@nestia/core 1.3.5 → 1.3.7

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.
Files changed (98) hide show
  1. package/README.md +9 -4
  2. package/lib/decorators/DynamicModule.d.ts +26 -26
  3. package/lib/decorators/DynamicModule.js +103 -103
  4. package/lib/decorators/DynamicModule.js.map +1 -1
  5. package/lib/decorators/EncryptedBody.d.ts +23 -23
  6. package/lib/decorators/EncryptedBody.js +128 -128
  7. package/lib/decorators/EncryptedController.d.ts +26 -26
  8. package/lib/decorators/EncryptedController.js +36 -36
  9. package/lib/decorators/EncryptedModule.d.ts +52 -52
  10. package/lib/decorators/EncryptedModule.js +161 -161
  11. package/lib/decorators/EncryptedModule.js.map +1 -1
  12. package/lib/decorators/EncryptedRoute.d.ts +78 -78
  13. package/lib/decorators/EncryptedRoute.js +209 -209
  14. package/lib/decorators/EncryptedRoute.js.map +1 -1
  15. package/lib/decorators/PlainBody.d.ts +22 -22
  16. package/lib/decorators/PlainBody.js +82 -82
  17. package/lib/decorators/TypedBody.d.ts +16 -16
  18. package/lib/decorators/TypedBody.js +45 -45
  19. package/lib/decorators/TypedParam.d.ts +31 -31
  20. package/lib/decorators/TypedParam.js +76 -76
  21. package/lib/decorators/TypedQuery.d.ts +14 -14
  22. package/lib/decorators/TypedQuery.js +109 -109
  23. package/lib/decorators/TypedQuery.js.map +1 -1
  24. package/lib/decorators/TypedRoute.d.ts +72 -72
  25. package/lib/decorators/TypedRoute.js +185 -185
  26. package/lib/decorators/TypedRoute.js.map +1 -1
  27. package/lib/decorators/internal/EncryptedConstant.d.ts +1 -1
  28. package/lib/decorators/internal/EncryptedConstant.js +7 -7
  29. package/lib/decorators/internal/TransformError.d.ts +1 -1
  30. package/lib/decorators/internal/TransformError.js +10 -10
  31. package/lib/decorators/internal/get_path_and_stringify.d.ts +1 -1
  32. package/lib/decorators/internal/get_path_and_stringify.js +83 -83
  33. package/lib/decorators/internal/get_text_body.d.ts +3 -3
  34. package/lib/decorators/internal/get_text_body.js +62 -62
  35. package/lib/decorators/internal/headers_to_object.d.ts +3 -3
  36. package/lib/decorators/internal/headers_to_object.js +49 -49
  37. package/lib/decorators/internal/load_controller.d.ts +5 -5
  38. package/lib/decorators/internal/load_controller.js +151 -152
  39. package/lib/decorators/internal/load_controller.js.map +1 -1
  40. package/lib/decorators/internal/route_error.d.ts +3 -3
  41. package/lib/decorators/internal/route_error.js +88 -88
  42. package/lib/decorators/internal/validate_request_body.d.ts +3 -3
  43. package/lib/decorators/internal/validate_request_body.js +66 -66
  44. package/lib/index.d.ts +3 -3
  45. package/lib/index.js +31 -31
  46. package/lib/module.d.ts +12 -12
  47. package/lib/module.js +28 -28
  48. package/lib/options/INestiaTransformOptions.d.ts +4 -4
  49. package/lib/options/INestiaTransformOptions.js +2 -2
  50. package/lib/options/INestiaTransformProject.d.ts +5 -5
  51. package/lib/options/INestiaTransformProject.js +2 -2
  52. package/lib/options/IRequestBodyValidator.d.ts +16 -16
  53. package/lib/options/IRequestBodyValidator.js +2 -2
  54. package/lib/options/IResponseBodyStringifier.d.ts +20 -20
  55. package/lib/options/IResponseBodyStringifier.js +2 -2
  56. package/lib/programmers/TypedBodyProgrammer.d.ts +5 -5
  57. package/lib/programmers/TypedBodyProgrammer.js +58 -58
  58. package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
  59. package/lib/programmers/TypedParamProgrammer.d.ts +5 -5
  60. package/lib/programmers/TypedParamProgrammer.js +110 -110
  61. package/lib/programmers/TypedParamProgrammer.js.map +1 -1
  62. package/lib/programmers/TypedQueryProgrammer.d.ts +5 -5
  63. package/lib/programmers/TypedQueryProgrammer.js +264 -264
  64. package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
  65. package/lib/programmers/TypedRouteProgrammer.d.ts +5 -5
  66. package/lib/programmers/TypedRouteProgrammer.js +49 -49
  67. package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
  68. package/lib/transform.d.ts +4 -4
  69. package/lib/transform.js +25 -25
  70. package/lib/transformers/FileTransformer.d.ts +5 -5
  71. package/lib/transformers/FileTransformer.js +40 -40
  72. package/lib/transformers/FileTransformer.js.map +1 -1
  73. package/lib/transformers/MethodDecoratorTransformer.d.ts +5 -5
  74. package/lib/transformers/MethodDecoratorTransformer.js +92 -92
  75. package/lib/transformers/MethodDecoratorTransformer.js.map +1 -1
  76. package/lib/transformers/MethodTransformer.d.ts +5 -5
  77. package/lib/transformers/MethodTransformer.js +62 -62
  78. package/lib/transformers/MethodTransformer.js.map +1 -1
  79. package/lib/transformers/NodeTransformer.d.ts +5 -5
  80. package/lib/transformers/NodeTransformer.js +21 -21
  81. package/lib/transformers/NodeTransformer.js.map +1 -1
  82. package/lib/transformers/ParameterDecoratorTransformer.d.ts +5 -5
  83. package/lib/transformers/ParameterDecoratorTransformer.js +68 -68
  84. package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
  85. package/lib/transformers/ParameterTransformer.d.ts +5 -5
  86. package/lib/transformers/ParameterTransformer.js +34 -34
  87. package/lib/transformers/ParameterTransformer.js.map +1 -1
  88. package/lib/typings/Creator.d.ts +3 -3
  89. package/lib/typings/Creator.js +2 -2
  90. package/lib/utils/ExceptionManager.d.ts +64 -64
  91. package/lib/utils/ExceptionManager.js +112 -112
  92. package/lib/utils/ExceptionManager.js.map +1 -1
  93. package/lib/utils/Singleton.d.ts +1 -1
  94. package/lib/utils/Singleton.js +23 -23
  95. package/lib/utils/SourceFinder.d.ts +9 -9
  96. package/lib/utils/SourceFinder.js +238 -238
  97. package/lib/utils/SourceFinder.js.map +1 -1
  98. package/package.json +6 -6
@@ -1,26 +1,26 @@
1
- import { IEncryptionPassword } from "@nestia/fetcher";
2
- /**
3
- * Encrypted controller.
4
- *
5
- * `EncryptedController` is an extension of the {@link nest.Controller} class decorator
6
- * function who configures encryption password of the AES-128/256 algorithm. The
7
- * encryption algorithm and password would be used by {@link EncryptedRoute} and
8
- * {@link EncryptedBody} to encrypt the request and response body of the HTTP protocol.
9
- *
10
- * By the way, you can configure the encryption password in the global level by using
11
- * {@link EncryptedModule} instead of the {@link nest.Module} in the module level. In
12
- * that case, you don't need to use this `EncryptedController` more. Just use the
13
- * {@link nest.Controller} without duplicated encryption password definitions.
14
- *
15
- * Of course, if you want to use different encryption password from the
16
- * {@link EncryptedModule}, this `EncryptedController` would be useful again. Therefore,
17
- * I recommend to use this `EncryptedController` decorator function only when you must
18
- * configure different encryption password from the {@link EncryptedModule}.
19
- *
20
- * @param path Path of the HTTP request
21
- * @param password Encryption password or its getter function
22
- * @returns Class decorator
23
- *
24
- * @author Jeongho Nam - https://github.com/samchon
25
- */
26
- export declare function EncryptedController(path: string, password: IEncryptionPassword | IEncryptionPassword.Closure): ClassDecorator;
1
+ import { IEncryptionPassword } from "@nestia/fetcher";
2
+ /**
3
+ * Encrypted controller.
4
+ *
5
+ * `EncryptedController` is an extension of the {@link nest.Controller} class decorator
6
+ * function who configures encryption password of the AES-128/256 algorithm. The
7
+ * encryption algorithm and password would be used by {@link EncryptedRoute} and
8
+ * {@link EncryptedBody} to encrypt the request and response body of the HTTP protocol.
9
+ *
10
+ * By the way, you can configure the encryption password in the global level by using
11
+ * {@link EncryptedModule} instead of the {@link nest.Module} in the module level. In
12
+ * that case, you don't need to use this `EncryptedController` more. Just use the
13
+ * {@link nest.Controller} without duplicated encryption password definitions.
14
+ *
15
+ * Of course, if you want to use different encryption password from the
16
+ * {@link EncryptedModule}, this `EncryptedController` would be useful again. Therefore,
17
+ * I recommend to use this `EncryptedController` decorator function only when you must
18
+ * configure different encryption password from the {@link EncryptedModule}.
19
+ *
20
+ * @param path Path of the HTTP request
21
+ * @param password Encryption password or its getter function
22
+ * @returns Class decorator
23
+ *
24
+ * @author Jeongho Nam - https://github.com/samchon
25
+ */
26
+ export declare function EncryptedController(path: string, password: IEncryptionPassword | IEncryptionPassword.Closure): ClassDecorator;
@@ -1,37 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EncryptedController = void 0;
4
- var common_1 = require("@nestjs/common");
5
- var EncryptedConstant_1 = require("./internal/EncryptedConstant");
6
- /**
7
- * Encrypted controller.
8
- *
9
- * `EncryptedController` is an extension of the {@link nest.Controller} class decorator
10
- * function who configures encryption password of the AES-128/256 algorithm. The
11
- * encryption algorithm and password would be used by {@link EncryptedRoute} and
12
- * {@link EncryptedBody} to encrypt the request and response body of the HTTP protocol.
13
- *
14
- * By the way, you can configure the encryption password in the global level by using
15
- * {@link EncryptedModule} instead of the {@link nest.Module} in the module level. In
16
- * that case, you don't need to use this `EncryptedController` more. Just use the
17
- * {@link nest.Controller} without duplicated encryption password definitions.
18
- *
19
- * Of course, if you want to use different encryption password from the
20
- * {@link EncryptedModule}, this `EncryptedController` would be useful again. Therefore,
21
- * I recommend to use this `EncryptedController` decorator function only when you must
22
- * configure different encryption password from the {@link EncryptedModule}.
23
- *
24
- * @param path Path of the HTTP request
25
- * @param password Encryption password or its getter function
26
- * @returns Class decorator
27
- *
28
- * @author Jeongho Nam - https://github.com/samchon
29
- */
30
- function EncryptedController(path, password) {
31
- return function (target) {
32
- Reflect.defineMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, password, target);
33
- (0, common_1.Controller)(path)(target);
34
- };
35
- }
36
- exports.EncryptedController = EncryptedController;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EncryptedController = void 0;
4
+ var common_1 = require("@nestjs/common");
5
+ var EncryptedConstant_1 = require("./internal/EncryptedConstant");
6
+ /**
7
+ * Encrypted controller.
8
+ *
9
+ * `EncryptedController` is an extension of the {@link nest.Controller} class decorator
10
+ * function who configures encryption password of the AES-128/256 algorithm. The
11
+ * encryption algorithm and password would be used by {@link EncryptedRoute} and
12
+ * {@link EncryptedBody} to encrypt the request and response body of the HTTP protocol.
13
+ *
14
+ * By the way, you can configure the encryption password in the global level by using
15
+ * {@link EncryptedModule} instead of the {@link nest.Module} in the module level. In
16
+ * that case, you don't need to use this `EncryptedController` more. Just use the
17
+ * {@link nest.Controller} without duplicated encryption password definitions.
18
+ *
19
+ * Of course, if you want to use different encryption password from the
20
+ * {@link EncryptedModule}, this `EncryptedController` would be useful again. Therefore,
21
+ * I recommend to use this `EncryptedController` decorator function only when you must
22
+ * configure different encryption password from the {@link EncryptedModule}.
23
+ *
24
+ * @param path Path of the HTTP request
25
+ * @param password Encryption password or its getter function
26
+ * @returns Class decorator
27
+ *
28
+ * @author Jeongho Nam - https://github.com/samchon
29
+ */
30
+ function EncryptedController(path, password) {
31
+ return function (target) {
32
+ Reflect.defineMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, password, target);
33
+ (0, common_1.Controller)(path)(target);
34
+ };
35
+ }
36
+ exports.EncryptedController = EncryptedController;
37
37
  //# sourceMappingURL=EncryptedController.js.map
@@ -1,52 +1,52 @@
1
- import { IEncryptionPassword } from "@nestia/fetcher/lib/IEncryptionPassword";
2
- import { Module } from "@nestjs/common";
3
- /**
4
- * Encrypted module.
5
- *
6
- * `EncryptedModule` is an extension of the {@link Module} class decorator function
7
- * who configures encryption password of the AES-128/256 algorithm. The encryption
8
- * algorithm and password would be used by {@link EncryptedRoute} and {@link EncryptedBody}
9
- * to encrypt the request and response bod of the HTTP protocol.
10
- *
11
- * By using this `EncryptedModule` decorator function, all of the
12
- * {@link Controller controllers} configured in the *metadata* would be automatically
13
- * changed to the {@link EncryptedController} with the *password*. If there're some
14
- * original {@link EncryptedController} decorated classes in the *metadata*, their
15
- * encryption password would be kept.
16
- *
17
- * Therefore, if you're planning to place original {@link EncryptedController} decorated
18
- * classes in the *metadata*, I hope them to have different encryption password from the
19
- * module level. If not, I recommend you use the {@link Controller} decorator
20
- * function instead.
21
- *
22
- * In addition, the `EncryptedModule` supports a convenient dynamic controller importing
23
- * function, {@link EncryptedModule.dynamic}. If you utilize the function with directory
24
- * path of the controller classes, it imports and configures the controller classes into
25
- * the `Module`, automatically.
26
- *
27
- * @param metadata Module configuration metadata
28
- * @param password Encryption password or its getter function
29
- * @returns Class decorator
30
- *
31
- * @author Jeongho Nam - https://github.com/samchon
32
- */
33
- export declare function EncryptedModule(metadata: Parameters<typeof Module>[0], password: IEncryptionPassword | IEncryptionPassword.Closure): ClassDecorator;
34
- export declare namespace EncryptedModule {
35
- /**
36
- * Dynamic encrypted module.
37
- *
38
- * `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule} function
39
- * who configures controller classes by the dynamic importing. By specifying directory
40
- * path of the controller classes, those controllers would be automatically imported
41
- * and configured.
42
- *
43
- * @param path Directory path of the controller classes
44
- * @param password Encryption password or its getter function
45
- * @param options Additional options except controller
46
- * @returns Class decorated module instance
47
- */
48
- function dynamic(path: string | string[] | {
49
- include: string[];
50
- exclude?: string[];
51
- }, password: IEncryptionPassword | IEncryptionPassword.Closure, options?: Omit<Parameters<typeof Module>[0], "controllers">): Promise<object>;
52
- }
1
+ import { IEncryptionPassword } from "@nestia/fetcher/lib/IEncryptionPassword";
2
+ import { Module } from "@nestjs/common";
3
+ /**
4
+ * Encrypted module.
5
+ *
6
+ * `EncryptedModule` is an extension of the {@link Module} class decorator function
7
+ * who configures encryption password of the AES-128/256 algorithm. The encryption
8
+ * algorithm and password would be used by {@link EncryptedRoute} and {@link EncryptedBody}
9
+ * to encrypt the request and response bod of the HTTP protocol.
10
+ *
11
+ * By using this `EncryptedModule` decorator function, all of the
12
+ * {@link Controller controllers} configured in the *metadata* would be automatically
13
+ * changed to the {@link EncryptedController} with the *password*. If there're some
14
+ * original {@link EncryptedController} decorated classes in the *metadata*, their
15
+ * encryption password would be kept.
16
+ *
17
+ * Therefore, if you're planning to place original {@link EncryptedController} decorated
18
+ * classes in the *metadata*, I hope them to have different encryption password from the
19
+ * module level. If not, I recommend you use the {@link Controller} decorator
20
+ * function instead.
21
+ *
22
+ * In addition, the `EncryptedModule` supports a convenient dynamic controller importing
23
+ * function, {@link EncryptedModule.dynamic}. If you utilize the function with directory
24
+ * path of the controller classes, it imports and configures the controller classes into
25
+ * the `Module`, automatically.
26
+ *
27
+ * @param metadata Module configuration metadata
28
+ * @param password Encryption password or its getter function
29
+ * @returns Class decorator
30
+ *
31
+ * @author Jeongho Nam - https://github.com/samchon
32
+ */
33
+ export declare function EncryptedModule(metadata: Parameters<typeof Module>[0], password: IEncryptionPassword | IEncryptionPassword.Closure): ClassDecorator;
34
+ export declare namespace EncryptedModule {
35
+ /**
36
+ * Dynamic encrypted module.
37
+ *
38
+ * `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule} function
39
+ * who configures controller classes by the dynamic importing. By specifying directory
40
+ * path of the controller classes, those controllers would be automatically imported
41
+ * and configured.
42
+ *
43
+ * @param path Directory path of the controller classes
44
+ * @param password Encryption password or its getter function
45
+ * @param options Additional options except controller
46
+ * @returns Class decorated module instance
47
+ */
48
+ function dynamic(path: string | string[] | {
49
+ include: string[];
50
+ exclude?: string[];
51
+ }, password: IEncryptionPassword | IEncryptionPassword.Closure, options?: Omit<Parameters<typeof Module>[0], "controllers">): Promise<object>;
52
+ }
@@ -1,162 +1,162 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
- return c > 3 && r && Object.defineProperty(target, key, r), r;
18
- };
19
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
20
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
- return new (P || (P = Promise))(function (resolve, reject) {
22
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- };
28
- var __generator = (this && this.__generator) || function (thisArg, body) {
29
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
30
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
31
- function verb(n) { return function (v) { return step([n, v]); }; }
32
- function step(op) {
33
- if (f) throw new TypeError("Generator is already executing.");
34
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
35
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
36
- if (y = 0, t) op = [op[0] & 2, t.value];
37
- switch (op[0]) {
38
- case 0: case 1: t = op; break;
39
- case 4: _.label++; return { value: op[1], done: false };
40
- case 5: _.label++; y = op[1]; op = [0]; continue;
41
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
42
- default:
43
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
44
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
45
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
46
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
47
- if (t[2]) _.ops.pop();
48
- _.trys.pop(); continue;
49
- }
50
- op = body.call(thisArg, _);
51
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
52
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
53
- }
54
- };
55
- var __values = (this && this.__values) || function(o) {
56
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
57
- if (m) return m.call(o);
58
- if (o && typeof o.length === "number") return {
59
- next: function () {
60
- if (o && i >= o.length) o = void 0;
61
- return { value: o && o[i++], done: !o };
62
- }
63
- };
64
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
65
- };
66
- Object.defineProperty(exports, "__esModule", { value: true });
67
- exports.EncryptedModule = void 0;
68
- var common_1 = require("@nestjs/common");
69
- var EncryptedConstant_1 = require("./internal/EncryptedConstant");
70
- var load_controller_1 = require("./internal/load_controller");
71
- /**
72
- * Encrypted module.
73
- *
74
- * `EncryptedModule` is an extension of the {@link Module} class decorator function
75
- * who configures encryption password of the AES-128/256 algorithm. The encryption
76
- * algorithm and password would be used by {@link EncryptedRoute} and {@link EncryptedBody}
77
- * to encrypt the request and response bod of the HTTP protocol.
78
- *
79
- * By using this `EncryptedModule` decorator function, all of the
80
- * {@link Controller controllers} configured in the *metadata* would be automatically
81
- * changed to the {@link EncryptedController} with the *password*. If there're some
82
- * original {@link EncryptedController} decorated classes in the *metadata*, their
83
- * encryption password would be kept.
84
- *
85
- * Therefore, if you're planning to place original {@link EncryptedController} decorated
86
- * classes in the *metadata*, I hope them to have different encryption password from the
87
- * module level. If not, I recommend you use the {@link Controller} decorator
88
- * function instead.
89
- *
90
- * In addition, the `EncryptedModule` supports a convenient dynamic controller importing
91
- * function, {@link EncryptedModule.dynamic}. If you utilize the function with directory
92
- * path of the controller classes, it imports and configures the controller classes into
93
- * the `Module`, automatically.
94
- *
95
- * @param metadata Module configuration metadata
96
- * @param password Encryption password or its getter function
97
- * @returns Class decorator
98
- *
99
- * @author Jeongho Nam - https://github.com/samchon
100
- */
101
- function EncryptedModule(metadata, password) {
102
- return function (target) {
103
- var e_1, _a;
104
- (0, common_1.Module)(metadata)(target);
105
- if (metadata.controllers === undefined)
106
- return;
107
- try {
108
- for (var _b = __values(metadata.controllers), _c = _b.next(); !_c.done; _c = _b.next()) {
109
- var c = _c.value;
110
- if (Reflect.hasMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, c) === false)
111
- Reflect.defineMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, password, c);
112
- }
113
- }
114
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
115
- finally {
116
- try {
117
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
118
- }
119
- finally { if (e_1) throw e_1.error; }
120
- }
121
- };
122
- }
123
- exports.EncryptedModule = EncryptedModule;
124
- (function (EncryptedModule) {
125
- /**
126
- * Dynamic encrypted module.
127
- *
128
- * `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule} function
129
- * who configures controller classes by the dynamic importing. By specifying directory
130
- * path of the controller classes, those controllers would be automatically imported
131
- * and configured.
132
- *
133
- * @param path Directory path of the controller classes
134
- * @param password Encryption password or its getter function
135
- * @param options Additional options except controller
136
- * @returns Class decorated module instance
137
- */
138
- function dynamic(path, password, options) {
139
- if (options === void 0) { options = {}; }
140
- return __awaiter(this, void 0, void 0, function () {
141
- var controllers, NestiaModule;
142
- return __generator(this, function (_a) {
143
- switch (_a.label) {
144
- case 0: return [4 /*yield*/, (0, load_controller_1.load_controllers)(path)];
145
- case 1:
146
- controllers = _a.sent();
147
- NestiaModule = /** @class */ (function () {
148
- function NestiaModule() {
149
- }
150
- NestiaModule = __decorate([
151
- EncryptedModule(__assign(__assign({}, options), { controllers: controllers }), password)
152
- ], NestiaModule);
153
- return NestiaModule;
154
- }());
155
- return [2 /*return*/, NestiaModule];
156
- }
157
- });
158
- });
159
- }
160
- EncryptedModule.dynamic = dynamic;
161
- })(EncryptedModule = exports.EncryptedModule || (exports.EncryptedModule = {}));
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ };
19
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
20
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
+ return new (P || (P = Promise))(function (resolve, reject) {
22
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ });
27
+ };
28
+ var __generator = (this && this.__generator) || function (thisArg, body) {
29
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
30
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
31
+ function verb(n) { return function (v) { return step([n, v]); }; }
32
+ function step(op) {
33
+ if (f) throw new TypeError("Generator is already executing.");
34
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
35
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
36
+ if (y = 0, t) op = [op[0] & 2, t.value];
37
+ switch (op[0]) {
38
+ case 0: case 1: t = op; break;
39
+ case 4: _.label++; return { value: op[1], done: false };
40
+ case 5: _.label++; y = op[1]; op = [0]; continue;
41
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
42
+ default:
43
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
44
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
45
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
46
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
47
+ if (t[2]) _.ops.pop();
48
+ _.trys.pop(); continue;
49
+ }
50
+ op = body.call(thisArg, _);
51
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
52
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
53
+ }
54
+ };
55
+ var __values = (this && this.__values) || function(o) {
56
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
57
+ if (m) return m.call(o);
58
+ if (o && typeof o.length === "number") return {
59
+ next: function () {
60
+ if (o && i >= o.length) o = void 0;
61
+ return { value: o && o[i++], done: !o };
62
+ }
63
+ };
64
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
65
+ };
66
+ Object.defineProperty(exports, "__esModule", { value: true });
67
+ exports.EncryptedModule = void 0;
68
+ var common_1 = require("@nestjs/common");
69
+ var EncryptedConstant_1 = require("./internal/EncryptedConstant");
70
+ var load_controller_1 = require("./internal/load_controller");
71
+ /**
72
+ * Encrypted module.
73
+ *
74
+ * `EncryptedModule` is an extension of the {@link Module} class decorator function
75
+ * who configures encryption password of the AES-128/256 algorithm. The encryption
76
+ * algorithm and password would be used by {@link EncryptedRoute} and {@link EncryptedBody}
77
+ * to encrypt the request and response bod of the HTTP protocol.
78
+ *
79
+ * By using this `EncryptedModule` decorator function, all of the
80
+ * {@link Controller controllers} configured in the *metadata* would be automatically
81
+ * changed to the {@link EncryptedController} with the *password*. If there're some
82
+ * original {@link EncryptedController} decorated classes in the *metadata*, their
83
+ * encryption password would be kept.
84
+ *
85
+ * Therefore, if you're planning to place original {@link EncryptedController} decorated
86
+ * classes in the *metadata*, I hope them to have different encryption password from the
87
+ * module level. If not, I recommend you use the {@link Controller} decorator
88
+ * function instead.
89
+ *
90
+ * In addition, the `EncryptedModule` supports a convenient dynamic controller importing
91
+ * function, {@link EncryptedModule.dynamic}. If you utilize the function with directory
92
+ * path of the controller classes, it imports and configures the controller classes into
93
+ * the `Module`, automatically.
94
+ *
95
+ * @param metadata Module configuration metadata
96
+ * @param password Encryption password or its getter function
97
+ * @returns Class decorator
98
+ *
99
+ * @author Jeongho Nam - https://github.com/samchon
100
+ */
101
+ function EncryptedModule(metadata, password) {
102
+ return function (target) {
103
+ var e_1, _a;
104
+ (0, common_1.Module)(metadata)(target);
105
+ if (metadata.controllers === undefined)
106
+ return;
107
+ try {
108
+ for (var _b = __values(metadata.controllers), _c = _b.next(); !_c.done; _c = _b.next()) {
109
+ var c = _c.value;
110
+ if (Reflect.hasMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, c) === false)
111
+ Reflect.defineMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, password, c);
112
+ }
113
+ }
114
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
115
+ finally {
116
+ try {
117
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
118
+ }
119
+ finally { if (e_1) throw e_1.error; }
120
+ }
121
+ };
122
+ }
123
+ exports.EncryptedModule = EncryptedModule;
124
+ (function (EncryptedModule) {
125
+ /**
126
+ * Dynamic encrypted module.
127
+ *
128
+ * `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule} function
129
+ * who configures controller classes by the dynamic importing. By specifying directory
130
+ * path of the controller classes, those controllers would be automatically imported
131
+ * and configured.
132
+ *
133
+ * @param path Directory path of the controller classes
134
+ * @param password Encryption password or its getter function
135
+ * @param options Additional options except controller
136
+ * @returns Class decorated module instance
137
+ */
138
+ function dynamic(path, password, options) {
139
+ if (options === void 0) { options = {}; }
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ var controllers, NestiaModule;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0: return [4 /*yield*/, (0, load_controller_1.load_controllers)(path)];
145
+ case 1:
146
+ controllers = _a.sent();
147
+ NestiaModule = /** @class */ (function () {
148
+ function NestiaModule() {
149
+ }
150
+ NestiaModule = __decorate([
151
+ EncryptedModule(__assign(__assign({}, options), { controllers: controllers }), password)
152
+ ], NestiaModule);
153
+ return NestiaModule;
154
+ }());
155
+ return [2 /*return*/, NestiaModule];
156
+ }
157
+ });
158
+ });
159
+ }
160
+ EncryptedModule.dynamic = dynamic;
161
+ })(EncryptedModule || (exports.EncryptedModule = EncryptedModule = {}));
162
162
  //# sourceMappingURL=EncryptedModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EncryptedModule.js","sourceRoot":"","sources":["../../src/decorators/EncryptedModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAwC;AAGxC,kEAAuE;AACvE,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,eAAe,CAC3B,QAAsC,EACtC,QAA2D;IAE3D,OAAO,UAAU,MAAW;;QACxB,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS;YAAE,OAAO;;YAE/C,KAAgB,IAAA,KAAA,SAAA,QAAQ,CAAC,WAAW,CAAA,gBAAA;gBAA/B,IAAM,CAAC,WAAA;gBACR,IAAI,OAAO,CAAC,WAAW,CAAC,2CAAuB,EAAE,CAAC,CAAC,KAAK,KAAK;oBACzD,OAAO,CAAC,cAAc,CAAC,2CAAuB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;aAAA;;;;;;;;;IACzE,CAAC,CAAC;AACN,CAAC;AAZD,0CAYC;AAED,WAAiB,eAAe;IAC5B;;;;;;;;;;;;OAYG;IACH,SAAsB,OAAO,CACzB,IAAmE,EACnE,QAA2D,EAC3D,OAA+D;QAA/D,wBAAA,EAAA,YAA+D;;;;;4BAGxB,qBAAM,IAAA,kCAAgB,EAAC,IAAI,CAAC,EAAA;;wBAA7D,WAAW,GAAsB,SAA4B;;4BAInE;4BAAoB,CAAC;4BAAf,YAAY;gCADjB,eAAe,uBAAM,OAAO,KAAE,WAAW,aAAA,KAAI,QAAQ,CAAC;+BACjD,YAAY,CAAG;4BAAD,mBAAC;yBAAA,AAArB;wBACA,sBAAO,YAAY,EAAC;;;;KACvB;IAZqB,uBAAO,UAY5B,CAAA;AACL,CAAC,EA3BgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA2B/B"}
1
+ {"version":3,"file":"EncryptedModule.js","sourceRoot":"","sources":["../../src/decorators/EncryptedModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAwC;AAGxC,kEAAuE;AACvE,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,eAAe,CAC3B,QAAsC,EACtC,QAA2D;IAE3D,OAAO,UAAU,MAAW;;QACxB,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS;YAAE,OAAO;;YAE/C,KAAgB,IAAA,KAAA,SAAA,QAAQ,CAAC,WAAW,CAAA,gBAAA;gBAA/B,IAAM,CAAC,WAAA;gBACR,IAAI,OAAO,CAAC,WAAW,CAAC,2CAAuB,EAAE,CAAC,CAAC,KAAK,KAAK;oBACzD,OAAO,CAAC,cAAc,CAAC,2CAAuB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;aAAA;;;;;;;;;IACzE,CAAC,CAAC;AACN,CAAC;AAZD,0CAYC;AAED,WAAiB,eAAe;IAC5B;;;;;;;;;;;;OAYG;IACH,SAAsB,OAAO,CACzB,IAAmE,EACnE,QAA2D,EAC3D,OAA+D;QAA/D,wBAAA,EAAA,YAA+D;;;;;4BAGxB,qBAAM,IAAA,kCAAgB,EAAC,IAAI,CAAC,EAAA;;wBAA7D,WAAW,GAAsB,SAA4B;;4BAInE;4BAAoB,CAAC;4BAAf,YAAY;gCADjB,eAAe,uBAAM,OAAO,KAAE,WAAW,aAAA,KAAI,QAAQ,CAAC;+BACjD,YAAY,CAAG;4BAAD,mBAAC;yBAAA,AAArB;wBACA,sBAAO,YAAY,EAAC;;;;KACvB;IAZqB,uBAAO,UAY5B,CAAA;AACL,CAAC,EA3BgB,eAAe,+BAAf,eAAe,QA2B/B"}