@anatix/runtime 1.0.8 → 1.0.9
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/dist/security/index.d.ts +1 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/security.config.d.ts +2 -0
- package/dist/security/security.config.d.ts.map +1 -1
- package/dist/security/security.config.js.map +1 -1
- package/dist/security/security.module.d.ts +6 -0
- package/dist/security/security.module.d.ts.map +1 -0
- package/dist/security/security.module.js +70 -0
- package/dist/security/security.module.js.map +1 -0
- package/package.json +4 -4
package/dist/security/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
|
package/dist/security/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./interfaces"), exports);
|
|
18
18
|
__exportStar(require("./tokens"), exports);
|
|
19
19
|
__exportStar(require("./security.config"), exports);
|
|
20
|
+
__exportStar(require("./security.module"), exports);
|
|
20
21
|
__exportStar(require("./bcrypt.adapter"), exports);
|
|
21
22
|
__exportStar(require("./aes.adapter"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+CAA6B;AAG7B,2CAAyB;AAGzB,oDAAkC;AAGlC,mDAAiC;AACjC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,+CAA6B;AAG7B,2CAAyB;AAGzB,oDAAkC;AAGlC,oDAAkC;AAGlC,mDAAiC;AACjC,gDAA8B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface SecurityConfig {
|
|
2
2
|
hashSaltRounds?: number;
|
|
3
|
+
hashingAdapter?: import('./interfaces').HashingAdapter | (new (...args: any[]) => import('./interfaces').HashingAdapter);
|
|
3
4
|
encryptionKey?: string | Buffer;
|
|
5
|
+
encryptionAdapter?: import('./interfaces').EncryptionAdapter | (new (...args: any[]) => import('./interfaces').EncryptionAdapter);
|
|
4
6
|
}
|
|
5
7
|
export declare const SECURITY_CONFIG = "SECURITY_CONFIG";
|
|
6
8
|
export declare const defaultSecurityConfig: SecurityConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.config.d.ts","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security.config.d.ts","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,cAAc;IAM7B,cAAc,CAAC,EAAE,MAAM,CAAC;IAMxB,cAAc,CAAC,EAAE,OAAO,cAAc,EAAE,cAAc,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,cAAc,EAAE,cAAc,CAAC,CAAC;IAkBzH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAMhC,iBAAiB,CAAC,EAAE,OAAO,cAAc,EAAE,iBAAiB,GAAG,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,cAAc,EAAE,iBAAiB,CAAC,CAAC;CACnI;AAGD,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAQjD,eAAO,MAAM,qBAAqB,EAAE,cAInC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.config.js","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"security.config.js","sourceRoot":"","sources":["../../src/security/security.config.ts"],"names":[],"mappings":";;;AAgEa,QAAA,eAAe,GAAG,iBAAiB,CAAC;AAQpC,QAAA,qBAAqB,GAAmB;IACnD,cAAc,EAAE,EAAE;IAElB,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;CAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.module.d.ts","sourceRoot":"","sources":["../../src/security/security.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAsCxD,qBAEa,cAAc;IACzB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,aAAa;CA+BvD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var SecurityModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SecurityModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const security_config_1 = require("./security.config");
|
|
13
|
+
const tokens_1 = require("./tokens");
|
|
14
|
+
const bcrypt_adapter_1 = require("./bcrypt.adapter");
|
|
15
|
+
const aes_adapter_1 = require("./aes.adapter");
|
|
16
|
+
function resolveAdapter(adapter, config, factory) {
|
|
17
|
+
if (adapter) {
|
|
18
|
+
if (typeof adapter === 'function') {
|
|
19
|
+
try {
|
|
20
|
+
return new adapter(config);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return new adapter();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return adapter;
|
|
27
|
+
}
|
|
28
|
+
if (factory)
|
|
29
|
+
return factory();
|
|
30
|
+
throw new Error('SecurityModule: adapter resolution failed');
|
|
31
|
+
}
|
|
32
|
+
function mergeSecurityConfig(input) {
|
|
33
|
+
const base = { ...security_config_1.defaultSecurityConfig };
|
|
34
|
+
const envKey = process.env.ENCRYPTION_KEY;
|
|
35
|
+
if (envKey) {
|
|
36
|
+
base.encryptionKey = envKey;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
...base,
|
|
40
|
+
...(input ?? {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
let SecurityModule = SecurityModule_1 = class SecurityModule {
|
|
44
|
+
static forRoot(config) {
|
|
45
|
+
const merged = mergeSecurityConfig(config);
|
|
46
|
+
return {
|
|
47
|
+
module: SecurityModule_1,
|
|
48
|
+
providers: [
|
|
49
|
+
{ provide: security_config_1.SECURITY_CONFIG, useValue: merged },
|
|
50
|
+
{
|
|
51
|
+
provide: tokens_1.HASHING_ADAPTER,
|
|
52
|
+
useFactory: (cfg) => resolveAdapter(cfg.hashingAdapter, cfg, () => new bcrypt_adapter_1.BcryptAdapter(cfg)),
|
|
53
|
+
inject: [security_config_1.SECURITY_CONFIG],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
provide: tokens_1.ENCRYPTION_ADAPTER,
|
|
57
|
+
useFactory: (cfg) => resolveAdapter(cfg.encryptionAdapter, cfg, () => new aes_adapter_1.AesAdapter(cfg)),
|
|
58
|
+
inject: [security_config_1.SECURITY_CONFIG],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
exports: [security_config_1.SECURITY_CONFIG, tokens_1.HASHING_ADAPTER, tokens_1.ENCRYPTION_ADAPTER],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.SecurityModule = SecurityModule;
|
|
66
|
+
exports.SecurityModule = SecurityModule = SecurityModule_1 = __decorate([
|
|
67
|
+
(0, common_1.Global)(),
|
|
68
|
+
(0, common_1.Module)({})
|
|
69
|
+
], SecurityModule);
|
|
70
|
+
//# sourceMappingURL=security.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.module.js","sourceRoot":"","sources":["../../src/security/security.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAE/D,uDAA2E;AAC3E,qCAA+D;AAC/D,qDAAiD;AACjD,+CAA2C;AAG3C,SAAS,cAAc,CACrB,OAAyC,EACzC,MAAuB,EACvB,OAAiB;IAEjB,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,OAAO,IAAK,OAAe,CAAC,MAAM,CAAC,CAAC;YACtC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAK,OAAe,EAAE,CAAC;YAChC,CAAC;QACH,CAAC;QACD,OAAO,OAAY,CAAC;IACtB,CAAC;IACD,IAAI,OAAO;QAAE,OAAO,OAAO,EAAE,CAAC;IAC9B,MAAM,IAAI,KAAK,CAAC,2CAA2C,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ACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAgC1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anatix/runtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Runtime infrastructure for Anatix-generated microservices",
|
|
5
5
|
"author": "Anatix Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"prom-client": "^15.1.3",
|
|
151
151
|
"reflect-metadata": "^0.2.2",
|
|
152
152
|
"rimraf": "^6.0.1",
|
|
153
|
-
"rxjs": "^7.8.
|
|
153
|
+
"rxjs": "^7.8.2",
|
|
154
154
|
"typeorm": "^0.3.20",
|
|
155
155
|
"typescript": "^5.7.2",
|
|
156
156
|
"uuid": "^11.0.0"
|
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
},
|
|
184
184
|
"homepage": "https://github.com/anatix/anatix-runtime#readme",
|
|
185
185
|
"dependencies": {
|
|
186
|
+
"bcryptjs": "^2.4.3",
|
|
186
187
|
"kafkajs": "^2.2.4",
|
|
187
|
-
"
|
|
188
|
-
"prom-client": "^15.1.0"
|
|
188
|
+
"prom-client": "^14.0.0 || ^15.0.0"
|
|
189
189
|
}
|
|
190
190
|
}
|