@go-to-k/cdkd 0.5.0 → 0.5.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/dist/cli.js +54 -28
- package/dist/cli.js.map +4 -4
- package/dist/go-to-k-cdkd-0.5.1.tgz +0 -0
- package/dist/index.js +53 -27
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.5.0.tgz +0 -0
package/dist/cli.js
CHANGED
|
@@ -26161,7 +26161,12 @@ var RETRYABLE_ERROR_MESSAGE_PATTERNS = [
|
|
|
26161
26161
|
// or SubscriptionFilter role propagation. CW Logs probes the destination
|
|
26162
26162
|
// by delivering a test message; if the stream is freshly ACTIVE or the
|
|
26163
26163
|
// assumed role hasn't propagated, the probe fails with "Invalid request".
|
|
26164
|
-
"Could not deliver test message"
|
|
26164
|
+
"Could not deliver test message",
|
|
26165
|
+
// SQS: same-name queue can't be re-created until 60s after a delete.
|
|
26166
|
+
// Hits when a stack is destroyed and re-deployed in quick succession
|
|
26167
|
+
// (a common dev / iteration loop). Retry recovers within ~60s instead
|
|
26168
|
+
// of failing the whole deploy.
|
|
26169
|
+
"wait 60 seconds"
|
|
26165
26170
|
];
|
|
26166
26171
|
var RETRYABLE_HTTP_STATUS_CODES = /* @__PURE__ */ new Set([429, 503]);
|
|
26167
26172
|
function isRetryableTransientError(error, message) {
|
|
@@ -26176,6 +26181,39 @@ function isRetryableTransientError(error, message) {
|
|
|
26176
26181
|
return RETRYABLE_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
|
|
26177
26182
|
}
|
|
26178
26183
|
|
|
26184
|
+
// src/deployment/retry.ts
|
|
26185
|
+
var defaultSleep = (ms) => new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
26186
|
+
async function withRetry(operation, logicalId, opts = {}) {
|
|
26187
|
+
const maxRetries = opts.maxRetries ?? 8;
|
|
26188
|
+
const initialDelayMs = opts.initialDelayMs ?? 1e3;
|
|
26189
|
+
const maxDelayMs = opts.maxDelayMs ?? 8e3;
|
|
26190
|
+
const sleep = opts.sleep ?? defaultSleep;
|
|
26191
|
+
let lastError;
|
|
26192
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
26193
|
+
try {
|
|
26194
|
+
return await operation();
|
|
26195
|
+
} catch (error) {
|
|
26196
|
+
lastError = error;
|
|
26197
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
26198
|
+
const retryable = isRetryableTransientError(error, message);
|
|
26199
|
+
if (!retryable || attempt >= maxRetries) {
|
|
26200
|
+
throw error;
|
|
26201
|
+
}
|
|
26202
|
+
const delay = Math.min(initialDelayMs * Math.pow(2, attempt), maxDelayMs);
|
|
26203
|
+
opts.logger?.debug(
|
|
26204
|
+
` \u23F3 Retrying ${logicalId} in ${delay / 1e3}s (attempt ${attempt + 1}/${maxRetries}) - ${message}`
|
|
26205
|
+
);
|
|
26206
|
+
for (let waited = 0; waited < delay; waited += 1e3) {
|
|
26207
|
+
if (opts.isInterrupted?.()) {
|
|
26208
|
+
throw opts.onInterrupted ? opts.onInterrupted() : new Error("Interrupted");
|
|
26209
|
+
}
|
|
26210
|
+
await sleep(Math.min(1e3, delay - waited));
|
|
26211
|
+
}
|
|
26212
|
+
}
|
|
26213
|
+
}
|
|
26214
|
+
throw lastError;
|
|
26215
|
+
}
|
|
26216
|
+
|
|
26179
26217
|
// src/deployment/deploy-engine.ts
|
|
26180
26218
|
var InterruptedError = class extends Error {
|
|
26181
26219
|
constructor() {
|
|
@@ -27162,32 +27200,20 @@ var DeployEngine = class {
|
|
|
27162
27200
|
);
|
|
27163
27201
|
}
|
|
27164
27202
|
/**
|
|
27165
|
-
* Execute an operation with retry for transient IAM propagation errors
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
|
|
27171
|
-
|
|
27172
|
-
|
|
27173
|
-
|
|
27174
|
-
|
|
27175
|
-
|
|
27176
|
-
|
|
27177
|
-
|
|
27178
|
-
|
|
27179
|
-
const delay = initialDelayMs * Math.pow(2, attempt);
|
|
27180
|
-
this.logger.debug(
|
|
27181
|
-
` \u23F3 Retrying ${logicalId} in ${delay / 1e3}s (attempt ${attempt + 1}/${maxRetries}) - ${message}`
|
|
27182
|
-
);
|
|
27183
|
-
for (let waited = 0; waited < delay; waited += 1e3) {
|
|
27184
|
-
if (this.interrupted)
|
|
27185
|
-
throw new InterruptedError();
|
|
27186
|
-
await new Promise((resolve4) => setTimeout(resolve4, Math.min(1e3, delay - waited)));
|
|
27187
|
-
}
|
|
27188
|
-
}
|
|
27189
|
-
}
|
|
27190
|
-
throw lastError;
|
|
27203
|
+
* Execute an operation with retry for transient IAM propagation errors.
|
|
27204
|
+
*
|
|
27205
|
+
* Thin wrapper over `withRetry` from ./retry.js that injects this engine's
|
|
27206
|
+
* SIGINT-aware interrupt check and logger. The actual backoff schedule
|
|
27207
|
+
* lives there.
|
|
27208
|
+
*/
|
|
27209
|
+
async withRetry(operation, logicalId, maxRetries, initialDelayMs) {
|
|
27210
|
+
return withRetry(operation, logicalId, {
|
|
27211
|
+
...maxRetries !== void 0 && { maxRetries },
|
|
27212
|
+
...initialDelayMs !== void 0 && { initialDelayMs },
|
|
27213
|
+
logger: this.logger,
|
|
27214
|
+
isInterrupted: () => this.interrupted,
|
|
27215
|
+
onInterrupted: () => new InterruptedError()
|
|
27216
|
+
});
|
|
27191
27217
|
}
|
|
27192
27218
|
/**
|
|
27193
27219
|
* Resolve stack outputs from template and resource attributes
|
|
@@ -28087,7 +28113,7 @@ function reorderArgs(argv) {
|
|
|
28087
28113
|
}
|
|
28088
28114
|
async function main() {
|
|
28089
28115
|
const program = new Command9();
|
|
28090
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.5.
|
|
28116
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.5.1");
|
|
28091
28117
|
program.addCommand(createBootstrapCommand());
|
|
28092
28118
|
program.addCommand(createSynthCommand());
|
|
28093
28119
|
program.addCommand(createListCommand());
|