@nestia/core 7.3.1 → 7.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/decorators/DynamicModule.d.ts +3 -2
- package/lib/decorators/DynamicModule.js +3 -2
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.d.ts +11 -11
- package/lib/decorators/EncryptedBody.js +13 -17
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.d.ts +15 -13
- package/lib/decorators/EncryptedController.js +15 -13
- package/lib/decorators/EncryptedController.js.map +1 -1
- package/lib/decorators/EncryptedModule.d.ts +22 -22
- package/lib/decorators/EncryptedModule.js +23 -25
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +20 -20
- package/lib/decorators/EncryptedRoute.js +23 -29
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.d.ts +3 -3
- package/lib/decorators/HumanRoute.js +3 -3
- package/lib/decorators/NoTransformConfigurationError.d.ts +10 -8
- package/lib/decorators/NoTransformConfigurationError.js +10 -8
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
- package/lib/decorators/PlainBody.d.ts +7 -6
- package/lib/decorators/PlainBody.js +2 -6
- package/lib/decorators/PlainBody.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.d.ts +12 -30
- package/lib/decorators/SwaggerCustomizer.js +3 -3
- package/lib/decorators/TypedBody.d.ts +7 -7
- package/lib/decorators/TypedBody.js +8 -10
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedException.d.ts +41 -58
- package/lib/decorators/TypedException.js +1 -3
- package/lib/decorators/TypedException.js.map +1 -1
- package/lib/decorators/TypedFormData.d.ts +16 -16
- package/lib/decorators/TypedFormData.js +17 -23
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedHeaders.d.ts +27 -25
- package/lib/decorators/TypedHeaders.js +27 -25
- package/lib/decorators/TypedHeaders.js.map +1 -1
- package/lib/decorators/TypedParam.d.ts +5 -5
- package/lib/decorators/TypedParam.js +5 -5
- package/lib/decorators/TypedQuery.d.ts +7 -6
- package/lib/decorators/TypedQuery.js +13 -24
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +24 -34
- package/lib/decorators/TypedRoute.js +19 -28
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/WebSocketRoute.d.ts +33 -31
- package/lib/decorators/WebSocketRoute.js +34 -34
- package/lib/decorators/WebSocketRoute.js.map +1 -1
- package/lib/decorators/internal/EncryptedConstant.js +1 -3
- package/lib/decorators/internal/EncryptedConstant.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.js +7 -21
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +6 -18
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/get_text_body.js +2 -6
- package/lib/decorators/internal/get_text_body.js.map +1 -1
- package/lib/decorators/internal/headers_to_object.js +1 -3
- package/lib/decorators/internal/headers_to_object.js.map +1 -1
- package/lib/decorators/internal/is_request_body_undefined.js +1 -3
- package/lib/decorators/internal/is_request_body_undefined.js.map +1 -1
- package/lib/decorators/internal/load_controller.js +3 -7
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/route_error.js +1 -3
- package/lib/decorators/internal/route_error.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +5 -15
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +5 -15
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +5 -15
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +5 -15
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/utils/ExceptionManager.d.ts +27 -20
- package/lib/utils/ExceptionManager.js +20 -20
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/Singleton.js +2 -6
- package/lib/utils/Singleton.js.map +1 -1
- package/package.json +6 -6
- package/src/decorators/DynamicModule.ts +3 -2
- package/src/decorators/EncryptedBody.ts +13 -17
- package/src/decorators/EncryptedController.ts +15 -13
- package/src/decorators/EncryptedModule.ts +23 -25
- package/src/decorators/EncryptedRoute.ts +23 -29
- package/src/decorators/HumanRoute.ts +3 -3
- package/src/decorators/NoTransformConfigurationError.ts +10 -8
- package/src/decorators/PlainBody.ts +9 -12
- package/src/decorators/SwaggerCustomizer.ts +12 -30
- package/src/decorators/TypedBody.ts +8 -10
- package/src/decorators/TypedException.ts +42 -61
- package/src/decorators/TypedFormData.ts +34 -34
- package/src/decorators/TypedHeaders.ts +27 -25
- package/src/decorators/TypedParam.ts +5 -5
- package/src/decorators/TypedQuery.ts +13 -24
- package/src/decorators/TypedRoute.ts +28 -46
- package/src/decorators/WebSocketRoute.ts +34 -34
- package/src/decorators/internal/EncryptedConstant.ts +1 -3
- package/src/decorators/internal/get_path_and_querify.ts +7 -21
- package/src/decorators/internal/get_path_and_stringify.ts +6 -18
- package/src/decorators/internal/get_text_body.ts +2 -6
- package/src/decorators/internal/headers_to_object.ts +1 -3
- package/src/decorators/internal/is_request_body_undefined.ts +1 -3
- package/src/decorators/internal/load_controller.ts +3 -7
- package/src/decorators/internal/route_error.ts +1 -3
- package/src/decorators/internal/validate_request_body.ts +5 -15
- package/src/decorators/internal/validate_request_form_data.ts +5 -15
- package/src/decorators/internal/validate_request_headers.ts +5 -15
- package/src/decorators/internal/validate_request_query.ts +5 -15
- package/src/utils/ExceptionManager.ts +29 -26
- package/src/utils/Singleton.ts +2 -6
|
@@ -7,9 +7,7 @@ exports.validate_request_body = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
10
|
+
/** @internal */
|
|
13
11
|
const validate_request_body = (method) => (validator) => {
|
|
14
12
|
if (!validator) {
|
|
15
13
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
@@ -24,9 +22,7 @@ const validate_request_body = (method) => (validator) => {
|
|
|
24
22
|
return () => new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
|
|
25
23
|
};
|
|
26
24
|
exports.validate_request_body = validate_request_body;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
25
|
+
/** @internal */
|
|
30
26
|
const assert = (closure) => (input) => {
|
|
31
27
|
try {
|
|
32
28
|
closure(input);
|
|
@@ -45,16 +41,12 @@ const assert = (closure) => (input) => {
|
|
|
45
41
|
throw exp;
|
|
46
42
|
}
|
|
47
43
|
};
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
44
|
+
/** @internal */
|
|
51
45
|
const is = (closure) => (input) => {
|
|
52
46
|
const success = closure(input);
|
|
53
47
|
return success ? null : new common_1.BadRequestException(MESSAGE);
|
|
54
48
|
};
|
|
55
|
-
/**
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
49
|
+
/** @internal */
|
|
58
50
|
const validate = (closure) => (input) => {
|
|
59
51
|
const result = closure(input);
|
|
60
52
|
return result.success
|
|
@@ -64,8 +56,6 @@ const validate = (closure) => (input) => {
|
|
|
64
56
|
message: MESSAGE,
|
|
65
57
|
});
|
|
66
58
|
};
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
59
|
+
/** @internal */
|
|
70
60
|
const MESSAGE = "Request body data is not following the promised type.";
|
|
71
61
|
//# sourceMappingURL=validate_request_body.js.map
|
|
@@ -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,oFAAiF;AAEjF
|
|
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,gBAAgB;AACT,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,gBAAgB;AAChB,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,6YAA6B,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,gBAAgB;AAChB,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,gBAAgB;AAChB,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,gBAAgB;AAChB,MAAM,OAAO,GAAG,uDAAuD,CAAC"}
|
|
@@ -7,9 +7,7 @@ exports.validate_request_form_data = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
10
|
+
/** @internal */
|
|
13
11
|
const validate_request_form_data = (props) => {
|
|
14
12
|
if (!props) {
|
|
15
13
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedFormData.Body");
|
|
@@ -24,9 +22,7 @@ const validate_request_form_data = (props) => {
|
|
|
24
22
|
return () => new Error(`Error on nestia.core.TypedFormData.Body(): invalid typed validator.`);
|
|
25
23
|
};
|
|
26
24
|
exports.validate_request_form_data = validate_request_form_data;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
25
|
+
/** @internal */
|
|
30
26
|
const assert = (closure) => (input) => {
|
|
31
27
|
try {
|
|
32
28
|
return closure(input);
|
|
@@ -44,16 +40,12 @@ const assert = (closure) => (input) => {
|
|
|
44
40
|
throw exp;
|
|
45
41
|
}
|
|
46
42
|
};
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
43
|
+
/** @internal */
|
|
50
44
|
const is = (closure) => (input) => {
|
|
51
45
|
const result = closure(input);
|
|
52
46
|
return result !== null ? result : new common_1.BadRequestException(MESSAGE);
|
|
53
47
|
};
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
48
|
+
/** @internal */
|
|
57
49
|
const validate = (closure) => (input) => {
|
|
58
50
|
const result = closure(input);
|
|
59
51
|
return result.success
|
|
@@ -63,8 +55,6 @@ const validate = (closure) => (input) => {
|
|
|
63
55
|
message: MESSAGE,
|
|
64
56
|
});
|
|
65
57
|
};
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
58
|
+
/** @internal */
|
|
69
59
|
const MESSAGE = "Request multipart data is not following the promised type.";
|
|
70
60
|
//# sourceMappingURL=validate_request_form_data.js.map
|
|
@@ -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,oFAAiF;AAEjF
|
|
1
|
+
{"version":3,"file":"validate_request_form_data.js","sourceRoot":"","sources":["../../../src/decorators/internal/validate_request_form_data.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AACrD,kDAA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Z,CAAC;AACH,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,EAAE,GACN,CAAI,OAAsC,EAAE,EAAE,CAC9C,CAAC,KAAe,EAA2B,EAAE;IAC3C,MAAM,MAAM,GAAa,OAAO,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,4BAAmB,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,QAAQ,GACZ,CAAI,OAA4C,EAAE,EAAE,CACpD,CAAC,KAAe,EAA2B,EAAE;IAC3C,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,gBAAgB;AAChB,MAAM,OAAO,GAAG,4DAA4D,CAAC"}
|
|
@@ -7,9 +7,7 @@ exports.validate_request_headers = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
10
|
+
/** @internal */
|
|
13
11
|
const validate_request_headers = (validator) => {
|
|
14
12
|
if (!validator) {
|
|
15
13
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)("TypedHeaders");
|
|
@@ -24,9 +22,7 @@ const validate_request_headers = (validator) => {
|
|
|
24
22
|
return () => new Error(`Error on nestia.core.TypedHeaders(): invalid typed validator.`);
|
|
25
23
|
};
|
|
26
24
|
exports.validate_request_headers = validate_request_headers;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
25
|
+
/** @internal */
|
|
30
26
|
const assert = (closure) => (input) => {
|
|
31
27
|
try {
|
|
32
28
|
return closure(input);
|
|
@@ -44,16 +40,12 @@ const assert = (closure) => (input) => {
|
|
|
44
40
|
throw exp;
|
|
45
41
|
}
|
|
46
42
|
};
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
43
|
+
/** @internal */
|
|
50
44
|
const is = (closure) => (input) => {
|
|
51
45
|
const result = closure(input);
|
|
52
46
|
return result !== null ? result : new common_1.BadRequestException(MESSAGE);
|
|
53
47
|
};
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
48
|
+
/** @internal */
|
|
57
49
|
const validate = (closure) => (input) => {
|
|
58
50
|
const result = closure(input);
|
|
59
51
|
return result.success
|
|
@@ -63,8 +55,6 @@ const validate = (closure) => (input) => {
|
|
|
63
55
|
message: MESSAGE,
|
|
64
56
|
});
|
|
65
57
|
};
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
58
|
+
/** @internal */
|
|
69
59
|
const MESSAGE = "Request headers data is not following the promised type.";
|
|
70
60
|
//# sourceMappingURL=validate_request_headers.js.map
|
|
@@ -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,oFAAiF;AAEjF
|
|
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,gBAAgB;AACT,MAAM,wBAAwB,GAAG,CACtC,SAAuC,EACgC,EAAE;IACzE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,IAAA,6DAA6B,EAAC,cA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AAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,4BAAmB,CAAC,OAAO,CAAC,CAAC;AACrE,CAAC,CAAC;AAEJ,gBAAgB;AAChB,MAAM,QAAQ,GACZ,CACE,OAEmB,EACnB,EAAE,CACJ,CACE,KAAoD,EAC3B,EAAE;IAC3B,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,gBAAgB;AAChB,MAAM,OAAO,GAAG,0DAA0D,CAAC"}
|
|
@@ -7,9 +7,7 @@ exports.validate_request_query = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const typia_1 = __importDefault(require("typia"));
|
|
9
9
|
const NoTransformConfigurationError_1 = require("../NoTransformConfigurationError");
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
10
|
+
/** @internal */
|
|
13
11
|
const validate_request_query = (method) => (validator) => {
|
|
14
12
|
if (!validator) {
|
|
15
13
|
(0, NoTransformConfigurationError_1.NoTransformConfigurationError)(method);
|
|
@@ -24,9 +22,7 @@ const validate_request_query = (method) => (validator) => {
|
|
|
24
22
|
return () => new Error(`Error on nestia.core.${method}(): invalid typed validator.`);
|
|
25
23
|
};
|
|
26
24
|
exports.validate_request_query = validate_request_query;
|
|
27
|
-
/**
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
25
|
+
/** @internal */
|
|
30
26
|
const assert = (closure) => (input) => {
|
|
31
27
|
try {
|
|
32
28
|
return closure(input);
|
|
@@ -44,16 +40,12 @@ const assert = (closure) => (input) => {
|
|
|
44
40
|
throw exp;
|
|
45
41
|
}
|
|
46
42
|
};
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
43
|
+
/** @internal */
|
|
50
44
|
const is = (closure) => (input) => {
|
|
51
45
|
const result = closure(input);
|
|
52
46
|
return result !== null ? result : new common_1.BadRequestException(MESSAGE);
|
|
53
47
|
};
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
48
|
+
/** @internal */
|
|
57
49
|
const validate = (closure) => (input) => {
|
|
58
50
|
const result = closure(input);
|
|
59
51
|
return result.success
|
|
@@ -63,8 +55,6 @@ const validate = (closure) => (input) => {
|
|
|
63
55
|
message: MESSAGE,
|
|
64
56
|
});
|
|
65
57
|
};
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
58
|
+
/** @internal */
|
|
69
59
|
const MESSAGE = "Request query data is not following the promised type.";
|
|
70
60
|
//# sourceMappingURL=validate_request_query.js.map
|
|
@@ -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,oFAAiF;AAEjF
|
|
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,gBAAgB;AACT,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,CAAM,CAAC;IAC7C,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,S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,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,gBAAgB;AAChB,MAAM,OAAO,GAAG,wDAAwD,CAAC"}
|
|
@@ -3,24 +3,27 @@ import { Creator } from "../typings/Creator";
|
|
|
3
3
|
/**
|
|
4
4
|
* Exception manager for HTTP server.
|
|
5
5
|
*
|
|
6
|
-
* `ExceptionManager` is an utility class who can insert or erase custom error
|
|
7
|
-
* its conversion method to a regular {@link nest.HttpException}
|
|
6
|
+
* `ExceptionManager` is an utility class who can insert or erase custom error
|
|
7
|
+
* class with its conversion method to a regular {@link nest.HttpException}
|
|
8
|
+
* instance.
|
|
8
9
|
*
|
|
9
|
-
* If you define an API function through {@link TypedRoute} or
|
|
10
|
-
* instead of the basic router decorator functions like
|
|
11
|
-
* {@link nest.Post} and the API function throws a custom
|
|
12
|
-
* {@link ExceptionManager.insert inserted} in this
|
|
13
|
-
* automatically converted to the regular
|
|
14
|
-
* {@link ExceptionManager.Closure}
|
|
10
|
+
* If you define an API function through {@link TypedRoute} or
|
|
11
|
+
* {@link EncryptedRoute} instead of the basic router decorator functions like
|
|
12
|
+
* {@link nest.Get} or {@link nest.Post} and the API function throws a custom
|
|
13
|
+
* error whose class has been {@link ExceptionManager.insert inserted} in this
|
|
14
|
+
* `EntityManager`, the error would be automatically converted to the regular
|
|
15
|
+
* {@link nest.HttpException} instance by the {@link ExceptionManager.Closure}
|
|
16
|
+
* function.
|
|
15
17
|
*
|
|
16
|
-
* Therefore, with this `ExceptionManager` and {@link TypedRoute} or
|
|
17
|
-
* you can manage your custom error classes much
|
|
18
|
-
*
|
|
18
|
+
* Therefore, with this `ExceptionManager` and {@link TypedRoute} or
|
|
19
|
+
* {@link EncryptedRoute}, you can manage your custom error classes much
|
|
20
|
+
* systemtically. You can avoid 500 internal server error or hard coding
|
|
21
|
+
* implementation about the custom error classes.
|
|
19
22
|
*
|
|
20
23
|
* Below error classes are defaultly configured in this `ExceptionManager`
|
|
21
24
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* - `typia.TypeGuardError`
|
|
26
|
+
* - `@nestia/fetcher.HttpError`
|
|
24
27
|
*
|
|
25
28
|
* @author Jeongho Nam - https://github.com/samchon
|
|
26
29
|
*/
|
|
@@ -28,7 +31,8 @@ export declare namespace ExceptionManager {
|
|
|
28
31
|
/**
|
|
29
32
|
* Insert an error class with converter.
|
|
30
33
|
*
|
|
31
|
-
* If you've inserted an duplicated error class, the closure would be
|
|
34
|
+
* If you've inserted an duplicated error class, the closure would be
|
|
35
|
+
* overwritten.
|
|
32
36
|
*
|
|
33
37
|
* @param creator Target error class
|
|
34
38
|
* @param closure A closure function converting to the `HttpException` class
|
|
@@ -44,20 +48,23 @@ export declare namespace ExceptionManager {
|
|
|
44
48
|
function on(closure: (error: any) => any): void;
|
|
45
49
|
function off(closure: (error: any) => any): void;
|
|
46
50
|
/**
|
|
47
|
-
* Type of a closure function converting to the regular
|
|
51
|
+
* Type of a closure function converting to the regular
|
|
52
|
+
* {@link nest.HttpException}.
|
|
48
53
|
*
|
|
49
|
-
* `ExceptionManager.Closure` is a type of closure function who are converting
|
|
50
|
-
* custom error to the regular {@link nest.HttpException} instance. It
|
|
51
|
-
* in the {@link ExceptionManager} with {@link TypedRoute} or
|
|
54
|
+
* `ExceptionManager.Closure` is a type of closure function who are converting
|
|
55
|
+
* from custom error to the regular {@link nest.HttpException} instance. It
|
|
56
|
+
* would be used in the {@link ExceptionManager} with {@link TypedRoute} or
|
|
57
|
+
* {@link EncryptedRoute}.
|
|
52
58
|
*/
|
|
53
59
|
interface Closure<T extends Error> {
|
|
54
60
|
/**
|
|
55
61
|
* Error converter.
|
|
56
62
|
*
|
|
57
|
-
* Convert from custom error to the regular {@link nest.HttpException}
|
|
63
|
+
* Convert from custom error to the regular {@link nest.HttpException}
|
|
64
|
+
* instance.
|
|
58
65
|
*
|
|
59
66
|
* @param exception Custom error instance
|
|
60
|
-
* @
|
|
67
|
+
* @returns Regular {@link nest.HttpException} instance
|
|
61
68
|
*/
|
|
62
69
|
(exception: T): HttpException;
|
|
63
70
|
}
|
|
@@ -6,24 +6,27 @@ const common_1 = require("@nestjs/common");
|
|
|
6
6
|
/**
|
|
7
7
|
* Exception manager for HTTP server.
|
|
8
8
|
*
|
|
9
|
-
* `ExceptionManager` is an utility class who can insert or erase custom error
|
|
10
|
-
* its conversion method to a regular {@link nest.HttpException}
|
|
9
|
+
* `ExceptionManager` is an utility class who can insert or erase custom error
|
|
10
|
+
* class with its conversion method to a regular {@link nest.HttpException}
|
|
11
|
+
* instance.
|
|
11
12
|
*
|
|
12
|
-
* If you define an API function through {@link TypedRoute} or
|
|
13
|
-
* instead of the basic router decorator functions like
|
|
14
|
-
* {@link nest.Post} and the API function throws a custom
|
|
15
|
-
* {@link ExceptionManager.insert inserted} in this
|
|
16
|
-
* automatically converted to the regular
|
|
17
|
-
* {@link ExceptionManager.Closure}
|
|
13
|
+
* If you define an API function through {@link TypedRoute} or
|
|
14
|
+
* {@link EncryptedRoute} instead of the basic router decorator functions like
|
|
15
|
+
* {@link nest.Get} or {@link nest.Post} and the API function throws a custom
|
|
16
|
+
* error whose class has been {@link ExceptionManager.insert inserted} in this
|
|
17
|
+
* `EntityManager`, the error would be automatically converted to the regular
|
|
18
|
+
* {@link nest.HttpException} instance by the {@link ExceptionManager.Closure}
|
|
19
|
+
* function.
|
|
18
20
|
*
|
|
19
|
-
* Therefore, with this `ExceptionManager` and {@link TypedRoute} or
|
|
20
|
-
* you can manage your custom error classes much
|
|
21
|
-
*
|
|
21
|
+
* Therefore, with this `ExceptionManager` and {@link TypedRoute} or
|
|
22
|
+
* {@link EncryptedRoute}, you can manage your custom error classes much
|
|
23
|
+
* systemtically. You can avoid 500 internal server error or hard coding
|
|
24
|
+
* implementation about the custom error classes.
|
|
22
25
|
*
|
|
23
26
|
* Below error classes are defaultly configured in this `ExceptionManager`
|
|
24
27
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* - `typia.TypeGuardError`
|
|
29
|
+
* - `@nestia/fetcher.HttpError`
|
|
27
30
|
*
|
|
28
31
|
* @author Jeongho Nam - https://github.com/samchon
|
|
29
32
|
*/
|
|
@@ -32,7 +35,8 @@ var ExceptionManager;
|
|
|
32
35
|
/**
|
|
33
36
|
* Insert an error class with converter.
|
|
34
37
|
*
|
|
35
|
-
* If you've inserted an duplicated error class, the closure would be
|
|
38
|
+
* If you've inserted an duplicated error class, the closure would be
|
|
39
|
+
* overwritten.
|
|
36
40
|
*
|
|
37
41
|
* @param creator Target error class
|
|
38
42
|
* @param closure A closure function converting to the `HttpException` class
|
|
@@ -67,13 +71,9 @@ var ExceptionManager;
|
|
|
67
71
|
ExceptionManager.listeners.delete(closure);
|
|
68
72
|
}
|
|
69
73
|
ExceptionManager.off = off;
|
|
70
|
-
/**
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
74
|
+
/** @internal */
|
|
73
75
|
ExceptionManager.tuples = [];
|
|
74
|
-
/**
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
76
|
+
/** @internal */
|
|
77
77
|
ExceptionManager.listeners = new Set();
|
|
78
78
|
})(ExceptionManager || (exports.ExceptionManager = ExceptionManager = {}));
|
|
79
79
|
ExceptionManager.insert(fetcher_1.HttpError, (error) => new common_1.HttpException({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExceptionManager.js","sourceRoot":"","sources":["../../src/utils/ExceptionManager.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAC5C,2CAA+C;AAI/C
|
|
1
|
+
{"version":3,"file":"ExceptionManager.js","sourceRoot":"","sources":["../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AC,OAAO,CAAC,CAAC;IACzB,CAAC;IAFe,mBAAE,KAEjB,CAAA;IAED,SAAgB,GAAG,CAAC,OAA4B;QAC9C,iBAAA,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAFe,oBAAG,MAElB,CAAA;IAwBD,gBAAgB;IACH,uBAAM,GAAwC,EAAE,CAAC;IAE9D,gBAAgB;IACH,0BAAS,GAA6B,IAAI,GAAG,EAAE,CAAC;AAC/D,CAAC,EAtEgB,gBAAgB,gCAAhB,gBAAgB,QAsEhC;AAED,gBAAgB,CAAC,MAAM,CACrB,mBAAS,EACT,CAAC,KAAK,EAAE,EAAE,CACR,IAAI,sBAAa,CACf;IACE,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,OAAO,EAAE,KAAK,CAAC,OAAO;CACvB,EACD,KAAK,CAAC,MAAM,CACb,CACJ,CAAC"}
|
package/lib/utils/Singleton.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Singleton = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
4
|
+
/** @internal */
|
|
7
5
|
class Singleton {
|
|
8
6
|
constructor(closure_) {
|
|
9
7
|
this.closure_ = closure_;
|
|
@@ -16,8 +14,6 @@ class Singleton {
|
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
exports.Singleton = Singleton;
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
17
|
+
/** @internal */
|
|
22
18
|
const NOT_MOUNTED_YET = {};
|
|
23
19
|
//# sourceMappingURL=Singleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Singleton.js","sourceRoot":"","sources":["../../src/utils/Singleton.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"Singleton.js","sourceRoot":"","sources":["../../src/utils/Singleton.ts"],"names":[],"mappings":";;;AAAA,gBAAgB;AAChB,MAAa,SAAS;IAGpB,YAAoC,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;QACnD,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;IAChC,CAAC;IAEM,GAAG;QACR,IAAI,IAAI,CAAC,MAAM,KAAK,eAAe;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC,MAAW,CAAC;IAC1B,CAAC;CACF;AAXD,8BAWC;AAED,gBAAgB;AAChB,MAAM,eAAe,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.3",
|
|
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": "^7.3.
|
|
39
|
+
"@nestia/fetcher": "^7.3.3",
|
|
40
40
|
"@nestjs/common": ">=7.0.1",
|
|
41
41
|
"@nestjs/core": ">=7.0.1",
|
|
42
42
|
"@samchon/openapi": "^4.5.0",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"reflect-metadata": ">=0.1.12",
|
|
49
49
|
"rxjs": ">=6.0.3",
|
|
50
50
|
"tgrid": "^1.1.0",
|
|
51
|
-
"typia": "^9.
|
|
51
|
+
"typia": "^9.6.1",
|
|
52
52
|
"ws": "^7.5.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@nestia/fetcher": ">=7.3.
|
|
55
|
+
"@nestia/fetcher": ">=7.3.3",
|
|
56
56
|
"@nestjs/common": ">=7.0.1",
|
|
57
57
|
"@nestjs/core": ">=7.0.1",
|
|
58
58
|
"@samchon/openapi": ">=4.5.0 <5.0.0",
|
|
59
59
|
"reflect-metadata": ">=0.1.12",
|
|
60
60
|
"rxjs": ">=6.0.3",
|
|
61
|
-
"typia": "
|
|
61
|
+
"typia": "^9.6.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@nestjs/common": "^11.0.13",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ts-node": "^10.9.1",
|
|
81
81
|
"ts-patch": "^3.3.0",
|
|
82
82
|
"tstl": "^3.0.0",
|
|
83
|
-
"typescript": "~5.
|
|
83
|
+
"typescript": "~5.9.2"
|
|
84
84
|
},
|
|
85
85
|
"files": [
|
|
86
86
|
"README.md",
|
|
@@ -18,11 +18,12 @@ export namespace DynamicModule {
|
|
|
18
18
|
*
|
|
19
19
|
* Constructs a module instance with directory path of controller classes.
|
|
20
20
|
*
|
|
21
|
-
* Every controller classes in the target directory would be dynamically
|
|
21
|
+
* Every controller classes in the target directory would be dynamically
|
|
22
|
+
* mounted.
|
|
22
23
|
*
|
|
23
24
|
* @param path Path of controllers
|
|
24
25
|
* @param metadata Additional metadata except controllers
|
|
25
|
-
* @returns
|
|
26
|
+
* @returns Module instance
|
|
26
27
|
*/
|
|
27
28
|
export async function mount(
|
|
28
29
|
path: string | string[] | { include: string[]; exclude?: string[] },
|
|
@@ -18,23 +18,23 @@ import { validate_request_body } from "./internal/validate_request_body";
|
|
|
18
18
|
/**
|
|
19
19
|
* Encrypted body decorator.
|
|
20
20
|
*
|
|
21
|
-
* `EncryptedBody` is a decorator function getting `application/json` typed data
|
|
22
|
-
* request body which has been encrypted by AES-128/256 algorithm. Also,
|
|
21
|
+
* `EncryptedBody` is a decorator function getting `application/json` typed data
|
|
22
|
+
* from request body which has been encrypted by AES-128/256 algorithm. Also,
|
|
23
23
|
* `EncryptedBody` validates the request body data type through
|
|
24
|
-
* [typia](https://github.com/samchon/typia) ad the validation speed is
|
|
25
|
-
*
|
|
24
|
+
* [typia](https://github.com/samchon/typia) ad the validation speed is maximum
|
|
25
|
+
* 15,000x times faster than `class-validator`.
|
|
26
26
|
*
|
|
27
|
-
* For reference, when the request body data is not following the promised type
|
|
28
|
-
* `BadRequestException` error (status code: 400) would be thrown. Also,
|
|
27
|
+
* For reference, when the request body data is not following the promised type
|
|
28
|
+
* `T`, `BadRequestException` error (status code: 400) would be thrown. Also,
|
|
29
29
|
* `EncryptedRoute` decrypts request body using those options.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* - AES-128/256
|
|
32
|
+
* - CBC mode
|
|
33
|
+
* - PKCS #5 Padding
|
|
34
|
+
* - Base64 Encoding
|
|
35
35
|
*
|
|
36
|
-
* @return Parameter decorator
|
|
37
36
|
* @author Jeongho Nam - https://github.com/samchon
|
|
37
|
+
* @returns Parameter decorator
|
|
38
38
|
*/
|
|
39
39
|
export function EncryptedBody<T>(
|
|
40
40
|
validator?: IRequestBodyValidator<T>,
|
|
@@ -75,9 +75,7 @@ export function EncryptedBody<T>(
|
|
|
75
75
|
})();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*/
|
|
78
|
+
/** @internal */
|
|
81
79
|
const decrypt = (body: string, key: string, iv: string): string => {
|
|
82
80
|
try {
|
|
83
81
|
return AesPkcs5.decrypt(body, key, iv);
|
|
@@ -90,9 +88,7 @@ const decrypt = (body: string, key: string, iv: string): string => {
|
|
|
90
88
|
}
|
|
91
89
|
};
|
|
92
90
|
|
|
93
|
-
/**
|
|
94
|
-
* @internal
|
|
95
|
-
*/
|
|
91
|
+
/** @internal */
|
|
96
92
|
const isTextPlain = (text?: string): boolean =>
|
|
97
93
|
text !== undefined &&
|
|
98
94
|
text
|
|
@@ -6,26 +6,28 @@ import { ENCRYPTION_METADATA_KEY } from "./internal/EncryptedConstant";
|
|
|
6
6
|
/**
|
|
7
7
|
* Encrypted controller.
|
|
8
8
|
*
|
|
9
|
-
* `EncryptedController` is an extension of the {@link nest.Controller} class
|
|
10
|
-
* function who configures encryption password of the AES-128/256
|
|
11
|
-
* encryption algorithm and password would be used by
|
|
12
|
-
* {@link EncryptedBody} to encrypt the request and
|
|
9
|
+
* `EncryptedController` is an extension of the {@link nest.Controller} class
|
|
10
|
+
* decorator function who configures encryption password of the AES-128/256
|
|
11
|
+
* algorithm. The encryption algorithm and password would be used by
|
|
12
|
+
* {@link EncryptedRoute} and {@link EncryptedBody} to encrypt the request and
|
|
13
|
+
* response body of the HTTP protocol.
|
|
13
14
|
*
|
|
14
|
-
* By the way, you can configure the encryption password in the global level by
|
|
15
|
-
* {@link EncryptedModule} instead of the {@link nest.Module} in the module
|
|
16
|
-
* that case, you don't need to use this `EncryptedController` more.
|
|
17
|
-
* {@link nest.Controller} without duplicated encryption password
|
|
15
|
+
* By the way, you can configure the encryption password in the global level by
|
|
16
|
+
* using {@link EncryptedModule} instead of the {@link nest.Module} in the module
|
|
17
|
+
* level. In that case, you don't need to use this `EncryptedController` more.
|
|
18
|
+
* Just use the {@link nest.Controller} without duplicated encryption password
|
|
19
|
+
* definitions.
|
|
18
20
|
*
|
|
19
21
|
* Of course, if you want to use different encryption password from the
|
|
20
|
-
* {@link EncryptedModule}, this `EncryptedController` would be useful again.
|
|
21
|
-
* I recommend to use this `EncryptedController` decorator function
|
|
22
|
-
* configure different encryption password from the
|
|
22
|
+
* {@link EncryptedModule}, this `EncryptedController` would be useful again.
|
|
23
|
+
* Therefore, I recommend to use this `EncryptedController` decorator function
|
|
24
|
+
* only when you must configure different encryption password from the
|
|
25
|
+
* {@link EncryptedModule}.
|
|
23
26
|
*
|
|
27
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
24
28
|
* @param path Path of the HTTP request
|
|
25
29
|
* @param password Encryption password or its getter function
|
|
26
30
|
* @returns Class decorator
|
|
27
|
-
*
|
|
28
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
29
31
|
*/
|
|
30
32
|
export function EncryptedController(
|
|
31
33
|
path: string,
|