@nestia/core 1.0.19 → 1.1.0-dev.20230413
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/README.md +1 -23
- package/lib/decorators/DynamicModule.d.ts +23 -23
- package/lib/decorators/DynamicModule.js +103 -103
- 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 +49 -49
- package/lib/decorators/EncryptedModule.js +161 -161
- 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 +25 -25
- package/lib/decorators/TypedParam.js +61 -61
- package/lib/decorators/TypedQuery.d.ts +14 -14
- package/lib/decorators/TypedQuery.js +99 -99
- 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/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 +2 -2
- package/lib/decorators/internal/load_controller.js +151 -152
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/route_error.d.ts +3 -3
- 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 +45 -45
- package/lib/programmers/TypedQueryProgrammer.d.ts +5 -5
- package/lib/programmers/TypedQueryProgrammer.js +260 -165
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +5 -5
- package/lib/programmers/TypedRouteProgrammer.js +47 -47
- 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/MethodTransformer.d.ts +5 -5
- package/lib/transformers/MethodTransformer.js +54 -54
- package/lib/transformers/MethodTransformer.js.map +1 -1
- 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 +53 -53
- package/lib/transformers/ParameterTransformer.d.ts +5 -5
- package/lib/transformers/ParameterTransformer.js +33 -33
- package/lib/transformers/ParameterTransformer.js.map +1 -1
- 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/package.json +7 -5
- package/src/decorators/TypedQuery.ts +10 -8
- package/src/programmers/TypedQueryProgrammer.ts +104 -33
- package/src/transformers/MethodTransformer.ts +1 -1
- package/src/transformers/ParameterTransformer.ts +1 -1
|
@@ -1,100 +1,100 @@
|
|
|
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
|
-
return [2 /*return*/, decoder(params)];
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
})();
|
|
69
|
-
}
|
|
70
|
-
exports.TypedQuery = TypedQuery;
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
(function (TypedQuery) {
|
|
75
|
-
function boolean(str) {
|
|
76
|
-
return str
|
|
77
|
-
}
|
|
78
|
-
TypedQuery.boolean = boolean;
|
|
79
|
-
function number(str) {
|
|
80
|
-
return str
|
|
81
|
-
}
|
|
82
|
-
TypedQuery.number = number;
|
|
83
|
-
function bigint(str) {
|
|
84
|
-
return str
|
|
85
|
-
}
|
|
86
|
-
TypedQuery.bigint = bigint;
|
|
87
|
-
function string(str) {
|
|
88
|
-
return str !==
|
|
89
|
-
}
|
|
90
|
-
TypedQuery.string = string;
|
|
91
|
-
})(TypedQuery = exports.TypedQuery || (exports.TypedQuery = {}));
|
|
92
|
-
Object.assign(TypedQuery, typia_1.assert);
|
|
93
|
-
/**
|
|
94
|
-
* @internal
|
|
95
|
-
*/
|
|
96
|
-
function tail(url) {
|
|
97
|
-
var index = url.indexOf("?");
|
|
98
|
-
return index === -1 ? "" : url.substring(index + 1);
|
|
99
|
-
}
|
|
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
|
+
return [2 /*return*/, decoder(params)];
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
})();
|
|
69
|
+
}
|
|
70
|
+
exports.TypedQuery = TypedQuery;
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
(function (TypedQuery) {
|
|
75
|
+
function boolean(str) {
|
|
76
|
+
return (str === null || str === void 0 ? void 0 : str.length) ? Boolean(str) : undefined;
|
|
77
|
+
}
|
|
78
|
+
TypedQuery.boolean = boolean;
|
|
79
|
+
function number(str) {
|
|
80
|
+
return (str === null || str === void 0 ? void 0 : str.length) ? Number(str) : undefined;
|
|
81
|
+
}
|
|
82
|
+
TypedQuery.number = number;
|
|
83
|
+
function bigint(str) {
|
|
84
|
+
return (str === null || str === void 0 ? void 0 : str.length) ? BigInt(str) : undefined;
|
|
85
|
+
}
|
|
86
|
+
TypedQuery.bigint = bigint;
|
|
87
|
+
function string(str) {
|
|
88
|
+
return str !== undefined && str !== null ? str : undefined;
|
|
89
|
+
}
|
|
90
|
+
TypedQuery.string = string;
|
|
91
|
+
})(TypedQuery = exports.TypedQuery || (exports.TypedQuery = {}));
|
|
92
|
+
Object.assign(TypedQuery, typia_1.assert);
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
function tail(url) {
|
|
97
|
+
var index = url.indexOf("?");
|
|
98
|
+
return index === -1 ? "" : url.substring(index + 1);
|
|
99
|
+
}
|
|
100
100
|
//# sourceMappingURL=TypedQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwE;AAGxE,+BAA+B;AAE/B,4DAA2D;AAE3D;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CACtB,OAAwC;IAExC,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAA,+BAAc,EAAC,YAAY,CAAC,CAAC;IAE9D,OAAO,IAAA,6BAAoB,EAAC,SAAe,UAAU,CACjD,QAAa,EACb,GAAqB;;;;gBAEf,OAAO,GAAoB,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;gBAC3D,MAAM,GAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvE,sBAAO,OAAO,CAAC,MAAM,CAAC,EAAC;;;KAC1B,CAAC,EAAE,CAAC;AACT,CAAC;AAbD,gCAaC;AAED;;GAEG;AACH,WAAiB,UAAU;IACvB,SAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"TypedQuery.js","sourceRoot":"","sources":["../../src/decorators/TypedQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwE;AAGxE,+BAA+B;AAE/B,4DAA2D;AAE3D;;;;;;;;;;;;GAYG;AACH,SAAgB,UAAU,CACtB,OAAwC;IAExC,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAA,+BAAc,EAAC,YAAY,CAAC,CAAC;IAE9D,OAAO,IAAA,6BAAoB,EAAC,SAAe,UAAU,CACjD,QAAa,EACb,GAAqB;;;;gBAEf,OAAO,GAAoB,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;gBAC3D,MAAM,GAAoB,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvE,sBAAO,OAAO,CAAC,MAAM,CAAC,EAAC;;;KAC1B,CAAC,EAAE,CAAC;AACT,CAAC;AAbD,gCAaC;AAED;;GAEG;AACH,WAAiB,UAAU;IACvB,SAAgB,OAAO,CACnB,GAA8B;QAE9B,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,EAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;IAJe,kBAAO,UAItB,CAAA;IACD,SAAgB,MAAM,CAAC,GAA8B;QACjD,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,EAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;IAFe,iBAAM,SAErB,CAAA;IACD,SAAgB,MAAM,CAAC,GAA8B;QACjD,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,EAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;IAFe,iBAAM,SAErB,CAAA;IACD,SAAgB,MAAM,CAAC,GAA8B;QACjD,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/D,CAAC;IAFe,iBAAM,SAErB,CAAA;AACL,CAAC,EAfgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAe1B;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,cAAM,CAAC,CAAC;AAElC;;GAEG;AACH,SAAS,IAAI,CAAC,GAAW;IACrB,IAAM,KAAK,GAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -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
|
+
}
|