@dyanet/nestjs-config-aws 1.0.1
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/LICENSE +21 -0
- package/README.md +1183 -0
- package/dist/cjs/config.module.js +178 -0
- package/dist/cjs/config.module.js.map +1 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/integration/index.js +23 -0
- package/dist/cjs/integration/index.js.map +1 -0
- package/dist/cjs/integration/interfaces/configuration-factory.interface.js +3 -0
- package/dist/cjs/integration/interfaces/configuration-factory.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/configuration-source.interface.js +3 -0
- package/dist/cjs/integration/interfaces/configuration-source.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/index.js +26 -0
- package/dist/cjs/integration/interfaces/index.js.map +1 -0
- package/dist/cjs/integration/interfaces/integration-options.interface.js +3 -0
- package/dist/cjs/integration/interfaces/integration-options.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/integration-state.interface.js +3 -0
- package/dist/cjs/integration/interfaces/integration-state.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/nestjs-config-compatibility.interface.js +73 -0
- package/dist/cjs/integration/interfaces/nestjs-config-compatibility.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/nestjs-config-integration.interface.js +3 -0
- package/dist/cjs/integration/interfaces/nestjs-config-integration.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/typed-configuration.interface.js +4 -0
- package/dist/cjs/integration/interfaces/typed-configuration.interface.js.map +1 -0
- package/dist/cjs/integration/interfaces/utility-types.interface.js +52 -0
- package/dist/cjs/integration/interfaces/utility-types.interface.js.map +1 -0
- package/dist/cjs/integration/nestjs-config-integration.module.js +124 -0
- package/dist/cjs/integration/nestjs-config-integration.module.js.map +1 -0
- package/dist/cjs/integration/providers/aws-configuration-loader.service.js +591 -0
- package/dist/cjs/integration/providers/aws-configuration-loader.service.js.map +1 -0
- package/dist/cjs/integration/providers/configuration-factory.provider.js +383 -0
- package/dist/cjs/integration/providers/configuration-factory.provider.js.map +1 -0
- package/dist/cjs/integration/providers/index.js +20 -0
- package/dist/cjs/integration/providers/index.js.map +1 -0
- package/dist/cjs/integration/services/async-config-helper.service.js +356 -0
- package/dist/cjs/integration/services/async-config-helper.service.js.map +1 -0
- package/dist/cjs/integration/services/error-handler.service.js +265 -0
- package/dist/cjs/integration/services/error-handler.service.js.map +1 -0
- package/dist/cjs/integration/services/factory-registration.service.js +512 -0
- package/dist/cjs/integration/services/factory-registration.service.js.map +1 -0
- package/dist/cjs/integration/services/index.js +26 -0
- package/dist/cjs/integration/services/index.js.map +1 -0
- package/dist/cjs/integration/services/integration-state.service.js +83 -0
- package/dist/cjs/integration/services/integration-state.service.js.map +1 -0
- package/dist/cjs/integration/services/namespace-handler.service.js +467 -0
- package/dist/cjs/integration/services/namespace-handler.service.js.map +1 -0
- package/dist/cjs/integration/services/nestjs-config-integration.service.js +316 -0
- package/dist/cjs/integration/services/nestjs-config-integration.service.js.map +1 -0
- package/dist/cjs/integration/services/precedence-handler.service.js +294 -0
- package/dist/cjs/integration/services/precedence-handler.service.js.map +1 -0
- package/dist/cjs/integration/services/validation-integration.service.js +591 -0
- package/dist/cjs/integration/services/validation-integration.service.js.map +1 -0
- package/dist/cjs/integration/utils/config-integration.util.js +283 -0
- package/dist/cjs/integration/utils/config-integration.util.js.map +1 -0
- package/dist/cjs/integration/utils/index.js +19 -0
- package/dist/cjs/integration/utils/index.js.map +1 -0
- package/dist/cjs/interfaces/config-loader.interface.js +3 -0
- package/dist/cjs/interfaces/config-loader.interface.js.map +1 -0
- package/dist/cjs/interfaces/config-service.interface.js +11 -0
- package/dist/cjs/interfaces/config-service.interface.js.map +1 -0
- package/dist/cjs/interfaces/default-schema.interface.js +63 -0
- package/dist/cjs/interfaces/default-schema.interface.js.map +1 -0
- package/dist/cjs/interfaces/errors.interface.js +77 -0
- package/dist/cjs/interfaces/errors.interface.js.map +1 -0
- package/dist/cjs/interfaces/index.js +25 -0
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/cjs/interfaces/module-options.interface.js +3 -0
- package/dist/cjs/interfaces/module-options.interface.js.map +1 -0
- package/dist/cjs/loaders/environment.loader.js +59 -0
- package/dist/cjs/loaders/environment.loader.js.map +1 -0
- package/dist/cjs/loaders/secrets-manager.loader.js +122 -0
- package/dist/cjs/loaders/secrets-manager.loader.js.map +1 -0
- package/dist/cjs/loaders/ssm-parameter-store.loader.js +146 -0
- package/dist/cjs/loaders/ssm-parameter-store.loader.js.map +1 -0
- package/dist/cjs/services/config.service.js +297 -0
- package/dist/cjs/services/config.service.js.map +1 -0
- package/dist/cjs/utils/validation.util.js +114 -0
- package/dist/cjs/utils/validation.util.js.map +1 -0
- package/dist/esm/config.module.js +175 -0
- package/dist/esm/config.module.js.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/integration/index.js +7 -0
- package/dist/esm/integration/index.js.map +1 -0
- package/dist/esm/integration/interfaces/configuration-factory.interface.js +2 -0
- package/dist/esm/integration/interfaces/configuration-factory.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/configuration-source.interface.js +2 -0
- package/dist/esm/integration/interfaces/configuration-source.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/index.js +10 -0
- package/dist/esm/integration/interfaces/index.js.map +1 -0
- package/dist/esm/integration/interfaces/integration-options.interface.js +2 -0
- package/dist/esm/integration/interfaces/integration-options.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/integration-state.interface.js +2 -0
- package/dist/esm/integration/interfaces/integration-state.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/nestjs-config-compatibility.interface.js +64 -0
- package/dist/esm/integration/interfaces/nestjs-config-compatibility.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/nestjs-config-integration.interface.js +2 -0
- package/dist/esm/integration/interfaces/nestjs-config-integration.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/typed-configuration.interface.js +3 -0
- package/dist/esm/integration/interfaces/typed-configuration.interface.js.map +1 -0
- package/dist/esm/integration/interfaces/utility-types.interface.js +44 -0
- package/dist/esm/integration/interfaces/utility-types.interface.js.map +1 -0
- package/dist/esm/integration/nestjs-config-integration.module.js +121 -0
- package/dist/esm/integration/nestjs-config-integration.module.js.map +1 -0
- package/dist/esm/integration/providers/aws-configuration-loader.service.js +588 -0
- package/dist/esm/integration/providers/aws-configuration-loader.service.js.map +1 -0
- package/dist/esm/integration/providers/configuration-factory.provider.js +380 -0
- package/dist/esm/integration/providers/configuration-factory.provider.js.map +1 -0
- package/dist/esm/integration/providers/index.js +4 -0
- package/dist/esm/integration/providers/index.js.map +1 -0
- package/dist/esm/integration/services/async-config-helper.service.js +353 -0
- package/dist/esm/integration/services/async-config-helper.service.js.map +1 -0
- package/dist/esm/integration/services/error-handler.service.js +262 -0
- package/dist/esm/integration/services/error-handler.service.js.map +1 -0
- package/dist/esm/integration/services/factory-registration.service.js +509 -0
- package/dist/esm/integration/services/factory-registration.service.js.map +1 -0
- package/dist/esm/integration/services/index.js +10 -0
- package/dist/esm/integration/services/index.js.map +1 -0
- package/dist/esm/integration/services/integration-state.service.js +80 -0
- package/dist/esm/integration/services/integration-state.service.js.map +1 -0
- package/dist/esm/integration/services/namespace-handler.service.js +464 -0
- package/dist/esm/integration/services/namespace-handler.service.js.map +1 -0
- package/dist/esm/integration/services/nestjs-config-integration.service.js +313 -0
- package/dist/esm/integration/services/nestjs-config-integration.service.js.map +1 -0
- package/dist/esm/integration/services/precedence-handler.service.js +291 -0
- package/dist/esm/integration/services/precedence-handler.service.js.map +1 -0
- package/dist/esm/integration/services/validation-integration.service.js +585 -0
- package/dist/esm/integration/services/validation-integration.service.js.map +1 -0
- package/dist/esm/integration/utils/config-integration.util.js +240 -0
- package/dist/esm/integration/utils/config-integration.util.js.map +1 -0
- package/dist/esm/integration/utils/index.js +3 -0
- package/dist/esm/integration/utils/index.js.map +1 -0
- package/dist/esm/interfaces/config-loader.interface.js +2 -0
- package/dist/esm/interfaces/config-loader.interface.js.map +1 -0
- package/dist/esm/interfaces/config-service.interface.js +7 -0
- package/dist/esm/interfaces/config-service.interface.js.map +1 -0
- package/dist/esm/interfaces/default-schema.interface.js +59 -0
- package/dist/esm/interfaces/default-schema.interface.js.map +1 -0
- package/dist/esm/interfaces/errors.interface.js +69 -0
- package/dist/esm/interfaces/errors.interface.js.map +1 -0
- package/dist/esm/interfaces/index.js +9 -0
- package/dist/esm/interfaces/index.js.map +1 -0
- package/dist/esm/interfaces/module-options.interface.js +2 -0
- package/dist/esm/interfaces/module-options.interface.js.map +1 -0
- package/dist/esm/loaders/environment.loader.js +55 -0
- package/dist/esm/loaders/environment.loader.js.map +1 -0
- package/dist/esm/loaders/secrets-manager.loader.js +118 -0
- package/dist/esm/loaders/secrets-manager.loader.js.map +1 -0
- package/dist/esm/loaders/ssm-parameter-store.loader.js +142 -0
- package/dist/esm/loaders/ssm-parameter-store.loader.js.map +1 -0
- package/dist/esm/services/config.service.js +261 -0
- package/dist/esm/services/config.service.js.map +1 -0
- package/dist/esm/utils/validation.util.js +110 -0
- package/dist/esm/utils/validation.util.js.map +1 -0
- package/dist/types/config.module.d.ts +46 -0
- package/dist/types/config.module.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/integration/index.d.ts +6 -0
- package/dist/types/integration/index.d.ts.map +1 -0
- package/dist/types/integration/interfaces/configuration-factory.interface.d.ts +71 -0
- package/dist/types/integration/interfaces/configuration-factory.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/configuration-source.interface.d.ts +24 -0
- package/dist/types/integration/interfaces/configuration-source.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/index.d.ts +9 -0
- package/dist/types/integration/interfaces/index.d.ts.map +1 -0
- package/dist/types/integration/interfaces/integration-options.interface.d.ts +66 -0
- package/dist/types/integration/interfaces/integration-options.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/integration-state.interface.d.ts +17 -0
- package/dist/types/integration/interfaces/integration-state.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/nestjs-config-compatibility.interface.d.ts +332 -0
- package/dist/types/integration/interfaces/nestjs-config-compatibility.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/nestjs-config-integration.interface.d.ts +259 -0
- package/dist/types/integration/interfaces/nestjs-config-integration.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/typed-configuration.interface.d.ts +209 -0
- package/dist/types/integration/interfaces/typed-configuration.interface.d.ts.map +1 -0
- package/dist/types/integration/interfaces/utility-types.interface.d.ts +249 -0
- package/dist/types/integration/interfaces/utility-types.interface.d.ts.map +1 -0
- package/dist/types/integration/nestjs-config-integration.module.d.ts +36 -0
- package/dist/types/integration/nestjs-config-integration.module.d.ts.map +1 -0
- package/dist/types/integration/providers/aws-configuration-loader.service.d.ts +134 -0
- package/dist/types/integration/providers/aws-configuration-loader.service.d.ts.map +1 -0
- package/dist/types/integration/providers/configuration-factory.provider.d.ts +119 -0
- package/dist/types/integration/providers/configuration-factory.provider.d.ts.map +1 -0
- package/dist/types/integration/providers/index.d.ts +3 -0
- package/dist/types/integration/providers/index.d.ts.map +1 -0
- package/dist/types/integration/services/async-config-helper.service.d.ts +84 -0
- package/dist/types/integration/services/async-config-helper.service.d.ts.map +1 -0
- package/dist/types/integration/services/error-handler.service.d.ts +84 -0
- package/dist/types/integration/services/error-handler.service.d.ts.map +1 -0
- package/dist/types/integration/services/factory-registration.service.d.ts +158 -0
- package/dist/types/integration/services/factory-registration.service.d.ts.map +1 -0
- package/dist/types/integration/services/index.d.ts +9 -0
- package/dist/types/integration/services/index.d.ts.map +1 -0
- package/dist/types/integration/services/integration-state.service.d.ts +41 -0
- package/dist/types/integration/services/integration-state.service.d.ts.map +1 -0
- package/dist/types/integration/services/namespace-handler.service.d.ts +192 -0
- package/dist/types/integration/services/namespace-handler.service.d.ts.map +1 -0
- package/dist/types/integration/services/nestjs-config-integration.service.d.ts +87 -0
- package/dist/types/integration/services/nestjs-config-integration.service.d.ts.map +1 -0
- package/dist/types/integration/services/precedence-handler.service.d.ts +103 -0
- package/dist/types/integration/services/precedence-handler.service.d.ts.map +1 -0
- package/dist/types/integration/services/validation-integration.service.d.ts +222 -0
- package/dist/types/integration/services/validation-integration.service.d.ts.map +1 -0
- package/dist/types/integration/utils/config-integration.util.d.ts +81 -0
- package/dist/types/integration/utils/config-integration.util.d.ts.map +1 -0
- package/dist/types/integration/utils/index.d.ts +2 -0
- package/dist/types/integration/utils/index.d.ts.map +1 -0
- package/dist/types/interfaces/config-loader.interface.d.ts +22 -0
- package/dist/types/interfaces/config-loader.interface.d.ts.map +1 -0
- package/dist/types/interfaces/config-service.interface.d.ts +23 -0
- package/dist/types/interfaces/config-service.interface.d.ts.map +1 -0
- package/dist/types/interfaces/default-schema.interface.d.ts +195 -0
- package/dist/types/interfaces/default-schema.interface.d.ts.map +1 -0
- package/dist/types/interfaces/errors.interface.d.ts +38 -0
- package/dist/types/interfaces/errors.interface.d.ts.map +1 -0
- package/dist/types/interfaces/index.d.ts +6 -0
- package/dist/types/interfaces/index.d.ts.map +1 -0
- package/dist/types/interfaces/module-options.interface.d.ts +64 -0
- package/dist/types/interfaces/module-options.interface.d.ts.map +1 -0
- package/dist/types/loaders/environment.loader.d.ts +26 -0
- package/dist/types/loaders/environment.loader.d.ts.map +1 -0
- package/dist/types/loaders/secrets-manager.loader.d.ts +52 -0
- package/dist/types/loaders/secrets-manager.loader.d.ts.map +1 -0
- package/dist/types/loaders/ssm-parameter-store.loader.d.ts +68 -0
- package/dist/types/loaders/ssm-parameter-store.loader.d.ts.map +1 -0
- package/dist/types/services/config.service.d.ts +94 -0
- package/dist/types/services/config.service.d.ts.map +1 -0
- package/dist/types/utils/validation.util.d.ts +53 -0
- package/dist/types/utils/validation.util.d.ts.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Default configuration schema using Zod.
|
|
4
|
+
* Provides a flexible base schema that can be extended by applications.
|
|
5
|
+
*/
|
|
6
|
+
export declare const defaultConfigSchema: z.ZodObject<{
|
|
7
|
+
/** Node.js environment */
|
|
8
|
+
NODE_ENV: z.ZodOptional<z.ZodEnum<["production", "development", "test"]>>;
|
|
9
|
+
/** Application environment (mirrors NODE_ENV with 'local' default) */
|
|
10
|
+
APP_ENV: z.ZodDefault<z.ZodEnum<["production", "test", "development", "local"]>>;
|
|
11
|
+
/** AWS region for services */
|
|
12
|
+
AWS_REGION: z.ZodOptional<z.ZodString>;
|
|
13
|
+
/** AWS profile for local development */
|
|
14
|
+
AWS_PROFILE: z.ZodOptional<z.ZodString>;
|
|
15
|
+
/** Application port */
|
|
16
|
+
PORT: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
/** Application host */
|
|
18
|
+
HOST: z.ZodOptional<z.ZodString>;
|
|
19
|
+
/** Log level */
|
|
20
|
+
LOG_LEVEL: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug", "verbose"]>>;
|
|
21
|
+
/** Database URL */
|
|
22
|
+
DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
23
|
+
/** Redis URL */
|
|
24
|
+
REDIS_URL: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
APP_ENV: "production" | "development" | "test" | "local";
|
|
27
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
28
|
+
AWS_REGION?: string | undefined;
|
|
29
|
+
AWS_PROFILE?: string | undefined;
|
|
30
|
+
PORT?: number | undefined;
|
|
31
|
+
HOST?: string | undefined;
|
|
32
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
33
|
+
DATABASE_URL?: string | undefined;
|
|
34
|
+
REDIS_URL?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
37
|
+
APP_ENV?: "production" | "development" | "test" | "local" | undefined;
|
|
38
|
+
AWS_REGION?: string | undefined;
|
|
39
|
+
AWS_PROFILE?: string | undefined;
|
|
40
|
+
PORT?: number | undefined;
|
|
41
|
+
HOST?: string | undefined;
|
|
42
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
43
|
+
DATABASE_URL?: string | undefined;
|
|
44
|
+
REDIS_URL?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Type inference for the default configuration schema.
|
|
48
|
+
*/
|
|
49
|
+
export type DefaultConfigSchema = z.infer<typeof defaultConfigSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Environment-specific validation schemas.
|
|
52
|
+
*/
|
|
53
|
+
export declare const environmentSchemas: {
|
|
54
|
+
local: z.ZodObject<{
|
|
55
|
+
NODE_ENV: z.ZodOptional<z.ZodEnum<["production", "development", "test"]>>;
|
|
56
|
+
APP_ENV: z.ZodDefault<z.ZodEnum<["production", "test", "development", "local"]>>;
|
|
57
|
+
AWS_PROFILE: z.ZodOptional<z.ZodString>;
|
|
58
|
+
PORT: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
HOST: z.ZodOptional<z.ZodString>;
|
|
60
|
+
LOG_LEVEL: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug", "verbose"]>>;
|
|
61
|
+
DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
62
|
+
REDIS_URL: z.ZodOptional<z.ZodString>;
|
|
63
|
+
} & {
|
|
64
|
+
AWS_REGION: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
APP_ENV: "production" | "development" | "test" | "local";
|
|
67
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
68
|
+
AWS_REGION?: string | undefined;
|
|
69
|
+
AWS_PROFILE?: string | undefined;
|
|
70
|
+
PORT?: number | undefined;
|
|
71
|
+
HOST?: string | undefined;
|
|
72
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
73
|
+
DATABASE_URL?: string | undefined;
|
|
74
|
+
REDIS_URL?: string | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
77
|
+
APP_ENV?: "production" | "development" | "test" | "local" | undefined;
|
|
78
|
+
AWS_REGION?: string | undefined;
|
|
79
|
+
AWS_PROFILE?: string | undefined;
|
|
80
|
+
PORT?: number | undefined;
|
|
81
|
+
HOST?: string | undefined;
|
|
82
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
83
|
+
DATABASE_URL?: string | undefined;
|
|
84
|
+
REDIS_URL?: string | undefined;
|
|
85
|
+
}>;
|
|
86
|
+
development: z.ZodObject<{
|
|
87
|
+
NODE_ENV: z.ZodOptional<z.ZodEnum<["production", "development", "test"]>>;
|
|
88
|
+
APP_ENV: z.ZodDefault<z.ZodEnum<["production", "test", "development", "local"]>>;
|
|
89
|
+
AWS_PROFILE: z.ZodOptional<z.ZodString>;
|
|
90
|
+
PORT: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
HOST: z.ZodOptional<z.ZodString>;
|
|
92
|
+
LOG_LEVEL: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug", "verbose"]>>;
|
|
93
|
+
DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
94
|
+
REDIS_URL: z.ZodOptional<z.ZodString>;
|
|
95
|
+
} & {
|
|
96
|
+
AWS_REGION: z.ZodString;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
APP_ENV: "production" | "development" | "test" | "local";
|
|
99
|
+
AWS_REGION: string;
|
|
100
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
101
|
+
AWS_PROFILE?: string | undefined;
|
|
102
|
+
PORT?: number | undefined;
|
|
103
|
+
HOST?: string | undefined;
|
|
104
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
105
|
+
DATABASE_URL?: string | undefined;
|
|
106
|
+
REDIS_URL?: string | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
AWS_REGION: string;
|
|
109
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
110
|
+
APP_ENV?: "production" | "development" | "test" | "local" | undefined;
|
|
111
|
+
AWS_PROFILE?: string | undefined;
|
|
112
|
+
PORT?: number | undefined;
|
|
113
|
+
HOST?: string | undefined;
|
|
114
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
115
|
+
DATABASE_URL?: string | undefined;
|
|
116
|
+
REDIS_URL?: string | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
test: z.ZodObject<{
|
|
119
|
+
NODE_ENV: z.ZodOptional<z.ZodEnum<["production", "development", "test"]>>;
|
|
120
|
+
APP_ENV: z.ZodDefault<z.ZodEnum<["production", "test", "development", "local"]>>;
|
|
121
|
+
AWS_PROFILE: z.ZodOptional<z.ZodString>;
|
|
122
|
+
PORT: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
HOST: z.ZodOptional<z.ZodString>;
|
|
124
|
+
LOG_LEVEL: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug", "verbose"]>>;
|
|
125
|
+
DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
126
|
+
REDIS_URL: z.ZodOptional<z.ZodString>;
|
|
127
|
+
} & {
|
|
128
|
+
AWS_REGION: z.ZodString;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
APP_ENV: "production" | "development" | "test" | "local";
|
|
131
|
+
AWS_REGION: string;
|
|
132
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
133
|
+
AWS_PROFILE?: string | undefined;
|
|
134
|
+
PORT?: number | undefined;
|
|
135
|
+
HOST?: string | undefined;
|
|
136
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
137
|
+
DATABASE_URL?: string | undefined;
|
|
138
|
+
REDIS_URL?: string | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
AWS_REGION: string;
|
|
141
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
142
|
+
APP_ENV?: "production" | "development" | "test" | "local" | undefined;
|
|
143
|
+
AWS_PROFILE?: string | undefined;
|
|
144
|
+
PORT?: number | undefined;
|
|
145
|
+
HOST?: string | undefined;
|
|
146
|
+
LOG_LEVEL?: "error" | "warn" | "info" | "debug" | "verbose" | undefined;
|
|
147
|
+
DATABASE_URL?: string | undefined;
|
|
148
|
+
REDIS_URL?: string | undefined;
|
|
149
|
+
}>;
|
|
150
|
+
production: z.ZodObject<{
|
|
151
|
+
NODE_ENV: z.ZodOptional<z.ZodEnum<["production", "development", "test"]>>;
|
|
152
|
+
APP_ENV: z.ZodDefault<z.ZodEnum<["production", "test", "development", "local"]>>;
|
|
153
|
+
AWS_PROFILE: z.ZodOptional<z.ZodString>;
|
|
154
|
+
PORT: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
HOST: z.ZodOptional<z.ZodString>;
|
|
156
|
+
DATABASE_URL: z.ZodOptional<z.ZodString>;
|
|
157
|
+
REDIS_URL: z.ZodOptional<z.ZodString>;
|
|
158
|
+
} & {
|
|
159
|
+
AWS_REGION: z.ZodString;
|
|
160
|
+
LOG_LEVEL: z.ZodDefault<z.ZodEnum<["error", "warn", "info"]>>;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
APP_ENV: "production" | "development" | "test" | "local";
|
|
163
|
+
AWS_REGION: string;
|
|
164
|
+
LOG_LEVEL: "error" | "warn" | "info";
|
|
165
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
166
|
+
AWS_PROFILE?: string | undefined;
|
|
167
|
+
PORT?: number | undefined;
|
|
168
|
+
HOST?: string | undefined;
|
|
169
|
+
DATABASE_URL?: string | undefined;
|
|
170
|
+
REDIS_URL?: string | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
AWS_REGION: string;
|
|
173
|
+
NODE_ENV?: "production" | "development" | "test" | undefined;
|
|
174
|
+
APP_ENV?: "production" | "development" | "test" | "local" | undefined;
|
|
175
|
+
AWS_PROFILE?: string | undefined;
|
|
176
|
+
PORT?: number | undefined;
|
|
177
|
+
HOST?: string | undefined;
|
|
178
|
+
LOG_LEVEL?: "error" | "warn" | "info" | undefined;
|
|
179
|
+
DATABASE_URL?: string | undefined;
|
|
180
|
+
REDIS_URL?: string | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Helper function to get the appropriate schema for the current environment.
|
|
185
|
+
*/
|
|
186
|
+
export declare function getSchemaForEnvironment(appEnv: string): z.ZodSchema;
|
|
187
|
+
/**
|
|
188
|
+
* Validation helper for APP_ENV values.
|
|
189
|
+
*/
|
|
190
|
+
export declare const appEnvSchema: z.ZodEnum<["production", "test", "development", "local"]>;
|
|
191
|
+
/**
|
|
192
|
+
* Type for valid APP_ENV values.
|
|
193
|
+
*/
|
|
194
|
+
export type AppEnv = z.infer<typeof appEnvSchema>;
|
|
195
|
+
//# sourceMappingURL=default-schema.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-schema.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/default-schema.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAC9B,0BAA0B;;IAG1B,sEAAsE;;IAGtE,8BAA8B;;IAG9B,wCAAwC;;IAGxC,uBAAuB;;IAGvB,uBAAuB;;IAGvB,gBAAgB;;IAGhB,mBAAmB;;IAGnB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAEhB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB9B,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,CAGnE;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,2DAAyD,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all configuration-related errors.
|
|
3
|
+
*/
|
|
4
|
+
export declare class ConfigurationError extends Error {
|
|
5
|
+
readonly cause?: Error | undefined;
|
|
6
|
+
constructor(message: string, cause?: Error | undefined);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when configuration validation fails.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ValidationError extends ConfigurationError {
|
|
12
|
+
readonly validationErrors: any;
|
|
13
|
+
readonly invalidKeys?: string[] | undefined;
|
|
14
|
+
constructor(message: string, validationErrors: any, invalidKeys?: string[] | undefined);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Error thrown when AWS service operations fail.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AWSServiceError extends ConfigurationError {
|
|
20
|
+
readonly service: 'SecretsManager' | 'SSM';
|
|
21
|
+
readonly operation: string;
|
|
22
|
+
constructor(message: string, service: 'SecretsManager' | 'SSM', operation: string, cause?: Error);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when required configuration is missing.
|
|
26
|
+
*/
|
|
27
|
+
export declare class MissingConfigurationError extends ConfigurationError {
|
|
28
|
+
readonly missingKeys: string[];
|
|
29
|
+
constructor(missingKeys: string[], message?: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Error thrown when configuration loading fails.
|
|
33
|
+
*/
|
|
34
|
+
export declare class ConfigurationLoadError extends ConfigurationError {
|
|
35
|
+
readonly loader: string;
|
|
36
|
+
constructor(message: string, loader: string, cause?: Error);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=errors.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/errors.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aACE,KAAK,CAAC,EAAE,KAAK;gBAA9C,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,KAAK,YAAA;CAS3D;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,kBAAkB;aAGnC,gBAAgB,EAAE,GAAG;aACrB,WAAW,CAAC,EAAE,MAAM,EAAE;gBAFtC,OAAO,EAAE,MAAM,EACC,gBAAgB,EAAE,GAAG,EACrB,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;CASzC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,kBAAkB;aAGnC,OAAO,EAAE,gBAAgB,GAAG,KAAK;aACjC,SAAS,EAAE,MAAM;gBAFjC,OAAO,EAAE,MAAM,EACC,OAAO,EAAE,gBAAgB,GAAG,KAAK,EACjC,SAAS,EAAE,MAAM,EACjC,KAAK,CAAC,EAAE,KAAK;CAShB;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;aAE7C,WAAW,EAAE,MAAM,EAAE;gBAArB,WAAW,EAAE,MAAM,EAAE,EACrC,OAAO,CAAC,EAAE,MAAM;CASnB;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,kBAAkB;aAG1C,MAAM,EAAE,MAAM;gBAD9B,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM,EAC9B,KAAK,CAAC,EAAE,KAAK;CAShB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAG3C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ZodType } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for AWS Secrets Manager integration.
|
|
4
|
+
*/
|
|
5
|
+
export interface SecretsManagerConfig {
|
|
6
|
+
/** AWS region for Secrets Manager */
|
|
7
|
+
region?: string;
|
|
8
|
+
/** Base path for secrets in different environments */
|
|
9
|
+
paths?: {
|
|
10
|
+
development?: string;
|
|
11
|
+
test?: string;
|
|
12
|
+
production?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Whether to enable Secrets Manager integration */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for AWS Systems Manager Parameter Store integration.
|
|
19
|
+
*/
|
|
20
|
+
export interface SSMConfig {
|
|
21
|
+
/** AWS region for SSM Parameter Store */
|
|
22
|
+
region?: string;
|
|
23
|
+
/** Base path for parameters in different environments */
|
|
24
|
+
paths?: {
|
|
25
|
+
development?: string;
|
|
26
|
+
test?: string;
|
|
27
|
+
production?: string;
|
|
28
|
+
};
|
|
29
|
+
/** Whether to enable SSM Parameter Store integration */
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
/** Whether to decrypt SecureString parameters */
|
|
32
|
+
decrypt?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for configuring the NestJS AWS Configuration module.
|
|
36
|
+
*/
|
|
37
|
+
export interface NestConfigAwsModuleOptions<T = any> {
|
|
38
|
+
/** Zod schema for configuration validation */
|
|
39
|
+
schema?: ZodType<T>;
|
|
40
|
+
/** Configuration for AWS Secrets Manager integration */
|
|
41
|
+
secretsManagerConfig?: SecretsManagerConfig;
|
|
42
|
+
/** Configuration for AWS Systems Manager Parameter Store integration */
|
|
43
|
+
ssmConfig?: SSMConfig;
|
|
44
|
+
/** Prefix for environment variables (e.g., 'APP_') */
|
|
45
|
+
envPrefix?: string;
|
|
46
|
+
/** Whether to ignore validation errors and continue with partial config */
|
|
47
|
+
ignoreValidationErrors?: boolean;
|
|
48
|
+
/** Custom environment variable name for APP_ENV (defaults to 'APP_ENV') */
|
|
49
|
+
appEnvVariable?: string;
|
|
50
|
+
/** Whether to load configuration synchronously during module initialization */
|
|
51
|
+
loadSync?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Async factory options for dynamic module configuration.
|
|
55
|
+
*/
|
|
56
|
+
export interface NestConfigAwsModuleAsyncOptions<T = any> {
|
|
57
|
+
/** Factory function to create module options */
|
|
58
|
+
useFactory: (...args: any[]) => Promise<NestConfigAwsModuleOptions<T>> | NestConfigAwsModuleOptions<T>;
|
|
59
|
+
/** Dependencies to inject into the factory function */
|
|
60
|
+
inject?: any[];
|
|
61
|
+
/** Imports required for the factory function */
|
|
62
|
+
imports?: any[];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=module-options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-options.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/module-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAEpB,wDAAwD;IACxD,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,2EAA2E;IAC3E,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B,CAAC,CAAC,GAAG,GAAG;IACtD,gDAAgD;IAChD,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAEvG,uDAAuD;IACvD,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,gDAAgD;IAChD,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;CACjB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigLoader } from '../interfaces/config-loader.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration loader that loads values from environment variables (process.env).
|
|
4
|
+
* This loader is always available and serves as the base configuration source.
|
|
5
|
+
*/
|
|
6
|
+
export declare class EnvironmentLoader implements ConfigLoader {
|
|
7
|
+
private readonly envPrefix?;
|
|
8
|
+
constructor(envPrefix?: string);
|
|
9
|
+
/**
|
|
10
|
+
* Load configuration from environment variables.
|
|
11
|
+
* @returns Promise resolving to environment variables as key-value pairs
|
|
12
|
+
*/
|
|
13
|
+
load(): Promise<Record<string, any>>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the name of this loader for logging and debugging.
|
|
16
|
+
* @returns The loader name
|
|
17
|
+
*/
|
|
18
|
+
getName(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Check if this loader is available.
|
|
21
|
+
* Environment variables are always available.
|
|
22
|
+
* @returns Promise resolving to true
|
|
23
|
+
*/
|
|
24
|
+
isAvailable(): Promise<boolean>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=environment.loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/environment.loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IACpD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;gBAExB,SAAS,CAAC,EAAE,MAAM;IAI9B;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IA6B1C;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAGtC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ConfigLoader } from '../interfaces/config-loader.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for SecretsManagerLoader
|
|
4
|
+
*/
|
|
5
|
+
export interface SecretsManagerLoaderConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Base secret name/path (without environment prefix)
|
|
8
|
+
* @default '/nestjs-config-aws'
|
|
9
|
+
*/
|
|
10
|
+
secretName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* AWS region for Secrets Manager client
|
|
13
|
+
* If not provided, will use AWS_REGION environment variable or default to 'us-east-1'
|
|
14
|
+
*/
|
|
15
|
+
region?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Custom environment mapping for secret paths
|
|
18
|
+
* @default { development: 'dev', test: 'test', production: 'production' }
|
|
19
|
+
*/
|
|
20
|
+
environmentMapping?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Configuration loader that loads values from AWS Secrets Manager.
|
|
24
|
+
* Supports environment-aware secret path construction and JSON parsing with string fallback.
|
|
25
|
+
*/
|
|
26
|
+
export declare class SecretsManagerLoader implements ConfigLoader {
|
|
27
|
+
private readonly client;
|
|
28
|
+
private readonly config;
|
|
29
|
+
private readonly appEnv;
|
|
30
|
+
constructor(config?: SecretsManagerLoaderConfig);
|
|
31
|
+
/**
|
|
32
|
+
* Load configuration from AWS Secrets Manager.
|
|
33
|
+
* @returns Promise resolving to configuration key-value pairs from the secret
|
|
34
|
+
*/
|
|
35
|
+
load(): Promise<Record<string, any>>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the name of this loader for logging and debugging.
|
|
38
|
+
* @returns The loader name with secret path
|
|
39
|
+
*/
|
|
40
|
+
getName(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Check if this loader is available in the current environment.
|
|
43
|
+
* @returns Promise resolving to true if not in local environment and AWS credentials are available
|
|
44
|
+
*/
|
|
45
|
+
isAvailable(): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Build the environment-aware secret name/path.
|
|
48
|
+
* @returns The full secret name with environment prefix
|
|
49
|
+
*/
|
|
50
|
+
private buildSecretName;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=secrets-manager.loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-manager.loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/secrets-manager.loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;AAED;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,GAAE,0BAA+B;IAqBnD;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IA8D1C;;;OAGG;IACH,OAAO,IAAI,MAAM;IAKjB;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;;OAGG;IACH,OAAO,CAAC,eAAe;CAYxB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ConfigLoader } from '../interfaces/config-loader.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for SSMParameterStoreLoader
|
|
4
|
+
*/
|
|
5
|
+
export interface SSMParameterStoreLoaderConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Base parameter path (without environment prefix)
|
|
8
|
+
* @default '/nestjs-config-aws'
|
|
9
|
+
*/
|
|
10
|
+
parameterPath?: string;
|
|
11
|
+
/**
|
|
12
|
+
* AWS region for SSM client
|
|
13
|
+
* If not provided, will use AWS_REGION environment variable or default to 'us-east-1'
|
|
14
|
+
*/
|
|
15
|
+
region?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Custom environment mapping for parameter paths
|
|
18
|
+
* @default { development: 'dev', test: 'test', production: 'production' }
|
|
19
|
+
*/
|
|
20
|
+
environmentMapping?: Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to decrypt SecureString parameters
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
withDecryption?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Configuration loader that loads values from AWS Systems Manager Parameter Store.
|
|
29
|
+
* Supports environment-aware parameter path construction, recursive parameter fetching with pagination,
|
|
30
|
+
* and parameter name transformation (remove prefix, convert to uppercase).
|
|
31
|
+
*/
|
|
32
|
+
export declare class SSMParameterStoreLoader implements ConfigLoader {
|
|
33
|
+
private readonly client;
|
|
34
|
+
private readonly config;
|
|
35
|
+
private readonly appEnv;
|
|
36
|
+
constructor(config?: SSMParameterStoreLoaderConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Load configuration from AWS Systems Manager Parameter Store.
|
|
39
|
+
* Implements recursive parameter fetching with NextToken handling for pagination.
|
|
40
|
+
* @returns Promise resolving to configuration key-value pairs from parameters
|
|
41
|
+
*/
|
|
42
|
+
load(): Promise<Record<string, any>>;
|
|
43
|
+
/**
|
|
44
|
+
* Get the name of this loader for logging and debugging.
|
|
45
|
+
* @returns The loader name with parameter path
|
|
46
|
+
*/
|
|
47
|
+
getName(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Check if this loader is available in the current environment.
|
|
50
|
+
* @returns Promise resolving to true if not in local environment, AWS_REGION is set, and AWS credentials are available
|
|
51
|
+
*/
|
|
52
|
+
isAvailable(): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Build the environment-aware parameter path.
|
|
55
|
+
* @returns The full parameter path with environment prefix
|
|
56
|
+
*/
|
|
57
|
+
private buildParameterPath;
|
|
58
|
+
/**
|
|
59
|
+
* Transform parameter name by removing the prefix and converting to uppercase.
|
|
60
|
+
* Example: '/dev/nestjs-config-aws/database/host' -> 'DATABASEHOST'
|
|
61
|
+
* This matches the original prospectory-backend implementation
|
|
62
|
+
* @param parameterName The full parameter name from AWS
|
|
63
|
+
* @param pathPrefix The path prefix to remove
|
|
64
|
+
* @returns The transformed parameter name or null if invalid
|
|
65
|
+
*/
|
|
66
|
+
private transformParameterName;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=ssm-parameter-store.loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssm-parameter-store.loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/ssm-parameter-store.loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5C;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,YAAW,YAAY;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,GAAE,6BAAkC;IAsBtD;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAsE1C;;;OAGG;IACH,OAAO,IAAI,MAAM;IAKjB;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;CAY/B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ZodType } from 'zod';
|
|
2
|
+
import { ConfigService } from '../interfaces/config-service.interface';
|
|
3
|
+
import { ConfigLoader } from '../interfaces/config-loader.interface';
|
|
4
|
+
import { DefaultConfigSchema } from '../interfaces/default-schema.interface';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for ConfigServiceImpl
|
|
7
|
+
*/
|
|
8
|
+
export interface ConfigServiceOptions<T = DefaultConfigSchema> {
|
|
9
|
+
/**
|
|
10
|
+
* Zod schema for configuration validation
|
|
11
|
+
* @default defaultConfigSchema
|
|
12
|
+
*/
|
|
13
|
+
schema?: ZodType<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Custom configuration loaders
|
|
16
|
+
* If not provided, default loaders (env, secrets manager, ssm) will be used
|
|
17
|
+
*/
|
|
18
|
+
loaders?: ConfigLoader[];
|
|
19
|
+
/**
|
|
20
|
+
* Environment variable prefix for EnvironmentLoader
|
|
21
|
+
*/
|
|
22
|
+
envPrefix?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to validate configuration on load
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
validateOnLoad?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to log configuration loading steps
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
enableLogging?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Implementation of ConfigService with AWS integration and APP_ENV logic.
|
|
36
|
+
* Provides type-safe configuration access with orchestrated loading from multiple sources.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ConfigServiceImpl<T = DefaultConfigSchema> extends ConfigService<T> {
|
|
39
|
+
private readonly logger;
|
|
40
|
+
private readonly schema;
|
|
41
|
+
private readonly loaders;
|
|
42
|
+
private readonly options;
|
|
43
|
+
private config;
|
|
44
|
+
private initialized;
|
|
45
|
+
private appEnv;
|
|
46
|
+
constructor(options?: ConfigServiceOptions<T>);
|
|
47
|
+
/**
|
|
48
|
+
* Initialize the configuration service by loading and validating configuration.
|
|
49
|
+
* This method should be called during application startup.
|
|
50
|
+
*/
|
|
51
|
+
initialize(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Get a configuration value by key with type safety.
|
|
54
|
+
* @param key - The configuration key to retrieve
|
|
55
|
+
* @returns The configuration value with proper typing
|
|
56
|
+
*/
|
|
57
|
+
get<K extends keyof T>(key: K): T[K];
|
|
58
|
+
/**
|
|
59
|
+
* Check if the configuration service has been initialized.
|
|
60
|
+
* @returns True if the service is ready to serve configuration values
|
|
61
|
+
*/
|
|
62
|
+
isInitialized(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Get all configuration values.
|
|
65
|
+
* @returns The complete configuration object
|
|
66
|
+
*/
|
|
67
|
+
getAll(): T;
|
|
68
|
+
/**
|
|
69
|
+
* Get the current APP_ENV value.
|
|
70
|
+
* @returns The current application environment
|
|
71
|
+
*/
|
|
72
|
+
getAppEnv(): string;
|
|
73
|
+
/**
|
|
74
|
+
* Initialize APP_ENV with NODE_ENV mirroring and warning logic.
|
|
75
|
+
* Implements requirement 2.0: APP_ENV mirroring NODE_ENV with "local" default and warning logic.
|
|
76
|
+
*/
|
|
77
|
+
private initializeAppEnv;
|
|
78
|
+
/**
|
|
79
|
+
* Create default configuration loaders.
|
|
80
|
+
* @returns Array of default loaders in precedence order
|
|
81
|
+
*/
|
|
82
|
+
private createDefaultLoaders;
|
|
83
|
+
/**
|
|
84
|
+
* Load configuration from all sources with proper precedence order.
|
|
85
|
+
* Implements orchestration: env -> secrets -> ssm with proper merging.
|
|
86
|
+
*/
|
|
87
|
+
private loadConfiguration;
|
|
88
|
+
/**
|
|
89
|
+
* Handle local environment overrides according to requirement 2.4.
|
|
90
|
+
* In local mode with valid AWS profile and .env file, .env values override AWS values.
|
|
91
|
+
*/
|
|
92
|
+
private handleLocalEnvironmentOverrides;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=config.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.service.d.ts","sourceRoot":"","sources":["../../../src/services/config.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAyC,MAAM,wCAAwC,CAAC;AAOpH;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,mBAAmB;IAC3D;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,qBACa,iBAAiB,CAAC,CAAC,GAAG,mBAAmB,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAItB;IAEF,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,GAAE,oBAAoB,CAAC,CAAC,CAAM;IAoBjD;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAoCjC;;;;OAIG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAUpC;;;OAGG;IACH,aAAa,IAAI,OAAO;IAIxB;;;OAGG;IACH,MAAM,IAAI,CAAC;IAUX;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA+DxB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;OAGG;YACW,iBAAiB;IAqD/B;;;OAGG;YACW,+BAA+B;CA8C9C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ZodError, ZodType, TypeOf } from 'zod';
|
|
2
|
+
import { ValidationError } from '../interfaces/errors.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Framework-agnostic validation utility for configuration values
|
|
5
|
+
* Adapted from ZodValidationPipe for standalone use
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConfigValidationUtil {
|
|
8
|
+
/**
|
|
9
|
+
* Validates a value against a Zod schema
|
|
10
|
+
* @param schema The Zod schema to validate against
|
|
11
|
+
* @param value The value to validate
|
|
12
|
+
* @param context Optional context for error messages
|
|
13
|
+
* @returns The validated and transformed value
|
|
14
|
+
* @throws ValidationError if validation fails
|
|
15
|
+
*/
|
|
16
|
+
static validate<T extends ZodType>(schema: T, value: unknown, context?: string): TypeOf<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Safely validates a value against a Zod schema without throwing
|
|
19
|
+
* @param schema The Zod schema to validate against
|
|
20
|
+
* @param value The value to validate
|
|
21
|
+
* @returns Object with success flag and either data or error
|
|
22
|
+
*/
|
|
23
|
+
static safeValidate<T extends ZodType>(schema: T, value: unknown): {
|
|
24
|
+
success: true;
|
|
25
|
+
data: TypeOf<T>;
|
|
26
|
+
} | {
|
|
27
|
+
success: false;
|
|
28
|
+
error: ValidationError;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Formats Zod validation errors into a structured format
|
|
32
|
+
* @param error The ZodError to format
|
|
33
|
+
* @returns Formatted error object or string
|
|
34
|
+
*/
|
|
35
|
+
static formatValidationErrors(error: ZodError): any;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a detailed error message for configuration validation failures
|
|
38
|
+
* @param error The ZodError to create a message for
|
|
39
|
+
* @param context Optional context for the error
|
|
40
|
+
* @returns Detailed error message string
|
|
41
|
+
*/
|
|
42
|
+
static createDetailedErrorMessage(error: ZodError, context?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Validates configuration with enhanced error context
|
|
45
|
+
* @param schema The Zod schema to validate against
|
|
46
|
+
* @param value The configuration object to validate
|
|
47
|
+
* @param source The source of the configuration (e.g., 'environment', 'secrets-manager')
|
|
48
|
+
* @returns The validated configuration
|
|
49
|
+
* @throws ValidationError with enhanced context
|
|
50
|
+
*/
|
|
51
|
+
static validateConfiguration<T extends ZodType>(schema: T, value: unknown, source: string): TypeOf<T>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=validation.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.util.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,OAAO,EAC/B,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAAC,CAAC,CAAC;IAaZ;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,OAAO,EACnC,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,GACb;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,eAAe,CAAA;KAAE;IAalF;;;;OAIG;IACH,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG;IA4BnD;;;;;OAKG;IACH,MAAM,CAAC,0BAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAmB5E;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,OAAO,EAC5C,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,CAAC,CAAC;CAYb"}
|