This commit is contained in:
2026-03-03 15:23:00 +00:00
parent 5e3726de39
commit 8e223bfbec
3689 changed files with 955330 additions and 1011 deletions

View File

@@ -0,0 +1,9 @@
import * as ts from 'typescript';
export declare function getDecorators(node: ts.Node, isMatching: (identifier: ts.Identifier) => boolean): ts.Identifier[];
export declare function getNodeFirstDecoratorName(node: ts.Node, isMatching: (identifier: ts.Identifier) => boolean): string | undefined;
export declare function getNodeFirstDecoratorValue(node: ts.Node, typeChecker: ts.TypeChecker, isMatching: (identifier: ts.Identifier) => boolean): any;
export declare function getDecoratorValues(decorator: ts.Identifier, typeChecker: ts.TypeChecker): any[];
export declare function getSecurites(decorator: ts.Identifier, typeChecker: ts.TypeChecker): any;
export declare function isDecorator(node: ts.Node, isMatching: (identifier: ts.Identifier) => boolean): boolean;
export declare function getPath(decorator: ts.Identifier, typeChecker: ts.TypeChecker): string;
export declare function getProduces(node: ts.Node, typeChecker: ts.TypeChecker): string[];

118
node_modules/@tsoa/cli/dist/utils/decoratorUtils.js generated vendored Normal file
View File

@@ -0,0 +1,118 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDecorators = getDecorators;
exports.getNodeFirstDecoratorName = getNodeFirstDecoratorName;
exports.getNodeFirstDecoratorValue = getNodeFirstDecoratorValue;
exports.getDecoratorValues = getDecoratorValues;
exports.getSecurites = getSecurites;
exports.isDecorator = isDecorator;
exports.getPath = getPath;
exports.getProduces = getProduces;
const ts = __importStar(require("typescript"));
const initializer_value_1 = require("../metadataGeneration/initializer-value");
function tsHasDecorators(tsNamespace) {
return typeof tsNamespace.canHaveDecorators === 'function';
}
function getDecorators(node, isMatching) {
// beginning in ts4.8 node.decorator is undefined, use getDecorators instead.
const decorators = tsHasDecorators(ts) && ts.canHaveDecorators(node) ? ts.getDecorators(node) : [];
if (!decorators || !decorators.length) {
return [];
}
return decorators
.map((e) => {
while (e.expression !== undefined) {
e = e.expression;
}
return e;
})
.filter(isMatching);
}
function getNodeFirstDecoratorName(node, isMatching) {
const decorators = getDecorators(node, isMatching);
if (!decorators || !decorators.length) {
return;
}
return decorators[0].text;
}
function getNodeFirstDecoratorValue(node, typeChecker, isMatching) {
const decorators = getDecorators(node, isMatching);
if (!decorators || !decorators.length) {
return;
}
const values = getDecoratorValues(decorators[0], typeChecker);
return values && values[0];
}
function getDecoratorValues(decorator, typeChecker) {
const expression = decorator.parent;
const expArguments = expression.arguments;
if (!expArguments || !expArguments.length) {
return [];
}
return expArguments.map(a => (0, initializer_value_1.getInitializerValue)(a, typeChecker));
}
function getSecurites(decorator, typeChecker) {
const [first, second] = getDecoratorValues(decorator, typeChecker);
if (isObject(first)) {
return first;
}
return { [first]: second || [] };
}
function isDecorator(node, isMatching) {
const decorators = getDecorators(node, isMatching);
if (!decorators || !decorators.length) {
return false;
}
return true;
}
function isObject(v) {
return typeof v === 'object' && v !== null;
}
function getPath(decorator, typeChecker) {
const [path] = getDecoratorValues(decorator, typeChecker);
if (path === undefined) {
return '';
}
return path;
}
function getProduces(node, typeChecker) {
const producesDecorators = getDecorators(node, identifier => identifier.text === 'Produces');
if (!producesDecorators || !producesDecorators.length) {
return [];
}
return producesDecorators.map(decorator => getDecoratorValues(decorator, typeChecker)[0]);
}
//# sourceMappingURL=decoratorUtils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"decoratorUtils.js","sourceRoot":"","sources":["../../src/utils/decoratorUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,sCAiBC;AAED,8DAOC;AAED,gEAOC;AAED,gDAOC;AAED,oCAMC;AAED,kCAMC;AAMD,0BAQC;AAED,kCAQC;AA9FD,+CAAiC;AACjC,+EAA8E;AAE9E,SAAS,eAAe,CAAC,WAAsB;IAI7C,OAAO,OAAO,WAAW,CAAC,iBAAiB,KAAK,UAAU,CAAC;AAC7D,CAAC;AAED,SAAgB,aAAa,CAAC,IAAa,EAAE,UAAkD;IAC7F,6EAA6E;IAC7E,MAAM,UAAU,GAAG,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnG,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,UAAU;SACd,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE;QACd,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAClC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC;QACnB,CAAC;QAED,OAAO,CAAkB,CAAC;IAC5B,CAAC,CAAC;SACD,MAAM,CAAC,UAAU,CAAC,CAAC;AACxB,CAAC;AAED,SAAgB,yBAAyB,CAAC,IAAa,EAAE,UAAkD;IACzG,MA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EAAE,EAAE,CAAC;AACnC,CAAC;AAED,SAAgB,WAAW,CAAC,IAAa,EAAE,UAAkD;IAC3F,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,CAAM;IACtB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED,SAAgB,OAAO,CAAC,SAAwB,EAAE,WAA2B;IAC3E,MAAM,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAE1D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,WAAW,CAAC,IAAa,EAAE,WAA2B;IACpE,MAAM,kBAAkB,GAAG,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAE7F,IAAI,CAAC,kBAAkB,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;QACtD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC"}

1
node_modules/@tsoa/cli/dist/utils/flowUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function throwUnless(condition: unknown, error: Error): asserts condition;

8
node_modules/@tsoa/cli/dist/utils/flowUtils.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.throwUnless = throwUnless;
function throwUnless(condition, error) {
if (!condition)
throw error;
}
//# sourceMappingURL=flowUtils.js.map

1
node_modules/@tsoa/cli/dist/utils/flowUtils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"flowUtils.js","sourceRoot":"","sources":["../../src/utils/flowUtils.ts"],"names":[],"mappings":";;AAAA,kCAEC;AAFD,SAAgB,WAAW,CAAC,SAAkB,EAAE,KAAY;IAC1D,IAAI,CAAC,SAAS;QAAE,MAAM,KAAK,CAAC;AAC9B,CAAC"}

5
node_modules/@tsoa/cli/dist/utils/fs.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import * as fs from 'fs';
export declare const fsExists: typeof fs.exists.__promisify__;
export declare const fsMkDir: typeof fs.mkdir.__promisify__;
export declare const fsWriteFile: typeof fs.writeFile.__promisify__;
export declare const fsReadFile: typeof fs.readFile.__promisify__;

43
node_modules/@tsoa/cli/dist/utils/fs.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.fsReadFile = exports.fsWriteFile = exports.fsMkDir = exports.fsExists = void 0;
const fs = __importStar(require("fs"));
const util_1 = require("util");
exports.fsExists = (0, util_1.promisify)(fs.exists);
exports.fsMkDir = (0, util_1.promisify)(fs.mkdir);
exports.fsWriteFile = (0, util_1.promisify)(fs.writeFile);
exports.fsReadFile = (0, util_1.promisify)(fs.readFile);
//# sourceMappingURL=fs.js.map

1
node_modules/@tsoa/cli/dist/utils/fs.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,+BAAiC;AAEpB,QAAA,QAAQ,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAChC,QAAA,OAAO,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAC9B,QAAA,WAAW,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,SAAS,CAAC,CAAC;AACtC,QAAA,UAAU,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,QAAQ,CAAC,CAAC"}

View File

@@ -0,0 +1 @@
export declare const isNotNullOrUndefined: <TValue>(value: TValue | null | undefined) => value is TValue;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNotNullOrUndefined = void 0;
const isNotNullOrUndefined = (value) => {
return value !== null && value !== undefined;
};
exports.isNotNullOrUndefined = isNotNullOrUndefined;
//# sourceMappingURL=genericTypeGuards.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"genericTypeGuards.js","sourceRoot":"","sources":["../../src/utils/genericTypeGuards.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAAS,KAAgC,EAAmB,EAAE;IAChG,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B"}

View File

@@ -0,0 +1,5 @@
import { Tsoa } from '@tsoa/runtime';
import { NodeArray, TypeNode } from 'typescript';
import { MetadataGenerator } from '../metadataGeneration/metadataGenerator';
export declare function getHeaderType(typeArgumentNodes: NodeArray<TypeNode> | undefined, index: number, metadataGenerator: MetadataGenerator): Tsoa.HeaderType | undefined;
export declare function isSupportedHeaderDataType(parameterType: Tsoa.Type): parameterType is Tsoa.HeaderType;

27
node_modules/@tsoa/cli/dist/utils/headerTypeHelpers.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHeaderType = getHeaderType;
exports.isSupportedHeaderDataType = isSupportedHeaderDataType;
const exceptions_1 = require("../metadataGeneration/exceptions");
const typeResolver_1 = require("../metadataGeneration/typeResolver");
function getHeaderType(typeArgumentNodes, index, metadataGenerator) {
if (!typeArgumentNodes || !typeArgumentNodes[index]) {
return undefined;
}
const candidate = new typeResolver_1.TypeResolver(typeArgumentNodes[index], metadataGenerator).resolve();
if (candidate && isSupportedHeaderDataType(candidate)) {
return candidate;
}
else if (candidate) {
throw new exceptions_1.GenerateMetadataError(`Unable to parse Header Type ${typeArgumentNodes[index].getText()}`, typeArgumentNodes[index]);
}
return undefined;
}
function isSupportedHeaderDataType(parameterType) {
const supportedPathDataTypes = ['nestedObjectLiteral', 'refObject'];
if (supportedPathDataTypes.find(t => t === parameterType.dataType)) {
return true;
}
return false;
}
//# sourceMappingURL=headerTypeHelpers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"headerTypeHelpers.js","sourceRoot":"","sources":["../../src/utils/headerTypeHelpers.ts"],"names":[],"mappings":";;AAMA,sCAcC;AAED,8DAOC;AA3BD,iEAAyE;AAEzE,qEAAkE;AAElE,SAAgB,aAAa,CAAC,iBAAkD,EAAE,KAAa,EAAE,iBAAoC;IACnI,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,2BAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC,CAAC,OAAO,EAAE,CAAC;IAE1F,IAAI,SAAS,IAAI,yBAAyB,CAAC,SAAS,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,kCAAqB,CAAC,+BAA+B,iBAAiB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IACjI,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,yBAAyB,CAAC,aAAwB;IAChE,MAAM,sBAAsB,GAA6B,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;IAC9F,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}

View File

@@ -0,0 +1,4 @@
/**
* Loads all exported classes from the given directory.
*/
export declare function importClassesFromDirectories(directories: string[], formats?: string[]): string[];

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.importClassesFromDirectories = importClassesFromDirectories;
const path_1 = require("path");
const glob_1 = require("glob");
/**
* Loads all exported classes from the given directory.
*/
function importClassesFromDirectories(directories, formats = ['.ts']) {
const allFiles = directories.reduce((allDirs, dir) => {
// glob docs says: Please only use forward-slashes in glob expressions.
// therefore do not do any normalization of dir path
return allDirs.concat((0, glob_1.sync)(dir));
}, []);
return allFiles.filter(file => {
const dtsExtension = file.substring(file.length - 5, file.length);
return formats.indexOf((0, path_1.extname)(file)) !== -1 && dtsExtension !== '.d.ts';
});
}
//# sourceMappingURL=importClassesFromDirectories.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"importClassesFromDirectories.js","sourceRoot":"","sources":["../../src/utils/importClassesFromDirectories.ts"],"names":[],"mappings":";;AAMA,oEAWC;AAjBD,+BAA+B;AAC/B,+BAA4B;AAE5B;;GAEG;AACH,SAAgB,4BAA4B,CAAC,WAAqB,EAAE,OAAO,GAAG,CAAC,KAAK,CAAC;IACnF,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QACnD,uEAAuE;QACvE,oDAAoD;QACpD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAC,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC,EAAE,EAAc,CAAC,CAAC;IAEnB,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,YAAY,KAAK,OAAO,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}

View File

@@ -0,0 +1,5 @@
import { Tsoa } from '@tsoa/runtime';
/**
* This will help us do exhaustive matching against only reference types. For example, once you have narrowed the input, you don't then have to check the case where it's a `integer` because it never will be.
*/
export declare function isRefType(metaType: Tsoa.Type): metaType is Tsoa.ReferenceType;

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRefType = isRefType;
// This file is designed to contain functions that narrow the input type to a type within src\metadataGeneration\tsoa.ts
const runtime_1 = require("@tsoa/runtime");
/**
* This will help us do exhaustive matching against only reference types. For example, once you have narrowed the input, you don't then have to check the case where it's a `integer` because it never will be.
*/
function isRefType(metaType) {
switch (metaType.dataType) {
case 'any':
return false;
case 'array':
return false;
case 'binary':
return false;
case 'boolean':
return false;
case 'buffer':
return false;
case 'byte':
return false;
case 'date':
return false;
case 'file':
return false;
case 'datetime':
return false;
case 'double':
return false;
case 'enum':
return false;
case 'float':
return false;
case 'integer':
return false;
case 'intersection':
return false;
case 'long':
return false;
case 'nestedObjectLiteral':
return false;
case 'object':
return false;
case 'refEnum':
return true;
case 'refObject':
return true;
case 'refAlias':
return true;
case 'string':
return false;
case 'tuple':
return false;
case 'union':
return false;
case 'void':
return false;
case 'undefined':
return false;
default: {
return (0, runtime_1.assertNever)(metaType);
}
}
}
//# sourceMappingURL=internalTypeGuards.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"internalTypeGuards.js","sourceRoot":"","sources":["../../src/utils/internalTypeGuards.ts"],"names":[],"mappings":";;AAMA,8BAwDC;AA9DD,wHAAwH;AACxH,2CAAkD;AAElD;;GAEG;AACH,SAAgB,SAAS,CAAC,QAAmB;IAC3C,QAAQ,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC1B,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,UAAU;YACb,OAAO,KAAK,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;QACf,KAAK,cAAc;YACjB,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,qBAAqB;YACxB,OAAO,KAAK,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,IAAI,CAAC;QACd,KAAK,WAAW;YACd,OAAO,IAAI,CAAC;QACd,KAAK,UAAU;YACb,OAAO,IAAI,CAAC;QACd,KAAK,QAAQ;YACX,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf,KAAK,WAAW;YACd,OAAO,KAAK,CAAC;QACf,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;AACH,CAAC"}

2
node_modules/@tsoa/cli/dist/utils/isVoidType.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Tsoa } from '@tsoa/runtime';
export declare const isVoidType: (type: Tsoa.Type) => boolean;

16
node_modules/@tsoa/cli/dist/utils/isVoidType.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isVoidType = void 0;
const isVoidType = (type) => {
if (type.dataType === 'void' || type.dataType === 'undefined') {
return true;
}
else if (type.dataType === 'refAlias') {
return (0, exports.isVoidType)(type.type);
}
else {
return false;
}
};
exports.isVoidType = isVoidType;
//# sourceMappingURL=isVoidType.js.map

1
node_modules/@tsoa/cli/dist/utils/isVoidType.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"isVoidType.js","sourceRoot":"","sources":["../../src/utils/isVoidType.ts"],"names":[],"mappings":";;;AAEO,MAAM,UAAU,GAAG,CAAC,IAAe,EAAW,EAAE;IACrD,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QACxC,OAAO,IAAA,kBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AARW,QAAA,UAAU,cAQrB"}

8
node_modules/@tsoa/cli/dist/utils/jsDocUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import * as ts from 'typescript';
export declare function getJSDocDescription(node: ts.Node): string | undefined;
export declare function getJSDocComment(node: ts.Node, tagName: string): string | undefined;
export declare function getJSDocComments(node: ts.Node, tagName: string): string[] | undefined;
export declare function getJSDocTagNames(node: ts.Node, requireTagName?: boolean): string[];
export declare function getJSDocTags(node: ts.Node, isMatching: (tag: ts.JSDocTag) => boolean): ts.JSDocTag[];
export declare function isExistJSDocTag(node: ts.Node, isMatching: (tag: ts.JSDocTag) => boolean): boolean;
export declare function commentToString(comment?: string | ts.NodeArray<ts.JSDocText | ts.JSDocLink | ts.JSDocComment>): string | undefined;

122
node_modules/@tsoa/cli/dist/utils/jsDocUtils.js generated vendored Normal file
View File

@@ -0,0 +1,122 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.getJSDocDescription = getJSDocDescription;
exports.getJSDocComment = getJSDocComment;
exports.getJSDocComments = getJSDocComments;
exports.getJSDocTagNames = getJSDocTagNames;
exports.getJSDocTags = getJSDocTags;
exports.isExistJSDocTag = isExistJSDocTag;
exports.commentToString = commentToString;
const ts = __importStar(require("typescript"));
const exceptions_1 = require("../metadataGeneration/exceptions");
function getJSDocDescription(node) {
const jsDocs = node.jsDoc;
if (!jsDocs || !jsDocs.length) {
return undefined;
}
return commentToString(jsDocs[0].comment) || undefined;
}
function getJSDocComment(node, tagName) {
const comments = getJSDocComments(node, tagName);
if (comments && comments.length !== 0) {
return comments[0];
}
return;
}
function getJSDocComments(node, tagName) {
const tags = getJSDocTags(node, tag => tag.tagName.text === tagName || tag.tagName.escapedText === tagName);
if (tags.length === 0) {
return;
}
const comments = [];
tags.forEach(tag => {
const comment = commentToString(tag.comment);
if (comment)
comments.push(comment);
});
return comments;
}
function getJSDocTagNames(node, requireTagName = false) {
let tags;
if (node.kind === ts.SyntaxKind.Parameter) {
const parameterName = node.name.text;
tags = getJSDocTags(node.parent, tag => {
if (ts.isJSDocParameterTag(tag)) {
return false;
}
else if (tag.comment === undefined) {
throw new exceptions_1.GenerateMetadataError(`Orphan tag: @${String(tag.tagName.text || tag.tagName.escapedText)} should have a parameter name follows with.`);
}
return commentToString(tag.comment)?.startsWith(parameterName) || false;
});
}
else {
tags = getJSDocTags(node, tag => {
return requireTagName ? tag.comment !== undefined : true;
});
}
return tags.map(tag => {
return tag.tagName.text;
});
}
function getJSDocTags(node, isMatching) {
const jsDocs = node.jsDoc;
if (!jsDocs || jsDocs.length === 0) {
return [];
}
const jsDoc = jsDocs[0];
if (!jsDoc.tags) {
return [];
}
return jsDoc.tags.filter(isMatching);
}
function isExistJSDocTag(node, isMatching) {
const tags = getJSDocTags(node, isMatching);
if (tags.length === 0) {
return false;
}
return true;
}
function commentToString(comment) {
if (typeof comment === 'string') {
return comment;
}
else if (comment) {
return comment.map(node => node.text).join(' ');
}
return undefined;
}
//# sourceMappingURL=jsDocUtils.js.map

1
node_modules/@tsoa/cli/dist/utils/jsDocUtils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"jsDocUtils.js","sourceRoot":"","sources":["../../src/utils/jsDocUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,kDAOC;AAED,0CAOC;AAED,4CAWC;AAED,4CAqBC;AAED,oCAYC;AAED,0CAMC;AAED,0CAQC;AAvFD,+CAAiC;AACjC,iEAAyE;AAEzE,SAAgB,mBAAmB,CAAC,IAAa;IAC/C,MAAM,MAAM,GAAI,IAAY,CAAC,KAAmB,CAAC;IACjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC;AACzD,CAAC;AAED,SAAgB,eAAe,CAAC,IAAa,EAAE,OAAe;IAC5D,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,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ChC,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,OAAO,EAAE,CAAC;QACnB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}

1
node_modules/@tsoa/cli/dist/utils/jsonUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function safeFromJson(json: string): any;

12
node_modules/@tsoa/cli/dist/utils/jsonUtils.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.safeFromJson = safeFromJson;
function safeFromJson(json) {
try {
return JSON.parse(json);
}
catch {
return undefined;
}
}
//# sourceMappingURL=jsonUtils.js.map

1
node_modules/@tsoa/cli/dist/utils/jsonUtils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"jsonUtils.js","sourceRoot":"","sources":["../../src/utils/jsonUtils.ts"],"names":[],"mappings":";;AAAA,oCAMC;AAND,SAAgB,YAAY,CAAC,IAAY;IACvC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}

9
node_modules/@tsoa/cli/dist/utils/pathUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* Removes all '/', '\', and spaces from the beginning and end of the path
* Replaces all '/', '\', and spaces between sections of the path
* Adds prefix and suffix if supplied
* Replace ':pathParam' with '{pathParam}'
*/
export declare function normalisePath(path: string, withPrefix?: string, withSuffix?: string, skipPrefixAndSuffixIfEmpty?: boolean): string;
export declare function convertColonPathParams(path: string): string;
export declare function convertBracesPathParams(path: string): string;

37
node_modules/@tsoa/cli/dist/utils/pathUtils.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalisePath = normalisePath;
exports.convertColonPathParams = convertColonPathParams;
exports.convertBracesPathParams = convertBracesPathParams;
/**
* Removes all '/', '\', and spaces from the beginning and end of the path
* Replaces all '/', '\', and spaces between sections of the path
* Adds prefix and suffix if supplied
* Replace ':pathParam' with '{pathParam}'
*/
function normalisePath(path, withPrefix, withSuffix, skipPrefixAndSuffixIfEmpty = true) {
if ((!path || path === '/') && skipPrefixAndSuffixIfEmpty) {
return '';
}
if (!path || typeof path !== 'string') {
path = '' + path;
}
// normalise beginning and end of the path
let normalised = path.replace(/^[/\\\s]+|[/\\\s]+$/g, '');
normalised = withPrefix ? withPrefix + normalised : normalised;
normalised = withSuffix ? normalised + withSuffix : normalised;
// normalise / signs amount in all path
normalised = normalised.replace(/[/\\\s]+/g, '/');
return normalised;
}
function convertColonPathParams(path) {
if (!path || typeof path !== 'string') {
return path;
}
const normalised = path.replace(/:([^/]+)/g, '{$1}');
return normalised;
}
function convertBracesPathParams(path) {
return path.replace(/{(\w*)}/g, ':$1');
}
//# sourceMappingURL=pathUtils.js.map

1
node_modules/@tsoa/cli/dist/utils/pathUtils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../../src/utils/pathUtils.ts"],"names":[],"mappings":";;AAMA,sCAcC;AAED,wDAOC;AAED,0DAEC;AAjCD;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,IAAY,EAAE,UAAmB,EAAE,UAAmB,EAAE,0BAA0B,GAAG,IAAI;IACrH,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,0BAA0B,EAAE,CAAC;QAC1D,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,0CAA0C;IAC1C,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IAC1D,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/D,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAC/D,uCAAuC;IACvC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAClD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAgB,sBAAsB,CAAC,IAAY;IACjD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACrD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAgB,uBAAuB,CAAC,IAAY;IAClD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC"}

3
node_modules/@tsoa/cli/dist/utils/swaggerUtils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare const DEFAULT_REQUEST_MEDIA_TYPE = "application/json";
export declare const DEFAULT_RESPONSE_MEDIA_TYPE = "application/json";
export declare function getValue(type: 'string' | 'number' | 'integer' | 'boolean' | undefined, member: unknown): string | number | boolean | null;

22
node_modules/@tsoa/cli/dist/utils/swaggerUtils.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_RESPONSE_MEDIA_TYPE = exports.DEFAULT_REQUEST_MEDIA_TYPE = void 0;
exports.getValue = getValue;
exports.DEFAULT_REQUEST_MEDIA_TYPE = 'application/json';
exports.DEFAULT_RESPONSE_MEDIA_TYPE = 'application/json';
function getValue(type, member) {
if (type == null || member == null) {
return null;
}
switch (type) {
case 'integer':
case 'number':
return Number(member);
case 'boolean':
return !!member;
case 'string':
default:
return String(member);
}
}
//# sourceMappingURL=swaggerUtils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"swaggerUtils.js","sourceRoot":"","sources":["../../src/utils/swaggerUtils.ts"],"names":[],"mappings":";;;AAGA,4BAeC;AAlBY,QAAA,0BAA0B,GAAG,kBAAkB,CAAC;AAChD,QAAA,2BAA2B,GAAG,kBAAkB,CAAC;AAE9D,SAAgB,QAAQ,CAAC,IAA6D,EAAE,MAAe;IACrG,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;QACxB,KAAK,SAAS;YACZ,OAAO,CAAC,CAAC,MAAM,CAAC;QAClB,KAAK,QAAQ,CAAC;QACd;YACE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}

View File

@@ -0,0 +1,3 @@
export type UnspecifiedObject = {
[key: string]: unknown;
};

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=unspecifiedObject.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"unspecifiedObject.js","sourceRoot":"","sources":["../../src/utils/unspecifiedObject.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,5 @@
import { Tsoa } from '@tsoa/runtime';
import * as ts from 'typescript';
export declare function getParameterValidators(parameter: ts.ParameterDeclaration, parameterName: string): Tsoa.Validators;
export declare function getPropertyValidators(property: ts.Node): Tsoa.Validators | undefined;
export declare function shouldIncludeValidatorInSchema(key: string): key is Tsoa.SchemaValidatorKey;

241
node_modules/@tsoa/cli/dist/utils/validatorUtils.js generated vendored Normal file
View File

@@ -0,0 +1,241 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getParameterValidators = getParameterValidators;
exports.getPropertyValidators = getPropertyValidators;
exports.shouldIncludeValidatorInSchema = shouldIncludeValidatorInSchema;
const validator_1 = __importDefault(require("validator"));
const exceptions_1 = require("./../metadataGeneration/exceptions");
const jsDocUtils_1 = require("./jsDocUtils");
function getParameterValidators(parameter, parameterName) {
if (!parameter.parent) {
return {};
}
const getCommentValue = (comment) => comment && comment.split(' ')[0];
const tags = (0, jsDocUtils_1.getJSDocTags)(parameter.parent, tag => {
const { comment } = tag;
return getParameterTagSupport().some(value => !!(0, jsDocUtils_1.commentToString)(comment) && value === tag.tagName.text && getCommentValue((0, jsDocUtils_1.commentToString)(comment)) === parameterName);
});
function getErrorMsg(comment, isValue = true) {
if (!comment) {
return;
}
if (isValue) {
const indexOf = comment.indexOf(' ');
if (indexOf > 0) {
return comment.substr(indexOf + 1);
}
else {
return undefined;
}
}
else {
return comment;
}
}
return tags.reduce((validateObj, tag) => {
if (!tag.comment) {
return validateObj;
}
const name = tag.tagName.text;
const comment = (0, jsDocUtils_1.commentToString)(tag.comment)
?.substring(((0, jsDocUtils_1.commentToString)(tag.comment)?.indexOf(' ') || -1) + 1)
.trim();
const value = getCommentValue(comment);
switch (name) {
case 'uniqueItems':
validateObj[name] = {
errorMsg: getErrorMsg(comment, false),
value: undefined,
};
break;
case 'minimum':
case 'maximum':
case 'minItems':
case 'maxItems':
case 'minLength':
case 'maxLength':
if (isNaN(value)) {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use number.`);
}
validateObj[name] = {
errorMsg: getErrorMsg(comment),
value: Number(value),
};
break;
case 'minDate':
case 'maxDate':
if (!validator_1.default.isISO8601(String(value), { strict: true })) {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use date format ISO 8601 ex. 2017-05-14, 2017-05-14T05:18Z`);
}
validateObj[name] = {
errorMsg: getErrorMsg(comment),
value,
};
break;
case 'pattern':
if (typeof value !== 'string') {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use string.`);
}
validateObj[name] = {
errorMsg: getErrorMsg(comment),
value: removeSurroundingQuotes(value),
};
break;
default:
if (name.startsWith('is')) {
const errorMsg = getErrorMsg(comment, false);
if (errorMsg) {
validateObj[name] = {
errorMsg,
value: undefined,
};
}
}
break;
}
return validateObj;
}, {});
}
function getPropertyValidators(property) {
const tags = (0, jsDocUtils_1.getJSDocTags)(property, tag => {
return getParameterTagSupport().some(value => value === tag.tagName.text);
});
function getValue(comment) {
if (!comment) {
return;
}
return comment.split(' ')[0];
}
function getFullValue(comment) {
if (!comment) {
return;
}
if (comment.includes('\n')) {
return comment.split('\n')[0];
}
return comment;
}
function getErrorMsg(comment, isValue = true) {
if (!comment) {
return;
}
if (isValue) {
const indexOf = comment.indexOf(' ');
if (indexOf > 0) {
return comment.substr(indexOf + 1);
}
else {
return undefined;
}
}
else {
return comment;
}
}
return tags.reduce((validateObj, tag) => {
const name = tag.tagName.text;
const comment = tag.comment;
const value = getValue((0, jsDocUtils_1.commentToString)(comment));
switch (name) {
case 'uniqueItems':
validateObj[name] = {
errorMsg: getErrorMsg((0, jsDocUtils_1.commentToString)(comment), false),
value: undefined,
};
break;
case 'minimum':
case 'maximum':
case 'minItems':
case 'maxItems':
case 'minLength':
case 'maxLength':
if (isNaN(value)) {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use number.`);
}
validateObj[name] = {
errorMsg: getErrorMsg((0, jsDocUtils_1.commentToString)(comment)),
value: Number(value),
};
break;
case 'minDate':
case 'maxDate':
if (!validator_1.default.isISO8601(String(value), { strict: true })) {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use date format ISO 8601 ex. 2017-05-14, 2017-05-14T05:18Z`);
}
validateObj[name] = {
errorMsg: getErrorMsg((0, jsDocUtils_1.commentToString)(comment)),
value,
};
break;
case 'pattern':
if (typeof value !== 'string') {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use string.`);
}
validateObj[name] = {
errorMsg: getErrorMsg((0, jsDocUtils_1.commentToString)(comment)),
value: removeSurroundingQuotes(value),
};
break;
case 'title':
if (typeof value !== 'string') {
throw new exceptions_1.GenerateMetadataError(`${name} parameter use string.`);
}
validateObj[name] = {
errorMsg: getErrorMsg((0, jsDocUtils_1.commentToString)(comment)),
value: getFullValue((0, jsDocUtils_1.commentToString)(comment)),
};
break;
default:
if (name.startsWith('is')) {
const errorMsg = getErrorMsg((0, jsDocUtils_1.commentToString)(comment), false);
if (errorMsg) {
validateObj[name] = {
errorMsg,
value: undefined,
};
}
}
break;
}
return validateObj;
}, {});
}
function getParameterTagSupport() {
return [
'isString',
'isBoolean',
'isInt',
'isLong',
'isFloat',
'isDouble',
'isDate',
'isDateTime',
'minItems',
'maxItems',
'uniqueItems',
'minLength',
'maxLength',
'pattern',
'minimum',
'maximum',
'minDate',
'maxDate',
'title',
];
}
function removeSurroundingQuotes(str) {
if (str.startsWith('`') && str.endsWith('`')) {
return str.substring(1, str.length - 1);
}
if (str.startsWith('```') && str.endsWith('```')) {
return str.substring(3, str.length - 3);
}
return str;
}
function shouldIncludeValidatorInSchema(key) {
return !key.startsWith('is') && key !== 'minDate' && key !== 'maxDate';
}
//# sourceMappingURL=validatorUtils.js.map

File diff suppressed because one or more lines are too long