@nestia/core 2.4.4 → 2.4.5-dev.20240114
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.
|
@@ -30,7 +30,7 @@ import { Module } from "@nestjs/common";
|
|
|
30
30
|
*
|
|
31
31
|
* @author Jeongho Nam - https://github.com/samchon
|
|
32
32
|
*/
|
|
33
|
-
export declare function EncryptedModule(metadata: Parameters<typeof Module>[0], password: IEncryptionPassword
|
|
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.
|
|
@@ -100,24 +100,8 @@ var load_controller_1 = require("./internal/load_controller");
|
|
|
100
100
|
*/
|
|
101
101
|
function EncryptedModule(metadata, password) {
|
|
102
102
|
return function (target) {
|
|
103
|
-
var e_1, _a;
|
|
104
103
|
(0, common_1.Module)(metadata)(target);
|
|
105
|
-
|
|
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
|
-
}
|
|
104
|
+
iterate(password)(target);
|
|
121
105
|
};
|
|
122
106
|
}
|
|
123
107
|
exports.EncryptedModule = EncryptedModule;
|
|
@@ -148,7 +132,7 @@ exports.EncryptedModule = EncryptedModule;
|
|
|
148
132
|
function NestiaModule() {
|
|
149
133
|
}
|
|
150
134
|
NestiaModule = __decorate([
|
|
151
|
-
EncryptedModule(__assign(__assign({}, options), { controllers: controllers }), password)
|
|
135
|
+
EncryptedModule(__assign(__assign({}, options), { controllers: controllers }), typeof password === "object" ? function () { return password; } : password)
|
|
152
136
|
], NestiaModule);
|
|
153
137
|
return NestiaModule;
|
|
154
138
|
}());
|
|
@@ -159,4 +143,41 @@ exports.EncryptedModule = EncryptedModule;
|
|
|
159
143
|
}
|
|
160
144
|
EncryptedModule.dynamic = dynamic;
|
|
161
145
|
})(EncryptedModule || (exports.EncryptedModule = EncryptedModule = {}));
|
|
146
|
+
var iterate = function (password) {
|
|
147
|
+
return function (modulo) {
|
|
148
|
+
var e_1, _a, e_2, _b;
|
|
149
|
+
var imports = Reflect.getMetadata("imports", modulo);
|
|
150
|
+
if (Array.isArray(imports))
|
|
151
|
+
try {
|
|
152
|
+
for (var imports_1 = __values(imports), imports_1_1 = imports_1.next(); !imports_1_1.done; imports_1_1 = imports_1.next()) {
|
|
153
|
+
var imp = imports_1_1.value;
|
|
154
|
+
if (typeof imp === "function")
|
|
155
|
+
iterate(password)(imp);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
159
|
+
finally {
|
|
160
|
+
try {
|
|
161
|
+
if (imports_1_1 && !imports_1_1.done && (_a = imports_1.return)) _a.call(imports_1);
|
|
162
|
+
}
|
|
163
|
+
finally { if (e_1) throw e_1.error; }
|
|
164
|
+
}
|
|
165
|
+
var controllers = Reflect.getMetadata("controllers", modulo);
|
|
166
|
+
if (Array.isArray(controllers))
|
|
167
|
+
try {
|
|
168
|
+
for (var controllers_1 = __values(controllers), controllers_1_1 = controllers_1.next(); !controllers_1_1.done; controllers_1_1 = controllers_1.next()) {
|
|
169
|
+
var c = controllers_1_1.value;
|
|
170
|
+
if (typeof c === "function")
|
|
171
|
+
Reflect.defineMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, password, c);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
175
|
+
finally {
|
|
176
|
+
try {
|
|
177
|
+
if (controllers_1_1 && !controllers_1_1.done && (_b = controllers_1.return)) _b.call(controllers_1);
|
|
178
|
+
}
|
|
179
|
+
finally { if (e_2) throw e_2.error; }
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
};
|
|
162
183
|
//# 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,CAC7B,QAAsC,EACtC,
|
|
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,CAC7B,QAAsC,EACtC,QAAqC;IAErC,OAAO,UAAU,MAAW;QAC1B,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;QACzB,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC;AARD,0CAQC;AAED,WAAiB,eAAe;IAC9B;;;;;;;;;;;;OAYG;IACH,SAAsB,OAAO,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AAA;IACrE,CAAC;AAXD,CAWC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/core",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.5-dev.20240114",
|
|
4
4
|
"description": "Super-fast validation decorators of NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://nestia.io",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@nestia/fetcher": "^2.4.
|
|
41
|
+
"@nestia/fetcher": "^2.4.5-dev.20240114",
|
|
42
42
|
"@nestjs/common": ">=7.0.1",
|
|
43
43
|
"@nestjs/core": ">=7.0.1",
|
|
44
44
|
"@nestjs/platform-express": ">=7.0.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typia": "^5.3.9"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@nestia/fetcher": ">=2.4.
|
|
54
|
+
"@nestia/fetcher": ">=2.4.5-dev.20240114",
|
|
55
55
|
"@nestjs/common": ">=7.0.1",
|
|
56
56
|
"@nestjs/core": ">=7.0.1",
|
|
57
57
|
"@nestjs/platform-express": ">=7.0.1",
|
|
@@ -37,15 +37,11 @@ import { load_controllers } from "./internal/load_controller";
|
|
|
37
37
|
*/
|
|
38
38
|
export function EncryptedModule(
|
|
39
39
|
metadata: Parameters<typeof Module>[0],
|
|
40
|
-
password: IEncryptionPassword
|
|
40
|
+
password: IEncryptionPassword.Closure,
|
|
41
41
|
): ClassDecorator {
|
|
42
42
|
return function (target: any) {
|
|
43
43
|
Module(metadata)(target);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (const c of metadata.controllers)
|
|
47
|
-
if (Reflect.hasMetadata(ENCRYPTION_METADATA_KEY, c) === false)
|
|
48
|
-
Reflect.defineMetadata(ENCRYPTION_METADATA_KEY, password, c);
|
|
44
|
+
iterate(password)(target);
|
|
49
45
|
};
|
|
50
46
|
}
|
|
51
47
|
|
|
@@ -72,8 +68,26 @@ export namespace EncryptedModule {
|
|
|
72
68
|
const controllers: Creator<object>[] = await load_controllers(path);
|
|
73
69
|
|
|
74
70
|
// RETURNS WITH DECORATING
|
|
75
|
-
@EncryptedModule(
|
|
71
|
+
@EncryptedModule(
|
|
72
|
+
{ ...options, controllers },
|
|
73
|
+
typeof password === "object" ? () => password : password,
|
|
74
|
+
)
|
|
76
75
|
class NestiaModule {}
|
|
77
76
|
return NestiaModule;
|
|
78
77
|
}
|
|
79
78
|
}
|
|
79
|
+
|
|
80
|
+
const iterate =
|
|
81
|
+
(password: IEncryptionPassword.Closure) =>
|
|
82
|
+
(modulo: any): void => {
|
|
83
|
+
const imports = Reflect.getMetadata("imports", modulo);
|
|
84
|
+
if (Array.isArray(imports))
|
|
85
|
+
for (const imp of imports)
|
|
86
|
+
if (typeof imp === "function") iterate(password)(imp);
|
|
87
|
+
|
|
88
|
+
const controllers = Reflect.getMetadata("controllers", modulo);
|
|
89
|
+
if (Array.isArray(controllers))
|
|
90
|
+
for (const c of controllers)
|
|
91
|
+
if (typeof c === "function")
|
|
92
|
+
Reflect.defineMetadata(ENCRYPTION_METADATA_KEY, password, c);
|
|
93
|
+
};
|