@tsoa-next/cli 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +3 -0
- package/dist/cli.d.ts +44 -0
- package/dist/cli.js +356 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/metadataGeneration/controllerGenerator.d.ts +30 -0
- package/dist/metadataGeneration/controllerGenerator.js +229 -0
- package/dist/metadataGeneration/controllerGenerator.js.map +1 -0
- package/dist/metadataGeneration/exceptions.d.ts +13 -0
- package/dist/metadataGeneration/exceptions.js +53 -0
- package/dist/metadataGeneration/exceptions.js.map +1 -0
- package/dist/metadataGeneration/extension.d.ts +5 -0
- package/dist/metadataGeneration/extension.js +85 -0
- package/dist/metadataGeneration/extension.js.map +1 -0
- package/dist/metadataGeneration/initializer-value.d.ts +6 -0
- package/dist/metadataGeneration/initializer-value.js +154 -0
- package/dist/metadataGeneration/initializer-value.js.map +1 -0
- package/dist/metadataGeneration/metadataGenerator.d.ts +29 -0
- package/dist/metadataGeneration/metadataGenerator.js +220 -0
- package/dist/metadataGeneration/metadataGenerator.js.map +1 -0
- package/dist/metadataGeneration/methodGenerator.d.ts +45 -0
- package/dist/metadataGeneration/methodGenerator.js +367 -0
- package/dist/metadataGeneration/methodGenerator.js.map +1 -0
- package/dist/metadataGeneration/parameterGenerator.d.ts +33 -0
- package/dist/metadataGeneration/parameterGenerator.js +552 -0
- package/dist/metadataGeneration/parameterGenerator.js.map +1 -0
- package/dist/metadataGeneration/transformer/dateTransformer.d.ts +6 -0
- package/dist/metadataGeneration/transformer/dateTransformer.js +28 -0
- package/dist/metadataGeneration/transformer/dateTransformer.js.map +1 -0
- package/dist/metadataGeneration/transformer/enumTransformer.d.ts +12 -0
- package/dist/metadataGeneration/transformer/enumTransformer.js +75 -0
- package/dist/metadataGeneration/transformer/enumTransformer.js.map +1 -0
- package/dist/metadataGeneration/transformer/primitiveTransformer.d.ts +11 -0
- package/dist/metadataGeneration/transformer/primitiveTransformer.js +70 -0
- package/dist/metadataGeneration/transformer/primitiveTransformer.js.map +1 -0
- package/dist/metadataGeneration/transformer/propertyTransformer.d.ts +12 -0
- package/dist/metadataGeneration/transformer/propertyTransformer.js +101 -0
- package/dist/metadataGeneration/transformer/propertyTransformer.js.map +1 -0
- package/dist/metadataGeneration/transformer/referenceTransformer.d.ts +10 -0
- package/dist/metadataGeneration/transformer/referenceTransformer.js +81 -0
- package/dist/metadataGeneration/transformer/referenceTransformer.js.map +1 -0
- package/dist/metadataGeneration/transformer/transformer.d.ts +9 -0
- package/dist/metadataGeneration/transformer/transformer.js +39 -0
- package/dist/metadataGeneration/transformer/transformer.js.map +1 -0
- package/dist/metadataGeneration/typeResolver.d.ts +52 -0
- package/dist/metadataGeneration/typeResolver.js +1202 -0
- package/dist/metadataGeneration/typeResolver.js.map +1 -0
- package/dist/module/generate-routes.d.ts +9 -0
- package/dist/module/generate-routes.js +90 -0
- package/dist/module/generate-routes.js.map +1 -0
- package/dist/module/generate-spec.d.ts +9 -0
- package/dist/module/generate-spec.js +79 -0
- package/dist/module/generate-spec.js.map +1 -0
- package/dist/routeGeneration/defaultRouteGenerator.d.ts +12 -0
- package/dist/routeGeneration/defaultRouteGenerator.js +119 -0
- package/dist/routeGeneration/defaultRouteGenerator.js.map +1 -0
- package/dist/routeGeneration/routeGenerator.d.ts +56 -0
- package/dist/routeGeneration/routeGenerator.js +257 -0
- package/dist/routeGeneration/routeGenerator.js.map +1 -0
- package/dist/routeGeneration/templates/express.hbs +221 -0
- package/dist/routeGeneration/templates/hapi.hbs +267 -0
- package/dist/routeGeneration/templates/koa.hbs +218 -0
- package/dist/swagger/specGenerator.d.ts +33 -0
- package/dist/swagger/specGenerator.js +253 -0
- package/dist/swagger/specGenerator.js.map +1 -0
- package/dist/swagger/specGenerator2.d.ts +27 -0
- package/dist/swagger/specGenerator2.js +476 -0
- package/dist/swagger/specGenerator2.js.map +1 -0
- package/dist/swagger/specGenerator3.d.ts +158 -0
- package/dist/swagger/specGenerator3.js +646 -0
- package/dist/swagger/specGenerator3.js.map +1 -0
- package/dist/swagger/specGenerator31.d.ts +24 -0
- package/dist/swagger/specGenerator31.js +75 -0
- package/dist/swagger/specGenerator31.js.map +1 -0
- package/dist/utils/decoratorUtils.d.ts +9 -0
- package/dist/utils/decoratorUtils.js +118 -0
- package/dist/utils/decoratorUtils.js.map +1 -0
- package/dist/utils/flowUtils.d.ts +1 -0
- package/dist/utils/flowUtils.js +8 -0
- package/dist/utils/flowUtils.js.map +1 -0
- package/dist/utils/fs.d.ts +5 -0
- package/dist/utils/fs.js +55 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/genericTypeGuards.d.ts +1 -0
- package/dist/utils/genericTypeGuards.js +8 -0
- package/dist/utils/genericTypeGuards.js.map +1 -0
- package/dist/utils/headerTypeHelpers.d.ts +5 -0
- package/dist/utils/headerTypeHelpers.js +27 -0
- package/dist/utils/headerTypeHelpers.js.map +1 -0
- package/dist/utils/importClassesFromDirectories.d.ts +4 -0
- package/dist/utils/importClassesFromDirectories.js +20 -0
- package/dist/utils/importClassesFromDirectories.js.map +1 -0
- package/dist/utils/internalTypeGuards.d.ts +5 -0
- package/dist/utils/internalTypeGuards.js +66 -0
- package/dist/utils/internalTypeGuards.js.map +1 -0
- package/dist/utils/isVoidType.d.ts +2 -0
- package/dist/utils/isVoidType.js +16 -0
- package/dist/utils/isVoidType.js.map +1 -0
- package/dist/utils/jsDocUtils.d.ts +8 -0
- package/dist/utils/jsDocUtils.js +122 -0
- package/dist/utils/jsDocUtils.js.map +1 -0
- package/dist/utils/jsonUtils.d.ts +1 -0
- package/dist/utils/jsonUtils.js +12 -0
- package/dist/utils/jsonUtils.js.map +1 -0
- package/dist/utils/pathUtils.d.ts +9 -0
- package/dist/utils/pathUtils.js +37 -0
- package/dist/utils/pathUtils.js.map +1 -0
- package/dist/utils/specMerge.d.ts +2 -0
- package/dist/utils/specMerge.js +36 -0
- package/dist/utils/specMerge.js.map +1 -0
- package/dist/utils/swaggerUtils.d.ts +3 -0
- package/dist/utils/swaggerUtils.js +22 -0
- package/dist/utils/swaggerUtils.js.map +1 -0
- package/dist/utils/unspecifiedObject.d.ts +3 -0
- package/dist/utils/unspecifiedObject.js +3 -0
- package/dist/utils/unspecifiedObject.js.map +1 -0
- package/dist/utils/validatorUtils.d.ts +5 -0
- package/dist/utils/validatorUtils.js +241 -0
- package/dist/utils/validatorUtils.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AbstractRouteGenerator = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const runtime_1 = require("@tsoa-next/runtime");
|
|
39
|
+
const internalTypeGuards_1 = require("../utils/internalTypeGuards");
|
|
40
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
41
|
+
const fs_1 = require("../utils/fs");
|
|
42
|
+
class AbstractRouteGenerator {
|
|
43
|
+
metadata;
|
|
44
|
+
options;
|
|
45
|
+
constructor(metadata, options) {
|
|
46
|
+
this.metadata = metadata;
|
|
47
|
+
this.options = options;
|
|
48
|
+
}
|
|
49
|
+
buildModels() {
|
|
50
|
+
const models = {};
|
|
51
|
+
Object.keys(this.metadata.referenceTypeMap).forEach(name => {
|
|
52
|
+
const referenceType = this.metadata.referenceTypeMap[name];
|
|
53
|
+
let model;
|
|
54
|
+
if (referenceType.dataType === 'refEnum') {
|
|
55
|
+
const refEnumModel = {
|
|
56
|
+
dataType: 'refEnum',
|
|
57
|
+
enums: referenceType.enums,
|
|
58
|
+
};
|
|
59
|
+
model = refEnumModel;
|
|
60
|
+
}
|
|
61
|
+
else if (referenceType.dataType === 'refObject') {
|
|
62
|
+
const propertySchemaDictionary = {};
|
|
63
|
+
referenceType.properties.forEach(property => {
|
|
64
|
+
propertySchemaDictionary[property.name] = this.buildPropertySchema(property);
|
|
65
|
+
});
|
|
66
|
+
const refObjModel = {
|
|
67
|
+
dataType: 'refObject',
|
|
68
|
+
properties: propertySchemaDictionary,
|
|
69
|
+
};
|
|
70
|
+
if (referenceType.additionalProperties) {
|
|
71
|
+
refObjModel.additionalProperties = this.buildProperty(referenceType.additionalProperties);
|
|
72
|
+
}
|
|
73
|
+
else if (this.options.noImplicitAdditionalProperties !== 'ignore') {
|
|
74
|
+
refObjModel.additionalProperties = false;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// Since Swagger allows "excess properties" (to use a TypeScript term) by default
|
|
78
|
+
refObjModel.additionalProperties = true;
|
|
79
|
+
}
|
|
80
|
+
model = refObjModel;
|
|
81
|
+
}
|
|
82
|
+
else if (referenceType.dataType === 'refAlias') {
|
|
83
|
+
const refType = {
|
|
84
|
+
dataType: 'refAlias',
|
|
85
|
+
type: {
|
|
86
|
+
...this.buildProperty(referenceType.type),
|
|
87
|
+
validators: referenceType.validators,
|
|
88
|
+
default: referenceType.default,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
model = refType;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
model = (0, runtime_1.assertNever)(referenceType);
|
|
95
|
+
}
|
|
96
|
+
models[name] = model;
|
|
97
|
+
});
|
|
98
|
+
return models;
|
|
99
|
+
}
|
|
100
|
+
pathTransformer(path) {
|
|
101
|
+
return (0, pathUtils_1.convertBracesPathParams)(path);
|
|
102
|
+
}
|
|
103
|
+
buildContext() {
|
|
104
|
+
const authenticationModule = this.options.authenticationModule ? this.getRelativeImportPath(this.options.authenticationModule) : undefined;
|
|
105
|
+
const iocModule = this.options.iocModule ? this.getRelativeImportPath(this.options.iocModule) : undefined;
|
|
106
|
+
// Left in for backwards compatibility, previously if we're working locally then tsoa runtime code wasn't an importable module but now it is.
|
|
107
|
+
const canImportByAlias = true;
|
|
108
|
+
const normalisedBasePath = (0, pathUtils_1.normalisePath)(this.options.basePath, '/');
|
|
109
|
+
return {
|
|
110
|
+
authenticationModule,
|
|
111
|
+
basePath: normalisedBasePath,
|
|
112
|
+
canImportByAlias,
|
|
113
|
+
controllers: this.metadata.controllers.map(controller => {
|
|
114
|
+
const normalisedControllerPath = this.pathTransformer((0, pathUtils_1.normalisePath)(controller.path, '/'));
|
|
115
|
+
return {
|
|
116
|
+
actions: controller.methods.map(method => {
|
|
117
|
+
const parameterObjs = {};
|
|
118
|
+
method.parameters.forEach(parameter => {
|
|
119
|
+
parameterObjs[parameter.parameterName] = this.buildParameterSchema(parameter);
|
|
120
|
+
});
|
|
121
|
+
const normalisedMethodPath = this.pathTransformer((0, pathUtils_1.normalisePath)(method.path, '/'));
|
|
122
|
+
const normalisedFullPath = (0, pathUtils_1.normalisePath)(`${normalisedBasePath}${normalisedControllerPath}${normalisedMethodPath}`, '/', '', false);
|
|
123
|
+
const uploadFilesWithDifferentFieldParameter = method.parameters.filter(parameter => parameter.type.dataType === 'file' || (parameter.type.dataType === 'array' && parameter.type.elementType.dataType === 'file'));
|
|
124
|
+
return {
|
|
125
|
+
fullPath: normalisedFullPath,
|
|
126
|
+
method: method.method.toLowerCase(),
|
|
127
|
+
name: method.name,
|
|
128
|
+
parameters: parameterObjs,
|
|
129
|
+
path: normalisedMethodPath,
|
|
130
|
+
uploadFile: uploadFilesWithDifferentFieldParameter.length > 0,
|
|
131
|
+
uploadFileName: uploadFilesWithDifferentFieldParameter.map(parameter => ({
|
|
132
|
+
name: parameter.name,
|
|
133
|
+
maxCount: parameter.type.dataType === 'file' ? 1 : undefined,
|
|
134
|
+
multiple: parameter.type.dataType === 'array' && parameter.type.elementType.dataType === 'file',
|
|
135
|
+
})),
|
|
136
|
+
security: method.security,
|
|
137
|
+
successStatus: method.successStatus ? method.successStatus : 'undefined',
|
|
138
|
+
};
|
|
139
|
+
}),
|
|
140
|
+
modulePath: this.getRelativeImportPath(controller.location),
|
|
141
|
+
name: controller.name,
|
|
142
|
+
path: normalisedControllerPath,
|
|
143
|
+
};
|
|
144
|
+
}),
|
|
145
|
+
environment: process.env,
|
|
146
|
+
iocModule,
|
|
147
|
+
minimalSwaggerConfig: { noImplicitAdditionalProperties: this.options.noImplicitAdditionalProperties, bodyCoercion: this.options.bodyCoercion },
|
|
148
|
+
models: this.buildModels(),
|
|
149
|
+
useFileUploads: this.metadata.controllers.some(controller => controller.methods.some(method => !!method.parameters.find(parameter => {
|
|
150
|
+
if (parameter.type.dataType === 'file') {
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
else if (parameter.type.dataType === 'array' && parameter.type.elementType.dataType === 'file') {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}))),
|
|
158
|
+
multerOpts: {
|
|
159
|
+
limits: {
|
|
160
|
+
fileSize: 8388608, // 8mb
|
|
161
|
+
},
|
|
162
|
+
...this.options.multerOpts,
|
|
163
|
+
},
|
|
164
|
+
useSecurity: this.metadata.controllers.some(controller => controller.methods.some(method => !!method.security.length)),
|
|
165
|
+
esm: this.options.esm,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
getRelativeImportPath(fileLocation) {
|
|
169
|
+
const currentExt = path.extname(fileLocation);
|
|
170
|
+
let newExtension = this.options.rewriteRelativeImportExtensions ? currentExt : '';
|
|
171
|
+
if (this.options.esm && !this.options.rewriteRelativeImportExtensions) {
|
|
172
|
+
switch (currentExt) {
|
|
173
|
+
case '.ts':
|
|
174
|
+
default:
|
|
175
|
+
newExtension = '.js';
|
|
176
|
+
break;
|
|
177
|
+
case '.mts':
|
|
178
|
+
newExtension = '.mjs';
|
|
179
|
+
break;
|
|
180
|
+
case '.cts':
|
|
181
|
+
newExtension = '.cjs';
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
fileLocation = fileLocation.replace(/\.(ts|mts|cts)$/, ''); // no ts extension in import
|
|
186
|
+
return `./${path.relative(this.options.routesDir, fileLocation).replace(/\\/g, '/')}${newExtension}`;
|
|
187
|
+
}
|
|
188
|
+
buildPropertySchema(source) {
|
|
189
|
+
const propertySchema = this.buildProperty(source.type);
|
|
190
|
+
propertySchema.default = source.default;
|
|
191
|
+
propertySchema.required = source.required ? true : undefined;
|
|
192
|
+
if (Object.keys(source.validators).length > 0) {
|
|
193
|
+
propertySchema.validators = source.validators;
|
|
194
|
+
}
|
|
195
|
+
return propertySchema;
|
|
196
|
+
}
|
|
197
|
+
buildParameterSchema(source) {
|
|
198
|
+
const property = this.buildProperty(source.type);
|
|
199
|
+
const parameter = {
|
|
200
|
+
default: source.default,
|
|
201
|
+
in: source.in,
|
|
202
|
+
name: source.name,
|
|
203
|
+
required: source.required ? true : undefined,
|
|
204
|
+
};
|
|
205
|
+
const parameterSchema = Object.assign(parameter, property);
|
|
206
|
+
if (Object.keys(source.validators).length > 0) {
|
|
207
|
+
parameterSchema.validators = source.validators;
|
|
208
|
+
}
|
|
209
|
+
return parameterSchema;
|
|
210
|
+
}
|
|
211
|
+
buildProperty(type) {
|
|
212
|
+
const schema = {
|
|
213
|
+
dataType: type.dataType,
|
|
214
|
+
};
|
|
215
|
+
if ((0, internalTypeGuards_1.isRefType)(type)) {
|
|
216
|
+
schema.dataType = undefined;
|
|
217
|
+
schema.ref = type.refName;
|
|
218
|
+
}
|
|
219
|
+
if (type.dataType === 'array') {
|
|
220
|
+
const arrayType = type;
|
|
221
|
+
if ((0, internalTypeGuards_1.isRefType)(arrayType.elementType)) {
|
|
222
|
+
schema.array = {
|
|
223
|
+
dataType: arrayType.elementType.dataType,
|
|
224
|
+
ref: arrayType.elementType.refName,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
schema.array = this.buildProperty(arrayType.elementType);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (type.dataType === 'enum') {
|
|
232
|
+
schema.enums = type.enums;
|
|
233
|
+
}
|
|
234
|
+
if (type.dataType === 'union' || type.dataType === 'intersection') {
|
|
235
|
+
schema.subSchemas = type.types.map(type => this.buildProperty(type));
|
|
236
|
+
}
|
|
237
|
+
if (type.dataType === 'nestedObjectLiteral') {
|
|
238
|
+
const objLiteral = type;
|
|
239
|
+
schema.nestedProperties = objLiteral.properties.reduce((acc, prop) => {
|
|
240
|
+
return { ...acc, [prop.name]: this.buildPropertySchema(prop) };
|
|
241
|
+
}, {});
|
|
242
|
+
schema.additionalProperties = objLiteral.additionalProperties && this.buildProperty(objLiteral.additionalProperties);
|
|
243
|
+
}
|
|
244
|
+
return schema;
|
|
245
|
+
}
|
|
246
|
+
async shouldWriteFile(fileName, content) {
|
|
247
|
+
if (this.options.noWriteIfUnchanged) {
|
|
248
|
+
if (await (0, fs_1.fsExists)(fileName)) {
|
|
249
|
+
const existingContent = (await (0, fs_1.fsReadFile)(fileName)).toString();
|
|
250
|
+
return content !== existingContent;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
exports.AbstractRouteGenerator = AbstractRouteGenerator;
|
|
257
|
+
//# sourceMappingURL=routeGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeGenerator.js","sourceRoot":"","sources":["../../src/routeGeneration/routeGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAE5B,gDAAiE;AACjE,oEAAuD;AACvD,kDAA2E;AAC3E,oCAAkD;AAElD,MAAsB,sBAAsB;IAErB;IACA;IAFrB,YACqB,QAAuB,EACvB,OAAe;QADf,aAAQ,GAAR,QAAQ,CAAe;QACvB,YAAO,GAAP,OAAO,CAAQ;IACjC,CAAC;IAOG,WAAW;QAChB,MAAM,MAAM,GAAG,EAAsB,CAAA;QAErC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACzD,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;YAE1D,IAAI,KAA4B,CAAA;YAChC,IAAI,aAAa,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBACzC,MAAM,Y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,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;QACtH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,QAAgB,EAAE,OAAe;QAC/D,IAAI,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;YACpC,IAAI,MAAM,IAAA,aAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC;gBAC7B,MAAM,eAAe,GAAG,CAAC,MAAM,IAAA,eAAU,EAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;gBAC/D,OAAO,OAAO,KAAK,eAAe,CAAA;YACpC,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAxPD,wDAwPC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
4
|
+
import type { TsoaRoute } from '@tsoa-next/runtime';
|
|
5
|
+
import { fetchMiddlewares, ExpressTemplateService } from '@tsoa-next/runtime';
|
|
6
|
+
{{#each controllers}}
|
|
7
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
8
|
+
import { {{name}} } from '{{modulePath}}';
|
|
9
|
+
{{/each}}
|
|
10
|
+
{{#if authenticationModule}}
|
|
11
|
+
import { expressAuthentication } from '{{authenticationModule}}';
|
|
12
|
+
// @ts-ignore - no great way to install types from subpackage
|
|
13
|
+
{{/if}}
|
|
14
|
+
{{#if iocModule}}
|
|
15
|
+
import { iocContainer } from '{{iocModule}}';
|
|
16
|
+
import type { IocContainer, IocContainerFactory } from '@tsoa-next/runtime';
|
|
17
|
+
{{/if}}
|
|
18
|
+
import type { Request as ExRequest, Response as ExResponse, RequestHandler, Router } from 'express';
|
|
19
|
+
{{#if useFileUploads}}
|
|
20
|
+
{{#if esm}}
|
|
21
|
+
import multer from 'multer';
|
|
22
|
+
{{else}}
|
|
23
|
+
const multer = require('multer');
|
|
24
|
+
{{/if}}
|
|
25
|
+
|
|
26
|
+
{{/if}}
|
|
27
|
+
|
|
28
|
+
{{#if authenticationModule}}
|
|
29
|
+
const expressAuthenticationRecasted = expressAuthentication as (req: ExRequest, securityName: string, scopes?: string[], res?: ExResponse) => Promise<any>;
|
|
30
|
+
{{/if}}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
34
|
+
|
|
35
|
+
const models: TsoaRoute.Models = {
|
|
36
|
+
{{#each models}}
|
|
37
|
+
"{{@key}}": {
|
|
38
|
+
{{#if enums}}
|
|
39
|
+
"dataType": "refEnum",
|
|
40
|
+
"enums": {{{json enums}}},
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#if properties}}
|
|
43
|
+
"dataType": "refObject",
|
|
44
|
+
"properties": {
|
|
45
|
+
{{#each properties}}
|
|
46
|
+
"{{@key}}": {{{json this}}},
|
|
47
|
+
{{/each}}
|
|
48
|
+
},
|
|
49
|
+
"additionalProperties": {{{json additionalProperties}}},
|
|
50
|
+
{{/if}}
|
|
51
|
+
{{#if type}}
|
|
52
|
+
"dataType": "refAlias",
|
|
53
|
+
"type": {{{json type}}},
|
|
54
|
+
{{/if}}
|
|
55
|
+
},
|
|
56
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
57
|
+
{{/each}}
|
|
58
|
+
};
|
|
59
|
+
const templateService = new ExpressTemplateService(models, {{{ json minimalSwaggerConfig}}});
|
|
60
|
+
|
|
61
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
{{#if useFileUploads}}
|
|
67
|
+
export function RegisterRoutes(app: Router,opts?:{multer?:ReturnType<typeof multer>}) {
|
|
68
|
+
{{else}}
|
|
69
|
+
export function RegisterRoutes(app: Router) {
|
|
70
|
+
{{/if}}
|
|
71
|
+
|
|
72
|
+
// ###########################################################################################################
|
|
73
|
+
// NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look
|
|
74
|
+
// Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa
|
|
75
|
+
// ###########################################################################################################
|
|
76
|
+
|
|
77
|
+
{{#if useFileUploads}}
|
|
78
|
+
const upload = opts?.multer || multer({{{json multerOpts}}});
|
|
79
|
+
{{/if}}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
{{#each controllers}}
|
|
83
|
+
{{#each actions}}
|
|
84
|
+
const args{{../name}}_{{name}}: Record<string, TsoaRoute.ParameterSchema> = {
|
|
85
|
+
{{#each parameters}}
|
|
86
|
+
{{@key}}: {{{json this}}},
|
|
87
|
+
{{/each}}
|
|
88
|
+
};
|
|
89
|
+
app.{{method}}('{{fullPath}}',
|
|
90
|
+
{{#if security.length}}
|
|
91
|
+
authenticateMiddleware({{json security}}),
|
|
92
|
+
{{/if}}
|
|
93
|
+
{{#if uploadFile}}
|
|
94
|
+
upload.fields([
|
|
95
|
+
{{#each uploadFileName}}
|
|
96
|
+
{
|
|
97
|
+
name: {{json name}},
|
|
98
|
+
{{#if maxCount}}
|
|
99
|
+
maxCount: {{maxCount}}
|
|
100
|
+
{{/if}}
|
|
101
|
+
}{{#if @last}}{{else}},{{/if}}
|
|
102
|
+
{{/each}}
|
|
103
|
+
]),
|
|
104
|
+
{{/if}}
|
|
105
|
+
...(fetchMiddlewares<RequestHandler>({{../name}})),
|
|
106
|
+
...(fetchMiddlewares<RequestHandler>({{../name}}.prototype.{{name}})),
|
|
107
|
+
|
|
108
|
+
async function {{../name}}_{{name}}(request: ExRequest, response: ExResponse, next: any) {
|
|
109
|
+
|
|
110
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
111
|
+
|
|
112
|
+
let validatedArgs: any[] = [];
|
|
113
|
+
try {
|
|
114
|
+
validatedArgs = templateService.getValidatedArgs({ args: args{{../name}}_{{name}}, request, response });
|
|
115
|
+
|
|
116
|
+
{{#if ../../iocModule}}
|
|
117
|
+
const container: IocContainer = typeof iocContainer === 'function' ? (iocContainer as IocContainerFactory)(request) : iocContainer;
|
|
118
|
+
|
|
119
|
+
const controller: any = await container.get<{{../name}}>({{../name}});
|
|
120
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
121
|
+
controller.setStatus(undefined);
|
|
122
|
+
}
|
|
123
|
+
{{else}}
|
|
124
|
+
const controller = new {{../name}}();
|
|
125
|
+
{{/if}}
|
|
126
|
+
|
|
127
|
+
await templateService.apiHandler({
|
|
128
|
+
methodName: '{{name}}',
|
|
129
|
+
controller,
|
|
130
|
+
response,
|
|
131
|
+
next,
|
|
132
|
+
validatedArgs,
|
|
133
|
+
successStatus: {{successStatus}},
|
|
134
|
+
});
|
|
135
|
+
} catch (err) {
|
|
136
|
+
return next(err);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
140
|
+
{{/each}}
|
|
141
|
+
{{/each}}
|
|
142
|
+
|
|
143
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
144
|
+
|
|
145
|
+
{{#if useSecurity}}
|
|
146
|
+
|
|
147
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
148
|
+
|
|
149
|
+
function authenticateMiddleware(security: TsoaRoute.Security[] = []) {
|
|
150
|
+
return async function runAuthenticationMiddleware(request: any, response: any, next: any) {
|
|
151
|
+
|
|
152
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
153
|
+
|
|
154
|
+
// keep track of failed auth attempts so we can hand back the most
|
|
155
|
+
// recent one. This behavior was previously existing so preserving it
|
|
156
|
+
// here
|
|
157
|
+
const failedAttempts: any[] = [];
|
|
158
|
+
const pushAndRethrow = (error: any) => {
|
|
159
|
+
failedAttempts.push(error);
|
|
160
|
+
throw error;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const secMethodOrPromises: Promise<any>[] = [];
|
|
164
|
+
for (const secMethod of security) {
|
|
165
|
+
if (Object.keys(secMethod).length > 1) {
|
|
166
|
+
const secMethodAndPromises: Promise<any>[] = [];
|
|
167
|
+
|
|
168
|
+
for (const name in secMethod) {
|
|
169
|
+
secMethodAndPromises.push(
|
|
170
|
+
expressAuthenticationRecasted(request, name, secMethod[name], response)
|
|
171
|
+
.catch(pushAndRethrow)
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
176
|
+
|
|
177
|
+
secMethodOrPromises.push(Promise.all(secMethodAndPromises)
|
|
178
|
+
.then(users => { return users[0]; }));
|
|
179
|
+
} else {
|
|
180
|
+
for (const name in secMethod) {
|
|
181
|
+
secMethodOrPromises.push(
|
|
182
|
+
expressAuthenticationRecasted(request, name, secMethod[name], response)
|
|
183
|
+
.catch(pushAndRethrow)
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
request['user'] = await Promise.any(secMethodOrPromises);
|
|
193
|
+
|
|
194
|
+
// Response was sent in middleware, abort
|
|
195
|
+
if (response.writableEnded) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
next();
|
|
200
|
+
}
|
|
201
|
+
catch(err) {
|
|
202
|
+
// Show most recent error as response
|
|
203
|
+
const error = failedAttempts.pop();
|
|
204
|
+
error.status = error.status || 401;
|
|
205
|
+
|
|
206
|
+
// Response was sent in middleware, abort
|
|
207
|
+
if (response.writableEnded) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
next(error);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
{{/if}}
|
|
217
|
+
|
|
218
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
|