@nestia/core 3.15.0-dev.20240926 → 3.16.0-dev.20240926
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/EncryptedRoute.d.ts +1 -1
- package/lib/decorators/EncryptedRoute.js +1 -1
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +7 -3
- package/lib/decorators/TypedRoute.js +1 -1
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +8 -6
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/options/INestiaTransformOptions.d.ts +1 -1
- package/lib/options/IResponseBodyStringifier.d.ts +2 -2
- package/lib/programmers/TypedRouteProgrammer.js +28 -11
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/package.json +6 -6
- package/src/decorators/EncryptedRoute.ts +4 -4
- package/src/decorators/TypedRoute.ts +9 -4
- package/src/decorators/internal/get_path_and_stringify.ts +10 -11
- package/src/options/INestiaTransformOptions.ts +0 -1
- package/src/options/IResponseBodyStringifier.ts +2 -2
- package/src/programmers/TypedRouteProgrammer.ts +33 -23
|
@@ -92,6 +92,6 @@ export declare namespace EncryptedRoute {
|
|
|
92
92
|
* @param func Logger function
|
|
93
93
|
* @default console.log
|
|
94
94
|
*/
|
|
95
|
-
function setValidateErrorLogger(func: (
|
|
95
|
+
function setValidateErrorLogger(func: (log: IValidateErrorLog) => void): void;
|
|
96
96
|
export import IValidateErrorLog = TypedRoute.IValidateErrorLog;
|
|
97
97
|
}
|
|
@@ -96,7 +96,7 @@ var EncryptedRoute;
|
|
|
96
96
|
*/
|
|
97
97
|
function Generator(method) {
|
|
98
98
|
function route(...args) {
|
|
99
|
-
const [path, stringify] = (0, get_path_and_stringify_1.get_path_and_stringify)(TypedRoute_1.TypedRoute.__logger)(`EncryptedRoute.${method}`)(...args);
|
|
99
|
+
const [path, stringify] = (0, get_path_and_stringify_1.get_path_and_stringify)(() => TypedRoute_1.TypedRoute.__logger)(`EncryptedRoute.${method}`)(...args);
|
|
100
100
|
return (0, common_1.applyDecorators)(ROUTERS[method](path), (0, common_1.UseInterceptors)(new EncryptedRouteInterceptor(method, stringify)));
|
|
101
101
|
}
|
|
102
102
|
return route;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptedRoute.js","sourceRoot":"","sources":["../../src/decorators/EncryptedRoute.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAwD;AAExD,2CAWwB;AAGxB,8CAAiD;AACjD,kDAA0B;AAG1B,kDAA+C;AAC/C,6CAA0C;AAC1C,oEAAuE;AACvE,8EAA2E;AAC3E,oEAAiE;AACjE,wDAAqD;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,IAAiB,cAAc,CAyF9B;AAzFD,WAAiB,cAAc;IAC7B;;;;;OAKG;IACU,kBAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,mBAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAEtC;;;;;OAKG;IACU,oBAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAExC;;;;;OAKG;IACU,kBAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAEpC;;;;;OAKG;IACU,qBAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE1C;;;;;;;;;;;;;;;OAeG;IACH,SAAgB,sBAAsB,CACpC,IAAsC;QAEtC,uBAAU,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAJe,qCAAsB,yBAIrC,CAAA;IAID;;OAEG;IACH,SAAS,SAAS,CAAC,MAAmD;QAUpE,SAAS,KAAK,CAAC,GAAG,IAAW;YAC3B,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,IAAA,+CAAsB,
|
|
1
|
+
{"version":3,"file":"EncryptedRoute.js","sourceRoot":"","sources":["../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I,GAAuB,IAAI,CAAC,SAAS,CAC7C,KAAK,EACL,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,GAAG,CACZ,CAAC;YACF,MAAM,QAAQ,GACZ,OAAO,KAAK,KAAK,UAAU;gBACzB,CAAC,CAAC,KAAK,CAAC;oBACJ,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;oBACtB,IAAI;oBACJ,SAAS,EAAE,QAAQ;iBACpB,CAAC;gBACJ,CAAC,CAAC,KAAK,CAAC;YAEZ,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAC;YACpC,OAAO,mBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC,EACF,IAAA,sBAAU,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,CAAC,CACzD,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,GAAG;IACd,GAAG,EAAH,YAAG;IACH,IAAI,EAAJ,aAAI;IACJ,GAAG,EAAH,YAAG;IACH,KAAK,EAAL,cAAK;IACL,MAAM,EAAN,eAAM;CACP,CAAC"}
|
|
@@ -87,7 +87,7 @@ export declare namespace TypedRoute {
|
|
|
87
87
|
* @param func Logger function
|
|
88
88
|
* @default console.log
|
|
89
89
|
*/
|
|
90
|
-
function setValidateErrorLogger(func: (
|
|
90
|
+
function setValidateErrorLogger(func: (log: IValidateErrorLog) => void): void;
|
|
91
91
|
/**
|
|
92
92
|
* Error log information of the response validation failure.
|
|
93
93
|
*
|
|
@@ -112,8 +112,12 @@ export declare namespace TypedRoute {
|
|
|
112
112
|
*/
|
|
113
113
|
path: string;
|
|
114
114
|
/**
|
|
115
|
-
* Validation error
|
|
115
|
+
* Validation error informations with detailed reasons.
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
errors: IValidation.IError[];
|
|
118
|
+
/**
|
|
119
|
+
* Data that is not following the promised type `T`.
|
|
120
|
+
*/
|
|
121
|
+
data: unknown;
|
|
118
122
|
}
|
|
119
123
|
}
|
|
@@ -90,7 +90,7 @@ var TypedRoute;
|
|
|
90
90
|
*/
|
|
91
91
|
function Generator(method) {
|
|
92
92
|
function route(...args) {
|
|
93
|
-
const [path, stringify] = (0, get_path_and_stringify_1.get_path_and_stringify)(TypedRoute.__logger)(`TypedRoute.${method}`)(...args);
|
|
93
|
+
const [path, stringify] = (0, get_path_and_stringify_1.get_path_and_stringify)(() => TypedRoute.__logger)(`TypedRoute.${method}`)(...args);
|
|
94
94
|
return (0, common_1.applyDecorators)(ROUTERS[method](path), (0, common_1.UseInterceptors)(new TypedRouteInterceptor(stringify)));
|
|
95
95
|
}
|
|
96
96
|
return route;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;AAAA,2CAWwB;AAGxB,8CAAiD;AACjD,kDAA2C;AAG3C,8EAA2E;AAC3E,wDAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,IAAiB,UAAU,
|
|
1
|
+
{"version":3,"file":"TypedRoute.js","sourceRoot":"","sources":["../../src/decorators/TypedRoute.ts"],"names":[],"mappings":";;;;;;AAAA,2CAWwB;AAGxB,8CAAiD;AACjD,kDAA2C;AAG3C,8EAA2E;AAC3E,wDAAqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,IAAiB,UAAU,CA8H1B;AA9HD,WAAiB,UAAU;IACzB;;;;;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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AAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEjC;;GAEG;AACH,MAAM,qBAAqB;IACzB,YACmB,SAIN;QAJM,cAAS,GAAT,SAAS,CAIf;IACV,CAAC;IAEG,SAAS,CAAC,OAAyB,EAAE,IAAiB;QAC3D,MAAM,IAAI,GAAsB,OAAO,CAAC,YAAY,EAAE,CAAC;QACvD,MAAM,OAAO,GAAoB,IAAI,CAAC,UAAU,EAAE,CAAC;QACnD,MAAM,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,CACvB,IAAA,eAAG,EAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAClE,IAAA,sBAAU,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,yBAAW,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,CAAC,CACzD,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,GAAG;IACd,GAAG,EAAH,YAAG;IACH,IAAI,EAAJ,aAAI;IACJ,KAAK,EAAL,cAAK;IACL,GAAG,EAAH,YAAG;IACH,MAAM,EAAN,eAAM;CACP,CAAC"}
|
|
@@ -38,9 +38,8 @@ const take = (logger) => (method) => (functor) => {
|
|
|
38
38
|
return is(functor.is);
|
|
39
39
|
else if (functor.type === "validate")
|
|
40
40
|
return validate(functor.validate);
|
|
41
|
-
else if (functor.type === "validate.log"
|
|
42
|
-
functor.
|
|
43
|
-
return validateLog(functor.validate)(logger);
|
|
41
|
+
else if (functor.type === "validate.log")
|
|
42
|
+
return validateLog(logger)(functor.validate);
|
|
44
43
|
throw new Error(`Error on nestia.core.${method}(): invalid typed stringify function.`);
|
|
45
44
|
};
|
|
46
45
|
/**
|
|
@@ -83,13 +82,16 @@ const validate = (closure) => (data, _method, _path) => {
|
|
|
83
82
|
});
|
|
84
83
|
return result.data;
|
|
85
84
|
};
|
|
86
|
-
const validateLog = (
|
|
85
|
+
const validateLog = (logger) => (closure) => (data, method, path) => {
|
|
87
86
|
const result = closure(data);
|
|
87
|
+
if (result.success === true)
|
|
88
|
+
return result.data;
|
|
88
89
|
if (result.success === false)
|
|
89
|
-
logger({
|
|
90
|
-
|
|
90
|
+
logger()({
|
|
91
|
+
errors: result.errors,
|
|
91
92
|
method,
|
|
92
93
|
path,
|
|
94
|
+
data,
|
|
93
95
|
});
|
|
94
96
|
return JSON.stringify(data);
|
|
95
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8D;AAC9D,kDAA2D;AAG3D,oFAAiF;AAGjF;;GAEG;AACI,MAAM,sBAAsB,GACjC,CAAC,
|
|
1
|
+
{"version":3,"file":"get_path_and_stringify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_stringify.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8D;AAC9D,kDAA2D;AAG3D,oFAAiF;AAGjF;;GAEG;AACI,MAAM,sBAAsB,GACjC,CAAC,MAAyD,EAAE,EAAE,CAC9D,CAAC,MAAc,EAAE,EAAE,CACnB,CACE,GAAG,IAAW,EAId,EAAE;IACF,MAAM,IAAI,GACR,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;QACrB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC3B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,IAAI,CAAC;IACX,MAAM,OAAO,GACX,IAAI,KAAK,IAAI,CA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AAI,CAAC;AACrB,CAAC,CAAC;AAEJ,MAAM,WAAW,GACf,CAAC,MAAyD,EAAE,EAAE,CAC9D,CAAI,OAAsC,EAAE,EAAE,CAC9C,CAAC,IAAO,EAAE,MAAc,EAAE,IAAY,EAAU,EAAE;IAChD,MAAM,MAAM,GAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IAChD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;QAC1B,MAAM,EAAE,CAAC;YACP,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM;YACN,IAAI;YACJ,IAAI;SACL,CAAC,CAAC;IACL,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface INestiaTransformOptions {
|
|
2
2
|
validate?: "assert" | "is" | "validate" | "assertEquals" | "equals" | "validateEquals" | "assertClone" | "validateClone" | "assertPrune" | "validatePrune";
|
|
3
|
-
stringify?: "stringify" | "assert" | "is" | "validate" | "validate.log" |
|
|
3
|
+
stringify?: "stringify" | "assert" | "is" | "validate" | "validate.log" | null;
|
|
4
4
|
throws?: boolean;
|
|
5
5
|
}
|
|
@@ -18,7 +18,7 @@ export declare namespace IResponseBodyStringifier {
|
|
|
18
18
|
validate: (input: T) => IValidation<string>;
|
|
19
19
|
}
|
|
20
20
|
interface IValidateLog<T> {
|
|
21
|
-
type: "validate.log"
|
|
22
|
-
validate: (input: T) => IValidation<
|
|
21
|
+
type: "validate.log";
|
|
22
|
+
validate: (input: T) => IValidation<string>;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TypedRouteProgrammer = void 0;
|
|
7
7
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const ValidateProgrammer_1 = require("typia/lib/programmers/ValidateProgrammer");
|
|
9
8
|
const JsonAssertStringifyProgrammer_1 = require("typia/lib/programmers/json/JsonAssertStringifyProgrammer");
|
|
10
9
|
const JsonIsStringifyProgrammer_1 = require("typia/lib/programmers/json/JsonIsStringifyProgrammer");
|
|
11
10
|
const JsonStringifyProgrammer_1 = require("typia/lib/programmers/json/JsonStringifyProgrammer");
|
|
@@ -14,25 +13,43 @@ var TypedRouteProgrammer;
|
|
|
14
13
|
(function (TypedRouteProgrammer) {
|
|
15
14
|
TypedRouteProgrammer.generate = (project) => (modulo) => (type) => {
|
|
16
15
|
// GENERATE STRINGIFY PLAN
|
|
17
|
-
const parameter = (
|
|
18
|
-
typescript_1.default.factory.createPropertyAssignment(typescript_1.default.factory.createIdentifier("type"), typescript_1.default.factory.createStringLiteral(
|
|
19
|
-
typescript_1.default.factory.createPropertyAssignment(typescript_1.default.factory.createIdentifier(key), programmer(Object.assign(Object.assign({}, project), { options: {} }))(modulo)(type)),
|
|
16
|
+
const parameter = (props) => typescript_1.default.factory.createObjectLiteralExpression([
|
|
17
|
+
typescript_1.default.factory.createPropertyAssignment(typescript_1.default.factory.createIdentifier("type"), typescript_1.default.factory.createStringLiteral(props.type)),
|
|
18
|
+
typescript_1.default.factory.createPropertyAssignment(typescript_1.default.factory.createIdentifier(props.key), props.programmer(Object.assign(Object.assign({}, project), { options: {} }))(modulo)(type)),
|
|
20
19
|
]);
|
|
21
20
|
// RETURNS
|
|
22
21
|
if (project.options.stringify === "is")
|
|
23
|
-
return parameter(
|
|
22
|
+
return parameter({
|
|
23
|
+
type: "is",
|
|
24
|
+
key: "is",
|
|
25
|
+
programmer: JsonIsStringifyProgrammer_1.JsonIsStringifyProgrammer.write,
|
|
26
|
+
});
|
|
24
27
|
else if (project.options.stringify === "validate")
|
|
25
|
-
return parameter(
|
|
28
|
+
return parameter({
|
|
29
|
+
type: "validate",
|
|
30
|
+
key: "validate",
|
|
31
|
+
programmer: JsonValidateStringifyProgrammer_1.JsonValidateStringifyProgrammer.write,
|
|
32
|
+
});
|
|
26
33
|
else if (project.options.stringify === "stringify")
|
|
27
|
-
return parameter(
|
|
34
|
+
return parameter({
|
|
35
|
+
type: "stringify",
|
|
36
|
+
key: "stringify",
|
|
37
|
+
programmer: JsonStringifyProgrammer_1.JsonStringifyProgrammer.write,
|
|
38
|
+
});
|
|
28
39
|
else if (project.options.stringify === "validate.log")
|
|
29
|
-
return parameter(
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
return parameter({
|
|
41
|
+
type: "validate.log",
|
|
42
|
+
key: "validate",
|
|
43
|
+
programmer: JsonValidateStringifyProgrammer_1.JsonValidateStringifyProgrammer.write,
|
|
44
|
+
});
|
|
32
45
|
else if (project.options.stringify === null)
|
|
33
46
|
return typescript_1.default.factory.createNull();
|
|
34
47
|
// ASSERT IS DEFAULT
|
|
35
|
-
return parameter(
|
|
48
|
+
return parameter({
|
|
49
|
+
type: "assert",
|
|
50
|
+
key: "assert",
|
|
51
|
+
programmer: JsonAssertStringifyProgrammer_1.JsonAssertStringifyProgrammer.write,
|
|
52
|
+
});
|
|
36
53
|
};
|
|
37
54
|
})(TypedRouteProgrammer || (exports.TypedRouteProgrammer = TypedRouteProgrammer = {}));
|
|
38
55
|
//# sourceMappingURL=TypedRouteProgrammer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedRouteProgrammer.js","sourceRoot":"","sources":["../../src/programmers/TypedRouteProgrammer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"TypedRouteProgrammer.js","sourceRoot":"","sources":["../../src/programmers/TypedRouteProgrammer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAC5B,4GAAyG;AACzG,oGAAiG;AACjG,gGAA6F;AAC7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;aAC1C,CAAC,CAAC;aACA,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,cAAc;YACnD,OAAO,SAAS,CAAC;gBACf,IAAI,EAAE,cAAc;gBACpB,GAAG,EAAE,UAAU;gBACf,UAAU,EAAE,iEAA+B,CAAC,KAAK;aAClD,CAAC,CAAC;aACA,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI;YACzC,OAAO,oBAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAEjC,oBAAoB;QACpB,OAAO,SAAS,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,GAAG,EAAE,QAAQ;YACb,UAAU,EAAE,6DAA6B,CAAC,KAAK;SAChD,CAAC,CAAC;IACL,CAAC,CAAC;AACN,CAAC,EAhEgB,oBAAoB,oCAApB,oBAAoB,QAgEpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0-dev.20240926",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://nestia.io",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nestia/fetcher": "^3.
|
|
39
|
+
"@nestia/fetcher": "^3.16.0-dev.20240926",
|
|
40
40
|
"@nestjs/common": ">=7.0.1",
|
|
41
41
|
"@nestjs/core": ">=7.0.1",
|
|
42
|
-
"@samchon/openapi": "^1.0
|
|
42
|
+
"@samchon/openapi": "^1.1.0",
|
|
43
43
|
"detect-ts-node": "^1.0.5",
|
|
44
44
|
"get-function-location": "^2.0.0",
|
|
45
45
|
"glob": "^7.2.0",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"reflect-metadata": ">=0.1.12",
|
|
50
50
|
"rxjs": ">=6.0.3",
|
|
51
51
|
"tgrid": "^1.0.0",
|
|
52
|
-
"typia": "^6.
|
|
52
|
+
"typia": "^6.11.0",
|
|
53
53
|
"ws": "^7.5.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@nestia/fetcher": ">=3.
|
|
56
|
+
"@nestia/fetcher": ">=3.16.0-dev.20240926",
|
|
57
57
|
"@nestjs/common": ">=7.0.1",
|
|
58
58
|
"@nestjs/core": ">=7.0.1",
|
|
59
59
|
"reflect-metadata": ">=0.1.12",
|
|
60
60
|
"rxjs": ">=6.0.3",
|
|
61
|
-
"typia": ">=6.
|
|
61
|
+
"typia": ">=6.11.0 <7.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@fastify/multipart": "^8.1.0",
|
|
@@ -103,7 +103,7 @@ export namespace EncryptedRoute {
|
|
|
103
103
|
* @default console.log
|
|
104
104
|
*/
|
|
105
105
|
export function setValidateErrorLogger(
|
|
106
|
-
func: (
|
|
106
|
+
func: (log: IValidateErrorLog) => void,
|
|
107
107
|
): void {
|
|
108
108
|
TypedRoute.setValidateErrorLogger(func);
|
|
109
109
|
}
|
|
@@ -124,9 +124,9 @@ export namespace EncryptedRoute {
|
|
|
124
124
|
): MethodDecorator;
|
|
125
125
|
|
|
126
126
|
function route(...args: any[]): MethodDecorator {
|
|
127
|
-
const [path, stringify] = get_path_and_stringify(
|
|
128
|
-
|
|
129
|
-
)(...args);
|
|
127
|
+
const [path, stringify] = get_path_and_stringify(
|
|
128
|
+
() => TypedRoute.__logger,
|
|
129
|
+
)(`EncryptedRoute.${method}`)(...args);
|
|
130
130
|
return applyDecorators(
|
|
131
131
|
ROUTERS[method](path),
|
|
132
132
|
UseInterceptors(new EncryptedRouteInterceptor(method, stringify)),
|
|
@@ -92,7 +92,7 @@ export namespace TypedRoute {
|
|
|
92
92
|
* @default console.log
|
|
93
93
|
*/
|
|
94
94
|
export function setValidateErrorLogger(
|
|
95
|
-
func: (
|
|
95
|
+
func: (log: IValidateErrorLog) => void,
|
|
96
96
|
): void {
|
|
97
97
|
__logger = func;
|
|
98
98
|
}
|
|
@@ -123,9 +123,14 @@ export namespace TypedRoute {
|
|
|
123
123
|
path: string;
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
* Validation error
|
|
126
|
+
* Validation error informations with detailed reasons.
|
|
127
127
|
*/
|
|
128
|
-
|
|
128
|
+
errors: IValidation.IError[];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Data that is not following the promised type `T`.
|
|
132
|
+
*/
|
|
133
|
+
data: unknown;
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
/**
|
|
@@ -145,7 +150,7 @@ export namespace TypedRoute {
|
|
|
145
150
|
): MethodDecorator;
|
|
146
151
|
|
|
147
152
|
function route(...args: any[]): MethodDecorator {
|
|
148
|
-
const [path, stringify] = get_path_and_stringify(__logger)(
|
|
153
|
+
const [path, stringify] = get_path_and_stringify(() => __logger)(
|
|
149
154
|
`TypedRoute.${method}`,
|
|
150
155
|
)(...args);
|
|
151
156
|
return applyDecorators(
|
|
@@ -9,7 +9,7 @@ import { TypedRoute } from "../TypedRoute";
|
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export const get_path_and_stringify =
|
|
12
|
-
(logger: (log: TypedRoute.IValidateErrorLog) => void) =>
|
|
12
|
+
(logger: () => (log: TypedRoute.IValidateErrorLog) => void) =>
|
|
13
13
|
(method: string) =>
|
|
14
14
|
(
|
|
15
15
|
...args: any[]
|
|
@@ -32,7 +32,7 @@ export const get_path_and_stringify =
|
|
|
32
32
|
* @internal
|
|
33
33
|
*/
|
|
34
34
|
const take =
|
|
35
|
-
(logger: (log: TypedRoute.IValidateErrorLog) => void) =>
|
|
35
|
+
(logger: () => (log: TypedRoute.IValidateErrorLog) => void) =>
|
|
36
36
|
(method: string) =>
|
|
37
37
|
<T>(functor?: IResponseBodyStringifier<T> | null) => {
|
|
38
38
|
if (functor === undefined) {
|
|
@@ -46,11 +46,8 @@ const take =
|
|
|
46
46
|
else if (functor.type === "assert") return assert(functor.assert);
|
|
47
47
|
else if (functor.type === "is") return is(functor.is);
|
|
48
48
|
else if (functor.type === "validate") return validate(functor.validate);
|
|
49
|
-
else if (
|
|
50
|
-
functor.
|
|
51
|
-
functor.type === "validateEquals.log"
|
|
52
|
-
)
|
|
53
|
-
return validateLog(functor.validate)(logger);
|
|
49
|
+
else if (functor.type === "validate.log")
|
|
50
|
+
return validateLog(logger)(functor.validate);
|
|
54
51
|
throw new Error(
|
|
55
52
|
`Error on nestia.core.${method}(): invalid typed stringify function.`,
|
|
56
53
|
);
|
|
@@ -104,15 +101,17 @@ const validate =
|
|
|
104
101
|
};
|
|
105
102
|
|
|
106
103
|
const validateLog =
|
|
104
|
+
(logger: () => (log: TypedRoute.IValidateErrorLog) => void) =>
|
|
107
105
|
<T>(closure: (data: T) => IValidation<any>) =>
|
|
108
|
-
(logger: (log: TypedRoute.IValidateErrorLog) => void) =>
|
|
109
106
|
(data: T, method: string, path: string): string => {
|
|
110
|
-
const result: IValidation<
|
|
107
|
+
const result: IValidation<string> = closure(data);
|
|
108
|
+
if (result.success === true) return result.data;
|
|
111
109
|
if (result.success === false)
|
|
112
|
-
logger({
|
|
113
|
-
|
|
110
|
+
logger()({
|
|
111
|
+
errors: result.errors,
|
|
114
112
|
method,
|
|
115
113
|
path,
|
|
114
|
+
data,
|
|
116
115
|
});
|
|
117
116
|
return JSON.stringify(data);
|
|
118
117
|
};
|
|
@@ -24,7 +24,7 @@ export namespace IResponseBodyStringifier {
|
|
|
24
24
|
validate: (input: T) => IValidation<string>;
|
|
25
25
|
}
|
|
26
26
|
export interface IValidateLog<T> {
|
|
27
|
-
type: "validate.log"
|
|
28
|
-
validate: (input: T) => IValidation<
|
|
27
|
+
type: "validate.log";
|
|
28
|
+
validate: (input: T) => IValidation<string>;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { ValidateProgrammer } from "typia/lib/programmers/ValidateProgrammer";
|
|
3
2
|
import { JsonAssertStringifyProgrammer } from "typia/lib/programmers/json/JsonAssertStringifyProgrammer";
|
|
4
3
|
import { JsonIsStringifyProgrammer } from "typia/lib/programmers/json/JsonIsStringifyProgrammer";
|
|
5
4
|
import { JsonStringifyProgrammer } from "typia/lib/programmers/json/JsonStringifyProgrammer";
|
|
@@ -14,22 +13,23 @@ export namespace TypedRouteProgrammer {
|
|
|
14
13
|
(modulo: ts.LeftHandSideExpression) =>
|
|
15
14
|
(type: ts.Type): ts.Expression => {
|
|
16
15
|
// GENERATE STRINGIFY PLAN
|
|
17
|
-
const parameter = (
|
|
18
|
-
|
|
16
|
+
const parameter = (props: {
|
|
17
|
+
type: string;
|
|
18
|
+
key: string;
|
|
19
19
|
programmer: (
|
|
20
20
|
project: IProject,
|
|
21
21
|
) => (
|
|
22
22
|
modulo: ts.LeftHandSideExpression,
|
|
23
|
-
) => (type: ts.Type) => ts.Expression
|
|
24
|
-
) =>
|
|
23
|
+
) => (type: ts.Type) => ts.Expression;
|
|
24
|
+
}) =>
|
|
25
25
|
ts.factory.createObjectLiteralExpression([
|
|
26
26
|
ts.factory.createPropertyAssignment(
|
|
27
27
|
ts.factory.createIdentifier("type"),
|
|
28
|
-
ts.factory.createStringLiteral(
|
|
28
|
+
ts.factory.createStringLiteral(props.type),
|
|
29
29
|
),
|
|
30
30
|
ts.factory.createPropertyAssignment(
|
|
31
|
-
ts.factory.createIdentifier(key),
|
|
32
|
-
programmer({
|
|
31
|
+
ts.factory.createIdentifier(props.key),
|
|
32
|
+
props.programmer({
|
|
33
33
|
...project,
|
|
34
34
|
options: {}, // use default option
|
|
35
35
|
})(modulo)(type),
|
|
@@ -38,27 +38,37 @@ export namespace TypedRouteProgrammer {
|
|
|
38
38
|
|
|
39
39
|
// RETURNS
|
|
40
40
|
if (project.options.stringify === "is")
|
|
41
|
-
return parameter(
|
|
41
|
+
return parameter({
|
|
42
|
+
type: "is",
|
|
43
|
+
key: "is",
|
|
44
|
+
programmer: JsonIsStringifyProgrammer.write,
|
|
45
|
+
});
|
|
42
46
|
else if (project.options.stringify === "validate")
|
|
43
|
-
return parameter(
|
|
47
|
+
return parameter({
|
|
48
|
+
type: "validate",
|
|
49
|
+
key: "validate",
|
|
50
|
+
programmer: JsonValidateStringifyProgrammer.write,
|
|
51
|
+
});
|
|
44
52
|
else if (project.options.stringify === "stringify")
|
|
45
|
-
return parameter(
|
|
53
|
+
return parameter({
|
|
54
|
+
type: "stringify",
|
|
55
|
+
key: "stringify",
|
|
56
|
+
programmer: JsonStringifyProgrammer.write,
|
|
57
|
+
});
|
|
46
58
|
else if (project.options.stringify === "validate.log")
|
|
47
|
-
return parameter(
|
|
48
|
-
"validate.log",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
);
|
|
52
|
-
else if (project.options.stringify === "validateEquals.log")
|
|
53
|
-
return parameter(
|
|
54
|
-
"validateEquals.log",
|
|
55
|
-
(project) => (modulo) =>
|
|
56
|
-
ValidateProgrammer.write(project)(modulo)(true),
|
|
57
|
-
);
|
|
59
|
+
return parameter({
|
|
60
|
+
type: "validate.log",
|
|
61
|
+
key: "validate",
|
|
62
|
+
programmer: JsonValidateStringifyProgrammer.write,
|
|
63
|
+
});
|
|
58
64
|
else if (project.options.stringify === null)
|
|
59
65
|
return ts.factory.createNull();
|
|
60
66
|
|
|
61
67
|
// ASSERT IS DEFAULT
|
|
62
|
-
return parameter(
|
|
68
|
+
return parameter({
|
|
69
|
+
type: "assert",
|
|
70
|
+
key: "assert",
|
|
71
|
+
programmer: JsonAssertStringifyProgrammer.write,
|
|
72
|
+
});
|
|
63
73
|
};
|
|
64
74
|
}
|