exisjs 0.5.5 → 0.5.6
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/dist/app/index.d.ts +4 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +12 -0
- package/dist/app/index.js.map +1 -0
- package/dist/auth/index.d.ts +6 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/{exports/auth.js → auth/index.js} +5 -5
- package/dist/auth/index.js.map +1 -0
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +16 -0
- package/dist/cache/index.js.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +78 -2
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/exports.js +2 -2
- package/dist/cli/commands/exports.js.map +1 -1
- package/dist/cli/manifest.d.ts.map +1 -1
- package/dist/cli/manifest.js +13 -0
- package/dist/cli/manifest.js.map +1 -1
- package/dist/{exports/config.d.ts → config/index.d.ts} +2 -2
- package/dist/config/index.d.ts.map +1 -0
- package/dist/{exports/config.js → config/index.js} +2 -2
- package/dist/config/index.js.map +1 -0
- package/dist/dataloader/index.d.ts +3 -0
- package/dist/dataloader/index.d.ts.map +1 -0
- package/dist/{exports/response.js → dataloader/index.js} +3 -2
- package/dist/dataloader/index.js.map +1 -0
- package/dist/decorators/constants.d.ts +45 -0
- package/dist/decorators/constants.d.ts.map +1 -0
- package/dist/decorators/constants.js +19 -0
- package/dist/decorators/constants.js.map +1 -0
- package/dist/decorators/core.d.ts +29 -0
- package/dist/decorators/core.d.ts.map +1 -0
- package/dist/decorators/core.js +140 -0
- package/dist/decorators/core.js.map +1 -0
- package/dist/decorators/index.d.ts +6 -184
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js +9 -680
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/middleware.d.ts +37 -0
- package/dist/decorators/middleware.d.ts.map +1 -0
- package/dist/decorators/middleware.js +290 -0
- package/dist/decorators/middleware.js.map +1 -0
- package/dist/decorators/params.d.ts +18 -0
- package/dist/decorators/params.d.ts.map +1 -0
- package/dist/decorators/params.js +106 -0
- package/dist/decorators/params.js.map +1 -0
- package/dist/decorators/response.d.ts +32 -0
- package/dist/decorators/response.d.ts.map +1 -0
- package/dist/decorators/response.js +93 -0
- package/dist/decorators/response.js.map +1 -0
- package/dist/decorators/routing.d.ts +39 -0
- package/dist/decorators/routing.d.ts.map +1 -0
- package/dist/decorators/routing.js +75 -0
- package/dist/decorators/routing.js.map +1 -0
- package/dist/di/container.d.ts.map +1 -1
- package/dist/di/container.js +2 -1
- package/dist/di/container.js.map +1 -1
- package/dist/di/index.d.ts +4 -0
- package/dist/di/index.d.ts.map +1 -0
- package/dist/{exports/di.js → di/index.js} +3 -3
- package/dist/di/index.js.map +1 -0
- package/dist/{exports/error.d.ts → error/index.d.ts} +1 -1
- package/dist/error/index.d.ts.map +1 -0
- package/dist/{exports/error.js → error/index.js} +1 -1
- package/dist/error/index.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -39
- package/dist/index.js.map +1 -1
- package/dist/integrations/mongoose.d.ts +2 -2
- package/dist/integrations/mongoose.d.ts.map +1 -1
- package/dist/integrations/mongoose.js +28 -7
- package/dist/integrations/mongoose.js.map +1 -1
- package/dist/lib/start-server.js +42 -3
- package/dist/lib/start-server.js.map +1 -1
- package/dist/middleware/cache.d.ts.map +1 -1
- package/dist/middleware/cache.js +4 -2
- package/dist/middleware/cache.js.map +1 -1
- package/dist/middleware/dedupe.d.ts +11 -0
- package/dist/middleware/dedupe.d.ts.map +1 -1
- package/dist/middleware/dedupe.js +12 -1
- package/dist/middleware/dedupe.js.map +1 -1
- package/dist/module/index.d.ts +3 -0
- package/dist/module/index.d.ts.map +1 -0
- package/dist/{exports/module.js → module/index.js} +2 -2
- package/dist/module/index.js.map +1 -0
- package/dist/observability/metrics.d.ts +6 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +60 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/{exports/plugin.d.ts → plugin/index.d.ts} +1 -1
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/{exports/plugin.js → plugin/index.js} +1 -1
- package/dist/plugin/index.js.map +1 -0
- package/dist/queue/client.d.ts.map +1 -1
- package/dist/queue/client.js +20 -1
- package/dist/queue/client.js.map +1 -1
- package/dist/queue/index.d.ts +6 -0
- package/dist/queue/index.d.ts.map +1 -1
- package/dist/queue/index.js +10 -0
- package/dist/queue/index.js.map +1 -1
- package/dist/{exports/route.d.ts → router/index.d.ts} +3 -3
- package/dist/router/index.d.ts.map +1 -0
- package/dist/{exports/route.js → router/index.js} +2 -2
- package/dist/router/index.js.map +1 -0
- package/dist/{exports/sanitize.d.ts → sanitize/index.d.ts} +1 -1
- package/dist/sanitize/index.d.ts.map +1 -0
- package/dist/{exports/sanitize.js → sanitize/index.js} +1 -1
- package/dist/sanitize/index.js.map +1 -0
- package/dist/server/app.d.ts +1 -0
- package/dist/server/app.d.ts.map +1 -1
- package/dist/server/app.js +62 -0
- package/dist/server/app.js.map +1 -1
- package/dist/server/bootstrapper.d.ts.map +1 -1
- package/dist/server/bootstrapper.js +2 -2
- package/dist/server/bootstrapper.js.map +1 -1
- package/dist/server/define.d.ts +13 -3
- package/dist/server/define.d.ts.map +1 -1
- package/dist/server/define.js +63 -11
- package/dist/server/define.js.map +1 -1
- package/dist/server/request.d.ts +1 -1
- package/dist/server/request.d.ts.map +1 -1
- package/dist/server/route-scanner.d.ts +1 -0
- package/dist/server/route-scanner.d.ts.map +1 -1
- package/dist/server/route-scanner.js +9 -0
- package/dist/server/route-scanner.js.map +1 -1
- package/dist/server/route.d.ts.map +1 -1
- package/dist/server/route.js +6 -1
- package/dist/server/route.js.map +1 -1
- package/dist/{exports/storage.d.ts → storage/index.d.ts} +1 -1
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/{exports/storage.js → storage/index.js} +1 -1
- package/dist/storage/index.js.map +1 -0
- package/dist/testing/client.d.ts +6 -3
- package/dist/testing/client.d.ts.map +1 -1
- package/dist/testing/client.js +12 -1
- package/dist/testing/client.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +14 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +59 -5
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +21 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/worker.d.ts +15 -0
- package/dist/utils/worker.d.ts.map +1 -0
- package/dist/utils/worker.js +50 -0
- package/dist/utils/worker.js.map +1 -0
- package/dist/{exports/validation.d.ts → validator/index.d.ts} +1 -1
- package/dist/validator/index.d.ts.map +1 -0
- package/dist/{exports/validation.js → validator/index.js} +1 -1
- package/dist/validator/index.js.map +1 -0
- package/package.json +41 -43
- package/dist/exports/app.d.ts +0 -2
- package/dist/exports/app.d.ts.map +0 -1
- package/dist/exports/app.js +0 -8
- package/dist/exports/app.js.map +0 -1
- package/dist/exports/auth.d.ts +0 -6
- package/dist/exports/auth.d.ts.map +0 -1
- package/dist/exports/auth.js.map +0 -1
- package/dist/exports/cache.d.ts +0 -4
- package/dist/exports/cache.d.ts.map +0 -1
- package/dist/exports/cache.js +0 -20
- package/dist/exports/cache.js.map +0 -1
- package/dist/exports/config.d.ts.map +0 -1
- package/dist/exports/config.js.map +0 -1
- package/dist/exports/dataloader.d.ts +0 -3
- package/dist/exports/dataloader.d.ts.map +0 -1
- package/dist/exports/dataloader.js +0 -19
- package/dist/exports/dataloader.js.map +0 -1
- package/dist/exports/decorators.d.ts +0 -2
- package/dist/exports/decorators.d.ts.map +0 -1
- package/dist/exports/decorators.js +0 -18
- package/dist/exports/decorators.js.map +0 -1
- package/dist/exports/di.d.ts +0 -4
- package/dist/exports/di.d.ts.map +0 -1
- package/dist/exports/di.js.map +0 -1
- package/dist/exports/error.d.ts.map +0 -1
- package/dist/exports/error.js.map +0 -1
- package/dist/exports/module.d.ts +0 -3
- package/dist/exports/module.d.ts.map +0 -1
- package/dist/exports/module.js.map +0 -1
- package/dist/exports/plugin.d.ts.map +0 -1
- package/dist/exports/plugin.js.map +0 -1
- package/dist/exports/queue.d.ts +0 -9
- package/dist/exports/queue.d.ts.map +0 -1
- package/dist/exports/queue.js +0 -16
- package/dist/exports/queue.js.map +0 -1
- package/dist/exports/response.d.ts +0 -2
- package/dist/exports/response.d.ts.map +0 -1
- package/dist/exports/response.js.map +0 -1
- package/dist/exports/route.d.ts.map +0 -1
- package/dist/exports/route.js.map +0 -1
- package/dist/exports/sanitize.d.ts.map +0 -1
- package/dist/exports/sanitize.js.map +0 -1
- package/dist/exports/storage.d.ts.map +0 -1
- package/dist/exports/storage.js.map +0 -1
- package/dist/exports/swagger.d.ts +0 -3
- package/dist/exports/swagger.d.ts.map +0 -1
- package/dist/exports/swagger.js +0 -6
- package/dist/exports/swagger.js.map +0 -1
- package/dist/exports/validation.d.ts.map +0 -1
- package/dist/exports/validation.js.map +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Controller = Controller;
|
|
4
|
+
exports.Injectable = Injectable;
|
|
5
|
+
exports.Server = Server;
|
|
6
|
+
exports.Gateway = Gateway;
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
/**
|
|
9
|
+
* Marks a class as a controller, automatically grouping its routes under the provided prefix.
|
|
10
|
+
* Uses standard ES decorators, completely avoiding reflect-metadata bloat.
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
*
|
|
14
|
+
* @Controller('/api/users')
|
|
15
|
+
* export class UserController {
|
|
16
|
+
* @Get()
|
|
17
|
+
* getUsers() { return []; }
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* @param {string | ControllerOptions} [prefixOrOptions] Route prefix or options
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
function Controller(prefixOrOptions) {
|
|
24
|
+
return function (target, context) {
|
|
25
|
+
const prefix = typeof prefixOrOptions === 'string'
|
|
26
|
+
? prefixOrOptions
|
|
27
|
+
: prefixOrOptions?.prefix || '';
|
|
28
|
+
const host = typeof prefixOrOptions === 'object' ? prefixOrOptions.host : undefined;
|
|
29
|
+
target.prototype[constants_1.CONTROLLER_PREFIX] = prefix;
|
|
30
|
+
if (host)
|
|
31
|
+
target.prototype[constants_1.CONTROLLER_HOST] = host;
|
|
32
|
+
if (context && context.metadata) {
|
|
33
|
+
context.metadata[constants_1.CONTROLLER_PREFIX] = prefix;
|
|
34
|
+
if (host)
|
|
35
|
+
context.metadata[constants_1.CONTROLLER_HOST] = host;
|
|
36
|
+
}
|
|
37
|
+
// Aggregate metadata from methods to the prototype registry
|
|
38
|
+
const proto = target.prototype;
|
|
39
|
+
proto[constants_1.ROUTE_REGISTRY] = proto[constants_1.ROUTE_REGISTRY] || [];
|
|
40
|
+
// Middlewares
|
|
41
|
+
const currentMiddlewares = proto[constants_1.MIDDLEWARE_REGISTRY];
|
|
42
|
+
if (Array.isArray(currentMiddlewares)) {
|
|
43
|
+
proto[constants_1.MIDDLEWARE_REGISTRY] = {
|
|
44
|
+
_classMiddlewares: currentMiddlewares,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else if (!proto[constants_1.MIDDLEWARE_REGISTRY] ||
|
|
48
|
+
typeof proto[constants_1.MIDDLEWARE_REGISTRY] !== 'object') {
|
|
49
|
+
proto[constants_1.MIDDLEWARE_REGISTRY] = {
|
|
50
|
+
_classMiddlewares: [],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else if (!proto[constants_1.MIDDLEWARE_REGISTRY]._classMiddlewares) {
|
|
54
|
+
proto[constants_1.MIDDLEWARE_REGISTRY]._classMiddlewares = [];
|
|
55
|
+
}
|
|
56
|
+
// Response Metadata, Guards/Interceptors, and Parameters
|
|
57
|
+
const classLifecycle = proto[constants_1.LIFECYCLE_METADATA_PROP] || {};
|
|
58
|
+
proto[constants_1.ROUTE_METADATA] = proto[constants_1.ROUTE_METADATA] || {};
|
|
59
|
+
proto[constants_1.LIFECYCLE_METADATA] = proto[constants_1.LIFECYCLE_METADATA] || {};
|
|
60
|
+
proto[constants_1.PARAM_METADATA] = proto[constants_1.PARAM_METADATA] || {};
|
|
61
|
+
for (const key of Object.getOwnPropertyNames(proto)) {
|
|
62
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
63
|
+
if (descriptor && typeof descriptor.value === 'function') {
|
|
64
|
+
const fn = descriptor.value;
|
|
65
|
+
// 1. Collect route definition
|
|
66
|
+
const routeMeta = fn[constants_1.ROUTE_META];
|
|
67
|
+
if (routeMeta) {
|
|
68
|
+
proto[constants_1.ROUTE_REGISTRY].push({
|
|
69
|
+
method: routeMeta.method,
|
|
70
|
+
path: routeMeta.path,
|
|
71
|
+
schema: routeMeta.schema,
|
|
72
|
+
handlerName: key,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// 2. Collect method middlewares
|
|
76
|
+
const methodMiddlewares = fn[constants_1.METHOD_MIDDLEWARES];
|
|
77
|
+
if (methodMiddlewares) {
|
|
78
|
+
proto[constants_1.MIDDLEWARE_REGISTRY][key] =
|
|
79
|
+
proto[constants_1.MIDDLEWARE_REGISTRY][key] || [];
|
|
80
|
+
proto[constants_1.MIDDLEWARE_REGISTRY][key].push(...methodMiddlewares);
|
|
81
|
+
}
|
|
82
|
+
// 3. Collect custom HttpCode / Header response metadata
|
|
83
|
+
const classRouteMetadata = proto[constants_1.ROUTE_METADATA_PROP] || {};
|
|
84
|
+
const routeMetadata = fn[constants_1.ROUTE_METADATA_PROP] || {};
|
|
85
|
+
if (Object.keys(classRouteMetadata).length > 0 ||
|
|
86
|
+
Object.keys(routeMetadata).length > 0) {
|
|
87
|
+
proto[constants_1.ROUTE_METADATA][key] = {
|
|
88
|
+
...classRouteMetadata,
|
|
89
|
+
...routeMetadata,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// 4. Collect Guards and Interceptors (merging class-level and method-level)
|
|
93
|
+
const lifecycleMetadata = fn[constants_1.LIFECYCLE_METADATA_PROP] || {};
|
|
94
|
+
proto[constants_1.LIFECYCLE_METADATA][key] = {
|
|
95
|
+
guards: [
|
|
96
|
+
...(classLifecycle._classGuards || []),
|
|
97
|
+
...(lifecycleMetadata.guards || []),
|
|
98
|
+
],
|
|
99
|
+
interceptors: [
|
|
100
|
+
...(classLifecycle._classInterceptors || []),
|
|
101
|
+
...(lifecycleMetadata.interceptors || []),
|
|
102
|
+
],
|
|
103
|
+
filters: [
|
|
104
|
+
...(classLifecycle._classFilters || []),
|
|
105
|
+
...(lifecycleMetadata.filters || []),
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
// 5. Collect parameter injection metadata
|
|
109
|
+
const paramMetadata = fn[constants_1.PARAM_METADATA_PROP];
|
|
110
|
+
if (paramMetadata) {
|
|
111
|
+
proto[constants_1.PARAM_METADATA][key] = paramMetadata;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function Injectable(options) {
|
|
118
|
+
return function (target, _context) {
|
|
119
|
+
if (options?.scope) {
|
|
120
|
+
target.prototype[Symbol.for('exisjs:scope')] = options.scope;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Marks a class as a root Server module.
|
|
126
|
+
*/
|
|
127
|
+
function Server(options) {
|
|
128
|
+
return function (target, _context) {
|
|
129
|
+
target.prototype[constants_1.SERVER_CONFIG] = options || {};
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Marks a class as a Gateway module.
|
|
134
|
+
*/
|
|
135
|
+
function Gateway(options) {
|
|
136
|
+
return function (target, _context) {
|
|
137
|
+
target.prototype[constants_1.GATEWAY_CONFIG] = options || {};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/decorators/core.ts"],"names":[],"mappings":";;AAqCA,gCA0GC;AAED,gCAMC;AAKD,wBAIC;AAKD,0BAIC;AAzKD,2CAeoB;AAOpB;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAC,eAA4C;IACrE,OAAO,UAAU,MAAW,EAAE,OAA+B;QAC3D,MAAM,MAAM,GACV,OAAO,eAAe,KAAK,QAAQ;YACjC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,eAAe,EAAE,MAAM,IAAI,EAAE,CAAA;QACnC,MAAM,IAAI,GACR,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;QAExE,MAAM,CAAC,SAAS,CAAC,6BAAiB,CAAC,GAAG,MAAM,CAAA;QAC5C,IAAI,IAAI;YAAE,MAAM,CAAC,SAAS,CAAC,2BAAe,CAAC,GAAG,IAAI,CAAA;QAElD,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAChC,OAAO,CAAC,QAAQ,CAAC,6BAAiB,CAAC,GAAG,MAAM,CAAA;YAC5C,IAAI,IAAI;gBAAE,OAAO,CAAC,QAAQ,CAAC,2BAAe,CAAC,GAAG,IAAI,CAAA;QACpD,CAAC;QAED,4DAA4D;QAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAA;QAC9B,KAAK,CAAC,0BAAc,CAAC,GAAG,KAAK,CAAC,0BAAc,CAAC,IAAI,EAAE,CAAA;QAEnD,cAAc;QACd,MAAM,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AACH,CAAC"}
|
|
@@ -1,185 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export declare const LIFECYCLE_METADATA: unique symbol;
|
|
8
|
-
export declare const PARAM_METADATA: unique symbol;
|
|
9
|
-
export interface RouteMeta {
|
|
10
|
-
method: HttpMethod;
|
|
11
|
-
path: string;
|
|
12
|
-
schema?: RouteSchema<any, any, any, any>;
|
|
13
|
-
handlerName: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ControllerOptions {
|
|
16
|
-
prefix?: string;
|
|
17
|
-
host?: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Marks a class as a controller, automatically grouping its routes under the provided prefix.
|
|
21
|
-
* Uses standard ES decorators, completely avoiding reflect-metadata bloat.
|
|
22
|
-
*
|
|
23
|
-
* Example:
|
|
24
|
-
*
|
|
25
|
-
* @Controller('/api/users')
|
|
26
|
-
* export class UserController {
|
|
27
|
-
* @Get()
|
|
28
|
-
* getUsers() { return []; }
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* @param {string | ControllerOptions} [prefixOrOptions] Route prefix or options
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export declare function Controller(prefixOrOptions?: string | ControllerOptions): any;
|
|
35
|
-
/**
|
|
36
|
-
* Marks a method as a GET route handler.
|
|
37
|
-
*
|
|
38
|
-
* Example:
|
|
39
|
-
*
|
|
40
|
-
* @Get('/:id')
|
|
41
|
-
* getUser(@Param('id') id: string) { return { id }; }
|
|
42
|
-
*
|
|
43
|
-
* @param {string} [path] The route path
|
|
44
|
-
* @param {RouteSchema} [schema] Optional validation schema
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
export declare const Get: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
48
|
-
/**
|
|
49
|
-
* Marks a method as a POST route handler.
|
|
50
|
-
*
|
|
51
|
-
* Example:
|
|
52
|
-
*
|
|
53
|
-
* @Post('/', { body: v.object({ name: v.string() }) })
|
|
54
|
-
* createUser(@Body() body: any) { return body; }
|
|
55
|
-
*
|
|
56
|
-
* @param {string} [path] The route path
|
|
57
|
-
* @param {RouteSchema} [schema] Optional validation schema
|
|
58
|
-
* @public
|
|
59
|
-
*/
|
|
60
|
-
export declare const Post: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
61
|
-
export declare const Put: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
62
|
-
export declare const Patch: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
63
|
-
export declare const Delete: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
64
|
-
export declare const Options: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
65
|
-
export declare const Head: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
66
|
-
export declare const All: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
67
|
-
export declare const Connect: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
68
|
-
export declare const Trace: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
69
|
-
export declare const Ws: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
70
|
-
export declare const Sse: (path?: string, schema?: RouteSchema<any, any, any, any>) => any;
|
|
71
|
-
/**
|
|
72
|
-
* Applies middleware to a Controller class or route method.
|
|
73
|
-
*
|
|
74
|
-
* Example:
|
|
75
|
-
*
|
|
76
|
-
* @Use(requireAuth)
|
|
77
|
-
* @Get('/dashboard')
|
|
78
|
-
* getDashboard() {}
|
|
79
|
-
*
|
|
80
|
-
* @param {...any} middlewares Middleware functions
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
export declare function Use(...middlewares: any[]): any;
|
|
84
|
-
/**
|
|
85
|
-
* Idempotency Decorator.
|
|
86
|
-
* Caches responses based on the provided Idempotency-Key header.
|
|
87
|
-
*
|
|
88
|
-
* Example:
|
|
89
|
-
* @Post('/checkout')
|
|
90
|
-
* @Idempotent()
|
|
91
|
-
* checkout() {}
|
|
92
|
-
*/
|
|
93
|
-
export declare function Idempotent(options?: import('../middleware/idempotency').IdempotentOptions): any;
|
|
94
|
-
/**
|
|
95
|
-
* Cache Decorator.
|
|
96
|
-
* Caches responses for GET requests.
|
|
97
|
-
*
|
|
98
|
-
* Example:
|
|
99
|
-
* @Get('/popular')
|
|
100
|
-
* @Cache({ ttlMs: 60000 })
|
|
101
|
-
* getPopular() {}
|
|
102
|
-
*/
|
|
103
|
-
export declare function Cache(options: import('../middleware/cache').CacheOptions): any;
|
|
104
|
-
/**
|
|
105
|
-
* Defines a custom HTTP status code for a successful response.
|
|
106
|
-
*
|
|
107
|
-
* Example:
|
|
108
|
-
*
|
|
109
|
-
* @Post('/')
|
|
110
|
-
* @HttpCode(201)
|
|
111
|
-
* create() {}
|
|
112
|
-
*
|
|
113
|
-
* @param {number} code HTTP Status code
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
export declare function HttpCode(code: number): any;
|
|
117
|
-
export declare function Header(name: string, value: string): any;
|
|
118
|
-
/**
|
|
119
|
-
* Defines the response schema for OpenAPI generation.
|
|
120
|
-
*
|
|
121
|
-
* Example:
|
|
122
|
-
*
|
|
123
|
-
* @Get('/')
|
|
124
|
-
* @Returns(v.object({ id: v.string() }))
|
|
125
|
-
* getUser() {}
|
|
126
|
-
*
|
|
127
|
-
* @param {RouteSchema['response']} schema The response schema
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
export declare function Returns(schema: import('../types').RouteSchema<any, any, any, any>['response']): any;
|
|
131
|
-
export declare function UseGuards(...guards: any[]): any;
|
|
132
|
-
export declare function UseInterceptors(...interceptors: any[]): any;
|
|
133
|
-
export declare function UseFilters(...filters: any[]): any;
|
|
134
|
-
export declare const Param: (nameOrPipe?: string | any, ...pipes: any[]) => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
135
|
-
export declare const Body: (nameOrPipe?: string | any, ...pipes: any[]) => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
136
|
-
export declare const Headers: (nameOrPipe?: string | any, ...pipes: any[]) => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
137
|
-
export declare const HostParam: (nameOrPipe?: string | any, ...pipes: any[]) => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
138
|
-
export declare const Req: () => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
139
|
-
export declare const Socket: () => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
140
|
-
export declare const Stream: () => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
141
|
-
export declare const Session: () => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
142
|
-
export declare const Next: () => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
143
|
-
export declare const Ip: () => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
144
|
-
export declare const UploadedFile: (nameOrPipe?: string | any, ...pipes: any[]) => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
145
|
-
export declare const UploadedFiles: (nameOrPipe?: string | any, ...pipes: any[]) => (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
146
|
-
export declare const Res: (options?: {
|
|
147
|
-
passthrough?: boolean;
|
|
148
|
-
}) => any;
|
|
149
|
-
export declare function Query(pathOrName?: string | any, schemaOrPipe?: RouteSchema<any, any, any, any> | any, ...pipes: any[]): any;
|
|
150
|
-
export declare const Redirect: (url: string, statusCode?: number) => any;
|
|
151
|
-
export declare const Permissions: (...permissions: string[]) => any;
|
|
152
|
-
export declare const Hosts: (...hosts: string[]) => any;
|
|
153
|
-
export declare function Injectable(options?: {
|
|
154
|
-
scope?: 'singleton' | 'request';
|
|
155
|
-
}): any;
|
|
156
|
-
export declare const SERVER_CONFIG: unique symbol;
|
|
157
|
-
export declare const GATEWAY_CONFIG: unique symbol;
|
|
158
|
-
export interface ServerConfig {
|
|
159
|
-
plugins?: any[];
|
|
160
|
-
providers?: any[];
|
|
161
|
-
cron?: any[];
|
|
162
|
-
queue?: any[];
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Marks a class as a root Server module.
|
|
166
|
-
*/
|
|
167
|
-
export declare function Server(options?: ServerConfig): any;
|
|
168
|
-
export interface GatewayConfig {
|
|
169
|
-
exclude?: any[];
|
|
170
|
-
middleware?: any[];
|
|
171
|
-
filters?: any[];
|
|
172
|
-
guards?: any[];
|
|
173
|
-
interceptors?: any[];
|
|
174
|
-
timeout?: number | ((req: any) => number);
|
|
175
|
-
metadata?: Record<string, any>;
|
|
176
|
-
cors?: any;
|
|
177
|
-
headers?: Record<string, string>;
|
|
178
|
-
imports?: any[];
|
|
179
|
-
providers?: any[];
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Marks a class as a Gateway module.
|
|
183
|
-
*/
|
|
184
|
-
export declare function Gateway(options?: GatewayConfig): any;
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './core';
|
|
3
|
+
export * from './routing';
|
|
4
|
+
export * from './params';
|
|
5
|
+
export * from './middleware';
|
|
6
|
+
export * from './response';
|
|
185
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|