@nestia/core 3.12.0 → 3.12.1-dev.20240903
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.js +1 -2
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/NoTransformConfigurationError.d.ts +22 -0
- package/lib/decorators/NoTransformConfigurationError.js +34 -0
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -0
- package/lib/decorators/TypedHeaders.js.map +1 -1
- package/lib/decorators/TypedParam.js +5 -3
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/WebSocketRoute.js +5 -3
- package/lib/decorators/WebSocketRoute.js.map +1 -1
- package/lib/decorators/internal/NoTransformConfigureError.d.ts +1 -1
- package/lib/decorators/internal/NoTransformConfigureError.js +4 -16
- package/lib/decorators/internal/NoTransformConfigureError.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.js +5 -3
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +5 -3
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +5 -3
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +5 -3
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +5 -3
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +5 -3
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/options/INestiaTransformOptions.d.ts +1 -0
- package/package.json +3 -3
- package/src/decorators/EncryptedRoute.ts +3 -2
- package/src/decorators/NoTransformConfigurationError.ts +32 -0
- package/src/decorators/TypedFormData.ts +1 -1
- package/src/decorators/TypedHeaders.ts +1 -2
- package/src/decorators/TypedParam.ts +5 -2
- package/src/decorators/WebSocketRoute.ts +5 -3
- package/src/decorators/internal/NoTransformConfigureError.ts +2 -18
- package/src/decorators/internal/get_path_and_querify.ts +5 -3
- package/src/decorators/internal/get_path_and_stringify.ts +5 -3
- package/src/decorators/internal/validate_request_body.ts +6 -4
- package/src/decorators/internal/validate_request_form_data.ts +6 -4
- package/src/decorators/internal/validate_request_headers.ts +7 -4
- package/src/decorators/internal/validate_request_query.ts +6 -3
- package/src/options/INestiaTransformOptions.ts +1 -0
|
@@ -10,7 +10,6 @@ const operators_1 = require("rxjs/operators");
|
|
|
10
10
|
const typia_1 = __importDefault(require("typia"));
|
|
11
11
|
const Singleton_1 = require("../utils/Singleton");
|
|
12
12
|
const EncryptedConstant_1 = require("./internal/EncryptedConstant");
|
|
13
|
-
const NoTransformConfigureError_1 = require("./internal/NoTransformConfigureError");
|
|
14
13
|
const get_path_and_stringify_1 = require("./internal/get_path_and_stringify");
|
|
15
14
|
const headers_to_object_1 = require("./internal/headers_to_object");
|
|
16
15
|
const route_error_1 = require("./internal/route_error");
|
|
@@ -107,7 +106,7 @@ class EncryptedRouteInterceptor {
|
|
|
107
106
|
return next.handle().pipe((0, operators_1.map)((value) => {
|
|
108
107
|
const param = Reflect.getMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, context.getClass());
|
|
109
108
|
if (!param)
|
|
110
|
-
return (
|
|
109
|
+
return Error(`Error on EncryptedRoute.${this.method}(): no password found.`);
|
|
111
110
|
const headers = new Singleton_1.Singleton(() => {
|
|
112
111
|
const request = http.getRequest();
|
|
113
112
|
return (0, headers_to_object_1.headers_to_object)(request.headers);
|
|
@@ -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,oEAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"EncryptedRoute.js","sourceRoot":"","sources":["../../src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E,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function NoTransformConfigurationError(method: string): never;
|
|
2
|
+
export declare namespace NoTransformConfigurationError {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to throw an error or not.
|
|
5
|
+
*
|
|
6
|
+
* If you set this value to `false`, {@link NoTransformConfigurationError} will
|
|
7
|
+
* not throw an error.
|
|
8
|
+
*
|
|
9
|
+
* Even if you've not configured the plugin transformer of `tsconfig.json` file,
|
|
10
|
+
* the error will not be thrown and the program will be continued. Instead, every
|
|
11
|
+
* validations and assertions will be skipped and the value will be returned as it is.
|
|
12
|
+
* Furthermore, unexpected behaviors may occur.
|
|
13
|
+
*
|
|
14
|
+
* Therefore, it is not recommended to set this value to `false` in production
|
|
15
|
+
* environment. Configure this value to be `false` only when you're debugging or testing.
|
|
16
|
+
*
|
|
17
|
+
* By the way, if you hope the `false` value to be set, you have to do it before the first.
|
|
18
|
+
* If you configure the `false` value after the `@nestia/core` decorator functions are
|
|
19
|
+
* composed, the value will not be applied and the error will be thrown.
|
|
20
|
+
*/
|
|
21
|
+
let throws: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoTransformConfigurationError = NoTransformConfigurationError;
|
|
4
|
+
function NoTransformConfigurationError(method) {
|
|
5
|
+
if (NoTransformConfigurationError.throws === true)
|
|
6
|
+
throw new Error([
|
|
7
|
+
`Error on nestia.core.${method}(): no transform has been configured.`,
|
|
8
|
+
`Run "npx typia setup" command, or check if you're using non-standard TypeScript compiler like Babel or SWC.`,
|
|
9
|
+
`Otherwise you're running "npx nestia sdk/swagger" or similar, run "npx tsc" command to find the reason why.`,
|
|
10
|
+
].join(" "));
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
(function (NoTransformConfigurationError) {
|
|
14
|
+
/**
|
|
15
|
+
* Whether to throw an error or not.
|
|
16
|
+
*
|
|
17
|
+
* If you set this value to `false`, {@link NoTransformConfigurationError} will
|
|
18
|
+
* not throw an error.
|
|
19
|
+
*
|
|
20
|
+
* Even if you've not configured the plugin transformer of `tsconfig.json` file,
|
|
21
|
+
* the error will not be thrown and the program will be continued. Instead, every
|
|
22
|
+
* validations and assertions will be skipped and the value will be returned as it is.
|
|
23
|
+
* Furthermore, unexpected behaviors may occur.
|
|
24
|
+
*
|
|
25
|
+
* Therefore, it is not recommended to set this value to `false` in production
|
|
26
|
+
* environment. Configure this value to be `false` only when you're debugging or testing.
|
|
27
|
+
*
|
|
28
|
+
* By the way, if you hope the `false` value to be set, you have to do it before the first.
|
|
29
|
+
* If you configure the `false` value after the `@nestia/core` decorator functions are
|
|
30
|
+
* composed, the value will not be applied and the error will be thrown.
|
|
31
|
+
*/
|
|
32
|
+
NoTransformConfigurationError.throws = true;
|
|
33
|
+
})(NoTransformConfigurationError || (exports.NoTransformConfigurationError = NoTransformConfigurationError = {}));
|
|
34
|
+
//# sourceMappingURL=NoTransformConfigurationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoTransformConfigurationError.js","sourceRoot":"","sources":["../../src/decorators/NoTransformConfigurationError.ts"],"names":[],"mappings":";;AAAA,sEAUC;AAVD,SAAgB,6BAA6B,CAAC,MAAc;IAC1D,IAAI,6BAA6B,CAAC,MAAM,KAAK,IAAI;QAC/C,MAAM,IAAI,KAAK,CACb;YACE,wBAAwB,MAAM,uCAAuC;YACrE,6GAA6G;YAC7G,6GAA6G;SAC9G,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;IACJ,OAAO,SAAkB,CAAC;AAC5B,CAAC;AACD,WAAiB,6BAA6B;IAC5C;;;;;;;;;;;;;;;;;OAiBG;IACQ,oCAAM,GAAG,IAAI,CAAC;AAC3B,CAAC,EApBgB,6BAA6B,6CAA7B,6BAA6B,QAoB7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedHeaders.js","sourceRoot":"","sources":["../../src/decorators/TypedHeaders.ts"],"names":[],"mappings":";;;;;AAiDA,
|
|
1
|
+
{"version":3,"file":"TypedHeaders.js","sourceRoot":"","sources":["../../src/decorators/TypedHeaders.ts"],"names":[],"mappings":";;;;;AAiDA,oCAeC;AAhED,2CAAwE;AAGxE,kDAA0B;AAG1B,kFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,SAAgB,YAAY,CAC1B,SAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,mDAAwB,EAAC,SAAS,CAAC,CAAC;IACpD,OAAO,IAAA,6BAAoB,EAAC,SAAS,YAAY,CAC/C,QAAa,EACb,OAAyB;QAEzB,MAAM,OAAO,GAAqC,OAAO;aACtD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAChB,MAAM,MAAM,GAAc,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,MAAM,YAAY,KAAK;YAAE,MAAM,MAAM,CAAC;QAC1C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,CAAC;AACP,CAAC;AACD,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,eAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TypedParam = TypedParam;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("./NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* Type safe URL parameter decorator.
|
|
12
12
|
*
|
|
@@ -31,8 +31,10 @@ const NoTransformConfigureError_1 = require("./internal/NoTransformConfigureErro
|
|
|
31
31
|
* @author Jeongho Nam - https://github.com/samchon
|
|
32
32
|
*/
|
|
33
33
|
function TypedParam(name, assert) {
|
|
34
|
-
if (assert === undefined)
|
|
35
|
-
|
|
34
|
+
if (assert === undefined) {
|
|
35
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedParam");
|
|
36
|
+
assert = (value) => value;
|
|
37
|
+
}
|
|
36
38
|
return (0, common_1.createParamDecorator)(function TypedParam({}, context) {
|
|
37
39
|
const request = context
|
|
38
40
|
.switchToHttp()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedParam.js","sourceRoot":"","sources":["../../src/decorators/TypedParam.ts"],"names":[],"mappings":";;;;;AAkCA,
|
|
1
|
+
{"version":3,"file":"TypedParam.js","sourceRoot":"","sources":["../../src/decorators/TypedParam.ts"],"names":[],"mappings":";;;;;AAkCA,gCA+BC;AAjED,2CAIwB;AAGxB,kDAA8C;AAE9C,mFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,UAAU,CACxB,IAAY,EACZ,MAA6B;IAE7B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAA,6DAA6B,EAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAU,CAAC;IACjC,CAAC;IAED,OAAO,IAAA,6BAAoB,EAAC,SAAS,UAAU,CAC7C,EAAO,EACP,OAAyB;QAEzB,MAAM,OAAO,GAAqC,OAAO;aACtD,YAAY,EAAE;aACd,UAAU,EAAE,CAAC;QAChB,MAAM,GAAG,GAAY,OAAO,CAAC,MAAc,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,qZAA6B,GAAG;gBAC9B,MAAM,IAAI,4BAAmB,CAAC;oBAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,MAAM,EAAE,GAAG,CAAC,OAAO;oBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,OAAO,EAAE,mCAAmC,IAAI,IAAI;iBACrD,CAAC,CAAC;YACL,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACX,CAAC;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.WebSocketRoute = WebSocketRoute;
|
|
7
7
|
const typia_1 = __importDefault(require("typia"));
|
|
8
|
-
const
|
|
8
|
+
const NoTransformConfigurationError_1 = require("./NoTransformConfigurationError");
|
|
9
9
|
const validate_request_body_1 = require("./internal/validate_request_body");
|
|
10
10
|
const validate_request_query_1 = require("./internal/validate_request_query");
|
|
11
11
|
/**
|
|
@@ -140,8 +140,10 @@ function WebSocketRoute(path) {
|
|
|
140
140
|
* @param field URL parameter field name
|
|
141
141
|
*/
|
|
142
142
|
function Param(field, assert) {
|
|
143
|
-
if (assert === undefined)
|
|
144
|
-
|
|
143
|
+
if (assert === undefined) {
|
|
144
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("WebSocketRoute.Param");
|
|
145
|
+
assert = (value) => value;
|
|
146
|
+
}
|
|
145
147
|
return function WebSocketParam(target, propertyKey, parameterIndex) {
|
|
146
148
|
emplace(target, propertyKey !== null && propertyKey !== void 0 ? propertyKey : "", {
|
|
147
149
|
category: "param",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketRoute.js","sourceRoot":"","sources":["../../src/decorators/WebSocketRoute.ts"],"names":[],"mappings":";;;;;AA2CA,wCAiBC;AA5DD,kDAA0B;
|
|
1
|
+
{"version":3,"file":"WebSocketRoute.js","sourceRoot":"","sources":["../../src/decorators/WebSocketRoute.ts"],"names":[],"mappings":";;;;;AA2CA,wCAiBC;AA5DD,kDAA0B;AAI1B,mFAAgF;AAEhF,4EAAyE;AACzE,8EAA2E;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,cAAc,CAC5B,IAAoC;IAEpC,OAAO,SAAS,cAAc,CAC5B,OAAe,EACf,YAA6B,EAC7B,UAAwC;QAExC,OAAO,CAAC,cAAc,CACpB,uBAAuB,EACvB;YACE,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;SACpC,EAClC,UAAU,CAAC,KAAK,CACjB,CAAC;Q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7C,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,eAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE/C;;OAEG;IACH,MAAM,OAAO,GAAG,CACd,MAAc,EACd,WAA4B,EAC5B,KAAuC,EACvC,EAAE;QACF,MAAM,KAAK,GACT,OAAO,CAAC,WAAW,CACjB,kCAAkC,EAClC,MAAM,EACN,WAAW,CACZ,CAAC;QACJ,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;;YAEzC,OAAO,CAAC,cAAc,CACpB,kCAAkC,EAClC,CAAC,KAAK,CAAC,EACP,MAAM,EACN,WAAW,CACZ,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,EA7LgB,cAAc,8BAAd,cAAc,QA6L9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { NoTransformConfigurationError as NoTransformConfigureError } from "../NoTransformConfigurationError";
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoTransformConfigureError =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`Error on nestia.core.${method}(): no transform has been configured.`,
|
|
8
|
-
`Run "npx typia setup" command, or check if you're using non-standard TypeScript compiler like Babel or SWC.`,
|
|
9
|
-
`Otherwise you're running "npx nestia sdk/swagger" or similar, run "npx tsc" command to find the reason why.`,
|
|
10
|
-
].join(" "));
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
(function (NoTransformConfigureError) {
|
|
17
|
-
NoTransformConfigureError.throws = true;
|
|
18
|
-
})(NoTransformConfigureError || (exports.NoTransformConfigureError = NoTransformConfigureError = {}));
|
|
3
|
+
exports.NoTransformConfigureError = void 0;
|
|
4
|
+
// For very old legay versions
|
|
5
|
+
var NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
6
|
+
Object.defineProperty(exports, "NoTransformConfigureError", { enumerable: true, get: function () { return NoTransformConfigurationError_1.NoTransformConfigurationError; } });
|
|
19
7
|
//# sourceMappingURL=NoTransformConfigureError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoTransformConfigureError.js","sourceRoot":"","sources":["../../../src/decorators/internal/NoTransformConfigureError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoTransformConfigureError.js","sourceRoot":"","sources":["../../../src/decorators/internal/NoTransformConfigureError.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kFAA8G;AAArG,0IAAA,6BAA6B,OAA6B"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.get_path_and_querify = void 0;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
@@ -24,8 +24,10 @@ exports.get_path_and_querify = get_path_and_querify;
|
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
26
|
const take = (method) => (functor) => {
|
|
27
|
-
if (functor === undefined)
|
|
28
|
-
|
|
27
|
+
if (functor === undefined) {
|
|
28
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
29
|
+
return querify;
|
|
30
|
+
}
|
|
29
31
|
else if (functor === null)
|
|
30
32
|
return querify;
|
|
31
33
|
else if (functor.type === "stringify")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_path_and_querify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_querify.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8D;AAC9D,kDAA2D;AAG3D,
|
|
1
|
+
{"version":3,"file":"get_path_and_querify.js","sourceRoot":"","sources":["../../../src/decorators/internal/get_path_and_querify.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8D;AAC9D,kDAA2D;AAG3D,oFAAiF;AAEjF;;GAEG;AACI,MAAM,oBAAoB,GAC/B,CAAC,MAAc,EAAE,EAAE,CACnB,CACE,GAAG,IAAW,EACoD,EAAE;IACpE,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,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAdS,QAAA,oBAAoB,wBAc7B;AAEJ;;GAEG;AACH,MAAM,IAAI,GACR,CAAC,MAAc,EAAE,EAAE,CACnB,CAAI,OAA0C,EAAE,EAAE;IAChD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,IAAA,6DAA6B,EAAC,MAAM,CAAC,CAAC;QACtC,OAAO,OAAO,CAAC;IACjB,CAAC;SAAM,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;SACvC,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,OAAO,CAAC,SAAS,CAAC;SAC3D,IAAI,OAAO,CA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G,CAAC,QAAQ;gBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,OAAO,EAAE,OAAO;aACjB,CAAC,CAAC;QACL,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,EAAE,GACN,CAAI,OAA4C,EAAE,EAAE,CACpD,CAAC,IAAO,EAAE,EAAE;IACV,MAAM,MAAM,GAA2B,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,IAAI,MAAM,KAAK,IAAI;QAAE,MAAM,IAAI,qCAA4B,CAAC,OAAO,CAAC,CAAC;IACrE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,QAAQ,GACZ,CAAI,OAAkD,EAAE,EAAE,CAC1D,CAAC,IAAO,EAAE,EAAE;IACV,MAAM,MAAM,GAAiC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;QAC1B,MAAM,IAAI,qCAA4B,CAAC;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;IACL,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.get_path_and_stringify = void 0;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
@@ -24,8 +24,10 @@ exports.get_path_and_stringify = get_path_and_stringify;
|
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
26
|
const take = (method) => (functor) => {
|
|
27
|
-
if (functor === undefined)
|
|
28
|
-
|
|
27
|
+
if (functor === undefined) {
|
|
28
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
29
|
+
return JSON.stringify;
|
|
30
|
+
}
|
|
29
31
|
else if (functor === null)
|
|
30
32
|
return JSON.stringify;
|
|
31
33
|
else if (functor.type === "stringify")
|
|
@@ -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,
|
|
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;AAEjF;;GAEG;AACI,MAAM,sBAAsB,GACjC,CAAC,MAAc,EAAE,EAAE,CACnB,CAAC,GAAG,IAAW,EAA2D,EAAE;IAC1E,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,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAZS,QAAA,sBAAsB,0BAY/B;AAEJ;;GAEG;AACH,MAAM,IAAI,GACR,CAAC,MAAc,EAAE,EAAE,C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,EAAE,CAC3C,CAAC,IAAO,EAAE,EAAE;IACV,MAAM,MAAM,GAAkB,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,MAAM,KAAK,IAAI;QAAE,MAAM,IAAI,qCAA4B,CAAC,OAAO,CAAC,CAAC;IACrE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,QAAQ,GACZ,CAAI,OAAyC,EAAE,EAAE,CACjD,CAAC,IAAO,EAAE,EAAE;IACV,MAAM,MAAM,GAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;QAC1B,MAAM,IAAI,qCAA4B,CAAC;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;IACL,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.validate_request_body = void 0;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
13
|
const validate_request_body = (method) => (validator) => {
|
|
14
|
-
if (!validator)
|
|
15
|
-
|
|
14
|
+
if (!validator) {
|
|
15
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
16
|
+
return () => null;
|
|
17
|
+
}
|
|
16
18
|
else if (validator.type === "assert")
|
|
17
19
|
return assert(validator.assert);
|
|
18
20
|
else if (validator.type === "is")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,
|
|
1
|
+
{"version":3,"file":"validate_request_body.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_body.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAEjF;;GAEG;AACI,MAAM,qBAAqB,GAChC,CAAC,MAAc,EAAE,EAAE,CACnB,CAAI,SAAoC,EAAgC,EAAE;IACxE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,MAAM,CAAC,CAAC;QACtC,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IACpB,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACnE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5E,OAAO,GAAG,EAAE,CACV,IAAI,KAAK,CAAC,wBAAwB,MAAM,8BAA8B,CAAC,CAAC;AAC5E,CAAC,CAAC;AAXS,QAAA,qBAAqB,yBAW9B;AAEJ;;GAEG;AACH,MAAM,MAAM,GACV,CAAI,OAAuB,EAAE,EAAE,CAC/B,CAAC,KAAQ,EAAE,EAAE;IACX,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qZAA6B,GAAG,GAAG,CAAC;YAClC,OAAO,IAAI,4BAAmB,CAAC;gBAC7B,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,MAAM,EAAE,GAAG,CAAC,OAAO;gBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,OAAO,EAAE,OAAO;aACjB,CAAC,CAAC;QACL,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,EAAE,GACN,CAAI,OAA6B,EAAE,EAAE,CACrC,CAAC,KAAQ,EAAE,EAAE;IACX,MAAM,OAAO,GAAY,OAAO,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,4BAAmB,CAAC,OAAO,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,QAAQ,GACZ,CAAI,OAAoC,EAAE,EAAE,CAC5C,CAAC,KAAQ,EAAE,EAAE;IACX,MAAM,MAAM,GAAmB,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,OAAO;QACnB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAI,4BAAmB,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;AACT,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,OAAO,GAAG,uDAAuD,CAAC"}
|
|
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.validate_request_form_data = void 0;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
13
|
const validate_request_form_data = (props) => {
|
|
14
|
-
if (!props)
|
|
15
|
-
|
|
14
|
+
if (!props) {
|
|
15
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedFormData.Body");
|
|
16
|
+
return (input) => Object.entries(input);
|
|
17
|
+
}
|
|
16
18
|
else if (props.validator.type === "assert")
|
|
17
19
|
return assert(props.validator.assert);
|
|
18
20
|
else if (props.validator.type === "is")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_form_data.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_form_data.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,
|
|
1
|
+
{"version":3,"file":"validate_request_form_data.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_form_data.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAEjF;;GAEG;AACI,MAAM,0BAA0B,GAAG,CACxC,KAAgC,EACE,EAAE;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;QACpD,OAAO,CAAC,KAAe,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAM,CAAC;IACzD,CAAC;SAAM,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,QAAQ;QAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACnC,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACjE,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU;QAC1C,OAAO,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,GAAG,EAAE,CACV,IAAI,KAAK,CACP,qEAAqE,CACtE,CAAC;AACN,CAAC,CAAC;AAfW,QAAA,0BAA0B,8BAerC;AAEF;;GAEG;AACH,MAAM,MAAM,GACV,CAAI,OAA+B,EAAE,EAAE,CACvC,CA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1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
13
|
const validate_request_headers = (validator) => {
|
|
14
|
-
if (!validator)
|
|
15
|
-
|
|
14
|
+
if (!validator) {
|
|
15
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedHeaders");
|
|
16
|
+
return (input) => Object.entries(input);
|
|
17
|
+
}
|
|
16
18
|
else if (validator.type === "assert")
|
|
17
19
|
return assert(validator.assert);
|
|
18
20
|
else if (validator.type === "is")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_headers.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_headers.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,
|
|
1
|
+
{"version":3,"file":"validate_request_headers.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_headers.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAEjF;;GAEG;AACI,MAAM,wBAAwB,GAAG,CACtC,SAAuC,EACgC,EAAE;IACzE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAoD,EAAE,EAAE,CAC9D,MAAM,CAAC,OAAO,CAAC,KAAK,CAAM,CAAC;IAC/B,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;SACnE,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACrD,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,Q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CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;AACT,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,OAAO,GAAG,0DAA0D,CAAC"}
|
|
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.validate_request_query = void 0;
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
|
-
const
|
|
9
|
+
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
13
|
const validate_request_query = (method) => (validator) => {
|
|
14
|
-
if (!validator)
|
|
15
|
-
|
|
14
|
+
if (!validator) {
|
|
15
|
+
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
16
|
+
return (input) => Object.fromEntries(input.entries());
|
|
17
|
+
}
|
|
16
18
|
else if (validator.type === "assert")
|
|
17
19
|
return assert(validator.assert);
|
|
18
20
|
else if (validator.type === "is")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_request_query.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_query.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,
|
|
1
|
+
{"version":3,"file":"validate_request_query.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_query.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA2D;AAG3D,oFAAiF;AAEjF;;GAEG;AACI,MAAM,sBAAsB,GACjC,CAAC,MAAc,EAAE,EAAE,CACnB,CAAI,SAAqC,EAAE,EAAE;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,MAAM,CAAC,CAAC;QACtC,OAAO,CAAC,KAAsB,EAAE,EAAE,CAChC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,CA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C,CAAC;AAEJ;;GAEG;AACH,MAAM,QAAQ,GACZ,CAAI,OAAmD,EAAE,EAAE,CAC3D,CAAC,KAAsB,EAA2B,EAAE;IAClD,MAAM,MAAM,GAAmB,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,OAAO;QACnB,CAAC,CAAC,MAAM,CAAC,IAAI;QACb,CAAC,CAAC,IAAI,4BAAmB,CAAC;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;AACT,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export interface INestiaTransformOptions {
|
|
2
2
|
validate?: "assert" | "is" | "validate" | "assertEquals" | "equals" | "validateEquals" | "assertClone" | "validateClone" | "assertPrune" | "validatePrune";
|
|
3
3
|
stringify?: "stringify" | "assert" | "is" | "validate" | null;
|
|
4
|
+
throws?: boolean;
|
|
4
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.1-dev.20240903",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://nestia.io",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@nestia/fetcher": "^3.12.
|
|
39
|
+
"@nestia/fetcher": "^3.12.1-dev.20240903",
|
|
40
40
|
"@nestjs/common": ">=7.0.1",
|
|
41
41
|
"@nestjs/core": ">=7.0.1",
|
|
42
42
|
"@samchon/openapi": "^0.4.6",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"ws": "^7.5.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@nestia/fetcher": ">=3.12.
|
|
56
|
+
"@nestia/fetcher": ">=3.12.1-dev.20240903",
|
|
57
57
|
"@nestjs/common": ">=7.0.1",
|
|
58
58
|
"@nestjs/core": ">=7.0.1",
|
|
59
59
|
"reflect-metadata": ">=0.1.12",
|
|
@@ -20,7 +20,6 @@ import typia from "typia";
|
|
|
20
20
|
import { IResponseBodyStringifier } from "../options/IResponseBodyStringifier";
|
|
21
21
|
import { Singleton } from "../utils/Singleton";
|
|
22
22
|
import { ENCRYPTION_METADATA_KEY } from "./internal/EncryptedConstant";
|
|
23
|
-
import { NoTransformConfigureError } from "./internal/NoTransformConfigureError";
|
|
24
23
|
import { get_path_and_stringify } from "./internal/get_path_and_stringify";
|
|
25
24
|
import { headers_to_object } from "./internal/headers_to_object";
|
|
26
25
|
import { route_error } from "./internal/route_error";
|
|
@@ -146,7 +145,9 @@ class EncryptedRouteInterceptor implements NestInterceptor {
|
|
|
146
145
|
context.getClass(),
|
|
147
146
|
);
|
|
148
147
|
if (!param)
|
|
149
|
-
return
|
|
148
|
+
return Error(
|
|
149
|
+
`Error on EncryptedRoute.${this.method}(): no password found.`,
|
|
150
|
+
);
|
|
150
151
|
|
|
151
152
|
const headers: Singleton<Record<string, string>> = new Singleton(() => {
|
|
152
153
|
const request: express.Request = http.getRequest();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function NoTransformConfigurationError(method: string) {
|
|
2
|
+
if (NoTransformConfigurationError.throws === true)
|
|
3
|
+
throw new Error(
|
|
4
|
+
[
|
|
5
|
+
`Error on nestia.core.${method}(): no transform has been configured.`,
|
|
6
|
+
`Run "npx typia setup" command, or check if you're using non-standard TypeScript compiler like Babel or SWC.`,
|
|
7
|
+
`Otherwise you're running "npx nestia sdk/swagger" or similar, run "npx tsc" command to find the reason why.`,
|
|
8
|
+
].join(" "),
|
|
9
|
+
);
|
|
10
|
+
return undefined as never;
|
|
11
|
+
}
|
|
12
|
+
export namespace NoTransformConfigurationError {
|
|
13
|
+
/**
|
|
14
|
+
* Whether to throw an error or not.
|
|
15
|
+
*
|
|
16
|
+
* If you set this value to `false`, {@link NoTransformConfigurationError} will
|
|
17
|
+
* not throw an error.
|
|
18
|
+
*
|
|
19
|
+
* Even if you've not configured the plugin transformer of `tsconfig.json` file,
|
|
20
|
+
* the error will not be thrown and the program will be continued. Instead, every
|
|
21
|
+
* validations and assertions will be skipped and the value will be returned as it is.
|
|
22
|
+
* Furthermore, unexpected behaviors may occur.
|
|
23
|
+
*
|
|
24
|
+
* Therefore, it is not recommended to set this value to `false` in production
|
|
25
|
+
* environment. Configure this value to be `false` only when you're debugging or testing.
|
|
26
|
+
*
|
|
27
|
+
* By the way, if you hope the `false` value to be set, you have to do it before the first.
|
|
28
|
+
* If you configure the `false` value after the `@nestia/core` decorator functions are
|
|
29
|
+
* composed, the value will not be applied and the error will be thrown.
|
|
30
|
+
*/
|
|
31
|
+
export let throws = true;
|
|
32
|
+
}
|
|
@@ -87,7 +87,7 @@ export namespace TypedFormData {
|
|
|
87
87
|
return createParamDecorator(async function TypedFormDataBody(
|
|
88
88
|
_unknown: any,
|
|
89
89
|
context: ExecutionContext,
|
|
90
|
-
) {
|
|
90
|
+
): Promise<T> {
|
|
91
91
|
const http: HttpArgumentsHost = context.switchToHttp();
|
|
92
92
|
const request: express.Request = http.getRequest();
|
|
93
93
|
if (isMultipartFormData(request.headers["content-type"]) === false)
|
|
@@ -54,11 +54,10 @@ export function TypedHeaders<T extends object>(
|
|
|
54
54
|
return createParamDecorator(function TypedHeaders(
|
|
55
55
|
_unknown: any,
|
|
56
56
|
context: ExecutionContext,
|
|
57
|
-
) {
|
|
57
|
+
): T {
|
|
58
58
|
const request: express.Request | FastifyRequest = context
|
|
59
59
|
.switchToHttp()
|
|
60
60
|
.getRequest();
|
|
61
|
-
|
|
62
61
|
const output: T | Error = checker(request.headers);
|
|
63
62
|
if (output instanceof Error) throw output;
|
|
64
63
|
return output;
|
|
@@ -7,7 +7,7 @@ import type express from "express";
|
|
|
7
7
|
import type { FastifyRequest } from "fastify";
|
|
8
8
|
import typia, { TypeGuardError } from "typia";
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { NoTransformConfigurationError } from "./NoTransformConfigurationError";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Type safe URL parameter decorator.
|
|
@@ -36,7 +36,10 @@ export function TypedParam<T extends boolean | bigint | number | string | null>(
|
|
|
36
36
|
name: string,
|
|
37
37
|
assert?: (value: string) => T,
|
|
38
38
|
): ParameterDecorator {
|
|
39
|
-
if (assert === undefined)
|
|
39
|
+
if (assert === undefined) {
|
|
40
|
+
NoTransformConfigurationError("TypedParam");
|
|
41
|
+
assert = (value) => value as T;
|
|
42
|
+
}
|
|
40
43
|
|
|
41
44
|
return createParamDecorator(function TypedParam(
|
|
42
45
|
{}: any,
|
|
@@ -2,8 +2,8 @@ import typia from "typia";
|
|
|
2
2
|
|
|
3
3
|
import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
|
|
4
4
|
import { IRequestQueryValidator } from "../options/IRequestQueryValidator";
|
|
5
|
+
import { NoTransformConfigurationError } from "./NoTransformConfigurationError";
|
|
5
6
|
import { IWebSocketRouteReflect } from "./internal/IWebSocketRouteReflect";
|
|
6
|
-
import { NoTransformConfigureError } from "./internal/NoTransformConfigureError";
|
|
7
7
|
import { validate_request_body } from "./internal/validate_request_body";
|
|
8
8
|
import { validate_request_query } from "./internal/validate_request_query";
|
|
9
9
|
|
|
@@ -166,8 +166,10 @@ export namespace WebSocketRoute {
|
|
|
166
166
|
field: string,
|
|
167
167
|
assert?: (value: string) => T,
|
|
168
168
|
): ParameterDecorator {
|
|
169
|
-
if (assert === undefined)
|
|
170
|
-
|
|
169
|
+
if (assert === undefined) {
|
|
170
|
+
NoTransformConfigurationError("WebSocketRoute.Param");
|
|
171
|
+
assert = (value) => value as T;
|
|
172
|
+
}
|
|
171
173
|
return function WebSocketParam(
|
|
172
174
|
target: Object,
|
|
173
175
|
propertyKey: string | symbol | undefined,
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
throw new Error(
|
|
4
|
-
[
|
|
5
|
-
`Error on nestia.core.${method}(): no transform has been configured.`,
|
|
6
|
-
`Run "npx typia setup" command, or check if you're using non-standard TypeScript compiler like Babel or SWC.`,
|
|
7
|
-
`Otherwise you're running "npx nestia sdk/swagger" or similar, run "npx tsc" command to find the reason why.`,
|
|
8
|
-
].join(" "),
|
|
9
|
-
);
|
|
10
|
-
return undefined as never;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export namespace NoTransformConfigureError {
|
|
17
|
-
export let throws = true;
|
|
18
|
-
}
|
|
1
|
+
// For very old legay versions
|
|
2
|
+
export { NoTransformConfigurationError as NoTransformConfigureError } from "../NoTransformConfigurationError";
|
|
@@ -2,7 +2,7 @@ import { InternalServerErrorException } from "@nestjs/common";
|
|
|
2
2
|
import typia, { IValidation, TypeGuardError } from "typia";
|
|
3
3
|
|
|
4
4
|
import { IResponseBodyQuerifier } from "../../options/IResponseBodyQuerifier";
|
|
5
|
-
import {
|
|
5
|
+
import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -29,8 +29,10 @@ export const get_path_and_querify =
|
|
|
29
29
|
const take =
|
|
30
30
|
(method: string) =>
|
|
31
31
|
<T>(functor?: IResponseBodyQuerifier<T> | null) => {
|
|
32
|
-
if (functor === undefined)
|
|
33
|
-
|
|
32
|
+
if (functor === undefined) {
|
|
33
|
+
NoTransformConfigurationError(method);
|
|
34
|
+
return querify;
|
|
35
|
+
} else if (functor === null) return querify;
|
|
34
36
|
else if (functor.type === "stringify") return functor.stringify;
|
|
35
37
|
else if (functor.type === "assert") return assert(functor.assert);
|
|
36
38
|
else if (functor.type === "is") return is(functor.is);
|
|
@@ -2,7 +2,7 @@ import { InternalServerErrorException } from "@nestjs/common";
|
|
|
2
2
|
import typia, { IValidation, TypeGuardError } from "typia";
|
|
3
3
|
|
|
4
4
|
import { IResponseBodyStringifier } from "../../options/IResponseBodyStringifier";
|
|
5
|
-
import {
|
|
5
|
+
import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -27,8 +27,10 @@ export const get_path_and_stringify =
|
|
|
27
27
|
const take =
|
|
28
28
|
(method: string) =>
|
|
29
29
|
<T>(functor?: IResponseBodyStringifier<T> | null) => {
|
|
30
|
-
if (functor === undefined)
|
|
31
|
-
|
|
30
|
+
if (functor === undefined) {
|
|
31
|
+
NoTransformConfigurationError(method);
|
|
32
|
+
return JSON.stringify;
|
|
33
|
+
} else if (functor === null) return JSON.stringify;
|
|
32
34
|
else if (functor.type === "stringify") return functor.stringify;
|
|
33
35
|
else if (functor.type === "assert") return assert(functor.assert);
|
|
34
36
|
else if (functor.type === "is") return is(functor.is);
|
|
@@ -2,16 +2,18 @@ import { BadRequestException } from "@nestjs/common";
|
|
|
2
2
|
import typia, { IValidation, TypeGuardError } from "typia";
|
|
3
3
|
|
|
4
4
|
import { IRequestBodyValidator } from "../../options/IRequestBodyValidator";
|
|
5
|
-
import {
|
|
5
|
+
import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export const validate_request_body =
|
|
11
11
|
(method: string) =>
|
|
12
|
-
<T>(validator?: IRequestBodyValidator<T>) => {
|
|
13
|
-
if (!validator)
|
|
14
|
-
|
|
12
|
+
<T>(validator?: IRequestBodyValidator<T>): ((input: T) => Error | null) => {
|
|
13
|
+
if (!validator) {
|
|
14
|
+
NoTransformConfigurationError(method);
|
|
15
|
+
return () => null;
|
|
16
|
+
} else if (validator.type === "assert") return assert(validator.assert);
|
|
15
17
|
else if (validator.type === "is") return is(validator.is);
|
|
16
18
|
else if (validator.type === "validate") return validate(validator.validate);
|
|
17
19
|
return () =>
|
|
@@ -2,16 +2,18 @@ import { BadRequestException } from "@nestjs/common";
|
|
|
2
2
|
import typia, { IValidation, TypeGuardError } from "typia";
|
|
3
3
|
|
|
4
4
|
import { IRequestFormDataProps } from "../../options/IRequestFormDataProps";
|
|
5
|
-
import {
|
|
5
|
+
import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export const validate_request_form_data = <T>(
|
|
11
11
|
props?: IRequestFormDataProps<T>,
|
|
12
|
-
) => {
|
|
13
|
-
if (!props)
|
|
14
|
-
|
|
12
|
+
): ((value: FormData) => T | Error) => {
|
|
13
|
+
if (!props) {
|
|
14
|
+
NoTransformConfigurationError("TypedFormData.Body");
|
|
15
|
+
return (input: FormData) => Object.entries(input) as T;
|
|
16
|
+
} else if (props.validator.type === "assert")
|
|
15
17
|
return assert(props.validator.assert);
|
|
16
18
|
else if (props.validator.type === "is") return is(props.validator.is);
|
|
17
19
|
else if (props.validator.type === "validate")
|
|
@@ -2,16 +2,19 @@ import { BadRequestException } from "@nestjs/common";
|
|
|
2
2
|
import typia, { IValidation, TypeGuardError } from "typia";
|
|
3
3
|
|
|
4
4
|
import { IRequestHeadersValidator } from "../../options/IRequestHeadersValidator";
|
|
5
|
-
import {
|
|
5
|
+
import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export const validate_request_headers = <T>(
|
|
11
11
|
validator?: IRequestHeadersValidator<T>,
|
|
12
|
-
) => {
|
|
13
|
-
if (!validator)
|
|
14
|
-
|
|
12
|
+
): ((input: Record<string, string | string[] | undefined>) => T | Error) => {
|
|
13
|
+
if (!validator) {
|
|
14
|
+
NoTransformConfigurationError("TypedHeaders");
|
|
15
|
+
return (input: Record<string, string | string[] | undefined>) =>
|
|
16
|
+
Object.entries(input) as T;
|
|
17
|
+
} else if (validator.type === "assert") return assert(validator.assert);
|
|
15
18
|
else if (validator.type === "is") return is(validator.is);
|
|
16
19
|
else if (validator.type === "validate") return validate(validator.validate);
|
|
17
20
|
return () =>
|
|
@@ -2,7 +2,7 @@ import { BadRequestException } from "@nestjs/common";
|
|
|
2
2
|
import typia, { IValidation, TypeGuardError } from "typia";
|
|
3
3
|
|
|
4
4
|
import { IRequestQueryValidator } from "../../options/IRequestQueryValidator";
|
|
5
|
-
import {
|
|
5
|
+
import { NoTransformConfigurationError } from "../NoTransformConfigurationError";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -10,8 +10,11 @@ import { NoTransformConfigureError } from "./NoTransformConfigureError";
|
|
|
10
10
|
export const validate_request_query =
|
|
11
11
|
(method: string) =>
|
|
12
12
|
<T>(validator?: IRequestQueryValidator<T>) => {
|
|
13
|
-
if (!validator)
|
|
14
|
-
|
|
13
|
+
if (!validator) {
|
|
14
|
+
NoTransformConfigurationError(method);
|
|
15
|
+
return (input: URLSearchParams) =>
|
|
16
|
+
Object.fromEntries(input.entries()) as T;
|
|
17
|
+
} else if (validator.type === "assert") return assert(validator.assert);
|
|
15
18
|
else if (validator.type === "is") return is(validator.is);
|
|
16
19
|
else if (validator.type === "validate") return validate(validator.validate);
|
|
17
20
|
return () =>
|