@floracodex/nestjs-secrets 1.0.3 → 1.1.0

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 (31) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +22 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/interfaces/secrets-loader-options.interface.d.ts +12 -0
  5. package/dist/interfaces/secrets-loader-options.interface.js +3 -0
  6. package/dist/interfaces/secrets-loader-options.interface.js.map +1 -0
  7. package/dist/interfaces/secrets-module-options.interface.d.ts +4 -0
  8. package/dist/interfaces/secrets-module-options.interface.js +3 -0
  9. package/dist/interfaces/secrets-module-options.interface.js.map +1 -0
  10. package/dist/interfaces/secrets-provider.interface.d.ts +26 -0
  11. package/dist/interfaces/secrets-provider.interface.js +10 -0
  12. package/dist/interfaces/secrets-provider.interface.js.map +1 -0
  13. package/dist/modules/secrets.module.d.ts +5 -0
  14. package/dist/modules/secrets.module.js +37 -0
  15. package/dist/modules/secrets.module.js.map +1 -0
  16. package/dist/providers/aws-parameter-store.provider.d.ts +39 -0
  17. package/dist/providers/aws-parameter-store.provider.js +98 -0
  18. package/dist/providers/aws-parameter-store.provider.js.map +1 -0
  19. package/dist/providers/aws-secrets-manager.provider.d.ts +30 -0
  20. package/dist/providers/aws-secrets-manager.provider.js +65 -0
  21. package/dist/providers/aws-secrets-manager.provider.js.map +1 -0
  22. package/dist/providers/azure-key-vault.provider.d.ts +34 -0
  23. package/dist/providers/azure-key-vault.provider.js +74 -0
  24. package/dist/providers/azure-key-vault.provider.js.map +1 -0
  25. package/dist/providers/google-secret-manager.provider.d.ts +25 -0
  26. package/dist/providers/google-secret-manager.provider.js +63 -0
  27. package/dist/providers/google-secret-manager.provider.js.map +1 -0
  28. package/dist/services/secrets-loader.service.d.ts +58 -0
  29. package/dist/services/secrets-loader.service.js +249 -0
  30. package/dist/services/secrets-loader.service.js.map +1 -0
  31. package/package.json +20 -20
@@ -0,0 +1,5 @@
1
+ export * from './interfaces/secrets-loader-options.interface';
2
+ export * from './interfaces/secrets-module-options.interface';
3
+ export * from './interfaces/secrets-provider.interface';
4
+ export * from './modules/secrets.module';
5
+ export * from './services/secrets-loader.service';
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces/secrets-loader-options.interface"), exports);
18
+ __exportStar(require("./interfaces/secrets-module-options.interface"), exports);
19
+ __exportStar(require("./interfaces/secrets-provider.interface"), exports);
20
+ __exportStar(require("./modules/secrets.module"), exports);
21
+ __exportStar(require("./services/secrets-loader.service"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gFAA8D;AAC9D,gFAA8D;AAC9D,0EAAwD;AACxD,2DAAyC;AACzC,oEAAkD"}
@@ -0,0 +1,12 @@
1
+ import { type SecretsProvider, type SecretsProviderType } from './secrets-provider.interface';
2
+ export interface SecretsLoaderOptions {
3
+ provider?: SecretsProviderType | SecretsProvider;
4
+ client?: any;
5
+ /**
6
+ * Base directory for config files (absolute or relative). If relative and not specified, defaults to
7
+ * <app_root>/config. If just a directory name is given (e.g. 'config'), it's resolved relative to app root
8
+ */
9
+ root?: string;
10
+ files: string[];
11
+ fileType?: 'yaml' | 'json';
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=secrets-loader-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-loader-options.interface.js","sourceRoot":"","sources":["../../src/interfaces/secrets-loader-options.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { type ConfigModuleOptions } from '@nestjs/config';
2
+ import { type SecretsLoaderOptions } from './secrets-loader-options.interface';
3
+ export interface SecretsModuleOptions extends ConfigModuleOptions, SecretsLoaderOptions {
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=secrets-module-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-module-options.interface.js","sourceRoot":"","sources":["../../src/interfaces/secrets-module-options.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Interface for secret providers
3
+ */
4
+ export declare abstract class SecretsProvider {
5
+ /**
6
+ * Checks if a string is a valid secret reference for this provider
7
+ * @param value The string to check
8
+ * @returns True if the string is a valid secret reference
9
+ */
10
+ abstract isSecretReference(value: string): boolean;
11
+ /**
12
+ * Resolves a secret reference to its actual value.
13
+ * @param secretRef The reference to the secret
14
+ * @returns The resolved secret value (string or array of strings)
15
+ * @throws Error when the secret cannot be retrieved or has an invalid format
16
+ */
17
+ abstract resolveSecret(secretRef: string): Promise<string | string[]>;
18
+ }
19
+ /**
20
+ * The secret providers included with this library.
21
+ *
22
+ * Note: You can also use a custom provider by passing an instance of your provider class to the SecretsLoaderService.
23
+ * Open a PR or reach out to us at support@floracodex.com if you implement your own provider. We'd love to officially
24
+ * support it if it makes sense to add it to this list.
25
+ */
26
+ export type SecretsProviderType = 'AwsParameterStoreProvider' | 'AwsSecretsManagerProvider' | 'AzureKeyVaultProvider' | 'GoogleSecretManagerProvider';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecretsProvider = void 0;
4
+ /**
5
+ * Interface for secret providers
6
+ */
7
+ class SecretsProvider {
8
+ }
9
+ exports.SecretsProvider = SecretsProvider;
10
+ //# sourceMappingURL=secrets-provider.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-provider.interface.js","sourceRoot":"","sources":["../../src/interfaces/secrets-provider.interface.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAsB,eAAe;CAepC;AAfD,0CAeC"}
@@ -0,0 +1,5 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import { SecretsModuleOptions } from '../interfaces/secrets-module-options.interface';
3
+ export declare class SecretsModule {
4
+ static forRoot(options: SecretsModuleOptions): Promise<DynamicModule>;
5
+ }
@@ -0,0 +1,37 @@
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 SecretsModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SecretsModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const config_1 = require("@nestjs/config");
13
+ const secrets_loader_service_1 = require("../services/secrets-loader.service");
14
+ let SecretsModule = SecretsModule_1 = class SecretsModule {
15
+ static async forRoot(options) {
16
+ const secretsLoaderService = new secrets_loader_service_1.SecretsLoaderService();
17
+ const configFactory = secretsLoaderService.createConfigFactory(options);
18
+ return {
19
+ module: SecretsModule_1,
20
+ imports: [
21
+ await config_1.ConfigModule.forRoot({
22
+ ...options,
23
+ load: [configFactory],
24
+ // Override any options that we handle ourselves
25
+ ignoreEnvFile: true
26
+ })
27
+ ],
28
+ exports: [config_1.ConfigModule]
29
+ };
30
+ }
31
+ };
32
+ exports.SecretsModule = SecretsModule;
33
+ exports.SecretsModule = SecretsModule = SecretsModule_1 = __decorate([
34
+ (0, common_1.Global)(),
35
+ (0, common_1.Module)({})
36
+ ], SecretsModule);
37
+ //# sourceMappingURL=secrets.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.module.js","sourceRoot":"","sources":["../../src/modules/secrets.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA6D;AAC7D,2CAA4C;AAC5C,+EAAwE;AAKjE,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACtB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAA6B;QAC9C,MAAM,oBAAoB,GAAG,IAAI,6CAAoB,EAAE,CAAC;QACxD,MAAM,aAAa,GAAG,oBAAoB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAExE,OAAO;YACH,MAAM,EAAE,eAAa;YACrB,OAAO,EAAE;gBACL,MAAM,qBAAY,CAAC,OAAO,CAAC;oBACvB,GAAG,OAAO;oBACV,IAAI,EAAE,CAAC,aAAa,CAAC;oBACrB,gDAAgD;oBAChD,aAAa,EAAE,IAAI;iBACtB,CAAC;aACL;YACD,OAAO,EAAE,CAAC,qBAAY,CAAC;SAC1B,CAAC;IACN,CAAC;CACJ,CAAA;AAlBY,sCAAa;wBAAb,aAAa;IAFzB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,aAAa,CAkBzB"}
@@ -0,0 +1,39 @@
1
+ import { SSMClient } from '@aws-sdk/client-ssm';
2
+ import { SecretsProvider } from '../interfaces/secrets-provider.interface';
3
+ export declare class AwsParameterStoreProvider implements SecretsProvider {
4
+ private readonly client;
5
+ private readonly logger;
6
+ /**
7
+ * Regular expression to validate AWS Parameter Store paths.
8
+ * Matches either:
9
+ * - Path format: /path/to/parameter
10
+ * - ARN format: arn:aws:ssm:region:account:parameter/path/to/parameter
11
+ */
12
+ private readonly parameterPathPattern;
13
+ constructor(client: SSMClient);
14
+ /**
15
+ * Checks if a string is a valid Parameter Store reference.
16
+ * @param value The string to check
17
+ * @returns True if the string is a valid Parameter Store reference
18
+ */
19
+ isSecretReference(value: string): boolean;
20
+ /**
21
+ * Resolves a Parameter Store reference to its actual value
22
+ * @param secretRef The reference to the secret in AWS Parameter Store
23
+ * @returns The resolved secret value as a string
24
+ * @throws Error when the secret cannot be retrieved or has an invalid format
25
+ */
26
+ resolveSecret(secretRef: string): Promise<string | string[]>;
27
+ /**
28
+ * Retrieves all parameters under a specific path.
29
+ * @param pathRef The parameter path reference ending with '/*'
30
+ * @returns Array of parameter values
31
+ */
32
+ private retrieveParametersByPath;
33
+ /**
34
+ * Retrieves a single parameter by name.
35
+ * @param paramName The parameter name or ARN
36
+ * @returns The parameter value
37
+ */
38
+ private retrieveSingleParameter;
39
+ }
@@ -0,0 +1,98 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var AwsParameterStoreProvider_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AwsParameterStoreProvider = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const client_ssm_1 = require("@aws-sdk/client-ssm");
16
+ let AwsParameterStoreProvider = AwsParameterStoreProvider_1 = class AwsParameterStoreProvider {
17
+ client;
18
+ logger = new common_1.Logger(AwsParameterStoreProvider_1.name);
19
+ /**
20
+ * Regular expression to validate AWS Parameter Store paths.
21
+ * Matches either:
22
+ * - Path format: /path/to/parameter
23
+ * - ARN format: arn:aws:ssm:region:account:parameter/path/to/parameter
24
+ */
25
+ parameterPathPattern = /^(?:\/[a-zA-Z0-9_./-]+|arn:[a-z-]+:ssm:[a-z0-9-]+:\d{12}:parameter\/[a-zA-Z0-9_./-]+)$/;
26
+ constructor(client) {
27
+ this.client = client;
28
+ }
29
+ /**
30
+ * Checks if a string is a valid Parameter Store reference.
31
+ * @param value The string to check
32
+ * @returns True if the string is a valid Parameter Store reference
33
+ */
34
+ isSecretReference(value) {
35
+ return this.parameterPathPattern.test(value);
36
+ }
37
+ /**
38
+ * Resolves a Parameter Store reference to its actual value
39
+ * @param secretRef The reference to the secret in AWS Parameter Store
40
+ * @returns The resolved secret value as a string
41
+ * @throws Error when the secret cannot be retrieved or has an invalid format
42
+ */
43
+ async resolveSecret(secretRef) {
44
+ if (secretRef.endsWith('/*')) {
45
+ return await this.retrieveParametersByPath(secretRef);
46
+ }
47
+ return await this.retrieveSingleParameter(secretRef);
48
+ }
49
+ /**
50
+ * Retrieves all parameters under a specific path.
51
+ * @param pathRef The parameter path reference ending with '/*'
52
+ * @returns Array of parameter values
53
+ */
54
+ async retrieveParametersByPath(pathRef) {
55
+ const basePath = pathRef.slice(0, -2);
56
+ const command = new client_ssm_1.GetParametersByPathCommand({
57
+ Path: basePath,
58
+ WithDecryption: true,
59
+ Recursive: true
60
+ });
61
+ const response = await this.client.send(command);
62
+ if (!response.Parameters || response.Parameters.length === 0) {
63
+ throw new Error(`No parameters found at path: ${basePath}`);
64
+ }
65
+ return response.Parameters.map((param) => {
66
+ if (!param.Value) {
67
+ this.logger.warn(`Parameter ${param.Name} has no value`);
68
+ return '';
69
+ }
70
+ return param.Value;
71
+ }).filter(Boolean);
72
+ }
73
+ /**
74
+ * Retrieves a single parameter by name.
75
+ * @param paramName The parameter name or ARN
76
+ * @returns The parameter value
77
+ */
78
+ async retrieveSingleParameter(paramName) {
79
+ const command = new client_ssm_1.GetParameterCommand({
80
+ Name: paramName,
81
+ WithDecryption: true
82
+ });
83
+ const response = await this.client.send(command);
84
+ if (!response.Parameter) {
85
+ throw new Error(`Parameter not found: ${paramName}`);
86
+ }
87
+ if (!response.Parameter.Value) {
88
+ throw new Error(`Parameter value is empty for: ${paramName}`);
89
+ }
90
+ return response.Parameter.Value;
91
+ }
92
+ };
93
+ exports.AwsParameterStoreProvider = AwsParameterStoreProvider;
94
+ exports.AwsParameterStoreProvider = AwsParameterStoreProvider = AwsParameterStoreProvider_1 = __decorate([
95
+ (0, common_1.Injectable)(),
96
+ __metadata("design:paramtypes", [client_ssm_1.SSMClient])
97
+ ], AwsParameterStoreProvider);
98
+ //# sourceMappingURL=aws-parameter-store.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-parameter-store.provider.js","sourceRoot":"","sources":["../../src/providers/aws-parameter-store.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAkD;AAClD,oDAA0G;AAInG,IAAM,yBAAyB,iCAA/B,MAAM,yBAAyB;IAWL;IAVZ,MAAM,GAAG,IAAI,eAAM,CAAC,2BAAyB,CAAC,IAAI,CAAC,CAAC;IAErE;;;;;OAKG;IACc,oBAAoB,GAAG,wFAAwF,CAAC;IAEjI,YAA6B,MAAiB;QAAjB,WAAM,GAAN,MAAM,CAAW;IAC9C,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;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;YACpC,IAAI,EAAE,SAAS;YACf,cAAc,EAAE,IAAI;SACvB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjD,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;IACpC,CAAC;CACJ,CAAA;AAzFY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAY4B,sBAAS;GAXrC,yBAAyB,CAyFrC"}
@@ -0,0 +1,30 @@
1
+ import { SecretsManager } from '@aws-sdk/client-secrets-manager';
2
+ import { SecretsProvider } from '../interfaces/secrets-provider.interface';
3
+ export declare class AwsSecretsManagerProvider implements SecretsProvider {
4
+ private readonly client;
5
+ private readonly logger;
6
+ /**
7
+ * Regular expression pattern for validating AWS Secrets Manager ARNs
8
+ */
9
+ private readonly arnPattern;
10
+ constructor(client: SecretsManager);
11
+ /**
12
+ * Checks if a string is a valid AWS Secrets Manager ARN.
13
+ * @param value The string to check
14
+ * @returns True if the string is a valid AWS Secrets Manager ARN
15
+ */
16
+ isSecretReference(value: string): boolean;
17
+ /**
18
+ * Resolves an AWS Secrets Manager ARN to its actual value
19
+ * @param secretRef The AWS Secrets Manager ARN
20
+ * @returns The resolved secret value as a string
21
+ * @throws Error when the secret cannot be retrieved or has an invalid format
22
+ */
23
+ resolveSecret(secretRef: string): Promise<string>;
24
+ /**
25
+ * Decodes a binary secret to a string.
26
+ * @param binaryData The binary data to decode
27
+ * @returns The decoded string
28
+ */
29
+ private decodeBinarySecret;
30
+ }
@@ -0,0 +1,65 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var AwsSecretsManagerProvider_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AwsSecretsManagerProvider = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
16
+ let AwsSecretsManagerProvider = AwsSecretsManagerProvider_1 = class AwsSecretsManagerProvider {
17
+ client;
18
+ logger = new common_1.Logger(AwsSecretsManagerProvider_1.name);
19
+ /**
20
+ * Regular expression pattern for validating AWS Secrets Manager ARNs
21
+ */
22
+ arnPattern = /^arn:aws:secretsmanager:[a-z0-9-]+:[0-9]+:secret:.+$/;
23
+ constructor(client) {
24
+ this.client = client;
25
+ }
26
+ /**
27
+ * Checks if a string is a valid AWS Secrets Manager ARN.
28
+ * @param value The string to check
29
+ * @returns True if the string is a valid AWS Secrets Manager ARN
30
+ */
31
+ isSecretReference(value) {
32
+ return this.arnPattern.test(value);
33
+ }
34
+ /**
35
+ * Resolves an AWS Secrets Manager ARN to its actual value
36
+ * @param secretRef The AWS Secrets Manager ARN
37
+ * @returns The resolved secret value as a string
38
+ * @throws Error when the secret cannot be retrieved or has an invalid format
39
+ */
40
+ async resolveSecret(secretRef) {
41
+ const response = await this.client.getSecretValue({ SecretId: secretRef });
42
+ if (response.SecretString) {
43
+ return response.SecretString;
44
+ }
45
+ else if (response.SecretBinary) {
46
+ return this.decodeBinarySecret(response.SecretBinary);
47
+ }
48
+ throw new Error('Secret value is empty');
49
+ }
50
+ /**
51
+ * Decodes a binary secret to a string.
52
+ * @param binaryData The binary data to decode
53
+ * @returns The decoded string
54
+ */
55
+ decodeBinarySecret(binaryData) {
56
+ const buff = Buffer.from(binaryData, 'base64');
57
+ return buff.toString('utf8');
58
+ }
59
+ };
60
+ exports.AwsSecretsManagerProvider = AwsSecretsManagerProvider;
61
+ exports.AwsSecretsManagerProvider = AwsSecretsManagerProvider = AwsSecretsManagerProvider_1 = __decorate([
62
+ (0, common_1.Injectable)(),
63
+ __metadata("design:paramtypes", [client_secrets_manager_1.SecretsManager])
64
+ ], AwsSecretsManagerProvider);
65
+ //# sourceMappingURL=aws-secrets-manager.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-secrets-manager.provider.js","sourceRoot":"","sources":["../../src/providers/aws-secrets-manager.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAkD;AAClD,4EAA+D;AAIxD,IAAM,yBAAyB,iCAA/B,MAAM,yBAAyB;IAQL;IAPZ,MAAM,GAAG,IAAI,eAAM,CAAC,2BAAyB,CAAC,IAAI,CAAC,CAAC;IAErE;;OAEG;IACc,UAAU,GAAG,sDAAsD,CAAC;IAErF,YAA6B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IACnD,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAC,CAAC,CAAC;QAEzE,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YACxB,OAAO,QAAQ,CAAC,YAAY,CAAC;QACjC,CAAC;aAAM,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC1D,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACK,kBAAkB,CAAC,UAAe;QACtC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,UAA+B,EAAE,QAAQ,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;CAEJ,CAAA;AAhDY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAS4B,uCAAc;GAR1C,yBAAyB,CAgDrC"}
@@ -0,0 +1,34 @@
1
+ import { SecretClient } from '@azure/keyvault-secrets';
2
+ import { SecretsProvider } from '../interfaces/secrets-provider.interface';
3
+ export declare class AzureKeyVaultProvider implements SecretsProvider {
4
+ private readonly client;
5
+ private readonly logger;
6
+ /**
7
+ * Regular expression to validate Azure Vault paths.
8
+ * - Standard format: https://<vault-name>.vault.azure.net/secrets/<secret-name>
9
+ * - With versions: https://<vault-name>.vault.azure.net/secrets/<secret-name>/<version>
10
+ * - With paths in secret names: https://<vault-name>.vault.azure.net/secrets/<path>/<secret-name>
11
+ */
12
+ private readonly secretUrlPattern;
13
+ constructor(client: SecretClient);
14
+ /**
15
+ * Checks if the provided string is a valid Azure Key Vault secret reference.
16
+ * @param value The string to check
17
+ * @returns True if the string is a valid Azure Key Vault secret reference
18
+ */
19
+ isSecretReference(value: string): boolean;
20
+ /**
21
+ * Resolves an Azure Key Vault secret reference to its actual value.
22
+ * @param secretRef The reference URL to the secret (https://<vault-name>.vault.azure.net/secrets/<secret-name>[/<version>])
23
+ * @returns The resolved secret value as a string
24
+ * @throws Error when the secret reference is invalid or cannot be retrieved
25
+ */
26
+ resolveSecret(secretRef: string): Promise<string>;
27
+ /**
28
+ * Parses an Azure Key Vault secret reference and extracts the secret name.
29
+ * @param secretRef The Azure Key Vault secret reference URL
30
+ * @returns The extracted secret name
31
+ * @throws Error when the secret reference format is invalid
32
+ */
33
+ private parseSecretReference;
34
+ }
@@ -0,0 +1,74 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var AzureKeyVaultProvider_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AzureKeyVaultProvider = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const keyvault_secrets_1 = require("@azure/keyvault-secrets");
16
+ let AzureKeyVaultProvider = AzureKeyVaultProvider_1 = class AzureKeyVaultProvider {
17
+ client;
18
+ logger = new common_1.Logger(AzureKeyVaultProvider_1.name);
19
+ /**
20
+ * Regular expression to validate Azure Vault paths.
21
+ * - Standard format: https://<vault-name>.vault.azure.net/secrets/<secret-name>
22
+ * - With versions: https://<vault-name>.vault.azure.net/secrets/<secret-name>/<version>
23
+ * - With paths in secret names: https://<vault-name>.vault.azure.net/secrets/<path>/<secret-name>
24
+ */
25
+ secretUrlPattern = /^https:\/\/[\w-]+\.vault\.azure\.net\/secrets\/([^/\s]+)(?:\/([^/\s]+))?$/;
26
+ constructor(client) {
27
+ this.client = client;
28
+ }
29
+ /**
30
+ * Checks if the provided string is a valid Azure Key Vault secret reference.
31
+ * @param value The string to check
32
+ * @returns True if the string is a valid Azure Key Vault secret reference
33
+ */
34
+ isSecretReference(value) {
35
+ return this.secretUrlPattern.test(value);
36
+ }
37
+ /**
38
+ * Resolves an Azure Key Vault secret reference to its actual value.
39
+ * @param secretRef The reference URL to the secret (https://<vault-name>.vault.azure.net/secrets/<secret-name>[/<version>])
40
+ * @returns The resolved secret value as a string
41
+ * @throws Error when the secret reference is invalid or cannot be retrieved
42
+ */
43
+ async resolveSecret(secretRef) {
44
+ const secretName = this.parseSecretReference(secretRef);
45
+ const response = await this.client.getSecret(secretName);
46
+ if (!response || !response.value) {
47
+ throw new Error(`Secret '${secretName}' was retrieved but has an empty value`);
48
+ }
49
+ return response.value;
50
+ }
51
+ /**
52
+ * Parses an Azure Key Vault secret reference and extracts the secret name.
53
+ * @param secretRef The Azure Key Vault secret reference URL
54
+ * @returns The extracted secret name
55
+ * @throws Error when the secret reference format is invalid
56
+ */
57
+ parseSecretReference(secretRef) {
58
+ const match = secretRef.match(this.secretUrlPattern);
59
+ if (!match) {
60
+ throw new Error(`Invalid Azure Key Vault secret reference: ${secretRef}. Expected format: https://<vault-name>.vault.azure.net/secrets/<secret-name>[/<version>]`);
61
+ }
62
+ // Extract the vault name (match[0]) and secret name (match[1])
63
+ const vaultName = match[0];
64
+ const secretName = match[1];
65
+ this.logger.debug(`Parsed secret reference from vault: ${vaultName}, secret: ${secretName}`);
66
+ return secretName;
67
+ }
68
+ };
69
+ exports.AzureKeyVaultProvider = AzureKeyVaultProvider;
70
+ exports.AzureKeyVaultProvider = AzureKeyVaultProvider = AzureKeyVaultProvider_1 = __decorate([
71
+ (0, common_1.Injectable)(),
72
+ __metadata("design:paramtypes", [keyvault_secrets_1.SecretClient])
73
+ ], AzureKeyVaultProvider);
74
+ //# sourceMappingURL=azure-key-vault.provider.js.map
@@ -0,0 +1 @@
1
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AC,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,SAAS,aAAa,UAAU,EAAE,CAAC,CAAC;QAC7F,OAAO,UAAU,CAAC;IACtB,CAAC;CAEJ,CAAA;AA9DY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAY4B,+BAAY;GAXxC,qBAAqB,CA8DjC"}
@@ -0,0 +1,25 @@
1
+ import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
2
+ import { SecretsProvider } from '../interfaces/secrets-provider.interface';
3
+ export declare class GoogleSecretManagerProvider implements SecretsProvider {
4
+ private readonly client;
5
+ private readonly logger;
6
+ /**
7
+ * Regular expression pattern for Google Secret Manager paths
8
+ * Format: projects/{project-id}/secrets/{secret-id}/versions/{version}
9
+ */
10
+ private readonly secretPathPattern;
11
+ constructor(client: SecretManagerServiceClient);
12
+ /**
13
+ * Checks if a string is a valid Google Secret Manager reference.
14
+ * @param value The string to check
15
+ * @returns True if the string is a valid Google Secret Manager reference
16
+ */
17
+ isSecretReference(value: string): boolean;
18
+ /**
19
+ * Resolves a Google Secret Manager reference to its actual value.
20
+ * @param secretRef The full path to the secret in format projects/{project}/secrets/{secret}/versions/{version}
21
+ * @returns The resolved secret value as a string
22
+ * @throws Error when the secret cannot be retrieved or has an invalid format
23
+ */
24
+ resolveSecret(secretRef: string): Promise<string>;
25
+ }
@@ -0,0 +1,63 @@
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 __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var GoogleSecretManagerProvider_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.GoogleSecretManagerProvider = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const secret_manager_1 = require("@google-cloud/secret-manager");
16
+ let GoogleSecretManagerProvider = GoogleSecretManagerProvider_1 = class GoogleSecretManagerProvider {
17
+ client;
18
+ logger = new common_1.Logger(GoogleSecretManagerProvider_1.name);
19
+ /**
20
+ * Regular expression pattern for Google Secret Manager paths
21
+ * Format: projects/{project-id}/secrets/{secret-id}/versions/{version}
22
+ */
23
+ secretPathPattern = /^projects\/[^/]+\/secrets\/[^/]+\/versions\/[^/]+$/;
24
+ constructor(client) {
25
+ this.client = client;
26
+ }
27
+ /**
28
+ * Checks if a string is a valid Google Secret Manager reference.
29
+ * @param value The string to check
30
+ * @returns True if the string is a valid Google Secret Manager reference
31
+ */
32
+ isSecretReference(value) {
33
+ return this.secretPathPattern.test(value);
34
+ }
35
+ /**
36
+ * Resolves a Google Secret Manager reference to its actual value.
37
+ * @param secretRef The full path to the secret in format projects/{project}/secrets/{secret}/versions/{version}
38
+ * @returns The resolved secret value as a string
39
+ * @throws Error when the secret cannot be retrieved or has an invalid format
40
+ */
41
+ async resolveSecret(secretRef) {
42
+ // The Google client returns an array where the first element contains the response
43
+ const [response] = await this.client.accessSecretVersion({
44
+ name: secretRef
45
+ });
46
+ if (!response || !response.payload) {
47
+ throw new Error('Secret payload is missing');
48
+ }
49
+ if (!response.payload.data) {
50
+ throw new Error('Secret payload data is missing');
51
+ }
52
+ // Return the secret data as a string, handling both Buffer and string formats
53
+ return Buffer.isBuffer(response.payload.data)
54
+ ? response.payload.data.toString('utf8')
55
+ : response.payload.data.toString();
56
+ }
57
+ };
58
+ exports.GoogleSecretManagerProvider = GoogleSecretManagerProvider;
59
+ exports.GoogleSecretManagerProvider = GoogleSecretManagerProvider = GoogleSecretManagerProvider_1 = __decorate([
60
+ (0, common_1.Injectable)(),
61
+ __metadata("design:paramtypes", [secret_manager_1.SecretManagerServiceClient])
62
+ ], GoogleSecretManagerProvider);
63
+ //# sourceMappingURL=google-secret-manager.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-secret-manager.provider.js","sourceRoot":"","sources":["../../src/providers/google-secret-manager.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAkD;AAClD,iEAAwE;AAIjE,IAAM,2BAA2B,mCAAjC,MAAM,2BAA2B;IASP;IARZ,MAAM,GAAG,IAAI,eAAM,CAAC,6BAA2B,CAAC,IAAI,CAAC,CAAC;IAEvE;;;OAGG;IACc,iBAAiB,GAAG,oDAAoD,CAAC;IAE1F,YAA6B,MAAkC;QAAlC,WAAM,GAAN,MAAM,CAA4B;IAC/D,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACjC,mFAAmF;QACnF,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;YACrD,IAAI,EAAE,SAAS;SAClB,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACtD,CAAC;QAED,8EAA8E;QAC9E,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACJ,CAAA;AA9CY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;qCAU4B,2CAA0B;GATtD,2BAA2B,CA8CvC"}
@@ -0,0 +1,58 @@
1
+ import { ConfigFactory, ConfigService } from '@nestjs/config';
2
+ import { SecretsLoaderOptions } from '../interfaces/secrets-loader-options.interface';
3
+ import { SecretsProvider } from '../interfaces/secrets-provider.interface';
4
+ /**
5
+ * Configuration loader with support for secret resolution
6
+ */
7
+ export declare class SecretsLoaderService {
8
+ private readonly logger;
9
+ /**
10
+ * Creates a config factory for use with ConfigModule.forRoot()
11
+ * @param options Configuration options
12
+ * @returns A config factory function
13
+ */
14
+ createConfigFactory(options: SecretsLoaderOptions): ConfigFactory;
15
+ /**
16
+ * Creates a secrets provider based on the provided key and client.
17
+ * @param key The provider type identifier
18
+ * @param client The client instance to be used by the provider
19
+ * @returns A promise that resolves to the created SecretsProvider or undefined if not supported
20
+ */
21
+ createSecretProvider(key: string, client: any): Promise<SecretsProvider | undefined>;
22
+ /**
23
+ * Finds the application root directory
24
+ * (Usually one level up from where this code is running in a typical NestJS app)
25
+ */
26
+ private findAppRootDirectory;
27
+ /**
28
+ * Determines if the path is specified relative to the current working directory
29
+ */
30
+ private isRelativePathFromCwd;
31
+ /**
32
+ * Loads configuration and resolves secrets
33
+ * @param options Configuration options
34
+ * @returns ConfigService instance
35
+ */
36
+ load(options: SecretsLoaderOptions): Promise<ConfigService>;
37
+ /**
38
+ * Loads and merges configuration files, resolving secrets if a provider is available
39
+ * @param provider The instantiated secret provider
40
+ * @param options Configuration options
41
+ * @returns Merged configuration object
42
+ */
43
+ private loadConfigFiles;
44
+ loadProvider(options: SecretsLoaderOptions): Promise<SecretsProvider | undefined>;
45
+ /**
46
+ * Resolves the base directory for configuration files based on the provided configuration
47
+ * or defaults to the application's standard config directory
48
+ */
49
+ private resolveBaseDirectory;
50
+ /**
51
+ * Resolves the default configuration directory path and logs it
52
+ */
53
+ private resolveDefaultConfigDirectory;
54
+ /**
55
+ * Recursively resolves secrets in configuration objects
56
+ */
57
+ private resolveSecrets;
58
+ }
@@ -0,0 +1,249 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var SecretsLoaderService_1;
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.SecretsLoaderService = void 0;
44
+ const common_1 = require("@nestjs/common");
45
+ const config_1 = require("@nestjs/config");
46
+ const node_fs_1 = require("node:fs");
47
+ const yaml = __importStar(require("js-yaml"));
48
+ const node_path_1 = require("node:path");
49
+ const lodash_1 = require("lodash");
50
+ /**
51
+ * Configuration loader with support for secret resolution
52
+ */
53
+ let SecretsLoaderService = SecretsLoaderService_1 = class SecretsLoaderService {
54
+ logger = new common_1.Logger(SecretsLoaderService_1.name);
55
+ /**
56
+ * Creates a config factory for use with ConfigModule.forRoot()
57
+ * @param options Configuration options
58
+ * @returns A config factory function
59
+ */
60
+ createConfigFactory(options) {
61
+ return async () => {
62
+ const provider = await this.loadProvider(options);
63
+ return await this.loadConfigFiles(provider, options);
64
+ };
65
+ }
66
+ /**
67
+ * Creates a secrets provider based on the provided key and client.
68
+ * @param key The provider type identifier
69
+ * @param client The client instance to be used by the provider
70
+ * @returns A promise that resolves to the created SecretsProvider or undefined if not supported
71
+ */
72
+ async createSecretProvider(key, client) {
73
+ switch (key) {
74
+ case 'AwsSecretsManagerProvider':
75
+ case 'SecretsManager': {
76
+ const { AwsSecretsManagerProvider } = await Promise.resolve().then(() => __importStar(require('../providers/aws-secrets-manager.provider')));
77
+ return new AwsSecretsManagerProvider(client);
78
+ }
79
+ case 'AwsParameterStoreProvider':
80
+ case 'SSMClient': {
81
+ const { AwsParameterStoreProvider } = await Promise.resolve().then(() => __importStar(require('../providers/aws-parameter-store.provider')));
82
+ return new AwsParameterStoreProvider(client);
83
+ }
84
+ case 'AzureKeyVaultProvider':
85
+ case 'SecretClient': {
86
+ const { AzureKeyVaultProvider } = await Promise.resolve().then(() => __importStar(require('../providers/azure-key-vault.provider')));
87
+ return new AzureKeyVaultProvider(client);
88
+ }
89
+ case 'GoogleSecretManagerProvider':
90
+ case 'SecretManagerServiceClient': {
91
+ const { GoogleSecretManagerProvider } = await Promise.resolve().then(() => __importStar(require('../providers/google-secret-manager.provider')));
92
+ return new GoogleSecretManagerProvider(client);
93
+ }
94
+ }
95
+ this.logger.warn(`Unsupported secret provider: ${client.constructor.name}`);
96
+ return undefined;
97
+ }
98
+ /**
99
+ * Finds the application root directory
100
+ * (Usually one level up from where this code is running in a typical NestJS app)
101
+ */
102
+ findAppRootDirectory() {
103
+ // Get the directory of the currently executing file
104
+ let currentDir = __dirname;
105
+ const specialDirs = ['dist', 'src', 'lib'];
106
+ // Check if we're in a special directory and move up if needed
107
+ const dirName = (0, node_path_1.basename)(currentDir);
108
+ if (specialDirs.includes(dirName)) {
109
+ currentDir = (0, node_path_1.resolve)(currentDir, '..');
110
+ }
111
+ // Handle the case where we might be in a deeper directory structure
112
+ const nodeModulesIndex = currentDir.indexOf('node_modules');
113
+ if (nodeModulesIndex > -1) {
114
+ currentDir = currentDir.substring(0, nodeModulesIndex);
115
+ }
116
+ return currentDir;
117
+ }
118
+ /**
119
+ * Determines if the path is specified relative to the current working directory
120
+ */
121
+ isRelativePathFromCwd(path) {
122
+ return path.startsWith('./') || path.startsWith('../');
123
+ }
124
+ /**
125
+ * Loads configuration and resolves secrets
126
+ * @param options Configuration options
127
+ * @returns ConfigService instance
128
+ */
129
+ async load(options) {
130
+ const provider = await this.loadProvider(options);
131
+ const config = await this.loadConfigFiles(provider, options);
132
+ return new config_1.ConfigService(config);
133
+ }
134
+ /**
135
+ * Loads and merges configuration files, resolving secrets if a provider is available
136
+ * @param provider The instantiated secret provider
137
+ * @param options Configuration options
138
+ * @returns Merged configuration object
139
+ */
140
+ async loadConfigFiles(provider, options) {
141
+ const { files, fileType = 'yaml' } = options;
142
+ // Resolve the base directory
143
+ const baseDirectory = this.resolveBaseDirectory(options.root);
144
+ if (!files.length) {
145
+ this.logger.warn('No configuration files specified');
146
+ return {};
147
+ }
148
+ let mergedConfig = {};
149
+ for (const filename of files) {
150
+ const filePath = (0, node_path_1.join)(baseDirectory, filename);
151
+ if ((0, node_fs_1.existsSync)(filePath)) {
152
+ try {
153
+ this.logger.debug(`Loading config from ${filePath}`);
154
+ const fileContent = (0, node_fs_1.readFileSync)(filePath, 'utf8');
155
+ let fileConfig;
156
+ if (fileType === 'yaml' || filename.endsWith('.yml') || filename.endsWith('.yaml')) {
157
+ fileConfig = yaml.load(fileContent);
158
+ }
159
+ else {
160
+ fileConfig = JSON.parse(fileContent);
161
+ }
162
+ // Merge with existing config, with the new config taking precedence
163
+ // Using lodash's merge function
164
+ mergedConfig = (0, lodash_1.merge)({}, mergedConfig, fileConfig);
165
+ }
166
+ catch (error) {
167
+ this.logger.error(`Failed to load config from ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
168
+ }
169
+ }
170
+ else {
171
+ this.logger.debug(`Config file not found: ${filePath}`);
172
+ }
173
+ }
174
+ // Resolve secrets if provider is available
175
+ if (provider) {
176
+ await this.resolveSecrets(mergedConfig, '', provider);
177
+ }
178
+ return mergedConfig;
179
+ }
180
+ async loadProvider(options) {
181
+ if (typeof options.provider === 'object') {
182
+ return options.provider;
183
+ }
184
+ if (typeof options.provider === 'string' && options.client) {
185
+ return this.createSecretProvider(options.provider, options.client);
186
+ }
187
+ if (options.client) {
188
+ return this.createSecretProvider(options.client.constructor.name, options.client);
189
+ }
190
+ return undefined;
191
+ }
192
+ /**
193
+ * Resolves the base directory for configuration files based on the provided configuration
194
+ * or defaults to the application's standard config directory
195
+ */
196
+ resolveBaseDirectory(directoryPath) {
197
+ const appRoot = this.findAppRootDirectory();
198
+ // If no directory path is specified, use the default config location
199
+ if (!directoryPath) {
200
+ return this.resolveDefaultConfigDirectory(appRoot, 'config');
201
+ }
202
+ // If it's an absolute path, use it directly
203
+ if ((0, node_path_1.isAbsolute)(directoryPath)) {
204
+ return directoryPath;
205
+ }
206
+ // Resolve from the current working directory
207
+ if (this.isRelativePathFromCwd(directoryPath)) {
208
+ return (0, node_path_1.resolve)(process.cwd(), directoryPath);
209
+ }
210
+ // If it's just a directory name, resolve from app root
211
+ return (0, node_path_1.join)(appRoot, directoryPath);
212
+ }
213
+ /**
214
+ * Resolves the default configuration directory path and logs it
215
+ */
216
+ resolveDefaultConfigDirectory(appRoot, configDir) {
217
+ configDir = (0, node_path_1.join)(appRoot, configDir);
218
+ this.logger.debug(`No base directory specified, using: ${configDir}`);
219
+ return configDir;
220
+ }
221
+ /**
222
+ * Recursively resolves secrets in configuration objects
223
+ */
224
+ async resolveSecrets(config, path = '', secretProvider) {
225
+ for (const key in config) {
226
+ const fullPath = path ? `${path}.${key}` : key;
227
+ // Using lodash's isString and isObject
228
+ if ((0, lodash_1.isString)(config[key])) {
229
+ if (secretProvider.isSecretReference(config[key])) {
230
+ try {
231
+ config[key] = await secretProvider.resolveSecret(config[key]);
232
+ this.logger.debug(`Loaded secret from provider [${fullPath}]`);
233
+ }
234
+ catch (error) {
235
+ this.logger.error(`Failed to load secret [${fullPath}]: ${error instanceof Error ? error.message : String(error)}`);
236
+ }
237
+ }
238
+ }
239
+ else if ((0, lodash_1.isObject)(config[key]) && !Array.isArray(config[key])) {
240
+ await this.resolveSecrets(config[key], fullPath, secretProvider);
241
+ }
242
+ }
243
+ }
244
+ };
245
+ exports.SecretsLoaderService = SecretsLoaderService;
246
+ exports.SecretsLoaderService = SecretsLoaderService = SecretsLoaderService_1 = __decorate([
247
+ (0, common_1.Injectable)()
248
+ ], SecretsLoaderService);
249
+ //# sourceMappingURL=secrets-loader.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-loader.service.js","sourceRoot":"","sources":["../../src/services/secrets-loader.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAkD;AAClD,2CAA4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D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,QAAQ,GAAG,CAAC,CAAC;oBACnE,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,0BAA0B,QAAQ,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnG,CAAC;oBACN,CAAC;gBACL,CAAC;YACL,CAAC;iBAAM,IAAI,IAAA,iBAAQ,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC9D,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;YACrE,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AAhOY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CAgOhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floracodex/nestjs-secrets",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "workspaces": [
5
5
  "example"
6
6
  ],
@@ -29,8 +29,8 @@
29
29
  "lint": "eslint . --max-warnings 0",
30
30
  "lint:fix": "eslint . --fix",
31
31
  "format": "eslint . --fix",
32
- "test": "jest --config ./test/jest-e2e.json",
33
- "test:watch": "jest --config ./test/jest-e2e.json --watch",
32
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./test/jest-e2e.json",
33
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./test/jest-e2e.json --watch",
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "repository": {
@@ -59,37 +59,37 @@
59
59
  "testEnvironment": "node"
60
60
  },
61
61
  "dependencies": {
62
- "js-yaml": "^4.1.0",
62
+ "js-yaml": "^4.3.2",
63
63
  "lodash": "^4.17.21",
64
64
  "reflect-metadata": "^0.2.2"
65
65
  },
66
66
  "devDependencies": {
67
- "@aws-sdk/client-secrets-manager": "^3.1041.0",
68
- "@aws-sdk/client-ssm": "^3.1041.0",
69
- "@azure/identity": "^4.9.1",
70
- "@azure/keyvault-secrets": "^4.9.0",
71
- "@floracodex/eslint-config": "^1.1.0",
72
- "@google-cloud/secret-manager": "^6.1.2",
73
- "@nestjs/cli": "^11.0.21",
74
- "@nestjs/testing": "^11.1.0",
67
+ "@aws-sdk/client-secrets-manager": "^3.1136.0",
68
+ "@aws-sdk/client-ssm": "^3.1136.0",
69
+ "@azure/identity": "^4.13.3",
70
+ "@azure/keyvault-secrets": "^4.11.2",
71
+ "@floracodex/eslint-config": "^1.2.0",
72
+ "@google-cloud/secret-manager": "^6.3.0",
73
+ "@nestjs/cli": "^12.0.3",
74
+ "@nestjs/testing": "^12.0.3",
75
75
  "@types/jest": "^30.0.0",
76
76
  "@types/js-yaml": "^4.0.9",
77
- "@types/lodash": "^4.17.16",
78
- "@types/node": "^25.6.0",
79
- "eslint": "^10.3.0",
80
- "jest": "^30.3.0",
77
+ "@types/lodash": "^4.17.25",
78
+ "@types/node": "^25.9.8",
79
+ "eslint": "^10.11.0",
80
+ "jest": "^30.5.2",
81
81
  "rimraf": "^6.0.1",
82
- "ts-jest": "^29.3.2",
82
+ "ts-jest": "^29.4.12",
83
83
  "ts-node": "^10.9.2",
84
- "typescript": "^5.9.3"
84
+ "typescript": "~6.0.3"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@aws-sdk/client-secrets-manager": "^3.799.0",
88
88
  "@aws-sdk/client-ssm": "^3.0.0",
89
89
  "@azure/keyvault-secrets": "^4.0.0",
90
90
  "@google-cloud/secret-manager": "^6.0.1",
91
- "@nestjs/common": "^10.0.0 || ^11.0.0",
92
- "@nestjs/config": "^3.0.0 || ^4.0.0"
91
+ "@nestjs/common": "^10.0.0 || ^11.0.0 || ^12.0.0",
92
+ "@nestjs/config": "^3.0.0 || ^4.0.0 || ^12.0.0"
93
93
  },
94
94
  "peerDependenciesMeta": {
95
95
  "@aws-sdk/client-secrets-manager": {