@dyanet/config-aws 1.0.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 (122) hide show
  1. package/README.md +195 -0
  2. package/dist/cjs/config-manager.js +360 -0
  3. package/dist/cjs/config-manager.js.map +1 -0
  4. package/dist/cjs/errors/index.js +65 -0
  5. package/dist/cjs/errors/index.js.map +1 -0
  6. package/dist/cjs/index.js +37 -0
  7. package/dist/cjs/index.js.map +1 -0
  8. package/dist/cjs/interfaces/config-loader.interface.js +3 -0
  9. package/dist/cjs/interfaces/config-loader.interface.js.map +1 -0
  10. package/dist/cjs/interfaces/config-manager.interface.js +3 -0
  11. package/dist/cjs/interfaces/config-manager.interface.js.map +1 -0
  12. package/dist/cjs/interfaces/env-file-loader.interface.js +3 -0
  13. package/dist/cjs/interfaces/env-file-loader.interface.js.map +1 -0
  14. package/dist/cjs/interfaces/environment-loader.interface.js +3 -0
  15. package/dist/cjs/interfaces/environment-loader.interface.js.map +1 -0
  16. package/dist/cjs/interfaces/index.js +3 -0
  17. package/dist/cjs/interfaces/index.js.map +1 -0
  18. package/dist/cjs/interfaces/s3-loader.interface.js +3 -0
  19. package/dist/cjs/interfaces/s3-loader.interface.js.map +1 -0
  20. package/dist/cjs/interfaces/secrets-manager-loader.interface.js +3 -0
  21. package/dist/cjs/interfaces/secrets-manager-loader.interface.js.map +1 -0
  22. package/dist/cjs/interfaces/ssm-parameter-store-loader.interface.js +3 -0
  23. package/dist/cjs/interfaces/ssm-parameter-store-loader.interface.js.map +1 -0
  24. package/dist/cjs/loaders/env-file.loader.js +167 -0
  25. package/dist/cjs/loaders/env-file.loader.js.map +1 -0
  26. package/dist/cjs/loaders/environment.loader.js +83 -0
  27. package/dist/cjs/loaders/environment.loader.js.map +1 -0
  28. package/dist/cjs/loaders/index.js +14 -0
  29. package/dist/cjs/loaders/index.js.map +1 -0
  30. package/dist/cjs/loaders/s3.loader.js +141 -0
  31. package/dist/cjs/loaders/s3.loader.js.map +1 -0
  32. package/dist/cjs/loaders/secrets-manager.loader.js +156 -0
  33. package/dist/cjs/loaders/secrets-manager.loader.js.map +1 -0
  34. package/dist/cjs/loaders/ssm-parameter-store.loader.js +193 -0
  35. package/dist/cjs/loaders/ssm-parameter-store.loader.js.map +1 -0
  36. package/dist/cjs/utils/env-file-parser.util.js +98 -0
  37. package/dist/cjs/utils/env-file-parser.util.js.map +1 -0
  38. package/dist/cjs/utils/index.js +8 -0
  39. package/dist/cjs/utils/index.js.map +1 -0
  40. package/dist/cjs/utils/validation.util.js +116 -0
  41. package/dist/cjs/utils/validation.util.js.map +1 -0
  42. package/dist/esm/config-manager.js +356 -0
  43. package/dist/esm/config-manager.js.map +1 -0
  44. package/dist/esm/errors/index.js +57 -0
  45. package/dist/esm/errors/index.js.map +1 -0
  46. package/dist/esm/index.js +21 -0
  47. package/dist/esm/index.js.map +1 -0
  48. package/dist/esm/interfaces/config-loader.interface.js +2 -0
  49. package/dist/esm/interfaces/config-loader.interface.js.map +1 -0
  50. package/dist/esm/interfaces/config-manager.interface.js +2 -0
  51. package/dist/esm/interfaces/config-manager.interface.js.map +1 -0
  52. package/dist/esm/interfaces/env-file-loader.interface.js +2 -0
  53. package/dist/esm/interfaces/env-file-loader.interface.js.map +1 -0
  54. package/dist/esm/interfaces/environment-loader.interface.js +2 -0
  55. package/dist/esm/interfaces/environment-loader.interface.js.map +1 -0
  56. package/dist/esm/interfaces/index.js +2 -0
  57. package/dist/esm/interfaces/index.js.map +1 -0
  58. package/dist/esm/interfaces/s3-loader.interface.js +2 -0
  59. package/dist/esm/interfaces/s3-loader.interface.js.map +1 -0
  60. package/dist/esm/interfaces/secrets-manager-loader.interface.js +2 -0
  61. package/dist/esm/interfaces/secrets-manager-loader.interface.js.map +1 -0
  62. package/dist/esm/interfaces/ssm-parameter-store-loader.interface.js +2 -0
  63. package/dist/esm/interfaces/ssm-parameter-store-loader.interface.js.map +1 -0
  64. package/dist/esm/loaders/env-file.loader.js +130 -0
  65. package/dist/esm/loaders/env-file.loader.js.map +1 -0
  66. package/dist/esm/loaders/environment.loader.js +79 -0
  67. package/dist/esm/loaders/environment.loader.js.map +1 -0
  68. package/dist/esm/loaders/index.js +6 -0
  69. package/dist/esm/loaders/index.js.map +1 -0
  70. package/dist/esm/loaders/s3.loader.js +137 -0
  71. package/dist/esm/loaders/s3.loader.js.map +1 -0
  72. package/dist/esm/loaders/secrets-manager.loader.js +152 -0
  73. package/dist/esm/loaders/secrets-manager.loader.js.map +1 -0
  74. package/dist/esm/loaders/ssm-parameter-store.loader.js +189 -0
  75. package/dist/esm/loaders/ssm-parameter-store.loader.js.map +1 -0
  76. package/dist/esm/utils/env-file-parser.util.js +94 -0
  77. package/dist/esm/utils/env-file-parser.util.js.map +1 -0
  78. package/dist/esm/utils/index.js +3 -0
  79. package/dist/esm/utils/index.js.map +1 -0
  80. package/dist/esm/utils/validation.util.js +112 -0
  81. package/dist/esm/utils/validation.util.js.map +1 -0
  82. package/dist/types/config-manager.d.ts +119 -0
  83. package/dist/types/config-manager.d.ts.map +1 -0
  84. package/dist/types/errors/index.d.ts +43 -0
  85. package/dist/types/errors/index.d.ts.map +1 -0
  86. package/dist/types/index.d.ts +24 -0
  87. package/dist/types/index.d.ts.map +1 -0
  88. package/dist/types/interfaces/config-loader.interface.d.ts +33 -0
  89. package/dist/types/interfaces/config-loader.interface.d.ts.map +1 -0
  90. package/dist/types/interfaces/config-manager.interface.d.ts +86 -0
  91. package/dist/types/interfaces/config-manager.interface.d.ts.map +1 -0
  92. package/dist/types/interfaces/env-file-loader.interface.d.ts +12 -0
  93. package/dist/types/interfaces/env-file-loader.interface.d.ts.map +1 -0
  94. package/dist/types/interfaces/environment-loader.interface.d.ts +10 -0
  95. package/dist/types/interfaces/environment-loader.interface.d.ts.map +1 -0
  96. package/dist/types/interfaces/index.d.ts +8 -0
  97. package/dist/types/interfaces/index.d.ts.map +1 -0
  98. package/dist/types/interfaces/s3-loader.interface.d.ts +14 -0
  99. package/dist/types/interfaces/s3-loader.interface.d.ts.map +1 -0
  100. package/dist/types/interfaces/secrets-manager-loader.interface.d.ts +12 -0
  101. package/dist/types/interfaces/secrets-manager-loader.interface.d.ts.map +1 -0
  102. package/dist/types/interfaces/ssm-parameter-store-loader.interface.d.ts +14 -0
  103. package/dist/types/interfaces/ssm-parameter-store-loader.interface.d.ts.map +1 -0
  104. package/dist/types/loaders/env-file.loader.d.ts +69 -0
  105. package/dist/types/loaders/env-file.loader.d.ts.map +1 -0
  106. package/dist/types/loaders/environment.loader.d.ts +46 -0
  107. package/dist/types/loaders/environment.loader.d.ts.map +1 -0
  108. package/dist/types/loaders/index.d.ts +6 -0
  109. package/dist/types/loaders/index.d.ts.map +1 -0
  110. package/dist/types/loaders/s3.loader.d.ts +62 -0
  111. package/dist/types/loaders/s3.loader.d.ts.map +1 -0
  112. package/dist/types/loaders/secrets-manager.loader.d.ts +68 -0
  113. package/dist/types/loaders/secrets-manager.loader.d.ts.map +1 -0
  114. package/dist/types/loaders/ssm-parameter-store.loader.d.ts +78 -0
  115. package/dist/types/loaders/ssm-parameter-store.loader.d.ts.map +1 -0
  116. package/dist/types/utils/env-file-parser.util.d.ts +45 -0
  117. package/dist/types/utils/env-file-parser.util.d.ts.map +1 -0
  118. package/dist/types/utils/index.d.ts +3 -0
  119. package/dist/types/utils/index.d.ts.map +1 -0
  120. package/dist/types/utils/validation.util.d.ts +53 -0
  121. package/dist/types/utils/validation.util.d.ts.map +1 -0
  122. package/package.json +97 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets-manager.loader.js","sourceRoot":"","sources":["../../../src/loaders/secrets-manager.loader.ts"],"names":[],"mappings":";;;AAAA,4EAA8F;AAC9F,wEAAsE;AAItE,sCAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,oBAAoB;IAQ/B,YAAY,SAAqC,EAAE;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAA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AC7C,MAAM,IAAI,wBAAe,CACvB,2CAA2C,UAAU,8BAA8B,EACnF,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,CACN,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,4CAA4C;YAC5C,MAAM,IAAI,wBAAe,CACvB,8BAA8B,UAAU,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC/H,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC3C,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,+BAAsB,CAC9B,6CAA6C,IAAI,CAAC,OAAO,KAAK;gBAC5D,2BAA2B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACtF,IAAI,CAAC,OAAO,EAAE,CACf,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,qBAAqB;QACnB,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAChD,CAAC;CACF;AArKD,oDAqKC"}
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SSMParameterStoreLoader = void 0;
4
+ const client_ssm_1 = require("@aws-sdk/client-ssm");
5
+ const credential_providers_1 = require("@aws-sdk/credential-providers");
6
+ const errors_1 = require("../errors");
7
+ /**
8
+ * Loader that reads configuration from AWS SSM Parameter Store.
9
+ * Supports environment-aware path construction, pagination, and decryption options.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Basic usage
14
+ * const loader = new SSMParameterStoreLoader({
15
+ * parameterPath: '/my-app/config',
16
+ * region: 'us-east-1'
17
+ * });
18
+ *
19
+ * // With environment mapping
20
+ * const loader = new SSMParameterStoreLoader({
21
+ * parameterPath: '/my-app/config',
22
+ * environmentMapping: {
23
+ * development: 'dev',
24
+ * staging: 'stg',
25
+ * production: 'prod'
26
+ * }
27
+ * });
28
+ * ```
29
+ */
30
+ class SSMParameterStoreLoader {
31
+ constructor(config = {}) {
32
+ this._appEnv = process.env['APP_ENV'] || process.env['NODE_ENV'] || 'local';
33
+ // Set default configuration
34
+ this._config = {
35
+ parameterPath: config.parameterPath || '/config-aws',
36
+ region: config.region || process.env['AWS_REGION'] || 'us-east-1',
37
+ environmentMapping: config.environmentMapping || {
38
+ development: 'dev',
39
+ test: 'test',
40
+ production: 'production',
41
+ },
42
+ withDecryption: config.withDecryption ?? true,
43
+ };
44
+ // Initialize AWS SSM client
45
+ this._client = new client_ssm_1.SSMClient({
46
+ credentials: (0, credential_providers_1.fromNodeProviderChain)(),
47
+ region: this._config.region,
48
+ });
49
+ }
50
+ /**
51
+ * Get the name of this loader for logging and debugging.
52
+ * @returns The loader name with parameter path
53
+ */
54
+ getName() {
55
+ try {
56
+ const parameterPath = this.buildParameterPath();
57
+ return `SSMParameterStoreLoader(${parameterPath})`;
58
+ }
59
+ catch {
60
+ // Fallback if path construction fails (e.g., missing env mapping)
61
+ return `SSMParameterStoreLoader(${this._config.parameterPath})`;
62
+ }
63
+ }
64
+ /**
65
+ * Check if this loader is available in the current environment.
66
+ * @returns Promise resolving to true if not in local environment and AWS credentials are available
67
+ */
68
+ async isAvailable() {
69
+ // Skip in local environment
70
+ if (this._appEnv === 'local') {
71
+ return false;
72
+ }
73
+ try {
74
+ // Test AWS credentials by attempting to get caller identity
75
+ await this._client.config.credentials();
76
+ return true;
77
+ }
78
+ catch {
79
+ return false;
80
+ }
81
+ }
82
+ /**
83
+ * Load configuration from AWS SSM Parameter Store.
84
+ * Implements recursive parameter fetching with NextToken handling for pagination.
85
+ * @returns Promise resolving to configuration key-value pairs from parameters
86
+ * @throws AWSServiceError if AWS operation fails
87
+ * @throws ConfigurationLoadError if parameter path cannot be constructed
88
+ */
89
+ async load() {
90
+ // Skip loading in local environment
91
+ if (this._appEnv === 'local') {
92
+ return {};
93
+ }
94
+ const parameterPath = this.buildParameterPath();
95
+ const result = {};
96
+ let nextToken;
97
+ try {
98
+ do {
99
+ const command = new client_ssm_1.GetParametersByPathCommand({
100
+ Path: parameterPath,
101
+ Recursive: true,
102
+ WithDecryption: this._config.withDecryption,
103
+ NextToken: nextToken,
104
+ });
105
+ const response = await this._client.send(command);
106
+ if (!response.Parameters) {
107
+ // No parameters found - this is not necessarily an error
108
+ break;
109
+ }
110
+ // Process each parameter
111
+ for (const param of response.Parameters) {
112
+ const key = this.transformParameterName(param.Name, parameterPath);
113
+ if (key && param.Value !== undefined) {
114
+ result[key] = param.Value;
115
+ }
116
+ }
117
+ nextToken = response.NextToken;
118
+ } while (nextToken);
119
+ return result;
120
+ }
121
+ catch (error) {
122
+ // Handle specific AWS errors
123
+ if (error instanceof Error) {
124
+ if (error.name === 'ResourceNotFoundException' || error.name === 'ParameterNotFound') {
125
+ // No parameters found at path - this is not necessarily an error
126
+ return {};
127
+ }
128
+ if (error.name === 'AccessDeniedException') {
129
+ throw new errors_1.AWSServiceError(`Access denied when retrieving parameters from path '${parameterPath}'. Check AWS credentials and permissions.`, 'SSM', 'GetParametersByPath', error);
130
+ }
131
+ if (error.name === 'InvalidFilterKey' || error.name === 'InvalidFilterValue') {
132
+ throw new errors_1.AWSServiceError(`Invalid parameter path '${parameterPath}'. Check path format.`, 'SSM', 'GetParametersByPath', error);
133
+ }
134
+ }
135
+ // For other errors, wrap in AWSServiceError
136
+ throw new errors_1.AWSServiceError(`Failed to retrieve parameters from path '${parameterPath}' in AWS SSM Parameter Store: ${error instanceof Error ? error.message : String(error)}`, 'SSM', 'GetParametersByPath', error instanceof Error ? error : undefined);
137
+ }
138
+ }
139
+ /**
140
+ * Build the environment-aware parameter path.
141
+ * @returns The full parameter path with environment prefix
142
+ * @throws ConfigurationLoadError if no environment mapping found
143
+ */
144
+ buildParameterPath() {
145
+ const envPrefix = this._config.environmentMapping[this._appEnv];
146
+ if (!envPrefix) {
147
+ throw new errors_1.ConfigurationLoadError(`No environment mapping found for APP_ENV '${this._appEnv}'. ` +
148
+ `Available environments: ${Object.keys(this._config.environmentMapping).join(', ')}`, this.getName());
149
+ }
150
+ return `/${envPrefix}${this._config.parameterPath}`;
151
+ }
152
+ /**
153
+ * Transform parameter name by removing the prefix and converting to uppercase.
154
+ * Example: '/dev/config-aws/database/host' -> 'DATABASE_HOST'
155
+ * @param parameterName The full parameter name from AWS
156
+ * @param pathPrefix The path prefix to remove
157
+ * @returns The transformed parameter name or null if invalid
158
+ */
159
+ transformParameterName(parameterName, pathPrefix) {
160
+ if (!parameterName) {
161
+ return null;
162
+ }
163
+ // Remove the path prefix
164
+ let key = parameterName;
165
+ if (key.startsWith(pathPrefix)) {
166
+ key = key.substring(pathPrefix.length);
167
+ }
168
+ // Remove leading slash if present
169
+ if (key.startsWith('/')) {
170
+ key = key.substring(1);
171
+ }
172
+ // Convert slashes to underscores and uppercase
173
+ key = key.replace(/\//g, '_').toUpperCase();
174
+ // Return null for empty keys
175
+ return key || null;
176
+ }
177
+ /**
178
+ * Get the current app environment.
179
+ * @returns The current APP_ENV or NODE_ENV value
180
+ */
181
+ getAppEnv() {
182
+ return this._appEnv;
183
+ }
184
+ /**
185
+ * Get the environment mapping configuration.
186
+ * @returns The environment mapping record
187
+ */
188
+ getEnvironmentMapping() {
189
+ return { ...this._config.environmentMapping };
190
+ }
191
+ }
192
+ exports.SSMParameterStoreLoader = SSMParameterStoreLoader;
193
+ //# sourceMappingURL=ssm-parameter-store.loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssm-parameter-store.loader.js","sourceRoot":"","sources":["../../../src/loaders/ssm-parameter-store.loader.ts"],"names":[],"mappings":";;;AAAA,oDAA4E;AAC5E,wEAAsE;AAItE,sCAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,uBAAuB;IAQlC,YAAY,SAAwC,EAAE;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC;QAE5E,4BAA4B;QAC5B,IAAI,CAAC,OAAO,GAAG;YACb,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,aAAa;YACpD,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,WAAW;YACjE,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI;gBAC/C,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,YAAY;aACzB;YACD,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,IAAI;SAC9C,CAAC;QAEF,4BAA4B;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAS,CAAC;YAC3B,WAAW,EAAE,IAAA,4CAAqB,GAAE;YACpC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;SAC5B,CAAC,CAAC;IACL,CAAC;IAGD;;;OAGG;IACH,OAAO;QACL,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAChD,OAAO,2BAA2B,aAAa,GAAG,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC;YACP,kEAAkE;YAClE,OAAO,2BAA2B,IAAI,CAAC,OAAO,CAA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EAAE,CAAC;IAChD,CAAC;CACF;AApND,0DAoNC"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvFileParser = void 0;
4
+ /**
5
+ * Parser for AWS ECS-compatible environment files.
6
+ *
7
+ * Format rules (per AWS ECS documentation):
8
+ * - Lines beginning with # are comments and ignored
9
+ * - Blank lines are ignored
10
+ * - Format: VARIABLE=VALUE (no spaces around =)
11
+ * - Variable names must match /^[a-zA-Z_][a-zA-Z0-9_]*$/
12
+ * - Values are literal (no quote processing, no interpolation)
13
+ * - One variable per line
14
+ * - Lines without = are ignored
15
+ * - Maximum line length: 32KB
16
+ *
17
+ * @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/use-environment-file.html
18
+ */
19
+ class EnvFileParser {
20
+ /**
21
+ * Parse environment file content into key-value pairs.
22
+ * @param content The raw content of the environment file
23
+ * @returns Record of environment variable names to values
24
+ */
25
+ static parse(content) {
26
+ const result = {};
27
+ // Handle empty content
28
+ if (!content) {
29
+ return result;
30
+ }
31
+ const lines = content.split(/\r?\n/);
32
+ for (const line of lines) {
33
+ // Skip lines exceeding max length
34
+ if (line.length > this.MAX_LINE_LENGTH) {
35
+ continue;
36
+ }
37
+ // Skip blank lines
38
+ if (line.trim() === '') {
39
+ continue;
40
+ }
41
+ // Skip comment lines (lines starting with # after optional whitespace)
42
+ if (line.trimStart().startsWith('#')) {
43
+ continue;
44
+ }
45
+ // Find the first = sign
46
+ const equalsIndex = line.indexOf('=');
47
+ if (equalsIndex === -1) {
48
+ // Lines without = are ignored
49
+ continue;
50
+ }
51
+ const key = line.substring(0, equalsIndex);
52
+ const value = line.substring(equalsIndex + 1);
53
+ // Validate variable name (must not be empty and must match pattern)
54
+ if (key.length === 0 || !this.VARIABLE_NAME_PATTERN.test(key)) {
55
+ continue;
56
+ }
57
+ result[key] = value;
58
+ }
59
+ return result;
60
+ }
61
+ /**
62
+ * Check if a variable name is valid per AWS ECS format.
63
+ * Variable names must:
64
+ * - Start with a letter (a-z, A-Z) or underscore (_)
65
+ * - Contain only alphanumeric characters and underscores
66
+ * - Not be empty
67
+ *
68
+ * @param name The variable name to check
69
+ * @returns true if the name is valid
70
+ */
71
+ static isValidVariableName(name) {
72
+ if (!name || name.length === 0) {
73
+ return false;
74
+ }
75
+ return this.VARIABLE_NAME_PATTERN.test(name);
76
+ }
77
+ /**
78
+ * Serialize a configuration object to AWS ECS-compatible env file format.
79
+ * @param config The configuration object to serialize
80
+ * @returns The serialized env file content
81
+ */
82
+ static serialize(config) {
83
+ const lines = [];
84
+ for (const [key, value] of Object.entries(config)) {
85
+ // Only include valid variable names
86
+ if (this.isValidVariableName(key)) {
87
+ lines.push(`${key}=${value}`);
88
+ }
89
+ }
90
+ return lines.join('\n');
91
+ }
92
+ }
93
+ exports.EnvFileParser = EnvFileParser;
94
+ /** Maximum line length per AWS ECS specification */
95
+ EnvFileParser.MAX_LINE_LENGTH = 32 * 1024; // 32KB
96
+ /** Valid variable name pattern: alphanumeric + underscore, cannot start with digit */
97
+ EnvFileParser.VARIABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
98
+ //# sourceMappingURL=env-file-parser.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-file-parser.util.js","sourceRoot":"","sources":["../../../src/utils/env-file-parser.util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAa,aAAa;IAOxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAe;QAC1B,MAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,uBAAuB;QACvB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAErC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,kCAAkC;YAClC,IAAI,IAAI,CAAC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,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,oCAAoC;YACpC,IAAI,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AA5FH,sCA6FC;AA5FC,oDAAoD;AAC5B,6BAAe,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;AAE5D,sFAAsF;AAC9D,mCAAqB,GAAG,0BAA0B,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvFileParser = exports.ConfigValidationUtil = void 0;
4
+ var validation_util_1 = require("./validation.util");
5
+ Object.defineProperty(exports, "ConfigValidationUtil", { enumerable: true, get: function () { return validation_util_1.ConfigValidationUtil; } });
6
+ var env_file_parser_util_1 = require("./env-file-parser.util");
7
+ Object.defineProperty(exports, "EnvFileParser", { enumerable: true, get: function () { return env_file_parser_util_1.EnvFileParser; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA;AAC7B,+DAAuD;AAA9C,qHAAA,aAAa,OAAA"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigValidationUtil = void 0;
4
+ const errors_1 = require("../errors");
5
+ /**
6
+ * Framework-agnostic validation utility for configuration values.
7
+ * Provides methods for validating configuration objects against Zod schemas.
8
+ */
9
+ class ConfigValidationUtil {
10
+ /**
11
+ * Validates a value against a Zod schema.
12
+ * @param schema The Zod schema to validate against
13
+ * @param value The value to validate
14
+ * @param context Optional context for error messages
15
+ * @returns The validated and transformed value
16
+ * @throws ValidationError if validation fails
17
+ */
18
+ static validate(schema, value, context) {
19
+ const result = schema.safeParse(value);
20
+ if (result.success) {
21
+ return result.data;
22
+ }
23
+ const errors = this.formatValidationErrors(result.error);
24
+ const contextMessage = context
25
+ ? `Configuration validation failed for ${context}`
26
+ : 'Configuration validation failed';
27
+ throw new errors_1.ValidationError(contextMessage, errors);
28
+ }
29
+ /**
30
+ * Safely validates a value against a Zod schema without throwing.
31
+ * @param schema The Zod schema to validate against
32
+ * @param value The value to validate
33
+ * @returns Object with success flag and either data or error
34
+ */
35
+ static safeValidate(schema, value) {
36
+ const result = schema.safeParse(value);
37
+ if (result.success) {
38
+ return { success: true, data: result.data };
39
+ }
40
+ const errors = this.formatValidationErrors(result.error);
41
+ const validationError = new errors_1.ValidationError('Configuration validation failed', errors);
42
+ return { success: false, error: validationError };
43
+ }
44
+ /**
45
+ * Formats Zod validation errors into a structured format.
46
+ * @param error The ZodError to format
47
+ * @returns Formatted error object or string
48
+ */
49
+ static formatValidationErrors(error) {
50
+ // If there's only one error at the root level, return just the message
51
+ if (error.issues.length === 1) {
52
+ const issue = error.issues[0];
53
+ if (issue && Array.isArray(issue.path) && issue.path.length === 0) {
54
+ return issue.message;
55
+ }
56
+ }
57
+ // For multiple errors or nested paths, create a structured object
58
+ return error.issues.reduce((errors, issue) => {
59
+ const path = issue.path.join('.');
60
+ const key = path || 'root';
61
+ if (!errors[key]) {
62
+ errors[key] = [];
63
+ }
64
+ errors[key].push({
65
+ message: issue.message,
66
+ code: issue.code,
67
+ path: issue.path,
68
+ });
69
+ return errors;
70
+ }, {});
71
+ }
72
+ /**
73
+ * Creates a detailed error message for configuration validation failures.
74
+ * @param error The ZodError to create a message for
75
+ * @param context Optional context for the error
76
+ * @returns Detailed error message string
77
+ */
78
+ static createDetailedErrorMessage(error, context) {
79
+ const contextPrefix = context ? `${context}: ` : '';
80
+ if (error.issues.length === 1) {
81
+ const issue = error.issues[0];
82
+ if (issue) {
83
+ const pathStr = issue.path.length > 0 ? ` at '${issue.path.join('.')}'` : '';
84
+ return `${contextPrefix}${issue.message}${pathStr}`;
85
+ }
86
+ }
87
+ const errorMessages = error.issues.map((issue) => {
88
+ const pathStr = issue.path.length > 0 ? ` at '${issue.path.join('.')}'` : '';
89
+ return ` - ${issue.message}${pathStr}`;
90
+ });
91
+ return `${contextPrefix}Multiple validation errors:\n${errorMessages.join('\n')}`;
92
+ }
93
+ /**
94
+ * Validates configuration with enhanced error context.
95
+ * @param schema The Zod schema to validate against
96
+ * @param value The configuration object to validate
97
+ * @param source The source of the configuration (e.g., 'environment', 'secrets-manager')
98
+ * @returns The validated configuration
99
+ * @throws ValidationError with enhanced context
100
+ */
101
+ static validateConfiguration(schema, value, source) {
102
+ try {
103
+ return this.validate(schema, value, `${source} configuration`);
104
+ }
105
+ catch (error) {
106
+ if (error instanceof errors_1.ValidationError) {
107
+ // Enhance the error with source information
108
+ const enhancedMessage = `Configuration validation failed for source '${source}': ${error.message}`;
109
+ throw new errors_1.ValidationError(enhancedMessage, error.validationErrors);
110
+ }
111
+ throw error;
112
+ }
113
+ }
114
+ }
115
+ exports.ConfigValidationUtil = ConfigValidationUtil;
116
+ //# sourceMappingURL=validation.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.util.js","sourceRoot":"","sources":["../../../src/utils/validation.util.ts"],"names":[],"mappings":";;;AACA,sCAA4C;AAE5C;;;GAGG;AACH,MAAa,oBAAoB;IAC/B;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,CACb,MAAS,EACT,KAAc,EACd,OAAgB;QAEhB,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEvC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,sBAAsB,CAA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