@nestia/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/lib/decorators/EncryptedBody.d.ts +22 -0
- package/lib/decorators/EncryptedBody.js +125 -0
- package/lib/decorators/EncryptedBody.js.map +1 -0
- package/lib/decorators/EncryptedController.d.ts +31 -0
- package/lib/decorators/EncryptedController.js +42 -0
- package/lib/decorators/EncryptedController.js.map +1 -0
- package/lib/decorators/EncryptedModule.d.ts +48 -0
- package/lib/decorators/EncryptedModule.js +270 -0
- package/lib/decorators/EncryptedModule.js.map +1 -0
- package/lib/decorators/EncryptedRoute.d.ts +78 -0
- package/lib/decorators/EncryptedRoute.js +191 -0
- package/lib/decorators/EncryptedRoute.js.map +1 -0
- package/lib/decorators/PlainBody.d.ts +22 -0
- package/lib/decorators/PlainBody.js +83 -0
- package/lib/decorators/PlainBody.js.map +1 -0
- package/lib/decorators/TypedBody.d.ts +14 -0
- package/lib/decorators/TypedBody.js +93 -0
- package/lib/decorators/TypedBody.js.map +1 -0
- package/lib/decorators/TypedParam.d.ts +25 -0
- package/lib/decorators/TypedParam.js +62 -0
- package/lib/decorators/TypedParam.js.map +1 -0
- package/lib/decorators/TypedRoute.d.ts +71 -0
- package/lib/decorators/TypedRoute.js +159 -0
- package/lib/decorators/TypedRoute.js.map +1 -0
- package/lib/decorators/internal/EncryptedConstant.d.ts +1 -0
- package/lib/decorators/internal/EncryptedConstant.js +8 -0
- package/lib/decorators/internal/EncryptedConstant.js.map +1 -0
- package/lib/decorators/internal/get_path_and_stringify.d.ts +1 -0
- package/lib/decorators/internal/get_path_and_stringify.js +75 -0
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -0
- package/lib/decorators/internal/headers_to_object.d.ts +1 -0
- package/lib/decorators/internal/headers_to_object.js +53 -0
- package/lib/decorators/internal/headers_to_object.js.map +1 -0
- package/lib/decorators/internal/route_error.d.ts +1 -0
- package/lib/decorators/internal/route_error.js +90 -0
- package/lib/decorators/internal/route_error.js.map +1 -0
- package/lib/decorators/internal/validate_request_body.d.ts +2 -0
- package/lib/decorators/internal/validate_request_body.js +56 -0
- package/lib/decorators/internal/validate_request_body.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +32 -0
- package/lib/index.js.map +1 -0
- package/lib/module.d.ts +9 -0
- package/lib/module.js +26 -0
- package/lib/module.js.map +1 -0
- package/lib/options/INestiaTransformOptions.d.ts +5 -0
- package/lib/options/INestiaTransformOptions.js +3 -0
- package/lib/options/INestiaTransformOptions.js.map +1 -0
- package/lib/options/INestiaTransformProject.d.ts +5 -0
- package/lib/options/INestiaTransformProject.js +3 -0
- package/lib/options/INestiaTransformProject.js.map +1 -0
- package/lib/options/IRequestBodyValidator.d.ts +16 -0
- package/lib/options/IRequestBodyValidator.js +3 -0
- package/lib/options/IRequestBodyValidator.js.map +1 -0
- package/lib/options/IResponseBodyStringifier.d.ts +20 -0
- package/lib/options/IResponseBodyStringifier.js +3 -0
- package/lib/options/IResponseBodyStringifier.js.map +1 -0
- package/lib/transform.d.ts +3 -0
- package/lib/transform.js +21 -0
- package/lib/transform.js.map +1 -0
- package/lib/transformers/BodyTransformer.d.ts +5 -0
- package/lib/transformers/BodyTransformer.js +69 -0
- package/lib/transformers/BodyTransformer.js.map +1 -0
- package/lib/transformers/FileTransformer.d.ts +5 -0
- package/lib/transformers/FileTransformer.js +33 -0
- package/lib/transformers/FileTransformer.js.map +1 -0
- package/lib/transformers/MethodTransformer.d.ts +5 -0
- package/lib/transformers/MethodTransformer.js +55 -0
- package/lib/transformers/MethodTransformer.js.map +1 -0
- package/lib/transformers/NodeTransformer.d.ts +5 -0
- package/lib/transformers/NodeTransformer.js +21 -0
- package/lib/transformers/NodeTransformer.js.map +1 -0
- package/lib/transformers/ParameterTransformer.d.ts +5 -0
- package/lib/transformers/ParameterTransformer.js +31 -0
- package/lib/transformers/ParameterTransformer.js.map +1 -0
- package/lib/transformers/RouteTransformer.d.ts +5 -0
- package/lib/transformers/RouteTransformer.js +115 -0
- package/lib/transformers/RouteTransformer.js.map +1 -0
- package/lib/typings/Creator.d.ts +3 -0
- package/lib/typings/Creator.js +3 -0
- package/lib/typings/Creator.js.map +1 -0
- package/lib/utils/ExceptionManager.d.ts +64 -0
- package/lib/utils/ExceptionManager.js +113 -0
- package/lib/utils/ExceptionManager.js.map +1 -0
- package/lib/utils/Singleton.d.ts +1 -0
- package/lib/utils/Singleton.js +24 -0
- package/lib/utils/Singleton.js.map +1 -0
- package/package.json +66 -0
- package/src/decorators/EncryptedBody.ts +102 -0
- package/src/decorators/EncryptedController.ts +43 -0
- package/src/decorators/EncryptedModule.ts +127 -0
- package/src/decorators/EncryptedRoute.ts +200 -0
- package/src/decorators/PlainBody.ts +38 -0
- package/src/decorators/TypedBody.ts +49 -0
- package/src/decorators/TypedParam.ts +70 -0
- package/src/decorators/TypedRoute.ts +149 -0
- package/src/decorators/internal/EncryptedConstant.ts +4 -0
- package/src/decorators/internal/get_path_and_stringify.ts +76 -0
- package/src/decorators/internal/headers_to_object.ts +13 -0
- package/src/decorators/internal/route_error.ts +41 -0
- package/src/decorators/internal/validate_request_body.ts +58 -0
- package/src/index.ts +5 -0
- package/src/module.ts +9 -0
- package/src/options/INestiaTransformOptions.ts +6 -0
- package/src/options/INestiaTransformProject.ts +6 -0
- package/src/options/IRequestBodyValidator.ts +20 -0
- package/src/options/IResponseBodyStringifier.ts +25 -0
- package/src/transform.ts +20 -0
- package/src/transformers/BodyTransformer.ts +106 -0
- package/src/transformers/FileTransformer.ts +49 -0
- package/src/transformers/MethodTransformer.ts +91 -0
- package/src/transformers/NodeTransformer.ts +18 -0
- package/src/transformers/ParameterTransformer.ts +45 -0
- package/src/transformers/RouteTransformer.ts +134 -0
- package/src/typings/Creator.ts +3 -0
- package/src/utils/ExceptionManager.ts +126 -0
- package/src/utils/Singleton.ts +20 -0
|
@@ -0,0 +1,159 @@
|
|
|
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;
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.TypedRoute = void 0;
|
|
41
|
+
var common_1 = require("@nestjs/common");
|
|
42
|
+
var rxjs_1 = require("rxjs");
|
|
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
|
+
* Safe router decorator functions.
|
|
48
|
+
*
|
|
49
|
+
* `TypedRoute` is a module containing router decorator functions which can boost up
|
|
50
|
+
* JSON string conversion speed about 5x times faster, through
|
|
51
|
+
* [`typia.stringify()`](https://github.com/samchon/typia#fastest-json-string-conversion).
|
|
52
|
+
*
|
|
53
|
+
* Also, router functions in `TypedRoute` can convert custom error classes to the
|
|
54
|
+
* regular {@link nest.HttpException} class automatically, through
|
|
55
|
+
* {@link ExceptionManager}.
|
|
56
|
+
*
|
|
57
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
58
|
+
*/
|
|
59
|
+
var TypedRoute;
|
|
60
|
+
(function (TypedRoute) {
|
|
61
|
+
/**
|
|
62
|
+
* Router decorator function for the GET method.
|
|
63
|
+
*
|
|
64
|
+
* @param path Path of the HTTP request
|
|
65
|
+
* @returns Method decorator
|
|
66
|
+
*/
|
|
67
|
+
TypedRoute.Get = Generator("Get");
|
|
68
|
+
/**
|
|
69
|
+
* Router decorator function for the POST method.
|
|
70
|
+
*
|
|
71
|
+
* @param path Path of the HTTP request
|
|
72
|
+
* @returns Method decorator
|
|
73
|
+
*/
|
|
74
|
+
TypedRoute.Post = Generator("Post");
|
|
75
|
+
/**
|
|
76
|
+
* Router decorator function for the PATH method.
|
|
77
|
+
*
|
|
78
|
+
* @param path Path of the HTTP request
|
|
79
|
+
* @returns Method decorator
|
|
80
|
+
*/
|
|
81
|
+
TypedRoute.Patch = Generator("Patch");
|
|
82
|
+
/**
|
|
83
|
+
* Router decorator function for the PUT method.
|
|
84
|
+
*
|
|
85
|
+
* @param path Path of the HTTP request
|
|
86
|
+
* @returns Method decorator
|
|
87
|
+
*/
|
|
88
|
+
TypedRoute.Put = Generator("Put");
|
|
89
|
+
/**
|
|
90
|
+
* Router decorator function for the DELETE method.
|
|
91
|
+
*
|
|
92
|
+
* @param path Path of the HTTP request
|
|
93
|
+
* @returns Method decorator
|
|
94
|
+
*/
|
|
95
|
+
TypedRoute.Delete = Generator("Delete");
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
function Generator(method) {
|
|
100
|
+
function route() {
|
|
101
|
+
var args = [];
|
|
102
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
103
|
+
args[_i] = arguments[_i];
|
|
104
|
+
}
|
|
105
|
+
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];
|
|
106
|
+
return (0, common_1.applyDecorators)(ROUTERS[method](path), (0, common_1.UseInterceptors)(new TypedRouteInterceptor(stringify)));
|
|
107
|
+
}
|
|
108
|
+
return route;
|
|
109
|
+
}
|
|
110
|
+
})(TypedRoute = exports.TypedRoute || (exports.TypedRoute = {}));
|
|
111
|
+
try {
|
|
112
|
+
for (var _b = __values([
|
|
113
|
+
typia_1.assertStringify,
|
|
114
|
+
typia_1.isStringify,
|
|
115
|
+
typia_1.stringify,
|
|
116
|
+
typia_1.validateStringify,
|
|
117
|
+
]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
118
|
+
var method = _c.value;
|
|
119
|
+
Object.assign(TypedRoute.Get, method);
|
|
120
|
+
Object.assign(TypedRoute.Delete, method);
|
|
121
|
+
Object.assign(TypedRoute.Post, method);
|
|
122
|
+
Object.assign(TypedRoute.Put, method);
|
|
123
|
+
Object.assign(TypedRoute.Patch, method);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
127
|
+
finally {
|
|
128
|
+
try {
|
|
129
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
130
|
+
}
|
|
131
|
+
finally { if (e_1) throw e_1.error; }
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
var TypedRouteInterceptor = /** @class */ (function () {
|
|
137
|
+
function TypedRouteInterceptor(stringify) {
|
|
138
|
+
this.stringify = stringify;
|
|
139
|
+
}
|
|
140
|
+
TypedRouteInterceptor.prototype.intercept = function (context, next) {
|
|
141
|
+
var _this = this;
|
|
142
|
+
var http = context.switchToHttp();
|
|
143
|
+
var response = http.getResponse();
|
|
144
|
+
response.header("Content-Type", "application/json");
|
|
145
|
+
return next.handle().pipe((0, rxjs_1.map)(function (value) { return _this.stringify(value); }), (0, rxjs_1.catchError)(function (err) { return (0, route_error_1.route_error)(http.getRequest(), err); }));
|
|
146
|
+
};
|
|
147
|
+
return TypedRouteInterceptor;
|
|
148
|
+
}());
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
var ROUTERS = {
|
|
153
|
+
Get: common_1.Get,
|
|
154
|
+
Post: common_1.Post,
|
|
155
|
+
Patch: common_1.Patch,
|
|
156
|
+
Put: common_1.Put,
|
|
157
|
+
Delete: common_1.Delete,
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=TypedRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAWwB;AAGxB,6BAAmD;AACnD,+BAKe;AAGf,4EAA2E;AAC3E,sDAAqD;AAErD;;;;;;;;;;;;GAYG;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;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G,CAAC;IAElE,yCAAS,GAAhB,UACI,OAAyB,EACzB,IAAiB;QAFrB,iBAYC;QARG,IAAM,IAAI,GAAsB,OAAO,CAAC,YAAY,EAAE,CAAC;QACvD,IAAM,QAAQ,GAAqB,IAAI,CAAC,WAAW,EAAE,CAAC;QACtD,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACrB,IAAA,UAAG,EAAC,UAAC,KAAK,IAAK,OAAA,KAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAArB,CAAqB,CAAC,EACrC,IAAA,iBAAU,EAAC,UAAC,GAAG,IAAK,OAAA,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,EAAnC,CAAmC,CAAC,CAC3D,CAAC;IACN,CAAC;IACL,4BAAC;AAAD,CAAC,AAhBD,IAgBC;AAED;;GAEG;AACH,IAAM,OAAO,GAAG;IACZ,GAAG,cAAA;IACH,IAAI,eAAA;IACJ,KAAK,gBAAA;IACL,GAAG,cAAA;IACH,MAAM,iBAAA;CACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
//# sourceMappingURL=EncryptedConstant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EncryptedConstant.js","sourceRoot":"","sources":["../../../src/decorators/internal/EncryptedConstant.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,uBAAuB,GAAG,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const get_path_and_stringify: (method: string) => (...args: any[]) => [string | string[] | undefined, (input: any) => string];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_path_and_stringify = void 0;
|
|
4
|
+
var common_1 = require("@nestjs/common");
|
|
5
|
+
var typia_1 = require("typia");
|
|
6
|
+
var get_path_and_stringify = function (method) {
|
|
7
|
+
return function () {
|
|
8
|
+
var args = [];
|
|
9
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
+
args[_i] = arguments[_i];
|
|
11
|
+
}
|
|
12
|
+
var path = args[0] === undefined ||
|
|
13
|
+
typeof args[0] === "string" ||
|
|
14
|
+
Array.isArray(args[0])
|
|
15
|
+
? args[0]
|
|
16
|
+
: null;
|
|
17
|
+
var functor = path === null ? args[0] : args[1];
|
|
18
|
+
return [path !== null && path !== void 0 ? path : undefined, take(method)(functor)];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.get_path_and_stringify = get_path_and_stringify;
|
|
22
|
+
var take = function (method) {
|
|
23
|
+
return function (functor) {
|
|
24
|
+
if (functor === undefined)
|
|
25
|
+
throw new Error("Error on nestia.core.".concat(method, "(): no stringify function provided."));
|
|
26
|
+
else if (functor.type === "stringify")
|
|
27
|
+
return functor.stringify;
|
|
28
|
+
else if (functor.type === "assert")
|
|
29
|
+
return assert(functor.assert);
|
|
30
|
+
else if (functor.type === "is")
|
|
31
|
+
return is(functor.is);
|
|
32
|
+
else if (functor.type === "validate")
|
|
33
|
+
return validate(functor.validate);
|
|
34
|
+
throw new Error("Error on nestia.core.".concat(method, "(): invalid typed stringify function."));
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
var assert = function (closure) {
|
|
38
|
+
return function (data) {
|
|
39
|
+
try {
|
|
40
|
+
return closure(data);
|
|
41
|
+
}
|
|
42
|
+
catch (exp) {
|
|
43
|
+
if (exp instanceof typia_1.TypeGuardError) {
|
|
44
|
+
throw new common_1.InternalServerErrorException({
|
|
45
|
+
path: exp.path,
|
|
46
|
+
reason: exp.message,
|
|
47
|
+
expected: exp.expected,
|
|
48
|
+
message: MESSAGE,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
throw exp;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var is = function (closure) {
|
|
56
|
+
return function (data) {
|
|
57
|
+
var result = closure(data);
|
|
58
|
+
if (result === null)
|
|
59
|
+
throw new common_1.InternalServerErrorException(MESSAGE);
|
|
60
|
+
return result;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var validate = function (closure) {
|
|
64
|
+
return function (data) {
|
|
65
|
+
var result = closure(data);
|
|
66
|
+
if (result.success === false)
|
|
67
|
+
throw new common_1.InternalServerErrorException({
|
|
68
|
+
errors: result.errors,
|
|
69
|
+
message: MESSAGE,
|
|
70
|
+
});
|
|
71
|
+
return result.data;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var MESSAGE = "Response body data is not following the promised type.";
|
|
75
|
+
//# sourceMappingURL=get_path_and_stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;AAAA,yCAA8D;AAC9D,+BAAoD;AAI7C,IAAM,sBAAsB,GAC/B,UAAC,MAAc;IACf,OAAA;QACI,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QAEd,IAAM,IAAI,GACN,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;YACrB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;YAC3B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACT,CAAC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AO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,OAAO,EAAE,OAAO;iBACnB,CAAC,CAAC;aACN;YACD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;AAdD,CAcC,CAAC;AAEN,IAAM,EAAE,GACJ,UAAI,OAAmC;IACvC,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAkB,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM,IAAI,qCAA4B,CAAC,OAAO,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAClB,CAAC;AAJD,CAIC,CAAC;AAEN,IAAM,QAAQ,GACV,UAAI,OAAyC;IAC7C,OAAA,UAAC,IAAO;QACJ,IAAM,MAAM,GAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,qCAA4B,CAAC;gBACnC,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO;aACnB,CAAC,CAAC;QACP,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;AARD,CAQC,CAAC;AAEN,IAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.headers_to_object = void 0;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
function headers_to_object(headers) {
|
|
35
|
+
var e_1, _a;
|
|
36
|
+
var output = {};
|
|
37
|
+
try {
|
|
38
|
+
for (var _b = __values(Object.entries(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
39
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
40
|
+
output[key] = value instanceof Array ? value[0] : value || "";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
44
|
+
finally {
|
|
45
|
+
try {
|
|
46
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
47
|
+
}
|
|
48
|
+
finally { if (e_1) throw e_1.error; }
|
|
49
|
+
}
|
|
50
|
+
return output;
|
|
51
|
+
}
|
|
52
|
+
exports.headers_to_object = headers_to_object;
|
|
53
|
+
//# sourceMappingURL=headers_to_object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers_to_object.js","sourceRoot":"","sources":["../../../src/decorators/internal/headers_to_object.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;GAEG;AACH,SAAgB,iBAAiB,CAC7B,OAAiC;;IAEjC,IAAM,MAAM,GAA2B,EAAE,CAAC;;QAC1C,KAA2B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA,gBAAA;YAAvC,IAAA,KAAA,mBAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YAClB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;SAAA;;;;;;;;;IAClE,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,8CAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.route_error = void 0;
|
|
31
|
+
var common_1 = require("@nestjs/common");
|
|
32
|
+
var rxjs_1 = require("rxjs");
|
|
33
|
+
var ExceptionManager_1 = require("../../utils/ExceptionManager");
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
function route_error(request, error) {
|
|
38
|
+
error = (function () {
|
|
39
|
+
var e_1, _a;
|
|
40
|
+
// HTTP-ERROR
|
|
41
|
+
if (error instanceof common_1.HttpException)
|
|
42
|
+
return error;
|
|
43
|
+
try {
|
|
44
|
+
// CUSTOM-REGISTERED ERROR
|
|
45
|
+
for (var _b = __values(ExceptionManager_1.ExceptionManager.tuples), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
46
|
+
var _d = __read(_c.value, 2), creator = _d[0], closure = _d[1];
|
|
47
|
+
if (error instanceof creator)
|
|
48
|
+
return closure(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52
|
+
finally {
|
|
53
|
+
try {
|
|
54
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
55
|
+
}
|
|
56
|
+
finally { if (e_1) throw e_1.error; }
|
|
57
|
+
}
|
|
58
|
+
// MAYBE INTERNAL ERROR
|
|
59
|
+
return error;
|
|
60
|
+
})();
|
|
61
|
+
try {
|
|
62
|
+
error.method = request.method;
|
|
63
|
+
error.path = request.path;
|
|
64
|
+
}
|
|
65
|
+
catch (_a) { }
|
|
66
|
+
setTimeout(function () {
|
|
67
|
+
var e_2, _a;
|
|
68
|
+
try {
|
|
69
|
+
for (var _b = __values(ExceptionManager_1.ExceptionManager.listeners), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
70
|
+
var listener = _c.value;
|
|
71
|
+
try {
|
|
72
|
+
var res = listener(error);
|
|
73
|
+
if (typeof res === "object" && typeof res.catch === "function")
|
|
74
|
+
res.catch(function () { });
|
|
75
|
+
}
|
|
76
|
+
catch (_d) { }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
80
|
+
finally {
|
|
81
|
+
try {
|
|
82
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
83
|
+
}
|
|
84
|
+
finally { if (e_2) throw e_2.error; }
|
|
85
|
+
}
|
|
86
|
+
}, 0);
|
|
87
|
+
return (0, rxjs_1.throwError)(function () { return error; });
|
|
88
|
+
}
|
|
89
|
+
exports.route_error = route_error;
|
|
90
|
+
//# sourceMappingURL=route_error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route_error.js","sourceRoot":"","sources":["../../../src/decorators/internal/route_error.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA+C;AAE/C,6BAA8C;AAE9C,iEAAgE;AAEhE;;GAEG;AACH,SAAgB,WAAW,CACvB,OAAwB,EACxB,KAAU;IAEV,KAAK,GAAG,CAAC;;QACL,aAAa;QACb,IAAI,KAAK,YAAY,sBAAa;YAAE,OAAO,KAAK,CAAC;;YAEjD,0BAA0B;YAC1B,KAAiC,IAAA,KAAA,SAAA,mCAAgB,CAAC,MAAM,CAAA,gBAAA;gBAA7C,IAAA,KAAA,mBAAkB,EAAjB,OAAO,QAAA,EAAE,OAAO,QAAA;gBACxB,IAAI,KAAK,YAAY,OAAO;oBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;aAAA;;;;;;;;;QAExD,uBAAuB;QACvB,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,EAAE,CAAC;IAEL,IAAI;QACA,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9B,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;KAC7B;IAAC,WAAM,GAAE;IAEV,UAAU,CAAC;;;YACP,KAAuB,IAAA,KAAA,SAAA,mCAAgB,CAAC,SAAS,CAAA,gBAAA,4BAAE;gBAA9C,IAAM,QAAQ,WAAA;gBACf,IAAI;oBACA,IAAM,GAAG,GAAuB,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAChD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU;wBAC1D,GAAG,CAAC,KAAK,CAAC,cAAO,CAAC,CAAC,CAAC;iBAC3B;gBAAC,WAAM,GAAE;aACb;;;;;;;;;IACL,CAAC,EAAE,CAAC,CAAC,CAAC;IACN,OAAO,IAAA,iBAAU,EAAC,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC,CAAC;AACnC,CAAC;AA/BD,kCA+BC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validate_request_body = void 0;
|
|
4
|
+
var common_1 = require("@nestjs/common");
|
|
5
|
+
var typia_1 = require("typia");
|
|
6
|
+
var validate_request_body = function (method) {
|
|
7
|
+
return function (validator) {
|
|
8
|
+
if (!validator)
|
|
9
|
+
throw new Error("Error on nestia.core.".concat(method, "(): no transformer."));
|
|
10
|
+
else if (validator.type === "assert")
|
|
11
|
+
return assert(validator.assert);
|
|
12
|
+
else if (validator.type === "is")
|
|
13
|
+
return is(validator.is);
|
|
14
|
+
else if (validator.type === "validate")
|
|
15
|
+
return validate(validator.validate);
|
|
16
|
+
throw new Error("Error on nestia.core.".concat(method, "(): invalid typed validator."));
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.validate_request_body = validate_request_body;
|
|
20
|
+
var assert = function (closure) {
|
|
21
|
+
return function (data) {
|
|
22
|
+
try {
|
|
23
|
+
closure(data);
|
|
24
|
+
}
|
|
25
|
+
catch (exp) {
|
|
26
|
+
if (exp instanceof typia_1.TypeGuardError) {
|
|
27
|
+
throw new common_1.BadRequestException({
|
|
28
|
+
path: exp.path,
|
|
29
|
+
reason: exp.message,
|
|
30
|
+
expected: exp.expected,
|
|
31
|
+
message: MESSAGE,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
throw exp;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
var is = function (closure) {
|
|
39
|
+
return function (data) {
|
|
40
|
+
var success = closure(data);
|
|
41
|
+
if (success === false)
|
|
42
|
+
throw new common_1.BadRequestException(MESSAGE);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var validate = function (closure) {
|
|
46
|
+
return function (data) {
|
|
47
|
+
var result = closure(data);
|
|
48
|
+
if (result.success === false)
|
|
49
|
+
throw new common_1.BadRequestException({
|
|
50
|
+
errors: result.errors,
|
|
51
|
+
message: MESSAGE,
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
var MESSAGE = "Request body data is not following the promised type.";
|
|
56
|
+
//# sourceMappingURL=validate_request_body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;AAAA,yCAAqD;AACrD,+BAAoD;AAI7C,IAAM,qBAAqB,GAC9B,UAAC,MAAc;IACf,OAAA,UAAI,SAAoC;QACpC,IAAI,CAAC,SAAS;YACV,MAAM,IAAI,KAAK,CACX,+BAAwB,MAAM,wBAAqB,CACtD,CAAC;aACD,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;aACjE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;aACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;YAClC,OAAO,QAAQ,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
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var core = __importStar(require("./module"));
|
|
30
|
+
__exportStar(require("./module"), exports);
|
|
31
|
+
exports.default = core;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiC;AAEjC,2CAAyB;AAEzB,kBAAe,IAAI,CAAC"}
|
package/lib/module.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./decorators/EncryptedBody";
|
|
2
|
+
export * from "./decorators/EncryptedController";
|
|
3
|
+
export * from "./decorators/EncryptedModule";
|
|
4
|
+
export * from "./decorators/EncryptedRoute";
|
|
5
|
+
export * from "./utils/ExceptionManager";
|
|
6
|
+
export * from "./decorators/PlainBody";
|
|
7
|
+
export * from "./decorators/TypedBody";
|
|
8
|
+
export * from "./decorators/TypedParam";
|
|
9
|
+
export * from "./decorators/TypedRoute";
|
package/lib/module.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./decorators/EncryptedBody"), exports);
|
|
18
|
+
__exportStar(require("./decorators/EncryptedController"), exports);
|
|
19
|
+
__exportStar(require("./decorators/EncryptedModule"), exports);
|
|
20
|
+
__exportStar(require("./decorators/EncryptedRoute"), exports);
|
|
21
|
+
__exportStar(require("./utils/ExceptionManager"), exports);
|
|
22
|
+
__exportStar(require("./decorators/PlainBody"), exports);
|
|
23
|
+
__exportStar(require("./decorators/TypedBody"), exports);
|
|
24
|
+
__exportStar(require("./decorators/TypedParam"), exports);
|
|
25
|
+
__exportStar(require("./decorators/TypedRoute"), exports);
|
|
26
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,mEAAiD;AACjD,+DAA6C;AAC7C,8DAA4C;AAC5C,2DAAyC;AACzC,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,0DAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"INestiaTransformOptions.js","sourceRoot":"","sources":["../../src/options/INestiaTransformOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"INestiaTransformProject.js","sourceRoot":"","sources":["../../src/options/INestiaTransformProject.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
export type IRequestBodyValidator<T> = IRequestBodyValidator.IAssert<T> | IRequestBodyValidator.IIs<T> | IRequestBodyValidator.IValidate<T>;
|
|
3
|
+
export declare namespace IRequestBodyValidator {
|
|
4
|
+
interface IAssert<T> {
|
|
5
|
+
type: "assert";
|
|
6
|
+
assert: (input: T) => T;
|
|
7
|
+
}
|
|
8
|
+
interface IIs<T> {
|
|
9
|
+
type: "is";
|
|
10
|
+
is: (input: T) => boolean;
|
|
11
|
+
}
|
|
12
|
+
interface IValidate<T> {
|
|
13
|
+
type: "validate";
|
|
14
|
+
validate: (input: T) => IValidation<T>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRequestBodyValidator.js","sourceRoot":"","sources":["../../src/options/IRequestBodyValidator.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IValidation } from "typia";
|
|
2
|
+
export type IResponseBodyStringifier<T> = IResponseBodyStringifier.IStringify<T> | IResponseBodyStringifier.IIs<T> | IResponseBodyStringifier.IAssert<T> | IResponseBodyStringifier.IValidate<T>;
|
|
3
|
+
export declare namespace IResponseBodyStringifier {
|
|
4
|
+
interface IStringify<T> {
|
|
5
|
+
type: "stringify";
|
|
6
|
+
stringify: (input: T) => string;
|
|
7
|
+
}
|
|
8
|
+
interface IIs<T> {
|
|
9
|
+
type: "is";
|
|
10
|
+
is: (input: T) => string | null;
|
|
11
|
+
}
|
|
12
|
+
interface IAssert<T> {
|
|
13
|
+
type: "assert";
|
|
14
|
+
assert: (input: T) => string;
|
|
15
|
+
}
|
|
16
|
+
interface IValidate<T> {
|
|
17
|
+
type: "validate";
|
|
18
|
+
validate: (input: T) => IValidation<string>;
|
|
19
|
+
}
|
|
20
|
+
}
|