@tsoa-next/runtime 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.
Files changed (92) hide show
  1. package/README.MD +3 -0
  2. package/dist/config.d.ts +240 -0
  3. package/dist/config.js +3 -0
  4. package/dist/config.js.map +1 -0
  5. package/dist/decorators/customAttribute.d.ts +1 -0
  6. package/dist/decorators/customAttribute.js +9 -0
  7. package/dist/decorators/customAttribute.js.map +1 -0
  8. package/dist/decorators/deprecated.d.ts +4 -0
  9. package/dist/decorators/deprecated.js +12 -0
  10. package/dist/decorators/deprecated.js.map +1 -0
  11. package/dist/decorators/example.d.ts +1 -0
  12. package/dist/decorators/example.js +9 -0
  13. package/dist/decorators/example.js.map +1 -0
  14. package/dist/decorators/extension.d.ts +4 -0
  15. package/dist/decorators/extension.js +9 -0
  16. package/dist/decorators/extension.js.map +1 -0
  17. package/dist/decorators/methods.d.ts +7 -0
  18. package/dist/decorators/methods.js +45 -0
  19. package/dist/decorators/methods.js.map +1 -0
  20. package/dist/decorators/middlewares.d.ts +15 -0
  21. package/dist/decorators/middlewares.js +53 -0
  22. package/dist/decorators/middlewares.js.map +1 -0
  23. package/dist/decorators/operationid.d.ts +1 -0
  24. package/dist/decorators/operationid.js +9 -0
  25. package/dist/decorators/operationid.js.map +1 -0
  26. package/dist/decorators/parameter.d.ts +73 -0
  27. package/dist/decorators/parameter.js +141 -0
  28. package/dist/decorators/parameter.js.map +1 -0
  29. package/dist/decorators/response.d.ts +17 -0
  30. package/dist/decorators/response.js +38 -0
  31. package/dist/decorators/response.js.map +1 -0
  32. package/dist/decorators/route.d.ts +5 -0
  33. package/dist/decorators/route.js +18 -0
  34. package/dist/decorators/route.js.map +1 -0
  35. package/dist/decorators/security.d.ts +10 -0
  36. package/dist/decorators/security.js +21 -0
  37. package/dist/decorators/security.js.map +1 -0
  38. package/dist/decorators/tags.d.ts +1 -0
  39. package/dist/decorators/tags.js +9 -0
  40. package/dist/decorators/tags.js.map +1 -0
  41. package/dist/index.d.ts +24 -0
  42. package/dist/index.js +41 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/interfaces/controller.d.ts +16 -0
  45. package/dist/interfaces/controller.js +24 -0
  46. package/dist/interfaces/controller.js.map +1 -0
  47. package/dist/interfaces/file.d.ts +31 -0
  48. package/dist/interfaces/file.js +3 -0
  49. package/dist/interfaces/file.js.map +1 -0
  50. package/dist/interfaces/iocModule.d.ts +7 -0
  51. package/dist/interfaces/iocModule.js +3 -0
  52. package/dist/interfaces/iocModule.js.map +1 -0
  53. package/dist/interfaces/response.d.ts +5 -0
  54. package/dist/interfaces/response.js +3 -0
  55. package/dist/interfaces/response.js.map +1 -0
  56. package/dist/metadataGeneration/tsoa.d.ts +219 -0
  57. package/dist/metadataGeneration/tsoa.js +3 -0
  58. package/dist/metadataGeneration/tsoa.js.map +1 -0
  59. package/dist/routeGeneration/additionalProps.d.ts +6 -0
  60. package/dist/routeGeneration/additionalProps.js +3 -0
  61. package/dist/routeGeneration/additionalProps.js.map +1 -0
  62. package/dist/routeGeneration/templateHelpers.d.ts +203 -0
  63. package/dist/routeGeneration/templateHelpers.js +859 -0
  64. package/dist/routeGeneration/templateHelpers.js.map +1 -0
  65. package/dist/routeGeneration/templates/express/expressTemplateService.d.ts +29 -0
  66. package/dist/routeGeneration/templates/express/expressTemplateService.js +118 -0
  67. package/dist/routeGeneration/templates/express/expressTemplateService.js.map +1 -0
  68. package/dist/routeGeneration/templates/hapi/hapiTemplateService.d.ts +36 -0
  69. package/dist/routeGeneration/templates/hapi/hapiTemplateService.js +120 -0
  70. package/dist/routeGeneration/templates/hapi/hapiTemplateService.js.map +1 -0
  71. package/dist/routeGeneration/templates/index.d.ts +4 -0
  72. package/dist/routeGeneration/templates/index.js +21 -0
  73. package/dist/routeGeneration/templates/index.js.map +1 -0
  74. package/dist/routeGeneration/templates/koa/koaTemplateService.d.ts +29 -0
  75. package/dist/routeGeneration/templates/koa/koaTemplateService.js +116 -0
  76. package/dist/routeGeneration/templates/koa/koaTemplateService.js.map +1 -0
  77. package/dist/routeGeneration/templates/templateService.d.ts +15 -0
  78. package/dist/routeGeneration/templates/templateService.js +37 -0
  79. package/dist/routeGeneration/templates/templateService.js.map +1 -0
  80. package/dist/routeGeneration/tsoa-route.d.ts +56 -0
  81. package/dist/routeGeneration/tsoa-route.js +11 -0
  82. package/dist/routeGeneration/tsoa-route.js.map +1 -0
  83. package/dist/swagger/swagger.d.ts +550 -0
  84. package/dist/swagger/swagger.js +12 -0
  85. package/dist/swagger/swagger.js.map +1 -0
  86. package/dist/utils/assertNever.d.ts +4 -0
  87. package/dist/utils/assertNever.js +10 -0
  88. package/dist/utils/assertNever.js.map +1 -0
  89. package/dist/utils/isHeaderType.d.ts +5 -0
  90. package/dist/utils/isHeaderType.js +3 -0
  91. package/dist/utils/isHeaderType.js.map +1 -0
  92. package/package.json +64 -0
package/README.MD ADDED
@@ -0,0 +1,3 @@
1
+ This package contains the runtime helpers for tsoa.
2
+
3
+ For a comprehensive Readme, please refer to [the main readme](https://github.com/lukeautry/tsoa#readme).
@@ -0,0 +1,240 @@
1
+ import { Swagger } from './swagger/swagger';
2
+ import { Options as MulterOpts } from 'multer';
3
+ export interface Config {
4
+ /**
5
+ * Swagger generation configuration object
6
+ */
7
+ spec: SpecConfig;
8
+ /**
9
+ * Route generation configuration object
10
+ */
11
+ routes: RoutesConfig;
12
+ /**
13
+ * Directories to ignore during TypeScript metadata scan
14
+ */
15
+ ignore?: string[];
16
+ /**
17
+ * The entry point to your API
18
+ */
19
+ entryFile: string;
20
+ /**
21
+ * An array of path globs that point to your route controllers that you would like to have tsoa include.
22
+ */
23
+ controllerPathGlobs?: string[];
24
+ /**
25
+ * Modes that allow you to prevent input data from entering into your API. This will document your decision in the swagger.yaml and it will turn on excess-property validation (at runtime) in your routes.
26
+ */
27
+ noImplicitAdditionalProperties?: 'throw-on-extras' | 'silently-remove-extras' | 'ignore';
28
+ /**
29
+ * Typescript CompilerOptions to be used during generation
30
+ *
31
+ * @type {Record<string, unknown>}
32
+ * @memberof RoutesConfig
33
+ */
34
+ compilerOptions?: Record<string, unknown>;
35
+ /**
36
+ * Multer's options to generate multer's middleware.
37
+ * It doesn't support storage option
38
+ *
39
+ * @example {
40
+ * "dest": "/tmp"
41
+ * } Allow multer to write to file instead of using Memory's buffer
42
+ * @deprecated
43
+ * since v6.4.0 instroduces RegisterRoutes can pass multerOptions,
44
+ * we will quickly remove this options soon at future version.
45
+ * (https://github.com/lukeautry/tsoa/issues/1587#issuecomment-2391291433)
46
+ * (https://github.com/lukeautry/tsoa/pull/1638)
47
+ */
48
+ multerOpts?: MulterOpts;
49
+ defaultNumberType?: 'double' | 'float' | 'integer' | 'long';
50
+ }
51
+ /**
52
+ * these options will be removed in a future version since we would prefer consumers to explicitly state their preference that the tsoa validation throws or removes additional properties
53
+ */
54
+ export type DeprecatedOptionForAdditionalPropertiesHandling = true | false;
55
+ export interface SpecConfig {
56
+ /**
57
+ * Generated SwaggerConfig.json will output here
58
+ */
59
+ outputDirectory: string;
60
+ /**
61
+ * API host, expressTemplate.g. localhost:3000 or myapi.com
62
+ */
63
+ host?: string;
64
+ /**
65
+ * API servers, expressTemplate.g. [production.api.com, staging.api.com]
66
+ *
67
+ * Only available with the specVersion 3
68
+ */
69
+ servers?: string[];
70
+ /**
71
+ * Base-name of swagger.json or swagger.yaml.
72
+ *
73
+ * @default: "swagger"
74
+ */
75
+ specFileBaseName?: string;
76
+ /**
77
+
78
+ * API version number; defaults to npm package version
79
+ */
80
+ version?: string;
81
+ /**
82
+ * Major OpenAPI version to generate; defaults to version 2 when not specified
83
+ * Possible values:
84
+ * - 2: generates OpenAPI version 2.
85
+ * - 3: generates OpenAPI version 3.
86
+ * - 3.1: generates OpenAPI version 3.1.
87
+ */
88
+ specVersion?: Swagger.SupportedSpecMajorVersion;
89
+ /**
90
+ * API name; defaults to npm package name
91
+ */
92
+ name?: string;
93
+ /**
94
+ * API description; defaults to npm package description
95
+ */
96
+ description?: string;
97
+ /**
98
+ * Link to the page that describes the terms of service.
99
+ * Must be in the URL format.
100
+ */
101
+ termsOfService?: string;
102
+ /**
103
+ * Contact Information
104
+ */
105
+ contact?: {
106
+ /**
107
+ * The identifying name of the contact person/organization.
108
+ * @default npm package author
109
+ */
110
+ name?: string;
111
+ /**
112
+ * The email address of the contact person/organization.
113
+ * @default npm package author email
114
+ */
115
+ email?: string;
116
+ /**
117
+ * API Info url
118
+ * The URL pointing to the contact information.
119
+ * @default npm package author url
120
+ */
121
+ url?: string;
122
+ };
123
+ /**
124
+ * API license; defaults to npm package license
125
+ */
126
+ license?: string;
127
+ /**
128
+ * Base API path; e.g. the 'v1' in https://myapi.com/v1
129
+ */
130
+ basePath?: string;
131
+ /**
132
+ * Base API prefix slash toggle
133
+ * e.g. the 'v1' with toggle true will be https://myapi.comv1
134
+ * Otherwise, http://myapi.com/v1
135
+ *
136
+ * Only available with the specVersion 3
137
+ */
138
+ disableBasePathPrefixSlash?: boolean;
139
+ /**
140
+ * Extend generated swagger spec with this object
141
+ * Note that generated properties will always take precedence over what get specified here
142
+ */
143
+ spec?: unknown;
144
+ /**
145
+ * Alter how the spec is merged to generated swagger spec.
146
+ * Possible values:
147
+ * - 'immediate' is overriding top level elements only thus you can not append a new path or alter an existing value without erasing same level elements.
148
+ * - 'recursive' proceed to a deep merge and will concat every branches or override or create new values if needed. @see https://www.npmjs.com/package/merge
149
+ * - 'deepmerge' uses `ts-deepmerge` to merge, which will concat object branches and concat arrays as well @see https://www.npmjs.com/package/deepmerge @see https://github.com/voodoocreation/ts-deepmerge
150
+ * The default is set to immediate so it is not breaking previous versions.
151
+ * @default 'immediate'
152
+ */
153
+ specMerging?: 'immediate' | 'recursive' | 'deepmerge';
154
+ /**
155
+ * Template string for generating operation ids.
156
+ * This should be a valid handlebars template and is provided
157
+ * with the following context:
158
+ * - 'controllerName' - String name of controller class.
159
+ * - 'method' - Tsoa.Method object.
160
+ *
161
+ * @default '{{titleCase method.name}}'
162
+ */
163
+ operationIdTemplate?: string;
164
+ /**
165
+ * Security Definitions Object
166
+ * A declaration of the security schemes available to be used in the
167
+ * specification. This does not enforce the security schemes on the operations
168
+ * and only serves to provide the relevant details for each scheme.
169
+ */
170
+ securityDefinitions?: {
171
+ [name: string]: Swagger.SecuritySchemes;
172
+ };
173
+ /**
174
+ * Swagger Tags Information for your API
175
+ */
176
+ tags?: Swagger.Tag[];
177
+ yaml?: boolean;
178
+ schemes?: Swagger.Protocol[];
179
+ /**
180
+ * Enable x-enum-varnames support
181
+ * @default false
182
+ */
183
+ xEnumVarnames?: boolean;
184
+ /**
185
+ * Sets a title for inline objects for responses and requestBodies
186
+ * This helps to generate more consistent clients
187
+ */
188
+ useTitleTagsForInlineObjects?: boolean;
189
+ /**
190
+ * Applies a default security to the entire API.
191
+ * Can be overridden with @Security or @NoSecurity decorators on controllers or methods
192
+ */
193
+ rootSecurity?: Swagger.Security[];
194
+ }
195
+ export interface RoutesConfig {
196
+ /**
197
+ * Routes directory; generated routes.ts (which contains the generated code wiring up routes using middleware of choice) will be dropped here
198
+ */
199
+ routesDir: string;
200
+ /**
201
+ * Routes filename; the filename of the generated route file ('routes.ts' by default)
202
+ */
203
+ routesFileName?: string;
204
+ /**
205
+ * Avoid writing the generated route file if the existing file is identical (useful to optimize watch processes); false by default
206
+ */
207
+ noWriteIfUnchanged?: boolean;
208
+ /**
209
+ * Base API path; e.g. the '/v1' in https://myapi.com/v1
210
+ */
211
+ basePath?: string;
212
+ /**
213
+ * Middleware provider.
214
+ */
215
+ middleware?: 'express' | 'hapi' | 'koa';
216
+ /**
217
+ * Override the Middleware template
218
+ */
219
+ middlewareTemplate?: string;
220
+ /**
221
+ * IOC module; e.g. './inversify/ioc' where IOC container named `iocContainer` is defined (https://github.com/inversify/InversifyJS)
222
+ */
223
+ iocModule?: string;
224
+ /**
225
+ * Authentication Module for express, hapi and koa
226
+ */
227
+ authenticationModule?: string;
228
+ /**
229
+ * When enabled, the imports in the routes files will have a `.js` extention to support esm.
230
+ *
231
+ * @default false
232
+ */
233
+ esm?: boolean;
234
+ bodyCoercion?: boolean;
235
+ /**
236
+ * When enabled, the imports in the routes files will keep having a `.ts` extention to support the TypeScript 5.7 feature rewriteRelativeImportExtensions.
237
+ * @default false
238
+ */
239
+ rewriteRelativeImportExtensions?: boolean;
240
+ }
package/dist/config.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare function CustomAttribute(_name: string, _value: string): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomAttribute = CustomAttribute;
4
+ function CustomAttribute(_name, _value) {
5
+ return () => {
6
+ return;
7
+ };
8
+ }
9
+ //# sourceMappingURL=customAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customAttribute.js","sourceRoot":"","sources":["../../src/decorators/customAttribute.ts"],"names":[],"mappings":";;AAAA,0CAIC;AAJD,SAAgB,eAAe,CAAC,KAAa,EAAE,MAAc;IAC3D,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * used to show a method as deprecated on swagger documentation
3
+ */
4
+ export declare function Deprecated(): PropertyDecorator & ClassDecorator & ParameterDecorator;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Deprecated = Deprecated;
4
+ /**
5
+ * used to show a method as deprecated on swagger documentation
6
+ */
7
+ function Deprecated() {
8
+ return () => {
9
+ return;
10
+ };
11
+ }
12
+ //# sourceMappingURL=deprecated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.js","sourceRoot":"","sources":["../../src/decorators/deprecated.ts"],"names":[],"mappings":";;AAGA,gCAIC;AAPD;;GAEG;AACH,SAAgB,UAAU;IACxB,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function Example<T>(exampleModel: T, exampleLabel?: string): PropertyDecorator;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Example = Example;
4
+ function Example(exampleModel, exampleLabel) {
5
+ return () => {
6
+ return;
7
+ };
8
+ }
9
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","sourceRoot":"","sources":["../../src/decorators/example.ts"],"names":[],"mappings":";;AAAA,0BAIC;AAJD,SAAgB,OAAO,CAAI,YAAe,EAAE,YAAqB;IAC/D,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function Extension(_name: string, _value: ExtensionType | ExtensionType[]): PropertyDecorator;
2
+ export type ExtensionType = string | number | boolean | null | ExtensionType[] | {
3
+ [name: string]: ExtensionType | ExtensionType[];
4
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Extension = Extension;
4
+ function Extension(_name, _value) {
5
+ return () => {
6
+ return;
7
+ };
8
+ }
9
+ //# sourceMappingURL=extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/decorators/extension.ts"],"names":[],"mappings":";;AAAA,8BAIC;AAJD,SAAgB,SAAS,CAAC,KAAa,EAAE,MAAuC;IAC9E,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function Options(value?: string): MethodDecorator;
2
+ export declare function Get(value?: string): MethodDecorator;
3
+ export declare function Post(value?: string): MethodDecorator;
4
+ export declare function Put(value?: string): MethodDecorator;
5
+ export declare function Patch(value?: string): MethodDecorator;
6
+ export declare function Delete(value?: string): MethodDecorator;
7
+ export declare function Head(value?: string): MethodDecorator;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Options = Options;
4
+ exports.Get = Get;
5
+ exports.Post = Post;
6
+ exports.Put = Put;
7
+ exports.Patch = Patch;
8
+ exports.Delete = Delete;
9
+ exports.Head = Head;
10
+ function Options(value) {
11
+ return () => {
12
+ return;
13
+ };
14
+ }
15
+ function Get(value) {
16
+ return () => {
17
+ return;
18
+ };
19
+ }
20
+ function Post(value) {
21
+ return () => {
22
+ return;
23
+ };
24
+ }
25
+ function Put(value) {
26
+ return () => {
27
+ return;
28
+ };
29
+ }
30
+ function Patch(value) {
31
+ return () => {
32
+ return;
33
+ };
34
+ }
35
+ function Delete(value) {
36
+ return () => {
37
+ return;
38
+ };
39
+ }
40
+ function Head(value) {
41
+ return () => {
42
+ return;
43
+ };
44
+ }
45
+ //# sourceMappingURL=methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.js","sourceRoot":"","sources":["../../src/decorators/methods.ts"],"names":[],"mappings":";;AAAA,0BAIC;AAED,kBAIC;AAED,oBAIC;AAED,kBAIC;AAED,sBAIC;AAED,wBAIC;AAED,oBAIC;AAxCD,SAAgB,OAAO,CAAC,KAAc;IACpC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,GAAG,CAAC,KAAc;IAChC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,IAAI,CAAC,KAAc;IACjC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,GAAG,CAAC,KAAc;IAChC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,KAAK,CAAC,KAAc;IAClC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,MAAM,CAAC,KAAc;IACnC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC;AAED,SAAgB,IAAI,CAAC,KAAc;IACjC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ type Middleware<T extends CallableFunction | object> = T;
2
+ /**
3
+ * Install middlewares to the Controller or a specific method.
4
+ * @param middlewares
5
+ * @returns
6
+ */
7
+ export declare function Middlewares<T extends CallableFunction | object>(...mws: Array<Middleware<T>>): ClassDecorator & MethodDecorator;
8
+ /**
9
+ * Internal function used to retrieve installed middlewares
10
+ * in controller and methods (used during routes generation)
11
+ * @param target
12
+ * @returns list of middlewares
13
+ */
14
+ export declare function fetchMiddlewares<T extends CallableFunction | object>(target: any): Array<Middleware<T>>;
15
+ export {};
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Middlewares = Middlewares;
4
+ exports.fetchMiddlewares = fetchMiddlewares;
5
+ const TSOA_MIDDLEWARES = Symbol('@tsoa:middlewares');
6
+ /**
7
+ * Helper function to create a decorator
8
+ * that can act as a class and method decorator.
9
+ * @param fn a callback function that accepts
10
+ * the subject of the decorator
11
+ * either the constructor or the
12
+ * method
13
+ * @returns
14
+ */
15
+ function decorator(fn) {
16
+ return (...args) => {
17
+ // class decorator
18
+ if (args.length === 1) {
19
+ fn(args[0]);
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
21
+ }
22
+ else if (args.length === 3 && args[2].value) {
23
+ // method decorator
24
+ const descriptor = args[2];
25
+ if (descriptor.value) {
26
+ fn(descriptor.value);
27
+ }
28
+ }
29
+ };
30
+ }
31
+ /**
32
+ * Install middlewares to the Controller or a specific method.
33
+ * @param middlewares
34
+ * @returns
35
+ */
36
+ function Middlewares(...mws) {
37
+ return decorator(target => {
38
+ if (mws) {
39
+ const current = fetchMiddlewares(target);
40
+ Reflect.defineMetadata(TSOA_MIDDLEWARES, [...current, ...mws], target);
41
+ }
42
+ });
43
+ }
44
+ /**
45
+ * Internal function used to retrieve installed middlewares
46
+ * in controller and methods (used during routes generation)
47
+ * @param target
48
+ * @returns list of middlewares
49
+ */
50
+ function fetchMiddlewares(target) {
51
+ return Reflect.getMetadata(TSOA_MIDDLEWARES, target) || [];
52
+ }
53
+ //# sourceMappingURL=middlewares.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middlewares.js","sourceRoot":"","sources":["../../src/decorators/middlewares.ts"],"names":[],"mappings":";;AAkCA,kCAOC;AAQD,4CAEC;AAjDD,MAAM,gBAAgB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAA;AAEpD;;;;;;;;GAQG;AACH,SAAS,SAAS,CAAC,EAAwB;IACzC,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE;QACxB,kBAAkB;QAClB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;YACX,sEAAsE;QACxE,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YAC9C,mBAAmB;YACnB,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAuB,CAAA;YAChD,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;gBACrB,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAsC,GAAG,GAAyB;IAC3F,OAAO,SAAS,CAAC,MAAM,CAAC,EAAE;QACxB,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,OAAO,GAAG,gBAAgB,CAAI,MAAM,CAAC,CAAA;YAC3C,OAAO,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;QACxE,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAsC,MAAW;IAC/E,OAAO,OAAO,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAA;AAC5D,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function OperationId(value: string): MethodDecorator;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperationId = OperationId;
4
+ function OperationId(value) {
5
+ return () => {
6
+ return;
7
+ };
8
+ }
9
+ //# sourceMappingURL=operationid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operationid.js","sourceRoot":"","sources":["../../src/decorators/operationid.ts"],"names":[],"mappings":";;AAAA,kCAIC;AAJD,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,GAAG,EAAE;QACV,OAAM;IACR,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Inject http Body
3
+ * @param {string} [name] properties name in body object
4
+ */
5
+ export declare function Body(): ParameterDecorator;
6
+ /**
7
+ * Inject value from body
8
+ *
9
+ * @param {string} [name] The name of the body parameter
10
+ */
11
+ export declare function BodyProp(name?: string): ParameterDecorator;
12
+ /**
13
+ * Inject http request
14
+ */
15
+ export declare function Request(): ParameterDecorator;
16
+ /**
17
+ * Inject value from request
18
+ *
19
+ * @param {name} [name] The name of the request parameter
20
+ */
21
+ export declare function RequestProp(name?: string): ParameterDecorator;
22
+ /**
23
+ * Inject value from Path
24
+ *
25
+ * @param {string} [name] The name of the path parameter
26
+ */
27
+ export declare function Path(name?: string): ParameterDecorator;
28
+ /**
29
+ * Inject value from query string
30
+ *
31
+ * @param {string} [name] The name of the query parameter
32
+ */
33
+ export declare function Query(name?: string): ParameterDecorator;
34
+ /**
35
+ * Inject all query values in a single object
36
+ */
37
+ export declare function Queries(): ParameterDecorator;
38
+ /**
39
+ * Inject value from Http header
40
+ *
41
+ * @param {string} [name] The name of the header parameter
42
+ */
43
+ export declare function Header(name?: string): ParameterDecorator;
44
+ /**
45
+ * Mark parameter as manually injected, which will not be generated
46
+ */
47
+ export declare function Inject(): ParameterDecorator;
48
+ /**
49
+ * Inject uploaded file
50
+ *
51
+ * @param {string} [name] The name of the uploaded file parameter
52
+ */
53
+ export declare function UploadedFile(name?: string): ParameterDecorator;
54
+ /**
55
+ * Inject uploaded files
56
+ *
57
+ * @param {string} [name] The name of the uploaded files parameter
58
+ */
59
+ export declare function UploadedFiles(name?: string): ParameterDecorator;
60
+ /**
61
+ * Inject uploaded files
62
+ *
63
+ * @param {string} [name] The name of the uploaded files parameter
64
+ */
65
+ export declare function FormField(name?: string): ParameterDecorator;
66
+ /**
67
+ * Overrides the default media type of request body.
68
+ * Can be used on specific method.
69
+ * Can't be used on controller level.
70
+ *
71
+ * @link https://swagger.io/docs/specification/describing-request-body/
72
+ */
73
+ export declare function Consumes(value: string): MethodDecorator;