Comparing version 5.1.1 to 6.0.0-rc.0
@@ -28,4 +28,12 @@ #!/usr/bin/env node | ||
} | ||
export declare function runCLI(): void; | ||
export declare function runCLI(): { | ||
[x: string]: unknown; | ||
_: (string | number)[]; | ||
$0: string; | ||
} | Promise<{ | ||
[x: string]: unknown; | ||
_: (string | number)[]; | ||
$0: string; | ||
}>; | ||
export declare function generateSpecAndRoutes(args: SwaggerArgs, metadata?: Tsoa.Metadata): Promise<Tsoa.Metadata>; | ||
export {}; |
#!/usr/bin/env node | ||
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateSpecAndRoutes = exports.runCLI = exports.validateSpecConfig = void 0; | ||
const path = require("path"); | ||
const YAML = require("yamljs"); | ||
const yargs = require("yargs"); | ||
const yamljs_1 = __importDefault(require("yamljs")); | ||
const yargs_1 = __importDefault(require("yargs")); | ||
const helpers_1 = require("yargs/helpers"); | ||
@@ -13,2 +38,3 @@ const metadataGenerator_1 = require("./metadataGeneration/metadataGenerator"); | ||
const fs_1 = require("./utils/fs"); | ||
const node_path_1 = require("node:path"); | ||
const workingDir = process.cwd(); | ||
@@ -42,11 +68,10 @@ let packageJson; | ||
const getConfig = async (configPath = 'tsoa.json') => { | ||
var _a; | ||
let config; | ||
const ext = path.extname(configPath); | ||
const ext = (0, node_path_1.extname)(configPath); | ||
try { | ||
if (ext === '.yaml' || ext === '.yml') { | ||
config = YAML.load(configPath); | ||
config = yamljs_1.default.load(configPath); | ||
} | ||
else if (ext === '.js') { | ||
config = await (_a = `${workingDir}/${configPath}`, Promise.resolve().then(() => require(_a))); | ||
config = await Promise.resolve(`${`${workingDir}/${configPath}`}`).then(s => __importStar(require(s))); | ||
} | ||
@@ -120,10 +145,10 @@ else { | ||
const contact = /^([^<(]*)?\s*(?:<([^>(]*)>)?\s*(?:\(([^)]*)\)|$)/m.exec(author); | ||
config.spec.contact.name = config.spec.contact.name || (contact === null || contact === void 0 ? void 0 : contact[1]); | ||
config.spec.contact.email = config.spec.contact.email || (contact === null || contact === void 0 ? void 0 : contact[2]); | ||
config.spec.contact.url = config.spec.contact.url || (contact === null || contact === void 0 ? void 0 : contact[3]); | ||
config.spec.contact.name = config.spec.contact.name || contact?.[1]; | ||
config.spec.contact.email = config.spec.contact.email || contact?.[2]; | ||
config.spec.contact.url = config.spec.contact.url || contact?.[3]; | ||
} | ||
else if (typeof author === 'object') { | ||
config.spec.contact.name = config.spec.contact.name || (author === null || author === void 0 ? void 0 : author.name); | ||
config.spec.contact.email = config.spec.contact.email || (author === null || author === void 0 ? void 0 : author.email); | ||
config.spec.contact.url = config.spec.contact.url || (author === null || author === void 0 ? void 0 : author.url); | ||
config.spec.contact.name = config.spec.contact.name || author?.name; | ||
config.spec.contact.email = config.spec.contact.email || author?.email; | ||
config.spec.contact.url = config.spec.contact.url || author?.url; | ||
} | ||
@@ -203,3 +228,3 @@ if (config.spec.rootSecurity) { | ||
function runCLI() { | ||
void yargs((0, helpers_1.hideBin)(process.argv)) | ||
return (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)) | ||
.usage('Usage: $0 <command> [options]') | ||
@@ -230,4 +255,14 @@ .command('spec', 'Generate OpenAPI spec', { | ||
exports.runCLI = runCLI; | ||
if (require.main === module) | ||
runCLI(); | ||
if (require.main === module) { | ||
void (async () => { | ||
try { | ||
await runCLI(); | ||
} | ||
catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error('tsoa cli error:\n', err); | ||
process.exit(1); | ||
} | ||
})(); | ||
} | ||
async function SpecGenerator(args) { | ||
@@ -234,0 +269,0 @@ try { |
@@ -1,4 +0,4 @@ | ||
import * as ts from 'typescript'; | ||
import { MetadataGenerator } from './metadataGenerator'; | ||
import { Tsoa } from '@tsoa/runtime'; | ||
import { type ClassDeclaration } from 'typescript'; | ||
export declare class ControllerGenerator { | ||
@@ -14,3 +14,3 @@ private readonly node; | ||
private readonly produces?; | ||
constructor(node: ts.ClassDeclaration, current: MetadataGenerator, parentSecurity?: Tsoa.Security[]); | ||
constructor(node: ClassDeclaration, current: MetadataGenerator, parentSecurity?: Tsoa.Security[]); | ||
IsValid(): boolean; | ||
@@ -17,0 +17,0 @@ Generate(): Tsoa.Controller; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ControllerGenerator = void 0; | ||
const ts = require("typescript"); | ||
const decoratorUtils_1 = require("./../utils/decoratorUtils"); | ||
@@ -10,2 +9,3 @@ const exceptions_1 = require("./exceptions"); | ||
const headerTypeHelpers_1 = require("../utils/headerTypeHelpers"); | ||
const typescript_1 = require("typescript"); | ||
class ControllerGenerator { | ||
@@ -44,3 +44,3 @@ constructor(node, current, parentSecurity = []) { | ||
return this.node.members | ||
.filter(ts.isMethodDeclaration) | ||
.filter(typescript_1.isMethodDeclaration) | ||
.map(m => new methodGenerator_1.MethodGenerator(m, this.current, this.commonResponses, this.path, this.tags, this.security, this.isHidden)) | ||
@@ -98,6 +98,6 @@ .filter(generator => generator.IsValid()) | ||
const securityDecorators = (0, decoratorUtils_1.getDecorators)(this.node, identifier => identifier.text === 'Security'); | ||
if ((noSecurityDecorators === null || noSecurityDecorators === void 0 ? void 0 : noSecurityDecorators.length) && (securityDecorators === null || securityDecorators === void 0 ? void 0 : securityDecorators.length)) { | ||
if (noSecurityDecorators?.length && securityDecorators?.length) { | ||
throw new exceptions_1.GenerateMetadataError(`NoSecurity decorator cannot be used in conjunction with Security decorator in '${this.node.name.text}' class.`); | ||
} | ||
if (noSecurityDecorators === null || noSecurityDecorators === void 0 ? void 0 : noSecurityDecorators.length) { | ||
if (noSecurityDecorators?.length) { | ||
return []; | ||
@@ -104,0 +104,0 @@ } |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getExtensionsFromJSDocComments = exports.getExtensions = void 0; | ||
const ts = require("typescript"); | ||
const ts = __importStar(require("typescript")); | ||
const initializer_value_1 = require("./initializer-value"); | ||
@@ -6,0 +29,0 @@ const jsonUtils_1 = require("../utils/jsonUtils"); |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getInitializerValue = void 0; | ||
const ts = require("typescript"); | ||
const ts = __importStar(require("typescript")); | ||
const hasInitializer = (node) => Object.prototype.hasOwnProperty.call(node, 'initializer'); | ||
const extractInitializer = (decl) => (decl && hasInitializer(decl) && decl.initializer) || undefined; | ||
const extractImportSpecifier = (symbol) => ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.declarations.length > 0 && ts.isImportSpecifier(symbol.declarations[0]) && symbol.declarations[0]) || undefined; | ||
const extractImportSpecifier = (symbol) => (symbol?.declarations && symbol.declarations.length > 0 && ts.isImportSpecifier(symbol.declarations[0]) && symbol.declarations[0]) || undefined; | ||
const getInitializerValue = (initializer, typeChecker, type) => { | ||
@@ -80,3 +103,3 @@ if (!initializer || !typeChecker) { | ||
const symbol = typeChecker.getSymbolAtLocation(initializer); | ||
return (0, exports.getInitializerValue)(extractInitializer(symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) || extractImportSpecifier(symbol), typeChecker); | ||
return (0, exports.getInitializerValue)(extractInitializer(symbol?.valueDeclaration) || extractImportSpecifier(symbol), typeChecker); | ||
} | ||
@@ -83,0 +106,0 @@ } |
@@ -1,3 +0,3 @@ | ||
import * as ts from 'typescript'; | ||
import { Tsoa } from '@tsoa/runtime'; | ||
import { type TypeChecker, type ClassDeclaration, type CompilerOptions } from 'typescript'; | ||
export declare class MetadataGenerator { | ||
@@ -7,8 +7,8 @@ private readonly compilerOptions?; | ||
private readonly rootSecurity; | ||
readonly controllerNodes: ts.ClassDeclaration[]; | ||
readonly typeChecker: ts.TypeChecker; | ||
readonly controllerNodes: ClassDeclaration[]; | ||
readonly typeChecker: TypeChecker; | ||
private readonly program; | ||
private referenceTypeMap; | ||
private circularDependencyResolvers; | ||
constructor(entryFile: string, compilerOptions?: ts.CompilerOptions | undefined, ignorePaths?: string[] | undefined, controllers?: string[], rootSecurity?: Tsoa.Security[]); | ||
constructor(entryFile: string, compilerOptions?: CompilerOptions | undefined, ignorePaths?: string[] | undefined, controllers?: string[], rootSecurity?: Tsoa.Security[]); | ||
Generate(): Tsoa.Metadata; | ||
@@ -19,3 +19,3 @@ private setProgramToDynamicControllersFiles; | ||
private checkForPathParamSignatureDuplicates; | ||
TypeChecker(): ts.TypeChecker; | ||
TypeChecker(): TypeChecker; | ||
AddReferenceType(referenceType: Tsoa.ReferenceType): void; | ||
@@ -22,0 +22,0 @@ GetReferenceType(refName: string): Tsoa.ReferenceType; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MetadataGenerator = void 0; | ||
const mm = require("minimatch"); | ||
const ts = require("typescript"); | ||
const minimatch_1 = __importDefault(require("minimatch")); | ||
const importClassesFromDirectories_1 = require("../utils/importClassesFromDirectories"); | ||
@@ -11,2 +13,3 @@ const controllerGenerator_1 = require("./controllerGenerator"); | ||
const decoratorUtils_1 = require("../utils/decoratorUtils"); | ||
const typescript_1 = require("typescript"); | ||
class MetadataGenerator { | ||
@@ -76,6 +79,6 @@ constructor(entryFile, compilerOptions, ignorePaths, controllers, rootSecurity = []) { | ||
method, | ||
path: (params === null || params === void 0 ? void 0 : params.reduce((s, a) => { | ||
path: params?.reduce((s, a) => { | ||
// replace all params with {} placeholder for comparison | ||
return s.replace(a, '{}'); | ||
}, method.path)) || method.path, | ||
}, method.path) || method.path, | ||
}); | ||
@@ -134,3 +137,3 @@ }); | ||
typeResolver_1.TypeResolver.clearCache(); | ||
this.program = controllers ? this.setProgramToDynamicControllersFiles(controllers) : ts.createProgram([entryFile], compilerOptions || {}); | ||
this.program = controllers ? this.setProgramToDynamicControllersFiles(controllers) : (0, typescript_1.createProgram)([entryFile], compilerOptions || {}); | ||
this.typeChecker = this.program.getTypeChecker(); | ||
@@ -154,3 +157,3 @@ } | ||
} | ||
return ts.createProgram(allGlobFiles, this.compilerOptions || {}); | ||
return (0, typescript_1.createProgram)(allGlobFiles, this.compilerOptions || {}); | ||
} | ||
@@ -161,3 +164,3 @@ extractNodeFromProgramSourceFiles() { | ||
for (const path of this.ignorePaths) { | ||
if (mm(sf.fileName, path)) { | ||
if ((0, minimatch_1.default)(sf.fileName, path)) { | ||
return; | ||
@@ -167,4 +170,4 @@ } | ||
} | ||
ts.forEachChild(sf, node => { | ||
if (ts.isClassDeclaration(node) && (0, decoratorUtils_1.getDecorators)(node, identifier => identifier.text === 'Route').length) { | ||
(0, typescript_1.forEachChild)(sf, node => { | ||
if ((0, typescript_1.isClassDeclaration)(node) && (0, decoratorUtils_1.getDecorators)(node, identifier => identifier.text === 'Route').length) { | ||
this.controllerNodes.push(node); | ||
@@ -171,0 +174,0 @@ } |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MethodGenerator = void 0; | ||
const ts = require("typescript"); | ||
const path = require("path"); | ||
const ts = __importStar(require("typescript")); | ||
const path = __importStar(require("path")); | ||
const isVoidType_1 = require("../utils/isVoidType"); | ||
@@ -179,4 +202,4 @@ const decoratorUtils_1 = require("./../utils/decoratorUtils"); | ||
description: (0, isVoidType_1.isVoidType)(type) ? 'No content' : returnsDescription, | ||
examples: examplesWithLabels === null || examplesWithLabels === void 0 ? void 0 : examplesWithLabels.map(ex => ex.example), | ||
exampleLabels: examplesWithLabels === null || examplesWithLabels === void 0 ? void 0 : examplesWithLabels.map(ex => ex.label), | ||
examples: examplesWithLabels?.map(ex => ex.example), | ||
exampleLabels: examplesWithLabels?.map(ex => ex.label), | ||
name: (0, isVoidType_1.isVoidType)(type) ? '204' : '200', | ||
@@ -197,4 +220,4 @@ produces: this.produces, | ||
description: description || '', | ||
examples: examplesWithLabels === null || examplesWithLabels === void 0 ? void 0 : examplesWithLabels.map(ex => ex.example), | ||
exampleLabels: examplesWithLabels === null || examplesWithLabels === void 0 ? void 0 : examplesWithLabels.map(ex => ex.label), | ||
examples: examplesWithLabels?.map(ex => ex.example), | ||
exampleLabels: examplesWithLabels?.map(ex => ex.label), | ||
name: name || '200', | ||
@@ -215,4 +238,3 @@ produces: this.getProducesAdapter(produces), | ||
getSchemaFromDecorator({ parent: expression }, schemaIndex) { | ||
var _a; | ||
if (!ts.isCallExpression(expression) || !((_a = expression.typeArguments) === null || _a === void 0 ? void 0 : _a.length)) { | ||
if (!ts.isCallExpression(expression) || !expression.typeArguments?.length) { | ||
return undefined; | ||
@@ -277,9 +299,9 @@ } | ||
const securityDecorators = this.getDecoratorsByIdentifier(this.node, 'Security'); | ||
if ((noSecurityDecorators === null || noSecurityDecorators === void 0 ? void 0 : noSecurityDecorators.length) > 1) { | ||
if (noSecurityDecorators?.length > 1) { | ||
throw new exceptions_1.GenerateMetadataError(`Only one NoSecurity decorator allowed in '${this.getCurrentLocation()}' method.`); | ||
} | ||
if ((noSecurityDecorators === null || noSecurityDecorators === void 0 ? void 0 : noSecurityDecorators.length) && (securityDecorators === null || securityDecorators === void 0 ? void 0 : securityDecorators.length)) { | ||
if (noSecurityDecorators?.length && securityDecorators?.length) { | ||
throw new exceptions_1.GenerateMetadataError(`NoSecurity decorator cannot be used in conjunction with Security decorator in '${this.getCurrentLocation()}' method.`); | ||
} | ||
if (noSecurityDecorators === null || noSecurityDecorators === void 0 ? void 0 : noSecurityDecorators.length) { | ||
if (noSecurityDecorators?.length) { | ||
return []; | ||
@@ -286,0 +308,0 @@ } |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ParameterGenerator = void 0; | ||
const ts = require("typescript"); | ||
const ts = __importStar(require("typescript")); | ||
const decoratorUtils_1 = require("./../utils/decoratorUtils"); | ||
@@ -182,3 +205,2 @@ const jsDocUtils_1 = require("./../utils/jsDocUtils"); | ||
getUploadedFileParameter(parameter, isArray) { | ||
var _a; | ||
const parameterName = parameter.name.text; | ||
@@ -199,3 +221,3 @@ const elementType = { dataType: 'file' }; | ||
in: 'formData', | ||
name: (_a = (0, decoratorUtils_1.getNodeFirstDecoratorValue)(this.parameter, this.current.typeChecker, ident => { | ||
name: (0, decoratorUtils_1.getNodeFirstDecoratorValue)(this.parameter, this.current.typeChecker, ident => { | ||
if (isArray) { | ||
@@ -205,3 +227,3 @@ return ident.text === 'UploadedFiles'; | ||
return ident.text === 'UploadedFile'; | ||
})) !== null && _a !== void 0 ? _a : parameterName, | ||
}) ?? parameterName, | ||
required: !parameter.questionToken && !parameter.initializer, | ||
@@ -215,3 +237,2 @@ type, | ||
getFormFieldParameter(parameter) { | ||
var _a; | ||
const parameterName = parameter.name.text; | ||
@@ -225,3 +246,3 @@ const type = { dataType: 'string' }; | ||
in: 'formData', | ||
name: (_a = (0, decoratorUtils_1.getNodeFirstDecoratorValue)(this.parameter, this.current.typeChecker, ident => ident.text === 'FormField')) !== null && _a !== void 0 ? _a : parameterName, | ||
name: (0, decoratorUtils_1.getNodeFirstDecoratorValue)(this.parameter, this.current.typeChecker, ident => ident.text === 'FormField') ?? parameterName, | ||
required: !parameter.questionToken && !parameter.initializer, | ||
@@ -356,10 +377,10 @@ type, | ||
const comment = (0, jsDocUtils_1.commentToString)(tag.comment); | ||
const isExample = (tag.tagName.text === 'example' || tag.tagName.escapedText === 'example') && !!tag.comment && (comment === null || comment === void 0 ? void 0 : comment.startsWith(parameterName)); | ||
const isExample = (tag.tagName.text === 'example' || tag.tagName.escapedText === 'example') && !!tag.comment && comment?.startsWith(parameterName); | ||
if (isExample) { | ||
const hasExampleLabel = ((comment === null || comment === void 0 ? void 0 : comment.split(' ')[0].indexOf('.')) || -1) > 0; | ||
const hasExampleLabel = (comment?.split(' ')[0].indexOf('.') || -1) > 0; | ||
// custom example label is delimited by first '.' and the rest will all be included as example label | ||
exampleLabels.push(hasExampleLabel ? comment === null || comment === void 0 ? void 0 : comment.split(' ')[0].split('.').slice(1).join('.') : undefined); | ||
exampleLabels.push(hasExampleLabel ? comment?.split(' ')[0].split('.').slice(1).join('.') : undefined); | ||
} | ||
return isExample !== null && isExample !== void 0 ? isExample : false; | ||
}).map(tag => { var _a; return ((0, jsDocUtils_1.commentToString)(tag.comment) || '').replace(`${((_a = (0, jsDocUtils_1.commentToString)(tag.comment)) === null || _a === void 0 ? void 0 : _a.split(' ')[0]) || ''}`, '').replace(/\r/g, ''); }); | ||
return isExample ?? false; | ||
}).map(tag => ((0, jsDocUtils_1.commentToString)(tag.comment) || '').replace(`${(0, jsDocUtils_1.commentToString)(tag.comment)?.split(' ')[0] || ''}`, '').replace(/\r/g, '')); | ||
if (examples.length === 0) { | ||
@@ -366,0 +387,0 @@ return { |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TypeResolver = void 0; | ||
const ts = require("typescript"); | ||
const ts = __importStar(require("typescript")); | ||
const jsDocUtils_1 = require("./../utils/jsDocUtils"); | ||
@@ -70,3 +93,2 @@ const decoratorUtils_1 = require("./../utils/decoratorUtils"); | ||
resolve() { | ||
var _a, _b; | ||
const primitiveType = this.getPrimitiveType(this.typeNode, this.parentNode); | ||
@@ -222,3 +244,3 @@ if (primitiveType) { | ||
if (type.aliasSymbol) { | ||
let declaration = (_a = type.aliasSymbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; | ||
let declaration = type.aliasSymbol.declarations?.[0]; | ||
if (declaration.name) { | ||
@@ -242,3 +264,3 @@ declaration = this.getModelTypeDeclaration(declaration.name); | ||
else if (type.isClassOrInterface()) { | ||
let declaration = (_b = type.symbol.declarations) === null || _b === void 0 ? void 0 : _b[0]; | ||
let declaration = type.symbol.declarations?.[0]; | ||
if (declaration.name) { | ||
@@ -517,9 +539,8 @@ declaration = this.getModelTypeDeclaration(declaration.name); | ||
getEnumerateType(typeName) { | ||
var _a, _b, _c; | ||
const enumName = typeName.text; | ||
const symbol = this.getSymbolAtLocation(typeName); | ||
// resolve value | ||
let declaredType = (((_a = this.current.typeChecker.getDeclaredTypeOfSymbol(symbol)) === null || _a === void 0 ? void 0 : _a.symbol) || symbol); | ||
let declaredType = (this.current.typeChecker.getDeclaredTypeOfSymbol(symbol)?.symbol || symbol); | ||
// if we are a EnumMember, return parent instead (this happens if a enum has only one entry, not quite sure why though...) | ||
if (this.hasFlag(declaredType, ts.SymbolFlags.EnumMember) && ((_c = (_b = declaredType.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration) === null || _c === void 0 ? void 0 : _c.kind) === ts.SyntaxKind.EnumDeclaration) { | ||
if (this.hasFlag(declaredType, ts.SymbolFlags.EnumMember) && declaredType.parent?.valueDeclaration?.kind === ts.SyntaxKind.EnumDeclaration) { | ||
declaredType = declaredType.parent; | ||
@@ -760,3 +781,3 @@ } | ||
const symbol = this.getSymbolAtLocation(type); | ||
const declarations = symbol === null || symbol === void 0 ? void 0 : symbol.getDeclarations(); | ||
const declarations = symbol?.getDeclarations(); | ||
if (!declarations) { | ||
@@ -769,4 +790,3 @@ throw new exceptions_1.GenerateMetadataError(`No declarations found for referenced type ${typeName}.`); | ||
let modelTypes = declarations.filter((node) => { | ||
var _a; | ||
return this.nodeIsUsable(node) && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.getText()) === typeName; | ||
return this.nodeIsUsable(node) && node.name?.getText() === typeName; | ||
}); | ||
@@ -802,8 +822,8 @@ if (!modelTypes.length) { | ||
} | ||
// Class model | ||
const properties = node.members | ||
.filter(member => !isIgnored(member)) | ||
.filter(member => member.kind === ts.SyntaxKind.PropertyDeclaration) | ||
.filter(member => !this.hasStaticModifier(member)) | ||
.filter(member => this.hasPublicModifier(member)); | ||
const properties = []; | ||
for (const member of node.members) { | ||
if (!isIgnored(member) && ts.isPropertyDeclaration(member) && !this.hasStaticModifier(member) && this.hasPublicModifier(member)) { | ||
properties.push(member); | ||
} | ||
} | ||
const classConstructor = node.members.find(member => ts.isConstructorDeclaration(member)); | ||
@@ -978,13 +998,13 @@ if (classConstructor && classConstructor.parameters) { | ||
isAccessibleParameter(node) { | ||
// No modifiers | ||
if (!node.modifiers) { | ||
const modifiers = ts.getModifiers(node); | ||
if (modifiers == null || modifiers.length === 0) { | ||
return false; | ||
} | ||
// public || public readonly | ||
if (node.modifiers.some(modifier => modifier.kind === ts.SyntaxKind.PublicKeyword)) { | ||
if (modifiers.some(modifier => modifier.kind === ts.SyntaxKind.PublicKeyword)) { | ||
return true; | ||
} | ||
// readonly, not private readonly, not public readonly | ||
const isReadonly = node.modifiers.some(modifier => modifier.kind === ts.SyntaxKind.ReadonlyKeyword); | ||
const isProtectedOrPrivate = node.modifiers.some(modifier => { | ||
const isReadonly = modifiers.some(modifier => modifier.kind === ts.SyntaxKind.ReadonlyKeyword); | ||
const isProtectedOrPrivate = modifiers.some(modifier => { | ||
return modifier.kind === ts.SyntaxKind.ProtectedKeyword || modifier.kind === ts.SyntaxKind.PrivateKeyword; | ||
@@ -991,0 +1011,0 @@ }); |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -23,3 +46,2 @@ exports.generateRoutes = void 0; | ||
async function getRouteGenerator(metadata, routesConfig) { | ||
var _a, _b; | ||
// default route generator for express/koa/hapi | ||
@@ -32,3 +54,3 @@ // custom route generator | ||
// try as a module import | ||
const module = await (_a = routeGenerator, Promise.resolve().then(() => require(_a))); | ||
const module = await Promise.resolve(`${routeGenerator}`).then(s => __importStar(require(s))); | ||
return new module.default(metadata, routesConfig); | ||
@@ -39,3 +61,3 @@ } | ||
const relativePath = path.relative(__dirname, routeGenerator); | ||
const module = await (_b = relativePath, Promise.resolve().then(() => require(_b))); | ||
const module = await Promise.resolve(`${relativePath}`).then(s => __importStar(require(s))); | ||
return new module.default(metadata, routesConfig); | ||
@@ -42,0 +64,0 @@ } |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateSpec = exports.getSwaggerOutputPath = void 0; | ||
const YAML = require("yamljs"); | ||
const YAML = __importStar(require("yamljs")); | ||
const metadataGenerator_1 = require("../metadataGeneration/metadataGenerator"); | ||
@@ -6,0 +29,0 @@ const specGenerator2_1 = require("../swagger/specGenerator2"); |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DefaultRouteGenerator = void 0; | ||
const fs = require("fs"); | ||
const handlebars = require("handlebars"); | ||
const path = require("path"); | ||
const fs = __importStar(require("fs")); | ||
const handlebars = __importStar(require("handlebars")); | ||
const path = __importStar(require("path")); | ||
const runtime_1 = require("@tsoa/runtime"); | ||
@@ -8,0 +31,0 @@ const fs_1 = require("../utils/fs"); |
@@ -45,3 +45,17 @@ /// <reference types="node" /> | ||
useFileUploads: boolean; | ||
multerOpts: import("multer").Options | undefined; | ||
multerOpts: { | ||
storage?: import("multer").StorageEngine | undefined; | ||
dest?: string | undefined; | ||
limits: { | ||
fieldNameSize?: number | undefined; | ||
fieldSize?: number | undefined; | ||
fields?: number | undefined; | ||
fileSize?: number | undefined; | ||
files?: number | undefined; | ||
parts?: number | undefined; | ||
headerPairs?: number | undefined; | ||
}; | ||
preservePath?: boolean | undefined; | ||
fileFilter?: ((req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, file: Express.Multer.File, callback: import("multer").FileFilterCallback) => void) | undefined; | ||
}; | ||
useSecurity: boolean; | ||
@@ -48,0 +62,0 @@ esm: boolean | undefined; |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AbstractRouteGenerator = void 0; | ||
const path = require("path"); | ||
const path = __importStar(require("path")); | ||
const runtime_1 = require("@tsoa/runtime"); | ||
@@ -97,5 +120,5 @@ const internalTypeGuards_1 = require("../utils/internalTypeGuards"); | ||
uploadFile: !!uploadFileParameter, | ||
uploadFileName: uploadFileParameter === null || uploadFileParameter === void 0 ? void 0 : uploadFileParameter.name, | ||
uploadFileName: uploadFileParameter?.name, | ||
uploadFiles: !!uploadFilesParameter, | ||
uploadFilesName: uploadFilesParameter === null || uploadFilesParameter === void 0 ? void 0 : uploadFilesParameter.name, | ||
uploadFilesName: uploadFilesParameter?.name, | ||
security: method.security, | ||
@@ -123,3 +146,8 @@ successStatus: method.successStatus ? method.successStatus : 'undefined', | ||
}))), | ||
multerOpts: this.options.multerOpts, | ||
multerOpts: { | ||
limits: { | ||
fileSize: 8388608, // 8mb | ||
}, | ||
...this.options.multerOpts, | ||
}, | ||
useSecurity: this.metadata.controllers.some(controller => controller.methods.some(method => !!method.security.length)), | ||
@@ -126,0 +154,0 @@ esm: this.options.esm, |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SpecGenerator = void 0; | ||
const runtime_1 = require("@tsoa/runtime"); | ||
const handlebars = require("handlebars"); | ||
const handlebars = __importStar(require("handlebars")); | ||
class SpecGenerator { | ||
@@ -34,4 +57,3 @@ constructor(metadata, config) { | ||
getOperationId(controllerName, method) { | ||
var _a; | ||
return this.buildOperationIdTemplate((_a = this.config.operationIdTemplate) !== null && _a !== void 0 ? _a : '{{titleCase method.name}}')({ | ||
return this.buildOperationIdTemplate(this.config.operationIdTemplate ?? '{{titleCase method.name}}')({ | ||
method, | ||
@@ -38,0 +60,0 @@ controllerName, |
@@ -193,3 +193,2 @@ "use strict"; | ||
method.responses.forEach((res) => { | ||
var _a; | ||
swaggerResponses[res.name] = { | ||
@@ -205,3 +204,3 @@ description: res.description, | ||
if (res.examples && res.examples[0]) { | ||
if ((((_a = res.exampleLabels) === null || _a === void 0 ? void 0 : _a.filter(e => e).length) || 0) > 0) { | ||
if ((res.exampleLabels?.filter(e => e).length || 0) > 0) { | ||
console.warn('Example labels are not supported in OpenAPI 2'); | ||
@@ -208,0 +207,0 @@ } |
@@ -26,5 +26,5 @@ "use strict"; | ||
let spec = { | ||
openapi: '3.0.0', | ||
components: this.buildComponents(), | ||
info: this.buildInfo(), | ||
openapi: '3.0.0', | ||
paths: this.buildPaths(), | ||
@@ -316,4 +316,3 @@ servers: this.buildServers(), | ||
const examples = res.examples.reduce((acc, ex, currentIndex) => { | ||
var _a; | ||
const exampleLabel = (_a = res.exampleLabels) === null || _a === void 0 ? void 0 : _a[currentIndex]; | ||
const exampleLabel = res.exampleLabels?.[currentIndex]; | ||
return { ...acc, [exampleLabel === undefined ? `Example ${exampleCounter++}` : exampleLabel]: { value: ex } }; | ||
@@ -426,3 +425,3 @@ }, {}); | ||
mediaType.examples = parameterExamples.reduce((acc, ex, currentIndex) => { | ||
const exampleLabel = parameterExampleLabels === null || parameterExampleLabels === void 0 ? void 0 : parameterExampleLabels[currentIndex]; | ||
const exampleLabel = parameterExampleLabels?.[currentIndex]; | ||
return { ...acc, [exampleLabel === undefined ? `Example ${exampleCounter++}` : exampleLabel]: { value: ex } }; | ||
@@ -492,3 +491,3 @@ }, {}); | ||
parameter.examples = parameterExamples.reduce((acc, ex, currentIndex) => { | ||
const exampleLabel = parameterExampleLabels === null || parameterExampleLabels === void 0 ? void 0 : parameterExampleLabels[currentIndex]; | ||
const exampleLabel = parameterExampleLabels?.[currentIndex]; | ||
return { ...acc, [exampleLabel === undefined ? `Example ${exampleCounter++}` : exampleLabel]: { value: ex } }; | ||
@@ -495,0 +494,0 @@ }, {}); |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getProduces = exports.getPath = exports.isDecorator = exports.getSecurites = exports.getDecoratorValues = exports.getNodeFirstDecoratorValue = exports.getNodeFirstDecoratorName = exports.getDecorators = void 0; | ||
const ts = require("typescript"); | ||
const ts = __importStar(require("typescript")); | ||
const initializer_value_1 = require("../metadataGeneration/initializer-value"); | ||
@@ -11,3 +34,3 @@ function tsHasDecorators(ts) { | ||
// beginning in ts4.8 node.decorator is undefined, use getDecorators instead. | ||
const decorators = tsHasDecorators(ts) && ts.canHaveDecorators(node) ? ts.getDecorators(node) : node.decorators; | ||
const decorators = tsHasDecorators(ts) && ts.canHaveDecorators(node) ? ts.getDecorators(node) : []; | ||
if (!decorators || !decorators.length) { | ||
@@ -14,0 +37,0 @@ return []; |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fsReadFile = exports.fsWriteFile = exports.fsMkDir = exports.fsExists = void 0; | ||
const fs = require("fs"); | ||
const fs = __importStar(require("fs")); | ||
const util_1 = require("util"); | ||
@@ -6,0 +29,0 @@ exports.fsExists = (0, util_1.promisify)(fs.exists); |
"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 (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.commentToString = exports.isExistJSDocTag = exports.getJSDocTags = exports.getJSDocTagNames = exports.getJSDocComments = exports.getJSDocComment = exports.getJSDocDescription = void 0; | ||
const ts = require("typescript"); | ||
const ts = __importStar(require("typescript")); | ||
const exceptions_1 = require("../metadataGeneration/exceptions"); | ||
@@ -41,3 +64,2 @@ function getJSDocDescription(node) { | ||
tags = getJSDocTags(node.parent, tag => { | ||
var _a; | ||
if (ts.isJSDocParameterTag(tag)) { | ||
@@ -49,3 +71,3 @@ return false; | ||
} | ||
return ((_a = commentToString(tag.comment)) === null || _a === void 0 ? void 0 : _a.startsWith(parameterName)) || false; | ||
return commentToString(tag.comment)?.startsWith(parameterName) || false; | ||
}); | ||
@@ -52,0 +74,0 @@ } |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPropertyValidators = exports.getParameterValidators = void 0; | ||
const validator_1 = require("validator"); | ||
const validator_1 = __importDefault(require("validator")); | ||
const exceptions_1 = require("./../metadataGeneration/exceptions"); | ||
@@ -34,3 +37,2 @@ const jsDocUtils_1 = require("./jsDocUtils"); | ||
return tags.reduce((validateObj, tag) => { | ||
var _a, _b; | ||
if (!tag.comment) { | ||
@@ -40,3 +42,5 @@ return validateObj; | ||
const name = tag.tagName.text; | ||
const comment = (_a = (0, jsDocUtils_1.commentToString)(tag.comment)) === null || _a === void 0 ? void 0 : _a.substr((((_b = (0, jsDocUtils_1.commentToString)(tag.comment)) === null || _b === void 0 ? void 0 : _b.indexOf(' ')) || -1) + 1).trim(); | ||
const comment = (0, jsDocUtils_1.commentToString)(tag.comment) | ||
?.substr(((0, jsDocUtils_1.commentToString)(tag.comment)?.indexOf(' ') || -1) + 1) | ||
.trim(); | ||
const value = getCommentValue(comment); | ||
@@ -43,0 +47,0 @@ switch (name) { |
{ | ||
"name": "@tsoa/cli", | ||
"description": "Build swagger-compliant REST APIs using TypeScript and Node", | ||
"version": "5.1.1", | ||
"version": "6.0.0-rc.0", | ||
"main": "./dist/index.js", | ||
@@ -33,23 +33,23 @@ "typings": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@tsoa/runtime": "^5.0.0", | ||
"deepmerge": "^4.2.2", | ||
"fs-extra": "^10.1.0", | ||
"glob": "^8.0.3", | ||
"@tsoa/runtime": "^6.0.0-rc.0", | ||
"deepmerge": "^4.3.1", | ||
"fs-extra": "^11.1.1", | ||
"glob": "^9.3.4", | ||
"handlebars": "^4.7.7", | ||
"merge": "^2.1.1", | ||
"minimatch": "^5.1.0", | ||
"typescript": "^4.9.5", | ||
"validator": "^13.7.0", | ||
"minimatch": "^8.0.2", | ||
"typescript": "^5.0.3", | ||
"validator": "^13.9.0", | ||
"yamljs": "^0.3.0", | ||
"yargs": "^17.5.1" | ||
"yargs": "^17.7.1" | ||
}, | ||
"devDependencies": { | ||
"@types/glob": "^8.0.0", | ||
"@types/glob": "^8.1.0", | ||
"@types/minimatch": "^5.1.0", | ||
"@types/node": "^18.7.13", | ||
"@types/validator": "^13.7.6", | ||
"@types/node": "^16.18.23", | ||
"@types/validator": "^13.7.14", | ||
"@types/yamljs": "^0.2.31", | ||
"@types/yargs": "^17.0.14", | ||
"@types/yargs": "^17.0.24", | ||
"copyfiles": "^2.4.1", | ||
"rimraf": "^3.0.2" | ||
"rimraf": "^4.4.1" | ||
}, | ||
@@ -65,3 +65,3 @@ "repository": { | ||
"yarn": ">=1.9.4", | ||
"node": ">=12.0.0" | ||
"node": ">=16.0.0" | ||
}, | ||
@@ -72,3 +72,3 @@ "engineStrict": true, | ||
}, | ||
"gitHead": "8017d1d7b6f034962d7b543718f14c8da0f60242" | ||
"gitHead": "5e53bbe937c2de32a80ab836c7a3dc6d9000e416" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
492639
97
5832
2
+ Added@hapi/accept@6.0.3(transitive)
+ Added@hapi/ammo@6.0.1(transitive)
+ Added@hapi/b64@6.0.1(transitive)
+ Added@hapi/boom@10.0.1(transitive)
+ Added@hapi/bounce@3.0.2(transitive)
+ Added@hapi/bourne@3.0.0(transitive)
+ Added@hapi/call@9.0.1(transitive)
+ Added@hapi/catbox@12.1.1(transitive)
+ Added@hapi/content@6.0.0(transitive)
+ Added@hapi/cryptiles@6.0.1(transitive)
+ Added@hapi/file@3.0.0(transitive)
+ Added@hapi/hapi@21.3.12(transitive)
+ Added@hapi/heavy@8.0.1(transitive)
+ Added@hapi/hoek@11.0.7(transitive)
+ Added@hapi/iron@7.0.1(transitive)
+ Added@hapi/mimos@7.0.1(transitive)
+ Added@hapi/nigel@5.0.1(transitive)
+ Added@hapi/pez@6.1.0(transitive)
+ Added@hapi/podium@5.0.1(transitive)
+ Added@hapi/shot@6.0.1(transitive)
+ Added@hapi/somever@4.1.1(transitive)
+ Added@hapi/statehood@8.1.1(transitive)
+ Added@hapi/subtext@8.1.0(transitive)
+ Added@hapi/teamwork@6.0.0(transitive)
+ Added@hapi/topo@6.0.2(transitive)
+ Added@hapi/validate@2.0.1(transitive)
+ Added@hapi/vise@5.0.1(transitive)
+ Added@tsoa/runtime@6.6.0(transitive)
+ Added@types/accepts@1.3.7(transitive)
+ Added@types/content-disposition@0.5.8(transitive)
+ Added@types/cookies@0.9.0(transitive)
+ Added@types/http-assert@1.5.6(transitive)
+ Added@types/keygrip@1.0.6(transitive)
+ Added@types/koa@2.15.0(transitive)
+ Added@types/koa-compose@3.2.8(transitive)
+ Addedaccepts@1.3.8(transitive)
+ Addedarray-flatten@1.1.1(transitive)
+ Addedbody-parser@1.20.3(transitive)
+ Addedbytes@3.1.2(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcontent-type@1.0.5(transitive)
+ Addedcookie@0.7.1(transitive)
+ Addedcookie-signature@1.0.6(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddepd@2.0.0(transitive)
+ Addeddestroy@1.2.0(transitive)
+ Addedee-first@1.1.1(transitive)
+ Addedencodeurl@1.0.22.0.0(transitive)
+ Addedescape-html@1.0.3(transitive)
+ Addedetag@1.8.1(transitive)
+ Addedexpress@4.21.2(transitive)
+ Addedfinalhandler@1.3.1(transitive)
+ Addedforwarded@0.2.0(transitive)
+ Addedfresh@0.5.2(transitive)
+ Addedfs-extra@11.2.0(transitive)
+ Addedglob@9.3.5(transitive)
+ Addedhttp-errors@2.0.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedipaddr.js@1.9.1(transitive)
+ Addedlru-cache@10.4.3(transitive)
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmerge-descriptors@1.0.3(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedmime-db@1.52.01.53.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimatch@8.0.4(transitive)
+ Addedminipass@4.2.87.1.2(transitive)
+ Addedms@2.0.02.1.3(transitive)
+ Addednegotiator@0.6.3(transitive)
+ Addedon-finished@2.4.1(transitive)
+ Addedparseurl@1.3.3(transitive)
+ Addedpath-scurry@1.11.1(transitive)
+ Addedpath-to-regexp@0.1.12(transitive)
+ Addedproxy-addr@2.0.7(transitive)
+ Addedqs@6.13.0(transitive)
+ Addedrange-parser@1.2.1(transitive)
+ Addedraw-body@2.5.2(transitive)
+ Addedreflect-metadata@0.2.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsend@0.19.0(transitive)
+ Addedserve-static@1.16.2(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedstatuses@2.0.1(transitive)
+ Addedtoidentifier@1.0.1(transitive)
+ Addedtype-is@1.6.18(transitive)
+ Addedtypescript@5.7.2(transitive)
+ Addedunpipe@1.0.0(transitive)
+ Addedutils-merge@1.0.1(transitive)
+ Addedvary@1.1.2(transitive)
- Removed@tsoa/runtime@5.0.0(transitive)
- Removedarray-buffer-byte-length@1.0.1(transitive)
- Removedarray.prototype.map@1.0.7(transitive)
- Removedarraybuffer.prototype.slice@1.0.3(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removeddata-view-buffer@1.0.1(transitive)
- Removeddata-view-byte-length@1.0.1(transitive)
- Removeddata-view-byte-offset@1.0.0(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-abstract@1.23.5(transitive)
- Removedes-aggregate-error@1.0.13(transitive)
- Removedes-array-method-boxes-properly@1.0.0(transitive)
- Removedes-get-iterator@1.1.3(transitive)
- Removedes-set-tostringtag@2.0.3(transitive)
- Removedes-to-primitive@1.3.0(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfs-extra@10.1.0(transitive)
- Removedfunction.prototype.name@1.1.6(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-symbol-description@1.0.2(transitive)
- Removedglob@8.1.0(transitive)
- Removedglobalthis@1.0.4(transitive)
- Removedhas-bigints@1.0.2(transitive)
- Removedhas-proto@1.2.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedinternal-slot@1.0.7(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-array-buffer@3.0.4(transitive)
- Removedis-async-function@2.0.0(transitive)
- Removedis-bigint@1.1.0(transitive)
- Removedis-boolean-object@1.2.0(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-data-view@1.0.2(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-finalizationregistry@1.1.0(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedis-map@2.0.3(transitive)
- Removedis-negative-zero@2.0.3(transitive)
- Removedis-number-object@1.1.0(transitive)
- Removedis-regex@1.2.1(transitive)
- Removedis-set@2.0.3(transitive)
- Removedis-shared-array-buffer@1.0.3(transitive)
- Removedis-string@1.1.0(transitive)
- Removedis-symbol@1.1.0(transitive)
- Removedis-typed-array@1.1.13(transitive)
- Removedis-weakmap@2.0.2(transitive)
- Removedis-weakref@1.0.2(transitive)
- Removedis-weakset@2.0.3(transitive)
- Removedisarray@2.0.5(transitive)
- Removediterate-iterator@1.0.2(transitive)
- Removediterate-value@1.0.2(transitive)
- Removedminimatch@5.1.6(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.5(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedpromise.any@2.0.6(transitive)
- Removedreflect-metadata@0.1.14(transitive)
- Removedreflect.getprototypeof@1.0.8(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
- Removedsafe-array-concat@1.1.3(transitive)
- Removedsafe-regex-test@1.0.3(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedstop-iteration-iterator@1.0.0(transitive)
- Removedstring.prototype.trim@1.2.10(transitive)
- Removedstring.prototype.trimend@1.0.9(transitive)
- Removedstring.prototype.trimstart@1.0.8(transitive)
- Removedtyped-array-buffer@1.0.2(transitive)
- Removedtyped-array-byte-length@1.0.1(transitive)
- Removedtyped-array-byte-offset@1.0.3(transitive)
- Removedtyped-array-length@1.0.7(transitive)
- Removedtypescript@4.9.5(transitive)
- Removedunbox-primitive@1.0.2(transitive)
- Removedwhich-boxed-primitive@1.1.0(transitive)
- Removedwhich-builtin-type@1.2.0(transitive)
- Removedwhich-collection@1.0.2(transitive)
- Removedwhich-typed-array@1.1.16(transitive)
Updated@tsoa/runtime@^6.0.0-rc.0
Updateddeepmerge@^4.3.1
Updatedfs-extra@^11.1.1
Updatedglob@^9.3.4
Updatedminimatch@^8.0.2
Updatedtypescript@^5.0.3
Updatedvalidator@^13.9.0
Updatedyargs@^17.7.1