@nestia/core 7.3.0 → 7.3.2
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/lib/utils/SourceFinder.js +4 -8
- package/lib/utils/SourceFinder.js.map +1 -1
- package/package.json +7 -8
- 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
- package/src/utils/SourceFinder.ts +5 -8
|
@@ -13,11 +13,12 @@ export declare namespace DynamicModule {
|
|
|
13
13
|
*
|
|
14
14
|
* Constructs a module instance with directory path of controller classes.
|
|
15
15
|
*
|
|
16
|
-
* Every controller classes in the target directory would be dynamically
|
|
16
|
+
* Every controller classes in the target directory would be dynamically
|
|
17
|
+
* mounted.
|
|
17
18
|
*
|
|
18
19
|
* @param path Path of controllers
|
|
19
20
|
* @param metadata Additional metadata except controllers
|
|
20
|
-
* @returns
|
|
21
|
+
* @returns Module instance
|
|
21
22
|
*/
|
|
22
23
|
function mount(path: string | string[] | {
|
|
23
24
|
include: string[];
|
|
@@ -33,11 +33,12 @@ var DynamicModule;
|
|
|
33
33
|
*
|
|
34
34
|
* Constructs a module instance with directory path of controller classes.
|
|
35
35
|
*
|
|
36
|
-
* Every controller classes in the target directory would be dynamically
|
|
36
|
+
* Every controller classes in the target directory would be dynamically
|
|
37
|
+
* mounted.
|
|
37
38
|
*
|
|
38
39
|
* @param path Path of controllers
|
|
39
40
|
* @param metadata Additional metadata except controllers
|
|
40
|
-
* @returns
|
|
41
|
+
* @returns Module instance
|
|
41
42
|
*/
|
|
42
43
|
function mount(path_1) {
|
|
43
44
|
return __awaiter(this, arguments, void 0, function* (path, metadata = {}, isTsNode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicModule.js","sourceRoot":"","sources":["../../src/decorators/DynamicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AAIxC,gEAA8D;AAE9D;;;;;;;GAOG;AACH,IAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"DynamicModule.js","sourceRoot":"","sources":["../../src/decorators/DynamicModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AAIxC,gEAA8D;AAE9D;;;;;;;GAOG;AACH,IAAiB,aAAa,CA6B7B;AA7BD,WAAiB,aAAa;IAC5B;;;;;;;;;;;OAWG;IACH,SAAsB,KAAK;6DACzB,IAAmE,EACnE,WAAgD,EAAE,EAClD,QAAkB;YAElB,mBAAmB;YACnB,MAAM,WAAW,GAAsB,MAAM,IAAA,kCAAgB,EAC3D,IAAI,EACJ,QAAQ,CACT,CAAC;YAEF,yBAAyB;YAEzB,IAAM,YAAY,GAAlB,MAAM,YAAY;aAAG,CAAA;YAAf,YAAY;gBADjB,IAAA,eAAM,kCAAM,QAAQ,KAAE,WAAW,IAAG;eAC/B,YAAY,CAAG;YACrB,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;IAfqB,mBAAK,QAe1B,CAAA;AACH,CAAC,EA7BgB,aAAa,6BAAb,aAAa,QA6B7B"}
|
|
@@ -2,22 +2,22 @@ import { IRequestBodyValidator } from "../options/IRequestBodyValidator";
|
|
|
2
2
|
/**
|
|
3
3
|
* Encrypted body decorator.
|
|
4
4
|
*
|
|
5
|
-
* `EncryptedBody` is a decorator function getting `application/json` typed data
|
|
6
|
-
* request body which has been encrypted by AES-128/256 algorithm. Also,
|
|
5
|
+
* `EncryptedBody` is a decorator function getting `application/json` typed data
|
|
6
|
+
* from request body which has been encrypted by AES-128/256 algorithm. Also,
|
|
7
7
|
* `EncryptedBody` validates the request body data type through
|
|
8
|
-
* [typia](https://github.com/samchon/typia) ad the validation speed is
|
|
9
|
-
*
|
|
8
|
+
* [typia](https://github.com/samchon/typia) ad the validation speed is maximum
|
|
9
|
+
* 15,000x times faster than `class-validator`.
|
|
10
10
|
*
|
|
11
|
-
* For reference, when the request body data is not following the promised type
|
|
12
|
-
* `BadRequestException` error (status code: 400) would be thrown. Also,
|
|
11
|
+
* For reference, when the request body data is not following the promised type
|
|
12
|
+
* `T`, `BadRequestException` error (status code: 400) would be thrown. Also,
|
|
13
13
|
* `EncryptedRoute` decrypts request body using those options.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* - AES-128/256
|
|
16
|
+
* - CBC mode
|
|
17
|
+
* - PKCS #5 Padding
|
|
18
|
+
* - Base64 Encoding
|
|
19
19
|
*
|
|
20
|
-
* @return Parameter decorator
|
|
21
20
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
|
+
* @returns Parameter decorator
|
|
22
22
|
*/
|
|
23
23
|
export declare function EncryptedBody<T>(validator?: IRequestBodyValidator<T>): ParameterDecorator;
|
|
@@ -20,23 +20,23 @@ const validate_request_body_1 = require("./internal/validate_request_body");
|
|
|
20
20
|
/**
|
|
21
21
|
* Encrypted body decorator.
|
|
22
22
|
*
|
|
23
|
-
* `EncryptedBody` is a decorator function getting `application/json` typed data
|
|
24
|
-
* request body which has been encrypted by AES-128/256 algorithm. Also,
|
|
23
|
+
* `EncryptedBody` is a decorator function getting `application/json` typed data
|
|
24
|
+
* from request body which has been encrypted by AES-128/256 algorithm. Also,
|
|
25
25
|
* `EncryptedBody` validates the request body data type through
|
|
26
|
-
* [typia](https://github.com/samchon/typia) ad the validation speed is
|
|
27
|
-
*
|
|
26
|
+
* [typia](https://github.com/samchon/typia) ad the validation speed is maximum
|
|
27
|
+
* 15,000x times faster than `class-validator`.
|
|
28
28
|
*
|
|
29
|
-
* For reference, when the request body data is not following the promised type
|
|
30
|
-
* `BadRequestException` error (status code: 400) would be thrown. Also,
|
|
29
|
+
* For reference, when the request body data is not following the promised type
|
|
30
|
+
* `T`, `BadRequestException` error (status code: 400) would be thrown. Also,
|
|
31
31
|
* `EncryptedRoute` decrypts request body using those options.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* - AES-128/256
|
|
34
|
+
* - CBC mode
|
|
35
|
+
* - PKCS #5 Padding
|
|
36
|
+
* - Base64 Encoding
|
|
37
37
|
*
|
|
38
|
-
* @return Parameter decorator
|
|
39
38
|
* @author Jeongho Nam - https://github.com/samchon
|
|
39
|
+
* @returns Parameter decorator
|
|
40
40
|
*/
|
|
41
41
|
function EncryptedBody(validator) {
|
|
42
42
|
const checker = (0, validate_request_body_1.validate_request_body)("EncryptedBody")(validator);
|
|
@@ -65,9 +65,7 @@ function EncryptedBody(validator) {
|
|
|
65
65
|
});
|
|
66
66
|
})();
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
68
|
+
/** @internal */
|
|
71
69
|
const decrypt = (body, key, iv) => {
|
|
72
70
|
try {
|
|
73
71
|
return AesPkcs5_1.AesPkcs5.decrypt(body, key, iv);
|
|
@@ -79,9 +77,7 @@ const decrypt = (body, key, iv) => {
|
|
|
79
77
|
throw exp;
|
|
80
78
|
}
|
|
81
79
|
};
|
|
82
|
-
/**
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
80
|
+
/** @internal */
|
|
85
81
|
const isTextPlain = (text) => text !== undefined &&
|
|
86
82
|
text
|
|
87
83
|
.split(";")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptedBody.js","sourceRoot":"","sources":["../../src/decorators/EncryptedBody.ts"],"names":[],"mappings":";;;;;;;;;;;AAsCA,sCAqCC;AA3ED,2DAAwD;AAExD,2CAIwB;AAKxB,kDAA+C;AAC/C,oEAAuE;AACvE,4DAAyD;AACzD,oEAAiE;AACjE,4EAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,aAAa,CAC3B,SAAoC;IAEpC,MAAM,OAAO,GAAG,IAAA,6CAAqB,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC;IAClE,OAAO,IAAA,6BAAoB,EAAC,SAAe,aAAa,CACtD,QAAa,EACb,OAAyB;;YAEzB,MAAM,OAAO,GAAqC,OAAO;iBACtD,YAAY,EAAE;iBACd,UAAU,EAAE,CAAC;YAChB,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,KAAK,KAAK;gBACxD,MAAM,IAAI,4BAAmB,CAAC,wCAAwC,CAAC,CAAC;YAE1E,MAAM,KAAK,GACT,OAAO,CAAC,WAAW,CAAC,2CAAuB,EAAE,OAAO,CAAC,QA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W,EAAE,EAAU,EAAU,EAAE;IAChE,IAAI,CAAC;QACH,OAAO,mBAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,KAAK;YACtB,MAAM,IAAI,4BAAmB,CAC3B,qFAAqF,CACtF,CAAC;;YACC,MAAM,GAAG,CAAC;IACjB,CAAC;AACH,CAAC,CAAC;AAEF,gBAAgB;AAChB,MAAM,WAAW,GAAG,CAAC,IAAa,EAAW,EAAE,CAC7C,IAAI,KAAK,SAAS;IAClB,IAAI;SACD,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;SACxB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,YAAY,CAAC,CAAC"}
|
|
@@ -2,25 +2,27 @@ import { IEncryptionPassword } from "@nestia/fetcher/lib/IEncryptionPassword";
|
|
|
2
2
|
/**
|
|
3
3
|
* Encrypted controller.
|
|
4
4
|
*
|
|
5
|
-
* `EncryptedController` is an extension of the {@link nest.Controller} class
|
|
6
|
-
* function who configures encryption password of the AES-128/256
|
|
7
|
-
* encryption algorithm and password would be used by
|
|
8
|
-
* {@link EncryptedBody} to encrypt the request and
|
|
5
|
+
* `EncryptedController` is an extension of the {@link nest.Controller} class
|
|
6
|
+
* decorator function who configures encryption password of the AES-128/256
|
|
7
|
+
* algorithm. The encryption algorithm and password would be used by
|
|
8
|
+
* {@link EncryptedRoute} and {@link EncryptedBody} to encrypt the request and
|
|
9
|
+
* response body of the HTTP protocol.
|
|
9
10
|
*
|
|
10
|
-
* By the way, you can configure the encryption password in the global level by
|
|
11
|
-
* {@link EncryptedModule} instead of the {@link nest.Module} in the module
|
|
12
|
-
* that case, you don't need to use this `EncryptedController` more.
|
|
13
|
-
* {@link nest.Controller} without duplicated encryption password
|
|
11
|
+
* By the way, you can configure the encryption password in the global level by
|
|
12
|
+
* using {@link EncryptedModule} instead of the {@link nest.Module} in the module
|
|
13
|
+
* level. In that case, you don't need to use this `EncryptedController` more.
|
|
14
|
+
* Just use the {@link nest.Controller} without duplicated encryption password
|
|
15
|
+
* definitions.
|
|
14
16
|
*
|
|
15
17
|
* Of course, if you want to use different encryption password from the
|
|
16
|
-
* {@link EncryptedModule}, this `EncryptedController` would be useful again.
|
|
17
|
-
* I recommend to use this `EncryptedController` decorator function
|
|
18
|
-
* configure different encryption password from the
|
|
18
|
+
* {@link EncryptedModule}, this `EncryptedController` would be useful again.
|
|
19
|
+
* Therefore, I recommend to use this `EncryptedController` decorator function
|
|
20
|
+
* only when you must configure different encryption password from the
|
|
21
|
+
* {@link EncryptedModule}.
|
|
19
22
|
*
|
|
23
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
20
24
|
* @param path Path of the HTTP request
|
|
21
25
|
* @param password Encryption password or its getter function
|
|
22
26
|
* @returns Class decorator
|
|
23
|
-
*
|
|
24
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
25
27
|
*/
|
|
26
28
|
export declare function EncryptedController(path: string, password: IEncryptionPassword | IEncryptionPassword.Closure): ClassDecorator;
|
|
@@ -6,26 +6,28 @@ const EncryptedConstant_1 = require("./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
|
function EncryptedController(path, password) {
|
|
31
33
|
return function (target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptedController.js","sourceRoot":"","sources":["../../src/decorators/EncryptedController.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"EncryptedController.js","sourceRoot":"","sources":["../../src/decorators/EncryptedController.ts"],"names":[],"mappings":";;AA+BA,kDAQC;AAtCD,2CAA4C;AAE5C,oEAAuE;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,mBAAmB,CACjC,IAAY,EACZ,QAA2D;IAE3D,OAAO,UAAU,MAAW;QAC1B,OAAO,CAAC,cAAc,CAAC,2CAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClE,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -3,42 +3,42 @@ import { Module } from "@nestjs/common";
|
|
|
3
3
|
/**
|
|
4
4
|
* Encrypted module.
|
|
5
5
|
*
|
|
6
|
-
* `EncryptedModule` is an extension of the {@link Module} class decorator
|
|
7
|
-
* who configures encryption password of the AES-128/256 algorithm. The
|
|
8
|
-
* algorithm and password would be used by {@link EncryptedRoute} and
|
|
9
|
-
* to encrypt the request and response bod of the HTTP
|
|
6
|
+
* `EncryptedModule` is an extension of the {@link Module} class decorator
|
|
7
|
+
* function who configures encryption password of the AES-128/256 algorithm. The
|
|
8
|
+
* encryption algorithm and password would be used by {@link EncryptedRoute} and
|
|
9
|
+
* {@link EncryptedBody} to encrypt the request and response bod of the HTTP
|
|
10
|
+
* protocol.
|
|
10
11
|
*
|
|
11
12
|
* By using this `EncryptedModule` decorator function, all of the
|
|
12
|
-
* {@link Controller controllers} configured in the
|
|
13
|
-
* changed to the {@link EncryptedController} with the
|
|
14
|
-
* original {@link EncryptedController} decorated classes in the
|
|
15
|
-
* encryption password would be kept.
|
|
13
|
+
* {@link Controller controllers} configured in the _metadata_ would be
|
|
14
|
+
* automatically changed to the {@link EncryptedController} with the _password_.
|
|
15
|
+
* If there're some original {@link EncryptedController} decorated classes in the
|
|
16
|
+
* _metadata_, their encryption password would be kept.
|
|
16
17
|
*
|
|
17
|
-
* Therefore, if you're planning to place original {@link EncryptedController}
|
|
18
|
-
* classes in the
|
|
19
|
-
* module level. If not, I recommend you use the
|
|
20
|
-
* function instead.
|
|
18
|
+
* Therefore, if you're planning to place original {@link EncryptedController}
|
|
19
|
+
* decorated classes in the _metadata_, I hope them to have different encryption
|
|
20
|
+
* password from the module level. If not, I recommend you use the
|
|
21
|
+
* {@link Controller} decorator function instead.
|
|
21
22
|
*
|
|
22
|
-
* In addition, the `EncryptedModule` supports a convenient dynamic controller
|
|
23
|
-
* function, {@link EncryptedModule.dynamic}. If you utilize the
|
|
24
|
-
* path of the controller classes, it imports and
|
|
25
|
-
* the `Module`, automatically.
|
|
23
|
+
* In addition, the `EncryptedModule` supports a convenient dynamic controller
|
|
24
|
+
* importing function, {@link EncryptedModule.dynamic}. If you utilize the
|
|
25
|
+
* function with directory path of the controller classes, it imports and
|
|
26
|
+
* configures the controller classes into the `Module`, automatically.
|
|
26
27
|
*
|
|
28
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
27
29
|
* @param metadata Module configuration metadata
|
|
28
30
|
* @param password Encryption password or its getter function
|
|
29
31
|
* @returns Class decorator
|
|
30
|
-
*
|
|
31
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
32
32
|
*/
|
|
33
33
|
export declare function EncryptedModule(metadata: Parameters<typeof Module>[0], password: IEncryptionPassword.Closure): ClassDecorator;
|
|
34
34
|
export declare namespace EncryptedModule {
|
|
35
35
|
/**
|
|
36
36
|
* Dynamic encrypted module.
|
|
37
37
|
*
|
|
38
|
-
* `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule}
|
|
39
|
-
* who configures controller classes by the dynamic importing. By
|
|
40
|
-
* path of the controller classes, those controllers
|
|
41
|
-
* and configured.
|
|
38
|
+
* `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule}
|
|
39
|
+
* function who configures controller classes by the dynamic importing. By
|
|
40
|
+
* specifying directory path of the controller classes, those controllers
|
|
41
|
+
* would be automatically imported and configured.
|
|
42
42
|
*
|
|
43
43
|
* @param path Directory path of the controller classes
|
|
44
44
|
* @param password Encryption password or its getter function
|
|
@@ -22,32 +22,32 @@ const load_controller_1 = require("./internal/load_controller");
|
|
|
22
22
|
/**
|
|
23
23
|
* Encrypted module.
|
|
24
24
|
*
|
|
25
|
-
* `EncryptedModule` is an extension of the {@link Module} class decorator
|
|
26
|
-
* who configures encryption password of the AES-128/256 algorithm. The
|
|
27
|
-
* algorithm and password would be used by {@link EncryptedRoute} and
|
|
28
|
-
* to encrypt the request and response bod of the HTTP
|
|
25
|
+
* `EncryptedModule` is an extension of the {@link Module} class decorator
|
|
26
|
+
* function who configures encryption password of the AES-128/256 algorithm. The
|
|
27
|
+
* encryption algorithm and password would be used by {@link EncryptedRoute} and
|
|
28
|
+
* {@link EncryptedBody} to encrypt the request and response bod of the HTTP
|
|
29
|
+
* protocol.
|
|
29
30
|
*
|
|
30
31
|
* By using this `EncryptedModule` decorator function, all of the
|
|
31
|
-
* {@link Controller controllers} configured in the
|
|
32
|
-
* changed to the {@link EncryptedController} with the
|
|
33
|
-
* original {@link EncryptedController} decorated classes in the
|
|
34
|
-
* encryption password would be kept.
|
|
32
|
+
* {@link Controller controllers} configured in the _metadata_ would be
|
|
33
|
+
* automatically changed to the {@link EncryptedController} with the _password_.
|
|
34
|
+
* If there're some original {@link EncryptedController} decorated classes in the
|
|
35
|
+
* _metadata_, their encryption password would be kept.
|
|
35
36
|
*
|
|
36
|
-
* Therefore, if you're planning to place original {@link EncryptedController}
|
|
37
|
-
* classes in the
|
|
38
|
-
* module level. If not, I recommend you use the
|
|
39
|
-
* function instead.
|
|
37
|
+
* Therefore, if you're planning to place original {@link EncryptedController}
|
|
38
|
+
* decorated classes in the _metadata_, I hope them to have different encryption
|
|
39
|
+
* password from the module level. If not, I recommend you use the
|
|
40
|
+
* {@link Controller} decorator function instead.
|
|
40
41
|
*
|
|
41
|
-
* In addition, the `EncryptedModule` supports a convenient dynamic controller
|
|
42
|
-
* function, {@link EncryptedModule.dynamic}. If you utilize the
|
|
43
|
-
* path of the controller classes, it imports and
|
|
44
|
-
* the `Module`, automatically.
|
|
42
|
+
* In addition, the `EncryptedModule` supports a convenient dynamic controller
|
|
43
|
+
* importing function, {@link EncryptedModule.dynamic}. If you utilize the
|
|
44
|
+
* function with directory path of the controller classes, it imports and
|
|
45
|
+
* configures the controller classes into the `Module`, automatically.
|
|
45
46
|
*
|
|
47
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
46
48
|
* @param metadata Module configuration metadata
|
|
47
49
|
* @param password Encryption password or its getter function
|
|
48
50
|
* @returns Class decorator
|
|
49
|
-
*
|
|
50
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
51
51
|
*/
|
|
52
52
|
function EncryptedModule(metadata, password) {
|
|
53
53
|
return function (target) {
|
|
@@ -59,10 +59,10 @@ function EncryptedModule(metadata, password) {
|
|
|
59
59
|
/**
|
|
60
60
|
* Dynamic encrypted module.
|
|
61
61
|
*
|
|
62
|
-
* `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule}
|
|
63
|
-
* who configures controller classes by the dynamic importing. By
|
|
64
|
-
* path of the controller classes, those controllers
|
|
65
|
-
* and configured.
|
|
62
|
+
* `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule}
|
|
63
|
+
* function who configures controller classes by the dynamic importing. By
|
|
64
|
+
* specifying directory path of the controller classes, those controllers
|
|
65
|
+
* would be automatically imported and configured.
|
|
66
66
|
*
|
|
67
67
|
* @param path Directory path of the controller classes
|
|
68
68
|
* @param password Encryption password or its getter function
|
|
@@ -84,9 +84,7 @@ function EncryptedModule(metadata, password) {
|
|
|
84
84
|
}
|
|
85
85
|
EncryptedModule.dynamic = dynamic;
|
|
86
86
|
})(EncryptedModule || (exports.EncryptedModule = EncryptedModule = {}));
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
87
|
+
/** @internal */
|
|
90
88
|
const iterate = (password) => (modulo) => {
|
|
91
89
|
const imports = Reflect.getMetadata("imports", modulo);
|
|
92
90
|
if (Array.isArray(imports))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptedModule.js","sourceRoot":"","sources":["../../src/decorators/EncryptedModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAqCA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,KAAK,UAAU;gBACzB,OAAO,CAAC,cAAc,CAAC,2CAAuB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -3,20 +3,21 @@ import { TypedRoute } from "./TypedRoute";
|
|
|
3
3
|
/**
|
|
4
4
|
* Encrypted router decorator functions.
|
|
5
5
|
*
|
|
6
|
-
* `EncryptedRoute` is a module containing router decorator functions which
|
|
7
|
-
* response body data through AES-128/256 encryption. Furthermore, they
|
|
8
|
-
* up JSON string conversion speed about 50x times faster than
|
|
9
|
-
* even type safe through
|
|
6
|
+
* `EncryptedRoute` is a module containing router decorator functions which
|
|
7
|
+
* encrypts response body data through AES-128/256 encryption. Furthermore, they
|
|
8
|
+
* can boost up JSON string conversion speed about 50x times faster than
|
|
9
|
+
* `class-transformer`, even type safe through
|
|
10
|
+
* [typia](https://github.com/samchon/typia).
|
|
10
11
|
*
|
|
11
12
|
* For reference, if you try to invalid data that is not following the promised
|
|
12
|
-
* type `T`, 500 internal server error would be thrown. Also, as
|
|
13
|
-
* composes JSON string through `typia.assertStringify<T>()`
|
|
14
|
-
* possible to modify response data through interceptors.
|
|
13
|
+
* type `T`, 500 internal server error would be thrown. Also, as
|
|
14
|
+
* `EncryptedRoute` composes JSON string through `typia.assertStringify<T>()`
|
|
15
|
+
* function, it is not possible to modify response data through interceptors.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* - AES-128/256
|
|
18
|
+
* - CBC mode
|
|
19
|
+
* - PKCS #5 Padding
|
|
20
|
+
* - Base64 Encoding
|
|
20
21
|
*
|
|
21
22
|
* @author Jeongho Nam - https://github.com/samchon
|
|
22
23
|
*/
|
|
@@ -79,18 +80,17 @@ export declare namespace EncryptedRoute {
|
|
|
79
80
|
/**
|
|
80
81
|
* Set the logger function for the response validation failure.
|
|
81
82
|
*
|
|
82
|
-
* If you've configured the transformation option to `validate.log`
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* If you've configured the transformation option to `validate.log` in the
|
|
84
|
+
* `tsconfig.json` file, then the error log information of the response
|
|
85
|
+
* validation failure would be logged through this function instead of
|
|
86
|
+
* throwing the 400 bad request error.
|
|
86
87
|
*
|
|
87
|
-
* By the way, be careful. If you've configured the response
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* backend server case.
|
|
88
|
+
* By the way, be careful. If you've configured the response transformation
|
|
89
|
+
* option to be `validate.log`, client may get wrong response data. Therefore,
|
|
90
|
+
* this way is not recommended in the common backend server case.
|
|
91
91
|
*
|
|
92
|
-
* @param func Logger function
|
|
93
92
|
* @default console.log
|
|
93
|
+
* @param func Logger function
|
|
94
94
|
*/
|
|
95
95
|
function setValidateErrorLogger(func: (log: IValidateErrorLog) => void): void;
|
|
96
96
|
export import IValidateErrorLog = TypedRoute.IValidateErrorLog;
|
|
@@ -17,20 +17,21 @@ const route_error_1 = require("./internal/route_error");
|
|
|
17
17
|
/**
|
|
18
18
|
* Encrypted router decorator functions.
|
|
19
19
|
*
|
|
20
|
-
* `EncryptedRoute` is a module containing router decorator functions which
|
|
21
|
-
* response body data through AES-128/256 encryption. Furthermore, they
|
|
22
|
-
* up JSON string conversion speed about 50x times faster than
|
|
23
|
-
* even type safe through
|
|
20
|
+
* `EncryptedRoute` is a module containing router decorator functions which
|
|
21
|
+
* encrypts response body data through AES-128/256 encryption. Furthermore, they
|
|
22
|
+
* can boost up JSON string conversion speed about 50x times faster than
|
|
23
|
+
* `class-transformer`, even type safe through
|
|
24
|
+
* [typia](https://github.com/samchon/typia).
|
|
24
25
|
*
|
|
25
26
|
* For reference, if you try to invalid data that is not following the promised
|
|
26
|
-
* type `T`, 500 internal server error would be thrown. Also, as
|
|
27
|
-
* composes JSON string through `typia.assertStringify<T>()`
|
|
28
|
-
* possible to modify response data through interceptors.
|
|
27
|
+
* type `T`, 500 internal server error would be thrown. Also, as
|
|
28
|
+
* `EncryptedRoute` composes JSON string through `typia.assertStringify<T>()`
|
|
29
|
+
* function, it is not possible to modify response data through interceptors.
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* - AES-128/256
|
|
32
|
+
* - CBC mode
|
|
33
|
+
* - PKCS #5 Padding
|
|
34
|
+
* - Base64 Encoding
|
|
34
35
|
*
|
|
35
36
|
* @author Jeongho Nam - https://github.com/samchon
|
|
36
37
|
*/
|
|
@@ -74,26 +75,23 @@ var EncryptedRoute;
|
|
|
74
75
|
/**
|
|
75
76
|
* Set the logger function for the response validation failure.
|
|
76
77
|
*
|
|
77
|
-
* If you've configured the transformation option to `validate.log`
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
78
|
+
* If you've configured the transformation option to `validate.log` in the
|
|
79
|
+
* `tsconfig.json` file, then the error log information of the response
|
|
80
|
+
* validation failure would be logged through this function instead of
|
|
81
|
+
* throwing the 400 bad request error.
|
|
81
82
|
*
|
|
82
|
-
* By the way, be careful. If you've configured the response
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* backend server case.
|
|
83
|
+
* By the way, be careful. If you've configured the response transformation
|
|
84
|
+
* option to be `validate.log`, client may get wrong response data. Therefore,
|
|
85
|
+
* this way is not recommended in the common backend server case.
|
|
86
86
|
*
|
|
87
|
-
* @param func Logger function
|
|
88
87
|
* @default console.log
|
|
88
|
+
* @param func Logger function
|
|
89
89
|
*/
|
|
90
90
|
function setValidateErrorLogger(func) {
|
|
91
91
|
TypedRoute_1.TypedRoute.setValidateErrorLogger(func);
|
|
92
92
|
}
|
|
93
93
|
EncryptedRoute.setValidateErrorLogger = setValidateErrorLogger;
|
|
94
|
-
/**
|
|
95
|
-
* @internal
|
|
96
|
-
*/
|
|
94
|
+
/** @internal */
|
|
97
95
|
function Generator(method) {
|
|
98
96
|
function route(...args) {
|
|
99
97
|
const [path, stringify] = (0, get_path_and_stringify_1.get_path_and_stringify)(() => TypedRoute_1.TypedRoute.__logger)(`EncryptedRoute.${method}`)(...args);
|
|
@@ -117,9 +115,7 @@ for (const method of [
|
|
|
117
115
|
EncryptedRoute.Patch,
|
|
118
116
|
])
|
|
119
117
|
deco[key] = value;
|
|
120
|
-
/**
|
|
121
|
-
* @internal
|
|
122
|
-
*/
|
|
118
|
+
/** @internal */
|
|
123
119
|
class EncryptedRouteInterceptor {
|
|
124
120
|
constructor(method, stringify) {
|
|
125
121
|
this.method = method;
|
|
@@ -147,9 +143,7 @@ class EncryptedRouteInterceptor {
|
|
|
147
143
|
}), (0, operators_1.catchError)((err) => (0, route_error_1.route_error)(http.getRequest(), err)));
|
|
148
144
|
}
|
|
149
145
|
}
|
|
150
|
-
/**
|
|
151
|
-
* @internal
|
|
152
|
-
*/
|
|
146
|
+
/** @internal */
|
|
153
147
|
const ROUTERS = {
|
|
154
148
|
Get: common_1.Get,
|
|
155
149
|
Post: common_1.Post,
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAiB,cAAc,CAsF9B;AAtFD,WAAiB,cAAc;IAC7B;;;;;OAKG;IACU,kBAAG,GAAG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AEZ,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,gBAAgB;AAChB,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"}
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* schema composer (of [`@samchon/openapi`](https://github.com/samchon/openapi))
|
|
6
6
|
* excludes the API.
|
|
7
7
|
*
|
|
8
|
-
* In other words, if you adjust the `@HumanRoute()` decorator to the API,
|
|
9
|
-
*
|
|
8
|
+
* In other words, if you adjust the `@HumanRoute()` decorator to the API, the
|
|
9
|
+
* API never participates in the LLM function calling. When calling the
|
|
10
10
|
* {@link HttpLlm.application} function, matched {@link IHttpLlmFunction} data
|
|
11
11
|
* never be composed.
|
|
12
12
|
*
|
|
13
|
-
* @returns Method decorator
|
|
14
13
|
* @author Jeongho Nam - https://github.com/samchon
|
|
14
|
+
* @returns Method decorator
|
|
15
15
|
*/
|
|
16
16
|
export declare function HumanRoute(): MethodDecorator;
|
|
@@ -9,13 +9,13 @@ const SwaggerCustomizer_1 = require("./SwaggerCustomizer");
|
|
|
9
9
|
* schema composer (of [`@samchon/openapi`](https://github.com/samchon/openapi))
|
|
10
10
|
* excludes the API.
|
|
11
11
|
*
|
|
12
|
-
* In other words, if you adjust the `@HumanRoute()` decorator to the API,
|
|
13
|
-
*
|
|
12
|
+
* In other words, if you adjust the `@HumanRoute()` decorator to the API, the
|
|
13
|
+
* API never participates in the LLM function calling. When calling the
|
|
14
14
|
* {@link HttpLlm.application} function, matched {@link IHttpLlmFunction} data
|
|
15
15
|
* never be composed.
|
|
16
16
|
*
|
|
17
|
-
* @returns Method decorator
|
|
18
17
|
* @author Jeongho Nam - https://github.com/samchon
|
|
18
|
+
* @returns Method decorator
|
|
19
19
|
*/
|
|
20
20
|
function HumanRoute() {
|
|
21
21
|
return (0, SwaggerCustomizer_1.SwaggerCustomizer)((props) => {
|
|
@@ -6,17 +6,19 @@ export declare namespace NoTransformConfigurationError {
|
|
|
6
6
|
* If you set this value to `false`, {@link NoTransformConfigurationError} will
|
|
7
7
|
* not throw an error.
|
|
8
8
|
*
|
|
9
|
-
* Even if you've not configured the plugin transformer of `tsconfig.json`
|
|
10
|
-
* the error will not be thrown and the program will be continued.
|
|
11
|
-
* validations and assertions will be skipped and the value
|
|
12
|
-
* Furthermore, unexpected behaviors may occur.
|
|
9
|
+
* Even if you've not configured the plugin transformer of `tsconfig.json`
|
|
10
|
+
* file, the error will not be thrown and the program will be continued.
|
|
11
|
+
* Instead, every validations and assertions will be skipped and the value
|
|
12
|
+
* will be returned as it is. Furthermore, unexpected behaviors may occur.
|
|
13
13
|
*
|
|
14
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
|
|
15
|
+
* environment. Configure this value to be `false` only when you're debugging
|
|
16
|
+
* or testing.
|
|
16
17
|
*
|
|
17
|
-
* By the way, if you hope the `false` value to be set, you have to do it
|
|
18
|
-
* If you configure the `false` value after the
|
|
19
|
-
* composed, the value will not be
|
|
18
|
+
* By the way, if you hope the `false` value to be set, you have to do it
|
|
19
|
+
* before the first. If you configure the `false` value after the
|
|
20
|
+
* `@nestia/core` decorator functions are composed, the value will not be
|
|
21
|
+
* applied and the error will be thrown.
|
|
20
22
|
*/
|
|
21
23
|
let throws: boolean;
|
|
22
24
|
}
|