@catbee/utils 2.0.0-next.0 → 2.0.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/LICENSE +1 -1
- package/README.md +102 -52
- package/array/index.cjs +215 -74
- package/array/index.d.ts +345 -2
- package/array/index.mjs +201 -74
- package/async/index.cjs +116 -39
- package/async/index.d.ts +292 -2
- package/async/index.mjs +116 -40
- package/cache/index.cjs +2 -2
- package/cache/index.d.ts +156 -2
- package/cache/index.mjs +3 -3
- package/config/index.cjs +80 -66
- package/config/index.d.ts +65 -3
- package/config/index.mjs +77 -65
- package/context-store/index.cjs +2 -3
- package/context-store/index.d.ts +193 -2
- package/context-store/index.mjs +2 -3
- package/crypto/index.cjs +55 -5
- package/crypto/index.d.ts +225 -2
- package/crypto/index.mjs +52 -7
- package/date/index.cjs +676 -2
- package/date/index.d.ts +676 -2
- package/date/index.mjs +665 -3
- package/decorator/index.cjs +2172 -0
- package/{decorators/decorators.utils.d.ts → decorator/index.d.ts} +58 -54
- package/decorator/index.mjs +2131 -0
- package/{dir → directory}/index.cjs +5 -4
- package/{dir/dir.utils.d.ts → directory/index.d.ts} +24 -21
- package/{dir → directory}/index.mjs +5 -4
- package/env/index.cjs +100 -68
- package/env/index.d.ts +391 -2
- package/env/index.mjs +100 -68
- package/exception/index.cjs +1 -1
- package/exception/index.d.ts +233 -2
- package/exception/index.mjs +1 -1
- package/fs/index.cjs +71 -37
- package/fs/index.d.ts +206 -2
- package/fs/index.mjs +65 -35
- package/http-status-codes/index.cjs +1 -1
- package/http-status-codes/index.d.ts +268 -2
- package/http-status-codes/index.mjs +1 -1
- package/id/index.cjs +1 -1
- package/id/index.d.ts +38 -2
- package/id/index.mjs +1 -1
- package/index.cjs +13 -13
- package/index.d.ts +5 -5
- package/index.mjs +5 -5
- package/logger/index.cjs +13 -15
- package/logger/index.d.ts +190 -2
- package/logger/index.mjs +14 -16
- package/middleware/index.cjs +1 -1
- package/middleware/index.d.ts +104 -2
- package/middleware/index.mjs +1 -1
- package/object/index.cjs +379 -0
- package/{obj/obj.utils.d.ts → object/index.d.ts} +73 -33
- package/object/index.mjs +360 -0
- package/package.json +41 -23
- package/performance/index.cjs +4 -4
- package/performance/index.d.ts +139 -2
- package/performance/index.mjs +4 -4
- package/request/index.cjs +37 -25
- package/request/index.d.ts +242 -3
- package/request/index.mjs +37 -25
- package/response/index.cjs +1 -1
- package/response/index.d.ts +319 -3
- package/response/index.mjs +1 -1
- package/server/index.cjs +249 -146
- package/server/index.d.ts +866 -5
- package/server/index.mjs +248 -144
- package/stream/index.cjs +1 -1
- package/stream/index.d.ts +91 -2
- package/stream/index.mjs +1 -1
- package/string/index.cjs +34 -1
- package/string/index.d.ts +146 -2
- package/string/index.mjs +31 -2
- package/type/index.cjs +19 -2
- package/type/index.d.ts +144 -2
- package/type/index.mjs +17 -3
- package/types/index.cjs +1 -1
- package/types/index.d.ts +775 -5
- package/types/index.mjs +1 -1
- package/url/index.cjs +63 -5
- package/url/index.d.ts +200 -2
- package/url/index.mjs +59 -6
- package/{validate → validation}/index.cjs +91 -44
- package/{validate/validate.utils.d.ts → validation/index.d.ts} +33 -24
- package/{validate → validation}/index.mjs +87 -44
- package/array/array.utils.d.ts +0 -191
- package/async/async.utils.d.ts +0 -296
- package/cache/cache.utils.d.ts +0 -176
- package/config/config.d.ts +0 -57
- package/context-store/context-store.utils.d.ts +0 -212
- package/crypto/crypto.utils.d.ts +0 -183
- package/date/date.utils.d.ts +0 -190
- package/decorators/index.cjs +0 -913
- package/decorators/index.d.ts +0 -25
- package/decorators/index.mjs +0 -872
- package/dir/index.d.ts +0 -25
- package/env/env.utils.d.ts +0 -400
- package/exception/exception.utils.d.ts +0 -253
- package/fs/fs.utils.d.ts +0 -196
- package/http-status-codes/http-status-codes.d.ts +0 -289
- package/id/id.utils.d.ts +0 -59
- package/logger/logger.utils.d.ts +0 -210
- package/middleware/middleware.utils.d.ts +0 -123
- package/obj/index.cjs +0 -317
- package/obj/index.d.ts +0 -25
- package/obj/index.mjs +0 -301
- package/performance/performance.utils.d.ts +0 -159
- package/request/request.utils.d.ts +0 -109
- package/response/response.utils.d.ts +0 -186
- package/server/server.builder.d.ts +0 -531
- package/server/server.d.ts +0 -303
- package/stream/stream.utils.d.ts +0 -111
- package/string/string.utils.d.ts +0 -124
- package/type/type.utils.d.ts +0 -129
- package/types/api-response.d.ts +0 -175
- package/types/common.d.ts +0 -148
- package/types/config.d.ts +0 -88
- package/types/server.d.ts +0 -291
- package/url/url.utils.d.ts +0 -164
- package/validate/index.d.ts +0 -25
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The MIT License
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Catbee Technologies. https://catbee.in/license
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -22,16 +22,17 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import '
|
|
26
|
-
import
|
|
25
|
+
import * as express_rate_limit from 'express-rate-limit';
|
|
26
|
+
import { RequestHandler, Router } from 'express';
|
|
27
|
+
|
|
27
28
|
/**
|
|
28
29
|
* Supported HTTP methods for route decorators
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'head' | 'trace' | 'connect';
|
|
31
32
|
/**
|
|
32
33
|
* Represents a route definition for controller methods
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
interface RouteDefinition {
|
|
35
36
|
/** The URL path for this route */
|
|
36
37
|
path: string;
|
|
37
38
|
/** HTTP method for this route */
|
|
@@ -42,7 +43,7 @@ export interface RouteDefinition {
|
|
|
42
43
|
/**
|
|
43
44
|
* Parameter decoration definition for method parameters
|
|
44
45
|
*/
|
|
45
|
-
|
|
46
|
+
interface ParamDefinition {
|
|
46
47
|
/** Parameter position in method signature */
|
|
47
48
|
index: number;
|
|
48
49
|
/** Type of parameter (query, body, etc.) */
|
|
@@ -52,15 +53,15 @@ export interface ParamDefinition {
|
|
|
52
53
|
/** Optional ParamOptions for advanced extraction */
|
|
53
54
|
options?: ParamOptions;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
limiter: ReturnType<typeof
|
|
56
|
+
type CachedRateLimiter = {
|
|
57
|
+
limiter: ReturnType<typeof express_rate_limit.rateLimit>;
|
|
57
58
|
config: string;
|
|
58
59
|
};
|
|
59
60
|
type Constructor<T = any> = new (...args: any[]) => T;
|
|
60
|
-
|
|
61
|
-
private instances;
|
|
62
|
-
private constructing;
|
|
63
|
-
private propertyInjections;
|
|
61
|
+
declare class DIContainer {
|
|
62
|
+
private readonly instances;
|
|
63
|
+
private readonly constructing;
|
|
64
|
+
private readonly propertyInjections;
|
|
64
65
|
register<T>(target: Constructor<T>): void;
|
|
65
66
|
/**
|
|
66
67
|
* Register a property injection to be resolved when the target class is instantiated
|
|
@@ -75,14 +76,14 @@ export declare class DIContainer {
|
|
|
75
76
|
*
|
|
76
77
|
* @returns Class decorator that marks a class as injectable and registers it with the DI container.
|
|
77
78
|
*/
|
|
78
|
-
|
|
79
|
+
declare function Injectable(): ClassDecorator;
|
|
79
80
|
/**
|
|
80
81
|
* Inject decorator for injecting dependencies into class properties.
|
|
81
82
|
*
|
|
82
83
|
* @param targetClass - The class to inject
|
|
83
84
|
* @returns Property decorator that injects the specified class into the property
|
|
84
85
|
*/
|
|
85
|
-
|
|
86
|
+
declare function Inject<T>(targetClass: new (...args: any[]) => T): PropertyDecorator;
|
|
86
87
|
/**
|
|
87
88
|
* Inject function for retrieving instances from the DI container.
|
|
88
89
|
* @param targetClass - The class to inject
|
|
@@ -92,7 +93,7 @@ export declare function Inject<T>(targetClass: new (...args: any[]) => T): Prope
|
|
|
92
93
|
* @example
|
|
93
94
|
* const a = inject(TestClass);
|
|
94
95
|
*/
|
|
95
|
-
|
|
96
|
+
declare function inject<T>(targetClass: new (...args: any[]) => T): T;
|
|
96
97
|
/**
|
|
97
98
|
* Decorator for GET HTTP method routes.
|
|
98
99
|
*
|
|
@@ -107,7 +108,7 @@ export declare function inject<T>(targetClass: new (...args: any[]) => T): T;
|
|
|
107
108
|
* }
|
|
108
109
|
* ```
|
|
109
110
|
*/
|
|
110
|
-
|
|
111
|
+
declare const Get: (path: string) => MethodDecorator;
|
|
111
112
|
/**
|
|
112
113
|
* Decorator for POST HTTP method routes.
|
|
113
114
|
*
|
|
@@ -122,56 +123,56 @@ export declare const Get: (path: string) => MethodDecorator;
|
|
|
122
123
|
* }
|
|
123
124
|
* ```
|
|
124
125
|
*/
|
|
125
|
-
|
|
126
|
+
declare const Post: (path: string) => MethodDecorator;
|
|
126
127
|
/**
|
|
127
128
|
* Decorator for PUT HTTP method routes.
|
|
128
129
|
*
|
|
129
130
|
* @param path - URL path for the route
|
|
130
131
|
* @returns Method decorator
|
|
131
132
|
*/
|
|
132
|
-
|
|
133
|
+
declare const Put: (path: string) => MethodDecorator;
|
|
133
134
|
/**
|
|
134
135
|
* Decorator for PATCH HTTP method routes.
|
|
135
136
|
*
|
|
136
137
|
* @param path - URL path for the route
|
|
137
138
|
* @returns Method decorator
|
|
138
139
|
*/
|
|
139
|
-
|
|
140
|
+
declare const Patch: (path: string) => MethodDecorator;
|
|
140
141
|
/**
|
|
141
142
|
* Decorator for DELETE HTTP method routes.
|
|
142
143
|
*
|
|
143
144
|
* @param path - URL path for the route
|
|
144
145
|
* @returns Method decorator
|
|
145
146
|
*/
|
|
146
|
-
|
|
147
|
+
declare const Delete: (path: string) => MethodDecorator;
|
|
147
148
|
/**
|
|
148
149
|
* Decorator for OPTIONS HTTP method routes.
|
|
149
150
|
*
|
|
150
151
|
* @param path - URL path for the route
|
|
151
152
|
* @returns Method decorator
|
|
152
153
|
*/
|
|
153
|
-
|
|
154
|
+
declare const Options: (path: string) => MethodDecorator;
|
|
154
155
|
/**
|
|
155
156
|
* Decorator for HEAD HTTP method routes.
|
|
156
157
|
*
|
|
157
158
|
* @param path - URL path for the route
|
|
158
159
|
* @returns Method decorator
|
|
159
160
|
*/
|
|
160
|
-
|
|
161
|
+
declare const Head: (path: string) => MethodDecorator;
|
|
161
162
|
/**
|
|
162
163
|
* Decorator for TRACE HTTP method routes.
|
|
163
164
|
*
|
|
164
165
|
* @param path - URL path for the route
|
|
165
166
|
* @returns Method decorator
|
|
166
167
|
*/
|
|
167
|
-
|
|
168
|
+
declare const Trace: (path: string) => MethodDecorator;
|
|
168
169
|
/**
|
|
169
170
|
* Decorator for CONNECT HTTP method routes.
|
|
170
171
|
*
|
|
171
172
|
* @param path - URL path for the route
|
|
172
173
|
* @returns Method decorator
|
|
173
174
|
*/
|
|
174
|
-
|
|
175
|
+
declare const Connect: (path: string) => MethodDecorator;
|
|
175
176
|
/**
|
|
176
177
|
* Decorator that marks a class as a controller with a base path.
|
|
177
178
|
* Used as the entry point for routing configuration.
|
|
@@ -187,7 +188,7 @@ export declare const Connect: (path: string) => MethodDecorator;
|
|
|
187
188
|
* }
|
|
188
189
|
* ```
|
|
189
190
|
*/
|
|
190
|
-
|
|
191
|
+
declare function Controller(basePath: string): ClassDecorator;
|
|
191
192
|
/**
|
|
192
193
|
* Decorator that applies middleware to a controller method or an entire controller.
|
|
193
194
|
* Multiple middlewares can be applied and will execute in order.
|
|
@@ -210,7 +211,8 @@ export declare function Controller(basePath: string): ClassDecorator;
|
|
|
210
211
|
* }
|
|
211
212
|
* ```
|
|
212
213
|
*/
|
|
213
|
-
|
|
214
|
+
declare function Use(...middlewares: RequestHandler[]): MethodDecorator & ClassDecorator;
|
|
215
|
+
type StrNumBool = 'string' | 'number' | 'boolean';
|
|
214
216
|
/**
|
|
215
217
|
* Options for parameter decorators
|
|
216
218
|
* @template T - Type of the parameter value after transformation
|
|
@@ -224,9 +226,9 @@ export declare function Use(...middlewares: RequestHandler[]): MethodDecorator &
|
|
|
224
226
|
* @property validate - Custom validation function
|
|
225
227
|
* @property transform - Custom transformation function
|
|
226
228
|
*/
|
|
227
|
-
|
|
229
|
+
interface ParamOptions<T = any> {
|
|
228
230
|
/** Base type of the parameter (default: 'string') */
|
|
229
|
-
type?:
|
|
231
|
+
type?: StrNumBool;
|
|
230
232
|
/** Data structure type (default: 'single') */
|
|
231
233
|
dataType?: 'single' | 'array' | 'object';
|
|
232
234
|
/** Delimiter for array types (default: ',') */
|
|
@@ -250,8 +252,8 @@ export interface ParamOptions<T = any> {
|
|
|
250
252
|
/** Custom transformation function */
|
|
251
253
|
transform?: (value: any) => any;
|
|
252
254
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
declare function createParamDecorator(type: ParamDefinition['type'], key?: string): (paramKey?: string) => ParameterDecorator;
|
|
256
|
+
declare function createParamDecoratorWithoutParam(type: ParamDefinition['type']): () => ParameterDecorator;
|
|
255
257
|
/**
|
|
256
258
|
* Decorator that extracts query parameters from request.
|
|
257
259
|
*
|
|
@@ -268,7 +270,7 @@ export declare function createParamDecoratorWithoutParam(type: ParamDefinition['
|
|
|
268
270
|
* }
|
|
269
271
|
* ```
|
|
270
272
|
*/
|
|
271
|
-
|
|
273
|
+
declare const Query: (paramKey?: string, options?: ParamOptions) => ParameterDecorator;
|
|
272
274
|
/**
|
|
273
275
|
* Decorator that extracts route parameters from request.
|
|
274
276
|
*
|
|
@@ -284,7 +286,7 @@ export declare const Query: (paramKey?: string, options?: ParamOptions) => Param
|
|
|
284
286
|
* }
|
|
285
287
|
* ```
|
|
286
288
|
*/
|
|
287
|
-
|
|
289
|
+
declare const Param: (paramKey?: string, options?: ParamOptions) => ParameterDecorator;
|
|
288
290
|
/**
|
|
289
291
|
* Decorator that extracts body or body property from request.
|
|
290
292
|
*
|
|
@@ -304,7 +306,7 @@ export declare const Param: (paramKey?: string, options?: ParamOptions) => Param
|
|
|
304
306
|
* }
|
|
305
307
|
* ```
|
|
306
308
|
*/
|
|
307
|
-
|
|
309
|
+
declare const Body: (paramKey?: string) => ParameterDecorator;
|
|
308
310
|
/**
|
|
309
311
|
* Decorator that injects a logger instance.
|
|
310
312
|
* @returns Parameter decorator
|
|
@@ -317,7 +319,7 @@ export declare const Body: (paramKey?: string) => ParameterDecorator;
|
|
|
317
319
|
* }
|
|
318
320
|
* ```
|
|
319
321
|
*/
|
|
320
|
-
|
|
322
|
+
declare const ReqLogger: () => ParameterDecorator;
|
|
321
323
|
/**
|
|
322
324
|
* Decorator that extracts request ID from headers.
|
|
323
325
|
* @returns Parameter decorator
|
|
@@ -330,7 +332,7 @@ export declare const ReqLogger: () => ParameterDecorator;
|
|
|
330
332
|
* }
|
|
331
333
|
* ```
|
|
332
334
|
*/
|
|
333
|
-
|
|
335
|
+
declare const ReqId: () => ParameterDecorator;
|
|
334
336
|
/**
|
|
335
337
|
* Decorator that extracts request headers.
|
|
336
338
|
* @param key - Optional key to extract specific header
|
|
@@ -344,7 +346,7 @@ export declare const ReqId: () => ParameterDecorator;
|
|
|
344
346
|
* }
|
|
345
347
|
* ```
|
|
346
348
|
*/
|
|
347
|
-
|
|
349
|
+
declare const ReqHeader: (paramKey?: string) => ParameterDecorator;
|
|
348
350
|
/**
|
|
349
351
|
* Decorator that extracts cookies from request.
|
|
350
352
|
* @param key - Optional key to extract specific cookie
|
|
@@ -358,7 +360,7 @@ export declare const ReqHeader: (paramKey?: string) => ParameterDecorator;
|
|
|
358
360
|
* }
|
|
359
361
|
* ```
|
|
360
362
|
*/
|
|
361
|
-
|
|
363
|
+
declare const ReqCookie: (paramKey?: string) => ParameterDecorator;
|
|
362
364
|
/**
|
|
363
365
|
* Decorator that injects the entire request object.
|
|
364
366
|
*
|
|
@@ -373,7 +375,7 @@ export declare const ReqCookie: (paramKey?: string) => ParameterDecorator;
|
|
|
373
375
|
* }
|
|
374
376
|
* ```
|
|
375
377
|
*/
|
|
376
|
-
|
|
378
|
+
declare const Req: () => ParameterDecorator;
|
|
377
379
|
/**
|
|
378
380
|
* Decorator that injects the response object.
|
|
379
381
|
*
|
|
@@ -388,7 +390,7 @@ export declare const Req: () => ParameterDecorator;
|
|
|
388
390
|
* }
|
|
389
391
|
* ```
|
|
390
392
|
*/
|
|
391
|
-
|
|
393
|
+
declare const Res: () => ParameterDecorator;
|
|
392
394
|
/**
|
|
393
395
|
* Decorator that sets a custom HTTP status code for a response.
|
|
394
396
|
*
|
|
@@ -405,7 +407,7 @@ export declare const Res: () => ParameterDecorator;
|
|
|
405
407
|
* }
|
|
406
408
|
* ```
|
|
407
409
|
*/
|
|
408
|
-
|
|
410
|
+
declare function HttpCode(status: number): MethodDecorator;
|
|
409
411
|
/**
|
|
410
412
|
* Decorator that adds a custom HTTP header to the response.
|
|
411
413
|
*
|
|
@@ -422,7 +424,7 @@ export declare function HttpCode(status: number): MethodDecorator;
|
|
|
422
424
|
* return { data: '...' };
|
|
423
425
|
* }
|
|
424
426
|
*/
|
|
425
|
-
|
|
427
|
+
declare function Header(name: string, value: string): MethodDecorator & ClassDecorator;
|
|
426
428
|
/**
|
|
427
429
|
* Decorator that adds a custom HTTP headers to the response.
|
|
428
430
|
*
|
|
@@ -452,7 +454,7 @@ export declare function Header(name: string, value: string): MethodDecorator & C
|
|
|
452
454
|
*
|
|
453
455
|
* ```
|
|
454
456
|
*/
|
|
455
|
-
|
|
457
|
+
declare function Headers(headers: Record<string, string> | string, value?: string): MethodDecorator & ClassDecorator;
|
|
456
458
|
/**
|
|
457
459
|
* Decorator that registers a function to run before route handler execution.
|
|
458
460
|
* Useful for pre-processing or logging.
|
|
@@ -475,7 +477,7 @@ export declare function Headers(headers: Record<string, string> | string, value?
|
|
|
475
477
|
* }
|
|
476
478
|
* ```
|
|
477
479
|
*/
|
|
478
|
-
|
|
480
|
+
declare function Before(fn: Function): MethodDecorator & ClassDecorator;
|
|
479
481
|
/**
|
|
480
482
|
* Decorator that registers a function to run after route handler execution.
|
|
481
483
|
* Can access the handler's result.
|
|
@@ -499,7 +501,7 @@ export declare function Before(fn: Function): MethodDecorator & ClassDecorator;
|
|
|
499
501
|
* }
|
|
500
502
|
* ```
|
|
501
503
|
*/
|
|
502
|
-
|
|
504
|
+
declare function After(fn: Function): MethodDecorator & ClassDecorator;
|
|
503
505
|
/**
|
|
504
506
|
* Decorator that requires specific roles for accessing a route.
|
|
505
507
|
* Must be used with authentication middleware.
|
|
@@ -519,7 +521,7 @@ export declare function After(fn: Function): MethodDecorator & ClassDecorator;
|
|
|
519
521
|
* }
|
|
520
522
|
* ```
|
|
521
523
|
*/
|
|
522
|
-
|
|
524
|
+
declare function Roles(...roles: string[]): MethodDecorator & ClassDecorator;
|
|
523
525
|
/**
|
|
524
526
|
* Decorator that redirects to another URL.
|
|
525
527
|
*
|
|
@@ -543,7 +545,7 @@ export declare function Roles(...roles: string[]): MethodDecorator & ClassDecora
|
|
|
543
545
|
* }
|
|
544
546
|
* ```
|
|
545
547
|
*/
|
|
546
|
-
|
|
548
|
+
declare function Redirect(url?: string, statusCode?: number): MethodDecorator;
|
|
547
549
|
/**
|
|
548
550
|
* Decorator that adds caching to a route response.
|
|
549
551
|
*
|
|
@@ -559,7 +561,7 @@ export declare function Redirect(url?: string, statusCode?: number): MethodDecor
|
|
|
559
561
|
* }
|
|
560
562
|
* ```
|
|
561
563
|
*/
|
|
562
|
-
|
|
564
|
+
declare function Cache(ttlSeconds: number): MethodDecorator & ClassDecorator;
|
|
563
565
|
/**
|
|
564
566
|
* Decorator that applies rate limiting to a route.
|
|
565
567
|
* Note: Requires 'express-rate-limit' package to be installed.
|
|
@@ -581,7 +583,7 @@ export declare function Cache(ttlSeconds: number): MethodDecorator & ClassDecora
|
|
|
581
583
|
* }
|
|
582
584
|
* ```
|
|
583
585
|
*/
|
|
584
|
-
|
|
586
|
+
declare function RateLimit(options: {
|
|
585
587
|
max: number;
|
|
586
588
|
windowMs: number;
|
|
587
589
|
standardHeaders?: boolean;
|
|
@@ -608,7 +610,7 @@ export declare function RateLimit(options: {
|
|
|
608
610
|
* }
|
|
609
611
|
* ```
|
|
610
612
|
*/
|
|
611
|
-
|
|
613
|
+
declare function ContentType(type: string): MethodDecorator & ClassDecorator;
|
|
612
614
|
/**
|
|
613
615
|
* Decorator that adds API versioning to a route.
|
|
614
616
|
*
|
|
@@ -638,7 +640,7 @@ export declare function ContentType(type: string): MethodDecorator & ClassDecora
|
|
|
638
640
|
* }
|
|
639
641
|
* ```
|
|
640
642
|
*/
|
|
641
|
-
|
|
643
|
+
declare function Version(version: string, options?: {
|
|
642
644
|
addPrefix?: boolean;
|
|
643
645
|
addHeader?: boolean;
|
|
644
646
|
headerName?: string;
|
|
@@ -658,7 +660,7 @@ export declare function Version(version: string, options?: {
|
|
|
658
660
|
* }
|
|
659
661
|
* ```
|
|
660
662
|
*/
|
|
661
|
-
|
|
663
|
+
declare function Timeout(ms: number): MethodDecorator & ClassDecorator;
|
|
662
664
|
/**
|
|
663
665
|
* Decorator that adds comprehensive logging to a route.
|
|
664
666
|
*
|
|
@@ -687,7 +689,7 @@ export declare function Timeout(ms: number): MethodDecorator & ClassDecorator;
|
|
|
687
689
|
* }
|
|
688
690
|
* ```
|
|
689
691
|
*/
|
|
690
|
-
|
|
692
|
+
declare function Log(options?: {
|
|
691
693
|
logEntry?: boolean;
|
|
692
694
|
logExit?: boolean;
|
|
693
695
|
logBody?: boolean;
|
|
@@ -701,5 +703,7 @@ export declare function Log(options?: {
|
|
|
701
703
|
* @param router - Express router instance
|
|
702
704
|
* @param controllers - Array of controller classes
|
|
703
705
|
*/
|
|
704
|
-
|
|
705
|
-
|
|
706
|
+
declare function registerControllers(router: Router, controllers: any[]): void;
|
|
707
|
+
|
|
708
|
+
export { After, Before, Body, Cache, Connect, ContentType, Controller, DIContainer, Delete, Get, Head, Header, Headers, HttpCode, Inject, Injectable, Log, Options, Param, Patch, Post, Put, Query, RateLimit, Redirect, Req, ReqCookie, ReqHeader, ReqId, ReqLogger, Res, Roles, Timeout, Trace, Use, Version, createParamDecorator, createParamDecoratorWithoutParam, inject, registerControllers };
|
|
709
|
+
export type { CachedRateLimiter, HttpMethod, ParamDefinition, ParamOptions, RouteDefinition };
|