@go-to-k/cdkd 0.4.0 → 0.4.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 CHANGED
@@ -25979,6 +25979,57 @@ var IMPLICIT_DELETE_DEPENDENCIES = {
25979
25979
  ]
25980
25980
  };
25981
25981
 
25982
+ // src/deployment/retryable-errors.ts
25983
+ var RETRYABLE_ERROR_MESSAGE_PATTERNS = [
25984
+ // IAM propagation
25985
+ "cannot be assumed",
25986
+ "role defined for the function",
25987
+ "not authorized to perform",
25988
+ "execution role",
25989
+ "trust policy",
25990
+ "Role validation failed",
25991
+ "does not have required permissions",
25992
+ "Trusted Entity",
25993
+ "currently in the following state: Pending",
25994
+ // DELETE dependency ordering (parallel deletion race conditions)
25995
+ "has dependencies and cannot be deleted",
25996
+ "can't be deleted since it has",
25997
+ "DependencyViolation",
25998
+ // AWS eventual consistency (dependency just created but not yet visible)
25999
+ // e.g., RDS DBCluster referencing a just-created DBSubnetGroup
26000
+ "does not exist",
26001
+ // AppSync schema is being created asynchronously
26002
+ "Schema is currently being altered",
26003
+ // IAM principal not yet propagated to S3 bucket policy
26004
+ "Invalid principal in policy",
26005
+ // S3 bucket creation/deletion still in progress
26006
+ "conflicting conditional operation",
26007
+ // Secrets Manager: ForceDeleteWithoutRecovery may take a moment to propagate
26008
+ "scheduled for deletion",
26009
+ // DynamoDB Streams / Kinesis: IAM role not yet propagated
26010
+ "Cannot access stream",
26011
+ "Please ensure the role can perform",
26012
+ // KMS: IAM role not yet propagated for CreateGrant
26013
+ "KMS key is invalid for CreateGrant",
26014
+ // CloudWatch Logs SubscriptionFilter: Kinesis stream eventual consistency
26015
+ // or SubscriptionFilter role propagation. CW Logs probes the destination
26016
+ // by delivering a test message; if the stream is freshly ACTIVE or the
26017
+ // assumed role hasn't propagated, the probe fails with "Invalid request".
26018
+ "Could not deliver test message"
26019
+ ];
26020
+ var RETRYABLE_HTTP_STATUS_CODES = /* @__PURE__ */ new Set([429, 503]);
26021
+ function isRetryableTransientError(error, message) {
26022
+ const metadata = error.$metadata;
26023
+ const statusCode = metadata?.httpStatusCode;
26024
+ if (statusCode !== void 0 && RETRYABLE_HTTP_STATUS_CODES.has(statusCode))
26025
+ return true;
26026
+ const cause = error.cause;
26027
+ const causeStatus = cause?.$metadata?.httpStatusCode;
26028
+ if (causeStatus !== void 0 && RETRYABLE_HTTP_STATUS_CODES.has(causeStatus))
26029
+ return true;
26030
+ return RETRYABLE_ERROR_MESSAGE_PATTERNS.some((p) => message.includes(p));
26031
+ }
26032
+
25982
26033
  // src/deployment/deploy-engine.ts
25983
26034
  var InterruptedError = class extends Error {
25984
26035
  constructor() {
@@ -26975,7 +27026,7 @@ var DeployEngine = class {
26975
27026
  } catch (error) {
26976
27027
  lastError = error;
26977
27028
  const message = error instanceof Error ? error.message : String(error);
26978
- const isRetryable = this.isRetryableError(error, message);
27029
+ const isRetryable = isRetryableTransientError(error, message);
26979
27030
  if (!isRetryable || attempt >= maxRetries) {
26980
27031
  throw error;
26981
27032
  }
@@ -26992,53 +27043,6 @@ var DeployEngine = class {
26992
27043
  }
26993
27044
  throw lastError;
26994
27045
  }
26995
- /**
26996
- * Determine if an error is retryable (transient).
26997
- * Checks HTTP status codes (429 throttle, 503 unavailable)
26998
- * and IAM propagation delay message patterns.
26999
- */
27000
- isRetryableError(error, message) {
27001
- const metadata = error.$metadata;
27002
- const statusCode = metadata?.httpStatusCode;
27003
- if (statusCode === 429 || statusCode === 503)
27004
- return true;
27005
- const cause = error.cause;
27006
- const causeStatus = cause?.$metadata?.httpStatusCode;
27007
- if (causeStatus === 429 || causeStatus === 503)
27008
- return true;
27009
- const retryablePatterns = [
27010
- "cannot be assumed",
27011
- "role defined for the function",
27012
- "not authorized to perform",
27013
- "execution role",
27014
- "trust policy",
27015
- "Role validation failed",
27016
- "does not have required permissions",
27017
- "Trusted Entity",
27018
- "currently in the following state: Pending",
27019
- // DELETE dependency ordering (parallel deletion race conditions)
27020
- "has dependencies and cannot be deleted",
27021
- "can't be deleted since it has",
27022
- "DependencyViolation",
27023
- // AWS eventual consistency (dependency just created but not yet visible)
27024
- // e.g., RDS DBCluster referencing a just-created DBSubnetGroup
27025
- "does not exist",
27026
- // AppSync schema is being created asynchronously
27027
- "Schema is currently being altered",
27028
- // IAM principal not yet propagated to S3 bucket policy
27029
- "Invalid principal in policy",
27030
- // S3 bucket creation/deletion still in progress
27031
- "conflicting conditional operation",
27032
- // Secrets Manager: ForceDeleteWithoutRecovery may take a moment to propagate
27033
- "scheduled for deletion",
27034
- // DynamoDB Streams / Kinesis: IAM role not yet propagated
27035
- "Cannot access stream",
27036
- "Please ensure the role can perform",
27037
- // KMS: IAM role not yet propagated for CreateGrant
27038
- "KMS key is invalid for CreateGrant"
27039
- ];
27040
- return retryablePatterns.some((p) => message.includes(p));
27041
- }
27042
27046
  /**
27043
27047
  * Resolve stack outputs from template and resource attributes
27044
27048
  *
@@ -27967,7 +27971,7 @@ function reorderArgs(argv) {
27967
27971
  }
27968
27972
  async function main() {
27969
27973
  const program = new Command8();
27970
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.4.0");
27974
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.4.1");
27971
27975
  program.addCommand(createBootstrapCommand());
27972
27976
  program.addCommand(createSynthCommand());
27973
27977
  program.addCommand(createDeployCommand());