@nestia/core 1.3.6 → 1.3.8
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 -26
- 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 +128 -128
- package/lib/decorators/EncryptedController.d.ts +26 -26
- package/lib/decorators/EncryptedController.js +36 -36
- package/lib/decorators/EncryptedModule.d.ts +52 -52
- 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 +209 -209
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- 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 +45 -45
- package/lib/decorators/TypedParam.d.ts +31 -31
- package/lib/decorators/TypedParam.js +76 -76
- package/lib/decorators/TypedQuery.d.ts +14 -14
- package/lib/decorators/TypedQuery.js +109 -109
- 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/TypedRoute.js.map +1 -1
- 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 +83 -83
- package/lib/decorators/internal/get_text_body.d.ts +3 -3
- package/lib/decorators/internal/get_text_body.js +62 -62
- 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 -5
- 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 +88 -88
- package/lib/decorators/internal/validate_request_body.d.ts +3 -3
- package/lib/decorators/internal/validate_request_body.js +66 -66
- 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 +58 -58
- package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedParamProgrammer.d.ts +5 -5
- package/lib/programmers/TypedParamProgrammer.js +110 -110
- package/lib/programmers/TypedParamProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryProgrammer.d.ts +5 -5
- package/lib/programmers/TypedQueryProgrammer.js +264 -264
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +5 -5
- package/lib/programmers/TypedRouteProgrammer.js +49 -49
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/lib/transform.d.ts +4 -4
- package/lib/transform.js +25 -25
- package/lib/transformers/FileTransformer.d.ts +5 -5
- package/lib/transformers/FileTransformer.js +40 -40
- package/lib/transformers/FileTransformer.js.map +1 -1
- package/lib/transformers/MethodDecoratorTransformer.d.ts +5 -5
- package/lib/transformers/MethodDecoratorTransformer.js +92 -92
- package/lib/transformers/MethodDecoratorTransformer.js.map +1 -1
- package/lib/transformers/MethodTransformer.d.ts +5 -5
- package/lib/transformers/MethodTransformer.js +62 -62
- package/lib/transformers/MethodTransformer.js.map +1 -1
- package/lib/transformers/NodeTransformer.d.ts +5 -5
- package/lib/transformers/NodeTransformer.js +21 -21
- package/lib/transformers/NodeTransformer.js.map +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.d.ts +5 -5
- package/lib/transformers/ParameterDecoratorTransformer.js +68 -68
- package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
- package/lib/transformers/ParameterTransformer.d.ts +5 -5
- package/lib/transformers/ParameterTransformer.js +34 -34
- 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/ExceptionManager.js.map +1 -1
- package/lib/utils/Singleton.d.ts +1 -1
- package/lib/utils/Singleton.js +23 -23
- package/lib/utils/SourceFinder.d.ts +9 -9
- package/lib/utils/SourceFinder.js +238 -238
- package/lib/utils/SourceFinder.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,186 +1,186 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
|
-
var __values = (this && this.__values) || function(o) {
|
|
28
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
29
|
-
if (m) return m.call(o);
|
|
30
|
-
if (o && typeof o.length === "number") return {
|
|
31
|
-
next: function () {
|
|
32
|
-
if (o && i >= o.length) o = void 0;
|
|
33
|
-
return { value: o && o[i++], done: !o };
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
37
|
-
};
|
|
38
|
-
var e_1, _a, e_2, _b, e_3, _c;
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.TypedRoute = void 0;
|
|
41
|
-
var common_1 = require("@nestjs/common");
|
|
42
|
-
var operators_1 = require("rxjs/operators");
|
|
43
|
-
var typia_1 = require("typia");
|
|
44
|
-
var get_path_and_stringify_1 = require("./internal/get_path_and_stringify");
|
|
45
|
-
var route_error_1 = require("./internal/route_error");
|
|
46
|
-
/**
|
|
47
|
-
* Type safe router decorator functions.
|
|
48
|
-
*
|
|
49
|
-
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
50
|
-
* JSON string conversion speed about 50x times faster than `class-transformer`.
|
|
51
|
-
* Furthermore, such JSON string conversion is even type safe through
|
|
52
|
-
* [typia](https://github.com/samchon/typia).
|
|
53
|
-
*
|
|
54
|
-
* For reference, router functions of `TypedRoute` can convert custom error classes to
|
|
55
|
-
* the regular {@link nest.HttpException} class automatically, through
|
|
56
|
-
* {@link ExceptionManager}.
|
|
57
|
-
*
|
|
58
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
59
|
-
*/
|
|
60
|
-
var TypedRoute;
|
|
61
|
-
(function (TypedRoute) {
|
|
62
|
-
/**
|
|
63
|
-
* Router decorator function for the GET method.
|
|
64
|
-
*
|
|
65
|
-
* @param path Path of the HTTP request
|
|
66
|
-
* @returns Method decorator
|
|
67
|
-
*/
|
|
68
|
-
TypedRoute.Get = Generator("Get");
|
|
69
|
-
/**
|
|
70
|
-
* Router decorator function for the POST method.
|
|
71
|
-
*
|
|
72
|
-
* @param path Path of the HTTP request
|
|
73
|
-
* @returns Method decorator
|
|
74
|
-
*/
|
|
75
|
-
TypedRoute.Post = Generator("Post");
|
|
76
|
-
/**
|
|
77
|
-
* Router decorator function for the PATH method.
|
|
78
|
-
*
|
|
79
|
-
* @param path Path of the HTTP request
|
|
80
|
-
* @returns Method decorator
|
|
81
|
-
*/
|
|
82
|
-
TypedRoute.Patch = Generator("Patch");
|
|
83
|
-
/**
|
|
84
|
-
* Router decorator function for the PUT method.
|
|
85
|
-
*
|
|
86
|
-
* @param path Path of the HTTP request
|
|
87
|
-
* @returns Method decorator
|
|
88
|
-
*/
|
|
89
|
-
TypedRoute.Put = Generator("Put");
|
|
90
|
-
/**
|
|
91
|
-
* Router decorator function for the DELETE method.
|
|
92
|
-
*
|
|
93
|
-
* @param path Path of the HTTP request
|
|
94
|
-
* @returns Method decorator
|
|
95
|
-
*/
|
|
96
|
-
TypedRoute.Delete = Generator("Delete");
|
|
97
|
-
/**
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
function Generator(method) {
|
|
101
|
-
function route() {
|
|
102
|
-
var args = [];
|
|
103
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
104
|
-
args[_i] = arguments[_i];
|
|
105
|
-
}
|
|
106
|
-
var _a = __read((0, get_path_and_stringify_1.get_path_and_stringify)("TypedRoute.".concat(method)).apply(void 0, __spreadArray([], __read(args), false)), 2), path = _a[0], stringify = _a[1];
|
|
107
|
-
return (0, common_1.applyDecorators)(ROUTERS[method](path), (0, common_1.UseInterceptors)(new TypedRouteInterceptor(stringify)));
|
|
108
|
-
}
|
|
109
|
-
return route;
|
|
110
|
-
}
|
|
111
|
-
})(TypedRoute
|
|
112
|
-
try {
|
|
113
|
-
for (var _d = __values([
|
|
114
|
-
typia_1.isStringify,
|
|
115
|
-
typia_1.assertStringify,
|
|
116
|
-
typia_1.validateStringify,
|
|
117
|
-
typia_1.stringify,
|
|
118
|
-
]), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
119
|
-
var method = _e.value;
|
|
120
|
-
try {
|
|
121
|
-
for (var _f = (e_2 = void 0, __values(Object.entries(method))), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
122
|
-
var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
|
|
123
|
-
try {
|
|
124
|
-
for (var _j = (e_3 = void 0, __values([
|
|
125
|
-
TypedRoute.Get,
|
|
126
|
-
TypedRoute.Delete,
|
|
127
|
-
TypedRoute.Post,
|
|
128
|
-
TypedRoute.Put,
|
|
129
|
-
TypedRoute.Patch,
|
|
130
|
-
])), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
131
|
-
var deco = _k.value;
|
|
132
|
-
deco[key] = value;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
136
|
-
finally {
|
|
137
|
-
try {
|
|
138
|
-
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
139
|
-
}
|
|
140
|
-
finally { if (e_3) throw e_3.error; }
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
145
|
-
finally {
|
|
146
|
-
try {
|
|
147
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
148
|
-
}
|
|
149
|
-
finally { if (e_2) throw e_2.error; }
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
154
|
-
finally {
|
|
155
|
-
try {
|
|
156
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
157
|
-
}
|
|
158
|
-
finally { if (e_1) throw e_1.error; }
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
*/
|
|
163
|
-
var TypedRouteInterceptor = /** @class */ (function () {
|
|
164
|
-
function TypedRouteInterceptor(stringify) {
|
|
165
|
-
this.stringify = stringify;
|
|
166
|
-
}
|
|
167
|
-
TypedRouteInterceptor.prototype.intercept = function (context, next) {
|
|
168
|
-
var _this = this;
|
|
169
|
-
var http = context.switchToHttp();
|
|
170
|
-
var response = http.getResponse();
|
|
171
|
-
response.header("Content-Type", "application/json");
|
|
172
|
-
return next.handle().pipe((0, operators_1.map)(function (value) { return _this.stringify(value); }), (0, operators_1.catchError)(function (err) { return (0, route_error_1.route_error)(http.getRequest(), err); }));
|
|
173
|
-
};
|
|
174
|
-
return TypedRouteInterceptor;
|
|
175
|
-
}());
|
|
176
|
-
/**
|
|
177
|
-
* @internal
|
|
178
|
-
*/
|
|
179
|
-
var ROUTERS = {
|
|
180
|
-
Get: common_1.Get,
|
|
181
|
-
Post: common_1.Post,
|
|
182
|
-
Patch: common_1.Patch,
|
|
183
|
-
Put: common_1.Put,
|
|
184
|
-
Delete: common_1.Delete,
|
|
185
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
+
};
|
|
27
|
+
var __values = (this && this.__values) || function(o) {
|
|
28
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
29
|
+
if (m) return m.call(o);
|
|
30
|
+
if (o && typeof o.length === "number") return {
|
|
31
|
+
next: function () {
|
|
32
|
+
if (o && i >= o.length) o = void 0;
|
|
33
|
+
return { value: o && o[i++], done: !o };
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
37
|
+
};
|
|
38
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.TypedRoute = void 0;
|
|
41
|
+
var common_1 = require("@nestjs/common");
|
|
42
|
+
var operators_1 = require("rxjs/operators");
|
|
43
|
+
var typia_1 = require("typia");
|
|
44
|
+
var get_path_and_stringify_1 = require("./internal/get_path_and_stringify");
|
|
45
|
+
var route_error_1 = require("./internal/route_error");
|
|
46
|
+
/**
|
|
47
|
+
* Type safe router decorator functions.
|
|
48
|
+
*
|
|
49
|
+
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
50
|
+
* JSON string conversion speed about 50x times faster than `class-transformer`.
|
|
51
|
+
* Furthermore, such JSON string conversion is even type safe through
|
|
52
|
+
* [typia](https://github.com/samchon/typia).
|
|
53
|
+
*
|
|
54
|
+
* For reference, router functions of `TypedRoute` can convert custom error classes to
|
|
55
|
+
* the regular {@link nest.HttpException} class automatically, through
|
|
56
|
+
* {@link ExceptionManager}.
|
|
57
|
+
*
|
|
58
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
59
|
+
*/
|
|
60
|
+
var TypedRoute;
|
|
61
|
+
(function (TypedRoute) {
|
|
62
|
+
/**
|
|
63
|
+
* Router decorator function for the GET method.
|
|
64
|
+
*
|
|
65
|
+
* @param path Path of the HTTP request
|
|
66
|
+
* @returns Method decorator
|
|
67
|
+
*/
|
|
68
|
+
TypedRoute.Get = Generator("Get");
|
|
69
|
+
/**
|
|
70
|
+
* Router decorator function for the POST method.
|
|
71
|
+
*
|
|
72
|
+
* @param path Path of the HTTP request
|
|
73
|
+
* @returns Method decorator
|
|
74
|
+
*/
|
|
75
|
+
TypedRoute.Post = Generator("Post");
|
|
76
|
+
/**
|
|
77
|
+
* Router decorator function for the PATH method.
|
|
78
|
+
*
|
|
79
|
+
* @param path Path of the HTTP request
|
|
80
|
+
* @returns Method decorator
|
|
81
|
+
*/
|
|
82
|
+
TypedRoute.Patch = Generator("Patch");
|
|
83
|
+
/**
|
|
84
|
+
* Router decorator function for the PUT method.
|
|
85
|
+
*
|
|
86
|
+
* @param path Path of the HTTP request
|
|
87
|
+
* @returns Method decorator
|
|
88
|
+
*/
|
|
89
|
+
TypedRoute.Put = Generator("Put");
|
|
90
|
+
/**
|
|
91
|
+
* Router decorator function for the DELETE method.
|
|
92
|
+
*
|
|
93
|
+
* @param path Path of the HTTP request
|
|
94
|
+
* @returns Method decorator
|
|
95
|
+
*/
|
|
96
|
+
TypedRoute.Delete = Generator("Delete");
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
function Generator(method) {
|
|
101
|
+
function route() {
|
|
102
|
+
var args = [];
|
|
103
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
104
|
+
args[_i] = arguments[_i];
|
|
105
|
+
}
|
|
106
|
+
var _a = __read((0, get_path_and_stringify_1.get_path_and_stringify)("TypedRoute.".concat(method)).apply(void 0, __spreadArray([], __read(args), false)), 2), path = _a[0], stringify = _a[1];
|
|
107
|
+
return (0, common_1.applyDecorators)(ROUTERS[method](path), (0, common_1.UseInterceptors)(new TypedRouteInterceptor(stringify)));
|
|
108
|
+
}
|
|
109
|
+
return route;
|
|
110
|
+
}
|
|
111
|
+
})(TypedRoute || (exports.TypedRoute = TypedRoute = {}));
|
|
112
|
+
try {
|
|
113
|
+
for (var _d = __values([
|
|
114
|
+
typia_1.isStringify,
|
|
115
|
+
typia_1.assertStringify,
|
|
116
|
+
typia_1.validateStringify,
|
|
117
|
+
typia_1.stringify,
|
|
118
|
+
]), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
119
|
+
var method = _e.value;
|
|
120
|
+
try {
|
|
121
|
+
for (var _f = (e_2 = void 0, __values(Object.entries(method))), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
122
|
+
var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
|
|
123
|
+
try {
|
|
124
|
+
for (var _j = (e_3 = void 0, __values([
|
|
125
|
+
TypedRoute.Get,
|
|
126
|
+
TypedRoute.Delete,
|
|
127
|
+
TypedRoute.Post,
|
|
128
|
+
TypedRoute.Put,
|
|
129
|
+
TypedRoute.Patch,
|
|
130
|
+
])), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
131
|
+
var deco = _k.value;
|
|
132
|
+
deco[key] = value;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
136
|
+
finally {
|
|
137
|
+
try {
|
|
138
|
+
if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
|
|
139
|
+
}
|
|
140
|
+
finally { if (e_3) throw e_3.error; }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
145
|
+
finally {
|
|
146
|
+
try {
|
|
147
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
148
|
+
}
|
|
149
|
+
finally { if (e_2) throw e_2.error; }
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
154
|
+
finally {
|
|
155
|
+
try {
|
|
156
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
157
|
+
}
|
|
158
|
+
finally { if (e_1) throw e_1.error; }
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
var TypedRouteInterceptor = /** @class */ (function () {
|
|
164
|
+
function TypedRouteInterceptor(stringify) {
|
|
165
|
+
this.stringify = stringify;
|
|
166
|
+
}
|
|
167
|
+
TypedRouteInterceptor.prototype.intercept = function (context, next) {
|
|
168
|
+
var _this = this;
|
|
169
|
+
var http = context.switchToHttp();
|
|
170
|
+
var response = http.getResponse();
|
|
171
|
+
response.header("Content-Type", "application/json");
|
|
172
|
+
return next.handle().pipe((0, operators_1.map)(function (value) { return _this.stringify(value); }), (0, operators_1.catchError)(function (err) { return (0, route_error_1.route_error)(http.getRequest(), err); }));
|
|
173
|
+
};
|
|
174
|
+
return TypedRouteInterceptor;
|
|
175
|
+
}());
|
|
176
|
+
/**
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
var ROUTERS = {
|
|
180
|
+
Get: common_1.Get,
|
|
181
|
+
Post: common_1.Post,
|
|
182
|
+
Patch: common_1.Patch,
|
|
183
|
+
Put: common_1.Put,
|
|
184
|
+
Delete: common_1.Delete,
|
|
185
|
+
};
|
|
186
186
|
//# sourceMappingURL=TypedRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAWwB;AAGxB,4CAAiD;AAEjD,+BAKe;AAGf,4EAA2E;AAC3E,sDAAqD;AAErD;;;;;;;;;;;;;GAaG;AACH,IAAiB,UAAU,CAiE1B;AAjED,WAAiB,UAAU;IACvB;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,eAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;OAKG;IACU,gBAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAExC;;;;;OAKG;IACU,cAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,iBAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,SAAS,CAAC,MAAmD;QAUlE,SAAS,KAAK;YAAC,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,yBAAc;;YACnB,IAAA,KAAA,OAAoB,IAAA,+CAAsB,EAC5C,qBAAc,MAAM,CAAE,CACzB,wCAAI,IAAI,cAAC,EAFH,IAAI,QAAA,EAAE,SAAS,QAEZ,CAAC;YACX,OAAO,IAAA,wBAAe,EAClB,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EACrB,IAAA,wBAAe,EAAC,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC,CACxD,CAAC;QACN,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC,EAjEgB,UAAU,
|
|
1
|
+
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAWwB;AAGxB,4CAAiD;AAEjD,+BAKe;A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
|
-
exports.ENCRYPTION_METADATA_KEY = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
exports.ENCRYPTION_METADATA_KEY = "nestia:core:encryption:password";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENCRYPTION_METADATA_KEY = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
exports.ENCRYPTION_METADATA_KEY = "nestia:core:encryption:password";
|
|
8
8
|
//# sourceMappingURL=EncryptedConstant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransformError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
function TransformError(method) {
|
|
8
|
-
return new Error("Error on nestia.core.".concat(method, "(): no transform has been configured. Run \"npx typia setup\" command."));
|
|
9
|
-
}
|
|
10
|
-
exports.TransformError = TransformError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransformError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
function TransformError(method) {
|
|
8
|
+
return new Error("Error on nestia.core.".concat(method, "(): no transform has been configured. Run \"npx typia setup\" command."));
|
|
9
|
+
}
|
|
10
|
+
exports.TransformError = TransformError;
|
|
11
11
|
//# sourceMappingURL=TransformError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const get_path_and_stringify: (method: string) => (...args: any[]) => [string | string[] | undefined, (input: any) => string];
|
|
1
|
+
export declare const get_path_and_stringify: (method: string) => (...args: any[]) => [string | string[] | undefined, (input: any) => string];
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.get_path_and_stringify = void 0;
|
|
7
|
-
var common_1 = require("@nestjs/common");
|
|
8
|
-
var typia_1 = __importDefault(require("typia"));
|
|
9
|
-
var TransformError_1 = require("./TransformError");
|
|
10
|
-
var get_path_and_stringify = function (method) {
|
|
11
|
-
return function () {
|
|
12
|
-
var args = [];
|
|
13
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14
|
-
args[_i] = arguments[_i];
|
|
15
|
-
}
|
|
16
|
-
var path = args[0] === undefined ||
|
|
17
|
-
typeof args[0] === "string" ||
|
|
18
|
-
Array.isArray(args[0])
|
|
19
|
-
? args[0]
|
|
20
|
-
: null;
|
|
21
|
-
var functor = path === null ? args[0] : args[1];
|
|
22
|
-
return [path !== null && path !== void 0 ? path : undefined, take(method)(functor)];
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
exports.get_path_and_stringify = get_path_and_stringify;
|
|
26
|
-
var take = function (method) {
|
|
27
|
-
return function (functor) {
|
|
28
|
-
if (functor === undefined)
|
|
29
|
-
throw (0, TransformError_1.TransformError)(method);
|
|
30
|
-
else if (functor === null)
|
|
31
|
-
return JSON.stringify;
|
|
32
|
-
else if (functor.type === "stringify")
|
|
33
|
-
return functor.stringify;
|
|
34
|
-
else if (functor.type === "assert")
|
|
35
|
-
return assert(functor.assert);
|
|
36
|
-
else if (functor.type === "is")
|
|
37
|
-
return is(functor.is);
|
|
38
|
-
else if (functor.type === "validate")
|
|
39
|
-
return validate(functor.validate);
|
|
40
|
-
throw new Error("Error on nestia.core.".concat(method, "(): invalid typed stringify function."));
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
var assert = function (closure) {
|
|
44
|
-
return function (data) {
|
|
45
|
-
try {
|
|
46
|
-
return closure(data);
|
|
47
|
-
}
|
|
48
|
-
catch (exp) {
|
|
49
|
-
if ((function (input) {
|
|
50
|
-
var $io0 = function (input) { return "string" === typeof input.method && (undefined === input.path || "string" === typeof input.path) && "string" === typeof input.expected && true && "string" === typeof input.name && "string" === typeof input.message && (undefined === input.stack || "string" === typeof input.stack); };
|
|
51
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
52
|
-
})(exp))
|
|
53
|
-
throw new common_1.InternalServerErrorException({
|
|
54
|
-
path: exp.path,
|
|
55
|
-
reason: exp.message,
|
|
56
|
-
expected: exp.expected,
|
|
57
|
-
value: exp.value,
|
|
58
|
-
message: MESSAGE,
|
|
59
|
-
});
|
|
60
|
-
throw exp;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
var is = function (closure) {
|
|
65
|
-
return function (data) {
|
|
66
|
-
var result = closure(data);
|
|
67
|
-
if (result === null)
|
|
68
|
-
throw new common_1.InternalServerErrorException(MESSAGE);
|
|
69
|
-
return result;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
var validate = function (closure) {
|
|
73
|
-
return function (data) {
|
|
74
|
-
var result = closure(data);
|
|
75
|
-
if (result.success === false)
|
|
76
|
-
throw new common_1.InternalServerErrorException({
|
|
77
|
-
errors: result.errors,
|
|
78
|
-
message: MESSAGE,
|
|
79
|
-
});
|
|
80
|
-
return result.data;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
var MESSAGE = "Response body data is not following the promised type.";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.get_path_and_stringify = void 0;
|
|
7
|
+
var common_1 = require("@nestjs/common");
|
|
8
|
+
var typia_1 = __importDefault(require("typia"));
|
|
9
|
+
var TransformError_1 = require("./TransformError");
|
|
10
|
+
var get_path_and_stringify = function (method) {
|
|
11
|
+
return function () {
|
|
12
|
+
var args = [];
|
|
13
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14
|
+
args[_i] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
var path = args[0] === undefined ||
|
|
17
|
+
typeof args[0] === "string" ||
|
|
18
|
+
Array.isArray(args[0])
|
|
19
|
+
? args[0]
|
|
20
|
+
: null;
|
|
21
|
+
var functor = path === null ? args[0] : args[1];
|
|
22
|
+
return [path !== null && path !== void 0 ? path : undefined, take(method)(functor)];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.get_path_and_stringify = get_path_and_stringify;
|
|
26
|
+
var take = function (method) {
|
|
27
|
+
return function (functor) {
|
|
28
|
+
if (functor === undefined)
|
|
29
|
+
throw (0, TransformError_1.TransformError)(method);
|
|
30
|
+
else if (functor === null)
|
|
31
|
+
return JSON.stringify;
|
|
32
|
+
else if (functor.type === "stringify")
|
|
33
|
+
return functor.stringify;
|
|
34
|
+
else if (functor.type === "assert")
|
|
35
|
+
return assert(functor.assert);
|
|
36
|
+
else if (functor.type === "is")
|
|
37
|
+
return is(functor.is);
|
|
38
|
+
else if (functor.type === "validate")
|
|
39
|
+
return validate(functor.validate);
|
|
40
|
+
throw new Error("Error on nestia.core.".concat(method, "(): invalid typed stringify function."));
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var assert = function (closure) {
|
|
44
|
+
return function (data) {
|
|
45
|
+
try {
|
|
46
|
+
return closure(data);
|
|
47
|
+
}
|
|
48
|
+
catch (exp) {
|
|
49
|
+
if ((function (input) {
|
|
50
|
+
var $io0 = function (input) { return "string" === typeof input.method && (undefined === input.path || "string" === typeof input.path) && "string" === typeof input.expected && true && "string" === typeof input.name && "string" === typeof input.message && (undefined === input.stack || "string" === typeof input.stack); };
|
|
51
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
52
|
+
})(exp))
|
|
53
|
+
throw new common_1.InternalServerErrorException({
|
|
54
|
+
path: exp.path,
|
|
55
|
+
reason: exp.message,
|
|
56
|
+
expected: exp.expected,
|
|
57
|
+
value: exp.value,
|
|
58
|
+
message: MESSAGE,
|
|
59
|
+
});
|
|
60
|
+
throw exp;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
var is = function (closure) {
|
|
65
|
+
return function (data) {
|
|
66
|
+
var result = closure(data);
|
|
67
|
+
if (result === null)
|
|
68
|
+
throw new common_1.InternalServerErrorException(MESSAGE);
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
var validate = function (closure) {
|
|
73
|
+
return function (data) {
|
|
74
|
+
var result = closure(data);
|
|
75
|
+
if (result.success === false)
|
|
76
|
+
throw new common_1.InternalServerErrorException({
|
|
77
|
+
errors: result.errors,
|
|
78
|
+
message: MESSAGE,
|
|
79
|
+
});
|
|
80
|
+
return result.data;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var MESSAGE = "Response body data is not following the promised type.";
|
|
84
84
|
//# sourceMappingURL=get_path_and_stringify.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type express from "express";
|
|
2
|
-
import type { FastifyRequest } from "fastify";
|
|
3
|
-
export declare const get_text_body: (request: express.Request | FastifyRequest) => Promise<string>;
|
|
1
|
+
import type express from "express";
|
|
2
|
+
import type { FastifyRequest } from "fastify";
|
|
3
|
+
export declare const get_text_body: (request: express.Request | FastifyRequest) => Promise<string>;
|