This commit is contained in:
2025-10-24 17:06:14 -05:00
parent 12d0690b91
commit df8c75603f
11289 changed files with 1209053 additions and 318 deletions

View File

@@ -0,0 +1,21 @@
var __defProp = Object.defineProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
__export(exports, {
classToInvokable: () => classToInvokable
});
function classToInvokable(Class) {
return new Proxy(Class, {
apply(_target, _thisArg, args) {
return new Class(...args);
},
construct(_target, args) {
return new Class(...args);
}
});
}
//# sourceMappingURL=class-to-invokable.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/utils/class-to-invokable.ts"],
"sourcesContent": ["/**\n * Utility type for a class which can be called in addion to being used as a constructor.\n */\ninterface Invokeable<Args extends Array<any>, Instance> {\n (...args: Args): Instance;\n new (...args: Args): Instance;\n}\n\n/**\n * Wraps a constructor to not need the `new` keyword using a proxy.\n * Only used for data types.\n *\n * @param {ProxyConstructor} Class The class instance to wrap as invocable.\n * @returns {Proxy} Wrapped class instance.\n * @private\n */\nexport function classToInvokable<Args extends Array<any>, Instance extends object>(\n Class: new (...args: Args) => Instance\n): Invokeable<Args, Instance> {\n return new Proxy<Invokeable<Args, Instance>>(Class as any, {\n apply(_target, _thisArg, args: Args) {\n return new Class(...args);\n },\n construct(_target, args: Args) {\n return new Class(...args);\n }\n });\n}\n"],
"mappings": ";;;;;;;AAAA;AAAA;AAAA;AAgBO,0BACL,OAC4B;AAC5B,SAAO,IAAI,MAAkC,OAAc;AAAA,IACzD,MAAM,SAAS,UAAU,MAAY;AACnC,aAAO,IAAI,MAAM,GAAG;AAAA;AAAA,IAEtB,UAAU,SAAS,MAAY;AAC7B,aAAO,IAAI,MAAM,GAAG;AAAA;AAAA;AAAA;",
"names": []
}

View File

@@ -0,0 +1,39 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
__export(exports, {
noBoolOperatorAliases: () => noBoolOperatorAliases,
noDoubleNestedGroup: () => noDoubleNestedGroup,
noStringOperators: () => noStringOperators,
noTrueLogging: () => noTrueLogging,
unsupportedEngine: () => unsupportedEngine
});
var import_util = __toModule(require("util"));
const noop = () => {
};
const noTrueLogging = (0, import_util.deprecate)(noop, "The logging-option should be either a function or false. Default: console.log", "SEQUELIZE0002");
const noStringOperators = (0, import_util.deprecate)(noop, "String based operators are deprecated. Please use Symbol based operators for better security, read more at https://sequelize.org/master/manual/querying.html#operators", "SEQUELIZE0003");
const noBoolOperatorAliases = (0, import_util.deprecate)(noop, "A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed.", "SEQUELIZE0004");
const noDoubleNestedGroup = (0, import_util.deprecate)(noop, "Passing a double nested nested array to `group` is unsupported and will be removed in v6.", "SEQUELIZE0005");
const unsupportedEngine = (0, import_util.deprecate)(noop, "This database engine version is not supported, please update your database server. More information https://github.com/sequelize/sequelize/blob/main/ENGINE.md", "SEQUELIZE0006");
//# sourceMappingURL=deprecations.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/utils/deprecations.ts"],
"sourcesContent": ["import { deprecate } from 'util';\n\nconst noop = () => { /* noop */ };\n\nexport const noTrueLogging = deprecate(noop, 'The logging-option should be either a function or false. Default: console.log', 'SEQUELIZE0002');\nexport const noStringOperators = deprecate(noop, 'String based operators are deprecated. Please use Symbol based operators for better security, read more at https://sequelize.org/master/manual/querying.html#operators', 'SEQUELIZE0003');\nexport const noBoolOperatorAliases = deprecate(noop, 'A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed.', 'SEQUELIZE0004');\nexport const noDoubleNestedGroup = deprecate(noop, 'Passing a double nested nested array to `group` is unsupported and will be removed in v6.', 'SEQUELIZE0005');\nexport const unsupportedEngine = deprecate(noop, 'This database engine version is not supported, please update your database server. More information https://github.com/sequelize/sequelize/blob/main/ENGINE.md', 'SEQUELIZE0006');\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0B;AAE1B,MAAM,OAAO,MAAM;AAAA;AAEZ,MAAM,gBAAgB,2BAAU,MAAM,iFAAiF;AACvH,MAAM,oBAAoB,2BAAU,MAAM,0KAA0K;AACpN,MAAM,wBAAwB,2BAAU,MAAM,0GAA0G;AACxJ,MAAM,sBAAsB,2BAAU,MAAM,6FAA6F;AACzI,MAAM,oBAAoB,2BAAU,MAAM,kKAAkK;",
"names": []
}

View File

@@ -0,0 +1,68 @@
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
__export(exports, {
JoinSQLFragmentsError: () => JoinSQLFragmentsError,
joinSQLFragments: () => joinSQLFragments
});
function doesNotWantLeadingSpace(str) {
return /^[;,)]/.test(str);
}
function doesNotWantTrailingSpace(str) {
return /\($/.test(str);
}
function singleSpaceJoinHelper(parts) {
return parts.reduce(({ skipNextLeadingSpace, result }, part) => {
if (skipNextLeadingSpace || doesNotWantLeadingSpace(part)) {
result += part.trim();
} else {
result += ` ${part.trim()}`;
}
return {
skipNextLeadingSpace: doesNotWantTrailingSpace(part),
result
};
}, {
skipNextLeadingSpace: true,
result: ""
}).result;
}
function joinSQLFragments(array) {
if (array.length === 0)
return "";
const truthyArray = array.filter((x) => !!x);
const flattenedArray = truthyArray.map((fragment) => {
if (Array.isArray(fragment)) {
return joinSQLFragments(fragment);
}
return fragment;
});
for (const fragment of flattenedArray) {
if (fragment && typeof fragment !== "string") {
throw new JoinSQLFragmentsError(flattenedArray, fragment, `Tried to construct a SQL string with a non-string, non-falsy fragment (${fragment}).`);
}
}
const trimmedArray = flattenedArray.map((x) => x.trim());
const nonEmptyStringArray = trimmedArray.filter((x) => x !== "");
return singleSpaceJoinHelper(nonEmptyStringArray);
}
class JoinSQLFragmentsError extends TypeError {
constructor(args, fragment, message) {
super(message);
__publicField(this, "args");
__publicField(this, "fragment");
this.args = args;
this.fragment = fragment;
this.name = "JoinSQLFragmentsError";
}
}
//# sourceMappingURL=join-sql-fragments.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/utils/join-sql-fragments.ts"],
"sourcesContent": ["import { SQLFragment, TruthySQLFragment } from '../generic/sql-fragment';\n\nfunction doesNotWantLeadingSpace(str: string): boolean {\n return /^[;,)]/.test(str);\n}\nfunction doesNotWantTrailingSpace(str: string): boolean {\n return /\\($/.test(str);\n}\n\n/**\n * Joins an array of strings with a single space between them,\n * except for:\n *\n * - Strings starting with ';', ',' and ')', which do not get a leading space.\n * - Strings ending with '(', which do not get a trailing space.\n *\n * @param {string[]} parts\n * @returns {string}\n * @private\n */\nfunction singleSpaceJoinHelper(parts: string[]): string {\n return parts.reduce(\n ({ skipNextLeadingSpace, result }, part) => {\n if (skipNextLeadingSpace || doesNotWantLeadingSpace(part)) {\n result += part.trim();\n } else {\n result += ` ${part.trim()}`;\n }\n return {\n skipNextLeadingSpace: doesNotWantTrailingSpace(part),\n result\n };\n },\n {\n skipNextLeadingSpace: true,\n result: ''\n }\n ).result;\n}\n\n/**\n * Joins an array with a single space, auto trimming when needed.\n *\n * Certain elements do not get leading/trailing spaces.\n *\n * @param {SQLFragment[]} array The array to be joined. Falsy values are skipped. If an\n * element is another array, this function will be called recursively on that array.\n * Otherwise, if a non-string, non-falsy value is present, a TypeError will be thrown.\n *\n * @returns {string} The joined string.\n *\n * @private\n */\nexport function joinSQLFragments(array: SQLFragment[]): string {\n if (array.length === 0) return '';\n\n const truthyArray: TruthySQLFragment[] = array.filter(\n (x): x is string | SQLFragment[] => !!x\n );\n const flattenedArray: string[] = truthyArray.map(\n (fragment: TruthySQLFragment) => {\n if (Array.isArray(fragment)) {\n return joinSQLFragments(fragment);\n }\n\n return fragment;\n }\n );\n\n // Ensure strings\n for (const fragment of flattenedArray) {\n if (fragment && typeof fragment !== 'string') {\n throw new JoinSQLFragmentsError(\n flattenedArray,\n fragment,\n `Tried to construct a SQL string with a non-string, non-falsy fragment (${fragment}).`\n );\n }\n }\n\n // Trim fragments\n const trimmedArray = flattenedArray.map(x => x.trim());\n\n // Skip full-whitespace fragments (empty after the above trim)\n const nonEmptyStringArray = trimmedArray.filter(x => x !== '');\n\n return singleSpaceJoinHelper(nonEmptyStringArray);\n}\n\nexport class JoinSQLFragmentsError extends TypeError {\n args: SQLFragment[];\n fragment: any; // iirc this error is only used when we get an invalid fragment.\n\n constructor(args: SQLFragment[], fragment: any, message: string) {\n super(message);\n \n this.args = args;\n this.fragment = fragment;\n this.name = 'JoinSQLFragmentsError';\n }\n}\n"],
"mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAEA,iCAAiC,KAAsB;AACrD,SAAO,SAAS,KAAK;AAAA;AAEvB,kCAAkC,KAAsB;AACtD,SAAO,MAAM,KAAK;AAAA;AAcpB,+BAA+B,OAAyB;AACtD,SAAO,MAAM,OACX,CAAC,EAAE,sBAAsB,UAAU,SAAS;AAC1C,QAAI,wBAAwB,wBAAwB,OAAO;AACzD,gBAAU,KAAK;AAAA,WACV;AACL,gBAAU,IAAI,KAAK;AAAA;AAErB,WAAO;AAAA,MACL,sBAAsB,yBAAyB;AAAA,MAC/C;AAAA;AAAA,KAGJ;AAAA,IACE,sBAAsB;AAAA,IACtB,QAAQ;AAAA,KAEV;AAAA;AAgBG,0BAA0B,OAA8B;AAC7D,MAAI,MAAM,WAAW;AAAG,WAAO;AAE/B,QAAM,cAAmC,MAAM,OAC7C,CAAC,MAAmC,CAAC,CAAC;AAExC,QAAM,iBAA2B,YAAY,IAC3C,CAAC,aAAgC;AAC/B,QAAI,MAAM,QAAQ,WAAW;AAC3B,aAAO,iBAAiB;AAAA;AAG1B,WAAO;AAAA;AAKX,aAAW,YAAY,gBAAgB;AACrC,QAAI,YAAY,OAAO,aAAa,UAAU;AAC5C,YAAM,IAAI,sBACR,gBACA,UACA,0EAA0E;AAAA;AAAA;AAMhF,QAAM,eAAe,eAAe,IAAI,OAAK,EAAE;AAG/C,QAAM,sBAAsB,aAAa,OAAO,OAAK,MAAM;AAE3D,SAAO,sBAAsB;AAAA;AAGxB,oCAAoC,UAAU;AAAA,EAInD,YAAY,MAAqB,UAAe,SAAiB;AAC/D,UAAM;AAJR;AACA;AAKE,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,OAAO;AAAA;AAAA;",
"names": []
}

82
qwen/nodejs/node_modules/sequelize/lib/utils/logger.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
__export(exports, {
Logger: () => Logger,
logger: () => logger
});
var import_debug = __toModule(require("debug"));
var import_util = __toModule(require("util"));
class Logger {
constructor(_a = {}) {
__publicField(this, "config");
var _b = _a, { context = "sequelize" } = _b, rest = __objRest(_b, ["context"]);
this.config = __spreadValues({
context
}, rest);
}
warn(message) {
console.warn(`(${this.config.context}) Warning: ${message}`);
}
inspect(value) {
return import_util.default.inspect(value, {
showHidden: false,
depth: 1
});
}
debugContext(name) {
return (0, import_debug.default)(`${this.config.context}:${name}`);
}
}
const logger = new Logger();
//# sourceMappingURL=logger.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/utils/logger.ts"],
"sourcesContent": ["/**\n * @file Sequelize module for debug and deprecation messages.\n * It require a `context` for which messages will be printed.\n *\n * @module logging\n * @access package\n */\nimport nodeDebug from 'debug';\nimport util from 'util';\n\n/**\n * The configuration for sequelize's logging interface.\n *\n * @access package\n */\nexport interface LoggerConfig {\n /**\n * The context which the logger should log in.\n *\n * @default 'sequelize'\n */\n context?: string;\n}\n\nexport class Logger {\n protected config: LoggerConfig;\n\n constructor({ context = 'sequelize', ...rest }: Partial<LoggerConfig> = {}) {\n this.config = {\n context,\n ...rest\n };\n }\n\n /**\n * Logs a warning in the logger's context.\n *\n * @param message The message of the warning.\n */\n warn(message: string): void {\n console.warn(`(${this.config.context}) Warning: ${message}`);\n }\n\n /**\n * Uses node's util.inspect to stringify a value.\n *\n * @param value The value which should be inspected.\n * @returns The string of the inspected value.\n */\n inspect(value: unknown): string {\n return util.inspect(value, {\n showHidden: false,\n depth: 1\n });\n }\n\n /**\n * Gets a debugger for a context.\n *\n * @param name The name of the context.\n * @returns A debugger interace which can be used to debug.\n */\n debugContext(name: string): nodeDebug.Debugger {\n return nodeDebug(`${this.config.context}:${name}`);\n }\n}\n\nexport const logger = new Logger();\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAOA,mBAAsB;AACtB,kBAAiB;AAgBV,aAAa;AAAA,EAGlB,YAAY,KAA4D,IAAI;AAFlE;AAEE,iBAAE,YAAU,gBAAZ,IAA4B,iBAA5B,IAA4B,CAA1B;AACZ,SAAK,SAAS;AAAA,MACZ;AAAA,OACG;AAAA;AAAA,EASP,KAAK,SAAuB;AAC1B,YAAQ,KAAK,IAAI,KAAK,OAAO,qBAAqB;AAAA;AAAA,EASpD,QAAQ,OAAwB;AAC9B,WAAO,oBAAK,QAAQ,OAAO;AAAA,MACzB,YAAY;AAAA,MACZ,OAAO;AAAA;AAAA;AAAA,EAUX,aAAa,MAAkC;AAC7C,WAAO,0BAAU,GAAG,KAAK,OAAO,WAAW;AAAA;AAAA;AAIxC,MAAM,SAAS,IAAI;",
"names": []
}

180
qwen/nodejs/node_modules/sequelize/lib/utils/sql.js generated vendored Normal file
View File

@@ -0,0 +1,180 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
__export(exports, {
injectReplacements: () => injectReplacements
});
var import_isPlainObject = __toModule(require("lodash/isPlainObject"));
var import_sql_string = __toModule(require("../sql-string"));
function injectReplacements(sqlString, dialect, replacements) {
var _a, _b, _c, _d;
if (replacements == null) {
return sqlString;
}
if (!Array.isArray(replacements) && !(0, import_isPlainObject.default)(replacements)) {
throw new TypeError(`"replacements" must be an array or a plain object, but received ${JSON.stringify(replacements)} instead.`);
}
const isNamedReplacements = (0, import_isPlainObject.default)(replacements);
const isPositionalReplacements = Array.isArray(replacements);
let lastConsumedPositionalReplacementIndex = -1;
let output = "";
let currentDollarStringTagName = null;
let isString = false;
let isColumn = false;
let previousSliceEnd = 0;
let isSingleLineComment = false;
let isCommentBlock = false;
let stringIsBackslashEscapable = false;
for (let i = 0; i < sqlString.length; i++) {
const char = sqlString[i];
if (isColumn) {
if (char === dialect.TICK_CHAR_RIGHT) {
isColumn = false;
}
continue;
}
if (isString) {
if (char === "'" && (!stringIsBackslashEscapable || !isBackslashEscaped(sqlString, i - 1))) {
isString = false;
stringIsBackslashEscapable = false;
}
continue;
}
if (currentDollarStringTagName !== null) {
if (char !== "$") {
continue;
}
const remainingString = sqlString.slice(i, sqlString.length);
const dollarStringStartMatch = remainingString.match(/^\$(?<name>[a-z_][0-9a-z_]*)?(\$)/i);
const tagName = ((_a = dollarStringStartMatch == null ? void 0 : dollarStringStartMatch.groups) == null ? void 0 : _a.name) || "";
if (currentDollarStringTagName === tagName) {
currentDollarStringTagName = null;
}
continue;
}
if (isSingleLineComment) {
if (char === "\n") {
isSingleLineComment = false;
}
continue;
}
if (isCommentBlock) {
if (char === "*" && sqlString[i + 1] === "/") {
isCommentBlock = false;
}
continue;
}
if (char === dialect.TICK_CHAR_LEFT) {
isColumn = true;
continue;
}
if (char === "'") {
isString = true;
stringIsBackslashEscapable = dialect.canBackslashEscape() || dialect.supports.escapeStringConstants && (sqlString[i - 1] === "E" || sqlString[i - 1] === "e") && canPrecedeNewToken(sqlString[i - 2]);
continue;
}
if (char === "-" && sqlString.slice(i, i + 3) === "-- ") {
isSingleLineComment = true;
continue;
}
if (char === "/" && sqlString.slice(i, i + 2) === "/*") {
isCommentBlock = true;
continue;
}
if (char === "$") {
const previousChar = sqlString[i - 1];
if (/[0-9a-z_]/i.test(previousChar)) {
continue;
}
const remainingString = sqlString.slice(i, sqlString.length);
const dollarStringStartMatch = remainingString.match(/^\$(?<name>[a-z_][0-9a-z_]*)?(\$)/i);
if (dollarStringStartMatch) {
currentDollarStringTagName = (_c = (_b = dollarStringStartMatch.groups) == null ? void 0 : _b.name) != null ? _c : "";
i += dollarStringStartMatch[0].length - 1;
continue;
}
continue;
}
if (isNamedReplacements && char === ":") {
const previousChar = sqlString[i - 1];
if (!canPrecedeNewToken(previousChar) && previousChar !== "[") {
continue;
}
const remainingString = sqlString.slice(i, sqlString.length);
const match = remainingString.match(/^:(?<name>[a-z_][0-9a-z_]*)(?:\)|,|$|\s|::|;|])/i);
const replacementName = (_d = match == null ? void 0 : match.groups) == null ? void 0 : _d.name;
if (!replacementName) {
continue;
}
const replacementValue = replacements[replacementName];
if (!Object.prototype.hasOwnProperty.call(replacements, replacementName) || replacementValue === void 0) {
throw new Error(`Named replacement ":${replacementName}" has no entry in the replacement map.`);
}
const escapedReplacement = (0, import_sql_string.escape)(replacementValue, void 0, dialect.name, true);
output += sqlString.slice(previousSliceEnd, i);
previousSliceEnd = i + replacementName.length + 1;
output += escapedReplacement;
continue;
}
if (isPositionalReplacements && char === "?") {
const previousChar = sqlString[i - 1];
if (!canPrecedeNewToken(previousChar) && previousChar !== "[") {
continue;
}
const nextChar = sqlString[i + 1];
if (nextChar === "|" || nextChar === "&") {
continue;
}
const replacementIndex = ++lastConsumedPositionalReplacementIndex;
const replacementValue = replacements[lastConsumedPositionalReplacementIndex];
if (replacementValue === void 0) {
throw new Error(`Positional replacement (?) ${replacementIndex} has no entry in the replacement map (replacements[${replacementIndex}] is undefined).`);
}
const escapedReplacement = (0, import_sql_string.escape)(replacementValue, void 0, dialect.name, true);
output += sqlString.slice(previousSliceEnd, i);
previousSliceEnd = i + 1;
output += escapedReplacement;
}
}
if (isString) {
throw new Error(`The following SQL query includes an unterminated string literal:
${sqlString}`);
}
output += sqlString.slice(previousSliceEnd, sqlString.length);
return output;
}
function canPrecedeNewToken(char) {
return char === void 0 || /[\s(>,=]/.test(char);
}
function isBackslashEscaped(string, pos) {
let escaped = false;
for (let i = pos; i >= 0; i--) {
const char = string[i];
if (char !== "\\") {
break;
}
escaped = !escaped;
}
return escaped;
}
//# sourceMappingURL=sql.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,82 @@
"use strict";
const _ = require("lodash");
const validator = _.cloneDeep(require("validator"));
const moment = require("moment");
const extensions = {
extend(name, fn) {
this[name] = fn;
return this;
},
notEmpty(str) {
return !str.match(/^[\s\t\r\n]*$/);
},
len(str, min, max) {
return this.isLength(str, min, max);
},
isUrl(str) {
return this.isURL(str);
},
isIPv6(str) {
return this.isIP(str, 6);
},
isIPv4(str) {
return this.isIP(str, 4);
},
notIn(str, values) {
return !this.isIn(str, values);
},
regex(str, pattern, modifiers) {
str += "";
if (Object.prototype.toString.call(pattern).slice(8, -1) !== "RegExp") {
pattern = new RegExp(pattern, modifiers);
}
return str.match(pattern);
},
notRegex(str, pattern, modifiers) {
return !this.regex(str, pattern, modifiers);
},
isDecimal(str) {
return str !== "" && !!str.match(/^(?:-?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][+-]?(?:[0-9]+))?$/);
},
min(str, val) {
const number = parseFloat(str);
return isNaN(number) || number >= val;
},
max(str, val) {
const number = parseFloat(str);
return isNaN(number) || number <= val;
},
not(str, pattern, modifiers) {
return this.notRegex(str, pattern, modifiers);
},
contains(str, elem) {
return !!elem && str.includes(elem);
},
notContains(str, elem) {
return !this.contains(str, elem);
},
is(str, pattern, modifiers) {
return this.regex(str, pattern, modifiers);
}
};
exports.extensions = extensions;
validator.isImmutable = function(value, validatorArgs, field, modelInstance) {
return modelInstance.isNewRecord || modelInstance.dataValues[field] === modelInstance._previousDataValues[field];
};
validator.notNull = function(val) {
return val !== null && val !== void 0;
};
_.forEach(extensions, (extend, key) => {
validator[key] = extend;
});
validator.isNull = validator.isEmpty;
validator.isDate = function(dateString) {
const parsed = Date.parse(dateString);
if (isNaN(parsed)) {
return false;
}
const date = new Date(parsed);
return moment(date.toISOString()).isValid();
};
exports.validator = validator;
//# sourceMappingURL=validator-extras.js.map

View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/utils/validator-extras.js"],
"sourcesContent": ["'use strict';\n\nconst _ = require('lodash');\nconst validator = _.cloneDeep(require('validator'));\nconst moment = require('moment');\n\nconst extensions = {\n extend(name, fn) {\n this[name] = fn;\n\n return this;\n },\n notEmpty(str) {\n return !str.match(/^[\\s\\t\\r\\n]*$/);\n },\n len(str, min, max) {\n return this.isLength(str, min, max);\n },\n isUrl(str) {\n return this.isURL(str);\n },\n isIPv6(str) {\n return this.isIP(str, 6);\n },\n isIPv4(str) {\n return this.isIP(str, 4);\n },\n notIn(str, values) {\n return !this.isIn(str, values);\n },\n regex(str, pattern, modifiers) {\n str += '';\n if (Object.prototype.toString.call(pattern).slice(8, -1) !== 'RegExp') {\n pattern = new RegExp(pattern, modifiers);\n }\n return str.match(pattern);\n },\n notRegex(str, pattern, modifiers) {\n return !this.regex(str, pattern, modifiers);\n },\n isDecimal(str) {\n return str !== '' && !!str.match(/^(?:-?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][+-]?(?:[0-9]+))?$/);\n },\n min(str, val) {\n const number = parseFloat(str);\n return isNaN(number) || number >= val;\n },\n max(str, val) {\n const number = parseFloat(str);\n return isNaN(number) || number <= val;\n },\n not(str, pattern, modifiers) {\n return this.notRegex(str, pattern, modifiers);\n },\n contains(str, elem) {\n return !!elem && str.includes(elem);\n },\n notContains(str, elem) {\n return !this.contains(str, elem);\n },\n is(str, pattern, modifiers) {\n return this.regex(str, pattern, modifiers);\n }\n};\nexports.extensions = extensions;\n\n// instance based validators\nvalidator.isImmutable = function(value, validatorArgs, field, modelInstance) {\n return modelInstance.isNewRecord || modelInstance.dataValues[field] === modelInstance._previousDataValues[field];\n};\n\n// extra validators\nvalidator.notNull = function(val) {\n return val !== null && val !== undefined;\n};\n\n// https://github.com/chriso/validator.js/blob/6.2.0/validator.js\n_.forEach(extensions, (extend, key) => {\n validator[key] = extend;\n});\n\n// map isNull to isEmpty\n// https://github.com/chriso/validator.js/commit/e33d38a26ee2f9666b319adb67c7fc0d3dea7125\nvalidator.isNull = validator.isEmpty;\n\n// isDate removed in 7.0.0\n// https://github.com/chriso/validator.js/commit/095509fc707a4dc0e99f85131df1176ad6389fc9\nvalidator.isDate = function(dateString) {\n // avoid http://momentjs.com/guides/#/warnings/js-date/\n // by doing a preliminary check on `dateString`\n const parsed = Date.parse(dateString);\n if (isNaN(parsed)) {\n // fail if we can't parse it\n return false;\n }\n // otherwise convert to ISO 8601 as moment prefers\n // http://momentjs.com/docs/#/parsing/string/\n const date = new Date(parsed);\n return moment(date.toISOString()).isValid();\n};\n\nexports.validator = validator;\n"],
"mappings": ";AAEA,MAAM,IAAI,QAAQ;AAClB,MAAM,YAAY,EAAE,UAAU,QAAQ;AACtC,MAAM,SAAS,QAAQ;AAEvB,MAAM,aAAa;AAAA,EACjB,OAAO,MAAM,IAAI;AACf,SAAK,QAAQ;AAEb,WAAO;AAAA;AAAA,EAET,SAAS,KAAK;AACZ,WAAO,CAAC,IAAI,MAAM;AAAA;AAAA,EAEpB,IAAI,KAAK,KAAK,KAAK;AACjB,WAAO,KAAK,SAAS,KAAK,KAAK;AAAA;AAAA,EAEjC,MAAM,KAAK;AACT,WAAO,KAAK,MAAM;AAAA;AAAA,EAEpB,OAAO,KAAK;AACV,WAAO,KAAK,KAAK,KAAK;AAAA;AAAA,EAExB,OAAO,KAAK;AACV,WAAO,KAAK,KAAK,KAAK;AAAA;AAAA,EAExB,MAAM,KAAK,QAAQ;AACjB,WAAO,CAAC,KAAK,KAAK,KAAK;AAAA;AAAA,EAEzB,MAAM,KAAK,SAAS,WAAW;AAC7B,WAAO;AACP,QAAI,OAAO,UAAU,SAAS,KAAK,SAAS,MAAM,GAAG,QAAQ,UAAU;AACrE,gBAAU,IAAI,OAAO,SAAS;AAAA;AAEhC,WAAO,IAAI,MAAM;AAAA;AAAA,EAEnB,SAAS,KAAK,SAAS,WAAW;AAChC,WAAO,CAAC,KAAK,MAAM,KAAK,SAAS;AAAA;AAAA,EAEnC,UAAU,KAAK;AACb,WAAO,QAAQ,MAAM,CAAC,CAAC,IAAI,MAAM;AAAA;AAAA,EAEnC,IAAI,KAAK,KAAK;AACZ,UAAM,SAAS,WAAW;AAC1B,WAAO,MAAM,WAAW,UAAU;AAAA;AAAA,EAEpC,IAAI,KAAK,KAAK;AACZ,UAAM,SAAS,WAAW;AAC1B,WAAO,MAAM,WAAW,UAAU;AAAA;AAAA,EAEpC,IAAI,KAAK,SAAS,WAAW;AAC3B,WAAO,KAAK,SAAS,KAAK,SAAS;AAAA;AAAA,EAErC,SAAS,KAAK,MAAM;AAClB,WAAO,CAAC,CAAC,QAAQ,IAAI,SAAS;AAAA;AAAA,EAEhC,YAAY,KAAK,MAAM;AACrB,WAAO,CAAC,KAAK,SAAS,KAAK;AAAA;AAAA,EAE7B,GAAG,KAAK,SAAS,WAAW;AAC1B,WAAO,KAAK,MAAM,KAAK,SAAS;AAAA;AAAA;AAGpC,QAAQ,aAAa;AAGrB,UAAU,cAAc,SAAS,OAAO,eAAe,OAAO,eAAe;AAC3E,SAAO,cAAc,eAAe,cAAc,WAAW,WAAW,cAAc,oBAAoB;AAAA;AAI5G,UAAU,UAAU,SAAS,KAAK;AAChC,SAAO,QAAQ,QAAQ,QAAQ;AAAA;AAIjC,EAAE,QAAQ,YAAY,CAAC,QAAQ,QAAQ;AACrC,YAAU,OAAO;AAAA;AAKnB,UAAU,SAAS,UAAU;AAI7B,UAAU,SAAS,SAAS,YAAY;AAGtC,QAAM,SAAS,KAAK,MAAM;AAC1B,MAAI,MAAM,SAAS;AAEjB,WAAO;AAAA;AAIT,QAAM,OAAO,IAAI,KAAK;AACtB,SAAO,OAAO,KAAK,eAAe;AAAA;AAGpC,QAAQ,YAAY;",
"names": []
}