@avleon/core 0.0.26 → 0.0.28

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 (41) hide show
  1. package/README.md +601 -561
  2. package/package.json +38 -6
  3. package/src/application.ts +104 -125
  4. package/src/authentication.ts +16 -16
  5. package/src/cache.ts +91 -91
  6. package/src/collection.test.ts +71 -0
  7. package/src/collection.ts +344 -254
  8. package/src/config.test.ts +35 -0
  9. package/src/config.ts +85 -42
  10. package/src/constants.ts +1 -1
  11. package/src/container.ts +54 -54
  12. package/src/controller.ts +125 -127
  13. package/src/decorators.ts +27 -27
  14. package/src/environment-variables.ts +53 -46
  15. package/src/exceptions/http-exceptions.ts +86 -86
  16. package/src/exceptions/index.ts +1 -1
  17. package/src/exceptions/system-exception.ts +35 -34
  18. package/src/file-storage.ts +206 -206
  19. package/src/helpers.ts +324 -328
  20. package/src/icore.ts +66 -90
  21. package/src/index.ts +30 -30
  22. package/src/interfaces/avleon-application.ts +32 -40
  23. package/src/logger.ts +72 -72
  24. package/src/map-types.ts +159 -159
  25. package/src/middleware.ts +119 -98
  26. package/src/multipart.ts +116 -116
  27. package/src/openapi.ts +372 -372
  28. package/src/params.ts +111 -111
  29. package/src/queue.ts +126 -126
  30. package/src/response.ts +74 -74
  31. package/src/results.ts +30 -30
  32. package/src/route-methods.ts +186 -186
  33. package/src/swagger-schema.ts +213 -213
  34. package/src/testing.ts +220 -220
  35. package/src/types/app-builder.interface.ts +18 -19
  36. package/src/types/application.interface.ts +7 -9
  37. package/src/utils/hash.ts +8 -5
  38. package/src/utils/index.ts +2 -2
  39. package/src/utils/optional-require.ts +50 -50
  40. package/src/validation.ts +160 -156
  41. package/src/validator-extend.ts +25 -25
package/src/openapi.ts CHANGED
@@ -1,372 +1,372 @@
1
- /**
2
- * @copyright 2024
3
- * @author Tareq Hossain
4
- * @email xtrinsic96@gmail.com
5
- * @url https://github.com/xtareq
6
- */
7
- export interface InfoObject {
8
- title: string;
9
- description?: string;
10
- termsOfService?: string;
11
- contact?: ContactObject;
12
- license?: LicenseObject;
13
- version: string;
14
- }
15
- export interface ContactObject {
16
- name?: string;
17
- url?: string;
18
- email?: string;
19
- }
20
- export interface LicenseObject {
21
- name: string;
22
- url?: string;
23
- }
24
- export interface ServerObject {
25
- url: string;
26
- description?: string;
27
- variables?: {
28
- [variable: string]: ServerVariableObject;
29
- };
30
- }
31
- export interface ServerVariableObject {
32
- enum?: string[];
33
- default: string;
34
- description?: string;
35
- }
36
-
37
- export type OpenApiUiOptions = {
38
- logo?: any;
39
- theme?: any;
40
- ui?: "default" | "scalar";
41
- openapi?: string;
42
- configuration?: any;
43
- routePrefix?: string;
44
- info?: InfoObject;
45
- servers?: ServerObject[];
46
- paths?: PathsObject<any>;
47
- components?: ComponentsObject;
48
- security?: SecurityRequirementObject[];
49
- tags?: TagObject[];
50
- externalDocs?: any;
51
- "x-express-openapi-additional-middleware"?: (
52
- | ((request: any, response: any, next: any) => Promise<void>)
53
- | ((request: any, response: any, next: any) => void)
54
- )[];
55
- "x-express-openapi-validation-strict"?: boolean;
56
- };
57
- export interface PathsObject<T extends {} = {}, P extends {} = {}> {
58
- [pattern: string]: (PathItemObject<T> & P) | undefined;
59
- }
60
- enum HttpMethods {
61
- GET = "get",
62
- PUT = "put",
63
- POST = "post",
64
- DELETE = "delete",
65
- OPTIONS = "options",
66
- HEAD = "head",
67
- PATCH = "patch",
68
- TRACE = "trace",
69
- }
70
- export type PathItemObject<T extends {} = {}> = {
71
- $ref?: string;
72
- summary?: string;
73
- description?: string;
74
- servers?: ServerObject[];
75
- parameters?: (ReferenceObject | ParameterObject)[];
76
- } & {
77
- [method in HttpMethods]?: OperationObject<T>;
78
- };
79
- export type OperationObject<T extends {} = {}> = {
80
- tags?: string[];
81
- summary?: string;
82
- description?: string;
83
- externalDocs?: ExternalDocumentationObject;
84
- operationId?: string;
85
- parameters?: (ReferenceObject | ParameterObject)[];
86
- requestBody?: ReferenceObject | RequestBodyObject;
87
- responses: ResponsesObject;
88
- callbacks?: {
89
- [callback: string]: ReferenceObject | CallbackObject;
90
- };
91
- deprecated?: boolean;
92
- security?: SecurityRequirementObject[];
93
- servers?: ServerObject[];
94
- } & T;
95
- export interface ExternalDocumentationObject {
96
- description?: string;
97
- url: string;
98
- }
99
- export interface ParameterObject extends ParameterBaseObject {
100
- name: string;
101
- in: string;
102
- }
103
- export interface HeaderObject extends ParameterBaseObject {}
104
- export interface ParameterBaseObject {
105
- description?: string;
106
- required?: boolean;
107
- deprecated?: boolean;
108
- allowEmptyValue?: boolean;
109
- style?: string;
110
- explode?: boolean;
111
- allowReserved?: boolean;
112
- schema?: ReferenceObject | SchemaObject;
113
- example?: any;
114
- examples?: {
115
- [media: string]: ReferenceObject | ExampleObject;
116
- };
117
- content?: {
118
- [media: string]: MediaTypeObject;
119
- };
120
- }
121
- export type NonArraySchemaObjectType =
122
- | "boolean"
123
- | "object"
124
- | "number"
125
- | "string"
126
- | "integer";
127
- export type ArraySchemaObjectType = "array";
128
- export type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
129
- export interface ArraySchemaObject extends BaseSchemaObject {
130
- type: ArraySchemaObjectType;
131
- items: ReferenceObject | SchemaObject;
132
- }
133
- export interface NonArraySchemaObject extends BaseSchemaObject {
134
- type?: NonArraySchemaObjectType;
135
- }
136
- export interface BaseSchemaObject {
137
- title?: string;
138
- description?: string;
139
- format?: string;
140
- default?: any;
141
- multipleOf?: number;
142
- maximum?: number;
143
- exclusiveMaximum?: boolean;
144
- minimum?: number;
145
- exclusiveMinimum?: boolean;
146
- maxLength?: number;
147
- minLength?: number;
148
- pattern?: string;
149
- additionalProperties?: boolean | ReferenceObject | SchemaObject;
150
- maxItems?: number;
151
- minItems?: number;
152
- uniqueItems?: boolean;
153
- maxProperties?: number;
154
- minProperties?: number;
155
- required?: string[];
156
- enum?: any[];
157
- properties?: {
158
- [name: string]: ReferenceObject | SchemaObject;
159
- };
160
- allOf?: (ReferenceObject | SchemaObject)[];
161
- oneOf?: (ReferenceObject | SchemaObject)[];
162
- anyOf?: (ReferenceObject | SchemaObject)[];
163
- not?: ReferenceObject | SchemaObject;
164
- nullable?: boolean;
165
- discriminator?: DiscriminatorObject;
166
- readOnly?: boolean;
167
- writeOnly?: boolean;
168
- xml?: XMLObject;
169
- externalDocs?: ExternalDocumentationObject;
170
- example?: any;
171
- deprecated?: boolean;
172
- }
173
- export interface DiscriminatorObject {
174
- propertyName: string;
175
- mapping?: {
176
- [value: string]: string;
177
- };
178
- }
179
- export interface XMLObject {
180
- name?: string;
181
- namespace?: string;
182
- prefix?: string;
183
- attribute?: boolean;
184
- wrapped?: boolean;
185
- }
186
- export interface ReferenceObject {
187
- $ref: string;
188
- }
189
- export interface ExampleObject {
190
- summary?: string;
191
- description?: string;
192
- value?: any;
193
- externalValue?: string;
194
- }
195
- export interface MediaTypeObject {
196
- schema?: ReferenceObject | SchemaObject;
197
- example?: any;
198
- examples?: {
199
- [media: string]: ReferenceObject | ExampleObject;
200
- };
201
- encoding?: {
202
- [media: string]: EncodingObject;
203
- };
204
- }
205
- export interface EncodingObject {
206
- contentType?: string;
207
- headers?: {
208
- [header: string]: ReferenceObject | HeaderObject;
209
- };
210
- style?: string;
211
- explode?: boolean;
212
- allowReserved?: boolean;
213
- }
214
- export interface RequestBodyObject {
215
- description?: string;
216
- content: {
217
- [media: string]: MediaTypeObject;
218
- };
219
- required?: boolean;
220
- }
221
- export interface ResponsesObject {
222
- [code: string]: ReferenceObject | ResponseObject;
223
- }
224
- export interface ResponseObject {
225
- description: string;
226
- headers?: {
227
- [header: string]: ReferenceObject | HeaderObject;
228
- };
229
- content?: {
230
- [media: string]: MediaTypeObject;
231
- };
232
- links?: {
233
- [link: string]: ReferenceObject | LinkObject;
234
- };
235
- }
236
- export interface LinkObject {
237
- operationRef?: string;
238
- operationId?: string;
239
- parameters?: {
240
- [parameter: string]: any;
241
- };
242
- requestBody?: any;
243
- description?: string;
244
- server?: ServerObject;
245
- }
246
- export interface CallbackObject {
247
- [url: string]: PathItemObject;
248
- }
249
- export interface SecurityRequirementObject {
250
- [name: string]: string[];
251
- }
252
- export interface ComponentsObject {
253
- schemas?: {
254
- [key: string]: ReferenceObject | SchemaObject;
255
- };
256
- responses?: {
257
- [key: string]: ReferenceObject | ResponseObject;
258
- };
259
- parameters?: {
260
- [key: string]: ReferenceObject | ParameterObject;
261
- };
262
- examples?: {
263
- [key: string]: ReferenceObject | ExampleObject;
264
- };
265
- requestBodies?: {
266
- [key: string]: ReferenceObject | RequestBodyObject;
267
- };
268
- headers?: {
269
- [key: string]: ReferenceObject | HeaderObject;
270
- };
271
- securitySchemes?: {
272
- [key: string]: ReferenceObject | SecuritySchemeObject;
273
- };
274
- links?: {
275
- [key: string]: ReferenceObject | LinkObject;
276
- };
277
- callbacks?: {
278
- [key: string]: ReferenceObject | CallbackObject;
279
- };
280
- }
281
- export type SecuritySchemeObject =
282
- | HttpSecurityScheme
283
- | ApiKeySecurityScheme
284
- | OAuth2SecurityScheme
285
- | OpenIdSecurityScheme;
286
- export interface HttpSecurityScheme {
287
- type: "http";
288
- description?: string;
289
- scheme: string;
290
- bearerFormat?: string;
291
- }
292
- export interface ApiKeySecurityScheme {
293
- type: "apiKey";
294
- description?: string;
295
- name: string;
296
- in: string;
297
- }
298
- export interface OAuth2SecurityScheme {
299
- type: "oauth2";
300
- description?: string;
301
- flows: {
302
- implicit?: {
303
- authorizationUrl: string;
304
- refreshUrl?: string;
305
- scopes: {
306
- [scope: string]: string;
307
- };
308
- };
309
- password?: {
310
- tokenUrl: string;
311
- refreshUrl?: string;
312
- scopes: {
313
- [scope: string]: string;
314
- };
315
- };
316
- clientCredentials?: {
317
- tokenUrl: string;
318
- refreshUrl?: string;
319
- scopes: {
320
- [scope: string]: string;
321
- };
322
- };
323
- authorizationCode?: {
324
- authorizationUrl: string;
325
- tokenUrl: string;
326
- refreshUrl?: string;
327
- scopes: {
328
- [scope: string]: string;
329
- };
330
- };
331
- };
332
- }
333
- export interface OpenIdSecurityScheme {
334
- type: "openIdConnect";
335
- description?: string;
336
- openIdConnectUrl: string;
337
- }
338
- export interface TagObject {
339
- name: string;
340
- description?: string;
341
- externalDocs?: ExternalDocumentationObject;
342
- }
343
-
344
- export type OpenApiOptions = {
345
- exclude?: boolean;
346
- deprecated?: boolean;
347
- tags?: readonly string[];
348
- description?: string;
349
- summary?: string;
350
- components?: ComponentsObject;
351
- response?: any;
352
- responseBody?: any;
353
- requestBody?: any;
354
- } & any;
355
-
356
- export function OpenApi(
357
- options: OpenApiOptions
358
- ): MethodDecorator & ClassDecorator & PropertyDecorator {
359
- return function (
360
- target: Object | Function,
361
- propertyKey?: string | symbol,
362
- descriptor?: PropertyDescriptor
363
- ) {
364
- if (typeof target === "function" && !propertyKey) {
365
- Reflect.defineMetadata("controller:openapi", options, target);
366
- } else if (descriptor) {
367
- Reflect.defineMetadata("route:openapi", options, target, propertyKey!);
368
- } else if (propertyKey) {
369
- Reflect.defineMetadata("property:openapi", options, target, propertyKey);
370
- }
371
- };
372
- }
1
+ /**
2
+ * @copyright 2024
3
+ * @author Tareq Hossain
4
+ * @email xtrinsic96@gmail.com
5
+ * @url https://github.com/xtareq
6
+ */
7
+ export interface InfoObject {
8
+ title: string;
9
+ description?: string;
10
+ termsOfService?: string;
11
+ contact?: ContactObject;
12
+ license?: LicenseObject;
13
+ version: string;
14
+ }
15
+ export interface ContactObject {
16
+ name?: string;
17
+ url?: string;
18
+ email?: string;
19
+ }
20
+ export interface LicenseObject {
21
+ name: string;
22
+ url?: string;
23
+ }
24
+ export interface ServerObject {
25
+ url: string;
26
+ description?: string;
27
+ variables?: {
28
+ [variable: string]: ServerVariableObject;
29
+ };
30
+ }
31
+ export interface ServerVariableObject {
32
+ enum?: string[];
33
+ default: string;
34
+ description?: string;
35
+ }
36
+
37
+ export type OpenApiUiOptions = {
38
+ logo?: any;
39
+ theme?: any;
40
+ ui?: "default" | "scalar";
41
+ openapi?: string;
42
+ configuration?: any;
43
+ routePrefix?: string;
44
+ info?: InfoObject;
45
+ servers?: ServerObject[];
46
+ paths?: PathsObject<any>;
47
+ components?: ComponentsObject;
48
+ security?: SecurityRequirementObject[];
49
+ tags?: TagObject[];
50
+ externalDocs?: any;
51
+ "x-express-openapi-additional-middleware"?: (
52
+ | ((request: any, response: any, next: any) => Promise<void>)
53
+ | ((request: any, response: any, next: any) => void)
54
+ )[];
55
+ "x-express-openapi-validation-strict"?: boolean;
56
+ };
57
+ export interface PathsObject<T extends {} = {}, P extends {} = {}> {
58
+ [pattern: string]: (PathItemObject<T> & P) | undefined;
59
+ }
60
+ enum HttpMethods {
61
+ GET = "get",
62
+ PUT = "put",
63
+ POST = "post",
64
+ DELETE = "delete",
65
+ OPTIONS = "options",
66
+ HEAD = "head",
67
+ PATCH = "patch",
68
+ TRACE = "trace",
69
+ }
70
+ export type PathItemObject<T extends {} = {}> = {
71
+ $ref?: string;
72
+ summary?: string;
73
+ description?: string;
74
+ servers?: ServerObject[];
75
+ parameters?: (ReferenceObject | ParameterObject)[];
76
+ } & {
77
+ [method in HttpMethods]?: OperationObject<T>;
78
+ };
79
+ export type OperationObject<T extends {} = {}> = {
80
+ tags?: string[];
81
+ summary?: string;
82
+ description?: string;
83
+ externalDocs?: ExternalDocumentationObject;
84
+ operationId?: string;
85
+ parameters?: (ReferenceObject | ParameterObject)[];
86
+ requestBody?: ReferenceObject | RequestBodyObject;
87
+ responses: ResponsesObject;
88
+ callbacks?: {
89
+ [callback: string]: ReferenceObject | CallbackObject;
90
+ };
91
+ deprecated?: boolean;
92
+ security?: SecurityRequirementObject[];
93
+ servers?: ServerObject[];
94
+ } & T;
95
+ export interface ExternalDocumentationObject {
96
+ description?: string;
97
+ url: string;
98
+ }
99
+ export interface ParameterObject extends ParameterBaseObject {
100
+ name: string;
101
+ in: string;
102
+ }
103
+ export interface HeaderObject extends ParameterBaseObject {}
104
+ export interface ParameterBaseObject {
105
+ description?: string;
106
+ required?: boolean;
107
+ deprecated?: boolean;
108
+ allowEmptyValue?: boolean;
109
+ style?: string;
110
+ explode?: boolean;
111
+ allowReserved?: boolean;
112
+ schema?: ReferenceObject | SchemaObject;
113
+ example?: any;
114
+ examples?: {
115
+ [media: string]: ReferenceObject | ExampleObject;
116
+ };
117
+ content?: {
118
+ [media: string]: MediaTypeObject;
119
+ };
120
+ }
121
+ export type NonArraySchemaObjectType =
122
+ | "boolean"
123
+ | "object"
124
+ | "number"
125
+ | "string"
126
+ | "integer";
127
+ export type ArraySchemaObjectType = "array";
128
+ export type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
129
+ export interface ArraySchemaObject extends BaseSchemaObject {
130
+ type: ArraySchemaObjectType;
131
+ items: ReferenceObject | SchemaObject;
132
+ }
133
+ export interface NonArraySchemaObject extends BaseSchemaObject {
134
+ type?: NonArraySchemaObjectType;
135
+ }
136
+ export interface BaseSchemaObject {
137
+ title?: string;
138
+ description?: string;
139
+ format?: string;
140
+ default?: any;
141
+ multipleOf?: number;
142
+ maximum?: number;
143
+ exclusiveMaximum?: boolean;
144
+ minimum?: number;
145
+ exclusiveMinimum?: boolean;
146
+ maxLength?: number;
147
+ minLength?: number;
148
+ pattern?: string;
149
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
150
+ maxItems?: number;
151
+ minItems?: number;
152
+ uniqueItems?: boolean;
153
+ maxProperties?: number;
154
+ minProperties?: number;
155
+ required?: string[];
156
+ enum?: any[];
157
+ properties?: {
158
+ [name: string]: ReferenceObject | SchemaObject;
159
+ };
160
+ allOf?: (ReferenceObject | SchemaObject)[];
161
+ oneOf?: (ReferenceObject | SchemaObject)[];
162
+ anyOf?: (ReferenceObject | SchemaObject)[];
163
+ not?: ReferenceObject | SchemaObject;
164
+ nullable?: boolean;
165
+ discriminator?: DiscriminatorObject;
166
+ readOnly?: boolean;
167
+ writeOnly?: boolean;
168
+ xml?: XMLObject;
169
+ externalDocs?: ExternalDocumentationObject;
170
+ example?: any;
171
+ deprecated?: boolean;
172
+ }
173
+ export interface DiscriminatorObject {
174
+ propertyName: string;
175
+ mapping?: {
176
+ [value: string]: string;
177
+ };
178
+ }
179
+ export interface XMLObject {
180
+ name?: string;
181
+ namespace?: string;
182
+ prefix?: string;
183
+ attribute?: boolean;
184
+ wrapped?: boolean;
185
+ }
186
+ export interface ReferenceObject {
187
+ $ref: string;
188
+ }
189
+ export interface ExampleObject {
190
+ summary?: string;
191
+ description?: string;
192
+ value?: any;
193
+ externalValue?: string;
194
+ }
195
+ export interface MediaTypeObject {
196
+ schema?: ReferenceObject | SchemaObject;
197
+ example?: any;
198
+ examples?: {
199
+ [media: string]: ReferenceObject | ExampleObject;
200
+ };
201
+ encoding?: {
202
+ [media: string]: EncodingObject;
203
+ };
204
+ }
205
+ export interface EncodingObject {
206
+ contentType?: string;
207
+ headers?: {
208
+ [header: string]: ReferenceObject | HeaderObject;
209
+ };
210
+ style?: string;
211
+ explode?: boolean;
212
+ allowReserved?: boolean;
213
+ }
214
+ export interface RequestBodyObject {
215
+ description?: string;
216
+ content: {
217
+ [media: string]: MediaTypeObject;
218
+ };
219
+ required?: boolean;
220
+ }
221
+ export interface ResponsesObject {
222
+ [code: string]: ReferenceObject | ResponseObject;
223
+ }
224
+ export interface ResponseObject {
225
+ description: string;
226
+ headers?: {
227
+ [header: string]: ReferenceObject | HeaderObject;
228
+ };
229
+ content?: {
230
+ [media: string]: MediaTypeObject;
231
+ };
232
+ links?: {
233
+ [link: string]: ReferenceObject | LinkObject;
234
+ };
235
+ }
236
+ export interface LinkObject {
237
+ operationRef?: string;
238
+ operationId?: string;
239
+ parameters?: {
240
+ [parameter: string]: any;
241
+ };
242
+ requestBody?: any;
243
+ description?: string;
244
+ server?: ServerObject;
245
+ }
246
+ export interface CallbackObject {
247
+ [url: string]: PathItemObject;
248
+ }
249
+ export interface SecurityRequirementObject {
250
+ [name: string]: string[];
251
+ }
252
+ export interface ComponentsObject {
253
+ schemas?: {
254
+ [key: string]: ReferenceObject | SchemaObject;
255
+ };
256
+ responses?: {
257
+ [key: string]: ReferenceObject | ResponseObject;
258
+ };
259
+ parameters?: {
260
+ [key: string]: ReferenceObject | ParameterObject;
261
+ };
262
+ examples?: {
263
+ [key: string]: ReferenceObject | ExampleObject;
264
+ };
265
+ requestBodies?: {
266
+ [key: string]: ReferenceObject | RequestBodyObject;
267
+ };
268
+ headers?: {
269
+ [key: string]: ReferenceObject | HeaderObject;
270
+ };
271
+ securitySchemes?: {
272
+ [key: string]: ReferenceObject | SecuritySchemeObject;
273
+ };
274
+ links?: {
275
+ [key: string]: ReferenceObject | LinkObject;
276
+ };
277
+ callbacks?: {
278
+ [key: string]: ReferenceObject | CallbackObject;
279
+ };
280
+ }
281
+ export type SecuritySchemeObject =
282
+ | HttpSecurityScheme
283
+ | ApiKeySecurityScheme
284
+ | OAuth2SecurityScheme
285
+ | OpenIdSecurityScheme;
286
+ export interface HttpSecurityScheme {
287
+ type: "http";
288
+ description?: string;
289
+ scheme: string;
290
+ bearerFormat?: string;
291
+ }
292
+ export interface ApiKeySecurityScheme {
293
+ type: "apiKey";
294
+ description?: string;
295
+ name: string;
296
+ in: string;
297
+ }
298
+ export interface OAuth2SecurityScheme {
299
+ type: "oauth2";
300
+ description?: string;
301
+ flows: {
302
+ implicit?: {
303
+ authorizationUrl: string;
304
+ refreshUrl?: string;
305
+ scopes: {
306
+ [scope: string]: string;
307
+ };
308
+ };
309
+ password?: {
310
+ tokenUrl: string;
311
+ refreshUrl?: string;
312
+ scopes: {
313
+ [scope: string]: string;
314
+ };
315
+ };
316
+ clientCredentials?: {
317
+ tokenUrl: string;
318
+ refreshUrl?: string;
319
+ scopes: {
320
+ [scope: string]: string;
321
+ };
322
+ };
323
+ authorizationCode?: {
324
+ authorizationUrl: string;
325
+ tokenUrl: string;
326
+ refreshUrl?: string;
327
+ scopes: {
328
+ [scope: string]: string;
329
+ };
330
+ };
331
+ };
332
+ }
333
+ export interface OpenIdSecurityScheme {
334
+ type: "openIdConnect";
335
+ description?: string;
336
+ openIdConnectUrl: string;
337
+ }
338
+ export interface TagObject {
339
+ name: string;
340
+ description?: string;
341
+ externalDocs?: ExternalDocumentationObject;
342
+ }
343
+
344
+ export type OpenApiOptions = {
345
+ exclude?: boolean;
346
+ deprecated?: boolean;
347
+ tags?: readonly string[];
348
+ description?: string;
349
+ summary?: string;
350
+ components?: ComponentsObject;
351
+ response?: any;
352
+ responseBody?: any;
353
+ requestBody?: any;
354
+ } & any;
355
+
356
+ export function OpenApi(
357
+ options: OpenApiOptions,
358
+ ): MethodDecorator & ClassDecorator & PropertyDecorator {
359
+ return function (
360
+ target: Object | Function,
361
+ propertyKey?: string | symbol,
362
+ descriptor?: PropertyDescriptor,
363
+ ) {
364
+ if (typeof target === "function" && !propertyKey) {
365
+ Reflect.defineMetadata("controller:openapi", options, target);
366
+ } else if (descriptor) {
367
+ Reflect.defineMetadata("route:openapi", options, target, propertyKey!);
368
+ } else if (propertyKey) {
369
+ Reflect.defineMetadata("property:openapi", options, target, propertyKey);
370
+ }
371
+ };
372
+ }