@nestia/core 1.1.0 → 1.1.2-dev.20230503
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/lib/decorators/DynamicModule.d.ts +26 -23
- package/lib/decorators/DynamicModule.js +103 -103
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.d.ts +23 -23
- package/lib/decorators/EncryptedBody.js +125 -125
- package/lib/decorators/EncryptedController.d.ts +31 -31
- package/lib/decorators/EncryptedController.js +41 -41
- package/lib/decorators/EncryptedModule.d.ts +52 -49
- package/lib/decorators/EncryptedModule.js +161 -161
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +78 -78
- package/lib/decorators/EncryptedRoute.js +216 -216
- package/lib/decorators/PlainBody.d.ts +22 -22
- package/lib/decorators/PlainBody.js +82 -82
- package/lib/decorators/TypedBody.d.ts +16 -16
- package/lib/decorators/TypedBody.js +94 -94
- package/lib/decorators/TypedParam.d.ts +31 -31
- package/lib/decorators/TypedParam.js +68 -65
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/TypedQuery.d.ts +14 -14
- package/lib/decorators/TypedQuery.js +124 -103
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +72 -72
- package/lib/decorators/TypedRoute.js +185 -185
- package/lib/decorators/internal/EncryptedConstant.d.ts +1 -1
- package/lib/decorators/internal/EncryptedConstant.js +7 -7
- package/lib/decorators/internal/TransformError.d.ts +1 -1
- package/lib/decorators/internal/TransformError.js +10 -10
- package/lib/decorators/internal/TransformError.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.d.ts +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +78 -78
- package/lib/decorators/internal/headers_to_object.d.ts +3 -3
- package/lib/decorators/internal/headers_to_object.js +49 -49
- package/lib/decorators/internal/load_controller.d.ts +5 -2
- package/lib/decorators/internal/load_controller.js +152 -151
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/route_error.d.ts +2 -2
- package/lib/decorators/internal/route_error.js +86 -86
- package/lib/decorators/internal/validate_request_body.d.ts +2 -2
- package/lib/decorators/internal/validate_request_body.js +57 -57
- package/lib/index.d.ts +3 -3
- package/lib/index.js +31 -31
- package/lib/module.d.ts +12 -12
- package/lib/module.js +28 -28
- package/lib/options/INestiaTransformOptions.d.ts +4 -4
- package/lib/options/INestiaTransformOptions.js +2 -2
- package/lib/options/INestiaTransformProject.d.ts +5 -5
- package/lib/options/INestiaTransformProject.js +2 -2
- package/lib/options/IRequestBodyValidator.d.ts +16 -16
- package/lib/options/IRequestBodyValidator.js +2 -2
- package/lib/options/IResponseBodyStringifier.d.ts +20 -20
- package/lib/options/IResponseBodyStringifier.js +2 -2
- package/lib/programmers/TypedBodyProgrammer.d.ts +5 -5
- package/lib/programmers/TypedBodyProgrammer.js +47 -45
- package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedParamProgrammer.d.ts +5 -5
- package/lib/programmers/TypedParamProgrammer.js +107 -107
- package/lib/programmers/TypedQueryProgrammer.d.ts +5 -5
- package/lib/programmers/TypedQueryProgrammer.js +263 -260
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +5 -5
- package/lib/programmers/TypedRouteProgrammer.js +49 -47
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/lib/transform.d.ts +3 -3
- package/lib/transform.js +20 -20
- package/lib/transformers/FileTransformer.d.ts +5 -5
- package/lib/transformers/FileTransformer.js +32 -32
- package/lib/transformers/MethodDecoratorTransformer.d.ts +5 -5
- package/lib/transformers/MethodDecoratorTransformer.js +87 -87
- package/lib/transformers/MethodDecoratorTransformer.js.map +1 -1
- package/lib/transformers/MethodTransformer.d.ts +5 -5
- package/lib/transformers/MethodTransformer.js +54 -54
- package/lib/transformers/NodeTransformer.d.ts +5 -5
- package/lib/transformers/NodeTransformer.js +20 -20
- package/lib/transformers/ParameterDecoratorTransformer.d.ts +5 -5
- package/lib/transformers/ParameterDecoratorTransformer.js +65 -65
- package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
- package/lib/transformers/ParameterTransformer.d.ts +5 -5
- package/lib/transformers/ParameterTransformer.js +33 -33
- package/lib/typings/Creator.d.ts +3 -3
- package/lib/typings/Creator.js +2 -2
- package/lib/utils/ExceptionManager.d.ts +64 -64
- package/lib/utils/ExceptionManager.js +112 -112
- package/lib/utils/Singleton.d.ts +1 -1
- package/lib/utils/Singleton.js +23 -23
- package/lib/utils/SourceFinder.d.ts +9 -0
- package/lib/utils/SourceFinder.js +239 -0
- package/lib/utils/SourceFinder.js.map +1 -0
- package/package.json +7 -7
- package/src/decorators/DynamicModule.ts +1 -1
- package/src/decorators/EncryptedModule.ts +1 -1
- package/src/decorators/TypedParam.ts +4 -1
- package/src/decorators/TypedQuery.ts +27 -4
- package/src/decorators/internal/TransformError.ts +1 -1
- package/src/decorators/internal/load_controller.ts +32 -25
- package/src/programmers/TypedBodyProgrammer.ts +2 -1
- package/src/programmers/TypedQueryProgrammer.ts +3 -1
- package/src/programmers/TypedRouteProgrammer.ts +2 -1
- package/src/transformers/MethodDecoratorTransformer.ts +1 -2
- package/src/transformers/ParameterDecoratorTransformer.ts +3 -3
- package/src/utils/SourceFinder.ts +60 -0
|
@@ -1,104 +1,125 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TypedQuery = void 0;
|
|
40
|
-
var common_1 = require("@nestjs/common");
|
|
41
|
-
var typia_1 = require("typia");
|
|
42
|
-
var TransformError_1 = require("./internal/TransformError");
|
|
43
|
-
/**
|
|
44
|
-
* Type safe URL query decorator.
|
|
45
|
-
*
|
|
46
|
-
* `TypedQuery` is a decorator function that can parse URL query string. It is almost
|
|
47
|
-
* same with {@link nest.Query}, but it can automatically cast property type following
|
|
48
|
-
* its DTO definition. Also, `TypedQuery` performs type validation.
|
|
49
|
-
*
|
|
50
|
-
* For referecen, when URL query parameters are different with their promised
|
|
51
|
-
* type `T`, `BadRequestException` error (status code: 400) would be thrown.
|
|
52
|
-
*
|
|
53
|
-
* @returns Parameter decorator
|
|
54
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
55
|
-
*/
|
|
56
|
-
function TypedQuery(decoder) {
|
|
57
|
-
if (decoder === undefined)
|
|
58
|
-
throw (0, TransformError_1.TransformError)("TypedQuery");
|
|
59
|
-
return (0, common_1.createParamDecorator)(function TypedQuery(_unknown, ctx) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var request, params;
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
request = ctx.switchToHttp().getRequest();
|
|
64
|
-
params = new URLSearchParams(tail(request.url));
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TypedQuery = void 0;
|
|
40
|
+
var common_1 = require("@nestjs/common");
|
|
41
|
+
var typia_1 = require("typia");
|
|
42
|
+
var TransformError_1 = require("./internal/TransformError");
|
|
43
|
+
/**
|
|
44
|
+
* Type safe URL query decorator.
|
|
45
|
+
*
|
|
46
|
+
* `TypedQuery` is a decorator function that can parse URL query string. It is almost
|
|
47
|
+
* same with {@link nest.Query}, but it can automatically cast property type following
|
|
48
|
+
* its DTO definition. Also, `TypedQuery` performs type validation.
|
|
49
|
+
*
|
|
50
|
+
* For referecen, when URL query parameters are different with their promised
|
|
51
|
+
* type `T`, `BadRequestException` error (status code: 400) would be thrown.
|
|
52
|
+
*
|
|
53
|
+
* @returns Parameter decorator
|
|
54
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
55
|
+
*/
|
|
56
|
+
function TypedQuery(decoder) {
|
|
57
|
+
if (decoder === undefined)
|
|
58
|
+
throw (0, TransformError_1.TransformError)("TypedQuery");
|
|
59
|
+
return (0, common_1.createParamDecorator)(function TypedQuery(_unknown, ctx) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
+
var request, params;
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
request = ctx.switchToHttp().getRequest();
|
|
64
|
+
params = new URLSearchParams(tail(request.url));
|
|
65
|
+
try {
|
|
66
|
+
return [2 /*return*/, decoder(params)];
|
|
67
|
+
}
|
|
68
|
+
catch (exp) {
|
|
69
|
+
if (exp instanceof typia_1.TypeGuardError) {
|
|
70
|
+
throw new common_1.BadRequestException({
|
|
71
|
+
path: exp.path,
|
|
72
|
+
reason: exp.message,
|
|
73
|
+
expected: exp.expected,
|
|
74
|
+
value: exp.value,
|
|
75
|
+
message: "Request query parameters are not following the promised type.",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
throw exp;
|
|
79
|
+
}
|
|
80
|
+
return [2 /*return*/];
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
})();
|
|
84
|
+
}
|
|
85
|
+
exports.TypedQuery = TypedQuery;
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
(function (TypedQuery) {
|
|
90
|
+
function boolean(str) {
|
|
91
|
+
if (str === null)
|
|
92
|
+
return undefined;
|
|
93
|
+
else if (str === "null")
|
|
94
|
+
return null;
|
|
95
|
+
else if (str.length === 0)
|
|
96
|
+
return true;
|
|
97
|
+
return str === "true" || str === "1"
|
|
98
|
+
? true
|
|
99
|
+
: str === "false" || str === "0"
|
|
100
|
+
? false
|
|
101
|
+
: str; // wrong type
|
|
102
|
+
}
|
|
103
|
+
TypedQuery.boolean = boolean;
|
|
104
|
+
function number(str) {
|
|
105
|
+
return (str === null || str === void 0 ? void 0 : str.length) ? (str === "null" ? null : Number(str)) : undefined;
|
|
106
|
+
}
|
|
107
|
+
TypedQuery.number = number;
|
|
108
|
+
function bigint(str) {
|
|
109
|
+
return (str === null || str === void 0 ? void 0 : str.length) ? (str === "null" ? null : BigInt(str)) : undefined;
|
|
110
|
+
}
|
|
111
|
+
TypedQuery.bigint = bigint;
|
|
112
|
+
function string(str) {
|
|
113
|
+
return str === null ? undefined : str === "null" ? null : str;
|
|
114
|
+
}
|
|
115
|
+
TypedQuery.string = string;
|
|
116
|
+
})(TypedQuery = exports.TypedQuery || (exports.TypedQuery = {}));
|
|
117
|
+
Object.assign(TypedQuery, typia_1.assert);
|
|
118
|
+
/**
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
function tail(url) {
|
|
122
|
+
var index = url.indexOf("?");
|
|
123
|
+
return index === -1 ? "" : url.substring(index + 1);
|
|
124
|
+
}
|
|
104
125
|
//# sourceMappingURL=TypedQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
|
|
2
|
-
/**
|
|
3
|
-
* Type safe router decorator functions.
|
|
4
|
-
*
|
|
5
|
-
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
6
|
-
* JSON string conversion speed about 50x times faster than `class-transformer`.
|
|
7
|
-
* Furthermore, such JSON string conversion is even type safe through
|
|
8
|
-
* [typia](https://github.com/samchon/typia).
|
|
9
|
-
*
|
|
10
|
-
* For reference, router functions of `TypedRoute` can convert custom error classes to
|
|
11
|
-
* the regular {@link nest.HttpException} class automatically, through
|
|
12
|
-
* {@link ExceptionManager}.
|
|
13
|
-
*
|
|
14
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
15
|
-
*/
|
|
16
|
-
export declare namespace TypedRoute {
|
|
17
|
-
/**
|
|
18
|
-
* Router decorator function for the GET method.
|
|
19
|
-
*
|
|
20
|
-
* @param path Path of the HTTP request
|
|
21
|
-
* @returns Method decorator
|
|
22
|
-
*/
|
|
23
|
-
const Get: {
|
|
24
|
-
(path?: string | string[]): MethodDecorator;
|
|
25
|
-
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
26
|
-
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Router decorator function for the POST method.
|
|
30
|
-
*
|
|
31
|
-
* @param path Path of the HTTP request
|
|
32
|
-
* @returns Method decorator
|
|
33
|
-
*/
|
|
34
|
-
const Post: {
|
|
35
|
-
(path?: string | string[]): MethodDecorator;
|
|
36
|
-
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
37
|
-
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Router decorator function for the PATH method.
|
|
41
|
-
*
|
|
42
|
-
* @param path Path of the HTTP request
|
|
43
|
-
* @returns Method decorator
|
|
44
|
-
*/
|
|
45
|
-
const Patch: {
|
|
46
|
-
(path?: string | string[]): MethodDecorator;
|
|
47
|
-
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
48
|
-
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Router decorator function for the PUT method.
|
|
52
|
-
*
|
|
53
|
-
* @param path Path of the HTTP request
|
|
54
|
-
* @returns Method decorator
|
|
55
|
-
*/
|
|
56
|
-
const Put: {
|
|
57
|
-
(path?: string | string[]): MethodDecorator;
|
|
58
|
-
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
59
|
-
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Router decorator function for the DELETE method.
|
|
63
|
-
*
|
|
64
|
-
* @param path Path of the HTTP request
|
|
65
|
-
* @returns Method decorator
|
|
66
|
-
*/
|
|
67
|
-
const Delete: {
|
|
68
|
-
(path?: string | string[]): MethodDecorator;
|
|
69
|
-
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
70
|
-
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
1
|
+
import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
|
|
2
|
+
/**
|
|
3
|
+
* Type safe router decorator functions.
|
|
4
|
+
*
|
|
5
|
+
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
6
|
+
* JSON string conversion speed about 50x times faster than `class-transformer`.
|
|
7
|
+
* Furthermore, such JSON string conversion is even type safe through
|
|
8
|
+
* [typia](https://github.com/samchon/typia).
|
|
9
|
+
*
|
|
10
|
+
* For reference, router functions of `TypedRoute` can convert custom error classes to
|
|
11
|
+
* the regular {@link nest.HttpException} class automatically, through
|
|
12
|
+
* {@link ExceptionManager}.
|
|
13
|
+
*
|
|
14
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace TypedRoute {
|
|
17
|
+
/**
|
|
18
|
+
* Router decorator function for the GET method.
|
|
19
|
+
*
|
|
20
|
+
* @param path Path of the HTTP request
|
|
21
|
+
* @returns Method decorator
|
|
22
|
+
*/
|
|
23
|
+
const Get: {
|
|
24
|
+
(path?: string | string[]): MethodDecorator;
|
|
25
|
+
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
26
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Router decorator function for the POST method.
|
|
30
|
+
*
|
|
31
|
+
* @param path Path of the HTTP request
|
|
32
|
+
* @returns Method decorator
|
|
33
|
+
*/
|
|
34
|
+
const Post: {
|
|
35
|
+
(path?: string | string[]): MethodDecorator;
|
|
36
|
+
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
37
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Router decorator function for the PATH method.
|
|
41
|
+
*
|
|
42
|
+
* @param path Path of the HTTP request
|
|
43
|
+
* @returns Method decorator
|
|
44
|
+
*/
|
|
45
|
+
const Patch: {
|
|
46
|
+
(path?: string | string[]): MethodDecorator;
|
|
47
|
+
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
48
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Router decorator function for the PUT method.
|
|
52
|
+
*
|
|
53
|
+
* @param path Path of the HTTP request
|
|
54
|
+
* @returns Method decorator
|
|
55
|
+
*/
|
|
56
|
+
const Put: {
|
|
57
|
+
(path?: string | string[]): MethodDecorator;
|
|
58
|
+
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
59
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Router decorator function for the DELETE method.
|
|
63
|
+
*
|
|
64
|
+
* @param path Path of the HTTP request
|
|
65
|
+
* @returns Method decorator
|
|
66
|
+
*/
|
|
67
|
+
const Delete: {
|
|
68
|
+
(path?: string | string[]): MethodDecorator;
|
|
69
|
+
<T>(stringify?: IResponseBodyStringifier<T> | undefined): MethodDecorator;
|
|
70
|
+
<T_1>(path: string | string[], stringify?: IResponseBodyStringifier<T_1> | undefined): MethodDecorator;
|
|
71
|
+
};
|
|
72
|
+
}
|