@go-to-k/cdkd 0.276.3 → 0.276.5

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as TemplateParser, $t as CdkdError, A as yellow, At as resolveAutoAssetStorage, B as IntrinsicFunctionResolver, Bt as MIGRATE_TMP_PREFIX, C as renderStatefulReason, Ct as AssetManifestLoader, D as gray, Dt as getDefaultStateBucketName, E as cyan, Et as synthesisStatusMessage, F as findActionableSilentDrops, Ft as resolveUseCdkBootstrapAssets, G as resolveExplicitPhysicalId, Gt as processStackMessages, H as refStateLookupFromResource, Ht as uploadCfnTemplate, I as CloudControlProvider, It as stateBucketExistenceConfirmed, J as DiffCalculator, Jt as AwsClients, K as assertRegionMatch, L as slowCcOperationTimeoutMs, Lt as warnDeprecatedNoPrefixCliFlag, M as collectInlinePolicyNamesManagedBySiblings, Mt as resolveSkipPrefix, N as clearOnUpdateRemoval, Nt as resolveStateBucketWithDefault, O as green, Ot as getLegacyStateBucketName, P as ProviderRegistry, Pt as resolveStateBucketWithDefaultAndSource, Q as DagBuilder, R as disableInstanceApiTermination, Rt as CFN_TEMPLATE_BODY_LIMIT, S as isStatefulRecreateTargetSync, St as runDockerStreaming, T as bold, Tt as Synthesizer, U as WAFv2WebACLProvider, Ut as expectedOwnerParam, V as cfnRefValueFromPhysicalId, Vt as findLargeInlineResources, W as normalizeAwsTagsToCfn, Wt as AssemblyReader, X as withRetry, Xt as resetAwsClients, Y as describeTypeWithThrottleRetry, Yt as getAwsClients, Z as isRetryableTransientError, Zt as setAwsClients, _ as createPreDeleteFinalSnapshot, _t as validateContainerRepoName, a as DeploymentEventsStore, an as LocalStartServiceError, at as stringifyValue, b as extractDeploymentEventError, bn as withErrorHandling, bt as getDockerCmd, c as replayFailedOperations, cn as NestedStackChildDirectDestroyError, ct as createAssetRedirectResolver, d as IMPLICIT_DELETE_DEPENDENCIES, dn as ResourceTimeoutError, dt as AssetModeResolver, et as LockManager, f as computeImplicitDeleteEdges, fn as ResourceUpdateNotSupportedError, ft as BOOTSTRAP_MARKER_PREFIX, g as ccRoutedFinalSnapshotError, gt as validateAssetBucketName, h as buildFinalSnapshotIdentifier, ht as parseBootstrapMarker, i as DeploymentEventsReader, in as LocalMigrateError, it as AssetPublisher, j as IAMRoleProvider, jt as resolveCaptureObservedState, k as red, kt as resolveApp, l as replayRollback, ln as PartialFailureError, lt as loadPublishableAssetManifest, m as PRE_DELETE_SNAPSHOT_TYPES, mn as StackTerminationProtectionError, mt as getBootstrapMarkerKey, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nn as DeployCancelledError, nt as rebuildClientForBucketRegion, o as planFailedOps, ot as WorkGraph, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as StackHasActiveImportsError, pt as ensureAssetStorage, q as applyRoleArnIfSet, qt as resolveBucketRegion, r as DeployEngine, rn as LocalInvokeBuildError$1, rt as shouldRetainResource, s as planRollback, sn as MissingCdkCliError, st as buildAssetRedirectMap, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as S3StateBackend, u as withResourceDeadline, un as ProvisioningError, ut as rewriteTemplateAssetReferences, v as isFinalSnapshotError, vt as buildDockerImage, w as formatResourceLine, wt as getDockerImageBySourceHash, x as MULTI_REGION_RECREATE_BLOCKED_TYPES, xt as runDockerForeground, y as unsupportedFinalSnapshotError, yn as normalizeAwsError, yt as formatDockerLoginError, z as isTerminationProtectionPropagationError, zt as CFN_TEMPLATE_URL_LIMIT } from "./deploy-engine-gQzltBso.js";
2
+ import { $ as DagBuilder, A as red, At as resolveApp, B as isTerminationProtectionPropagationError, Bt as CFN_TEMPLATE_URL_LIMIT, C as isStatefulRecreateTargetSync, Ct as runDockerStreaming, D as cyan, Dt as synthesisStatusMessage, E as bold, Et as Synthesizer, F as ProviderRegistry, Ft as resolveStateBucketWithDefaultAndSource, G as normalizeAwsTagsToCfn, Gt as AssemblyReader, H as cfnRefValueFromPhysicalId, Ht as findLargeInlineResources, I as findActionableSilentDrops, It as resolveUseCdkBootstrapAssets, J as applyRoleArnIfSet, Jt as resolveBucketRegion, K as resolveExplicitPhysicalId, Kt as processStackMessages, L as CloudControlProvider, Lt as stateBucketExistenceConfirmed, M as IAMRoleProvider, Mt as resolveCaptureObservedState, N as collectInlinePolicyNamesManagedBySiblings, Nt as resolveSkipPrefix, O as gray, Ot as getDefaultStateBucketName, P as clearOnUpdateRemoval, Pt as resolveStateBucketWithDefault, Q as isRetryableTransientError, Qt as setAwsClients, R as slowCcOperationTimeoutMs, Rt as warnDeprecatedNoPrefixCliFlag, S as MULTI_REGION_RECREATE_BLOCKED_TYPES, St as runDockerForeground, T as formatResourceLine, Tt as getDockerImageBySourceHash, U as refStateLookupFromResource, Ut as uploadCfnTemplate, V as IntrinsicFunctionResolver, Vt as MIGRATE_TMP_PREFIX, W as WAFv2WebACLProvider, Wt as expectedOwnerParam, X as describeTypeWithThrottleRetry, Xt as getAwsClients, Y as DiffCalculator, Yt as AwsClients, Z as withRetry, Zt as resetAwsClients, _ as createPreDeleteFinalSnapshot, _t as validateAssetBucketName, a as DeploymentEventsStore, an as LocalMigrateError, at as AssetPublisher, b as unsupportedFinalSnapshotError, bn as normalizeAwsError, bt as formatDockerLoginError, c as replayFailedOperations, cn as MissingCdkCliError, ct as buildAssetRedirectMap, d as IMPLICIT_DELETE_DEPENDENCIES, dn as ProvisioningError, dt as rewriteTemplateAssetReferences, en as CdkdError, et as TemplateParser, f as computeImplicitDeleteEdges, fn as ResourceTimeoutError, ft as AssetModeResolver, g as ccRoutedFinalSnapshotError, gt as parseBootstrapMarker, h as buildFinalSnapshotIdentifier, hn as StackTerminationProtectionError, ht as getBootstrapMarkerKey, i as DeploymentEventsReader, in as LocalInvokeBuildError$1, it as shouldRetainResource, j as yellow, jt as resolveAutoAssetStorage, k as green, kt as getLegacyStateBucketName, l as replayRollback, ln as NestedStackChildDirectDestroyError, lt as createAssetRedirectResolver, m as PRE_DELETE_SNAPSHOT_TYPES, mn as StackHasActiveImportsError, mt as ensureAssetStorage, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as S3StateBackend, o as planFailedOps, on as LocalStartServiceError, ot as stringifyValue, p as ATOMIC_FINAL_SNAPSHOT_TYPES, pn as ResourceUpdateNotSupportedError, pt as BOOTSTRAP_MARKER_PREFIX, q as assertRegionMatch, r as DeployEngine, rn as DeployCancelledError, rt as rebuildClientForBucketRegion, s as planRollback, st as WorkGraph, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as LockManager, u as withResourceDeadline, un as PartialFailureError, ut as loadPublishableAssetManifest, v as isFinalSnapshotError, vt as validateContainerRepoName, w as renderStatefulReason, wt as AssetManifestLoader, x as extractDeploymentEventError, xn as withErrorHandling, xt as getDockerCmd, y as refusesFinalSnapshot, yt as buildDockerImage, z as disableInstanceApiTermination, zt as CFN_TEMPLATE_BODY_LIMIT } from "./deploy-engine-BwPdeLbJ.js";
3
3
  import { a as getLiveRenderer, c as PATTERN_B_RESOURCE_TYPES, d as generateResourceNameWithFallback, f as withSkipPrefix, i as runStackBuffered, n as getLogger, o as PATTERN_B_NAME_OPTIONS, p as withStackName, s as PATTERN_B_NAME_PROPERTIES, u as generateResourceName } from "./logger-BYMEE-BS.js";
4
- import { t as ASGProvider } from "./asg-provider-DFSI7iBe.js";
4
+ import { t as ASGProvider } from "./asg-provider-Wm3Q60jN.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { createHash, randomBytes, randomUUID } from "node:crypto";
7
7
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
@@ -51247,6 +51247,20 @@ async function findJournalCandidates(backend, prefix) {
51247
51247
  return refs;
51248
51248
  }
51249
51249
  /**
51250
+ * The `DeletionPolicy Snapshot — ...` note a planned Snapshot delete carries
51251
+ * (issue #1366). Consults the SAME mechanism matrix the replay will run, so
51252
+ * the preview cannot promise a final snapshot for a shape the executor is
51253
+ * about to REFUSE (a cc-api-routed atomic type, or a type with no snapshot
51254
+ * mechanism at all). `skipFinalSnapshot` is threaded in because the
51255
+ * classifier is pure and cannot see CLI flags — under the opt-out every shape
51256
+ * plain-deletes, refusals included, so the flag is checked first.
51257
+ */
51258
+ function snapshotNote(resourceType, effectiveProvisionedBy, skipFinalSnapshot) {
51259
+ if (skipFinalSnapshot) return "DeletionPolicy Snapshot — NO final snapshot (--skip-final-snapshot)";
51260
+ if (refusesFinalSnapshot(resourceType, effectiveProvisionedBy)) return "DeletionPolicy Snapshot — cdkd cannot snapshot this resource; the rollback will REFUSE it (re-run with --skip-final-snapshot to delete without one)";
51261
+ return "DeletionPolicy Snapshot — final snapshot, then delete";
51262
+ }
51263
+ /**
51250
51264
  * Human label for a planned rollback action (plan preview). `skipFinalSnapshot`
51251
51265
  * is threaded in because the classifier is pure (it cannot see CLI flags) and
51252
51266
  * the Snapshot label would otherwise promise a final snapshot the run is about
@@ -51257,7 +51271,7 @@ function actionLabel(item, skipFinalSnapshot) {
51257
51271
  const rep = replacement ? " [replacement occurred, best-effort revert]" : "";
51258
51272
  switch (action) {
51259
51273
  case "delete": return ` - delete ${op.logicalId} (${op.resourceType})${rep}`;
51260
- case "delete-with-final-snapshot": return skipFinalSnapshot ? ` - delete ${op.logicalId} (${op.resourceType}) [DeletionPolicy Snapshot — NO final snapshot (--skip-final-snapshot)]` : ` - delete ${op.logicalId} (${op.resourceType}) [DeletionPolicy Snapshot — final snapshot, then delete]`;
51274
+ case "delete-with-final-snapshot": return ` - delete ${op.logicalId} (${op.resourceType}) [${snapshotNote(op.resourceType, item.effectiveProvisionedBy, skipFinalSnapshot)}]`;
51261
51275
  case "orphan-retain": return ` - orphan ${op.logicalId} (${op.resourceType}) [DeletionPolicy Retain — left in AWS]`;
51262
51276
  case "orphan-flag": return ` - orphan ${op.logicalId} (${op.resourceType}) [--orphan]`;
51263
51277
  case "revert": return ` - revert ${op.logicalId} (${op.resourceType})${rep}`;
@@ -51280,7 +51294,7 @@ function failedActionLabel(item, skipFinalSnapshot) {
51280
51294
  switch (action) {
51281
51295
  case "revert-failed-update": return ` - revert ${op.logicalId} (${op.resourceType}) [FAILED update — remote state unknown, force-applying previous properties]`;
51282
51296
  case "delete-failed-create": return ` - delete ${op.logicalId} (${op.resourceType}) [FAILED create]`;
51283
- case "delete-failed-create-with-final-snapshot": return skipFinalSnapshot ? ` - delete ${op.logicalId} (${op.resourceType}) [FAILED create, DeletionPolicy Snapshot — NO final snapshot (--skip-final-snapshot)]` : ` - delete ${op.logicalId} (${op.resourceType}) [FAILED create, DeletionPolicy Snapshot — final snapshot, then delete]`;
51297
+ case "delete-failed-create-with-final-snapshot": return ` - delete ${op.logicalId} (${op.resourceType}) [FAILED create, ${snapshotNote(op.resourceType, item.effectiveProvisionedBy, skipFinalSnapshot)}]`;
51284
51298
  case "orphan-failed-create-retain": return ` - orphan ${op.logicalId} (${op.resourceType}) [FAILED create, DeletionPolicy Retain — left in AWS]`;
51285
51299
  case "skip-failed-unknown": return ` - skip ${op.logicalId} (${op.resourceType}) — failed CREATE recorded no physical id`;
51286
51300
  case "skip-failed-noop": return ` - skip ${op.logicalId} (${op.resourceType}) — failed ${op.changeType} left nothing to revert`;
@@ -51368,11 +51382,11 @@ async function rollbackCommand(stackArg, options) {
51368
51382
  if (segment.failedOperations && segment.failedOperations.length > 0) if (options.revertFailed) {
51369
51383
  const failedPlan = planFailedOps(segment.failedOperations, planStateView);
51370
51384
  for (const item of failedPlan) logger.info(failedActionLabel(item, options.skipFinalSnapshot === true));
51371
- applyFailedPlanToPreview(failedPlan, planStateView);
51385
+ applyFailedPlanToPreview(failedPlan, planStateView, options.skipFinalSnapshot === true);
51372
51386
  } else for (const fop of segment.failedOperations) logger.info(` - (left as-is) ${fop.logicalId} (${fop.resourceType}) — its ${fop.changeType} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
51373
51387
  const plan = planRollback(segment.operations, planStateView, orphanLogicalIds);
51374
51388
  for (const item of plan) logger.info(actionLabel(item, options.skipFinalSnapshot === true));
51375
- applyPlanToPreview(plan, planStateView);
51389
+ applyPlanToPreview(plan, planStateView, options.skipFinalSnapshot === true);
51376
51390
  }
51377
51391
  logger.info("");
51378
51392
  if (!skipConfirmation) {
@@ -51506,16 +51520,30 @@ async function rollbackCommand(stackArg, options) {
51506
51520
  }
51507
51521
  }
51508
51522
  /**
51523
+ * Will the replay REFUSE this planned Snapshot delete instead of performing
51524
+ * it (issue #1368)? The preview must not unwind a record for an op that
51525
+ * never runs — the same question {@link snapshotNote} answers for the label,
51526
+ * asked with the same predicate and the same route, so the label and the
51527
+ * previewed state cannot disagree.
51528
+ */
51529
+ function planItemWillBeRefused(resourceType, effectiveProvisionedBy, skipFinalSnapshot) {
51530
+ if (skipFinalSnapshot) return false;
51531
+ return refusesFinalSnapshot(resourceType, effectiveProvisionedBy);
51532
+ }
51533
+ /**
51509
51534
  * Apply a planned segment's effect to the plan-preview state so the NEXT
51510
51535
  * (older) segment's plan is classified against already-unwound state.
51511
51536
  * Mirrors what `replayRollback` mutates, without touching AWS.
51512
51537
  */
51513
- function applyPlanToPreview(plan, previewState) {
51538
+ function applyPlanToPreview(plan, previewState, skipFinalSnapshot) {
51514
51539
  for (const item of plan) {
51515
51540
  const { op, action } = item;
51516
51541
  switch (action) {
51517
- case "delete":
51518
51542
  case "delete-with-final-snapshot":
51543
+ if (planItemWillBeRefused(op.resourceType, item.effectiveProvisionedBy, skipFinalSnapshot)) break;
51544
+ if (op.changeType === "CREATE") delete previewState[op.logicalId];
51545
+ break;
51546
+ case "delete":
51519
51547
  case "orphan-retain":
51520
51548
  case "orphan-flag":
51521
51549
  if (op.changeType === "CREATE") delete previewState[op.logicalId];
@@ -51533,12 +51561,15 @@ function applyPlanToPreview(plan, previewState) {
51533
51561
  * Apply a planned FAILED-op revert's effect to the plan-preview state
51534
51562
  * (issue #1198). Mirrors `replayFailedOperations` without touching AWS.
51535
51563
  */
51536
- function applyFailedPlanToPreview(plan, previewState) {
51564
+ function applyFailedPlanToPreview(plan, previewState, skipFinalSnapshot) {
51537
51565
  for (const item of plan) {
51538
51566
  const { op, action } = item;
51539
51567
  switch (action) {
51540
- case "delete-failed-create":
51541
51568
  case "delete-failed-create-with-final-snapshot":
51569
+ if (planItemWillBeRefused(op.resourceType, item.effectiveProvisionedBy, skipFinalSnapshot)) break;
51570
+ delete previewState[op.logicalId];
51571
+ break;
51572
+ case "delete-failed-create":
51542
51573
  case "orphan-failed-create-retain":
51543
51574
  delete previewState[op.logicalId];
51544
51575
  break;
@@ -63738,7 +63769,7 @@ function createMigrateCommand() {
63738
63769
  */
63739
63770
  function buildProgram() {
63740
63771
  const program = new Command();
63741
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.276.3");
63772
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.276.5");
63742
63773
  program.hook("preAction", (_thisCommand, actionCommand) => {
63743
63774
  const { profile } = actionCommand.optsWithGlobals();
63744
63775
  if (profile !== void 0) process.env["AWS_PROFILE"] = profile;