@go-to-k/cdkd 0.294.10 → 0.294.11

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.
@@ -2,8 +2,8 @@ import { a as runWithStackAwsClients, i as resetAwsClients, o as setAwsClients,
2
2
  import { A as displaySafe, C as SAFE_MSG_ALTERED_CHAR, D as cutMarker, E as UNRENDERABLE, F as safeMsg, I as stringifyJsonPayload, L as truncateCodePoints, M as isPasteableIdent, O as displayAwsMessage, P as plainIdentOr, T as STACK_REF_MAX_CODE_POINTS, b as withSkipPrefix, c as getLiveRenderer, d as PATTERN_B_RESOURCE_TYPES, h as generateResourceName, i as reserveStdoutForPayload, j as displayStackName, k as displayIdent, l as PATTERN_B_NAME_OPTIONS, m as explicitNamePropertyFor, n as getLogger, o as runStackBuffered, p as derivesPatternBName, r as isStdoutReservedForPayload, u as PATTERN_B_NAME_PROPERTIES, w as SECRET_REF_MAX_CODE_POINTS, x as withStackName } from "./logger-B46YMG0h.js";
3
3
  import { At as clientDefaultsFor, Bn as isMarkedNonRetryable, Bt as IntrinsicResolutionRefusalError, Dt as withPasteableAwsProfile, Et as setPasteableAwsProfile, F as runDeleteAttempt, Fn as retryClassificationText, G as beginCommandInterruptScope, Gt as MalformedProducerRecordRefusalError, Hn as markNonRetryable, Ht as LocalStartServiceError, In as describeAwsFailure, It as CrossAccountSecretRefusalError, J as isInterruptedWaitError, Jt as ProvisioningError, K as endCommandInterruptScope, Kt as NestedStackChildDirectDestroyError, Mt as AccountIdUnavailableError, Nn as isRetryableTransientError, Ot as ambientClientDefaults, Pn as isTransientServerError, Pt as CdkdError, Qt as StackTerminationProtectionError, Rn as safeStringify, Rt as DeployCancelledError, St as injectiveKey, Tt as producerRecordKey, V as isAwsCliLiteral, Vn as isThrottlingError, Vt as LocalInvokeBuildError$1, Xt as ResourceUpdateNotSupportedError, Yt as ResourceTimeoutError, Zt as StackHasActiveImportsError, _ as VALUE_NOT_SHOWN, _n as shellQuote, _t as formatLockOperation, an as TIMEOUT_FLAG_RESOURCE_TYPE, bn as setPasteableVerbFlags, bt as CUSTOM_RESOURCE_RESPONSE_PREFIX, dn as isInertUnquoted, en as SynthesisError, fn as pasteableCommand, ft as UNREPRODUCIBLE_LOCK_CLAUSE, g as assertRegionMatch, gn as shellBoundedDisplay, gt as formatLockExpiry, h as RESOURCE_NOT_FOUND, hn as quotedOrDescribed, ht as forceQuitRecoveryClause, in as withErrorHandling, it as resourceTypeShown, jt as credentialFingerprint, kt as ambientCredentialConfig, ln as commandHole, mn as plainOrDescribed, mt as buildLockContentionMessage, n as RESOLVED_PREVIOUS_PRINCIPAL_KEYS, nt as logicalIdShown, pt as buildForceUnlockCommand, q as interruptWatchListenerCount, qt as PartialFailureError, rn as normalizeAwsError, s as readRecordedPrincipals, sn as SHELL_ACTIVE_WHY, t as IAM_PRINCIPAL_NAME, vn as withheldTargetClause, vt as formatLockOwner, w as remedyLogicalId, wt as producerCoordinateKey, xt as DEFAULT_STATE_PREFIX, yn as setPasteableRunFlags, zt as DynamicReferenceRegionAmbiguousError } from "./iam-policy-targets-CMSQGQnm.js";
4
4
  import { n as awsClientDefaults, r as getAssumedRoleCredentials, u as formatAuthority } from "./aws-client-defaults-D0q0z4dG.js";
5
- import { $ as nestedChildStackName, $a as hasReadableExportSet, $o as resolveAutoAssetStorage, $r as refuseMalformedOrphanRecordsForDestroy, Ai as unwrittenCreateOnlyReplacement, Ao as describeDockerExecFailure, Ar as malformedDriftResourcePropertiesWarning, As as renderAssemblyPathEscape, B as gray, Ba as STATE_SOURCED_BASELINE_RULES, Bn as regionLessSecretName, Bo as redactedDockerCause, Br as malformedOrphansWarning, Bt as secretBearingStateKeyWarning, Ca as createSecretMasker, Ci as repairMalformedResourcePropertiesForReadOnly, Cn as UNSPECIFIED_SKIP_REASON, Co as readBootstrapMarkerBody, Cr as deployRefusesOrphanRowsReason, Cs as hasOwnKey, Ct as effectiveDeletionPolicy, Da as markSameGenerationBag, Di as unreadableResourceEntries, Dn as isWaitAbandonedError, Do as buildDockerImage, Dr as hasReadableResources, Ds as absoluteAssemblyPathEscape, Ea as maskSecretsInText, Ei as unreadableOrphanRecords, Eo as buildDenyExternalAccessPolicy, Er as hasReadableOutputs, Es as ownValue, Et as unsupportedFinalSnapshotError, Fa as identityKeyFor, Fi as shownType, Fn as DiffCalculator, Fo as getDockerCmd, Fr as malformedLocalResourcesWarning, Ft as extractDeploymentEventError, G as namesAnyDeclaredParameter, Ga as isSingleDynamicReferenceToken, Gn as isIamRoleArn, Go as stripControlChars, Gr as malformedResourcePropertiesWarning, Gt as collectDeclaredOutputNames, H as red, Ha as STATE_SOURCED_READBACK_RULES, Hn as assertFlagRoleArn, Ho as runDockerStreaming, Hr as malformedOutputsWarning, Ht as exportNameSecretExposure, I as formatResourceLine, Ia as carriesSecretMask, Ii as MULTI_REGION_RECREATE_BLOCKED_TYPES, In as INTRINSIC_KEYS, Io as isDockerClientEnvKey, Ir as malformedOrphanRecordsRefusalMessage, It as WITHHELD_NAME_DISPLAY, J as makeSiblingClaimReader, Ja as S3StateBackend, Jn as applyCallerIdentityCredentials, Jo as Synthesizer, Jr as malformedStateRefusalMessage, Jt as bindingSkippedOutputs, K as reachableDivergentParameters, Ka as LockManager, Kn as sendableAssumeRoleCommand, Ko as AssetManifestLoader, Kr as malformedResourcesWarning, Kt as collectPublishedOutputNames, L as createReadOnlyAttributeHealerFactory, La as recordMaskOnlyValue, Li as isStatefulRecreateTargetForReplace, Ln as IntrinsicFunctionResolver, Lo as isMalformedEnvKey, Lr as malformedOrphanRecordsWarning, Lt as displayTextOrWithheld, Ma as dynamicReferenceTokens, Mi as NO_CC_HANDLERS_REASON, Mo as dockerSpawnEnvWithSensitive, Mr as malformedExportSourceWarning, Mt as updatePartialReason, Na as isUncertifiedBaselineMaskPosition, Ni as hasNoCloudControlHandlers, No as finchSecretArgvRefusal, Nr as malformedLocalOutputsWarning, Ns as resolveBucketRegion, Nt as DeploymentEventsReader, Oa as redactSecretsForState, Oi as findActionableSilentDrops, Oo as resolveDockerContextDirectory, Or as isReadableOrphanRecord, Os as describeFileReadFailure, Pa as pathCrossesDottedKey, Pi as findReplacedReadersOfRecreateTargets, Po as formatDockerLoginError, Pr as malformedLocalResourceEntriesWarning, Pt as DeploymentEventsStore, Qa as exportNamesCarriedFrom, Qo as resolveApp, Qr as refuseMalformedOrphanRecords, Qt as RollbackInlinePolicyWriters, R as bold, Ra as recordMaskOnlyValuesIn, Ri as isStatefulRecreateTargetSync, Rn as classifyReplaySecretRegion, Ro as partitionSensitiveEnv, Rr as malformedOrphanRowsKeptWarning, Rt as exportAliasCollisionScrubWarning, Sa as shareLogOnlyValues, Si as repairMalformedResourceEntriesForReadOnly, So as parseBootstrapMarker, Sr as UNREADABLE_RESOURCES_MAP_ROW, Ss as defineOwnKey, St as createPreDeleteFinalSnapshot, Ta as maskSecretsInError, Ti as unpreviewableOrphanRecords, Tn as deleteSkipReason, To as validateContainerRepoName, Tr as hasReadableOrphans, Ts as nullPrototypeRecord, Tt as refusesFinalSnapshot, U as yellow, Ua as TEMPLATE_SOURCED_RULES, Un as assertSendableRoleArn, Uo as warnFinchArgvExposure, Ur as malformedRenderedContainersWarning, Ut as isWholeDynamicReferenceValue, V as green, Va as STATE_SOURCED_CROSS_GENERATION_RULES, Vn as applyRoleArnIfSet, Vo as runDockerForeground, Vr as malformedOutputsRefusalMessage, Vt as secretSafeKeyDisplay, W as computeParameterTaint, Wa as WHOLE_DYNAMIC_REFERENCE_PATTERN, Wn as explicitRoleArnOrThrow, Wo as escapeRegExp, Wr as malformedResourceEntriesWarning, Wt as noEchoParameterValueSeed, X as NESTED_PENDING_PARENT_REASON, Xa as acceptedCreateOnlyDropsOf, Xn as envCredentialsAreAssumedRole, Xo as getDefaultStateBucketName, Xr as refuseDivergentRecordRegionForDestroy, Xt as DEFAULT_RESOURCE_WARN_AFTER_MS, Y as planOrphanAdoption, Ya as rebuildClientForBucketRegion, Yn as callerEnvCredentials, Yo as synthesisStatusMessage, Yr as previewableOrphanRecords, Yt as DEFAULT_RESOURCE_TIMEOUT_MS, Z as dropSettledNestedJournals, Za as describeRegionValueKind, Zo as getLegacyStateBucketName, Zt as maskingRetryLogger, _ as perType, _a as literalSplitDelimitersOf, _i as refuseMalformedResourcesForExport, _n as isCustomResourceType$1, _o as BOOTSTRAP_MARKER_PREFIX, _r as withSharedDrainBudget, _s as canonicalizeRegion, _t as inheritProducerRegions, a as conditionInputsFrom, ai as refuseMalformedResourceAttributesForOrphan, ao as orphansAfterRollback, ar as parameterTypeMayLoseSecretIdentity, as as stateBucketExistenceConfirmed, at as replayFailedOperations, ba as recordLogOnlyParameterValue, bi as repairMalformedOrphansForReadOnly, bn as slowCcOperationTimeoutMs, bo as getBootstrapMarkerKey, br as STATE_RESOURCES_MALFORMED, bs as StageLoadError, bt as buildFinalSnapshotIdentifier, c as isSecretBearingReferenceString, ci as refuseMalformedResourceEntriesForDestroy, co as AssetPublisher, cr as carriesDynamicReference, cs as CFN_TEMPLATE_BODY_LIMIT, ct as destroyStackRecordsView, d as makeCanonicalizePropertiesFn, da as liveMatchesUnresolvedTokenFrame, di as refuseMalformedResourceEntriesForOrphan, do as WorkGraph, dr as keepsSecretReferenceToken, ds as findLargeInlineResources, dt as recordAfterRollbackUpdate, ei as refuseMalformedOrphans, en as ledgerForStack, eo as hasReasonlessBaselineRefusal, es as resolveCaptureObservedState, f as withResourceDeadline, fa as inheritNestedStackParameterAssociations, fi as refuseMalformedResourcePropertiesForDrift, fo as buildAssetRedirectMap, fr as AWS_NO_VALUE, fs as uploadCfnTemplate, ft as planFailedOps, g as isProtectionValueActive, ga as hasMaskableValues, gi as refuseMalformedResourcesForDestroy, gn as wouldReturnToSdkProvider, go as AssetModeResolver, gs as PARTITION_TABLE, h as PROTECTION_PROPERTY_BY_TYPE, ha as createUnionSecretMasker, hi as refuseMalformedResourcesForDeploy, hn as ccBrokenReason, ho as rewriteTemplateAssetReferences, hr as refStateLookupFromResource, hs as expectedOwnerParam, ht as findNestedStackTypeChanges, i as conditionFingerprint, ia as withRetry, ii as refuseMalformedOutputsForDestroy, io as isReadableBag, ir as isUnboundTemplateParameter, is as resolveUseCdkBootstrapAssets, it as withNestedStackContext, ja as DYNAMIC_REFERENCE_TOKEN_SCAN, jo as describeDockerFailure, jr as malformedExportNamesWarning, js as resolveAssemblyPath, jt as updatePartialMessage, ka as scrubResourceRecord, ko as describeDockerCapturedOutput, kr as isReadableResourceEntry, ks as displayAssemblyPath, l as keptWholeReasonText, la as DagBuilder, li as refuseMalformedResourceEntriesForImport, lo as isSensitiveAttributeName, lr as carriesFetchableDynamicReference, ls as CFN_TEMPLATE_URL_LIMIT, m as recordedProtectionNote, ma as carryLogOnlyValues, mi as refuseMalformedResourcePropertiesForOrphan, mn as ProviderRegistry, mo as loadPublishableAssetManifest, mr as isStalePlaceholderArnAttribute, ms as decodeListingKey, mt as resolveReplacementOldType, n as IMPLICIT_DELETE_DEPENDENCIES, na as templateResourceTypes, ni as refuseMalformedOrphansForOrphan, nn as withCreateTokenLedger, no as importableOutputKeys, ns as resolveStateBucketWithDefault, nt as withNestedRevertRun, o as parentSuppliedValues, oi as refuseMalformedResourceEntries, oo as orphansCarriedFrom, or as getAccountInfo, os as warnDeprecatedNoPrefixCliFlag, ot as replayRollback, p as recordedProtectionEvidence, pa as recordNestedStackParameterExpressions, pi as refuseMalformedResourcePropertiesForExport, pn as CC_BROKEN_REASON, po as createAssetRedirectResolver, pr as cfnRefValueFromPhysicalId, ps as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, pt as planRollback, q as resourcesNamingDeclaredParameter, qa as isLockInfoExpired, qn as AWS_CREDENTIAL_ENV_KEYS, qo as getDockerImageBySourceHash, qr as malformedScrubResourceEntriesRefusalMessage, qt as isExportAliasCollision, r as computeImplicitDeleteEdges, ra as describeTypeWithThrottleRetry, ri as refuseMalformedOutputs, ro as importableOutputs, rr as coerceParameterTypedValue, rs as resolveStateBucketWithDefaultAndSource, s as readRecordedConditionVerdicts, si as refuseMalformedResourceEntriesForDeploy, so as shouldRetainResource, sr as isImpossibleEmptyStoredAttribute, ss as ssmResolvedValueType, t as DeployEngine, ta as prefetchCreateOnlyPropertyPaths, ti as refuseMalformedOrphansForDestroy, to as hasUnverifiableParameterRefusal, ts as resolveSkipPrefix, tt as revertedNestedRowIds, u as mergeNoChangeOutputs, ua as TemplateParser, ui as refuseMalformedResourceEntriesForImportSave, uo as stringifyValue, ur as isNamelessDynamicReferenceError, us as MIGRATE_TMP_PREFIX, ut as withStackRecords, v as readProtection, va as logOnlyValueCount, vi as refuseMalformedState, vo as assertAssetBucketRegion, vr as JSON_LISTING_HOLE_VALUE, vs as derivePartitionAndUrlSuffix, vt as ATOMIC_FINAL_SNAPSHOT_TYPES, wa as errorCauseChain, wi as repairMalformedResourcesForReadOnly, wn as deleteIndeterminateGuards, wo as validateAssetBucketName, wr as displayLogicalId, ws as hasPlainPrototype, wt as isFinalSnapshotError, xa as recordLogOnlyValue, xi as repairMalformedOutputsForReadOnly, xn as ccProtectionRegistryTypes, xo as isCrossRegionRedirect, xr as UNREADABLE_ORPHANS_CONTAINER_ROW, xs as processStackMessages, xt as ccRoutedFinalSnapshotError, ya as printingCorpusOf, yi as repairMalformedOrphanRecordsForReadOnly, yn as CloudControlProvider, yo as ensureAssetStorage, yr as STATE_REGION_DIVERGED, ys as AssemblyReader, yt as PRE_DELETE_SNAPSHOT_TYPES, z as cyan, za as recordNoEchoAttributeValues, zi as renderStatefulReason, zn as producerRegionsFromState, zo as redactDockerArgvValues, zr as malformedOrphansRefusalMessage, zt as secretBearing } from "./deploy-engine-RCOtmm4V.js";
6
- import { t as getCdkdVersion } from "./version-BNo3JdVW.js";
5
+ import { $ as resourcesNamingDeclaredParameter, $a as STATE_SOURCED_READBACK_RULES, $n as explicitRoleArnOrThrow, $o as runDockerForeground, $r as malformedOutputsWarning, $t as noEchoParameterValueSeed, Aa as printingCorpusOf, Ai as repairMalformedOrphanRecordsForReadOnly, An as ccProtectionRegistryTypes, Ao as assertAssetBucketRegion, Ar as STATE_REGION_DIVERGED, As as derivePartitionAndUrlSuffix, At as ccRoutedFinalSnapshotError, Ba as scrubResourceRecord, Bo as resolveDockerContextDirectory, Br as isReadableResourceEntry, Bs as describeFileReadFailure, Bt as updatePartialMessage, C as perType, Ca as inheritNestedStackParameterAssociations, Ci as refuseMalformedResourcePropertiesForDrift, Cn as ProviderRegistry, Co as WorkGraph, Cr as isStalePlaceholderArnAttribute, Cs as findLargeInlineResources, Ct as resolveReplacementOldType, Da as hasMaskableValues, Di as refuseMalformedResourcesForDestroy, Do as rewriteTemplateAssetReferences, Dr as parameterInputsFor, Ds as expectedOwnerParam, Dt as ATOMIC_FINAL_SNAPSHOT_TYPES, Ea as createUnionSecretMasker, Ei as refuseMalformedResourcesForDeploy, En as isCustomResourceType$1, Eo as loadPublishableAssetManifest, Er as withSharedDrainBudget, Es as decodeListingKey, Et as inheritProducerRegions, Fa as errorCauseChain, Fi as repairMalformedResourcesForReadOnly, Fo as readBootstrapMarkerBody, Fr as displayLogicalId, Fs as hasOwnKey, Ft as unsupportedFinalSnapshotError, G as cyan, Ga as pathCrossesDottedKey, Gi as findReplacedReadersOfRecreateTargets, Gn as INTRINSIC_KEYS, Go as finchSecretArgvRefusal, Gr as malformedLocalResourceEntriesWarning, Gs as resolveBucketRegion, Gt as WITHHELD_NAME_DISPLAY, H as formatResourceLine, Ha as DYNAMIC_REFERENCE_TOKEN_SCAN, Ho as describeDockerExecFailure, Hr as malformedExportNamesWarning, Hs as renderAssemblyPathEscape, Ht as DeploymentEventsReader, Ia as maskSecretsInError, Ii as unpreviewableOrphanRecords, In as isWaitAbandonedError, Io as validateAssetBucketName, Ir as hasReadableOrphans, Is as hasPlainPrototype, J as red, Ja as recordMaskOnlyValue, Ji as isStatefulRecreateTargetForReplace, Jn as producerRegionsFromState, Jo as isDockerClientEnvKey, Jr as malformedOrphanRecordsWarning, Jt as secretBearing, K as gray, Ka as identityKeyFor, Ki as shownType, Kn as IntrinsicFunctionResolver, Ko as formatDockerLoginError, Kr as malformedLocalResourcesWarning, Kt as displayTextOrWithheld, La as maskSecretsInText, Li as unreadableOrphanRecords, Lo as validateContainerRepoName, Lr as hasReadableOutputs, Ls as nullPrototypeRecord, Ma as recordLogOnlyValue, Mi as repairMalformedOutputsForReadOnly, Mn as UNSPECIFIED_SKIP_REASON, Mo as getBootstrapMarkerKey, Mr as UNREADABLE_ORPHANS_CONTAINER_ROW, Ms as StageLoadError, Mt as effectiveDeletionPolicy, Na as shareLogOnlyValues, Ni as repairMalformedResourceEntriesForReadOnly, Nn as deleteIndeterminateGuards, No as isCrossRegionRedirect, Nr as UNREADABLE_RESOURCES_MAP_ROW, Ns as processStackMessages, Nt as isFinalSnapshotError, Oa as literalSplitDelimitersOf, Oi as refuseMalformedResourcesForExport, On as CloudControlProvider, Oo as AssetModeResolver, Os as PARTITION_TABLE, Ot as PRE_DELETE_SNAPSHOT_TYPES, Pa as createSecretMasker, Pi as repairMalformedResourcePropertiesForReadOnly, Pn as deleteSkipReason, Po as parseBootstrapMarker, Pr as deployRefusesOrphanRowsReason, Ps as defineOwnKey, Pt as refusesFinalSnapshot, Q as reachableDivergentParameters, Qa as STATE_SOURCED_CROSS_GENERATION_RULES, Qn as assertSendableRoleArn, Qo as redactedDockerCause, Qr as malformedOutputsRefusalMessage, Qt as isWholeDynamicReferenceValue, Ra as markSameGenerationBag, Ri as unreadableResourceEntries, Ro as buildDenyExternalAccessPolicy, Rr as hasReadableResources, Rs as ownValue, S as isProtectionValueActive, Sa as liveMatchesUnresolvedTokenFrame, Si as refuseMalformedResourceEntriesForOrphan, Sn as CC_BROKEN_REASON, So as stringifyValue, Sr as cfnRefValueFromPhysicalId, Ss as MIGRATE_TMP_PREFIX, St as planRollback, Ta as carryLogOnlyValues, Ti as refuseMalformedResourcePropertiesForOrphan, Tn as wouldReturnToSdkProvider, To as createAssetRedirectResolver, Ts as CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION, U as createReadOnlyAttributeHealerFactory, Ua as dynamicReferenceTokens, Ui as NO_CC_HANDLERS_REASON, Uo as describeDockerFailure, Ur as malformedExportSourceWarning, Us as resolveAssemblyPath, Ut as DeploymentEventsStore, Vi as unwrittenCreateOnlyReplacement, Vo as describeDockerCapturedOutput, Vr as malformedDriftResourcePropertiesWarning, Vs as displayAssemblyPath, Vt as updatePartialReason, W as bold, Wa as isUncertifiedBaselineMaskPosition, Wi as hasNoCloudControlHandlers, Wn as DiffCalculator, Wo as dockerSpawnEnvWithSensitive, Wr as malformedLocalOutputsWarning, Wt as extractDeploymentEventError, X as computeParameterTaint, Xa as recordNoEchoAttributeValues, Xi as renderStatefulReason, Xn as applyRoleArnIfSet, Xo as partitionSensitiveEnv, Xr as malformedOrphansRefusalMessage, Xt as secretSafeKeyDisplay, Y as yellow, Ya as recordMaskOnlyValuesIn, Yi as isStatefulRecreateTargetSync, Yn as regionLessSecretName, Yo as isMalformedEnvKey, Yr as malformedOrphanRowsKeptWarning, Yt as secretBearingStateKeyWarning, Z as namesAnyDeclaredParameter, Za as STATE_SOURCED_BASELINE_RULES, Zn as assertFlagRoleArn, Zo as redactDockerArgvValues, Zr as malformedOrphansWarning, Zt as exportNameSecretExposure, _ as makeCanonicalizePropertiesFn, _i as refuseMalformedResourceEntries, _o as orphansAfterRollback, _r as carriesDynamicReference, _s as stateBucketExistenceConfirmed, _t as destroyStackRecordsView, a as findNestedTemplateTreeDefect, ai as malformedStateRefusalMessage, an as DEFAULT_RESOURCE_WARN_AFTER_MS, ao as S3StateBackend, ar as envCredentialsAreAssumedRole, as as getDockerImageBySourceHash, at as dropSettledNestedJournals, b as recordedProtectionNote, ba as DagBuilder, bi as refuseMalformedResourceEntriesForImport, bo as AssetPublisher, br as keepsSecretReferenceToken, bs as CFN_TEMPLATE_BODY_LIMIT, bt as recordAfterRollbackUpdate, c as renderNestedTemplateTreeDefect, co as acceptedCreateOnlyDropsOf, cs as getDefaultStateBucketName, ct as recordDisplacedSkips, d as conditionInputsFrom, di as refuseMalformedOrphans, dn as withCreateTokenLedger, do as hasReadableExportSet, ds as resolveAutoAssetStorage, dt as withNestedRevertRun, ei as malformedRenderedContainersWarning, en as collectDeclaredOutputNames, eo as TEMPLATE_SOURCED_RULES, er as isIamRoleArn, es as runDockerStreaming, et as makeSiblingClaimReader, f as parentSuppliedValues, fa as prefetchCreateOnlyPropertyPaths, fi as refuseMalformedOrphansForDestroy, fo as hasReasonlessBaselineRefusal, fr as coerceParameterTypedValue, fs as resolveCaptureObservedState, g as mergeNoChangeOutputs, gi as refuseMalformedResourceAttributesForOrphan, go as isReadableBag, gr as isImpossibleEmptyStoredAttribute, gs as resolveUseCdkBootstrapAssets, h as keptWholeReasonText, ha as withRetry, hi as refuseMalformedOutputsForDestroy, ho as importableOutputs, hr as getAccountInfo, hs as resolveStateBucketWithDefaultAndSource, ht as replayRollback, i as childTemplateLoader, ii as malformedScrubResourceEntriesRefusalMessage, in as DEFAULT_RESOURCE_TIMEOUT_MS, io as isLockInfoExpired, ir as callerEnvCredentials, is as AssetManifestLoader, it as displacedPhysicalIdShown, ja as recordLogOnlyParameterValue, ji as repairMalformedOrphansForReadOnly, jo as ensureAssetStorage, jr as STATE_RESOURCES_MALFORMED, js as AssemblyReader, jt as createPreDeleteFinalSnapshot, ka as logOnlyValueCount, ki as refuseMalformedState, kn as slowCcOperationTimeoutMs, ko as BOOTSTRAP_MARKER_PREFIX, kr as JSON_LISTING_HOLE_VALUE, ks as canonicalizeRegion, kt as buildFinalSnapshotIdentifier, l as templateIdentity, li as refuseMalformedOrphanRecords, ln as ledgerForStack, lo as describeRegionValueKind, ls as getLegacyStateBucketName, m as isSecretBearingReferenceString, ma as describeTypeWithThrottleRetry, mi as refuseMalformedOutputs, mo as importableOutputKeys, mr as parameterTypeMayLoseSecretIdentity, ms as resolveStateBucketWithDefault, mt as replayFailedOperations, n as IMPLICIT_DELETE_DEPENDENCIES, ni as malformedResourcePropertiesWarning, nn as isExportAliasCollision, no as isSingleDynamicReferenceToken, nr as AWS_CREDENTIAL_ENV_KEYS, ns as escapeRegExp, nt as NESTED_PENDING_PARENT_REASON, o as isAbsoluteAssetPath, oi as previewableOrphanRecords, on as maskingRetryLogger, oo as rebuildClientForBucketRegion, os as Synthesizer, p as readRecordedConditionVerdicts, pa as templateResourceTypes, pi as refuseMalformedOrphansForOrphan, po as hasUnverifiableParameterRefusal, pr as isUnboundTemplateParameter, ps as resolveSkipPrefix, pt as withNestedStackContext, q as green, qa as carriesSecretMask, qi as MULTI_REGION_RECREATE_BLOCKED_TYPES, qn as classifyReplaySecretRegion, qo as getDockerCmd, qr as malformedOrphanRecordsRefusalMessage, qt as exportAliasCollisionScrubWarning, r as computeImplicitDeleteEdges, ri as malformedResourcesWarning, rn as bindingSkippedOutputs, ro as LockManager, rr as applyCallerIdentityCredentials, rs as stripControlChars, rt as displacedOpClause, s as listNestedTemplateRows, si as refuseDivergentRecordRegionForDestroy, sn as RollbackInlinePolicyWriters, so as splitImportedOps, ss as synthesisStatusMessage, st as nestedChildStackName$1, t as DeployEngine, ti as malformedResourceEntriesWarning, tn as collectPublishedOutputNames, to as WHOLE_DYNAMIC_REFERENCE_PATTERN, tr as sendableAssumeRoleCommand, ts as warnFinchArgvExposure, tt as planOrphanAdoption, u as conditionFingerprint, ui as refuseMalformedOrphanRecordsForDestroy, uo as exportNamesCarriedFrom, us as resolveApp, ut as revertedNestedRowIds, v as withResourceDeadline, vi as refuseMalformedResourceEntriesForDeploy, vo as orphansCarriedFrom, vr as carriesFetchableDynamicReference, vs as warnDeprecatedNoPrefixCliFlag, w as readProtection, wa as recordNestedStackParameterExpressions, wi as refuseMalformedResourcePropertiesForExport, wn as ccBrokenReason, wo as buildAssetRedirectMap, wr as refStateLookupFromResource, ws as uploadCfnTemplate, wt as findNestedStackTypeChanges, x as PROTECTION_PROPERTY_BY_TYPE, xa as TemplateParser, xi as refuseMalformedResourceEntriesForImportSave, xo as isSensitiveAttributeName, xr as AWS_NO_VALUE, xs as CFN_TEMPLATE_URL_LIMIT, xt as planFailedOps, y as recordedProtectionEvidence, yi as refuseMalformedResourceEntriesForDestroy, yo as shouldRetainResource, yr as isNamelessDynamicReferenceError, ys as ssmResolvedValueType, yt as withStackRecords, za as redactSecretsForState, zi as findActionableSilentDrops, zo as buildDockerImage, zr as isReadableOrphanRecord, zs as absoluteAssemblyPathEscape } from "./deploy-engine-CMRU0DTu.js";
6
+ import { t as getCdkdVersion } from "./version-DIQcU8CA.js";
7
7
  import { randomBytes, randomUUID } from "node:crypto";
8
8
  import { CopyObjectCommand, CreateBucketCommand, DeleteBucketCommand, DeleteObjectsCommand, GetBucketLocationCommand, GetObjectCommand, HeadBucketCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, NotFound, PutBucketEncryptionCommand, PutBucketPolicyCommand, PutBucketVersioningCommand, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
9
9
  import { GetRoleCommand, GetUserCommand } from "@aws-sdk/client-iam";
@@ -1880,147 +1880,6 @@ function analyzePinCcApiReachability(pinnedLogicalIds, stacks) {
1880
1880
  };
1881
1881
  }
1882
1882
 
1883
- //#endregion
1884
- //#region src/utils/nested-template-cycle.ts
1885
- const NESTED_STACK_TYPE$2 = "AWS::CloudFormation::Stack";
1886
- function isAbsoluteAssetPath(p) {
1887
- return path.isAbsolute(p) || p.startsWith("/");
1888
- }
1889
- function templateIdentity(templatePath) {
1890
- const dir = path.dirname(templatePath);
1891
- let realDir;
1892
- try {
1893
- realDir = fs.realpathSync.native(dir);
1894
- } catch {
1895
- realDir = path.resolve(dir);
1896
- }
1897
- return path.join(realDir, path.basename(templatePath));
1898
- }
1899
- function listNestedTemplateRows(template) {
1900
- if (template === null || typeof template !== "object") return [];
1901
- const resources = template.Resources;
1902
- if (resources === null || resources === void 0) return [];
1903
- const rows = [];
1904
- for (const [logicalId, resource] of Object.entries(resources)) {
1905
- const row = resource;
1906
- if (row?.Type !== NESTED_STACK_TYPE$2) continue;
1907
- const assetPath = row.Metadata?.["aws:asset:path"];
1908
- if (typeof assetPath !== "string" || assetPath.length === 0) continue;
1909
- rows.push({
1910
- logicalId,
1911
- assetPath
1912
- });
1913
- }
1914
- return rows;
1915
- }
1916
- function readNestedRows(templatePath) {
1917
- let parsed;
1918
- try {
1919
- parsed = JSON.parse(fs.readFileSync(templatePath, "utf-8"));
1920
- } catch {
1921
- return;
1922
- }
1923
- return listNestedTemplateRows(parsed);
1924
- }
1925
- const MAX_NESTING_DEPTH = 512;
1926
- const MAX_ROWS_FOLLOWED = 1e4;
1927
- function findNestedTemplateTreeDefect(nestedTemplates, ancestorTemplatePaths = []) {
1928
- const onChain = /* @__PURE__ */ new Set();
1929
- for (const p of ancestorTemplatePaths) onChain.add(templateIdentity(p));
1930
- const clean = /* @__PURE__ */ new Set();
1931
- const chain = [];
1932
- let rowsFollowed = 0;
1933
- const visit = (logicalId, templatePath) => {
1934
- if (typeof templatePath !== "string") return void 0;
1935
- const identity = templateIdentity(templatePath);
1936
- const lexical = path.resolve(templatePath);
1937
- chain.push({
1938
- logicalId,
1939
- templatePath: identity
1940
- });
1941
- try {
1942
- if (onChain.has(identity)) return {
1943
- kind: "cycle",
1944
- chain: [...chain]
1945
- };
1946
- if (chain.length > 512) return {
1947
- kind: "too-deep",
1948
- chain: [...chain]
1949
- };
1950
- if (++rowsFollowed > 1e4) return {
1951
- kind: "too-large",
1952
- chain: [...chain]
1953
- };
1954
- if (clean.has(lexical)) return void 0;
1955
- const rows = readNestedRows(templatePath);
1956
- if (rows === void 0) return void 0;
1957
- onChain.add(identity);
1958
- try {
1959
- const dir = path.dirname(templatePath);
1960
- for (const row of rows) {
1961
- if (isAbsoluteAssetPath(row.assetPath)) return {
1962
- kind: "absolute-path",
1963
- chain: [...chain],
1964
- logicalId: row.logicalId,
1965
- assetPath: row.assetPath
1966
- };
1967
- const resolved = resolveAssemblyPath(dir, row.assetPath);
1968
- if (!resolved.contained) return {
1969
- kind: "escaping-path",
1970
- chain: [...chain],
1971
- logicalId: row.logicalId,
1972
- assetPath: row.assetPath,
1973
- escape: resolved,
1974
- dir
1975
- };
1976
- const defect = visit(row.logicalId, resolved.path);
1977
- if (defect) return defect;
1978
- }
1979
- } finally {
1980
- onChain.delete(identity);
1981
- }
1982
- clean.add(lexical);
1983
- return;
1984
- } finally {
1985
- chain.pop();
1986
- }
1987
- };
1988
- for (const [logicalId, templatePath] of Object.entries(nestedTemplates)) {
1989
- const defect = visit(logicalId, templatePath);
1990
- if (defect) return defect;
1991
- }
1992
- }
1993
- const MAX_RENDERED_HOPS = 8;
1994
- function renderChain(chain) {
1995
- const hop = (h) => `${displayIdent(h.logicalId)} (${displayAssemblyPath(h.templatePath)})`;
1996
- if (chain.length <= MAX_RENDERED_HOPS) return chain.map(hop).join(" then ");
1997
- const keep = MAX_RENDERED_HOPS / 2;
1998
- return [
1999
- ...chain.slice(0, keep).map(hop),
2000
- `... ${chain.length - 8} more ...`,
2001
- ...chain.slice(-4).map(hop)
2002
- ].join(" then ");
2003
- }
2004
- function renderNestedTemplateTreeDefect(defect, stackName, action) {
2005
- const provenance = `CDK emits an acyclic nested template tree with relative asset paths, so this indicates the synth output was hand-modified or generated by a non-CDK toolchain. Refusing to ${action}.`;
2006
- const owner = (chain) => {
2007
- const ids = chain.slice(0, -1).map((h) => h.logicalId);
2008
- const keep = MAX_RENDERED_HOPS / 2;
2009
- if (ids.length <= MAX_RENDERED_HOPS) return displayStackName([stackName, ...ids].join("~"));
2010
- const head = displayStackName([stackName, ...ids.slice(0, keep)].join("~"));
2011
- const tail = displayStackName(ids.slice(-4).join("~"));
2012
- return `${head}~...${ids.length - 8} more...~${tail}`;
2013
- };
2014
- if (defect.kind === "cycle") {
2015
- const closing = defect.chain[defect.chain.length - 1];
2016
- return `The nested template tree under stack ${displayStackName(stackName)} contains a cycle: ${renderChain(defect.chain)}. Nested stack ${displayIdent(closing.logicalId)} (declared in stack ${owner(defect.chain)}) resolves to a template that is already on that nesting chain, so its Metadata['aws:asset:path'] closes a cycle. ${provenance}`;
2017
- }
2018
- if (defect.kind === "too-large") return `The nested template tree under stack ${displayStackName(stackName)} has more than ${MAX_ROWS_FOLLOWED} nested-stack rows to follow (the walk stopped at ${renderChain(defect.chain)}). That is far beyond any CDK-generated assembly. Symlinked directories can give one template file many paths, which multiplies the tree without ever repeating on one chain. Refusing to ${action}.`;
2019
- if (defect.kind === "too-deep") return `The nested template tree under stack ${displayStackName(stackName)} nests more than ${512} levels deep: ${renderChain(defect.chain)}. No tree that deep can deploy, because each level lengthens the child's state key and S3 caps a key at 1024 bytes. ${provenance}`;
2020
- if (defect.kind === "escaping-path") return `The nested template tree under stack ${displayStackName(stackName)} has nested stack ${displayIdent(defect.logicalId)} (reached through ${renderChain(defect.chain)}) with Metadata['aws:asset:path']=${displayAssemblyPath(defect.assetPath)} which ${renderAssemblyPathEscape(defect.escape, defect.dir, action)}`;
2021
- return `The nested template tree under stack ${displayStackName(stackName)} has nested stack ${displayIdent(defect.logicalId)} (reached through ${renderChain(defect.chain)}) with Metadata['aws:asset:path']=${displayAssemblyPath(defect.assetPath)} which is absolute. ${provenance}`;
2022
- }
2023
-
2024
1883
  //#endregion
2025
1884
  //#region src/cli/commands/nested-template-preflight.ts
2026
1885
  function refuseMalformedNestedTemplateTrees(stacks) {
@@ -2503,7 +2362,7 @@ function collectCrossStackRefs(node, onRef) {
2503
2362
  //#region src/provisioning/register-providers.ts
2504
2363
  let providerClasses;
2505
2364
  function loadProviderClasses() {
2506
- providerClasses ??= import("./provider-classes-R7yvwymx.js");
2365
+ providerClasses ??= import("./provider-classes-5NUmLSTV.js");
2507
2366
  return providerClasses;
2508
2367
  }
2509
2368
  function registerAllProviders(registry, classes) {
@@ -4632,7 +4491,40 @@ async function computeStackDiff(currentState, template, region, stackName, state
4632
4491
  deployRefusals.push(deployRefusesOrphanRowsReason(previewedRowsTheDeployRefuses));
4633
4492
  }
4634
4493
  }
4635
- const changes = await diffCalculator.calculateDiff(stateForDiff, effectiveTemplate, resolveFn, canonicalizeProperties, void 0, void 0, maskForLog);
4494
+ let maskedInputs;
4495
+ if (options.previewMaskedInputs === true) {
4496
+ const classified = parameterInputsFor({
4497
+ template,
4498
+ values: mergedParameters,
4499
+ unbound: unboundParameterNames
4500
+ });
4501
+ const resourcesForInputs = stateForDiff.resources;
4502
+ maskedInputs = { sources: {
4503
+ template: effectiveTemplate,
4504
+ parameterInput: classified.parameterInput,
4505
+ conditions,
4506
+ childTemplate: childTemplateLoader(options.nestedTemplates),
4507
+ resolve: async (node) => {
4508
+ const secrets = /* @__PURE__ */ new Map();
4509
+ return {
4510
+ value: await intrinsicResolver.resolve(structuredClone(node), {
4511
+ recordedSecretValues: secrets,
4512
+ template: effectiveTemplate,
4513
+ resources: resourcesForInputs,
4514
+ stateBackend,
4515
+ stackName,
4516
+ bestEffort: true,
4517
+ ...Object.keys(classified.bound).length > 0 && { parameters: classified.bound },
4518
+ ...conditions && Object.keys(conditions).length > 0 && { conditions },
4519
+ skipDynamicReferences: true,
4520
+ staleAttributeHeal: { phase: "probe" }
4521
+ }),
4522
+ secrets
4523
+ };
4524
+ }
4525
+ } };
4526
+ }
4527
+ const changes = await diffCalculator.calculateDiff(stateForDiff, effectiveTemplate, resolveFn, canonicalizeProperties, void 0, void 0, maskForLog, void 0, maskedInputs);
4636
4528
  const nestedStackTypeChanges = findNestedStackTypeChanges({
4637
4529
  changes,
4638
4530
  stateResources: stateForDiff.resources
@@ -4912,7 +4804,9 @@ async function buildDiffTree(args) {
4912
4804
  ...previewOrphanAdoption && { previewOrphanAdoption },
4913
4805
  ...inheritedSecrets && { inheritedSecrets },
4914
4806
  ...attributeHealer && { attributeHealer },
4915
- inheritSecretBearingTemplate: false
4807
+ inheritSecretBearingTemplate: false,
4808
+ previewMaskedInputs: !isNestedChild,
4809
+ nestedTemplates
4916
4810
  });
4917
4811
  } finally {
4918
4812
  createOnlyPrefetch.cancel();
@@ -5184,7 +5078,7 @@ function renderChangeLines(changes, logFn, ccApiRoutes, adoptedOrphans) {
5184
5078
  logFn(` [~] ${logicalId} (${change.resourceType})${annotateAdoption(logicalId)}${annotateRouting(logicalId)}`);
5185
5079
  if (change.propertyChanges && change.propertyChanges.length > 0) for (const propChange of change.propertyChanges) {
5186
5080
  const requiresReplace = propChange.requiresReplacement && (propChange.inPlacePropagated === true || propChange.replacementPropagated === true) ? " [may require replacement]" : propChange.requiresReplacement ? " [requires replacement]" : "";
5187
- const propagated = propChange.replacementPropagated ? " [replacement propagated]" : propChange.inPlacePropagated ? " [attribute propagated]" : propChange.maskedExpressionChanged === true ? " [template expression changed]" : "";
5081
+ const propagated = propChange.replacementPropagated ? " [replacement propagated]" : propChange.inPlacePropagated ? " [attribute propagated]" : propChange.maskedExpressionChanged === true ? " [masked input or expression changed]" : "";
5188
5082
  const indent = " ";
5189
5083
  const [oldFiltered, newFiltered] = stripUnchangedValuePair(propChange.oldValue, propChange.newValue);
5190
5084
  const oldStr = renderDiffValue(propChange.oldValue, oldFiltered, indent, false);
@@ -6726,6 +6620,7 @@ function abandonedScanVerdict(source, err) {
6726
6620
  }
6727
6621
  function abandonedUnitVerdict(entry) {
6728
6622
  if (!entry.carriedDynamicReference) return "silent";
6623
+ if (entry.unit === "placeholder") return "count";
6729
6624
  if (isTemplateShapeResolutionFailure(entry.error) || !entry.carriedFetchableReference) return "warn";
6730
6625
  return "count";
6731
6626
  }
@@ -6962,6 +6857,25 @@ function makeCrossStackPrePass(deps) {
6962
6857
  await walk(bag, "", canRefuse);
6963
6858
  };
6964
6859
  }
6860
+ async function bindDefaultedParametersOneByOne(resolver, template, shownStack, logger) {
6861
+ const bound = nullPrototypeRecord();
6862
+ const declared = template.Parameters;
6863
+ if (declared === void 0 || declared === null || typeof declared !== "object") return bound;
6864
+ for (const [name, definition] of Object.entries(declared)) {
6865
+ if (definition === null || typeof definition !== "object" || !("Default" in definition)) continue;
6866
+ if (definition.Default === "") continue;
6867
+ try {
6868
+ const one = await resolver.resolveParameters({
6869
+ ...template,
6870
+ Parameters: { [name]: definition }
6871
+ });
6872
+ if (Object.hasOwn(one, name)) bound[name] = one[name];
6873
+ } catch (err) {
6874
+ logger.debug(safeMsg`Parameter ${name} of ${shownStack} left unbound: ${err instanceof Error ? err.message : String(err)}`);
6875
+ }
6876
+ }
6877
+ return bound;
6878
+ }
6965
6879
  function exportNameDisplayOver(outputSecrets, extra, withheld) {
6966
6880
  const corpus = new Map([...printingCorpusOf(outputSecrets), ...extra ?? []]);
6967
6881
  return (exportName, alsoMask) => {
@@ -7110,6 +7024,7 @@ async function scrubStack(stack, region, stateBackend, lockManager, opts) {
7110
7024
  throw new ScrubRefusalError(`Nested stack ${shownStack}: its Parameters could not be resolved against its own template (${reason}), so its secrets cannot be identified. Its record was NOT examined and may still hold plaintext.`, "SCRUB_NESTED_CHILD_UNRESOLVABLE");
7111
7025
  }
7112
7026
  logger.debug(`Parameter resolution skipped for ${shownStack}: ${maskSecretsInText(err instanceof Error ? err.message : String(err), outputSecrets)}`);
7027
+ parameters = await bindDefaultedParametersOneByOne(resolver, stack.template, shownStack, logger);
7113
7028
  }
7114
7029
  const resolverStateBackend = memoizeCrossStackStateReads(stateBackend);
7115
7030
  const resolverContext = (recordedSecretValues) => ({
@@ -8234,7 +8149,18 @@ async function driftCommand(stacks, options) {
8234
8149
  return scope;
8235
8150
  };
8236
8151
  const resolvePrincipalUniqueId = createIamPrincipalUniqueIdResolver(awsClients);
8237
- const targetRefs = resolveTargetRefs(stacks, await stateBackend.listStacks(), options);
8152
+ const stateRefs = await stateBackend.listStacks();
8153
+ const targetRefs = resolveTargetRefs(stacks, stateRefs, options);
8154
+ const selectedKeys = new Set(targetRefs.map(stackRefKey));
8155
+ const stateKeys = new Set(stateRefs.map(stackRefKey));
8156
+ const nestedChildRecord = (childStackName, region) => {
8157
+ const key = stackRefKey({
8158
+ stackName: childStackName,
8159
+ region
8160
+ });
8161
+ if (selectedKeys.has(key)) return "selected";
8162
+ return stateKeys.has(key) ? "unselected" : "missing";
8163
+ };
8238
8164
  const reports = [];
8239
8165
  for (const ref of targetRefs) {
8240
8166
  if (!ref.region) {
@@ -8252,7 +8178,7 @@ async function driftCommand(stacks, options) {
8252
8178
  }
8253
8179
  const stackRegion = ref.region;
8254
8180
  const scope = stackRegionScope(stackRegion);
8255
- const report = await runWithStackAwsClients(scope.clients, () => runDriftForStack(ref.stackName, stackRegion, stateBackend, scope.registry, scope.ccApiFallback, resolvePrincipalUniqueId, options.accept || options.revert ? "refuse" : "repair"));
8181
+ const report = await runWithStackAwsClients(scope.clients, () => runDriftForStack(ref.stackName, stackRegion, stateBackend, scope.registry, scope.ccApiFallback, resolvePrincipalUniqueId, options.accept || options.revert ? "refuse" : "repair", nestedChildRecord));
8256
8182
  reports.push(report);
8257
8183
  }
8258
8184
  if (options.json) writeJsonReport(reports);
@@ -8267,6 +8193,7 @@ async function driftCommand(stacks, options) {
8267
8193
  }
8268
8194
  const mode = options.accept ? "accept" : "revert";
8269
8195
  const refusedDeleted = refuseDeletedForRemediation(reports, mode, logger);
8196
+ const anyRefusedDeleted = refusedDeleted.deleted + refusedDeleted.recordMissing > 0;
8270
8197
  if (!reports.some((r) => r.outcomes.some((o) => matchOutcome(o, {
8271
8198
  drifted: () => true,
8272
8199
  clean: () => false,
@@ -8275,7 +8202,7 @@ async function driftCommand(stacks, options) {
8275
8202
  skipped: () => false,
8276
8203
  deleted: () => false
8277
8204
  })))) {
8278
- if (refusedDeleted > 0) {
8205
+ if (anyRefusedDeleted) {
8279
8206
  if (anyIncomplete) {
8280
8207
  for (const line of incompleteRemediationMessage(reports, mode).slice(0, -1)) logger.info(line);
8281
8208
  logger.info(safeMsg`Re-run 'cdkd drift' without --${mode} to see which resources and why — ` + `with a deleted resource in the stack, that run exits 1.`);
@@ -8295,28 +8222,72 @@ async function driftCommand(stacks, options) {
8295
8222
  else try {
8296
8223
  outcome = await runRevert(reports, stackRegionScope, stateBackend, stateConfig, awsClients, options);
8297
8224
  } catch (err) {
8298
- if (refusedDeleted > 0 && err instanceof PartialFailureError) throw new PartialFailureError(`${err.message} ${deletedRefusalError(refusedDeleted, mode).message}`, err);
8225
+ if (anyRefusedDeleted && err instanceof PartialFailureError) throw new PartialFailureError(`${err.message} ${deletedRefusalError(refusedDeleted, mode).message}`, err);
8299
8226
  throw err;
8300
8227
  }
8301
- if (refusedDeleted > 0 && !options.dryRun && outcome !== false) throw deletedRefusalError(refusedDeleted, mode);
8228
+ if (anyRefusedDeleted && !options.dryRun && outcome !== false) throw deletedRefusalError(refusedDeleted, mode);
8302
8229
  } finally {
8303
8230
  for (const { clients } of stackRegionScopes.values()) clients.destroy();
8304
8231
  awsClients.destroy();
8305
8232
  }
8306
8233
  }
8307
8234
  function refuseDeletedForRemediation(reports, mode, logger) {
8308
- let refused = 0;
8235
+ const refused = {
8236
+ deleted: 0,
8237
+ recordMissing: 0
8238
+ };
8309
8239
  for (const report of reports) for (const outcome of report.outcomes) {
8310
8240
  if (outcome.kind !== "deleted") continue;
8311
- refused += 1;
8241
+ if (outcome.nestedStackRecordMissing === true) {
8242
+ refused.recordMissing += 1;
8243
+ logger.warn(safeMsg` ! ${reportHeading(report)} ${reportResource(outcome)}: NOT ` + (mode === "revert" ? "reverted" : "accepted") + safeMsg` — ${nestedRecordMissingClause(report, outcome)} ${NESTED_RECORD_MISSING_REMEDY}`);
8244
+ continue;
8245
+ }
8312
8246
  logger.warn(safeMsg` ! ${reportHeading(report)} ${reportResource(outcome)}: NOT ` + (mode === "revert" ? "reverted — AWS reports this resource no longer exists (deleted outside cdkd), and --revert updates a resource in place: it cannot recreate one." : "accepted — AWS reports this resource no longer exists (deleted outside cdkd), so there is no AWS-current value to write to state.") + safeMsg` ${DELETED_RESOURCE_REMEDY}`);
8247
+ refused.deleted += 1;
8313
8248
  }
8314
8249
  return refused;
8315
8250
  }
8316
- function deletedRefusalError(count, mode) {
8317
- return new PartialFailureError(`${count} resource(s) deleted outside cdkd were not ${mode === "accept" ? "accepted" : "reverted"}; each is named above.`);
8251
+ function deletedRefusalError({ deleted, recordMissing }, mode) {
8252
+ const verb = mode === "accept" ? "accepted" : "reverted";
8253
+ const parts = [...deleted > 0 ? [`${deleted} resource(s) deleted outside cdkd`] : [], ...recordMissing > 0 ? [`${recordMissing} nested stack(s) whose state record is gone`] : []];
8254
+ return new PartialFailureError(`${parts.join(" and ")} were not ${verb}; each is named above.`);
8318
8255
  }
8319
8256
  const DELETED_RESOURCE_REMEDY = "First confirm it is really gone (in the AWS console or with the AWS CLI). A deploy that does not change it will not recreate it: to recreate it, remove it from the CDK app and deploy, then restore it and deploy again; if it is meant to be gone, the first of those deploys is enough. Anything in the app that references it has to come out with it, and that deploy DELETES those resources too.";
8257
+ const NESTED_RECORD_MISSING_REMEDY = "If the parent was imported with 'cdkd import --migrate-from-cloudformation' and that import stopped part-way, its nested stacks were not recorded yet: re-run that import with --force, which rebuilds the parent record from the stack and then records them. Otherwise the resources the nested stack held are no longer tracked by cdkd and may still exist in AWS, and recreating it can collide with them. A deploy that does not change the nested stack will not recreate it: to recreate it, remove it from the CDK app and deploy, then restore it and deploy again; if it is meant to be gone, the first of those deploys is enough.";
8258
+ function nestedRecordMissingClause(report, outcome) {
8259
+ return safeMsg`its nested stack's own state record ${reportIdent(nestedChildStackName(report.stackName, outcome.logicalId), STACK_REF_MAX_CODE_POINTS)} is not in state.`;
8260
+ }
8261
+ function nestedChildStackName(parentStackName, logicalId) {
8262
+ return `${parentStackName}~${logicalId}`;
8263
+ }
8264
+ function stackRefKey(ref) {
8265
+ return producerRecordKey(ref.stackName, ref.region ?? "");
8266
+ }
8267
+ function isNestedDescendantOf(ref, ancestor) {
8268
+ return ancestor.region !== void 0 && ref.region === ancestor.region && ref.stackName.startsWith(`${ancestor.stackName}~`);
8269
+ }
8270
+ function compareNestedStackNames(a, b) {
8271
+ const as = a.split("~");
8272
+ const bs = b.split("~");
8273
+ for (let i = 0; i < Math.min(as.length, bs.length); i++) if (as[i] !== bs[i]) return as[i] < bs[i] ? -1 : 1;
8274
+ return as.length - bs.length;
8275
+ }
8276
+ function withNestedDescendants(selected, stateRefs) {
8277
+ const out = [];
8278
+ const seen = /* @__PURE__ */ new Set();
8279
+ const add = (ref) => {
8280
+ const key = stackRefKey(ref);
8281
+ if (seen.has(key)) return;
8282
+ seen.add(key);
8283
+ out.push(ref);
8284
+ };
8285
+ for (const ref of selected) {
8286
+ add(ref);
8287
+ stateRefs.filter((r) => isNestedDescendantOf(r, ref)).sort((a, b) => compareNestedStackNames(a.stackName, b.stackName)).forEach(add);
8288
+ }
8289
+ return out;
8290
+ }
8320
8291
  function resolveTargetRefs(stacks, stateRefs, options) {
8321
8292
  if (options.all) {
8322
8293
  if (stateRefs.length === 0) throw new Error("No stacks found in state bucket.");
@@ -8326,8 +8297,9 @@ function resolveTargetRefs(stacks, stateRefs, options) {
8326
8297
  if (stacks.length === 0) {
8327
8298
  const candidates = options.stackRegion ? stateRefs.filter((r) => r.region === options.stackRegion) : stateRefs;
8328
8299
  if (candidates.length === 0) throw new Error("No stacks found in state bucket. Run `cdkd deploy` first, or pass --all explicitly.");
8329
- if (candidates.length === 1) return [candidates[0]];
8330
- const listing = candidates.map((r) => `${r.stackName}${r.region ? ` (${r.region})` : ""}`).join(", ");
8300
+ const roots = candidates.filter((r) => !candidates.some((a) => a !== r && isNestedDescendantOf(r, a)));
8301
+ if (roots.length === 1) return withNestedDescendants([roots[0]], candidates);
8302
+ const listing = roots.map((r) => `${r.stackName}${r.region ? ` (${r.region})` : ""}`).join(", ");
8331
8303
  throw new Error(`Multiple stacks found in state: ${listing}. Specify stack name(s) or use --all.`);
8332
8304
  }
8333
8305
  const out = [];
@@ -8350,7 +8322,7 @@ function resolveTargetRefs(stacks, stateRefs, options) {
8350
8322
  const regions = matches.map((r) => r.region === void 0 ? "(legacy)" : regionShown(r.region)).join(", ");
8351
8323
  throw new Error(`Stack ${quotedOrDescribed(stackName, "stack name")} has state in multiple regions: ${regions}. Re-run with --stack-region ${commandHole("region")} to disambiguate.`);
8352
8324
  }
8353
- return out;
8325
+ return withNestedDescendants(out, stateRefs);
8354
8326
  }
8355
8327
  function createIamPrincipalUniqueIdResolver(awsClients) {
8356
8328
  const cache = /* @__PURE__ */ new Map();
@@ -8654,7 +8626,7 @@ function redactDriftChanges(changes, secrets, secretPaths, maskPaths) {
8654
8626
  maskedPaths
8655
8627
  };
8656
8628
  }
8657
- async function runDriftForStack(stackName, region, stateBackend, providerRegistry, ccApiFallback, resolvePrincipalUniqueId, malformedRecordMode) {
8629
+ async function runDriftForStack(stackName, region, stateBackend, providerRegistry, ccApiFallback, resolvePrincipalUniqueId, malformedRecordMode, nestedChildRecord) {
8658
8630
  const result = await stateBackend.getState(stackName, region);
8659
8631
  if (!result) throw new Error(`No state found for stack '${stackName}' (${region}). Run 'cdkd state list' to see available stacks.`);
8660
8632
  return await withStackName(stackName, async () => {
@@ -8714,6 +8686,26 @@ async function runDriftForStack(stackName, region, stateBackend, providerRegistr
8714
8686
  });
8715
8687
  continue;
8716
8688
  }
8689
+ if (resource.resourceType === "AWS::CloudFormation::Stack") {
8690
+ const child = nestedChildRecord(nestedChildStackName(stackName, logicalId), region);
8691
+ if (child === "selected") {
8692
+ outcomes.push({
8693
+ kind: "skipped",
8694
+ logicalId,
8695
+ resourceType: resource.resourceType
8696
+ });
8697
+ continue;
8698
+ }
8699
+ if (child === "missing") {
8700
+ outcomes.push({
8701
+ kind: "deleted",
8702
+ logicalId,
8703
+ resourceType: resource.resourceType,
8704
+ nestedStackRecordMissing: true
8705
+ });
8706
+ continue;
8707
+ }
8708
+ }
8717
8709
  let provider;
8718
8710
  const secrets = /* @__PURE__ */ new Map();
8719
8711
  try {
@@ -9870,7 +9862,8 @@ function writeJsonReport(reports) {
9870
9862
  deleted: (del) => {
9871
9863
  deleted.push({
9872
9864
  logicalId: del.logicalId,
9873
- type: del.resourceType
9865
+ type: del.resourceType,
9866
+ ...del.nestedStackRecordMissing === true && { nestedStackRecordMissing: true }
9874
9867
  });
9875
9868
  }
9876
9869
  });
@@ -9935,6 +9928,7 @@ function writeHumanReport(reports) {
9935
9928
  const unsupported = [];
9936
9929
  let inspectedCount = 0;
9937
9930
  let skippedCount = 0;
9931
+ let nestedCoveredCount = 0;
9938
9932
  for (const o of report.outcomes) matchOutcome(o, {
9939
9933
  drifted: (d) => {
9940
9934
  drifted.push(d);
@@ -9943,8 +9937,9 @@ function writeHumanReport(reports) {
9943
9937
  unsupported: (u) => {
9944
9938
  unsupported.push(u);
9945
9939
  },
9946
- skipped: () => {
9940
+ skipped: (sk) => {
9947
9941
  skippedCount += 1;
9942
+ if (sk.resourceType === "AWS::CloudFormation::Stack") nestedCoveredCount += 1;
9948
9943
  },
9949
9944
  clean: () => {
9950
9945
  inspectedCount += 1;
@@ -9961,14 +9956,15 @@ function writeHumanReport(reports) {
9961
9956
  const notCompared = notComparedOutcomes(report);
9962
9957
  const checked = inspected - notCompared.length;
9963
9958
  if (drifted.length === 0 && deleted.length === 0) {
9964
- if (notCompared.length === 0 && checked === 0 && report.outcomes.length > 0) process.stdout.write(`⚠ ${reportHeading(report)}: no drift detected, but NOTHING was compared — 0 of ${report.outcomes.length} resource${report.outcomes.length === 1 ? "" : "s"} checked (${unsupported.length} unsupported, ${skippedCount} skipped)\n`);
9959
+ if (notCompared.length === 0 && nestedCoveredCount > 0 && nestedCoveredCount === report.outcomes.length) process.stdout.write(`✓ ${reportHeading(report)}: no drift detected here — ${nestedCoveredCount} nested stack${nestedCoveredCount === 1 ? "" : "s"}, each checked in its own block\n`);
9960
+ else if (notCompared.length === 0 && checked === 0 && report.outcomes.length > 0) process.stdout.write(`⚠ ${reportHeading(report)}: no drift detected, but NOTHING was compared — 0 of ${report.outcomes.length} resource${report.outcomes.length === 1 ? "" : "s"} checked (${unsupported.length} unsupported, ${skippedCount} skipped)\n`);
9965
9961
  else if (notCompared.length > 0) process.stdout.write(`⚠ ${reportHeading(report)}: no drift detected, but ${checked} of ${inspected} resource${inspected === 1 ? "" : "s"} fully checked ` + (notCompared.some((n) => !ANY_OF_IT_COMPARED[n.cause]) ? `(${notCompared.length} not fully compared), ` : `(${notCompared.length} only partially compared), `) + `${unsupported.length} unsupported\n`);
9966
9962
  else process.stdout.write(`✓ ${reportHeading(report)}: no drift detected (${checked} resource${checked === 1 ? "" : "s"} checked, ${unsupported.length} unsupported)\n`);
9967
9963
  } else {
9968
9964
  const driftCount = drifted.length + deleted.length;
9969
9965
  const word = driftCount === 1 ? "resource" : "resources";
9970
9966
  process.stdout.write(`\n⚠ ${reportHeading(report)}: drift detected on ${driftCount} ${word}\n\n`);
9971
- for (const o of deleted) process.stdout.write(` - ${reportResource(o)} — DELETED outside cdkd: AWS reports it does not exist.\n\n`);
9967
+ for (const o of deleted) process.stdout.write(o.nestedStackRecordMissing === true ? ` - ${reportResource(o)} — RECORD MISSING: ${nestedRecordMissingClause(report, o)}\n\n` : ` - ${reportResource(o)} — DELETED outside cdkd: AWS reports it does not exist.\n\n`);
9972
9968
  for (const o of drifted) {
9973
9969
  process.stdout.write(` ~ ${reportResource(o)}\n`);
9974
9970
  for (const change of o.changes) {
@@ -10010,7 +10006,7 @@ function stackRegionOption$2() {
10010
10006
  return new Option("--stack-region <region>", "Region of the stack record to inspect. Required when the same stack name has state in multiple regions.").argParser(parseStackRegion);
10011
10007
  }
10012
10008
  function createDriftCommand() {
10013
- const cmd = new Command("drift").description("Detect drift between cdkd state and AWS reality. Exits 0 when nothing drifted, 1 when drift is detected, and 2 when nothing drifted but cdkd REFUSED to compare a resource, because a dynamic reference its state records could not be attributed to a region. Pass --accept to update cdkd state from AWS, or --revert to push cdkd state values back into AWS.").argument("[stacks...]", "Stack name(s) to check (physical CloudFormation names)").option("--all", "Check every stack in the state bucket", false).option("--json", "Output as JSON", false).option("--accept", "Update cdkd state with the AWS-current values for every drifted property (state ← AWS). Mutually exclusive with --revert.", false).option("--revert", "Push cdkd state values back into AWS via provider.update for every drifted resource (AWS ← state). Mutually exclusive with --accept.", false).option("--dry-run", "Print the planned mutations without acquiring a lock or hitting AWS / S3. Honored by --accept and --revert.", false).option("--concurrency <number>", "Maximum concurrent provider.update calls during --revert", (value) => parseInt(value, 10), 4).addOption(stackRegionOption$2()).action(withErrorHandling(driftCommand));
10009
+ const cmd = new Command("drift").description("Detect drift between cdkd state and AWS reality. Exits 0 when nothing drifted, 1 when drift is detected, and 2 when nothing drifted but cdkd REFUSED to compare a resource, because a dynamic reference its state records could not be attributed to a region. Pass --accept to update cdkd state from AWS, or --revert to push cdkd state values back into AWS.").argument("[stacks...]", "Stack name(s) to check (physical CloudFormation names), each with its nested stacks").option("--all", "Check every stack in the state bucket", false).option("--json", "Output as JSON", false).option("--accept", "Update cdkd state with the AWS-current values for every drifted property (state ← AWS). Mutually exclusive with --revert.", false).option("--revert", "Push cdkd state values back into AWS via provider.update for every drifted resource (AWS ← state). Mutually exclusive with --accept.", false).option("--dry-run", "Print the planned mutations without acquiring a lock or hitting AWS / S3. Honored by --accept and --revert.", false).option("--concurrency <number>", "Maximum concurrent provider.update calls during --revert", (value) => parseInt(value, 10), 4).addOption(stackRegionOption$2()).action(withErrorHandling(driftCommand));
10014
10010
  [...commonOptions, ...stateOptions].forEach((opt) => cmd.addOption(opt));
10015
10011
  cmd.addOption(deprecatedRegionOption);
10016
10012
  return cmd;
@@ -10744,7 +10740,7 @@ async function purgeEventsAfterDestroy(reader, stackName, region, opts, logger)
10744
10740
  if (opts.purgeEvents !== true || opts.runResult !== "SUCCEEDED" || opts.interrupted) return null;
10745
10741
  try {
10746
10742
  const purge = await reader.pruneRuns(stackName, region, { all: true });
10747
- if (purge.deletedRunIds.length > 0 || purge.indexDeleted) logger.info(` Purged deployment-event history for ${displaySafe(stackName)} (${displaySafe(region)}). Where the state bucket is versioned — which bootstrapping with cdkd enables — earlier versions of those keys survive and stay readable with GetObject and a VersionId.`);
10743
+ if (purge.deletedRunIds.length > 0 || purge.indexDeleted) logger.info(` Purged deployment-event history for ${displaySafe(stackName)} (${displaySafe(region)}) and the earlier versions of the deleted keys, unless a warning above says otherwise.`);
10748
10744
  return purge;
10749
10745
  } catch (purgeError) {
10750
10746
  logger.warn(` Failed to purge deployment-event history for ${displaySafe(stackName)}: ${displaySafe(purgeError instanceof Error ? purgeError.message : String(purgeError))}`);
@@ -11083,7 +11079,7 @@ async function destroyCommand(stackArgs, options) {
11083
11079
  }
11084
11080
  }
11085
11081
  function createDestroyCommand() {
11086
- const cmd = new Command("destroy").description("Destroy all resources in the stack").argument("[stacks...]", "Stack name(s) to destroy. Accepts CDK display paths (e.g. 'MyStage/Api') with wildcards ('MyStage/*', '**'), or exact physical CloudFormation names (e.g. 'MyStage-Api').").option("--all", "Destroy every top-level stack (top-level only; Stage stacks: '**')", false).option("--purge-events", `After a clean destroy, also delete the stack's deployment-event history (issue #808 store) so an object listing of the state bucket comes back empty. Where the state bucket is versioned — which bootstrapping with cdkd enables — earlier versions of those keys survive and stay readable with GetObject and a VersionId. By default events survive destroy as post-mortem context. Skipped when the destroy fails or is interrupted (those events aid the retry). Equivalent for an already-destroyed stack: cdkd events prune ${commandHole("stack")} --all.`, false).action(withErrorHandling(destroyCommand));
11082
+ const cmd = new Command("destroy").description("Destroy all resources in the stack").argument("[stacks...]", "Stack name(s) to destroy. Accepts CDK display paths (e.g. 'MyStage/Api') with wildcards ('MyStage/*', '**'), or exact physical CloudFormation names (e.g. 'MyStage-Api').").option("--all", "Destroy every top-level stack (top-level only; Stage stacks: '**')", false).option("--purge-events", `After a clean destroy, also delete the stack's deployment-event history (issue #808 store), purging the earlier versions of those keys on a versioned state bucket too unless a warning says otherwise. By default events survive destroy as post-mortem context. Skipped when the destroy fails or is interrupted (those events aid the retry). Equivalent for an already-destroyed stack: cdkd events prune ${commandHole("stack")} --all.`, false).action(withErrorHandling(destroyCommand));
11087
11083
  [
11088
11084
  ...commonOptions,
11089
11085
  ...appOptions,
@@ -15700,6 +15696,12 @@ function actionLabel(item, skipFinalSnapshot) {
15700
15696
  case "skip-already-done": return ` - skip ${safe(op.logicalId)} (${safe(op.resourceType)}) — already reverted`;
15701
15697
  }
15702
15698
  }
15699
+ function importedOpLabel(op) {
15700
+ return ` - skip ${logicalIdShown(op.logicalId)} (${resourceTypeShown(op.resourceType)}) — adopted by cdkd import after this deploy, left as it is`;
15701
+ }
15702
+ function displacedOpLabel(op, segment) {
15703
+ return ` - skip ${logicalIdShown(op.logicalId)} (${resourceTypeShown(op.resourceType)}) — ${displacedOpClause(op, segment.importedResources ?? [], getLogger())}; not reverted, check that resource by hand`;
15704
+ }
15703
15705
  function failedActionLabel(item, skipFinalSnapshot) {
15704
15706
  const { op, action } = item;
15705
15707
  switch (action) {
@@ -15709,6 +15711,7 @@ function failedActionLabel(item, skipFinalSnapshot) {
15709
15711
  case "orphan-failed-create-retain": return ` - orphan ${safe(op.logicalId)} (${safe(op.resourceType)}) [FAILED create, DeletionPolicy Retain — left in AWS]`;
15710
15712
  case "skip-failed-unknown": return ` - skip ${safe(op.logicalId)} (${safe(op.resourceType)}) — failed CREATE recorded no physical id`;
15711
15713
  case "skip-failed-noop": return ` - skip ${safe(op.logicalId)} (${safe(op.resourceType)}) — failed ${safe(op.changeType)} left nothing to revert`;
15714
+ case "skip-failed-mismatch": return ` - skip ${logicalIdShown(op.logicalId)} (${resourceTypeShown(op.resourceType)}) — failed CREATE recorded ${displacedPhysicalIdShown(op, getLogger()) ?? "a physical id"}, which is not the resource state tracks under this id; not reverted, needs manual attention`;
15712
15715
  case "skip-failed-absent": return ` - skip ${safe(op.logicalId)} (${safe(op.resourceType)}) — no previous state available`;
15713
15716
  case "skip-failed-type-change": return ` - skip ${safe(op.logicalId)} (from ${safe(op.previousState?.resourceType)} to ${safe(op.resourceType)}) — failed Type change is a replacement, no in-place revert exists`;
15714
15717
  }
@@ -15792,9 +15795,12 @@ async function rollbackCommand(stackArg, options) {
15792
15795
  };
15793
15796
  if (!journal || journal.segments.length === 0 && orphanedPending === 0) throw new Error(`Nothing to roll back for ${plainOrDescribed(stackName, "stack name")} (${plainOrDescribed(region, "region")}). Run 'cdkd deploy' to (re)deploy, or 'cdkd destroy' to clean up.`);
15794
15797
  if (!stateData) throw new Error(`Rollback journal exists for ${safeStack(stackName)} (${safe(region)}) but its state.json is missing (keys: ${safe(setup.prefix)}/${safeStack(stackName)}/${safe(region)}/state.json and .../rollback-journal.json). State appears corrupted — inspect the bucket manually.`);
15795
- if (!options.revertFailed) for (const segment of journal.segments) for (const logicalId of revertedNestedRowIds(segment.failedOperations ?? [])) {
15796
- const child = nestedChildStackName(stackName, logicalId);
15797
- if (((await setup.stateBackend.loadRollbackJournal(child, region).catch(() => null))?.segments ?? []).some((s) => s.runId === segment.runId && s.reason !== "nested-pending-parent" && s.operations.length > 0)) throw new Error(`Nested stack ${plainOrDescribed(child, "nested stack name")} failed during a deploy this journal records, and its own journal still holds that deploy's completed operations. Re-run with --revert-failed so they are reverted in order with the parent's.`);
15798
+ if (!options.revertFailed) for (const segment of journal.segments) {
15799
+ const failedRows = splitImportedOps(segment.failedOperations ?? [], segment).replay;
15800
+ for (const logicalId of revertedNestedRowIds(failedRows)) {
15801
+ const child = nestedChildStackName$1(stackName, logicalId);
15802
+ if (((await setup.stateBackend.loadRollbackJournal(child, region).catch(() => null))?.segments ?? []).some((s) => s.runId === segment.runId && s.reason !== "nested-pending-parent" && splitImportedOps(s.operations, s).replay.length > 0)) throw new Error(`Nested stack ${plainOrDescribed(child, "nested stack name")} failed during a deploy this journal records, and its own journal still holds that deploy's completed operations. Re-run with --revert-failed so they are reverted in order with the parent's.`);
15803
+ }
15798
15804
  }
15799
15805
  const baseState = stateData.state;
15800
15806
  const refusalRecovery = {
@@ -15827,20 +15833,24 @@ async function rollbackCommand(stackArg, options) {
15827
15833
  for (let s = journal.segments.length - 1; s >= 0; s--) {
15828
15834
  const segment = journal.segments[s];
15829
15835
  logger.info(`\n Segment ${s + 1}/${journal.segments.length} (${safe(segment.reason)}${segment.runId ? `, run ${safe(segment.runId)}` : ""}):`);
15830
- if (segment.failedOperations && segment.failedOperations.length > 0) {
15836
+ const failedOps = splitImportedOps(segment.failedOperations ?? [], segment);
15837
+ const completedOps = splitImportedOps(segment.operations, segment, orphanLogicalIds);
15838
+ for (const op of [...failedOps.imported, ...completedOps.imported]) logger.info(importedOpLabel(op));
15839
+ for (const op of [...failedOps.displaced, ...completedOps.displaced]) logger.info(displacedOpLabel(op, segment));
15840
+ if (failedOps.replay.length > 0) {
15831
15841
  if (options.revertFailed) {
15832
- const failedPlan = planFailedOps(segment.failedOperations, planStateView);
15842
+ const failedPlan = planFailedOps(failedOps.replay, planStateView);
15833
15843
  for (const item of failedPlan) {
15834
15844
  logger.info(failedActionLabel(item, options.skipFinalSnapshot === true));
15835
- if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
15845
+ if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName$1(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
15836
15846
  }
15837
15847
  applyFailedPlanToPreview(failedPlan, planStateView, options.skipFinalSnapshot === true);
15838
- } else for (const fop of segment.failedOperations) logger.info(` - (left as-is) ${logicalIdShown(fop.logicalId)} (${resourceTypeShown(fop.resourceType)}) — its ${plainOrDescribed(fop.changeType, "change type")} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
15848
+ } else for (const fop of failedOps.replay) logger.info(` - (left as-is) ${logicalIdShown(fop.logicalId)} (${resourceTypeShown(fop.resourceType)}) — its ${plainOrDescribed(fop.changeType, "change type")} FAILED mid-deploy; pass --revert-failed to attempt reverting it`);
15839
15849
  }
15840
- const plan = planRollback(segment.operations, planStateView, orphanLogicalIds);
15850
+ const plan = planRollback(completedOps.replay, planStateView, orphanLogicalIds);
15841
15851
  for (const item of plan) {
15842
15852
  logger.info(actionLabel(item, options.skipFinalSnapshot === true));
15843
- if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
15853
+ if (revertedNestedRowIds([item.op]).length > 0) for (const line of await previewNestedChildRevert(setup.stateBackend, nestedChildStackName$1(stackName, item.op.logicalId), region, segment.runId, options.skipFinalSnapshot === true)) logger.info(line);
15844
15854
  }
15845
15855
  applyPlanToPreview(plan, planStateView, options.skipFinalSnapshot === true);
15846
15856
  }
@@ -15911,6 +15921,11 @@ async function rollbackCommand(stackArg, options) {
15911
15921
  while (journal.segments.length > 0) {
15912
15922
  if (interrupted) break;
15913
15923
  const segment = journal.segments[journal.segments.length - 1];
15924
+ const completedSplit = splitImportedOps(segment.operations, segment, orphanLogicalIds);
15925
+ const completedOps = completedSplit.replay;
15926
+ const displaced = [...completedSplit.displaced, ...splitImportedOps(segment.failedOperations ?? [], segment).displaced];
15927
+ for (const op of displaced) logger.warn(displacedOpLabel(op, segment).trim());
15928
+ recordDisplacedSkips(ctx.recordEvent, stackName, displaced);
15914
15929
  let nestedRun;
15915
15930
  const result = await withNestedStackContext({
15916
15931
  stateBackend: setup.stateBackend,
@@ -15932,18 +15947,23 @@ async function rollbackCommand(stackArg, options) {
15932
15947
  return inSegmentScope(segment, async () => {
15933
15948
  let failedOpFailures = 0;
15934
15949
  let failedOpWarnings = 0;
15935
- if (options.revertFailed && segment.failedOperations && segment.failedOperations.length > 0) {
15936
- const failedResult = await replayFailedOperations(segment.failedOperations, stateResources, stackName, ctx, {
15950
+ const failedOps = splitImportedOps(segment.failedOperations ?? [], segment);
15951
+ if (options.revertFailed && failedOps.replay.length > 0) {
15952
+ const failedResult = await replayFailedOperations(failedOps.replay, stateResources, stackName, ctx, {
15937
15953
  afterOp: saveState,
15938
15954
  isInterrupted: () => interrupted,
15939
- emitEnvelope: segment.operations.length === 0,
15955
+ emitEnvelope: completedOps.length === 0,
15940
15956
  onOrphan: (record) => mintedOrphans.push(record),
15941
15957
  inlinePolicyWriters
15942
15958
  });
15943
15959
  failedOpFailures = failedResult.failures;
15944
15960
  failedOpWarnings = failedResult.warnings;
15945
- const remaining = failedResult.remainingFailedOps;
15946
- if (!declinedDivergentRewrite && remaining.length !== segment.failedOperations.length) try {
15961
+ const remaining = [
15962
+ ...failedOps.imported,
15963
+ ...failedOps.displaced,
15964
+ ...failedResult.remainingFailedOps
15965
+ ];
15966
+ if (!declinedDivergentRewrite && remaining.length !== (segment.failedOperations ?? []).length) try {
15947
15967
  await setup.stateBackend.setRollbackJournalFailedOperations(stackName, region, remaining);
15948
15968
  if (remaining.length === 0) delete segment.failedOperations;
15949
15969
  else segment.failedOperations = remaining;
@@ -15956,7 +15976,7 @@ async function rollbackCommand(stackArg, options) {
15956
15976
  interrupted: true
15957
15977
  };
15958
15978
  }
15959
- const replayResult = await replayRollback(segment.operations, stateResources, stackName, ctx, {
15979
+ const replayResult = await replayRollback(completedOps, stateResources, stackName, ctx, {
15960
15980
  orphanLogicalIds,
15961
15981
  afterOp: saveState,
15962
15982
  isInterrupted: () => interrupted,
@@ -15971,7 +15991,7 @@ async function rollbackCommand(stackArg, options) {
15971
15991
  });
15972
15992
  }));
15973
15993
  totalFailures += result.failures;
15974
- totalWarnings += result.warnings + (nestedRun?.warnings ?? 0);
15994
+ totalWarnings += result.warnings + (nestedRun?.warnings ?? 0) + displaced.length;
15975
15995
  if (declinedDivergentRewrite) break;
15976
15996
  if (result.interrupted) {
15977
15997
  interrupted = true;
@@ -16060,7 +16080,10 @@ async function previewNestedChildRevert(backend, childStackName, region, runId,
16060
16080
  const view = { ...childState.state.resources };
16061
16081
  const lines = [` ${shown} replays its own journal:`];
16062
16082
  for (let s = segments.length - 1; s >= 0; s--) {
16063
- const childPlan = planRollback(segments[s].operations, view, /* @__PURE__ */ new Set());
16083
+ const childOps = splitImportedOps(segments[s].operations, segments[s]);
16084
+ for (const op of childOps.imported) lines.push(` ${importedOpLabel(op)}`);
16085
+ for (const op of childOps.displaced) lines.push(` ${displacedOpLabel(op, segments[s])}`);
16086
+ const childPlan = planRollback(childOps.replay, view, /* @__PURE__ */ new Set());
16064
16087
  for (const item of childPlan) lines.push(` ${actionLabel(item, skipFinalSnapshot)}`);
16065
16088
  applyPlanToPreview(childPlan, view, skipFinalSnapshot);
16066
16089
  }
@@ -16138,7 +16161,7 @@ const runListToken = (value, fallback) => {
16138
16161
  };
16139
16162
  const safeText = (value) => displaySafe(value);
16140
16163
  const safeCount = (value) => typeof value === "number" ? String(value) : "?";
16141
- const NONCURRENT_VERSIONS_SURVIVE_NOTE = " Where the state bucket is versioned — which bootstrapping with cdkd enables — earlier versions of the deleted keys survive and stay readable with GetObject and a VersionId; prune does not purge them.";
16164
+ const EARLIER_VERSIONS_PURGED_NOTE = " Earlier versions of the deleted keys were purged as well, unless a warning above says otherwise.";
16142
16165
  async function eventsCommand(stackName, options) {
16143
16166
  const logger = getLogger();
16144
16167
  if (options.verbose) logger.setLevel("debug");
@@ -16253,10 +16276,10 @@ async function eventsPruneCommand(stackName, options) {
16253
16276
  ...olderThanMs !== void 0 && { olderThanMs }
16254
16277
  });
16255
16278
  if (result.deletedRunIds.length === 0) {
16256
- logger.info(gray(result.indexDeleted ? `Removed the empty deployment-event index for ${safeStack} (${safeRegion}); no run streams to delete. Where the state bucket is versioned — which bootstrapping with cdkd enables — earlier versions of the deleted keys survive and stay readable with GetObject and a VersionId; prune does not purge them.` : `No runs matched the prune criteria for ${safeStack} (${safeRegion}).`));
16279
+ logger.info(gray(result.indexDeleted ? `Removed the empty deployment-event index for ${safeStack} (${safeRegion}); no run streams to delete. Earlier versions of the deleted keys were purged as well, unless a warning above says otherwise.` : `No runs matched the prune criteria for ${safeStack} (${safeRegion}).`));
16257
16280
  return;
16258
16281
  }
16259
- logger.info(`${green("Pruned")} ${result.deletedRunIds.length} deployment-event run(s) for ${cyan(safeStack)} ${gray(`(${safeRegion})`)}; ${result.remainingRunIds.length} retained` + (result.indexDeleted ? gray(" (index removed)") : "") + "." + gray(NONCURRENT_VERSIONS_SURVIVE_NOTE));
16282
+ logger.info(`${green("Pruned")} ${result.deletedRunIds.length} deployment-event run(s) for ${cyan(safeStack)} ${gray(`(${safeRegion})`)}; ${result.remainingRunIds.length} retained` + (result.indexDeleted ? gray(" (index removed)") : "") + "." + gray(EARLIER_VERSIONS_PURGED_NOTE));
16260
16283
  } finally {
16261
16284
  awsClients.destroy();
16262
16285
  }
@@ -16353,7 +16376,7 @@ function createEventsCommand() {
16353
16376
  return cmd;
16354
16377
  }
16355
16378
  function createEventsPruneCommand() {
16356
- return new Command("prune").description("Delete old per-run deployment-event streams. On a versioned state bucket this clears the object listing; earlier versions of the deleted keys survive and are not purged.").argument("<stack>", "Stack name (physical CloudFormation name)").addOption(new Option("--keep <N>", "Retain only the newest N runs").argParser((v) => {
16379
+ return new Command("prune").description("Delete old per-run deployment-event streams. On a versioned state bucket the earlier versions of the deleted keys are purged too, unless a warning says otherwise.").argument("<stack>", "Stack name (physical CloudFormation name)").addOption(new Option("--keep <N>", "Retain only the newest N runs").argParser((v) => {
16357
16380
  const n = parseInt(v, 10);
16358
16381
  if (!Number.isInteger(n) || n < 0) throw new Error(`Invalid --keep value ${v === "" ? "\"\"" : displayIdent(v)}: expected a non-negative integer.`);
16359
16382
  return n;
@@ -18114,6 +18137,7 @@ async function importCommand(stackArg, options) {
18114
18137
  const saveOptions = {};
18115
18138
  if (existingEtag) saveOptions.expectedEtag = existingEtag;
18116
18139
  if (migrationPending) saveOptions.migrateLegacy = true;
18140
+ await recordImportOnRollbackJournal(stateBackend, stackInfo.stackName, targetRegion, importedRows.map((r) => r.logicalId), stackState.resources, logger);
18117
18141
  await stateBackend.saveState(stackInfo.stackName, targetRegion, stackState, saveOptions);
18118
18142
  logger.info(`✓ State written: ${stackInfo.stackName} (${targetRegion})`);
18119
18143
  logger.info(` ${importedRows.length} resource(s) imported. Run 'cdkd diff' to see how the imported state lines up with the template.`);
@@ -18157,6 +18181,25 @@ async function importCommand(stackArg, options) {
18157
18181
  function stackShown(stackName) {
18158
18182
  return isPasteableIdent(stackName) ? `stack '${stackName}'` : "a stack whose name is not a plain identifier";
18159
18183
  }
18184
+ async function recordImportOnRollbackJournal(stateBackend, stackName, region, logicalIds, resources, logger) {
18185
+ const marks = logicalIds.flatMap((logicalId) => {
18186
+ const record = hasOwnKey(resources, logicalId) ? resources[logicalId] : void 0;
18187
+ const physicalId = record?.physicalId;
18188
+ const resourceType = record?.resourceType;
18189
+ return typeof physicalId === "string" && physicalId !== "" && typeof resourceType === "string" && resourceType !== "" ? [{
18190
+ logicalId,
18191
+ physicalId,
18192
+ resourceType
18193
+ }] : [];
18194
+ });
18195
+ let marked;
18196
+ try {
18197
+ marked = await stateBackend.markRollbackJournalImported(stackName, region, marks);
18198
+ } catch (error) {
18199
+ throw new Error(`Could not record this import on the rollback journal of ${stackShown(stackName)}, so state was NOT written: a later cdkd rollback could otherwise delete what was imported. Cause: ${displaySafe(error instanceof Error ? error.message : String(error))}`);
18200
+ }
18201
+ if (marked.length > 0) logger.info(safeMsg` The rollback journal of ${stackShown(stackName)} records ` + safeMsg`${marked.map((id) => logicalIdShown(id)).join(", ")} as imported: ` + "cdkd rollback leaves those resources as they are.");
18202
+ }
18160
18203
  function mergeCfnDerivedOverrides(params) {
18161
18204
  const { cfnMapping, template, templateLogicalIds, overrides } = params;
18162
18205
  const stats = {
@@ -18837,6 +18880,7 @@ async function importNestedStackChildrenRecursive(args) {
18837
18880
  childStackState.parentRegion = parentRegion;
18838
18881
  const childDeployedParameters = namesAnyDeclaredParameter(childStateTemplate) ? await readDeployedParameters(childTreeNode.stackName, args.cfnClient, logger, displaySafe(childStackName)) : void 0;
18839
18882
  await captureObservedForImportedResources(childStackState, providerRegistry, logger, await withSharedDrainBudget(() => resolveImportedProperties(childStackState, childStateTemplate, childRegion, stateBackend, logger, childDeployedParameters)), rebuiltLogicalIdsFrom(rows, childTemplate));
18883
+ await recordImportOnRollbackJournal(stateBackend, childStackName, childRegion, rows.filter((r) => r.outcome === "imported").map((r) => r.logicalId), childStackState.resources, logger);
18840
18884
  await stateBackend.saveState(childStackName, childRegion, childStackState);
18841
18885
  logger.info(`✓ Nested stack state written: ${childStackName} (${childRegion}) — ${rows.filter((r) => r.outcome === "imported").length} resource(s) imported.`);
18842
18886
  if (childTreeNode.nested.size > 0) await importNestedStackChildrenRecursive({
@@ -26092,5 +26136,5 @@ function collectVerbFlags(program) {
26092
26136
  }
26093
26137
 
26094
26138
  //#endregion
26095
- export { canonicalizeIpProtocolValue as a, buildProgram, isAbsoluteAssetPath as c, resolveSecretDerivedPrincipals as i, listNestedTemplateRows as l, runDestroyForStack as n, resolvedResourceTimeoutMs as o, isResolvableSecretPrincipalList as r, findNestedTemplateTreeDefect as s, canonicalizeIpv4Cidr as t, renderNestedTemplateTreeDefect as u };
26096
- //# sourceMappingURL=program-Eed63bId.js.map
26139
+ export { canonicalizeIpProtocolValue as a, buildProgram, resolveSecretDerivedPrincipals as i, runDestroyForStack as n, resolvedResourceTimeoutMs as o, isResolvableSecretPrincipalList as r, canonicalizeIpv4Cidr as t };
26140
+ //# sourceMappingURL=program-dQFaGjL1.js.map