envilder 0.7.5 → 0.7.7
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/README.md +9 -21
- package/docs/CHANGELOG.md +110 -5
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.d.ts +14 -2
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.d.ts.map +1 -1
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.js +113 -18
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,26 +9,12 @@
|
|
|
9
9
|
<span>Streamline your environment setup with AWS Parameter Store</span>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</a>
|
|
19
|
-
<a href="https://github.com/macalbert/envilder/actions/workflows/tests.yml">
|
|
20
|
-
<img src="https://github.com/macalbert/envilder/actions/workflows/tests.yml/badge.svg" alt="CI Tests">
|
|
21
|
-
</a>
|
|
22
|
-
<a href="https://macalbert.github.io/envilder/">
|
|
23
|
-
<img src="https://img.shields.io/badge/coverage-report-green.svg" alt="Coverage Report">
|
|
24
|
-
</a>
|
|
25
|
-
<a href="https://snyk.io/test/github/macalbert/envilder">
|
|
26
|
-
<img src="https://snyk.io/test/github/macalbert/envilder/badge.svg" alt="Known Vulnerabilities">
|
|
27
|
-
</a>
|
|
28
|
-
<a href="./LICENSE">
|
|
29
|
-
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License">
|
|
30
|
-
</a>
|
|
31
|
-
</p>
|
|
12
|
+
[](https://www.npmjs.com/package/envilder)
|
|
13
|
+
[](https://npmcharts.com/compare/envilder)
|
|
14
|
+
[](https://github.com/macalbert/envilder/actions/workflows/tests.yml)
|
|
15
|
+
[](https://macalbert.github.io/envilder/)
|
|
16
|
+
[](https://snyk.io/test/github/macalbert/envilder)
|
|
17
|
+
[](./LICENSE)
|
|
32
18
|
|
|
33
19
|
## Why centralize environment variables?
|
|
34
20
|
|
|
@@ -70,7 +56,9 @@ onboarding and CI/CD workflows.
|
|
|
70
56
|
- [✅ How Envilder makes life easier](#-how-envilder-makes-life-easier)
|
|
71
57
|
- [📚 Table of Contents](#-table-of-contents)
|
|
72
58
|
- [⚙️ Features](#️-features)
|
|
59
|
+
- [🧱 Feature Status](#-feature-status)
|
|
73
60
|
- [💾 Installation](#-installation)
|
|
61
|
+
- [🤖 GitHub Action](#-github-action)
|
|
74
62
|
- [🚀 Quick Start](#-quick-start)
|
|
75
63
|
- [🎥 Video Demonstration](#-video-demonstration)
|
|
76
64
|
- [🏁 Get Started (3 steps)](#-get-started-3-steps)
|
|
@@ -129,7 +117,7 @@ Use Envilder directly in your CI/CD workflows with our official GitHub Action:
|
|
|
129
117
|
aws-region: us-east-1
|
|
130
118
|
|
|
131
119
|
- name: Pull secrets from AWS SSM
|
|
132
|
-
uses: macalbert/envilder/github-action@v0.7.
|
|
120
|
+
uses: macalbert/envilder/github-action@v0.7.6
|
|
133
121
|
with:
|
|
134
122
|
map-file: param-map.json
|
|
135
123
|
env-file: .env
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,100 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- markdownlint-disable MD024 -->
|
|
2
|
+
# Changelog
|
|
3
|
+
|
|
4
|
+
## [0.7.6] - 2026-01-16
|
|
5
|
+
|
|
6
|
+
### Fixed
|
|
7
|
+
|
|
8
|
+
* **ci:** Align npm publish script with CI workflow expectations to prevent failures
|
|
9
|
+
* Removed redundant validation steps (lint, build, test) from publish script that were already executed in CI
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
* Simplified npm publish script from full validation pipeline to `npm pack --dry-run && npm publish`
|
|
14
|
+
* Updated README badge links - npm downloads now links to npmcharts for visual statistics
|
|
15
|
+
* Converted README badges from HTML to standard Markdown format for better maintainability
|
|
16
|
+
* Updated GitHub Action version references from v0.7.2 to v0.7.6 in documentation
|
|
17
|
+
|
|
18
|
+
### Removed
|
|
19
|
+
|
|
20
|
+
* **ci:** Deleted deprecated `publish-action.yml` workflow
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## [0.7.5] - 2026-01-15
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
|
|
28
|
+
* Remove changelog generation instructions from documentation ([#104](https://github.com/macalbert/envilder/pull/104))
|
|
29
|
+
* Update GitHub Copilot instructions
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
* Bump undici to address security vulnerability ([#105](https://github.com/macalbert/envilder/pull/105))
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## [0.7.4] - 2026-01-02
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
* **ci:** Update npm publish command to include `--no-git-checks` flag
|
|
42
|
+
|
|
43
|
+
### Dependencies
|
|
44
|
+
|
|
45
|
+
* Bump @commitlint/cli from 20.1.0 to 20.2.0 ([#103](https://github.com/macalbert/envilder/pull/103))
|
|
46
|
+
* Bump testcontainers from 11.9.0 to 11.11.0 ([#102](https://github.com/macalbert/envilder/pull/102))
|
|
47
|
+
* Bump @types/node from 24.10.1 to 25.0.3 ([#101](https://github.com/macalbert/envilder/pull/101))
|
|
48
|
+
* Bump @testcontainers/localstack from 11.9.0 to 11.11.0 ([#100](https://github.com/macalbert/envilder/pull/100))
|
|
49
|
+
* Bump @commitlint/config-conventional ([#99](https://github.com/macalbert/envilder/pull/99))
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## [0.7.3] - 2025-12-06
|
|
54
|
+
|
|
55
|
+
### Dependencies
|
|
56
|
+
|
|
57
|
+
* Bump actions/checkout from 5 to 6 ([#98](https://github.com/macalbert/envilder/pull/98))
|
|
58
|
+
* Bump glob from 11.1.0 to 13.0.0 ([#97](https://github.com/macalbert/envilder/pull/97))
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## [0.7.2] - 2025-11-29
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
* **ci:** Update Node.js version to 24 in workflow
|
|
67
|
+
* Update publish command to use pnpm
|
|
68
|
+
* Add repository field to package.json
|
|
69
|
+
* Standardize quotes in publish-npm.yml
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
* Bump pnpm/action-setup from 2 to 4 ([#92](https://github.com/macalbert/envilder/pull/92))
|
|
74
|
+
* Bump @commitlint/cli from 19.8.1 to 20.1.0 ([#94](https://github.com/macalbert/envilder/pull/94))
|
|
75
|
+
* Bump glob in the npm_and_yarn group ([#96](https://github.com/macalbert/envilder/pull/96))
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## [0.7.1] - 2025-11-16
|
|
80
|
+
|
|
81
|
+
### Documentation
|
|
82
|
+
|
|
83
|
+
* Update README and ROADMAP for GitHub Action integration ([#95](https://github.com/macalbert/envilder/pull/95))
|
|
84
|
+
* Update GitHub Action version from v1 to v0.7.1
|
|
85
|
+
* Fix example version for GitHub Action
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
|
|
89
|
+
* **ci:** Update workflow to use pnpm for dependency management
|
|
90
|
+
|
|
91
|
+
### Tests
|
|
92
|
+
|
|
93
|
+
* Increase timeout for E2E tests to 60 seconds
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## [0.7.0](https://github.com/macalbert/envilder/compare/v0.6.6...v0.7.0) (2025-11-16)
|
|
2
98
|
|
|
3
99
|
* ♻️ Move GitHub Action to github-action/ subfolder ([d9bf4d2](https://github.com/macalbert/envilder/commit/d9bf4d2e81acbb1ef2b4e0034c0b6aaa8b307ba3))
|
|
4
100
|
|
|
@@ -10,7 +106,7 @@
|
|
|
10
106
|
* **githubAction:** Remove source map generation from build:gha script ([8989448](https://github.com/macalbert/envilder/commit/898944898cdea866f28f8874b714bfe3fd2dd88e))
|
|
11
107
|
* **githubAction:** Update action references in documentation and code ([412601b](https://github.com/macalbert/envilder/commit/412601b7b56a90dd50e031addcaf192e2dec8ba3))
|
|
12
108
|
|
|
13
|
-
|
|
109
|
+
## Features
|
|
14
110
|
|
|
15
111
|
* **githubAction:** Add end-to-end tests for GitHub Actions simulation ([29464a0](https://github.com/macalbert/envilder/commit/29464a016d0072cc728345400f68e0c62669579b))
|
|
16
112
|
* **githubAction:** Update action paths and add new GitHub Action implementation ([4310e50](https://github.com/macalbert/envilder/commit/4310e5040fa4952c50e800578fb91e00cf2f7a36))
|
|
@@ -21,8 +117,9 @@
|
|
|
21
117
|
|
|
22
118
|
* Action path changed from macalbert/envilder@v1 to macalbert/envilder/github-action@v1
|
|
23
119
|
|
|
24
|
-
|
|
25
|
-
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Changelog
|
|
26
123
|
|
|
27
124
|
All notable changes to this project will be documented in this file.
|
|
28
125
|
|
|
@@ -319,8 +416,15 @@ This project follows [Conventional Commits](https://www.conventionalcommits.org/
|
|
|
319
416
|
3. Run `pnpm version [patch|minor|major]` to create a new release
|
|
320
417
|
4. Move `[Unreleased]` entries to the new version section
|
|
321
418
|
|
|
322
|
-
**Alternative**: Use [GitHub Releases](https://github.com/macalbert/envilder/releases) to auto-generate release notes
|
|
419
|
+
**Alternative**: Use [GitHub Releases](https://github.com/macalbert/envilder/releases) to auto-generate release notes
|
|
420
|
+
from commit messages.
|
|
323
421
|
|
|
422
|
+
[0.7.6]: https://github.com/macalbert/envilder/compare/v0.7.5...v0.7.6
|
|
423
|
+
[0.7.5]: https://github.com/macalbert/envilder/compare/v0.7.4...v0.7.5
|
|
424
|
+
[0.7.4]: https://github.com/macalbert/envilder/compare/v0.7.3...v0.7.4
|
|
425
|
+
[0.7.3]: https://github.com/macalbert/envilder/compare/v0.7.2...v0.7.3
|
|
426
|
+
[0.7.2]: https://github.com/macalbert/envilder/compare/v0.7.1...v0.7.2
|
|
427
|
+
[0.7.1]: https://github.com/macalbert/envilder/compare/v0.6.6...v0.7.1
|
|
324
428
|
[0.6.6]: https://github.com/macalbert/envilder/compare/v0.6.5...v0.6.6
|
|
325
429
|
[0.6.5]: https://github.com/macalbert/envilder/compare/v0.6.4...v0.6.5
|
|
326
430
|
[0.6.4]: https://github.com/macalbert/envilder/compare/v0.6.3...v0.6.4
|
|
@@ -336,3 +440,4 @@ This project follows [Conventional Commits](https://www.conventionalcommits.org/
|
|
|
336
440
|
[0.2.3]: https://github.com/macalbert/envilder/compare/v0.2.1...v0.2.3
|
|
337
441
|
[0.2.1]: https://github.com/macalbert/envilder/compare/v0.1.4...v0.2.1
|
|
338
442
|
[0.1.4]: https://github.com/macalbert/envilder/releases/tag/v0.1.4
|
|
443
|
+
<!-- markdownlint-enable MD024 -->
|
|
@@ -16,7 +16,19 @@ export declare class PushEnvToSsmCommandHandler {
|
|
|
16
16
|
*/
|
|
17
17
|
handle(command: PushEnvToSsmCommand): Promise<void>;
|
|
18
18
|
private loadConfiguration;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Validates and groups environment variables by SSM path.
|
|
21
|
+
* Ensures that all variables pointing to the same SSM path have the same value.
|
|
22
|
+
* Returns a map of SSM path to value.
|
|
23
|
+
*/
|
|
24
|
+
private validateAndGroupByPath;
|
|
25
|
+
private pushParametersToSSM;
|
|
26
|
+
private pushParameter;
|
|
27
|
+
/**
|
|
28
|
+
* Retries an async operation with exponential backoff and jitter.
|
|
29
|
+
* Handles AWS SSM throttling errors (TooManyUpdates).
|
|
30
|
+
*/
|
|
31
|
+
private retryWithBackoff;
|
|
32
|
+
private getErrorMessage;
|
|
21
33
|
}
|
|
22
34
|
//# sourceMappingURL=PushEnvToSsmCommandHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushEnvToSsmCommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,qBACa,0BAA0B;IAGnC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAH7B,cAAc,EAAE,eAAe,EAE/B,aAAa,EAAE,cAAc,EACN,MAAM,EAAE,OAAO;IAGzD;;;;;;OAMG;IACG,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YAmB3C,iBAAiB;
|
|
1
|
+
{"version":3,"file":"PushEnvToSsmCommandHandler.d.ts","sourceRoot":"","sources":["../../../../src/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,qBACa,0BAA0B;IAGnC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAH7B,cAAc,EAAE,eAAe,EAE/B,aAAa,EAAE,cAAc,EACN,MAAM,EAAE,OAAO;IAGzD;;;;;;OAMG;IACG,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YAmB3C,iBAAiB;IAwB/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;YAmDhB,mBAAmB;YAoBnB,aAAa;IAgB3B;;;OAGG;YACW,gBAAgB;IAoC9B,OAAO,CAAC,eAAe;CA0CxB"}
|
|
@@ -39,12 +39,13 @@ let PushEnvToSsmCommandHandler = class PushEnvToSsmCommandHandler {
|
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
try {
|
|
41
41
|
this.logger.info(`Starting push operation from '${command.envFilePath}' using map '${command.mapPath}'`);
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const config = yield this.loadConfiguration(command);
|
|
43
|
+
const validatedPaths = this.validateAndGroupByPath(config);
|
|
44
|
+
yield this.pushParametersToSSM(validatedPaths);
|
|
44
45
|
this.logger.info(`Successfully pushed environment variables from '${command.envFilePath}' to AWS SSM.`);
|
|
45
46
|
}
|
|
46
47
|
catch (error) {
|
|
47
|
-
const errorMessage =
|
|
48
|
+
const errorMessage = this.getErrorMessage(error);
|
|
48
49
|
this.logger.error(`Failed to push environment file: ${errorMessage}`);
|
|
49
50
|
throw error;
|
|
50
51
|
}
|
|
@@ -61,29 +62,123 @@ let PushEnvToSsmCommandHandler = class PushEnvToSsmCommandHandler {
|
|
|
61
62
|
return { paramMap, envVariables };
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Validates and groups environment variables by SSM path.
|
|
67
|
+
* Ensures that all variables pointing to the same SSM path have the same value.
|
|
68
|
+
* Returns a map of SSM path to value.
|
|
69
|
+
*/
|
|
70
|
+
validateAndGroupByPath(config) {
|
|
71
|
+
const { paramMap, envVariables } = config;
|
|
72
|
+
const pathToValueMap = new Map();
|
|
73
|
+
for (const [envKey, ssmPath] of Object.entries(paramMap)) {
|
|
74
|
+
const envValue = envVariables[envKey];
|
|
75
|
+
if (envValue === undefined) {
|
|
76
|
+
this.logger.warn(`Warning: Environment variable ${envKey} not found in environment file`);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const existing = pathToValueMap.get(ssmPath);
|
|
80
|
+
if (existing) {
|
|
81
|
+
if (existing.value !== envValue) {
|
|
82
|
+
const existingMasked = new EnvironmentVariable(existing.sourceKeys[0], existing.value, true).maskedValue;
|
|
83
|
+
const newMasked = new EnvironmentVariable(envKey, envValue, true)
|
|
84
|
+
.maskedValue;
|
|
85
|
+
throw new Error(`Conflicting values for SSM path '${ssmPath}': ` +
|
|
86
|
+
`'${existing.sourceKeys[0]}' has value '${existingMasked}' ` +
|
|
87
|
+
`but '${envKey}' has value '${newMasked}'`);
|
|
88
|
+
}
|
|
89
|
+
existing.sourceKeys.push(envKey);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
pathToValueMap.set(ssmPath, { value: envValue, sourceKeys: [envKey] });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const uniquePaths = pathToValueMap.size;
|
|
96
|
+
const totalVariables = Object.keys(paramMap).length;
|
|
97
|
+
this.logger.info(`Validated ${totalVariables} environment variables mapping to ${uniquePaths} unique SSM parameters`);
|
|
98
|
+
return pathToValueMap;
|
|
99
|
+
}
|
|
100
|
+
pushParametersToSSM(pathToValueMap) {
|
|
65
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
return this.
|
|
102
|
+
const pathsToProcess = Array.from(pathToValueMap.keys());
|
|
103
|
+
this.logger.info(`Processing ${pathsToProcess.length} unique SSM parameters`);
|
|
104
|
+
// Process parameters in parallel with retry logic for throttling errors
|
|
105
|
+
const parameterProcessingPromises = Array.from(pathToValueMap.entries()).map(([ssmPath, { value, sourceKeys }]) => {
|
|
106
|
+
return this.retryWithBackoff(() => this.pushParameter(ssmPath, value, sourceKeys));
|
|
71
107
|
});
|
|
72
|
-
yield Promise.all(
|
|
108
|
+
yield Promise.all(parameterProcessingPromises);
|
|
73
109
|
});
|
|
74
110
|
}
|
|
75
|
-
|
|
111
|
+
pushParameter(ssmPath, value, sourceKeys) {
|
|
76
112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
113
|
+
const envVariable = new EnvironmentVariable(sourceKeys[0], value, true);
|
|
114
|
+
yield this.secretProvider.setSecret(ssmPath, value);
|
|
115
|
+
const keysDescription = sourceKeys.length > 1 ? `${sourceKeys.join(', ')}` : sourceKeys[0];
|
|
116
|
+
this.logger.info(`Pushed ${keysDescription}=${envVariable.maskedValue} to AWS SSM at path ${ssmPath}`);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Retries an async operation with exponential backoff and jitter.
|
|
121
|
+
* Handles AWS SSM throttling errors (TooManyUpdates).
|
|
122
|
+
*/
|
|
123
|
+
retryWithBackoff(operation_1) {
|
|
124
|
+
return __awaiter(this, arguments, void 0, function* (operation, maxRetries = 5, baseDelayMs = 100) {
|
|
125
|
+
let lastError;
|
|
126
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
127
|
+
try {
|
|
128
|
+
return yield operation();
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
lastError = error;
|
|
132
|
+
const isThrottlingError = typeof error === 'object' &&
|
|
133
|
+
error !== null &&
|
|
134
|
+
'name' in error &&
|
|
135
|
+
(error.name === 'TooManyUpdates' ||
|
|
136
|
+
error.name === 'ThrottlingException' ||
|
|
137
|
+
error.name === 'TooManyRequestsException');
|
|
138
|
+
if (!isThrottlingError || attempt === maxRetries) {
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
const exponentialDelay = baseDelayMs * 2 ** attempt;
|
|
142
|
+
const jitter = Math.random() * exponentialDelay * 0.5; // 0-50% jitter
|
|
143
|
+
const delayMs = exponentialDelay + jitter;
|
|
144
|
+
yield new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
145
|
+
}
|
|
84
146
|
}
|
|
147
|
+
throw lastError;
|
|
85
148
|
});
|
|
86
149
|
}
|
|
150
|
+
getErrorMessage(error) {
|
|
151
|
+
if (error instanceof Error) {
|
|
152
|
+
return error.message;
|
|
153
|
+
}
|
|
154
|
+
if (typeof error === 'string') {
|
|
155
|
+
return error;
|
|
156
|
+
}
|
|
157
|
+
if (error === null) {
|
|
158
|
+
return 'Unknown error (null)';
|
|
159
|
+
}
|
|
160
|
+
if (error === undefined) {
|
|
161
|
+
return 'Unknown error (undefined)';
|
|
162
|
+
}
|
|
163
|
+
if (typeof error === 'object') {
|
|
164
|
+
const awsError = error;
|
|
165
|
+
if (awsError.name) {
|
|
166
|
+
return awsError.message
|
|
167
|
+
? `${awsError.name}: ${awsError.message}`
|
|
168
|
+
: awsError.name;
|
|
169
|
+
}
|
|
170
|
+
const safeFields = [];
|
|
171
|
+
if (awsError.code)
|
|
172
|
+
safeFields.push(`code: ${awsError.code}`);
|
|
173
|
+
if (awsError.message)
|
|
174
|
+
safeFields.push(`message: ${awsError.message}`);
|
|
175
|
+
if (safeFields.length > 0) {
|
|
176
|
+
return `Object error (${safeFields.join(', ')})`;
|
|
177
|
+
}
|
|
178
|
+
return `Object error: ${Object.keys(error).join(', ')}`;
|
|
179
|
+
}
|
|
180
|
+
return `Unknown error: ${String(error)}`;
|
|
181
|
+
}
|
|
87
182
|
};
|
|
88
183
|
PushEnvToSsmCommandHandler = __decorate([
|
|
89
184
|
injectable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushEnvToSsmCommandHandler.js","sourceRoot":"","sources":["../../../../src/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIhC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAEmB,cAA+B,EAE/B,aAA6B,EACN,MAAe;QAHtC,mBAAc,GAAd,cAAc,CAAiB;QAE/B,kBAAa,GAAb,aAAa,CAAgB;QACN,WAAM,GAAN,MAAM,CAAS;IACtD,CAAC;IAEJ;;;;;;OAMG;IACG,MAAM,CAAC,OAA4B;;YACvC,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,iCAAiC,OAAO,CAAC,WAAW,gBAAgB,OAAO,CAAC,OAAO,GAAG,CACvF,CAAC;gBACF,MAAM,
|
|
1
|
+
{"version":3,"file":"PushEnvToSsmCommandHandler.js","sourceRoot":"","sources":["../../../../src/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIhC,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAEmB,cAA+B,EAE/B,aAA6B,EACN,MAAe;QAHtC,mBAAc,GAAd,cAAc,CAAiB;QAE/B,kBAAa,GAAb,aAAa,CAAgB;QACN,WAAM,GAAN,MAAM,CAAS;IACtD,CAAC;IAEJ;;;;;;OAMG;IACG,MAAM,CAAC,OAA4B;;YACvC,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,iCAAiC,OAAO,CAAC,WAAW,gBAAgB,OAAO,CAAC,OAAO,GAAG,CACvF,CAAC;gBACF,MAA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