@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
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -7388,7 +7388,12 @@ var RETRYABLE_ERROR_MESSAGE_PATTERNS = [
|
|
|
7388
7388
|
// or SubscriptionFilter role propagation. CW Logs probes the destination
|
|
7389
7389
|
// by delivering a test message; if the stream is freshly ACTIVE or the
|
|
7390
7390
|
// assumed role hasn't propagated, the probe fails with "Invalid request".
|
|
7391
|
-
"Could not deliver test message"
|
|
7391
|
+
"Could not deliver test message",
|
|
7392
|
+
// SQS: same-name queue can't be re-created until 60s after a delete.
|
|
7393
|
+
// Hits when a stack is destroyed and re-deployed in quick succession
|
|
7394
|
+
// (a common dev / iteration loop). Retry recovers within ~60s instead
|
|
7395
|
+
// of failing the whole deploy.
|
|
7396
|
+
"wait 60 seconds"
|
|
7392
7397
|
];
|
|
7393
7398
|
var RETRYABLE_HTTP_STATUS_CODES = /* @__PURE__ */ new Set([429, 503]);
|
|
7394
7399
|
function isRetryableTransientError(error, message) {
|
|
@@ -7403,6 +7408,39 @@ function isRetryableTransientError(error, message) {
|
|
|
7403
7408
|
return RETRYABLE_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
|
|
7404
7409
|
}
|
|
7405
7410
|
|
|
7411
|
+
// src/deployment/retry.ts
|
|
7412
|
+
var defaultSleep = (ms) => new Promise((resolve4) => setTimeout(resolve4, ms));
|
|
7413
|
+
async function withRetry(operation, logicalId, opts = {}) {
|
|
7414
|
+
const maxRetries = opts.maxRetries ?? 8;
|
|
7415
|
+
const initialDelayMs = opts.initialDelayMs ?? 1e3;
|
|
7416
|
+
const maxDelayMs = opts.maxDelayMs ?? 8e3;
|
|
7417
|
+
const sleep = opts.sleep ?? defaultSleep;
|
|
7418
|
+
let lastError;
|
|
7419
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
7420
|
+
try {
|
|
7421
|
+
return await operation();
|
|
7422
|
+
} catch (error) {
|
|
7423
|
+
lastError = error;
|
|
7424
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
7425
|
+
const retryable = isRetryableTransientError(error, message);
|
|
7426
|
+
if (!retryable || attempt >= maxRetries) {
|
|
7427
|
+
throw error;
|
|
7428
|
+
}
|
|
7429
|
+
const delay = Math.min(initialDelayMs * Math.pow(2, attempt), maxDelayMs);
|
|
7430
|
+
opts.logger?.debug(
|
|
7431
|
+
` \u23F3 Retrying ${logicalId} in ${delay / 1e3}s (attempt ${attempt + 1}/${maxRetries}) - ${message}`
|
|
7432
|
+
);
|
|
7433
|
+
for (let waited = 0; waited < delay; waited += 1e3) {
|
|
7434
|
+
if (opts.isInterrupted?.()) {
|
|
7435
|
+
throw opts.onInterrupted ? opts.onInterrupted() : new Error("Interrupted");
|
|
7436
|
+
}
|
|
7437
|
+
await sleep(Math.min(1e3, delay - waited));
|
|
7438
|
+
}
|
|
7439
|
+
}
|
|
7440
|
+
}
|
|
7441
|
+
throw lastError;
|
|
7442
|
+
}
|
|
7443
|
+
|
|
7406
7444
|
// src/deployment/deploy-engine.ts
|
|
7407
7445
|
var InterruptedError = class extends Error {
|
|
7408
7446
|
constructor() {
|
|
@@ -8389,32 +8427,20 @@ var DeployEngine = class {
|
|
|
8389
8427
|
);
|
|
8390
8428
|
}
|
|
8391
8429
|
/**
|
|
8392
|
-
* Execute an operation with retry for transient IAM propagation errors
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
const delay = initialDelayMs * Math.pow(2, attempt);
|
|
8407
|
-
this.logger.debug(
|
|
8408
|
-
` \u23F3 Retrying ${logicalId} in ${delay / 1e3}s (attempt ${attempt + 1}/${maxRetries}) - ${message}`
|
|
8409
|
-
);
|
|
8410
|
-
for (let waited = 0; waited < delay; waited += 1e3) {
|
|
8411
|
-
if (this.interrupted)
|
|
8412
|
-
throw new InterruptedError();
|
|
8413
|
-
await new Promise((resolve4) => setTimeout(resolve4, Math.min(1e3, delay - waited)));
|
|
8414
|
-
}
|
|
8415
|
-
}
|
|
8416
|
-
}
|
|
8417
|
-
throw lastError;
|
|
8430
|
+
* Execute an operation with retry for transient IAM propagation errors.
|
|
8431
|
+
*
|
|
8432
|
+
* Thin wrapper over `withRetry` from ./retry.js that injects this engine's
|
|
8433
|
+
* SIGINT-aware interrupt check and logger. The actual backoff schedule
|
|
8434
|
+
* lives there.
|
|
8435
|
+
*/
|
|
8436
|
+
async withRetry(operation, logicalId, maxRetries, initialDelayMs) {
|
|
8437
|
+
return withRetry(operation, logicalId, {
|
|
8438
|
+
...maxRetries !== void 0 && { maxRetries },
|
|
8439
|
+
...initialDelayMs !== void 0 && { initialDelayMs },
|
|
8440
|
+
logger: this.logger,
|
|
8441
|
+
isInterrupted: () => this.interrupted,
|
|
8442
|
+
onInterrupted: () => new InterruptedError()
|
|
8443
|
+
});
|
|
8418
8444
|
}
|
|
8419
8445
|
/**
|
|
8420
8446
|
* Resolve stack outputs from template and resource attributes
|