@cdkd/cli 0.358.7 → 0.359.0

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.
Files changed (58) hide show
  1. package/dist/{ambient-client-defaults-DvXDYfs8.js → ambient-client-defaults-BNqC0q-Z.js} +3 -3
  2. package/dist/{ambient-client-defaults-DvXDYfs8.js.map → ambient-client-defaults-BNqC0q-Z.js.map} +1 -1
  3. package/dist/{asg-provider-BReZap7O.js → asg-provider-BDCUGWZV.js} +6 -6
  4. package/dist/{asg-provider-BReZap7O.js.map → asg-provider-BDCUGWZV.js.map} +1 -1
  5. package/dist/cli.js +3 -3
  6. package/dist/{custom-resource-runtime-CpziCILQ.js → custom-resource-runtime-DMkX_oQo.js} +6 -6
  7. package/dist/{custom-resource-runtime-CpziCILQ.js.map → custom-resource-runtime-DMkX_oQo.js.map} +1 -1
  8. package/dist/{db-associated-roles-DTMCw2Ka.js → db-associated-roles-Bx5ML-MI.js} +2 -2
  9. package/dist/{db-associated-roles-DTMCw2Ka.js.map → db-associated-roles-Bx5ML-MI.js.map} +1 -1
  10. package/dist/{delete-started-DNc0CPAc.js → delete-started-V5NHQ1O-.js} +4 -4
  11. package/dist/{delete-started-DNc0CPAc.js.map → delete-started-V5NHQ1O-.js.map} +1 -1
  12. package/dist/{deploy-engine-Db00WvIx.js → deploy-engine-BjSv27_M.js} +2025 -859
  13. package/dist/deploy-engine-BjSv27_M.js.map +1 -0
  14. package/dist/{ec2-termination-protection-Gf-1-VVU.js → ec2-termination-protection-hc3MeuqF.js} +11 -7
  15. package/dist/ec2-termination-protection-hc3MeuqF.js.map +1 -0
  16. package/dist/{ecr-uri-zC_A2VLB.js → ecr-uri-D1ijxg7D.js} +2 -2
  17. package/dist/{ecr-uri-zC_A2VLB.js.map → ecr-uri-D1ijxg7D.js.map} +1 -1
  18. package/dist/{expected-bucket-owner-Am4J3ano.js → expected-bucket-owner-CQimj8gv.js} +2 -2
  19. package/dist/{expected-bucket-owner-Am4J3ano.js.map → expected-bucket-owner-CQimj8gv.js.map} +1 -1
  20. package/dist/{iam-role-provider-BisBYgT3.js → iam-role-provider-b46RdZD5.js} +27 -13
  21. package/dist/iam-role-provider-b46RdZD5.js.map +1 -0
  22. package/dist/{image-plan-CNMyGwzi.js → image-plan-DtFbiJj5.js} +8 -8
  23. package/dist/{image-plan-CNMyGwzi.js.map → image-plan-DtFbiJj5.js.map} +1 -1
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +5 -5
  27. package/dist/{logger-BZmINj0f.js → logger-CqKPJ_tV.js} +2 -2
  28. package/dist/{logger-BZmINj0f.js.map → logger-CqKPJ_tV.js.map} +1 -1
  29. package/dist/{neptune-provider-DM4GhUTb.js → neptune-provider-DiyWADaS.js} +7 -7
  30. package/dist/{neptune-provider-DM4GhUTb.js.map → neptune-provider-DiyWADaS.js.map} +1 -1
  31. package/dist/{program-CCtcOCaP.js → program-Cdwgr3Yv.js} +626 -40
  32. package/dist/program-Cdwgr3Yv.js.map +1 -0
  33. package/dist/{provider-classes-CgZzBNg8.js → provider-classes-DhmwW7hI.js} +465 -391
  34. package/dist/provider-classes-DhmwW7hI.js.map +1 -0
  35. package/dist/{rds-provider-Cef0DBFH.js → rds-provider-DpOZv_UG.js} +10 -10
  36. package/dist/{rds-provider-Cef0DBFH.js.map → rds-provider-DpOZv_UG.js.map} +1 -1
  37. package/dist/{read-replica-DCjUkLOl.js → read-replica-Ct0oakPU.js} +3 -3
  38. package/dist/{read-replica-DCjUkLOl.js.map → read-replica-Ct0oakPU.js.map} +1 -1
  39. package/dist/{replacement-rules-iQkausbv.js → replacement-rules-CMnMy7rf.js} +3 -3
  40. package/dist/{replacement-rules-iQkausbv.js.map → replacement-rules-CMnMy7rf.js.map} +1 -1
  41. package/dist/{resource-deadline-6tnCx6Yj.js → resource-deadline-DlZTHrBj.js} +123 -122
  42. package/dist/resource-deadline-DlZTHrBj.js.map +1 -0
  43. package/dist/{restore-source-guard-Dj_CS7r6.js → restore-source-guard-DIs6rqZm.js} +4 -4
  44. package/dist/{restore-source-guard-Dj_CS7r6.js.map → restore-source-guard-DIs6rqZm.js.map} +1 -1
  45. package/dist/{run-cli-Db8hPv4V.js → run-cli-BLZnjA32.js} +2 -2
  46. package/dist/{run-cli-Db8hPv4V.js.map → run-cli-BLZnjA32.js.map} +1 -1
  47. package/dist/{settle-own-write-members-CXG2uUvJ.js → settle-own-write-members-C1uPhq2z.js} +49 -304
  48. package/dist/settle-own-write-members-C1uPhq2z.js.map +1 -0
  49. package/dist/{version-DSeV-Tyv.js → version-DyE_oClc.js} +2 -2
  50. package/dist/{version-DSeV-Tyv.js.map → version-DyE_oClc.js.map} +1 -1
  51. package/package.json +1 -1
  52. package/dist/deploy-engine-Db00WvIx.js.map +0 -1
  53. package/dist/ec2-termination-protection-Gf-1-VVU.js.map +0 -1
  54. package/dist/iam-role-provider-BisBYgT3.js.map +0 -1
  55. package/dist/program-CCtcOCaP.js.map +0 -1
  56. package/dist/provider-classes-CgZzBNg8.js.map +0 -1
  57. package/dist/resource-deadline-6tnCx6Yj.js.map +0 -1
  58. package/dist/settle-own-write-members-CXG2uUvJ.js.map +0 -1
@@ -1,15 +1,15 @@
1
- import { A as displayStackName, C as STACK_REF_MAX_CODE_POINTS, D as displayAwsMessage, I as terminalSafe, L as truncateCodePoints, N as plainIdentOr, O as displayIdent, P as safeMsg, S as SECRET_REF_MAX_CODE_POINTS, T as asIsMessage, _ as shellQuote, a as UNSHOWABLE_VALUE, c as deployReplaceCommand, d as pasteableCommand, f as physicalIdShownBesideCommand, g as shellBoundedDisplay, h as quotedOrDescribed, i as SHELL_ACTIVE_WHY, j as isPasteableIdent, k as displaySafe, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, s as commandHole, t as getCdkdVersion, u as isInertUnquoted, v as withheldTargetClause, w as UNRENDERABLE } from "./version-DSeV-Tyv.js";
2
- import { $ as withStackScope, A as configStringRefusal, C as fallbackNamePropertyFor, D as coerceCfnInteger, E as coerceCfnBoolean, F as requireConfigString, G as currentNameGeneration, H as looksLikeCdkdGeneratedName, J as getCurrentStackName, K as getCurrentSkipPrefix, M as replayWarn, O as configBooleanRefusal, P as requireConfigObject, Q as withSkipPrefix, S as explicitNamePropertyFor, T as withoutGeneratedFallbackName, V as generateResourceNameWithFallback, W as stackInstanceNameSuffix, X as isNameGeneration, Z as withNameGeneration, _ as currentLogLineMasker, b as alternateNamePropertiesFor, c as VERBOSE_POINTER, et as withStackScopeBeforeStateRead, g as verbosePointerTail, h as verbosePointerSentence, j as readConfigString, k as configIntegerRefusal, m as verboseAwareText, n as getLogger, p as safeStringify, q as getCurrentStackInstanceId, u as describeAwsFailure, v as installLogLineMaskerSource, w as generatedNameFor, x as applyDefaultNameForFallback, y as getLiveRenderer } from "./logger-BZmINj0f.js";
3
- import { A as stripControlChars, C as isNameCooldownError, F as isAmbiguousOutcomeError, G as markRedactedCause, H as isMarkedNonRetryable, J as DynamicReferenceRegionAmbiguousError, K as wrapMaskedAwsError, L as isIamPropagationError, O as relayedNameCollision, P as isAmbiguousCcHandlerErrorCode, Q as AccountIdUnavailableError, R as isRetryableTransientError, S as isNameCollisionErrorFrom, T as isReplayedNameCollisionFrom, U as isThrottlingError, W as markNonRetryable, X as MalformedProducerRecordRefusalError, Y as IntrinsicResolutionRefusalError, Z as SelectOutOfBoundsRefusalError, _ as ResourceUpdateNotSupportedError, a as normalizeAwsError, at as ProvisioningError, b as isUpdateUnsupportedError, et as CdkdError, i as credentialFingerprint, k as escapeRegExp$1, m as ExportInUseError, n as ambientCredentialConfig, nt as DeploymentNotApprovedError, ot as ResourceTimeoutError, q as CrossAccountSecretRefusalError, r as clientDefaultsFor, st as StateError, t as ambientClientDefaults, w as isRecreateRetryableError, z as isTransientServerError } from "./ambient-client-defaults-DvXDYfs8.js";
1
+ import { A as displayStackName, C as STACK_REF_MAX_CODE_POINTS, D as displayAwsMessage, I as terminalSafe, L as truncateCodePoints, N as plainIdentOr, O as displayIdent, P as safeMsg, S as SECRET_REF_MAX_CODE_POINTS, T as asIsMessage, _ as shellQuote, a as UNSHOWABLE_VALUE, c as deployReplaceCommand, d as pasteableCommand, f as physicalIdShownBesideCommand, g as shellBoundedDisplay, h as quotedOrDescribed, i as SHELL_ACTIVE_WHY, j as isPasteableIdent, k as displaySafe, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, s as commandHole, t as getCdkdVersion, u as isInertUnquoted, v as withheldTargetClause, w as UNRENDERABLE } from "./version-DyE_oClc.js";
2
+ import { $ as withStackScope, A as configStringRefusal, C as fallbackNamePropertyFor, D as coerceCfnInteger, E as coerceCfnBoolean, F as requireConfigString, G as currentNameGeneration, H as looksLikeCdkdGeneratedName, J as getCurrentStackName, K as getCurrentSkipPrefix, M as replayWarn, O as configBooleanRefusal, P as requireConfigObject, Q as withSkipPrefix, S as explicitNamePropertyFor, T as withoutGeneratedFallbackName, V as generateResourceNameWithFallback, W as stackInstanceNameSuffix, X as isNameGeneration, Z as withNameGeneration, _ as currentLogLineMasker, b as alternateNamePropertiesFor, c as VERBOSE_POINTER, et as withStackScopeBeforeStateRead, g as verbosePointerTail, h as verbosePointerSentence, j as readConfigString, k as configIntegerRefusal, m as verboseAwareText, n as getLogger, p as safeStringify, q as getCurrentStackInstanceId, u as describeAwsFailure, v as installLogLineMaskerSource, w as generatedNameFor, x as applyDefaultNameForFallback, y as getLiveRenderer } from "./logger-CqKPJ_tV.js";
3
+ import { A as stripControlChars, C as isNameCooldownError, F as isAmbiguousOutcomeError, G as markRedactedCause, H as isMarkedNonRetryable, J as DynamicReferenceRegionAmbiguousError, K as wrapMaskedAwsError, L as isIamPropagationError, O as relayedNameCollision, P as isAmbiguousCcHandlerErrorCode, Q as AccountIdUnavailableError, R as isRetryableTransientError, S as isNameCollisionErrorFrom, T as isReplayedNameCollisionFrom, U as isThrottlingError, W as markNonRetryable, X as MalformedProducerRecordRefusalError, Y as IntrinsicResolutionRefusalError, Z as SelectOutOfBoundsRefusalError, _ as ResourceUpdateNotSupportedError, a as normalizeAwsError, at as ProvisioningError, b as isUpdateUnsupportedError, et as CdkdError, i as credentialFingerprint, k as escapeRegExp$1, m as ExportInUseError, n as ambientCredentialConfig, nt as DeploymentNotApprovedError, ot as ResourceTimeoutError, q as CrossAccountSecretRefusalError, r as clientDefaultsFor, st as StateError, t as ambientClientDefaults, w as isRecreateRetryableError, z as isTransientServerError } from "./ambient-client-defaults-BNqC0q-Z.js";
4
4
  import { a as getAssumedRoleCredentials, c as setAssumedRoleCredentials, d as quietS3Logger, f as ambientRegion, i as awsEndpointOverrideUrl, n as awsClientDefaults, o as getPreAssumeEnvCredentials, r as awsEndpointOverrideActive, t as SECOND_ROLE_PUBLISH_REFUSAL, u as setPreAssumeEnvCredentials } from "./aws-client-defaults-DAebi99J.js";
5
5
  import { l as s3ClientDefaults, r as getAwsClients } from "./aws-clients-DOkPjjAW.js";
6
- import { A as withRetry, B as phaseTimingsEnabled, C as templateResourceTypes, D as isAwsEmulatorRegistryMiss, E as hasNoRegistrySchema, F as ignoresUnmodifiedGroupSize, G as describeJsonParseFailure, I as rollingUpdatePolicy, J as parseJsonNamingNoBody, K as jsonParseFailureStandIn, L as willReplaceGroup, M as INSTANCE_REFRESH_TRIGGER_PROPERTIES, N as REPLACEMENT_TRIGGER_PROPERTIES, O as reportAwsEmulatorRegistryMiss, R as PhaseClock, S as prefetchCreateOnlyPropertyPaths, T as describeTypeWithThrottleRetry, U as timePhase, V as recordPhase, W as timePhaseSync, Y as utf8ByteLength, _ as unchangedBehindSecretReference, a as reDisableInstanceApiTermination, b as getCreateOnlyPropertyPaths, d as markRefusedBeforeApplying, f as priorAttemptLookup, h as withPriorAttempts, i as observeThenDisableInstanceApiTermination, j as CREATE_ONLY_PATHS_SNAPSHOT, k as IAM_PROPAGATION_MAX_DELAY_MS, m as provenOrphanIdsInJournal, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, p as priorAttemptsInJournal, q as parseFailureDebugDetail, r as isTerminationProtectionPropagationError, s as resolvedResourceTimeoutMs, u as isRefusedBeforeApplying, v as cachedCreateOnlyPropertyPaths, w as parseCreateOnlyPropertyPointers, x as isIntrinsicShaped, z as phaseScopeForStack } from "./ec2-termination-protection-Gf-1-VVU.js";
6
+ import { A as IAM_PROPAGATION_MAX_DELAY_MS, B as phaseScopeForStack, C as prefetchCreateOnlyPropertyPaths, D as hasNoRegistrySchema, E as describeTypeWithThrottleRetry, G as timePhaseSync, H as recordPhase, I as ignoresUnmodifiedGroupSize, J as parseFailureDebugDetail, K as describeJsonParseFailure, L as rollingUpdatePolicy, M as CREATE_ONLY_PATHS_SNAPSHOT, N as INSTANCE_REFRESH_TRIGGER_PROPERTIES, O as isAwsEmulatorRegistryMiss, P as REPLACEMENT_TRIGGER_PROPERTIES, R as willReplaceGroup, S as isIntrinsicShaped, T as parseCreateOnlyPropertyPointers, V as phaseTimingsEnabled, W as timePhase, X as utf8ByteLength, Y as parseJsonNamingNoBody, a as reDisableInstanceApiTermination, c as resolvedResourceTimeoutMs, d as isRefusedBeforeApplying, f as markRefusedBeforeApplying, g as withPriorAttempts, h as provenOrphanIdsInJournal, i as observeThenDisableInstanceApiTermination, j as withRetry, k as reportAwsEmulatorRegistryMiss, m as priorAttemptsInJournal, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, p as priorAttemptLookup, q as jsonParseFailureStandIn, r as isTerminationProtectionPropagationError, v as unchangedBehindSecretReference, w as templateResourceTypes, x as getCreateOnlyPropertyPaths, y as cachedCreateOnlyPropertyPaths, z as PhaseClock } from "./ec2-termination-protection-hc3MeuqF.js";
7
7
  import { i as sameRegion, n as canonicalizeRegion, r as derivePartitionAndUrlSuffix } from "./aws-partition-DA0r2sr-.js";
8
- import { $ as deleteWithProtectionCompensation, $t as markAuxiliaryFailure, At as canonicalizeRoute53QueryName, Bt as createMaskedRetryLogger, Ct as protectedReplacementAdvice, Gt as RETRY_AUXILIARY_OWNER, H as normalizeAwsTagsToCfn, Ht as maskDeep, I as withoutServerErrorRetries, It as resourceTypeShown, J as RESOURCE_NOT_FOUND, Jt as createdBeforeFailure, K as resolveExplicitPhysicalId, Lt as segmentAfterAnchor, Mt as compositeIdSeparatorRefusal, Ot as isInterruptedWaitError, Pt as logicalIdShown, Q as compensateProtectionFlip, Qt as isAuxiliaryMarkOf, Rt as stateOrphanRecordRemedy, St as pasteableAwsCommand, T as withUnchangedSecretPrincipalLists, U as quotedRemedyLogicalId, Ut as maskerOrIdentity, V as isQuotableImportValue, Vt as isSecretDerivedValue, W as refusalTypeShown, Wt as withDerivedNameMasks, X as isMarkedNotGone, Y as assertRegionMatch, Yt as createdResourceIdentityBeforeFailure, Z as markNotGone, Zt as isAuxiliaryFailure, _n as injectiveKey, _t as monotonicNowMs, bn as producerRecordKey, d as CreatedResourceSink, dn as sanitizeRecoveryValue, dt as ProtectionFlipRegistry, en as markCreatedBeforeFailure, f as clearCreatedReport, fn as CUSTOM_RESOURCE_RESPONSE_PREFIX, ft as isTerminalDeleteFailure, g as retractCreatedResource, gn as withPasteableAwsProfile, gt as ElapsedBudgetRegistry, ht as ElapsedBudget, i as withResourceDeadline, kt as startInterruptWatch, m as reportCreatedResource, mt as runDeleteAttempt, n as enclosingDeadlineRemainingMs, o as prepareRemovalForUpdate, p as collectCreatedResources, pn as DEFAULT_STATE_PREFIX, pt as protectionFlipKey, r as whileEnclosingDeadlinesPaused, s as removalWarning, t as enclosingDeadlineExpired, tt as observeThenDisableProtection, u as withoutInjectedRemovals, un as recoveryCommandFlags, vt as DELETION_PROTECTION_DOC_POINTER, zt as createMaskedLogSinks } from "./resource-deadline-6tnCx6Yj.js";
9
- import { t as expectedOwnerParam } from "./expected-bucket-owner-Am4J3ano.js";
10
- import { Ct as isReadableBag, Dt as skippedOutputsCarriedFrom, Et as shouldRetainResource, Ot as stackInstanceIdCarriedFrom, St as importableOutputs, Tt as orphansCarriedFrom, _t as acceptedCreateOnlyDropsOf, gt as slowCcOperationTimeoutMs, ht as dbInstanceAttributes, i as dbClusterAttributes, n as isRefusedByName, r as markDeleteStarted, t as isDeleteStarted, vt as describeRegionValueKind, wt as orphansAfterRollback, xt as importableOutputKeys, yt as exportNamesCarriedFrom } from "./delete-started-DNc0CPAc.js";
11
- import { $t as recordInheritedParameterValue, A as witnessNormalize, An as recordNoEchoAttributeValues, At as withoutPhysicalNameCopies, B as redactionClaimOf, Cn as noEchoParameterPlaintextsOf, Ct as withLegacyOverlapScan, D as recordedNoEchoValuesOf, Dn as recordFreshNoEchoValuesIn, Dt as replaceEmbeddedPhysicalNameRewrites, E as recordPassedNoEchoParameters, En as recordDerivedMaskOnlyValue, Et as repairPhysicalNameCopyLeaves, F as markLeafCertifiedBag, G as foldRecording, Gt as recordTakenIfBranch, H as mixedLiteralAnswered, Ht as splitOutsideDynamicReferences, I as markSameGenerationBag, In as isDynamicReferenceString, It as secretRerenderPairs, J as hasPassProvenance, Jt as templateRereadsAccountId, K as openRecordingScope, Kt as inheritedPseudoValue, L as mergeResolvedPairs, Ln as isSingleDynamicReferenceToken, M as carryRedactionMarks, Mn as recordProvenPublicExpression, Mt as DYNAMIC_REFERENCE_TOKEN_SCAN, N as intrinsicLeafResolutionOf, Nn as wholeStringLeavesOf, Nt as dynamicReferenceTokens, O as replaceAtCoordinates, Ot as scrubResourceRecord, P as isSameGenerationBag, Pn as withoutNoEchoParameterEntries, Q as recordReferenceResolution, Qt as recordInheritedParameterRead, R as recordIntrinsicLeafResolution, Rn as maskMatchSpans, S as noEchoParametersReadBy, Sn as markNoEchoParameterClass, St as replaceWholeLeaves, Tt as repairEmbeddedPhysicalNamesTowards, U as withLegacyMixedScan, Ut as standsForInheritedSecret, V as resolvedPlaintextOf, Vt as rereadParameterExpression, W as redactForState, Wt as recordDroppedArrayElements, X as passReadVersionsFor, Xt as inheritedParameterExpression, Y as passProvenanceFor, Yt as inheritNestedStackParameterAssociations, Z as recordReferenceProvenanceEntry, Zt as inheritedRenderedToken, _ as noEchoComparison, _n as freshNoEchoValuesOf, _t as maskSecretsInText, an as recordRecoverableMaskedOutput, at as literalSplitDelimitersOf, bn as isScopedSecretVerdict, bt as legacyReferenceLeavesOnly, c as parseLambdaFunctionAddress, ct as recordLogOnlyParameterValue, d as canonicalJson$6, dn as crossStackSourceKey, dt as shareLogOnlyValues, en as redactInheritedParameterValue, et as carryLogOnlyValues, f as isMarkedCoordinate, fn as recordCrossStackExpression, ft as unionOfSecretBags, g as maskedLeafCoordinatesOf, gn as contradictProvenPublicExpression, gt as maskSecretsInError, h as maskWholeValue, hn as carryFreshNoEchoMark, ht as maskRecordedSecretsInText, in as freshNoEchoLeafPositions, it as hasMaskableValues, jn as recordNoEchoParameterFreshValue, jt as spanNamesResolvableService, k as valueAtCoordinate, kt as withPhysicalNameCopies, ln as recordPhysicalNameCopy, lt as recordLogOnlySplitFragments, m as maskReadbackAtCoordinates, mn as carriesSecretMask, mt as errorCauseChain, nn as carriesFreshNoEchoValue, nt as createUnionSecretMasker, on as recoverMaskedOutput, ot as logOnlyValueCount, p as maskAtCoordinates, pn as splitGetAttStringForm, pt as createSecretMasker, q as recordSecretResolution, qt as recordInheritedPseudoParameters, rn as embedsFreshNoEchoValue, rt as hasLogOnlyValues, sn as physicalNameCopiesOf, st as printingCorpusOf, t as ReplacementRulesRegistry, tn as withdrawRenderedParameterSpelling, tt as carryLogOnlyValuesCarriedBy, u as canonicalCoordinates, un as recordNestedStackParameterExpressions, ut as recordLogOnlyValue, v as noEchoCoordinatesOf, vn as isMaskOnlyPlaintext, vt as differingStringLeaves, w as readbackPathFor, wn as pinScopedSecretVerdict, wt as embeddedPhysicalNameRewrites, x as noEchoParameterNodesAt, xn as isSecretExpressionByVerdictOrSpelling, xt as overlapRuleAnswered, y as noEchoLeavesOf, yn as isNoEchoParameterPlaintext, yt as legacyLeavesWithoutMask, z as recordIntrinsicLeafResolutionAs, zt as arrayPairsWhateverDrops } from "./replacement-rules-iQkausbv.js";
12
- import { C as withUnsettledItems, S as unsettledPropertiesOf, T as withoutUnsettledProperties, _ as isUsableAttemptedName, b as unsettledItemsOf, c as planTagDiff, f as tagPlanWarning, h as definedAttributes, i as refuseRestoreFromItself, l as readTagList, u as refuseMalformedDesiredTags, v as unsettledContextOf, w as withUnsettledProperties, x as unsettledItemsTopKey, y as unsettledItemsField } from "./restore-source-guard-Dj_CS7r6.js";
8
+ import { $t as markAuxiliaryFailure, At as canonicalizeRoute53QueryName, B as assertRegionMatch, Bt as createMaskedRetryLogger, D as withoutServerErrorRetries, F as refusalTypeShown, Gt as RETRY_AUXILIARY_OWNER, H as markNotGone, Ht as maskDeep, It as resourceTypeShown, Jt as createdBeforeFailure, K as observeThenDisableProtection, L as resolveExplicitPhysicalId, Lt as segmentAfterAnchor, M as isQuotableImportValue, Mt as compositeIdSeparatorRefusal, N as normalizeAwsTagsToCfn, P as quotedRemedyLogicalId, Pt as logicalIdShown, Qt as isAuxiliaryMarkOf, Rt as stateOrphanRecordRemedy, U as compensateProtectionFlip, Ut as maskerOrIdentity, V as isMarkedNotGone, Vt as isSecretDerivedValue, W as deleteWithProtectionCompensation, Wt as withDerivedNameMasks, Yt as createdResourceIdentityBeforeFailure, Zt as isAuxiliaryFailure, _n as withPasteableAwsProfile, at as runDeleteAttempt, bt as startInterruptWatch, ct as monotonicNowMs, d as CreatedResourceSink, dn as sanitizeRecoveryValue, en as markCreatedBeforeFailure, f as clearCreatedReport, fn as CUSTOM_RESOURCE_RESPONSE_PREFIX, g as retractCreatedResource, i as withResourceDeadline, it as protectionFlipKey, kt as withUnchangedSecretPrincipalLists, lt as DELETION_PROTECTION_DOC_POINTER, m as reportCreatedResource, mn as WAIT_CONDITION_SIGNAL_PREFIX, mt as protectedReplacementAdvice, n as enclosingDeadlineRemainingMs, nt as ProtectionFlipRegistry, o as prepareRemovalForUpdate, ot as ElapsedBudget, p as collectCreatedResources, pn as DEFAULT_STATE_PREFIX, pt as pasteableAwsCommand, r as whileEnclosingDeadlinesPaused, rt as isTerminalDeleteFailure, s as removalWarning, st as ElapsedBudgetRegistry, t as enclosingDeadlineExpired, u as withoutInjectedRemovals, un as recoveryCommandFlags, vn as injectiveKey, wt as holdsSecretDerivedEntry, xn as producerRecordKey, yt as isInterruptedWaitError, z as RESOURCE_NOT_FOUND, zt as createMaskedLogSinks } from "./resource-deadline-DlZTHrBj.js";
9
+ import { t as expectedOwnerParam } from "./expected-bucket-owner-CQimj8gv.js";
10
+ import { Ct as isReadableBag, Dt as skippedOutputsCarriedFrom, Et as shouldRetainResource, Ot as stackInstanceIdCarriedFrom, St as importableOutputs, Tt as orphansCarriedFrom, _t as acceptedCreateOnlyDropsOf, gt as slowCcOperationTimeoutMs, ht as dbInstanceAttributes, i as dbClusterAttributes, n as isRefusedByName, r as markDeleteStarted, t as isDeleteStarted, vt as describeRegionValueKind, wt as orphansAfterRollback, xt as importableOutputKeys, yt as exportNamesCarriedFrom } from "./delete-started-V5NHQ1O-.js";
11
+ import { $t as recordInheritedParameterValue, A as witnessNormalize, An as recordNoEchoAttributeValues, At as withoutPhysicalNameCopies, B as redactionClaimOf, Cn as noEchoParameterPlaintextsOf, Ct as withLegacyOverlapScan, D as recordedNoEchoValuesOf, Dn as recordFreshNoEchoValuesIn, Dt as replaceEmbeddedPhysicalNameRewrites, E as recordPassedNoEchoParameters, En as recordDerivedMaskOnlyValue, Et as repairPhysicalNameCopyLeaves, F as markLeafCertifiedBag, G as foldRecording, Gt as recordTakenIfBranch, H as mixedLiteralAnswered, Ht as splitOutsideDynamicReferences, I as markSameGenerationBag, In as isDynamicReferenceString, It as secretRerenderPairs, J as hasPassProvenance, Jt as templateRereadsAccountId, K as openRecordingScope, Kt as inheritedPseudoValue, L as mergeResolvedPairs, Ln as isSingleDynamicReferenceToken, M as carryRedactionMarks, Mn as recordProvenPublicExpression, Mt as DYNAMIC_REFERENCE_TOKEN_SCAN, N as intrinsicLeafResolutionOf, Nn as wholeStringLeavesOf, Nt as dynamicReferenceTokens, O as replaceAtCoordinates, Ot as scrubResourceRecord, P as isSameGenerationBag, Pn as withoutNoEchoParameterEntries, Q as recordReferenceResolution, Qt as recordInheritedParameterRead, R as recordIntrinsicLeafResolution, Rn as maskMatchSpans, S as noEchoParametersReadBy, Sn as markNoEchoParameterClass, St as replaceWholeLeaves, Tt as repairEmbeddedPhysicalNamesTowards, U as withLegacyMixedScan, Ut as standsForInheritedSecret, V as resolvedPlaintextOf, Vt as rereadParameterExpression, W as redactForState, Wt as recordDroppedArrayElements, X as passReadVersionsFor, Xt as inheritedParameterExpression, Y as passProvenanceFor, Yt as inheritNestedStackParameterAssociations, Z as recordReferenceProvenanceEntry, Zt as inheritedRenderedToken, _ as noEchoComparison, _n as freshNoEchoValuesOf, _t as maskSecretsInText, an as recordRecoverableMaskedOutput, at as literalSplitDelimitersOf, bn as isScopedSecretVerdict, bt as legacyReferenceLeavesOnly, c as parseLambdaFunctionAddress, ct as recordLogOnlyParameterValue, d as canonicalJson$7, dn as crossStackSourceKey, dt as shareLogOnlyValues, en as redactInheritedParameterValue, et as carryLogOnlyValues, f as isMarkedCoordinate, fn as recordCrossStackExpression, ft as unionOfSecretBags, g as maskedLeafCoordinatesOf, gn as contradictProvenPublicExpression, gt as maskSecretsInError, h as maskWholeValue, hn as carryFreshNoEchoMark, ht as maskRecordedSecretsInText, in as freshNoEchoLeafPositions, it as hasMaskableValues, jn as recordNoEchoParameterFreshValue, jt as spanNamesResolvableService, k as valueAtCoordinate, kt as withPhysicalNameCopies, ln as recordPhysicalNameCopy, lt as recordLogOnlySplitFragments, m as maskReadbackAtCoordinates, mn as carriesSecretMask, mt as errorCauseChain, nn as carriesFreshNoEchoValue, nt as createUnionSecretMasker, on as recoverMaskedOutput, ot as logOnlyValueCount, p as maskAtCoordinates, pn as splitGetAttStringForm, pt as createSecretMasker, q as recordSecretResolution, qt as recordInheritedPseudoParameters, rn as embedsFreshNoEchoValue, rt as hasLogOnlyValues, sn as physicalNameCopiesOf, st as printingCorpusOf, t as ReplacementRulesRegistry, tn as withdrawRenderedParameterSpelling, tt as carryLogOnlyValuesCarriedBy, u as canonicalCoordinates, un as recordNestedStackParameterExpressions, ut as recordLogOnlyValue, v as noEchoCoordinatesOf, vn as isMaskOnlyPlaintext, vt as differingStringLeaves, w as readbackPathFor, wn as pinScopedSecretVerdict, wt as embeddedPhysicalNameRewrites, x as noEchoParameterNodesAt, xn as isSecretExpressionByVerdictOrSpelling, xt as overlapRuleAnswered, y as noEchoLeavesOf, yn as isNoEchoParameterPlaintext, yt as legacyLeavesWithoutMask, z as recordIntrinsicLeafResolutionAs, zt as arrayPairsWhateverDrops } from "./replacement-rules-CMnMy7rf.js";
12
+ import { C as withUnsettledItems, S as unsettledPropertiesOf, T as withoutUnsettledProperties, _ as isUsableAttemptedName, b as unsettledItemsOf, c as planTagDiff, f as tagPlanWarning, h as definedAttributes, i as refuseRestoreFromItself, l as readTagList, u as refuseMalformedDesiredTags, v as unsettledContextOf, w as withUnsettledProperties, x as unsettledItemsTopKey, y as unsettledItemsField } from "./restore-source-guard-DIs6rqZm.js";
13
13
  import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
14
14
  import { AsyncLocalStorage } from "node:async_hooks";
15
15
  import { CreateBucketCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchKey, PutBucketEncryptionCommand, PutBucketLifecycleConfigurationCommand, PutBucketPolicyCommand, PutObjectCommand, PutPublicAccessBlockCommand, S3Client } from "@aws-sdk/client-s3";
@@ -82,7 +82,7 @@ async function resolveBucketRegion(bucketName, opts = {}) {
82
82
  });
83
83
  }
84
84
  try {
85
- const { expectedOwnerParam } = await import("./expected-bucket-owner-Am4J3ano.js").then((n) => n.n);
85
+ const { expectedOwnerParam } = await import("./expected-bucket-owner-CQimj8gv.js").then((n) => n.n);
86
86
  return (await client.send(new GetBucketLocationCommand({
87
87
  Bucket: bucketName,
88
88
  ...await expectedOwnerParam(client)
@@ -1803,7 +1803,7 @@ var CrossPrefixReadError = class extends Error {
1803
1803
  key;
1804
1804
  cause;
1805
1805
  constructor(key, cause) {
1806
- super(`reading ${displayIdent(key, { maxCodePoints: 1024 })} failed (${errorName$1(cause, "an unknown error")})`);
1806
+ super(`reading ${displayIdent(key, { maxCodePoints: 1024 })} failed (${errorName$2(cause, "an unknown error")})`);
1807
1807
  this.name = "CrossPrefixReadError";
1808
1808
  this.key = key;
1809
1809
  this.cause = cause;
@@ -2081,7 +2081,7 @@ function destructiveDeployUnderOtherPrefixMessage(s, prefixes, action = "deploy-
2081
2081
  function staleRecordNotice(s, prefixes) {
2082
2082
  return `Note: bucket ${displayIdent(s.bucket)} also holds a record of stack ${subjectText(s)} under another state prefix (${prefixesText(prefixes)}) that owns no resource -- the leftover of a failed first deploy. It does not block this command; remove it with \`${stateCommand("orphan", s, prefixes[0])}\`${prefixes.length > 1 ? ", and the same with each other prefix" : ""}.`;
2083
2083
  }
2084
- function errorName$1(error, fallback) {
2084
+ function errorName$2(error, fallback) {
2085
2085
  const subject = error instanceof CrossPrefixReadError ? error.cause : error;
2086
2086
  return subject !== null && typeof subject === "object" && typeof subject.name === "string" ? displaySafe(subject.name, { asciiOnly: true }) : fallback;
2087
2087
  }
@@ -2089,10 +2089,10 @@ function failedKeyText(error) {
2089
2089
  return error instanceof CrossPrefixReadError ? ` reading s3 object ${displayIdent(error.key, { maxCodePoints: 1024 })}` : "";
2090
2090
  }
2091
2091
  function crossPrefixDeniedWarning(s, error, stage = "probe") {
2092
- if (stage === "registry" && isNotImplemented(unwrapCause(error))) return `Could not use the stack registry for stack ${subjectText(s)}: the state bucket's endpoint does not implement a conditional write${failedKeyText(error)} (${errorName$1(error, "NotImplemented")}), so the bucket's other state prefixes were scanned instead, which is slower. Continuing.`;
2093
- if (stage === "registry") return `Could not use the stack registry for stack ${subjectText(s)}: S3 refused${failedKeyText(error)} (${errorName$1(error, "AccessDenied")}), so the bucket's other state prefixes were scanned instead, which is slower. Grant s3:GetObject, s3:PutObject and s3:DeleteObject on ${displayIdent(s.bucket)}/_cdkd-registry/* to use it. Continuing.`;
2092
+ if (stage === "registry" && isNotImplemented(unwrapCause(error))) return `Could not use the stack registry for stack ${subjectText(s)}: the state bucket's endpoint does not implement a conditional write${failedKeyText(error)} (${errorName$2(error, "NotImplemented")}), so the bucket's other state prefixes were scanned instead, which is slower. Continuing.`;
2093
+ if (stage === "registry") return `Could not use the stack registry for stack ${subjectText(s)}: S3 refused${failedKeyText(error)} (${errorName$2(error, "AccessDenied")}), so the bucket's other state prefixes were scanned instead, which is slower. Grant s3:GetObject, s3:PutObject and s3:DeleteObject on ${displayIdent(s.bucket)}/_cdkd-registry/* to use it. Continuing.`;
2094
2094
  const what = stage === "list" ? `S3 refused to list bucket ${displayIdent(s.bucket)}` : `S3 refused a read under another state prefix of bucket ${displayIdent(s.bucket)}`;
2095
- return `Could not check the other state prefixes for stack ${subjectText(s)}: ${what} (${errorName$1(error, "AccessDenied")}). Continuing. Deploying one stack name under two state prefixes in one account and region is unsupported.`;
2095
+ return `Could not check the other state prefixes for stack ${subjectText(s)}: ${what} (${errorName$2(error, "AccessDenied")}). Continuing. Deploying one stack name under two state prefixes in one account and region is unsupported.`;
2096
2096
  }
2097
2097
  function inProgressUnderOtherPrefixMessage(s, action, prefix) {
2098
2098
  const account = recoveryCommandFlags({
@@ -2118,7 +2118,7 @@ function inProgressUnderOtherPrefixMessage(s, action, prefix) {
2118
2118
  return `Refusing to ${VERB[action]} stack ${subjectText(s)}: bucket ${displayIdent(s.bucket)} assigns it to state prefix ${displayIdent(prefix)}, which records nothing for it yet but holds its lock, so a deploy there may be in progress. ${UNSUPPORTED_SENTENCE} ${NOTHING[action]} Re-run once that deploy has finished; if none is running, remove its lock with \`${unlock}\` and re-run.`;
2119
2119
  }
2120
2120
  function crossPrefixFailedMessage(s, action, error) {
2121
- return `Refusing to ${VERB[action]} stack ${subjectText(s)}: cdkd could not check whether the bucket ${displayIdent(s.bucket)} records it under another state prefix (${errorName$1(error, "an unknown error")}${failedKeyText(error)}). ${UNSUPPORTED_SENTENCE} ${NOTHING[action]} Re-run once the check can succeed.`;
2121
+ return `Refusing to ${VERB[action]} stack ${subjectText(s)}: cdkd could not check whether the bucket ${displayIdent(s.bucket)} records it under another state prefix (${errorName$2(error, "an unknown error")}${failedKeyText(error)}). ${UNSUPPORTED_SENTENCE} ${NOTHING[action]} Re-run once the check can succeed.`;
2122
2122
  }
2123
2123
  function applyCrossPrefixScan(result, s, action, warn, info) {
2124
2124
  if (result.kind !== "in-progress" && result.stale !== void 0 && result.stale.length > 0) info?.(staleRecordNotice(s, result.stale));
@@ -4946,6 +4946,18 @@ const PROPERTY_COVERAGE_BY_TYPE = /* @__PURE__ */ new Map([
4946
4946
  primaryIdentifier: /* @__PURE__ */ new Set(["StackId"]),
4947
4947
  ccRouteUnavailable: true
4948
4948
  }],
4949
+ ["AWS::CloudFormation::WaitCondition", {
4950
+ handled: /* @__PURE__ */ new Set([
4951
+ "Count",
4952
+ "Handle",
4953
+ "Timeout"
4954
+ ]),
4955
+ sdkUnwired: /* @__PURE__ */ new Map(),
4956
+ createOnlyDrops: /* @__PURE__ */ new Set(),
4957
+ readOnly: /* @__PURE__ */ new Set(["Data", "Id"]),
4958
+ primaryIdentifier: /* @__PURE__ */ new Set(["Id"]),
4959
+ ccRouteUnavailable: true
4960
+ }],
4949
4961
  ["AWS::CloudFormation::WaitConditionHandle", {
4950
4962
  handled: /* @__PURE__ */ new Set(),
4951
4963
  sdkUnwired: /* @__PURE__ */ new Map(),
@@ -7571,7 +7583,6 @@ const NON_PROVISIONABLE_TYPES = /* @__PURE__ */ new Set([
7571
7583
  "AWS::CleanRoomsML::TrainedModelInferenceJob",
7572
7584
  "AWS::CloudFormation::Macro",
7573
7585
  "AWS::CloudFormation::ResourceScan",
7574
- "AWS::CloudFormation::WaitCondition",
7575
7586
  "AWS::CloudFront::StreamingDistribution",
7576
7587
  "AWS::CloudHSMV2::Backup",
7577
7588
  "AWS::CodeArtifact::Package",
@@ -7853,6 +7864,7 @@ const SDK_PROVIDER_NON_PROVISIONABLE_TYPES = /* @__PURE__ */ new Set([
7853
7864
  "AWS::BedrockAgentCore::Browser",
7854
7865
  "AWS::BedrockAgentCore::CodeInterpreter",
7855
7866
  "AWS::Budgets::Budget",
7867
+ "AWS::CloudFormation::WaitCondition",
7856
7868
  "AWS::CloudFormation::WaitConditionHandle",
7857
7869
  "AWS::CloudWatch::AnomalyDetector",
7858
7870
  "AWS::CodeBuild::Project",
@@ -8877,12 +8889,12 @@ function malformedOrphansForOrphanRefusalMessage(rawStackName, rawRegion, logica
8877
8889
 
8878
8890
  // src/deployment/masked-property-fingerprints/core.ts
8879
8891
  const FINGERPRINT_LAYOUT$1 = 1;
8880
- function canonicalJson$5(value) {
8892
+ function canonicalJson$6(value) {
8881
8893
  if (value === void 0) return "null";
8882
- if (Array.isArray(value)) return `[${value.map(canonicalJson$5).join(",")}]`;
8894
+ if (Array.isArray(value)) return `[${value.map(canonicalJson$6).join(",")}]`;
8883
8895
  if (value !== null && typeof value === "object") {
8884
8896
  const record = value;
8885
- return `{${Object.keys(record).filter((key) => record[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson$5(record[key])}`).join(",")}}`;
8897
+ return `{${Object.keys(record).filter((key) => record[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson$6(record[key])}`).join(",")}}`;
8886
8898
  }
8887
8899
  return JSON.stringify(value) ?? "null";
8888
8900
  }
@@ -8903,7 +8915,7 @@ function splitInputFingerprint(entry) {
8903
8915
  };
8904
8916
  }
8905
8917
  function templateCarriesNeedle(templateValue, secrets) {
8906
- const text = canonicalJson$5(templateValue);
8918
+ const text = canonicalJson$6(templateValue);
8907
8919
  for (const needle of printingCorpusOf(secrets).keys()) {
8908
8920
  if (needle.length < 4) continue;
8909
8921
  if (text.includes(needle) || text.includes(JSON.stringify(needle).slice(1, -1))) return true;
@@ -8911,7 +8923,7 @@ function templateCarriesNeedle(templateValue, secrets) {
8911
8923
  return false;
8912
8924
  }
8913
8925
  function maskedPropertyFingerprint(templateValue) {
8914
- const digest = createHash("sha256").update(canonicalJson$5({
8926
+ const digest = createHash("sha256").update(canonicalJson$6({
8915
8927
  layout: FINGERPRINT_LAYOUT$1,
8916
8928
  value: templateValue
8917
8929
  })).digest("hex");
@@ -9169,7 +9181,7 @@ async function maskedInputWalk(templateValue, sources, covered) {
9169
9181
  };
9170
9182
  }
9171
9183
  function inputFingerprintOf(form, templateValue) {
9172
- const digest = createHash("sha256").update(canonicalJson$5({
9184
+ const digest = createHash("sha256").update(canonicalJson$6({
9173
9185
  layout: 2,
9174
9186
  value: form
9175
9187
  })).digest("hex");
@@ -9220,7 +9232,7 @@ const NESTED_STACK_TYPE$4 = "AWS::CloudFormation::Stack";
9220
9232
  const NESTED_OUTPUT_PREFIX = "Outputs.";
9221
9233
  function carriesSecretValue(value, corpora) {
9222
9234
  if (carriesSecretMask(value)) return true;
9223
- const text = canonicalJson$5(value);
9235
+ const text = canonicalJson$6(value);
9224
9236
  if (text.includes("{{resolve:")) return true;
9225
9237
  for (const corpus of corpora) {
9226
9238
  if (corpus === void 0) continue;
@@ -9269,7 +9281,7 @@ function parameterInputsFor(args) {
9269
9281
  };
9270
9282
  }
9271
9283
  function carriesReference(operand) {
9272
- return canonicalJson$5(operand).includes(DYNAMIC_REFERENCE_OPEN);
9284
+ return canonicalJson$6(operand).includes(DYNAMIC_REFERENCE_OPEN);
9273
9285
  }
9274
9286
  function proof(walk, proven) {
9275
9287
  return walk.covered === void 0 ? {} : { proven: proven() };
@@ -9691,7 +9703,7 @@ function possiblyMaskedKeys(resolvedProps, corpora) {
9691
9703
  return Object.keys(resolvedProps).filter((key) => {
9692
9704
  const value = resolvedProps[key];
9693
9705
  if (carriesSecretMask(value) || wholeShortLeaf(value)) return true;
9694
- const text = canonicalJson$5(value);
9706
+ const text = canonicalJson$6(value);
9695
9707
  return long.some((needle) => text.includes(needle) || text.includes(JSON.stringify(needle).slice(1, -1)));
9696
9708
  });
9697
9709
  }
@@ -10182,7 +10194,7 @@ function replacementNameKeyMoves(input) {
10182
10194
  if (key === void 0) return void 0;
10183
10195
  const fold = replacementOrderIsCaseSensitive(input.resourceType) ? (v) => v : (v) => v.toLowerCase();
10184
10196
  for (const path of key.name) {
10185
- const desiredName = valueAt$1(input.desiredProperties, path);
10197
+ const desiredName = valueAt$2(input.desiredProperties, path);
10186
10198
  if (desiredName === void 0) continue;
10187
10199
  const held = heldAt(input.recorded, input.observed, path);
10188
10200
  if (held.unreadable || held.value === void 0) return void 0;
@@ -10210,7 +10222,7 @@ function renameMakesRecreateCreateFirst(input) {
10210
10222
  }
10211
10223
  return false;
10212
10224
  }
10213
- function valueAt$1(bag, path) {
10225
+ function valueAt$2(bag, path) {
10214
10226
  let node = bag;
10215
10227
  for (const segment of path.slice(0, -1)) {
10216
10228
  if (node === null || typeof node !== "object" || Array.isArray(node)) return void 0;
@@ -10227,14 +10239,14 @@ function unreadableAt(bag, path) {
10227
10239
  if (node === null || typeof node !== "object" || Array.isArray(node)) return false;
10228
10240
  node = node[segment];
10229
10241
  }
10230
- return node !== void 0 && node !== null && valueAt$1(bag, path) === void 0;
10242
+ return node !== void 0 && node !== null && valueAt$2(bag, path) === void 0;
10231
10243
  }
10232
10244
  function heldAt(recorded, observed, path) {
10233
10245
  if (unreadableAt(recorded, path)) return {
10234
10246
  value: void 0,
10235
10247
  unreadable: true
10236
10248
  };
10237
- const value = valueAt$1(recorded, path) ?? valueAt$1(observed, path);
10249
+ const value = valueAt$2(recorded, path) ?? valueAt$2(observed, path);
10238
10250
  return {
10239
10251
  value,
10240
10252
  unreadable: value === void 0 && unreadableAt(observed, path)
@@ -10292,9 +10304,9 @@ const DEPLOY_VOICE = {
10292
10304
  };
10293
10305
  function sentIdentifierIs(requested, recorded, observed, physicalId) {
10294
10306
  const isNameKey = (key) => /(Name|Identifier)$/.test(key);
10295
- if (!Object.keys(requested).some((key) => isNameKey(key) && valueAt$1(requested, [key]) === physicalId)) return false;
10307
+ if (!Object.keys(requested).some((key) => isNameKey(key) && valueAt$2(requested, [key]) === physicalId)) return false;
10296
10308
  return [...new Set([...Object.keys(requested), ...Object.keys(recorded ?? {})].filter(isNameKey))].every((key) => {
10297
- const sent = valueAt$1(requested, [key]);
10309
+ const sent = valueAt$2(requested, [key]);
10298
10310
  return sent !== void 0 && heldAt(recorded, observed, [key]).value === sent;
10299
10311
  });
10300
10312
  }
@@ -10323,7 +10335,7 @@ function replayPrefixChoice(input) {
10323
10335
  if (raw === void 0 || raw === "") return { kind: "not-applicable" };
10324
10336
  const recorded = getCurrentSkipPrefix();
10325
10337
  const property = rewrite.property;
10326
- const declared = valueAt$1(input.properties, [property]);
10338
+ const declared = valueAt$2(input.properties, [property]);
10327
10339
  if (declared === void 0 || typeof input.logicalId !== "string" || typeof input.physicalId !== "string" || input.physicalId === "") return {
10328
10340
  kind: "unreproduced",
10329
10341
  skipPrefix: recorded,
@@ -10471,22 +10483,22 @@ function reverseReplacementTrustsGeneratedName(resourceType) {
10471
10483
  // src/deployment/replacement-name-holder/holder.ts
10472
10484
  function recordSetHolds(requested, recorded, observed, newPhysicalId, r, v) {
10473
10485
  const newRecord = `${v.holderRecord} (${r.shown(newPhysicalId)})`;
10474
- const wantName = valueAt$1(requested, ["Name"]);
10475
- const wantType = valueAt$1(requested, ["Type"]);
10486
+ const wantName = valueAt$2(requested, ["Name"]);
10487
+ const wantType = valueAt$2(requested, ["Type"]);
10476
10488
  const haveName = heldAt(recorded, observed, ["Name"]).value;
10477
10489
  const haveType = heldAt(recorded, observed, ["Type"]).value;
10478
10490
  if (wantName === void 0 || wantType === void 0) return unproven(`cdkd cannot read the Name and Type ${v.createdRecord} asked for`);
10479
10491
  const wanted = `${v.create} asked for Name ${r.quoted(wantName)}`;
10480
10492
  if (haveName === void 0 || haveType === void 0) return unproven(`${wanted}, and cdkd cannot read the name ${newRecord} holds`);
10481
10493
  if (dnsFold(wantName) !== dnsFold(haveName)) return /\\[0-9]{3}/.test(wantName + haveName) ? unproven(`${wanted}, and cdkd cannot compare it with the escaped name ${newRecord} holds`) : elsewhere(`${wanted}, while ${newRecord} holds Name ${r.quoted(haveName)}`);
10482
- const wantZoneId = valueAt$1(requested, ["HostedZoneId"]);
10494
+ const wantZoneId = valueAt$2(requested, ["HostedZoneId"]);
10483
10495
  const haveZoneId = heldAt(recorded, observed, ["HostedZoneId"]).value;
10484
- const wantZoneName = valueAt$1(requested, ["HostedZoneName"]);
10496
+ const wantZoneName = valueAt$2(requested, ["HostedZoneName"]);
10485
10497
  const haveZoneName = heldAt(recorded, observed, ["HostedZoneName"]).value;
10486
10498
  const sameZone = wantZoneId !== void 0 && haveZoneId !== void 0 ? zoneIdFold(wantZoneId) === zoneIdFold(haveZoneId) : wantZoneName !== void 0 && haveZoneName !== void 0 ? dnsFold(wantZoneName) === dnsFold(haveZoneName) : void 0;
10487
10499
  if (sameZone === false) return elsewhere(`${wanted}, while ${newRecord} is in another hosted zone`);
10488
10500
  if (sameZone === void 0) return unproven(`${wanted}, and cdkd cannot tell whether ${newRecord} is in the same hosted zone`);
10489
- const wantSet = valueAt$1(requested, ["SetIdentifier"]);
10501
+ const wantSet = valueAt$2(requested, ["SetIdentifier"]);
10490
10502
  const haveSet = heldAt(recorded, observed, ["SetIdentifier"]).value;
10491
10503
  if (wantType.toUpperCase() === "CNAME" !== (haveType.toUpperCase() === "CNAME")) return HOLDS;
10492
10504
  if (wantType.toUpperCase() !== haveType.toUpperCase()) return elsewhere(`${wanted} of Type ${r.quoted(wantType)}, while ${newRecord} is a ${r.quoted(haveType)} record of that name`);
@@ -10502,7 +10514,7 @@ function pathValue(bag, path) {
10502
10514
  return node;
10503
10515
  }
10504
10516
  function rewrittenNameHolds(input, rewrite, viaCloudControl, labels, newResource, r, v) {
10505
- const declared = valueAt$1(input.requested, [rewrite.property]);
10517
+ const declared = valueAt$2(input.requested, [rewrite.property]);
10506
10518
  const logicalId = typeof input.logicalId === "string" && input.logicalId !== "" ? input.logicalId : void 0;
10507
10519
  if (declared === void 0 && (viaCloudControl || logicalId === void 0)) return unproven(`${v.create} named no ${labels}, and cdkd cannot derive the name its provider generates, so it cannot show that ${newResource} holds it`);
10508
10520
  const sent = viaCloudControl ? declared : generateResourceNameWithFallback(declared, logicalId ?? "", { maxLength: rewrite.maxLength });
@@ -10536,11 +10548,11 @@ function holderVerdict$1(input, v) {
10536
10548
  const rewrite = ownEntry$1(SENT_NAME_REWRITTEN, oldResourceType);
10537
10549
  if (rewrite !== void 0) return rewrittenNameHolds(input, rewrite, input.createdVia === "cc-api", labels, newResource, r, v);
10538
10550
  let generatedName = false;
10539
- let namePath = oldKey.name.find((path) => valueAt$1(requested, path) !== void 0);
10540
- let wantName = namePath === void 0 ? void 0 : valueAt$1(requested, namePath);
10551
+ let namePath = oldKey.name.find((path) => valueAt$2(requested, path) !== void 0);
10552
+ let wantName = namePath === void 0 ? void 0 : valueAt$2(requested, namePath);
10541
10553
  if (namePath === void 0 && input.generated !== void 0 && reverseReplacementTrustsGeneratedName(oldResourceType)) {
10542
- namePath = oldKey.name.find((path) => valueAt$1(input.generated, path) !== void 0);
10543
- wantName = namePath === void 0 ? void 0 : valueAt$1(input.generated, namePath);
10554
+ namePath = oldKey.name.find((path) => valueAt$2(input.generated, path) !== void 0);
10555
+ wantName = namePath === void 0 ? void 0 : valueAt$2(input.generated, namePath);
10544
10556
  generatedName = wantName !== void 0;
10545
10557
  }
10546
10558
  const derived = ownEntry$1(DERIVED_GENERATED_NAMES, oldResourceType);
@@ -10559,14 +10571,14 @@ function holderVerdict$1(input, v) {
10559
10571
  const h = heldAt(recorded, observed, path);
10560
10572
  return h.value !== void 0 || h.unreadable;
10561
10573
  });
10562
- const recordedName = namePathHeld && valueAt$1(recorded, namePathHeld);
10563
- const observedName = namePathHeld && valueAt$1(observed, namePathHeld);
10574
+ const recordedName = namePathHeld && valueAt$2(recorded, namePathHeld);
10575
+ const observedName = namePathHeld && valueAt$2(observed, namePathHeld);
10564
10576
  if (namePathHeld !== void 0 && recordedName !== void 0 && observedName !== void 0 && !same(recordedName, observedName)) return unproven(`${wanted}, and the records of ${newResource} disagree on its ${r.shown(namePathHeld.join("."))} (recorded ${r.quoted(recordedName)}, read back ${r.quoted(observedName)}), so cdkd cannot show which name it holds`);
10565
10577
  const haveName = namePathHeld === void 0 ? void 0 : heldAt(recorded, observed, namePathHeld).value;
10566
10578
  if (!(haveName !== void 0 && same(haveName, wantName) || physicalId !== "" && !NO_PHYSICAL_ID_NAME_PROOF.has(newResourceType) && holderIdNames(inCase(physicalId), inCase(wantName)))) return haveName !== void 0 && !generatedName ? elsewhere(`${wanted}, while ${newResource} holds ${r.quoted(haveName)}`) : unproven(`${wanted}, and cdkd cannot show that ${newResource} holds that name`);
10567
10579
  for (const [i, path] of (oldKey.scope ?? []).entries()) {
10568
10580
  const label = r.shown(path.join("."));
10569
- const wantRaw = valueAt$1(requested, path);
10581
+ const wantRaw = valueAt$2(requested, path);
10570
10582
  const have = heldAt(recorded, observed, path);
10571
10583
  if (wantRaw === void 0 && unreadableAt(requested, path) || have.unreadable) return unproven(`${wanted}, and cdkd cannot read the ${label} that places it`);
10572
10584
  const fallback = oldKey.scopeDefaults?.[i];
@@ -12916,6 +12928,224 @@ function s3BucketWebsiteUrl(bucketName, region) {
12916
12928
  return `http://${bucketName}.s3-website${S3_WEBSITE_ENDPOINT_LEGACY_DASH_REGIONS.has(folded) ? "-" : "."}${folded}.${urlSuffix}`;
12917
12929
  }
12918
12930
 
12931
+ // src/provisioning/getatt-attributes.generated.ts
12932
+ const WRITABLE_GETATT_ATTRIBUTES = {
12933
+ "AWS::Amplify::Branch": ["BranchName"],
12934
+ "AWS::Amplify::Domain": [
12935
+ "AutoSubDomainCreationPatterns",
12936
+ "AutoSubDomainIAMRole",
12937
+ "DomainName",
12938
+ "EnableAutoSubDomain"
12939
+ ],
12940
+ "AWS::AppMesh::GatewayRoute": [
12941
+ "GatewayRouteName",
12942
+ "MeshName",
12943
+ "MeshOwner",
12944
+ "VirtualGatewayName"
12945
+ ],
12946
+ "AWS::AppMesh::Mesh": ["MeshName"],
12947
+ "AWS::AppMesh::Route": [
12948
+ "MeshName",
12949
+ "MeshOwner",
12950
+ "RouteName",
12951
+ "VirtualRouterName"
12952
+ ],
12953
+ "AWS::AppMesh::VirtualGateway": [
12954
+ "MeshName",
12955
+ "MeshOwner",
12956
+ "VirtualGatewayName"
12957
+ ],
12958
+ "AWS::AppMesh::VirtualNode": [
12959
+ "MeshName",
12960
+ "MeshOwner",
12961
+ "VirtualNodeName"
12962
+ ],
12963
+ "AWS::AppMesh::VirtualRouter": [
12964
+ "MeshName",
12965
+ "MeshOwner",
12966
+ "VirtualRouterName"
12967
+ ],
12968
+ "AWS::AppMesh::VirtualService": [
12969
+ "MeshName",
12970
+ "MeshOwner",
12971
+ "VirtualServiceName"
12972
+ ],
12973
+ "AWS::AppSync::DataSource": ["Name"],
12974
+ "AWS::AppSync::DomainName": ["DomainName"],
12975
+ "AWS::AppSync::FunctionConfiguration": ["DataSourceName", "Name"],
12976
+ "AWS::AppSync::Resolver": ["FieldName", "TypeName"],
12977
+ "AWS::Backup::BackupSelection": ["BackupPlanId"],
12978
+ "AWS::Backup::BackupVault": ["BackupVaultName"],
12979
+ "AWS::CleanRooms::AnalysisTemplate": ["Schema"],
12980
+ "AWS::Cloud9::EnvironmentEC2": ["Name"],
12981
+ "AWS::CloudWatch::InsightRule": ["RuleName"],
12982
+ "AWS::CodeArtifact::Domain": ["EncryptionKey"],
12983
+ "AWS::CodeArtifact::Repository": ["DomainName", "DomainOwner"],
12984
+ "AWS::EC2::CapacityReservation": [
12985
+ "AvailabilityZone",
12986
+ "InstanceType",
12987
+ "Tenancy"
12988
+ ],
12989
+ "AWS::EC2::Instance": ["AvailabilityZone"],
12990
+ "AWS::EC2::SecurityGroup": ["VpcId"],
12991
+ "AWS::EC2::Subnet": [
12992
+ "AvailabilityZone",
12993
+ "AvailabilityZoneId",
12994
+ "CidrBlock",
12995
+ "OutpostArn",
12996
+ "VpcId"
12997
+ ],
12998
+ "AWS::EC2::VPC": ["CidrBlock"],
12999
+ "AWS::EFS::MountTarget": ["IpAddress"],
13000
+ "AWS::EKS::Nodegroup": ["ClusterName", "NodegroupName"],
13001
+ "AWS::ElasticLoadBalancingV2::LoadBalancer": ["SecurityGroups"],
13002
+ "AWS::EventSchemas::Discoverer": ["CrossAccount"],
13003
+ "AWS::EventSchemas::Registry": ["RegistryName"],
13004
+ "AWS::EventSchemas::Schema": ["SchemaName"],
13005
+ "AWS::Events::EventBus": ["Name"],
13006
+ "AWS::GameLift::GameSessionQueue": ["Name"],
13007
+ "AWS::GameLift::MatchmakingConfiguration": ["Name"],
13008
+ "AWS::GameLift::MatchmakingRuleSet": ["Name"],
13009
+ "AWS::Grafana::Workspace": ["GrafanaVersion"],
13010
+ "AWS::Greengrass::ConnectorDefinition": ["Name"],
13011
+ "AWS::Greengrass::CoreDefinition": ["Name"],
13012
+ "AWS::Greengrass::DeviceDefinition": ["Name"],
13013
+ "AWS::Greengrass::FunctionDefinition": ["Name"],
13014
+ "AWS::Greengrass::Group": ["Name", "RoleArn"],
13015
+ "AWS::Greengrass::LoggerDefinition": ["Name"],
13016
+ "AWS::Greengrass::ResourceDefinition": ["Name"],
13017
+ "AWS::Greengrass::SubscriptionDefinition": ["Name"],
13018
+ "AWS::ImageBuilder::Component": ["Name"],
13019
+ "AWS::ImageBuilder::ContainerRecipe": ["Name"],
13020
+ "AWS::ImageBuilder::DistributionConfiguration": ["Name"],
13021
+ "AWS::ImageBuilder::ImagePipeline": ["Name"],
13022
+ "AWS::ImageBuilder::ImageRecipe": ["Name"],
13023
+ "AWS::ImageBuilder::InfrastructureConfiguration": ["Name"],
13024
+ "AWS::Kinesis::StreamConsumer": ["ConsumerName", "StreamARN"],
13025
+ "AWS::MSK::Cluster": ["CurrentVersion"],
13026
+ "AWS::ManagedBlockchain::Member": ["NetworkId"],
13027
+ "AWS::ManagedBlockchain::Node": ["MemberId", "NetworkId"],
13028
+ "AWS::MediaConvert::JobTemplate": ["Name"],
13029
+ "AWS::MediaConvert::Preset": ["Name"],
13030
+ "AWS::MediaConvert::Queue": ["Name"],
13031
+ "AWS::NetworkManager::ConnectAttachment": ["ProposedSegmentChange"],
13032
+ "AWS::NetworkManager::SiteToSiteVpnAttachment": ["ProposedSegmentChange"],
13033
+ "AWS::NetworkManager::TransitGatewayRouteTableAttachment": ["ProposedSegmentChange"],
13034
+ "AWS::NetworkManager::VpcAttachment": ["ProposedSegmentChange"],
13035
+ "AWS::OpsWorks::Instance": ["AvailabilityZone"],
13036
+ "AWS::OpsWorks::UserProfile": ["SshUsername"],
13037
+ "AWS::QuickSight::Analysis": ["Errors", "Sheets"],
13038
+ "AWS::RDS::DBInstance": ["DBSystemId"],
13039
+ "AWS::RDS::DBParameterGroup": ["DBParameterGroupName"],
13040
+ "AWS::RedshiftServerless::Workgroup": ["Workgroup"],
13041
+ "AWS::RoboMaker::RobotApplication": ["CurrentRevisionId"],
13042
+ "AWS::RoboMaker::SimulationApplication": ["CurrentRevisionId"],
13043
+ "AWS::Route53Resolver::ResolverEndpoint": [
13044
+ "Direction",
13045
+ "Name",
13046
+ "OutpostArn",
13047
+ "PreferredInstanceType",
13048
+ "ResolverEndpointType"
13049
+ ],
13050
+ "AWS::Route53Resolver::ResolverRule": [
13051
+ "DomainName",
13052
+ "Name",
13053
+ "ResolverEndpointId",
13054
+ "TargetIps"
13055
+ ],
13056
+ "AWS::Route53Resolver::ResolverRuleAssociation": [
13057
+ "Name",
13058
+ "ResolverRuleId",
13059
+ "VPCId"
13060
+ ],
13061
+ "AWS::S3::AccessPoint": ["Name"],
13062
+ "AWS::SNS::Topic": ["TopicName"],
13063
+ "AWS::SQS::Queue": ["QueueName"],
13064
+ "AWS::SSM::Parameter": ["Type"],
13065
+ "AWS::SSM::ResourceDataSync": ["SyncName"],
13066
+ "AWS::SageMaker::CodeRepository": ["CodeRepositoryName"],
13067
+ "AWS::SageMaker::Endpoint": ["EndpointName"],
13068
+ "AWS::SageMaker::EndpointConfig": ["EndpointConfigName"],
13069
+ "AWS::SageMaker::Model": ["ModelName"],
13070
+ "AWS::SageMaker::ModelPackage": ["LastModifiedTime"],
13071
+ "AWS::SageMaker::NotebookInstance": ["NotebookInstanceName"],
13072
+ "AWS::SageMaker::NotebookInstanceLifecycleConfig": ["NotebookInstanceLifecycleConfigName"],
13073
+ "AWS::SageMaker::Workteam": ["WorkteamName"],
13074
+ "AWS::ServiceDiscovery::Service": ["Name"],
13075
+ "AWS::Signer::SigningProfile": ["ProfileName"],
13076
+ "AWS::StepFunctions::Activity": ["Name"],
13077
+ "AWS::Transfer::User": ["ServerId", "UserName"]
13078
+ };
13079
+ const SHAPE_MISMATCHED_GETATT_ATTRIBUTES = {
13080
+ "AWS::DocDB::DBCluster": ["Port"],
13081
+ "AWS::Events::EventBus": ["Policy"],
13082
+ "AWS::MediaLive::Input": ["Destinations", "Sources"]
13083
+ };
13084
+
13085
+ // src/deployment/recorded-identity-attributes.ts
13086
+ const SURVIVOR_IDENTITY_ATTRIBUTES = {
13087
+ "AWS::IAM::Role": "RoleId",
13088
+ "AWS::IAM::ManagedPolicy": "PolicyId",
13089
+ "AWS::DynamoDB::Table": "TableId",
13090
+ "AWS::RDS::DBInstance": "DbiResourceId",
13091
+ "AWS::RDS::DBCluster": "DBClusterResourceId",
13092
+ "AWS::IAM::User": "UserId",
13093
+ "AWS::IAM::Group": "GroupId",
13094
+ "AWS::IAM::InstanceProfile": "InstanceProfileId"
13095
+ };
13096
+ function isRecordedIdentityAttribute(resourceType, key) {
13097
+ return Object.hasOwn(SURVIVOR_IDENTITY_ATTRIBUTES, resourceType) && SURVIVOR_IDENTITY_ATTRIBUTES[resourceType] === key;
13098
+ }
13099
+ function keepRecordedIdentity(resourceType, previous, next, onDiffering) {
13100
+ if (!Object.hasOwn(SURVIVOR_IDENTITY_ATTRIBUTES, resourceType)) return next;
13101
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[resourceType];
13102
+ const held = previous !== void 0 && Object.hasOwn(previous, key) ? previous[key] : void 0;
13103
+ const recorded = isUsableIdentityValue(held) ? held : void 0;
13104
+ if (recorded === void 0 || next[key] === recorded) return next;
13105
+ if (Object.hasOwn(next, key) && next[key] !== void 0) onDiffering?.(key);
13106
+ return {
13107
+ ...next,
13108
+ [key]: recorded
13109
+ };
13110
+ }
13111
+ function attributesAfterUpdate(resourceType, previous, result, onDiffering) {
13112
+ if (result.wasReplaced) return result.attributes;
13113
+ const next = result.attributes ?? previous;
13114
+ return next === void 0 ? void 0 : keepRecordedIdentity(resourceType, previous, next, onDiffering);
13115
+ }
13116
+ function withoutDeadIdentity(resourceType, attributes) {
13117
+ if (attributes === void 0 || !Object.hasOwn(SURVIVOR_IDENTITY_ATTRIBUTES, resourceType)) return attributes;
13118
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[resourceType];
13119
+ if (!Object.hasOwn(attributes, key)) return attributes;
13120
+ const { [key]: _dead, ...rest } = attributes;
13121
+ return rest;
13122
+ }
13123
+ function newCopyDeleteAttributes(resourceType, current, oldDeletedBeforeCreate, previous) {
13124
+ if (oldDeletedBeforeCreate !== true || !Object.hasOwn(SURVIVOR_IDENTITY_ATTRIBUTES, resourceType)) return current;
13125
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[resourceType];
13126
+ return current?.[key] !== void 0 && current[key] === previous?.[key] ? withoutDeadIdentity(resourceType, current) : current;
13127
+ }
13128
+ function isUsableIdentityValue(value) {
13129
+ return typeof value === "string" && value !== "" && !value.includes("***") && !holdsSecretDerivedEntry(value);
13130
+ }
13131
+ function replaceDeadIdentity(resourceType, attributes, previous, madeIdentity) {
13132
+ const dropped = newCopyDeleteAttributes(resourceType, attributes, true, previous);
13133
+ if (dropped === attributes || madeIdentity === void 0 || madeIdentity === "") return dropped;
13134
+ return {
13135
+ ...dropped,
13136
+ [SURVIVOR_IDENTITY_ATTRIBUTES[resourceType]]: madeIdentity
13137
+ };
13138
+ }
13139
+
13140
+ // src/deployment/unexposed-identity-attribute.ts
13141
+ function isUnexposedRecordedIdentity(resourceType, attributeName) {
13142
+ if (!isRecordedIdentityAttribute(resourceType, attributeName)) return false;
13143
+ const coverage = getPropertyCoverage(resourceType);
13144
+ if (coverage === void 0) return false;
13145
+ if (coverage.readOnly.has(attributeName)) return false;
13146
+ return !(Object.hasOwn(WRITABLE_GETATT_ATTRIBUTES, resourceType) && WRITABLE_GETATT_ATTRIBUTES[resourceType].includes(attributeName));
13147
+ }
13148
+
12919
13149
  // src/deployment/intrinsic-resolver/getatt/flat-object-attributes.ts
12920
13150
  const FLAT_OBJECT_MEMBERS = {
12921
13151
  "AWS::RDS::DBInstance": {
@@ -13189,6 +13419,10 @@ function refuseEndpointTheEngineLacks(resolver, resource, logicalId, attributeNa
13189
13419
  const other = lacking === "RedisEndpoint" ? "ConfigurationEndpoint" : "RedisEndpoint";
13190
13420
  throw markNonRetryable(new IntrinsicResolutionRefusalError(`Cannot resolve Fn::GetAtt [${displayMasked(resolver, logicalId, context)}, ${displayMasked(resolver, attributeName, context)}]: the cache cluster's engine is ${displayMasked(resolver, engine, context)}, which has no ${lacking}. CloudFormation answers an empty Address and Port for it; cdkd refuses instead of passing an empty endpoint on. Reference ${other} instead.`));
13191
13421
  }
13422
+ function refuseUnexposedRecordedIdentity(resolver, resourceType, logicalId, attributeName, context) {
13423
+ if (!isUnexposedRecordedIdentity(resourceType, attributeName)) return;
13424
+ throw markNonRetryable(new IntrinsicResolutionRefusalError(`Cannot resolve Fn::GetAtt [${displayMasked(resolver, logicalId, context)}, ${displayMasked(resolver, attributeName, context)}] for ${displayMasked(resolver, resourceType, context)}: CloudFormation does not expose ${displayMasked(resolver, attributeName, context)} as an attribute of this type and rejects the template. cdkd records it for its own identity checks only. Read an attribute the type exposes, or use Ref.`));
13425
+ }
13192
13426
 
13193
13427
  // src/deployment/intrinsic-resolver/getatt-construct-core.ts
13194
13428
  const NOT_CONSTRUCTED = Symbol("NOT_CONSTRUCTED");
@@ -14877,8 +15111,12 @@ function maskedSecretSegment(segment) {
14877
15111
  return `****${segment.slice(-4)}`;
14878
15112
  }
14879
15113
  function secretPhysicalIdSegment(resourceType, physicalId) {
14880
- if (resourceType !== "AWS::AppSync::ApiKey") return void 0;
14881
15114
  if (typeof physicalId !== "string" || physicalId === "") return void 0;
15115
+ if (resourceType === "AWS::CloudFormation::WaitConditionHandle") {
15116
+ const query = physicalId.indexOf("?");
15117
+ return query >= 0 && query < physicalId.length - 1 ? physicalId.slice(query + 1) : void 0;
15118
+ }
15119
+ if (resourceType !== "AWS::AppSync::ApiKey") return void 0;
14882
15120
  const parts = physicalId.split("|");
14883
15121
  if (parts.length === 2 && parts[0] !== "" && parts[1] !== "") return parts[1];
14884
15122
  const arn = APPSYNC_ARN.exec(physicalId);
@@ -16506,6 +16744,7 @@ async function resolveGetAtt(resolver, getAtt, context) {
16506
16744
  if (!resource) throw markNonRetryable(/* @__PURE__ */ new Error(`Resource ${displayMasked(resolver, logicalId, context)} not found for Fn::GetAtt`));
16507
16745
  recordSecretNamedRead(logicalId, void 0, context);
16508
16746
  refuseEndpointTheEngineLacks(resolver, resource, logicalId, attributeName, context);
16747
+ refuseUnexposedRecordedIdentity(resolver, resource.resourceType, logicalId, attributeName, context);
16509
16748
  if (!isAlwaysLiveAttribute(resource.resourceType, attributeName) && resource.attributes !== void 0) {
16510
16749
  const storedValue = Object.hasOwn(resource.attributes, attributeName) ? resource.attributes[attributeName] : assembleFlatObjectAttribute(resource.resourceType, attributeName, resource.attributes);
16511
16750
  const flatValue = isImpossibleEmptyStoredAttribute(resource.resourceType, attributeName, storedValue) ? void 0 : storedValue;
@@ -17645,160 +17884,6 @@ function maskLeavesDeep(value) {
17645
17884
  return "***";
17646
17885
  }
17647
17886
 
17648
- // src/provisioning/getatt-attributes.generated.ts
17649
- const WRITABLE_GETATT_ATTRIBUTES = {
17650
- "AWS::Amplify::Branch": ["BranchName"],
17651
- "AWS::Amplify::Domain": [
17652
- "AutoSubDomainCreationPatterns",
17653
- "AutoSubDomainIAMRole",
17654
- "DomainName",
17655
- "EnableAutoSubDomain"
17656
- ],
17657
- "AWS::AppMesh::GatewayRoute": [
17658
- "GatewayRouteName",
17659
- "MeshName",
17660
- "MeshOwner",
17661
- "VirtualGatewayName"
17662
- ],
17663
- "AWS::AppMesh::Mesh": ["MeshName"],
17664
- "AWS::AppMesh::Route": [
17665
- "MeshName",
17666
- "MeshOwner",
17667
- "RouteName",
17668
- "VirtualRouterName"
17669
- ],
17670
- "AWS::AppMesh::VirtualGateway": [
17671
- "MeshName",
17672
- "MeshOwner",
17673
- "VirtualGatewayName"
17674
- ],
17675
- "AWS::AppMesh::VirtualNode": [
17676
- "MeshName",
17677
- "MeshOwner",
17678
- "VirtualNodeName"
17679
- ],
17680
- "AWS::AppMesh::VirtualRouter": [
17681
- "MeshName",
17682
- "MeshOwner",
17683
- "VirtualRouterName"
17684
- ],
17685
- "AWS::AppMesh::VirtualService": [
17686
- "MeshName",
17687
- "MeshOwner",
17688
- "VirtualServiceName"
17689
- ],
17690
- "AWS::AppSync::DataSource": ["Name"],
17691
- "AWS::AppSync::DomainName": ["DomainName"],
17692
- "AWS::AppSync::FunctionConfiguration": ["DataSourceName", "Name"],
17693
- "AWS::AppSync::Resolver": ["FieldName", "TypeName"],
17694
- "AWS::Backup::BackupSelection": ["BackupPlanId"],
17695
- "AWS::Backup::BackupVault": ["BackupVaultName"],
17696
- "AWS::CleanRooms::AnalysisTemplate": ["Schema"],
17697
- "AWS::Cloud9::EnvironmentEC2": ["Name"],
17698
- "AWS::CloudWatch::InsightRule": ["RuleName"],
17699
- "AWS::CodeArtifact::Domain": ["EncryptionKey"],
17700
- "AWS::CodeArtifact::Repository": ["DomainName", "DomainOwner"],
17701
- "AWS::EC2::CapacityReservation": [
17702
- "AvailabilityZone",
17703
- "InstanceType",
17704
- "Tenancy"
17705
- ],
17706
- "AWS::EC2::Instance": ["AvailabilityZone"],
17707
- "AWS::EC2::SecurityGroup": ["VpcId"],
17708
- "AWS::EC2::Subnet": [
17709
- "AvailabilityZone",
17710
- "AvailabilityZoneId",
17711
- "CidrBlock",
17712
- "OutpostArn",
17713
- "VpcId"
17714
- ],
17715
- "AWS::EC2::VPC": ["CidrBlock"],
17716
- "AWS::EFS::MountTarget": ["IpAddress"],
17717
- "AWS::EKS::Nodegroup": ["ClusterName", "NodegroupName"],
17718
- "AWS::ElasticLoadBalancingV2::LoadBalancer": ["SecurityGroups"],
17719
- "AWS::EventSchemas::Discoverer": ["CrossAccount"],
17720
- "AWS::EventSchemas::Registry": ["RegistryName"],
17721
- "AWS::EventSchemas::Schema": ["SchemaName"],
17722
- "AWS::Events::EventBus": ["Name"],
17723
- "AWS::GameLift::GameSessionQueue": ["Name"],
17724
- "AWS::GameLift::MatchmakingConfiguration": ["Name"],
17725
- "AWS::GameLift::MatchmakingRuleSet": ["Name"],
17726
- "AWS::Grafana::Workspace": ["GrafanaVersion"],
17727
- "AWS::Greengrass::ConnectorDefinition": ["Name"],
17728
- "AWS::Greengrass::CoreDefinition": ["Name"],
17729
- "AWS::Greengrass::DeviceDefinition": ["Name"],
17730
- "AWS::Greengrass::FunctionDefinition": ["Name"],
17731
- "AWS::Greengrass::Group": ["Name", "RoleArn"],
17732
- "AWS::Greengrass::LoggerDefinition": ["Name"],
17733
- "AWS::Greengrass::ResourceDefinition": ["Name"],
17734
- "AWS::Greengrass::SubscriptionDefinition": ["Name"],
17735
- "AWS::ImageBuilder::Component": ["Name"],
17736
- "AWS::ImageBuilder::ContainerRecipe": ["Name"],
17737
- "AWS::ImageBuilder::DistributionConfiguration": ["Name"],
17738
- "AWS::ImageBuilder::ImagePipeline": ["Name"],
17739
- "AWS::ImageBuilder::ImageRecipe": ["Name"],
17740
- "AWS::ImageBuilder::InfrastructureConfiguration": ["Name"],
17741
- "AWS::Kinesis::StreamConsumer": ["ConsumerName", "StreamARN"],
17742
- "AWS::MSK::Cluster": ["CurrentVersion"],
17743
- "AWS::ManagedBlockchain::Member": ["NetworkId"],
17744
- "AWS::ManagedBlockchain::Node": ["MemberId", "NetworkId"],
17745
- "AWS::MediaConvert::JobTemplate": ["Name"],
17746
- "AWS::MediaConvert::Preset": ["Name"],
17747
- "AWS::MediaConvert::Queue": ["Name"],
17748
- "AWS::NetworkManager::ConnectAttachment": ["ProposedSegmentChange"],
17749
- "AWS::NetworkManager::SiteToSiteVpnAttachment": ["ProposedSegmentChange"],
17750
- "AWS::NetworkManager::TransitGatewayRouteTableAttachment": ["ProposedSegmentChange"],
17751
- "AWS::NetworkManager::VpcAttachment": ["ProposedSegmentChange"],
17752
- "AWS::OpsWorks::Instance": ["AvailabilityZone"],
17753
- "AWS::OpsWorks::UserProfile": ["SshUsername"],
17754
- "AWS::QuickSight::Analysis": ["Errors", "Sheets"],
17755
- "AWS::RDS::DBInstance": ["DBSystemId"],
17756
- "AWS::RDS::DBParameterGroup": ["DBParameterGroupName"],
17757
- "AWS::RedshiftServerless::Workgroup": ["Workgroup"],
17758
- "AWS::RoboMaker::RobotApplication": ["CurrentRevisionId"],
17759
- "AWS::RoboMaker::SimulationApplication": ["CurrentRevisionId"],
17760
- "AWS::Route53Resolver::ResolverEndpoint": [
17761
- "Direction",
17762
- "Name",
17763
- "OutpostArn",
17764
- "PreferredInstanceType",
17765
- "ResolverEndpointType"
17766
- ],
17767
- "AWS::Route53Resolver::ResolverRule": [
17768
- "DomainName",
17769
- "Name",
17770
- "ResolverEndpointId",
17771
- "TargetIps"
17772
- ],
17773
- "AWS::Route53Resolver::ResolverRuleAssociation": [
17774
- "Name",
17775
- "ResolverRuleId",
17776
- "VPCId"
17777
- ],
17778
- "AWS::S3::AccessPoint": ["Name"],
17779
- "AWS::SNS::Topic": ["TopicName"],
17780
- "AWS::SQS::Queue": ["QueueName"],
17781
- "AWS::SSM::Parameter": ["Type"],
17782
- "AWS::SSM::ResourceDataSync": ["SyncName"],
17783
- "AWS::SageMaker::CodeRepository": ["CodeRepositoryName"],
17784
- "AWS::SageMaker::Endpoint": ["EndpointName"],
17785
- "AWS::SageMaker::EndpointConfig": ["EndpointConfigName"],
17786
- "AWS::SageMaker::Model": ["ModelName"],
17787
- "AWS::SageMaker::ModelPackage": ["LastModifiedTime"],
17788
- "AWS::SageMaker::NotebookInstance": ["NotebookInstanceName"],
17789
- "AWS::SageMaker::NotebookInstanceLifecycleConfig": ["NotebookInstanceLifecycleConfigName"],
17790
- "AWS::SageMaker::Workteam": ["WorkteamName"],
17791
- "AWS::ServiceDiscovery::Service": ["Name"],
17792
- "AWS::Signer::SigningProfile": ["ProfileName"],
17793
- "AWS::StepFunctions::Activity": ["Name"],
17794
- "AWS::Transfer::User": ["ServerId", "UserName"]
17795
- };
17796
- const SHAPE_MISMATCHED_GETATT_ATTRIBUTES = {
17797
- "AWS::DocDB::DBCluster": ["Port"],
17798
- "AWS::Events::EventBus": ["Policy"],
17799
- "AWS::MediaLive::Input": ["Destinations", "Sources"]
17800
- };
17801
-
17802
17887
  // src/provisioning/read-only-properties.ts
17803
17888
  function isDefinitiveRefusal(error) {
17804
17889
  if (isThrottlingError(error)) return false;
@@ -18131,12 +18216,61 @@ function withListenerRuleConditionOps(resourceType, patch, desired) {
18131
18216
  }];
18132
18217
  }
18133
18218
 
18219
+ // src/provisioning/cc-read-back-default-paths.ts
18220
+ const CC_READ_BACK_DEFAULT_PATHS = { "AWS::OpenSearchService::Domain": [{
18221
+ path: ["AdvancedOptions", "override_main_response_version"],
18222
+ value: "false"
18223
+ }, {
18224
+ path: ["AIMLOptions"],
18225
+ value: {
18226
+ S3VectorsEngine: { Enabled: false },
18227
+ ServerlessVectorAcceleration: { Enabled: false }
18228
+ }
18229
+ }] };
18230
+ function hasCcReadBackDefaultPaths(resourceType) {
18231
+ return Object.prototype.hasOwnProperty.call(CC_READ_BACK_DEFAULT_PATHS, resourceType);
18232
+ }
18233
+ const ABSENT$1 = Symbol("absent");
18234
+ function valueAt$1(bag, path) {
18235
+ let cur = bag;
18236
+ for (const segment of path) {
18237
+ if (cur === null || typeof cur !== "object" || Array.isArray(cur)) return ABSENT$1;
18238
+ if (!Object.prototype.hasOwnProperty.call(cur, segment)) return ABSENT$1;
18239
+ cur = cur[segment];
18240
+ }
18241
+ return cur;
18242
+ }
18243
+ function withCcReadBackDefaultRemovals(resourceType, patch, desired, liveModel) {
18244
+ const defaults = hasCcReadBackDefaultPaths(resourceType) ? CC_READ_BACK_DEFAULT_PATHS[resourceType] : [];
18245
+ if (defaults.length === 0 || patch.length === 0 || liveModel === void 0) return patch;
18246
+ const extra = [];
18247
+ for (const { path, value } of defaults) {
18248
+ const pointer = `/${path.map(escapeJsonPointer$1).join("/")}`;
18249
+ if (patch.some((op) => op.path === pointer || op.path.startsWith(`${pointer}/`) || pointer.startsWith(`${op.path}/`))) continue;
18250
+ if (!isDeepStrictEqual(valueAt$1(liveModel, path), value)) continue;
18251
+ const declared = valueAt$1(desired, path);
18252
+ if (declared !== ABSENT$1 && !isDeepStrictEqual(declared, value)) continue;
18253
+ extra.push({
18254
+ op: "remove",
18255
+ path: pointer
18256
+ });
18257
+ }
18258
+ return extra.length === 0 ? patch : [...patch, ...extra];
18259
+ }
18260
+ function escapeJsonPointer$1(key) {
18261
+ return key.replace(/~/g, "~0").replace(/\//g, "~1");
18262
+ }
18263
+
18134
18264
  // src/provisioning/cc-read-back-empty-keys.ts
18135
- const CC_READ_BACK_EMPTY_KEYS = { "AWS::ImageBuilder::InfrastructureConfiguration": ["ResourceTags"] };
18265
+ const CC_READ_BACK_EMPTY_KEYS = {
18266
+ "AWS::DataSync::Task": ["Name", "Schedule"],
18267
+ "AWS::ImageBuilder::InfrastructureConfiguration": ["ResourceTags"]
18268
+ };
18136
18269
  function hasCcReadBackEmptyKeys(resourceType) {
18137
18270
  return Object.prototype.hasOwnProperty.call(CC_READ_BACK_EMPTY_KEYS, resourceType);
18138
18271
  }
18139
- function isEmptyCollection(value) {
18272
+ function isEmptyValue(value) {
18273
+ if (value === "") return true;
18140
18274
  if (Array.isArray(value)) return value.length === 0;
18141
18275
  return value !== null && typeof value === "object" && Object.keys(value).length === 0;
18142
18276
  }
@@ -18150,14 +18284,16 @@ function withCcReadBackEmptyKeyRemovals(resourceType, patch, desired, liveModel)
18150
18284
  const existing = out.findIndex((op) => op.path === path);
18151
18285
  if (existing !== -1) {
18152
18286
  const op = out[existing];
18153
- if ((op.op === "add" || op.op === "replace") && isEmptyCollection(op.value)) out = Object.prototype.hasOwnProperty.call(liveModel, key) ? out.map((o, i) => i === existing ? {
18287
+ const live = liveModel[key];
18288
+ const keepsLiveString = op.value === "" && typeof live === "string" && live !== "";
18289
+ if ((op.op === "add" || op.op === "replace") && isEmptyValue(op.value) && !keepsLiveString) out = Object.prototype.hasOwnProperty.call(liveModel, key) ? out.map((o, i) => i === existing ? {
18154
18290
  op: "remove",
18155
18291
  path
18156
18292
  } : o) : out.filter((_, i) => i !== existing);
18157
18293
  continue;
18158
18294
  }
18159
- if (!isEmptyCollection(liveModel[key])) continue;
18160
- if (Object.prototype.hasOwnProperty.call(desired, key) && !isEmptyCollection(desired[key])) continue;
18295
+ if (!isEmptyValue(liveModel[key])) continue;
18296
+ if (Object.prototype.hasOwnProperty.call(desired, key) && !isEmptyValue(desired[key])) continue;
18161
18297
  extra.push({
18162
18298
  op: "remove",
18163
18299
  path
@@ -18890,6 +19026,7 @@ async function updateInIdLogScope(logicalId, physicalId, resourceType, propertie
18890
19026
  ...sentNothing
18891
19027
  };
18892
19028
  }
19029
+ if (hasCcReadBackDefaultPaths(resourceType)) patch = withCcReadBackDefaultRemovals(resourceType, patch, cleanProperties, await readLiveModel());
18893
19030
  if (writesTopLevelObject(patch)) {
18894
19031
  const [createOnlyPaths, readOnlyPaths] = await Promise.all([getCreateOnlyPropertyPaths(resourceType), getReadOnlyPropertyPaths(resourceType)]);
18895
19032
  const gaps = [...nestedCreateOnlyGaps(patch, createOnlyPaths), ...nestedReadOnlyGaps(patch, (readOnlyPaths ?? []).map((path) => path.split(".")), cleanPreviousProperties, resourceType)];
@@ -19038,7 +19175,7 @@ async function deleteEc2VolumeDirect(client, volumeId, logicalId, opts) {
19038
19175
  await client.send(new DeleteVolumeCommand({ VolumeId: volumeId }));
19039
19176
  opts.logger.debug(`DeleteVolume accepted for ${logicalId} (${volumeId})`);
19040
19177
  } catch (error) {
19041
- if (errorName(error) !== "IncorrectState") throw error;
19178
+ if (errorName$1(error) !== "IncorrectState") throw error;
19042
19179
  let state;
19043
19180
  try {
19044
19181
  state = await readVolumeState(client, volumeId);
@@ -19087,11 +19224,11 @@ async function readVolumeState(client, volumeId) {
19087
19224
  const volume = (await client.send(new DescribeVolumesCommand({ VolumeIds: [volumeId] }))).Volumes?.[0];
19088
19225
  return volume === void 0 ? void 0 : volume.State ?? "unknown";
19089
19226
  } catch (error) {
19090
- if (errorName(error) === "InvalidVolume.NotFound") return void 0;
19227
+ if (errorName$1(error) === "InvalidVolume.NotFound") return void 0;
19091
19228
  throw error;
19092
19229
  }
19093
19230
  }
19094
- function errorName(error) {
19231
+ function errorName$1(error) {
19095
19232
  if (typeof error !== "object" || error === null) return "";
19096
19233
  const name = error.name;
19097
19234
  return typeof name === "string" ? name : "";
@@ -19739,6 +19876,62 @@ function ccProtectionSite(resourceType, physicalId, entry, region) {
19739
19876
  };
19740
19877
  }
19741
19878
 
19879
+ // src/provisioning/recorded-identity.ts
19880
+ function recordedIdentityId(resourceType, context) {
19881
+ if (!Object.hasOwn(SURVIVOR_IDENTITY_ATTRIBUTES, resourceType)) return void 0;
19882
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[resourceType];
19883
+ const value = context?.recordedAttributes?.[key];
19884
+ return isUsableIdentityValue(value) ? {
19885
+ key,
19886
+ value
19887
+ } : void 0;
19888
+ }
19889
+ var RecordedIdentityError = class extends ProvisioningError {
19890
+ constructor(message, resourceType, logicalId, physicalId, cause) {
19891
+ super(message, resourceType, logicalId, physicalId, cause);
19892
+ Object.setPrototypeOf(this, new.target.prototype);
19893
+ this.name = "RecordedIdentityError";
19894
+ }
19895
+ };
19896
+ var RecordedIdentityMismatchError = class RecordedIdentityMismatchError extends RecordedIdentityError {
19897
+ attribute;
19898
+ constructor(params) {
19899
+ const { label, resourceType, logicalId, physicalId, attribute, context } = params;
19900
+ super(`Cannot delete ${label} ${logicalId}: the ${label} holding the name cdkd recorded is not the one cdkd created (its ${attribute} differs from the recorded one), so cdkd sent no delete and kept the record. Leave that ${label} alone; if the one cdkd created is gone, drop the record with ${stateOrphanRecordRemedy(context, logicalId)}.`, resourceType, logicalId, physicalId);
19901
+ Object.setPrototypeOf(this, RecordedIdentityMismatchError.prototype);
19902
+ this.attribute = attribute;
19903
+ this.name = "RecordedIdentityMismatchError";
19904
+ markNonRetryable(this);
19905
+ }
19906
+ };
19907
+ const RECORDED_IDENTITY_REREAD_DELAY_MS = 5e3;
19908
+ async function assertRecordedIdentity(params) {
19909
+ const recorded = recordedIdentityId(params.resourceType, params.context);
19910
+ if (recorded === void 0) return;
19911
+ const { label, resourceType, logicalId, physicalId, context } = params;
19912
+ let liveId = params.liveId;
19913
+ if (typeof liveId === "string" && liveId !== "" && liveId !== recorded.value) {
19914
+ await new Promise((resolve) => setTimeout(resolve, RECORDED_IDENTITY_REREAD_DELAY_MS));
19915
+ liveId = await params.reread();
19916
+ }
19917
+ if (typeof liveId !== "string" || liveId === "") throw markNotGone(new RecordedIdentityError(`Cannot delete ${label} ${logicalId}: AWS answered without its ${recorded.key}, so cdkd cannot confirm it is the one cdkd created; nothing was sent and the record is kept. Re-run the operation.`, resourceType, logicalId, physicalId));
19918
+ if (liveId === recorded.value) return;
19919
+ throw new RecordedIdentityMismatchError({
19920
+ label,
19921
+ resourceType,
19922
+ logicalId,
19923
+ physicalId,
19924
+ attribute: recorded.key,
19925
+ context
19926
+ });
19927
+ }
19928
+ function differingIdentityWarning(logicalId, resourceType, attribute) {
19929
+ return safeMsg`${logicalId} (${resourceType}): the update answered with another ${attribute} than the recorded one, so it may have reached another resource under the same name; cdkd keeps the recorded ${attribute}. Check the resource before deleting anything by hand.`;
19930
+ }
19931
+ function identityWarner(logger, mask, op) {
19932
+ return (attribute) => logger.warn(mask(differingIdentityWarning(op.logicalId, op.resourceType, attribute)));
19933
+ }
19934
+
19742
19935
  // src/provisioning/cloud-control/delete-guards.ts
19743
19936
  const CC_DELETE_IDENTITY_CHECKED_TYPES = /* @__PURE__ */ new Set(["AWS::S3::Bucket"]);
19744
19937
  function requiresCcDeleteIdentityCheck(resourceType) {
@@ -19754,6 +19947,17 @@ function bucketLocationToRegion(constraint) {
19754
19947
  function isNoSuchBucketError(error) {
19755
19948
  return error?.name === "NoSuchBucket";
19756
19949
  }
19950
+ const CC_MODEL_OMITS_IDENTITY = /* @__PURE__ */ new Set([
19951
+ "AWS::DynamoDB::Table",
19952
+ "AWS::IAM::User",
19953
+ "AWS::IAM::Group",
19954
+ "AWS::IAM::InstanceProfile"
19955
+ ]);
19956
+ const CC_DELETE_RECORDED_IDENTITY_ATTRIBUTES = new Map(Object.entries(SURVIVOR_IDENTITY_ATTRIBUTES).filter(([resourceType]) => !CC_MODEL_OMITS_IDENTITY.has(resourceType)));
19957
+ function recordedCcDeleteIdentity(resourceType, context) {
19958
+ if (!CC_DELETE_RECORDED_IDENTITY_ATTRIBUTES.has(resourceType)) return void 0;
19959
+ return recordedIdentityId(resourceType, context);
19960
+ }
19757
19961
  const SDK_DELETE_FAMILIES = /* @__PURE__ */ new Map([
19758
19962
  ["AWS::RDS::DBCluster", "rds"],
19759
19963
  ["AWS::RDS::DBInstance", "rds"],
@@ -19780,6 +19984,113 @@ function isCcConflict(error) {
19780
19984
  return typeof error === "object" && error !== null && error.name === "ResourceConflictException";
19781
19985
  }
19782
19986
 
19987
+ // src/provisioning/cloud-control/delete-identity.ts
19988
+ async function assertRecordedRegionAgainstClient(phase, expectedRegion, resourceType, logicalId, physicalId) {
19989
+ const recordedRegion = canonicalizeRegion(expectedRegion?.trim());
19990
+ if (recordedRegion === void 0 || recordedRegion === "") return;
19991
+ let clientRegion;
19992
+ try {
19993
+ clientRegion = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
19994
+ } catch (error) {
19995
+ this.logger.debug(`Could not resolve the Cloud Control client region before the ${phase} region check for ${logicalId} (${resourceType}): ${displaySafe(describeAwsFailure(error).detail)}`);
19996
+ clientRegion = void 0;
19997
+ }
19998
+ try {
19999
+ assertRegionMatch(clientRegion, recordedRegion, resourceType, logicalId, physicalId, phase);
20000
+ } catch (error) {
20001
+ throw markNonRetryable(error);
20002
+ }
20003
+ }
20004
+ async function assertRecordedIdentityBeforeCcDelete(logicalId, resourceType, physicalId, context) {
20005
+ if (recordedCcDeleteIdentity(resourceType, context) === void 0) return;
20006
+ const read = async () => {
20007
+ let raw;
20008
+ try {
20009
+ raw = (await this.cloudControlClient.send(new GetResourceCommand({
20010
+ TypeName: resourceType,
20011
+ Identifier: physicalId
20012
+ }))).ResourceDescription?.Properties;
20013
+ } catch (error) {
20014
+ if (error?.name === "ResourceNotFoundException") return ABSENT;
20015
+ try {
20016
+ this.handleError(error, "READ", resourceType, logicalId, physicalId);
20017
+ } catch (wrapped) {
20018
+ throw markNotGoneOnNeedle(wrapped);
20019
+ }
20020
+ }
20021
+ const key = CC_DELETE_RECORDED_IDENTITY_ATTRIBUTES.get(resourceType);
20022
+ try {
20023
+ const model = typeof raw === "string" ? JSON.parse(raw) : void 0;
20024
+ const live = model !== null && typeof model === "object" && !Array.isArray(model) ? model[key] : void 0;
20025
+ return typeof live === "string" ? live : void 0;
20026
+ } catch {
20027
+ return;
20028
+ }
20029
+ };
20030
+ const first = await read();
20031
+ if (first === ABSENT) return;
20032
+ await assertRecordedIdentity({
20033
+ label: resourceType,
20034
+ resourceType,
20035
+ logicalId,
20036
+ physicalId,
20037
+ liveId: first,
20038
+ reread: async () => {
20039
+ const again = await read();
20040
+ return again === ABSENT ? void 0 : again;
20041
+ },
20042
+ context
20043
+ });
20044
+ }
20045
+ const ABSENT = Symbol("absent");
20046
+ async function confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context) {
20047
+ if (!requiresCcDeleteIdentityCheck(resourceType)) return void 0;
20048
+ const recordedRegion = context?.expectedRegion?.trim();
20049
+ let expectedRegion = recordedRegion === void 0 || recordedRegion === "" ? void 0 : recordedRegion;
20050
+ let clientRegionError;
20051
+ if (expectedRegion === void 0) try {
20052
+ const clientRegion = (await this.cloudControlClient.config.region())?.trim();
20053
+ expectedRegion = clientRegion === void 0 || clientRegion === "" ? void 0 : clientRegion;
20054
+ } catch (error) {
20055
+ const clientRegionFailure = describeAwsFailure(error);
20056
+ clientRegionError = clientRegionFailure.summary;
20057
+ this.logger.debug(`Could not resolve the Cloud Control client region while confirming ${physicalId}: ${clientRegionFailure.detail}`);
20058
+ expectedRegion = void 0;
20059
+ }
20060
+ if (expectedRegion === void 0) {
20061
+ const reason = clientRegionError === void 0 ? `neither the stack state nor the AWS client reports a region` : `the stack state records no region and the AWS client's region could not be resolved: ${clientRegionError}`;
20062
+ this.logger.warn(`Could not confirm that ${resourceType} ${physicalId} (${logicalId}) is the resource this destroy targets: ${reason.replace(/[.\s]+$/, "")}. Proceeding with the delete.`);
20063
+ return {
20064
+ guard: CC_DELETE_REGION_IDENTITY_GUARD,
20065
+ reason
20066
+ };
20067
+ }
20068
+ const wantRegion = canonicalizeRegion(expectedRegion);
20069
+ let actualRegion;
20070
+ try {
20071
+ const location = await getAwsClients().s3.send(new GetBucketLocationCommand({ Bucket: physicalId }));
20072
+ actualRegion = bucketLocationToRegion(location.LocationConstraint);
20073
+ } catch (error) {
20074
+ if (isNoSuchBucketError(error)) {
20075
+ this.logger.debug(`Bucket ${physicalId} (${logicalId}) is already absent; leaving the delete to the Cloud Control idempotency path`);
20076
+ return;
20077
+ }
20078
+ const failure = describeAwsFailure(error);
20079
+ this.logger.debug(`s3:GetBucketLocation on ${physicalId} (${logicalId}) failed: ${failure.detail}`);
20080
+ const summarySentence = failure.summary.replace(/[.\s]+$/, "");
20081
+ this.logger.warn(`Could not confirm which region S3 bucket ${physicalId} (${logicalId}) lives in before deleting it: ${summarySentence}. S3 bucket names are globally unique, so cdkd cannot rule out that this name denotes a bucket in another region. Grant s3:GetBucketLocation on the bucket to enable the check. Proceeding with the delete.`);
20082
+ return {
20083
+ guard: CC_DELETE_REGION_IDENTITY_GUARD,
20084
+ reason: `s3:GetBucketLocation on ${physicalId} could not be answered: ${failure.summary}`
20085
+ };
20086
+ }
20087
+ if (actualRegion === wantRegion) {
20088
+ this.logger.debug(`Confirmed S3 bucket ${physicalId} (${logicalId}) lives in ${wantRegion} before deleting it`);
20089
+ return;
20090
+ }
20091
+ throw markNonRetryable(new ProvisioningError(`Refusing to delete S3 bucket ${physicalId} for ${logicalId} (${resourceType}): the bucket carrying that name lives in ${actualRegion}, while this destroy targets ${wantRegion}. S3 bucket names are globally unique, so a physical id recorded in cdkd state can denote a bucket in a different region. S3 follows the region redirect for a body-bearing operation, so issuing this delete risks destroying the live bucket in ${actualRegion} instead, unrecoverably, rather than reporting the bucket absent. Confirm the physical id recorded in cdkd state (cdkd state show) and correct the record: --region does not change this comparison, which reads the region stored in the state file, so re-running the destroy with a different flag value will not resolve it.`, resourceType, logicalId, physicalId));
20092
+ }
20093
+
19783
20094
  // src/provisioning/delete-gone-wait.ts
19784
20095
  async function waitForGoneAfterDelete(opts) {
19785
20096
  const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
@@ -19982,7 +20293,7 @@ async function deleteInIdLogScope(logicalId, physicalId, resourceType, propertie
19982
20293
  const indeterminateGuard = await this.confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context);
19983
20294
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
19984
20295
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
19985
- const { ASGProvider } = await import("./asg-provider-BReZap7O.js");
20296
+ const { ASGProvider } = await import("./asg-provider-BDCUGWZV.js");
19986
20297
  const delegateRegion = ambientRegion();
19987
20298
  let asgProvider = this.asgDeleteDelegates.get(delegateRegion);
19988
20299
  if (asgProvider === void 0) {
@@ -19991,6 +20302,7 @@ async function deleteInIdLogScope(logicalId, physicalId, resourceType, propertie
19991
20302
  }
19992
20303
  return withIndeterminateGuard(await asgProvider.delete(logicalId, physicalId, resourceType, properties, context), indeterminateGuard);
19993
20304
  }
20305
+ await assertRecordedIdentityBeforeCcDelete.call(this, logicalId, resourceType, physicalId, context);
19994
20306
  if ((context?.deletionPolicy === "Delete" || context?.skipFinalSnapshot === true) && SDK_DELETE_FAMILIES.has(resourceType)) {
19995
20307
  if (deletesThroughSdkProvider(resourceType, properties)) {
19996
20308
  const delegate = await this.sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId);
@@ -20136,7 +20448,7 @@ async function sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId)
20136
20448
  const family = SDK_DELETE_FAMILIES.get(resourceType);
20137
20449
  const cached = this.sdkDeleteDelegates.get(family);
20138
20450
  if (cached !== void 0 && cached.region === ccRegion) return cached.provider;
20139
- const provider = family === "rds" ? new (await (import("./rds-provider-Cef0DBFH.js"))).RDSProvider({ region: ccRegion }) : new (await (import("./neptune-provider-DM4GhUTb.js"))).NeptuneProvider({ region: ccRegion });
20451
+ const provider = family === "rds" ? new (await (import("./rds-provider-DpOZv_UG.js"))).RDSProvider({ region: ccRegion }) : new (await (import("./neptune-provider-DiyWADaS.js"))).NeptuneProvider({ region: ccRegion });
20140
20452
  this.sdkDeleteDelegates.set(family, {
20141
20453
  region: ccRegion,
20142
20454
  provider
@@ -20158,71 +20470,6 @@ async function ec2ClientInCcRegion(resourceType, logicalId, physicalId) {
20158
20470
  return ec2;
20159
20471
  }
20160
20472
 
20161
- // src/provisioning/cloud-control/delete-identity.ts
20162
- async function assertRecordedRegionAgainstClient(phase, expectedRegion, resourceType, logicalId, physicalId) {
20163
- const recordedRegion = canonicalizeRegion(expectedRegion?.trim());
20164
- if (recordedRegion === void 0 || recordedRegion === "") return;
20165
- let clientRegion;
20166
- try {
20167
- clientRegion = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
20168
- } catch (error) {
20169
- this.logger.debug(`Could not resolve the Cloud Control client region before the ${phase} region check for ${logicalId} (${resourceType}): ${displaySafe(describeAwsFailure(error).detail)}`);
20170
- clientRegion = void 0;
20171
- }
20172
- try {
20173
- assertRegionMatch(clientRegion, recordedRegion, resourceType, logicalId, physicalId, phase);
20174
- } catch (error) {
20175
- throw markNonRetryable(error);
20176
- }
20177
- }
20178
- async function confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context) {
20179
- if (!requiresCcDeleteIdentityCheck(resourceType)) return void 0;
20180
- const recordedRegion = context?.expectedRegion?.trim();
20181
- let expectedRegion = recordedRegion === void 0 || recordedRegion === "" ? void 0 : recordedRegion;
20182
- let clientRegionError;
20183
- if (expectedRegion === void 0) try {
20184
- const clientRegion = (await this.cloudControlClient.config.region())?.trim();
20185
- expectedRegion = clientRegion === void 0 || clientRegion === "" ? void 0 : clientRegion;
20186
- } catch (error) {
20187
- const clientRegionFailure = describeAwsFailure(error);
20188
- clientRegionError = clientRegionFailure.summary;
20189
- this.logger.debug(`Could not resolve the Cloud Control client region while confirming ${physicalId}: ${clientRegionFailure.detail}`);
20190
- expectedRegion = void 0;
20191
- }
20192
- if (expectedRegion === void 0) {
20193
- const reason = clientRegionError === void 0 ? `neither the stack state nor the AWS client reports a region` : `the stack state records no region and the AWS client's region could not be resolved: ${clientRegionError}`;
20194
- this.logger.warn(`Could not confirm that ${resourceType} ${physicalId} (${logicalId}) is the resource this destroy targets: ${reason.replace(/[.\s]+$/, "")}. Proceeding with the delete.`);
20195
- return {
20196
- guard: CC_DELETE_REGION_IDENTITY_GUARD,
20197
- reason
20198
- };
20199
- }
20200
- const wantRegion = canonicalizeRegion(expectedRegion);
20201
- let actualRegion;
20202
- try {
20203
- const location = await getAwsClients().s3.send(new GetBucketLocationCommand({ Bucket: physicalId }));
20204
- actualRegion = bucketLocationToRegion(location.LocationConstraint);
20205
- } catch (error) {
20206
- if (isNoSuchBucketError(error)) {
20207
- this.logger.debug(`Bucket ${physicalId} (${logicalId}) is already absent; leaving the delete to the Cloud Control idempotency path`);
20208
- return;
20209
- }
20210
- const failure = describeAwsFailure(error);
20211
- this.logger.debug(`s3:GetBucketLocation on ${physicalId} (${logicalId}) failed: ${failure.detail}`);
20212
- const summarySentence = failure.summary.replace(/[.\s]+$/, "");
20213
- this.logger.warn(`Could not confirm which region S3 bucket ${physicalId} (${logicalId}) lives in before deleting it: ${summarySentence}. S3 bucket names are globally unique, so cdkd cannot rule out that this name denotes a bucket in another region. Grant s3:GetBucketLocation on the bucket to enable the check. Proceeding with the delete.`);
20214
- return {
20215
- guard: CC_DELETE_REGION_IDENTITY_GUARD,
20216
- reason: `s3:GetBucketLocation on ${physicalId} could not be answered: ${failure.summary}`
20217
- };
20218
- }
20219
- if (actualRegion === wantRegion) {
20220
- this.logger.debug(`Confirmed S3 bucket ${physicalId} (${logicalId}) lives in ${wantRegion} before deleting it`);
20221
- return;
20222
- }
20223
- throw markNonRetryable(new ProvisioningError(`Refusing to delete S3 bucket ${physicalId} for ${logicalId} (${resourceType}): the bucket carrying that name lives in ${actualRegion}, while this destroy targets ${wantRegion}. S3 bucket names are globally unique, so a physical id recorded in cdkd state can denote a bucket in a different region. S3 follows the region redirect for a body-bearing operation, so issuing this delete risks destroying the live bucket in ${actualRegion} instead, unrecoverably, rather than reporting the bucket absent. Confirm the physical id recorded in cdkd state (cdkd state show) and correct the record: --region does not change this comparison, which reads the region stored in the state file, so re-running the destroy with a different flag value will not resolve it.`, resourceType, logicalId, physicalId));
20224
- }
20225
-
20226
20473
  // src/provisioning/cloud-control/protection.ts
20227
20474
  async function disableCcProtection(logicalId, physicalId, resourceType, entry) {
20228
20475
  const protectionProperty = entry.property;
@@ -21841,11 +22088,11 @@ function applyNoEchoDeleteValues(properties, recordedLeaves, values) {
21841
22088
  payload: properties,
21842
22089
  unresolved: []
21843
22090
  };
21844
- const byKey = new Map((values?.leaves ?? []).map((leaf) => [canonicalJson$6(leaf.coordinate), leaf]));
22091
+ const byKey = new Map((values?.leaves ?? []).map((leaf) => [canonicalJson$7(leaf.coordinate), leaf]));
21845
22092
  const entries = [];
21846
22093
  const unresolved = [];
21847
22094
  for (const coordinate of masked) {
21848
- const leaf = byKey.get(canonicalJson$6(coordinate));
22095
+ const leaf = byKey.get(canonicalJson$7(coordinate));
21849
22096
  if (leaf === void 0) unresolved.push(coordinate);
21850
22097
  else entries.push({
21851
22098
  coordinate,
@@ -21896,7 +22143,7 @@ async function noEchoDeleteValuesFromResolved(options) {
21896
22143
  const fingerprinter = options.inputSources === void 0 ? void 0 : inputFingerprinter(templateProps, options.inputSources);
21897
22144
  const leaves = [];
21898
22145
  for (const coordinate of masked) {
21899
- if (!nodes.has(canonicalJson$6(coordinate))) continue;
22146
+ if (!nodes.has(canonicalJson$7(coordinate))) continue;
21900
22147
  if (!await fingerprintsUnchanged(record, templateProps, coordinate, fingerprinter)) continue;
21901
22148
  const value = valueAtCoordinate(resolvedProperties, coordinate);
21902
22149
  if (value === void 0 || carriesSecretMask(value)) continue;
@@ -22075,7 +22322,7 @@ var TemplateNoEchoReresolver = class TemplateNoEchoReresolver {
22075
22322
  const bag = await this.noEchoNeedles();
22076
22323
  const leaves = [];
22077
22324
  for (const coordinate of masked) {
22078
- const key = canonicalJson$6(coordinate);
22325
+ const key = canonicalJson$7(coordinate);
22079
22326
  if (!nodes.has(key)) continue;
22080
22327
  const node = nodes.get(key)?.node;
22081
22328
  if (!readsParametersOnly(node, declared, refused)) continue;
@@ -22777,7 +23024,7 @@ async function publishToSns(topicArn, request) {
22777
23024
  }
22778
23025
  async function invokeLambda(serviceToken, request) {
22779
23026
  if (localCustomResourceRuntimeActive()) {
22780
- const { invokeCustomResourceFunctionLocally } = await import("./custom-resource-runtime-CpziCILQ.js");
23027
+ const { invokeCustomResourceFunctionLocally } = await import("./custom-resource-runtime-DMkX_oQo.js");
22781
23028
  const local = await invokeCustomResourceFunctionLocally({
22782
23029
  lambda: this.lambdaClient,
22783
23030
  s3: this.s3Client
@@ -23258,6 +23505,217 @@ var CustomResourceProvider = class CustomResourceProvider {
23258
23505
  }
23259
23506
  };
23260
23507
 
23508
+ // src/provisioning/wait-condition-signal-versions.ts
23509
+ async function listSignalVersions(client, bucket, key, owner) {
23510
+ const versions = [];
23511
+ let keyMarker;
23512
+ let versionIdMarker;
23513
+ do {
23514
+ const page = await client.send(new ListObjectVersionsCommand({
23515
+ Bucket: bucket,
23516
+ Prefix: key,
23517
+ ...owner,
23518
+ EncodingType: "url",
23519
+ ...keyMarker !== void 0 && { KeyMarker: keyMarker },
23520
+ ...versionIdMarker !== void 0 && { VersionIdMarker: versionIdMarker }
23521
+ }));
23522
+ for (const v of page.Versions ?? []) {
23523
+ if (typeof v.VersionId !== "string") continue;
23524
+ let listed;
23525
+ try {
23526
+ listed = decodeListingKey(v.Key);
23527
+ } catch {
23528
+ continue;
23529
+ }
23530
+ if (listed === key) versions.push({
23531
+ versionId: v.VersionId,
23532
+ size: v.Size ?? 0
23533
+ });
23534
+ }
23535
+ keyMarker = page.IsTruncated ? decodeListingKey(page.NextKeyMarker) : void 0;
23536
+ versionIdMarker = page.IsTruncated ? page.NextVersionIdMarker : void 0;
23537
+ } while (keyMarker !== void 0);
23538
+ return versions.reverse();
23539
+ }
23540
+
23541
+ // src/provisioning/wait-condition-signal-store.ts
23542
+ const SIGNAL_URL_EXPIRES_IN_SECONDS = 604800;
23543
+ const MAX_SIGNAL_BYTES = 65536;
23544
+ const LEGACY_HANDLE_ID_PREFIX = "cdkd-wait-condition-handle-";
23545
+ const SIGNAL_KEY = new RegExp(`^${WAIT_CONDITION_SIGNAL_PREFIX}/[A-Za-z0-9]{1,255}-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.json$`);
23546
+ function signalKeyFor(logicalId) {
23547
+ return `${WAIT_CONDITION_SIGNAL_PREFIX}/${logicalId}-${randomUUID()}.json`;
23548
+ }
23549
+ function classifyHandleUrl(handle, bucket) {
23550
+ if (handle.startsWith("cdkd-wait-condition-handle-")) return { kind: "legacy" };
23551
+ let parsed;
23552
+ try {
23553
+ parsed = new URL(handle);
23554
+ } catch {
23555
+ return { kind: "foreign" };
23556
+ }
23557
+ const marker = `/${WAIT_CONDITION_SIGNAL_PREFIX}/`;
23558
+ const at = parsed.pathname.lastIndexOf(marker);
23559
+ if (at < 0) return { kind: "foreign" };
23560
+ let key;
23561
+ try {
23562
+ key = decodeURIComponent(parsed.pathname.slice(at + 1));
23563
+ } catch {
23564
+ return { kind: "foreign" };
23565
+ }
23566
+ if (!SIGNAL_KEY.test(key)) return { kind: "foreign" };
23567
+ const before = parsed.pathname.slice(0, at);
23568
+ return before === `/${bucket}` || before === "" && parsed.hostname.startsWith(`${bucket}.`) ? {
23569
+ kind: "ours",
23570
+ key
23571
+ } : { kind: "foreign" };
23572
+ }
23573
+ function parseSignalBody(body) {
23574
+ let doc;
23575
+ try {
23576
+ doc = JSON.parse(body);
23577
+ } catch {
23578
+ return;
23579
+ }
23580
+ if (doc === null || typeof doc !== "object" || Array.isArray(doc)) return void 0;
23581
+ const d = doc;
23582
+ const status = typeof d["Status"] === "string" ? d["Status"].toUpperCase() : void 0;
23583
+ if (status !== "SUCCESS" && status !== "FAILURE") return void 0;
23584
+ const text = (v) => v === void 0 || v === null ? "" : typeof v === "string" ? v : JSON.stringify(v);
23585
+ return {
23586
+ status,
23587
+ uniqueId: text(d["UniqueId"]),
23588
+ data: text(d["Data"]),
23589
+ reason: text(d["Reason"])
23590
+ };
23591
+ }
23592
+ function evaluateSignals(signals, count) {
23593
+ const data = /* @__PURE__ */ new Map();
23594
+ if (count <= 0) return {
23595
+ state: "succeeded",
23596
+ data: {}
23597
+ };
23598
+ for (const signal of signals) {
23599
+ if (signal.status === "FAILURE") return {
23600
+ state: "failed",
23601
+ signal
23602
+ };
23603
+ data.set(signal.uniqueId, signal.data);
23604
+ if (data.size >= count) return {
23605
+ state: "succeeded",
23606
+ data: Object.fromEntries(data)
23607
+ };
23608
+ }
23609
+ return {
23610
+ state: "pending",
23611
+ successes: data.size
23612
+ };
23613
+ }
23614
+ var WaitConditionSignalStore = class {
23615
+ bucket;
23616
+ clients = /* @__PURE__ */ new WeakMap();
23617
+ logger = getLogger().child("WaitConditionSignalStore");
23618
+ setBucket(bucket) {
23619
+ this.bucket = bucket;
23620
+ }
23621
+ requireBucket() {
23622
+ if (this.bucket === void 0 || this.bucket === "") throw new Error("No cdkd state bucket is configured, so no wait condition signal URL can be issued.");
23623
+ return this.bucket;
23624
+ }
23625
+ client() {
23626
+ const base = getAwsClients().s3;
23627
+ const bucket = this.requireBucket();
23628
+ let resolved = this.clients.get(base);
23629
+ if (resolved === void 0) {
23630
+ resolved = rebuildClientForBucketRegion(base, bucket, {
23631
+ reuseClientCredentials: true,
23632
+ tolerateNonStandardClient: true
23633
+ }).then((rebuilt) => rebuilt ?? base);
23634
+ this.clients.set(base, resolved);
23635
+ resolved.catch(() => {
23636
+ if (this.clients.get(base) === resolved) this.clients.delete(base);
23637
+ });
23638
+ }
23639
+ return resolved;
23640
+ }
23641
+ async issueSignalUrl(logicalId) {
23642
+ const bucket = this.requireBucket();
23643
+ const client = await this.client();
23644
+ const key = signalKeyFor(logicalId);
23645
+ const url = await getSignedUrl(client, new PutObjectCommand({
23646
+ Bucket: bucket,
23647
+ Key: key
23648
+ }), { expiresIn: SIGNAL_URL_EXPIRES_IN_SECONDS });
23649
+ let expiresAt = new Date(Date.now() + SIGNAL_URL_EXPIRES_IN_SECONDS * 1e3);
23650
+ try {
23651
+ const provider = client.config?.credentials;
23652
+ const creds = typeof provider === "function" ? await provider() : void 0;
23653
+ if (creds?.expiration instanceof Date && creds.expiration < expiresAt) expiresAt = creds.expiration;
23654
+ } catch {}
23655
+ return {
23656
+ url,
23657
+ key,
23658
+ expiresAt
23659
+ };
23660
+ }
23661
+ async readSignals(key, seen, maxVersions = Infinity) {
23662
+ const bucket = this.requireBucket();
23663
+ const client = await this.client();
23664
+ const owner = await expectedOwnerParam(client);
23665
+ const versions = await listSignalVersions(client, bucket, key, owner);
23666
+ if (versions.length > maxVersions) throw Object.assign(/* @__PURE__ */ new Error(`${versions.length} signal versions exceed the limit of ${maxVersions}`), { name: "WaitConditionSignalFlood" });
23667
+ const signals = [];
23668
+ for (const { versionId, size } of versions) {
23669
+ if (!seen.has(versionId)) seen.set(versionId, await this.readVersion(client, bucket, key, versionId, size, owner));
23670
+ const signal = seen.get(versionId);
23671
+ if (signal) signals.push(signal);
23672
+ }
23673
+ return signals;
23674
+ }
23675
+ async readVersion(client, bucket, key, versionId, size, owner) {
23676
+ if (size === 0) return null;
23677
+ if (size > 65536) {
23678
+ this.logger.warn(safeMsg`Ignoring a wait condition signal of ${size} bytes (over ${MAX_SIGNAL_BYTES}).`);
23679
+ return null;
23680
+ }
23681
+ const body = await (await client.send(new GetObjectCommand({
23682
+ Bucket: bucket,
23683
+ Key: key,
23684
+ VersionId: versionId,
23685
+ ...owner
23686
+ }))).Body?.transformToString() ?? "";
23687
+ const signal = parseSignalBody(body);
23688
+ if (signal === void 0) {
23689
+ this.logger.warn(safeMsg`Ignoring a wait condition signal that is not a {"Status": "SUCCESS" | "FAILURE", ...} document (${body.length} bytes).`);
23690
+ return null;
23691
+ }
23692
+ return signal;
23693
+ }
23694
+ async deleteSignals(key) {
23695
+ try {
23696
+ const bucket = this.requireBucket();
23697
+ const client = await this.client();
23698
+ const owner = await expectedOwnerParam(client);
23699
+ const deleted = await client.send(new DeleteObjectCommand({
23700
+ Bucket: bucket,
23701
+ Key: key,
23702
+ ...owner
23703
+ }));
23704
+ await purgeNoncurrentKeyVersions(client, bucket, [key], { requestFields: owner });
23705
+ if (deleted.DeleteMarker === true && typeof deleted.VersionId === "string") await client.send(new DeleteObjectCommand({
23706
+ Bucket: bucket,
23707
+ Key: key,
23708
+ VersionId: deleted.VersionId,
23709
+ ...owner
23710
+ }));
23711
+ } catch (error) {
23712
+ const failure = describeAwsFailure(error);
23713
+ this.logger.warn(safeMsg`Could not remove the wait condition signal object ${key}: ${failure.summary}`);
23714
+ this.logger.debug(safeMsg`Signal object delete failure detail: ${failure.detail}`);
23715
+ }
23716
+ }
23717
+ };
23718
+
23261
23719
  // src/provisioning/provider-registry/routing.ts
23262
23720
  function getProviderFor(input) {
23263
23721
  const debug = (message) => {
@@ -25836,6 +26294,7 @@ var ProviderRegistry = class {
25836
26294
  providers = /* @__PURE__ */ new Map();
25837
26295
  cloudControlProvider;
25838
26296
  customResourceProvider;
26297
+ waitConditionSignals = new WaitConditionSignalStore();
25839
26298
  skipResourceTypes = /* @__PURE__ */ new Set();
25840
26299
  allowedUnsupportedTypes = /* @__PURE__ */ new Set();
25841
26300
  allowedUnsupportedProperties = /* @__PURE__ */ new Set();
@@ -25860,6 +26319,7 @@ var ProviderRegistry = class {
25860
26319
  }
25861
26320
  setCustomResourceResponseBucket(bucket) {
25862
26321
  this.customResourceProvider.setResponseBucket(bucket);
26322
+ this.waitConditionSignals.setBucket(bucket);
25863
26323
  this.logger.debug(`Custom resource response bucket set to: ${bucket}`);
25864
26324
  }
25865
26325
  skipResourceType(resourceType) {
@@ -25936,6 +26396,292 @@ function isCustomResource(resourceType) {
25936
26396
  return resourceType.startsWith("Custom::") || resourceType === "AWS::CloudFormation::CustomResource";
25937
26397
  }
25938
26398
 
26399
+ // src/provisioning/policy-document-content.ts
26400
+ const MASK = "***";
26401
+ const PERMANENT_CDKD_CODES = /* @__PURE__ */ new Set(["ROLLBACK_SECRET_TOKEN_SCAN_MISMATCH"]);
26402
+ const MARKED_PERMANENT_CODE_PREFIXES = ["INTRINSIC_RESOLUTION_REFUSAL", "ROLLBACK_SECRET_REGION_AMBIGUOUS"];
26403
+ const NOT_FOUND_ERROR_NAMES = /* @__PURE__ */ new Set([
26404
+ "ResourceNotFoundException",
26405
+ "ParameterNotFound",
26406
+ "ParameterVersionNotFound"
26407
+ ]);
26408
+ function holdsUnresolvedValue(document) {
26409
+ let root = document;
26410
+ if (typeof document === "string") try {
26411
+ root = JSON.parse(document);
26412
+ } catch {
26413
+ root = document;
26414
+ }
26415
+ const walk = (v) => {
26416
+ if (typeof v === "string") return v === MASK || v.includes("{{resolve:");
26417
+ if (Array.isArray(v)) return v.some(walk);
26418
+ if (v !== null && typeof v === "object") return Object.values(v).some(walk);
26419
+ return false;
26420
+ };
26421
+ return walk(root);
26422
+ }
26423
+ function isPermanentResolutionError(error) {
26424
+ let current = error;
26425
+ for (let depth = 0; depth < 5 && current != null; depth++) {
26426
+ const e = current;
26427
+ if (typeof e.name === "string" && NOT_FOUND_ERROR_NAMES.has(e.name)) return true;
26428
+ if (typeof e.code === "string") {
26429
+ if (PERMANENT_CDKD_CODES.has(e.code)) return true;
26430
+ const code = e.code;
26431
+ if (MARKED_PERMANENT_CODE_PREFIXES.some((p) => code.startsWith(p)) && isMarkedNonRetryable(current)) return true;
26432
+ }
26433
+ if (typeof e.message === "string" && e.message.startsWith("Dynamic reference: ")) return true;
26434
+ current = e.cause;
26435
+ }
26436
+ return false;
26437
+ }
26438
+ function errorName(error) {
26439
+ const name = error?.name;
26440
+ return typeof name === "string" && /^[\w.-]{1,128}$/.test(name) ? name : "error";
26441
+ }
26442
+ async function attemptedPolicyDocument(recorded, resolve) {
26443
+ let document = recorded;
26444
+ if (resolve) try {
26445
+ document = await resolve();
26446
+ } catch (error) {
26447
+ return isPermanentResolutionError(error) ? {
26448
+ kind: "unusable",
26449
+ why: "a secret it references does not exist or cannot be used"
26450
+ } : {
26451
+ kind: "retry",
26452
+ errorName: errorName(error)
26453
+ };
26454
+ }
26455
+ if (!(typeof document === "string" && document.length > 0 || document !== null && typeof document === "object")) return {
26456
+ kind: "unusable",
26457
+ why: "no policy document it attempted is recorded"
26458
+ };
26459
+ if (holdsUnresolvedValue(document)) return {
26460
+ kind: "unusable",
26461
+ why: "its policy document still holds a secret reference or masked value"
26462
+ };
26463
+ return {
26464
+ kind: "document",
26465
+ document
26466
+ };
26467
+ }
26468
+ const ACCOUNT_ID = /^\d{12}$/;
26469
+ const ACCOUNT_ROOT_ARN = /^arn:[a-z-]+:iam::(\d{12}):root$/;
26470
+ const LIST_KEYS = [
26471
+ "Action",
26472
+ "NotAction",
26473
+ "Resource",
26474
+ "NotResource"
26475
+ ];
26476
+ const PRINCIPAL_KEYS = ["Principal", "NotPrincipal"];
26477
+ function unwrapSingle(value) {
26478
+ return Array.isArray(value) && value.length === 1 ? value[0] : value;
26479
+ }
26480
+ function accountKey(value) {
26481
+ if (typeof value !== "string") return value;
26482
+ if (ACCOUNT_ID.test(value)) return `account:${value}`;
26483
+ const m = ACCOUNT_ROOT_ARN.exec(value);
26484
+ return m ? `account:${m[1]}` : value;
26485
+ }
26486
+ const ANYONE = "anyone:*";
26487
+ function normalizePrincipal(principal) {
26488
+ if (principal === "*") return ANYONE;
26489
+ if (principal === null || typeof principal !== "object" || Array.isArray(principal)) return principal;
26490
+ const keys = Object.keys(principal);
26491
+ if (keys.length === 1 && keys[0] === "AWS" && unwrapSingle(principal["AWS"]) === "*") return ANYONE;
26492
+ const out = {};
26493
+ for (const [key, raw] of Object.entries(principal)) out[key] = unwrapSingle(key === "AWS" ? Array.isArray(raw) ? raw.map(accountKey) : accountKey(raw) : raw);
26494
+ return out;
26495
+ }
26496
+ function normalizeStatement(statement) {
26497
+ if (statement === null || typeof statement !== "object" || Array.isArray(statement)) return statement;
26498
+ const out = { ...statement };
26499
+ for (const key of LIST_KEYS) if (Object.prototype.hasOwnProperty.call(out, key)) out[key] = unwrapSingle(out[key]);
26500
+ for (const key of PRINCIPAL_KEYS) if (Object.prototype.hasOwnProperty.call(out, key)) out[key] = normalizePrincipal(out[key]);
26501
+ return out;
26502
+ }
26503
+ function canonicalJson$5(value) {
26504
+ const sortKeys = (v) => {
26505
+ if (Array.isArray(v)) return v.map(sortKeys);
26506
+ if (v !== null && typeof v === "object") {
26507
+ const out = Object.create(null);
26508
+ for (const key of Object.keys(v).sort()) out[key] = sortKeys(v[key]);
26509
+ return out;
26510
+ }
26511
+ return v;
26512
+ };
26513
+ return JSON.stringify(sortKeys(value));
26514
+ }
26515
+ function policyContentKey(document) {
26516
+ let value = document;
26517
+ if (typeof document === "string") try {
26518
+ value = JSON.parse(document);
26519
+ } catch {
26520
+ return `raw:${document}`;
26521
+ }
26522
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
26523
+ const doc = { ...value };
26524
+ if (Object.prototype.hasOwnProperty.call(doc, "Statement")) doc["Statement"] = (Array.isArray(doc["Statement"]) ? doc["Statement"] : [doc["Statement"]]).map(normalizeStatement);
26525
+ value = doc;
26526
+ }
26527
+ return canonicalJson$5(value);
26528
+ }
26529
+
26530
+ // src/provisioning/settle-after-own-write.ts
26531
+ const OWN_WRITE_REREAD_DELAYS_MS = [
26532
+ 500,
26533
+ 1e3,
26534
+ 2e3
26535
+ ];
26536
+ async function reReadUntilSettled(read, settled, delaysMs) {
26537
+ let answer = await read();
26538
+ for (const delayMs of delaysMs) {
26539
+ if (settled(answer)) return {
26540
+ answer,
26541
+ settled: true
26542
+ };
26543
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
26544
+ answer = await read();
26545
+ }
26546
+ return {
26547
+ answer,
26548
+ settled: settled(answer)
26549
+ };
26550
+ }
26551
+ function memberReadFailure(err) {
26552
+ return isThrottlingError(err) || isTransientServerError(err) || isAmbiguousOutcomeError(err) ? "failed" : "refused";
26553
+ }
26554
+ async function settleDeclaredMember(first, read, matches, declared, delaysMs, unsettled) {
26555
+ const settled = (answer) => typeof answer === "object" && matches(answer.value);
26556
+ if (first === "refused" || settled(first)) return first;
26557
+ let newest = first;
26558
+ for (const delayMs of delaysMs) {
26559
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
26560
+ let answer;
26561
+ try {
26562
+ answer = await read();
26563
+ } catch (err) {
26564
+ answer = memberReadFailure(err);
26565
+ }
26566
+ if (answer === "refused") break;
26567
+ if (answer !== "failed") newest = answer;
26568
+ if (settled(newest)) return newest;
26569
+ }
26570
+ if (newest !== "failed") unsettled();
26571
+ return newest === "absent" ? { value: declared } : newest;
26572
+ }
26573
+ function warnUnsettledMember(logger, logicalId, resourceType, memberKey) {
26574
+ logger.warn(safeMsg`${resourceType} ${logicalId}: the read right after the write never showed the declared ${memberKey}, so its drift baseline may not match the live resource; run ${proseQuoted(cdkdRemedy("cdkd state refresh-observed"))} on the stack to re-capture it`);
26575
+ }
26576
+ function declaredMemberDocument(value) {
26577
+ if (typeof value === "string") {
26578
+ if (value === "") return void 0;
26579
+ try {
26580
+ return JSON.parse(value);
26581
+ } catch {
26582
+ return value;
26583
+ }
26584
+ }
26585
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
26586
+ }
26587
+ const KMS_DEFAULT_KEY_POLICY_ID = "key-default-1";
26588
+ const EFS_FILE_SYSTEM_ARN = /^arn:[a-z-]+:elasticfilesystem:[a-z0-9-]+:\d{12}:file-system\/fs-[0-9a-f]+$/;
26589
+ function efsPolicyMatchesDeclared(answer, declared, fileSystemId) {
26590
+ return policyDocumentMatchesDeclared(withoutAddedResource(answer, declared, fileSystemId), declared);
26591
+ }
26592
+ function withoutAddedResource(answer, declared, fileSystemId) {
26593
+ const parse = (doc) => {
26594
+ if (typeof doc !== "string") return doc;
26595
+ try {
26596
+ return JSON.parse(doc);
26597
+ } catch {
26598
+ return doc;
26599
+ }
26600
+ };
26601
+ const read = parse(answer);
26602
+ const want = parse(declared);
26603
+ const statements = (doc) => {
26604
+ if (typeof doc !== "object" || doc === null || Array.isArray(doc)) return void 0;
26605
+ const s = doc["Statement"];
26606
+ return s === void 0 ? void 0 : Array.isArray(s) ? s : [s];
26607
+ };
26608
+ const readStatements = statements(read);
26609
+ const wantStatements = statements(want);
26610
+ if (readStatements === void 0 || wantStatements === void 0) return answer;
26611
+ return {
26612
+ ...read,
26613
+ Statement: readStatements.map((entry, index) => {
26614
+ const wanted = wantStatements[index];
26615
+ if (typeof entry !== "object" || entry === null || typeof wanted !== "object" || wanted === null || Object.prototype.hasOwnProperty.call(wanted, "Resource")) return entry;
26616
+ const resource = entry["Resource"];
26617
+ if (typeof resource !== "string" || !EFS_FILE_SYSTEM_ARN.test(resource) || fileSystemId !== void 0 && !resource.endsWith(`:file-system/${fileSystemId}`)) return entry;
26618
+ const { Resource: _added, ...rest } = entry;
26619
+ return rest;
26620
+ })
26621
+ };
26622
+ }
26623
+ function declaredPolicyDocument(properties) {
26624
+ if (typeof properties !== "object" || properties === null || Array.isArray(properties)) return;
26625
+ const doc = properties["PolicyDocument"];
26626
+ if (typeof doc === "string") return doc === "" ? void 0 : doc;
26627
+ return typeof doc === "object" && doc !== null && !Array.isArray(doc) ? doc : void 0;
26628
+ }
26629
+ function policyDocumentMatchesDeclared(answer, declared) {
26630
+ return answer !== void 0 && policyContentKey(foldConditionValues(answer)) === policyContentKey(foldConditionValues(declared));
26631
+ }
26632
+ function foldConditionValues(document) {
26633
+ let doc = document;
26634
+ if (typeof doc === "string") try {
26635
+ doc = JSON.parse(doc);
26636
+ } catch {
26637
+ return document;
26638
+ }
26639
+ if (typeof doc !== "object" || doc === null || Array.isArray(doc)) return doc;
26640
+ const statement = doc["Statement"];
26641
+ if (statement === void 0) return doc;
26642
+ const statements = Array.isArray(statement) ? statement : [statement];
26643
+ return {
26644
+ ...doc,
26645
+ Statement: statements.map((entry) => {
26646
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return entry;
26647
+ const condition = entry["Condition"];
26648
+ if (typeof condition !== "object" || condition === null || Array.isArray(condition)) return entry;
26649
+ const folded = {};
26650
+ for (const [operator, block] of Object.entries(condition)) {
26651
+ if (typeof block !== "object" || block === null || Array.isArray(block)) {
26652
+ folded[operator] = block;
26653
+ continue;
26654
+ }
26655
+ const values = {};
26656
+ for (const [key, value] of Object.entries(block)) values[key] = Array.isArray(value) && value.length === 1 ? value[0] : value;
26657
+ folded[operator] = values;
26658
+ }
26659
+ return {
26660
+ ...entry,
26661
+ Condition: folded
26662
+ };
26663
+ })
26664
+ };
26665
+ }
26666
+ const SNS_DEFAULT_POLICY_ID = "__default_policy_ID";
26667
+ const LAMBDA_PERMISSION_STATEMENT_KEYS = [
26668
+ "Action",
26669
+ "Principal",
26670
+ "SourceArn",
26671
+ "SourceAccount",
26672
+ "PrincipalOrgID",
26673
+ "InvokedViaFunctionUrl"
26674
+ ];
26675
+ function lambdaPermissionMatchesDeclared(read, declared) {
26676
+ return LAMBDA_PERMISSION_STATEMENT_KEYS.every((key) => {
26677
+ if (key === "InvokedViaFunctionUrl") return read[key] === true === (coerceCfnBoolean(declared[key]) === true);
26678
+ const want = declared[key];
26679
+ const got = read[key];
26680
+ if (want === void 0 || want === null || want === "") return got === void 0;
26681
+ return key === "Principal" ? accountKey(got) === accountKey(want) : got === want;
26682
+ });
26683
+ }
26684
+
25939
26685
  // src/provisioning/iam-sibling-managed-policies.ts
25940
26686
  const ATTACHMENT_FIELD = {
25941
26687
  "AWS::IAM::Role": "Roles",
@@ -26774,7 +27520,7 @@ async function ccRoutedInstanceTakesNoSnapshot(input) {
26774
27520
  if (resourceType !== "AWS::RDS::DBInstance") return false;
26775
27521
  if (region === void 0 || region === "") return false;
26776
27522
  const mask = input.mask ?? ((text) => text);
26777
- const { describeDBInstanceInRegion, isLiveReadReplica } = await import("./read-replica-DCjUkLOl.js").then((n) => n.l);
27523
+ const { describeDBInstanceInRegion, isLiveReadReplica } = await import("./read-replica-Ct0oakPU.js").then((n) => n.l);
26778
27524
  let reason;
26779
27525
  try {
26780
27526
  const live = await describeDBInstanceInRegion(physicalId, region);
@@ -28325,12 +29071,12 @@ const gray = (s) => `${codes.gray}${s}${codes.reset}`;
28325
29071
  const bold = (s) => `${codes.bright}${s}${codes.reset}`;
28326
29072
 
28327
29073
  // src/deployment/delete-guard-scope.ts
28328
- const storage$1 = new AsyncLocalStorage();
29074
+ const storage$2 = new AsyncLocalStorage();
28329
29075
  function collectDeleteGuards(sink, fn) {
28330
- return storage$1.run(sink, fn);
29076
+ return storage$2.run(sink, fn);
28331
29077
  }
28332
29078
  function reportDeleteGuards(result, target) {
28333
- const sink = storage$1.getStore();
29079
+ const sink = storage$2.getStore();
28334
29080
  if (!sink) return;
28335
29081
  for (const guard of deleteIndeterminateGuards(result)) sink.push({
28336
29082
  guard: guard.guard,
@@ -28687,183 +29433,6 @@ function isReplacementNameRefusal(error, logicalId) {
28687
29433
  return false;
28688
29434
  }
28689
29435
 
28690
- // src/deployment/superseded-resources.ts
28691
- function supersededResourcesOf(state) {
28692
- const rows = state?.supersededResources;
28693
- if (!Array.isArray(rows)) return [];
28694
- return rows.filter(isSupersededResourceRecord);
28695
- }
28696
- function isSupersededResourceRecord(row) {
28697
- if (typeof row !== "object" || row === null) return false;
28698
- const entry = row;
28699
- const record = entry["state"];
28700
- if (typeof entry["logicalId"] !== "string") return false;
28701
- if (typeof record !== "object" || record === null) return false;
28702
- const { physicalId, resourceType, properties } = record;
28703
- return typeof physicalId === "string" && physicalId !== "" && typeof resourceType === "string" && resourceType !== "" && typeof properties === "object" && properties !== null && !Array.isArray(properties);
28704
- }
28705
- function isSupersededHeld(entry, resources) {
28706
- return supersededHolderOf(entry, resources) !== void 0;
28707
- }
28708
- function supersededHolderOf(entry, resources) {
28709
- const holders = Object.values(resources).filter((record) => typeof record === "object" && record !== null && record.physicalId === entry.state.physicalId);
28710
- return holders.find((record) => record.resourceType === entry.state.resourceType) ?? holders[0];
28711
- }
28712
- function isSupersededHeldBySameType(entry, resources) {
28713
- return Object.values(resources).some((record) => typeof record === "object" && record !== null && record.physicalId === entry.state.physicalId && record.resourceType === entry.state.resourceType);
28714
- }
28715
- function supersededHeldByOtherTypeWarning(entry, holderType) {
28716
- return `the superseded ${entry.state.resourceType} of ${entry.logicalId} (${entry.state.physicalId}) was not deleted: a ${holderType} record of this stack has the same physical id, and cdkd never deletes an id a record names. If the ${entry.state.resourceType} still exists, delete it by hand; it is no longer tracked in state.`;
28717
- }
28718
- function addSuperseded(host, entry) {
28719
- host.supersededResources = [...(Array.isArray(host.supersededResources) ? host.supersededResources : []).filter((row) => !isSupersededResourceRecord(row) || row.state.physicalId !== entry.state.physicalId || row.state.resourceType !== entry.state.resourceType), entry];
28720
- }
28721
- function canRecordSuperseded(record, deleteContext) {
28722
- if (deleteNeedsThisRunsNoEchoValues(record, deleteContext.noEchoDeleteValues)) return false;
28723
- if (deleteContext.persistedRecord !== true && Array.isArray(record.noEchoLeaves) && record.noEchoLeaves.length > 0) return false;
28724
- if (deleteContext.inlinePolicyClaimed !== void 0) return false;
28725
- return !INLINE_POLICY_TYPES.has(record.resourceType);
28726
- }
28727
- function deleteNeedsThisRunsNoEchoValues(record, noEchoDeleteValues) {
28728
- if (noEchoDeleteValues !== void 0) return true;
28729
- return readsNoEchoDeleteValues(record.resourceType) && Array.isArray(record.noEchoLeaves) && record.noEchoLeaves.length > 0;
28730
- }
28731
- function isInlinePolicyType(resourceType) {
28732
- return INLINE_POLICY_TYPES.has(resourceType);
28733
- }
28734
- const INLINE_POLICY_TYPES = /* @__PURE__ */ new Set([
28735
- "AWS::IAM::Policy",
28736
- "AWS::IAM::RolePolicy",
28737
- "AWS::IAM::UserPolicy",
28738
- "AWS::IAM::GroupPolicy"
28739
- ]);
28740
- function removeSuperseded(host, entry) {
28741
- if (!Array.isArray(host.supersededResources)) return;
28742
- const remaining = host.supersededResources.filter((row) => row !== entry);
28743
- if (remaining.length === 0) delete host.supersededResources;
28744
- else host.supersededResources = remaining;
28745
- }
28746
- function supersededAfterRollback(base, pending, resources) {
28747
- const added = Array.isArray(pending.supersededResources) ? pending.supersededResources : [];
28748
- const all = [...ownNotPending(base, added).filter((entry) => !isSupersededResourceRecord(entry) || !isSupersededHeldBySameType(entry, resources)), ...added];
28749
- return all.length > 0 ? { supersededResources: all } : {};
28750
- }
28751
- function ownNotPending(base, added) {
28752
- return (Array.isArray(base.supersededResources) ? base.supersededResources : []).filter((entry) => !added.some((a) => a.state.physicalId === entry.state.physicalId && a.state.resourceType === entry.state.resourceType));
28753
- }
28754
- const SUPERSEDED_KEPT_REMEDY = "cdkd keeps it in state: the next `cdkd deploy` of this stack retries the delete, and `cdkd destroy` deletes it";
28755
- function withoutSuperseded(state) {
28756
- const { supersededResources: _dropped, ...rest } = state;
28757
- return rest;
28758
- }
28759
- async function deleteSupersededEntry(entry, input) {
28760
- const record = entry.state;
28761
- const owesSnapshot = entry.skipFinalSnapshot !== true && entry.finalSnapshotIdentifier !== void 0 && PRE_DELETE_SNAPSHOT_TYPES.has(record.resourceType);
28762
- if (owesSnapshot) {
28763
- if (input.preDeleteSnapshot === void 0) return {
28764
- kind: "failed",
28765
- error: new CdkdError(`The final snapshot of ${entry.logicalId}'s superseded ${record.resourceType} could not be taken here. The resource was NOT deleted.`, "FINAL_SNAPSHOT_FAILED")
28766
- };
28767
- if (input.stop()) return {
28768
- kind: "failed",
28769
- error: new CdkdError(`The run was interrupted before the final snapshot of ${entry.logicalId}'s superseded ${record.resourceType}. The resource was NOT deleted.`, "FINAL_SNAPSHOT_FAILED")
28770
- };
28771
- try {
28772
- await createPreDeleteFinalSnapshot(record.resourceType, record.physicalId, entry.logicalId, input.preDeleteSnapshot.clients, input.preDeleteSnapshot.logger, {
28773
- refuseUnsnapshottableState: true,
28774
- reuseStartedAtOrAfter: Number.isFinite(entry.supersededAt) ? entry.supersededAt : Date.now(),
28775
- stop: input.stop
28776
- });
28777
- } catch (error) {
28778
- return {
28779
- kind: "failed",
28780
- error
28781
- };
28782
- }
28783
- }
28784
- const { finalSnapshotIdentifier: _taken, ...snapshotTaken } = entry;
28785
- const failed = (error) => owesSnapshot ? {
28786
- kind: "failed",
28787
- error,
28788
- replacement: snapshotTaken
28789
- } : {
28790
- kind: "failed",
28791
- error
28792
- };
28793
- let result;
28794
- try {
28795
- const send = () => input.provider.delete(entry.logicalId, record.physicalId, record.resourceType, record.properties, {
28796
- expectedRegion: input.region,
28797
- ...entry.forceDataDelete === true && { forceDataDelete: true },
28798
- ...entry.finalSnapshotIdentifier !== void 0 && !PRE_DELETE_SNAPSHOT_TYPES.has(record.resourceType) && { finalSnapshotIdentifier: entry.finalSnapshotIdentifier },
28799
- deletionPolicy: replacementDeletePolicy(entry.updateReplacePolicy),
28800
- ...entry.skipFinalSnapshot === true && { skipFinalSnapshot: true },
28801
- ...input.removeProtection === true && { removeProtection: true },
28802
- ...input.stackDestroy === true && { stackDestroy: true },
28803
- recordedAttributes: record.attributes,
28804
- recordedCreateOnlyDrops: record.acceptedCreateOnlyDrops,
28805
- recordedNoEchoLeaves: record.noEchoLeaves,
28806
- recordedTypedPayloadLeaves: record.typedPayloadLeaves,
28807
- maskSecrets: input.maskSecrets
28808
- });
28809
- result = input.once === true ? await send() : await retryWhileInUse(send, input.stop);
28810
- } catch (error) {
28811
- return failed(error);
28812
- }
28813
- reportDeleteGuards(result, {
28814
- physicalId: record.physicalId,
28815
- resourceType: record.resourceType,
28816
- provisionedBy: record.provisionedBy
28817
- });
28818
- const reason = deleteSkipReason(result);
28819
- return reason === void 0 ? { kind: "deleted" } : {
28820
- kind: "notDeleted",
28821
- reason
28822
- };
28823
- }
28824
- const supersededInUseRetry = {
28825
- attempts: 6,
28826
- delayMs: 1e4
28827
- };
28828
- const IN_USE_ERROR_NAMES = /* @__PURE__ */ new Set([
28829
- "ResourceInUseException",
28830
- "ResourceInUse",
28831
- "DependencyViolation"
28832
- ]);
28833
- const IN_USE_CONFLICT = /\bare using it\b/;
28834
- function isInUseRefusal(error) {
28835
- for (let current = error, depth = 0; current !== void 0 && depth < 8; depth++) {
28836
- if (typeof current !== "object" || current === null) return false;
28837
- const { name, message } = current;
28838
- if (typeof name === "string" && IN_USE_ERROR_NAMES.has(name)) return true;
28839
- if (name === "ConflictException" && typeof message === "string" && IN_USE_CONFLICT.test(message)) return true;
28840
- current = current.cause;
28841
- }
28842
- return false;
28843
- }
28844
- function isInUseOrConflictRefusal(error) {
28845
- if (isInUseRefusal(error)) return true;
28846
- for (let current = error, depth = 0; current !== void 0 && depth < 8; depth++) {
28847
- if (typeof current !== "object" || current === null) return false;
28848
- if (current.name === "ConflictException") return true;
28849
- current = current.cause;
28850
- }
28851
- return false;
28852
- }
28853
- async function retryWhileInUse(send, stop) {
28854
- for (let attempt = 1;; attempt++) try {
28855
- return await send();
28856
- } catch (error) {
28857
- if (attempt >= supersededInUseRetry.attempts || stop() || !isInUseRefusal(error) || isMarkedNonRetryable(error)) throw error;
28858
- await new Promise((resolve) => setTimeout(resolve, supersededInUseRetry.delayMs));
28859
- if (stop()) throw error;
28860
- }
28861
- }
28862
- function holdsSupersededResources(record) {
28863
- const rows = record.supersededResources;
28864
- return rows !== void 0 && (!Array.isArray(rows) || rows.length > 0);
28865
- }
28866
-
28867
29436
  // src/deployment/rollback-executor/replay-scope.ts
28868
29437
  function withReplayDeletePrinting(scope, fn) {
28869
29438
  const deployBag = scope.ctx.logOnlyNeedlesFor?.(scope.op.logicalId);
@@ -29147,7 +29716,6 @@ async function liveSurvivorRead(ctx, oldType, physicalId) {
29147
29716
  clearTimeout(timer);
29148
29717
  }
29149
29718
  }
29150
- const SURVIVOR_IDENTITY_ATTRIBUTES = { "AWS::IAM::Role": "RoleId" };
29151
29719
  const INTERRUPT_POLL_MS = 250;
29152
29720
  async function probeReplacedSurvivor(s, oldType, timeoutMs = REPLACED_SURVIVOR_PROBE_TIMEOUT_MS) {
29153
29721
  if (s.isInterrupted?.() === true) return "interrupted";
@@ -29225,19 +29793,294 @@ function judgeHolder(s, oldType, existence, read, snapshot) {
29225
29793
  return read.identity === void 0 ? "unknown" : "exists";
29226
29794
  }
29227
29795
  async function identityVerdict(s, physicalId, oldType) {
29228
- const key = SURVIVOR_IDENTITY_ATTRIBUTES[oldType];
29229
- if (key === void 0) return "exists";
29230
- const recorded = s.op.previousState?.attributes?.[key];
29231
- if (typeof recorded !== "string" || recorded === "" || recorded.includes("***")) return "exists";
29796
+ const held = recordedIdentityValue(oldType, s.op.previousState?.attributes);
29797
+ if (held.kind === "no-attribute" || held.kind === "not-recorded") return "identity-unverified";
29798
+ const recorded = recordedIdentityId(oldType, { recordedAttributes: s.op.previousState?.attributes })?.value;
29799
+ if (recorded === void 0) return "identity-uncompared";
29232
29800
  try {
29233
29801
  const provider = s.ctx.providerRegistry.getProvider(oldType);
29234
- if (typeof provider.resourceIdentity !== "function") return "exists";
29802
+ if (typeof provider.resourceIdentity !== "function") return "identity-unverified";
29235
29803
  const live = await withReplayDeletePrinting(s, () => provider.resourceIdentity(physicalId, oldType, { expectedRegion: s.ctx.region }));
29236
29804
  if (live === RESOURCE_NOT_FOUND) return "gone";
29237
- return typeof live === "string" && live !== "" && live !== recorded ? "foreign" : "exists";
29805
+ if (typeof live !== "string" || live === "") return "identity-uncompared";
29806
+ return live === recorded ? "exists" : "foreign";
29238
29807
  } catch {
29239
- return "exists";
29808
+ return "identity-unread";
29809
+ }
29810
+ }
29811
+ function recordedIdentityValue(oldType, attributes) {
29812
+ if (!Object.hasOwn(SURVIVOR_IDENTITY_ATTRIBUTES, oldType)) return { kind: "no-attribute" };
29813
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[oldType];
29814
+ const value = typeof attributes === "object" && attributes !== null && Object.hasOwn(attributes, key) ? attributes[key] : void 0;
29815
+ return value === void 0 || value === null || value === "" ? { kind: "not-recorded" } : {
29816
+ kind: "held",
29817
+ key
29818
+ };
29819
+ }
29820
+ function unverifiedIdentityCause(oldType, attributes, shownType) {
29821
+ const held = recordedIdentityValue(oldType, attributes);
29822
+ if (held.kind === "no-attribute") return `cdkd records no AWS-assigned id for ${shownType} to compare`;
29823
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[oldType];
29824
+ return held.kind === "not-recorded" ? `its state record holds no ${key}: it was written before cdkd recorded one` : `cdkd has no read of the ${key} for ${shownType}`;
29825
+ }
29826
+
29827
+ // src/deployment/journaled-holder.ts
29828
+ const journaledHolderRead = {
29829
+ attempts: 3,
29830
+ delayMs: 2e3
29831
+ };
29832
+ function isUnreadHolder(judged) {
29833
+ return judged === "unreadable" || judged === "interrupted";
29834
+ }
29835
+ async function judgeJournaledHolder(input) {
29836
+ if (input.journaled.split("|")[0] !== canonicalizeRegion(input.region)) return { incomparable: "the recorded generation names another region than the stack's" };
29837
+ try {
29838
+ if (typeof input.provider().replacedSurvivorIdentity !== "function") return { incomparable: "cdkd reads no holder for this resource type" };
29839
+ } catch {
29840
+ return { incomparable: "cdkd reads no holder for this resource type" };
29841
+ }
29842
+ let judged = "unreadable";
29843
+ for (let attempt = 0; attempt < journaledHolderRead.attempts; attempt++) {
29844
+ if (attempt > 0) {
29845
+ if (input.interrupted()) return "interrupted";
29846
+ await new Promise((resolve) => setTimeout(resolve, journaledHolderRead.delayMs));
29847
+ }
29848
+ judged = judge(await readHolder(input), input.journaled, input.resourceType);
29849
+ if (judged !== "unreadable") break;
29850
+ }
29851
+ return judged;
29852
+ }
29853
+ function unreadHolderCause(judged) {
29854
+ return judged === "interrupted" ? "the run was interrupted before cdkd could read what holds that name now to confirm it is the resource the deploy replaced" : "cdkd could not read what holds that name now to confirm it is the resource the deploy replaced";
29855
+ }
29856
+ function incomparableHolderNote(reason) {
29857
+ return `cdkd cannot compare what holds that name now with the generation it recorded (${reason}), so the delete is sent by name, as for an entry recorded without one`;
29858
+ }
29859
+ function notOursHolderCause(resourceType, attribute) {
29860
+ return `the ${resourceType} now under that name is not the one the deploy replaced (its ${attribute} differs from what cdkd read when it deferred the delete), so no delete was sent and that resource was left alone`;
29861
+ }
29862
+ async function readHolder(input) {
29863
+ let timer;
29864
+ try {
29865
+ const provider = input.provider();
29866
+ if (typeof provider.replacedSurvivorIdentity !== "function") return { kind: "unknown" };
29867
+ return await Promise.race([provider.replacedSurvivorIdentity(input.physicalId, input.resourceType, { expectedRegion: input.region }), new Promise((resolve) => {
29868
+ timer = setTimeout(() => resolve({ kind: "unknown" }), DEFERRAL_IDENTITY_TIMEOUT_MS);
29869
+ })]);
29870
+ } catch {
29871
+ return { kind: "unknown" };
29872
+ } finally {
29873
+ clearTimeout(timer);
29874
+ }
29875
+ }
29876
+ function judge(read, journaled, resourceType) {
29877
+ switch (read.kind) {
29878
+ case "gone": return "gone";
29879
+ case "foreign": return { notOurs: read.seen === "other-account" ? "owning account" : "region" };
29880
+ case "unknown": return "unreadable";
29881
+ case "owned":
29882
+ if (read.identity === void 0) return "unreadable";
29883
+ if (read.identity === journaled) return "ours";
29884
+ return journaled.split("|")[0] === SURVIVOR_LIVE_READ_TYPES[resourceType] ? { notOurs: "creation time" } : "ours";
29885
+ }
29886
+ }
29887
+
29888
+ // src/deployment/superseded-resources.ts
29889
+ function supersededResourcesOf(state) {
29890
+ const rows = state?.supersededResources;
29891
+ if (!Array.isArray(rows)) return [];
29892
+ return rows.filter(isSupersededResourceRecord);
29893
+ }
29894
+ function isSupersededResourceRecord(row) {
29895
+ if (typeof row !== "object" || row === null) return false;
29896
+ const entry = row;
29897
+ const record = entry["state"];
29898
+ if (typeof entry["logicalId"] !== "string") return false;
29899
+ if (typeof record !== "object" || record === null) return false;
29900
+ const { physicalId, resourceType, properties } = record;
29901
+ return typeof physicalId === "string" && physicalId !== "" && typeof resourceType === "string" && resourceType !== "" && typeof properties === "object" && properties !== null && !Array.isArray(properties);
29902
+ }
29903
+ function isSupersededHeld(entry, resources) {
29904
+ return supersededHolderOf(entry, resources) !== void 0;
29905
+ }
29906
+ function supersededHolderOf(entry, resources) {
29907
+ const holders = Object.values(resources).filter((record) => typeof record === "object" && record !== null && record.physicalId === entry.state.physicalId);
29908
+ return holders.find((record) => record.resourceType === entry.state.resourceType) ?? holders[0];
29909
+ }
29910
+ function isSupersededHeldBySameType(entry, resources) {
29911
+ return Object.values(resources).some((record) => typeof record === "object" && record !== null && record.physicalId === entry.state.physicalId && record.resourceType === entry.state.resourceType);
29912
+ }
29913
+ function supersededHeldByOtherTypeWarning(entry, holderType) {
29914
+ return `the superseded ${entry.state.resourceType} of ${entry.logicalId} (${entry.state.physicalId}) was not deleted: a ${holderType} record of this stack has the same physical id, and cdkd never deletes an id a record names. If the ${entry.state.resourceType} still exists, delete it by hand; it is no longer tracked in state.`;
29915
+ }
29916
+ function addSuperseded(host, entry) {
29917
+ host.supersededResources = [...(Array.isArray(host.supersededResources) ? host.supersededResources : []).filter((row) => !isSupersededResourceRecord(row) || row.state.physicalId !== entry.state.physicalId || row.state.resourceType !== entry.state.resourceType), entry];
29918
+ }
29919
+ function canRecordSuperseded(record, deleteContext) {
29920
+ if (deleteNeedsThisRunsNoEchoValues(record, deleteContext.noEchoDeleteValues)) return false;
29921
+ if (deleteContext.persistedRecord !== true && Array.isArray(record.noEchoLeaves) && record.noEchoLeaves.length > 0) return false;
29922
+ if (deleteContext.inlinePolicyClaimed !== void 0) return false;
29923
+ return !INLINE_POLICY_TYPES.has(record.resourceType);
29924
+ }
29925
+ function deleteNeedsThisRunsNoEchoValues(record, noEchoDeleteValues) {
29926
+ if (noEchoDeleteValues !== void 0) return true;
29927
+ return readsNoEchoDeleteValues(record.resourceType) && Array.isArray(record.noEchoLeaves) && record.noEchoLeaves.length > 0;
29928
+ }
29929
+ function isInlinePolicyType(resourceType) {
29930
+ return INLINE_POLICY_TYPES.has(resourceType);
29931
+ }
29932
+ const INLINE_POLICY_TYPES = /* @__PURE__ */ new Set([
29933
+ "AWS::IAM::Policy",
29934
+ "AWS::IAM::RolePolicy",
29935
+ "AWS::IAM::UserPolicy",
29936
+ "AWS::IAM::GroupPolicy"
29937
+ ]);
29938
+ function removeSuperseded(host, entry) {
29939
+ if (!Array.isArray(host.supersededResources)) return;
29940
+ const remaining = host.supersededResources.filter((row) => row !== entry);
29941
+ if (remaining.length === 0) delete host.supersededResources;
29942
+ else host.supersededResources = remaining;
29943
+ }
29944
+ function supersededAfterRollback(base, pending, resources) {
29945
+ const added = Array.isArray(pending.supersededResources) ? pending.supersededResources : [];
29946
+ const all = [...ownNotPending(base, added).filter((entry) => !isSupersededResourceRecord(entry) || !isSupersededHeldBySameType(entry, resources)), ...added];
29947
+ return all.length > 0 ? { supersededResources: all } : {};
29948
+ }
29949
+ function ownNotPending(base, added) {
29950
+ return (Array.isArray(base.supersededResources) ? base.supersededResources : []).filter((entry) => !added.some((a) => a.state.physicalId === entry.state.physicalId && a.state.resourceType === entry.state.resourceType));
29951
+ }
29952
+ const SUPERSEDED_KEPT_REMEDY = "cdkd keeps it in state: the next `cdkd deploy` of this stack retries the delete, and `cdkd destroy` deletes it";
29953
+ function withoutSuperseded(state) {
29954
+ const { supersededResources: _dropped, ...rest } = state;
29955
+ return rest;
29956
+ }
29957
+ async function deleteSupersededEntry(entry, input) {
29958
+ const record = entry.state;
29959
+ if (Object.prototype.hasOwnProperty.call(entry, "identity")) {
29960
+ const journaled = entry.identity;
29961
+ const judged = typeof journaled !== "string" || journaled === "" ? { incomparable: "the recorded generation is malformed" } : input.holderProvider === void 0 ? { incomparable: "cdkd reads no holder for this resource type" } : await judgeJournaledHolder({
29962
+ provider: input.holderProvider,
29963
+ resourceType: record.resourceType,
29964
+ physicalId: record.physicalId,
29965
+ region: input.region,
29966
+ journaled,
29967
+ interrupted: input.stop
29968
+ });
29969
+ if (judged === "gone") return { kind: "gone" };
29970
+ if (isUnreadHolder(judged)) return {
29971
+ kind: "failed",
29972
+ error: new CdkdError(`No delete was sent: ${unreadHolderCause(judged)}`, "SUPERSEDED_HOLDER_UNREAD")
29973
+ };
29974
+ if (typeof judged === "object" && "incomparable" in judged) input.warn?.(incomparableHolderNote(judged.incomparable));
29975
+ else if (judged !== "ours") return {
29976
+ kind: "notOurs",
29977
+ cause: notOursHolderCause(record.resourceType, judged.notOurs)
29978
+ };
29979
+ }
29980
+ const owesSnapshot = entry.skipFinalSnapshot !== true && entry.finalSnapshotIdentifier !== void 0 && PRE_DELETE_SNAPSHOT_TYPES.has(record.resourceType);
29981
+ if (owesSnapshot) {
29982
+ if (input.preDeleteSnapshot === void 0) return {
29983
+ kind: "failed",
29984
+ error: new CdkdError(`The final snapshot of ${entry.logicalId}'s superseded ${record.resourceType} could not be taken here. The resource was NOT deleted.`, "FINAL_SNAPSHOT_FAILED")
29985
+ };
29986
+ if (input.stop()) return {
29987
+ kind: "failed",
29988
+ error: new CdkdError(`The run was interrupted before the final snapshot of ${entry.logicalId}'s superseded ${record.resourceType}. The resource was NOT deleted.`, "FINAL_SNAPSHOT_FAILED")
29989
+ };
29990
+ try {
29991
+ await createPreDeleteFinalSnapshot(record.resourceType, record.physicalId, entry.logicalId, input.preDeleteSnapshot.clients, input.preDeleteSnapshot.logger, {
29992
+ refuseUnsnapshottableState: true,
29993
+ reuseStartedAtOrAfter: Number.isFinite(entry.supersededAt) ? entry.supersededAt : Date.now(),
29994
+ stop: input.stop
29995
+ });
29996
+ } catch (error) {
29997
+ return {
29998
+ kind: "failed",
29999
+ error
30000
+ };
30001
+ }
30002
+ }
30003
+ const { finalSnapshotIdentifier: _taken, ...snapshotTaken } = entry;
30004
+ const failed = (error) => owesSnapshot ? {
30005
+ kind: "failed",
30006
+ error,
30007
+ replacement: snapshotTaken
30008
+ } : {
30009
+ kind: "failed",
30010
+ error
30011
+ };
30012
+ let result;
30013
+ try {
30014
+ const send = () => input.provider.delete(entry.logicalId, record.physicalId, record.resourceType, record.properties, {
30015
+ expectedRegion: input.region,
30016
+ ...entry.forceDataDelete === true && { forceDataDelete: true },
30017
+ ...entry.finalSnapshotIdentifier !== void 0 && !PRE_DELETE_SNAPSHOT_TYPES.has(record.resourceType) && { finalSnapshotIdentifier: entry.finalSnapshotIdentifier },
30018
+ deletionPolicy: replacementDeletePolicy(entry.updateReplacePolicy),
30019
+ ...entry.skipFinalSnapshot === true && { skipFinalSnapshot: true },
30020
+ ...input.removeProtection === true && { removeProtection: true },
30021
+ ...input.stackDestroy === true && { stackDestroy: true },
30022
+ recordedAttributes: record.attributes,
30023
+ recordedCreateOnlyDrops: record.acceptedCreateOnlyDrops,
30024
+ recordedNoEchoLeaves: record.noEchoLeaves,
30025
+ recordedTypedPayloadLeaves: record.typedPayloadLeaves,
30026
+ maskSecrets: input.maskSecrets
30027
+ });
30028
+ result = input.once === true ? await send() : await retryWhileInUse(send, input.stop);
30029
+ } catch (error) {
30030
+ return failed(error);
29240
30031
  }
30032
+ reportDeleteGuards(result, {
30033
+ physicalId: record.physicalId,
30034
+ resourceType: record.resourceType,
30035
+ provisionedBy: record.provisionedBy
30036
+ });
30037
+ const reason = deleteSkipReason(result);
30038
+ return reason === void 0 ? { kind: "deleted" } : {
30039
+ kind: "notDeleted",
30040
+ reason
30041
+ };
30042
+ }
30043
+ const supersededInUseRetry = {
30044
+ attempts: 6,
30045
+ delayMs: 1e4
30046
+ };
30047
+ const IN_USE_ERROR_NAMES = /* @__PURE__ */ new Set([
30048
+ "ResourceInUseException",
30049
+ "ResourceInUse",
30050
+ "DependencyViolation"
30051
+ ]);
30052
+ const IN_USE_CONFLICT = /\bare using it\b/;
30053
+ function isInUseRefusal(error) {
30054
+ for (let current = error, depth = 0; current !== void 0 && depth < 8; depth++) {
30055
+ if (typeof current !== "object" || current === null) return false;
30056
+ const { name, message } = current;
30057
+ if (typeof name === "string" && IN_USE_ERROR_NAMES.has(name)) return true;
30058
+ if (name === "ConflictException" && typeof message === "string" && IN_USE_CONFLICT.test(message)) return true;
30059
+ current = current.cause;
30060
+ }
30061
+ return false;
30062
+ }
30063
+ function isInUseOrConflictRefusal(error) {
30064
+ if (isInUseRefusal(error)) return true;
30065
+ for (let current = error, depth = 0; current !== void 0 && depth < 8; depth++) {
30066
+ if (typeof current !== "object" || current === null) return false;
30067
+ if (current.name === "ConflictException") return true;
30068
+ current = current.cause;
30069
+ }
30070
+ return false;
30071
+ }
30072
+ async function retryWhileInUse(send, stop) {
30073
+ for (let attempt = 1;; attempt++) try {
30074
+ return await send();
30075
+ } catch (error) {
30076
+ if (attempt >= supersededInUseRetry.attempts || stop() || !isInUseRefusal(error) || isMarkedNonRetryable(error)) throw error;
30077
+ await new Promise((resolve) => setTimeout(resolve, supersededInUseRetry.delayMs));
30078
+ if (stop()) throw error;
30079
+ }
30080
+ }
30081
+ function holdsSupersededResources(record) {
30082
+ const rows = record.supersededResources;
30083
+ return rows !== void 0 && (!Array.isArray(rows) || rows.length > 0);
29241
30084
  }
29242
30085
 
29243
30086
  // src/deployment/deploy-engine/replacement/delete-replaced.ts
@@ -29250,6 +30093,15 @@ async function deleteReplacedAfterCreate(run, deps, logicalId, oldResourceType,
29250
30093
  const identity = await readDeferralIdentity(deps.providerRegistry(), oldResourceType, currentResource.physicalId, deps.stackRegion);
29251
30094
  if (identity !== void 0) run.replacedOldIdentity.set(logicalId, identity);
29252
30095
  else run.replacedOldIdentity.delete(logicalId);
30096
+ const recorded = run.supersededEntries.get(logicalId);
30097
+ if (identity !== void 0 && recorded !== void 0 && run.supersededHost !== void 0) {
30098
+ const withIdentity = {
30099
+ ...recorded,
30100
+ identity
30101
+ };
30102
+ addSuperseded(run.supersededHost, withIdentity);
30103
+ run.supersededEntries.set(logicalId, withIdentity);
30104
+ }
29253
30105
  run.deferredReplacedDeletes?.set(logicalId, {
29254
30106
  physicalId: currentResource.physicalId,
29255
30107
  resourceType: oldResourceType,
@@ -29263,6 +30115,7 @@ async function deleteReplacedAfterCreate(run, deps, logicalId, oldResourceType,
29263
30115
  return;
29264
30116
  }
29265
30117
  if (!isRetry) deps.logger.info(safeMsg` Deleting old ${logicalId} (${displayPhysicalId(currentResource.resourceType, currentResource.physicalId)})...`);
30118
+ else if (!await journaledHolderIsOurs(run, deps, logicalId, oldResourceType, currentResource)) return;
29266
30119
  let sentSnapshotIdentifier = finalSnapshotIdentifier;
29267
30120
  if (owesPreDeleteSnapshot(oldResourceType, finalSnapshotIdentifier)) {
29268
30121
  if (!await takeOwedSnapshot(run, deps, logicalId, currentResource, secrets, isRetry)) return;
@@ -29332,6 +30185,45 @@ async function deleteReplacedAfterCreate(run, deps, logicalId, oldResourceType,
29332
30185
  deps.logger.info(isRetry ? safeMsg` ${green("✓")} Old ${logicalId} (${currentResource.physicalId}) deleted` : safeMsg` ${green("✓")} Old resource deleted`);
29333
30186
  }
29334
30187
  }
30188
+ async function journaledHolderIsOurs(run, deps, logicalId, oldResourceType, oldResource) {
30189
+ const journaled = run.replacedOldIdentity.get(logicalId);
30190
+ if (journaled === void 0) return true;
30191
+ const judged = await judgeJournaledHolder({
30192
+ provider: () => deps.providerRegistry().getProvider(oldResourceType),
30193
+ resourceType: oldResourceType,
30194
+ physicalId: oldResource.physicalId,
30195
+ region: deps.stackRegion,
30196
+ journaled,
30197
+ interrupted: () => deps.interrupted()
30198
+ });
30199
+ if (judged === "ours") return true;
30200
+ const shown = displayPhysicalId(oldResource.resourceType, oldResource.physicalId);
30201
+ if (typeof judged === "object" && "incomparable" in judged) {
30202
+ deps.logger.warn(safeMsg` ⚠ Old ${logicalId} (${shown}): ${incomparableHolderNote(judged.incomparable)}`);
30203
+ return true;
30204
+ }
30205
+ const recorded = run.supersededEntries.get(logicalId);
30206
+ if (isUnreadHolder(judged)) {
30207
+ const why = unreadHolderCause(judged);
30208
+ if (recorded === void 0) {
30209
+ run.replacedOldMaySurvive.set(logicalId, "unconfirmed");
30210
+ run.replacedDeleteSkips.set(logicalId, `the replaced ${oldResourceType} (${oldResource.physicalId}) was not deleted (${why}) and is no longer tracked by cdkd`);
30211
+ }
30212
+ deps.logger.warn(safeMsg` ⚠ Old ${logicalId} (${shown}) was not deleted: ${why}, so no delete was sent. ` + (recorded !== void 0 ? safeMsg`${SUPERSEDED_KEPT_REMEDY}.` : "It is no longer tracked in state: delete it manually once you confirm it is the stack's."));
30213
+ return false;
30214
+ }
30215
+ if (recorded !== void 0 && run.supersededHost !== void 0) {
30216
+ removeSuperseded(run.supersededHost, recorded);
30217
+ run.supersededEntries.delete(logicalId);
30218
+ }
30219
+ run.replacedOldMaySurvive.delete(logicalId);
30220
+ if (judged === "gone") {
30221
+ deps.logger.info(safeMsg` ${green("✓")} Old ${logicalId} (${shown}) is already gone; no delete was sent`);
30222
+ return false;
30223
+ }
30224
+ deps.logger.warn(safeMsg` ⚠ Old ${logicalId} (${shown}) was not deleted: ${notOursHolderCause(oldResourceType, judged.notOurs)}. The replaced resource is gone, and cdkd no longer tracks it in state.`);
30225
+ return false;
30226
+ }
29335
30227
  async function takeOwedSnapshot(run, deps, logicalId, oldResource, secrets, isRetry) {
29336
30228
  const recorded = isRetry ? run.supersededEntries.get(logicalId) : void 0;
29337
30229
  const tracking = () => recorded !== void 0 ? "kept" : oldIdHeldByAnotherRecord(deps, logicalId, oldResource) ? "held" : "untracked";
@@ -32503,7 +33395,7 @@ function maskRestoredNoEchoRecord(record, baseline, substituted = []) {
32503
33395
  const marked = noEchoLeavesOf(baseline) ?? [];
32504
33396
  const names = declaredNoEchoAttributeNames(baseline);
32505
33397
  if (marked.length === 0 && names.length === 0 && substituted.length === 0) return record;
32506
- const echoes = (name, value) => value !== record.physicalId && substituted.some((leaf) => leaf.coordinate[0] === name && canonicalJson$6(leaf.value) === canonicalJson$6(value));
33398
+ const echoes = (name, value) => value !== record.physicalId && substituted.some((leaf) => leaf.coordinate[0] === name && canonicalJson$7(leaf.value) === canonicalJson$7(value));
32507
33399
  let attributes = record.attributes;
32508
33400
  if (attributes !== void 0 && attributes !== null && typeof attributes === "object") for (const [name, value] of Object.entries(attributes)) {
32509
33401
  if (!names.includes(name) && !echoes(name, value)) continue;
@@ -32514,7 +33406,7 @@ function maskRestoredNoEchoRecord(record, baseline, substituted = []) {
32514
33406
  const list = coordinate.findIndex((segment) => typeof segment === "number");
32515
33407
  if (list < 0) return false;
32516
33408
  const path = coordinate.slice(0, list);
32517
- return canonicalJson$6(valueAtCoordinate(byIndex, path)) !== canonicalJson$6(valueAtCoordinate(baseline.properties, path));
33409
+ return canonicalJson$7(valueAtCoordinate(byIndex, path)) !== canonicalJson$7(valueAtCoordinate(baseline.properties, path));
32518
33410
  });
32519
33411
  const properties = reshaped.length === 0 ? byIndex : maskReadbackAtCoordinates(byIndex, baseline.properties, reshaped);
32520
33412
  const widened = reshaped.map((coordinate) => readbackPathFor(byIndex, baseline.properties, coordinate)).filter((path, i) => path !== void 0 && path.length < reshaped[i].length);
@@ -33150,15 +34042,15 @@ async function createWithRollbackRetry(provider, create, logicalId, logger, isIn
33150
34042
  isRetryable: outer.isRetryable
33151
34043
  });
33152
34044
  }
33153
- function recordAfterRollbackUpdate(restored, result) {
33154
- return withoutNoEchoValueMacs(withoutUnsettledProperties(recordAfterRollbackUpdateUnsettled(restored, result)));
34045
+ function recordAfterRollbackUpdate(restored, result, onDiffering) {
34046
+ return withoutNoEchoValueMacs(withoutUnsettledProperties(recordAfterRollbackUpdateUnsettled(restored, result, onDiffering)));
33155
34047
  }
33156
34048
  function withoutNoEchoValueMacs(record) {
33157
34049
  if (record.noEchoValueMacs === void 0) return record;
33158
34050
  const { noEchoValueMacs: _dropped, ...rest } = record;
33159
34051
  return rest;
33160
34052
  }
33161
- function recordAfterRollbackUpdateUnsettled(restored, result) {
34053
+ function recordAfterRollbackUpdateUnsettled(restored, result, onDiffering) {
33162
34054
  if (result === void 0) return restored;
33163
34055
  const returned = result.attributes;
33164
34056
  const replacedId = result.wasReplaced && typeof result.physicalId === "string" && result.physicalId !== "" ? result.physicalId : void 0;
@@ -33169,10 +34061,10 @@ function recordAfterRollbackUpdateUnsettled(restored, result) {
33169
34061
  ...returned === void 0 && idChanged ? withoutAttributes : restored,
33170
34062
  ...replacedId !== void 0 && { physicalId: replacedId },
33171
34063
  ...result.effectiveProperties && { properties: copyClaimingProviderBag(result.effectiveProperties) },
33172
- ...returned !== void 0 && { attributes: result.wasReplaced ? { ...returned } : {
34064
+ ...returned !== void 0 && { attributes: result.wasReplaced ? { ...returned } : keepRecordedIdentity(restored.resourceType, restored.attributes, {
33173
34065
  ...restored.attributes,
33174
34066
  ...returned
33175
- } }
34067
+ }, onDiffering) }
33176
34068
  };
33177
34069
  }
33178
34070
  function recordedPropertiesAfterReplayCreate(restored, result) {
@@ -33205,6 +34097,7 @@ function buildReadCurrentStateContext(state, excludedLogicalId) {
33205
34097
  const ownObserved = ownRecord("observedProperties");
33206
34098
  return {
33207
34099
  siblings,
34100
+ ...isReadableResourceEntry(own) && own.provisionedBy === "cc-api" && { ccApiRead: true },
33208
34101
  ...ownAttributes && { attributes: ownAttributes },
33209
34102
  ...ownObserved && { driftBaseline: ownObserved }
33210
34103
  };
@@ -33408,7 +34301,8 @@ async function replayRevert(s) {
33408
34301
  ...previousState,
33409
34302
  physicalId: current.physicalId
33410
34303
  } : previousState;
33411
- stateResources[op.logicalId] = maskRestoredNoEchoRecord(redactRollbackRecord(await withRefreshedObservedBaseline(recordAfterRollbackUpdate(restoreBase, revertResult), {
34304
+ const revertedRecord = recordAfterRollbackUpdate(restoreBase, revertResult, identityWarner(logger, mask, op));
34305
+ stateResources[op.logicalId] = maskRestoredNoEchoRecord(redactRollbackRecord(await withRefreshedObservedBaseline(revertedRecord, {
33412
34306
  provider,
33413
34307
  op,
33414
34308
  desiredProps,
@@ -33512,7 +34406,7 @@ async function recreateOldResource(s, r) {
33512
34406
  ...newCopyClaimed && { inlinePolicyClaimed: newCopyClaimed },
33513
34407
  ...finalSnapshotIdentifier !== void 0 && { finalSnapshotIdentifier },
33514
34408
  deletionPolicy: replacementDeletePolicy(current.updateReplacePolicy),
33515
- recordedAttributes: current.attributes,
34409
+ recordedAttributes: newCopyDeleteAttributes(op.resourceType, current.attributes, op.oldDeletedBeforeCreate, op.previousState?.attributes),
33516
34410
  recordedCreateOnlyDrops: current.acceptedCreateOnlyDrops,
33517
34411
  recordedNoEchoLeaves: current.noEchoLeaves,
33518
34412
  recordedTypedPayloadLeaves: current.typedPayloadLeaves,
@@ -33671,7 +34565,7 @@ async function finishReverseReplacement(s, r, createResult, deletedNewFirst) {
33671
34565
  ...newCopyClaimed && { inlinePolicyClaimed: newCopyClaimed },
33672
34566
  ...finalSnapshotIdentifier !== void 0 && { finalSnapshotIdentifier },
33673
34567
  deletionPolicy: replacementDeletePolicy(current.updateReplacePolicy),
33674
- recordedAttributes: current.attributes,
34568
+ recordedAttributes: newCopyDeleteAttributes(op.resourceType, current.attributes, op.oldDeletedBeforeCreate, op.previousState?.attributes),
33675
34569
  recordedCreateOnlyDrops: current.acceptedCreateOnlyDrops,
33676
34570
  recordedNoEchoLeaves: current.noEchoLeaves,
33677
34571
  recordedTypedPayloadLeaves: current.typedPayloadLeaves,
@@ -33796,16 +34690,26 @@ async function replayReverseReplacement(s) {
33796
34690
  result.warnings++;
33797
34691
  survivor = "exists";
33798
34692
  }
34693
+ let identityUnverified = false;
34694
+ if (survivor === "identity-unverified") {
34695
+ identityUnverified = true;
34696
+ survivor = "exists";
34697
+ }
33799
34698
  if (survivor === "exists" && op.oldResourceMaySurvive === "unconfirmed") throw survivorUnprovenRefusal(s, oldType, "maybe-deleting");
33800
34699
  if (op.oldResourceMaySurvive === "deferred" && survivor !== "gone" && survivor !== "interrupted" && (survivor === "exists" || deferredDeleteStillPending(ctx.supersededResources, prev, oldType))) {
33801
34700
  logger.info(safeMsg` Rollback: the old resource of ${safe(op.logicalId)} (${mask(String(prev.physicalId))}) was not deleted yet — re-adopting it`);
33802
- return replayReadopt(s, {});
34701
+ await replayReadopt(s, {});
34702
+ if (identityUnverified) warnUnverifiedSurvivor(s, oldType);
34703
+ if (survivor === "identity-uncompared" || survivor === "identity-unread") warnUnverifiedSurvivor(s, oldType, survivor);
34704
+ return;
33803
34705
  }
33804
34706
  if (survivor === "exists") {
33805
34707
  const oldShown = refusalPhysicalId(mask(String(prev.physicalId)));
33806
34708
  logger.warn(safeMsg` ⚠ Rollback: the old resource of ${shownLogicalId(op.logicalId)} (${oldShown}) still ` + "exists — the deploy's delete of it was not confirmed — so it is re-adopted instead of re-created. Part of it may have been removed before that delete failed: check it " + safeMsg`with ${cdkdRemedy("cdkd drift")} after the rollback.${describedPhysicalIdPointer(oldShown)}`);
33807
34709
  result.warnings++;
33808
- return replayReadopt(s, { reason: `the old resource survived a delete that was refused or never sent during the deploy and was re-adopted instead of re-created; the provider may have run part of that delete, so check it with ${cdkdRemedy("cdkd drift")}` });
34710
+ await replayReadopt(s, { reason: `the old resource survived a delete that was refused or never sent during the deploy and was re-adopted instead of re-created; the provider may have run part of that delete, so check it with ${cdkdRemedy("cdkd drift")}` });
34711
+ if (identityUnverified) warnUnverifiedSurvivor(s, oldType);
34712
+ return;
33809
34713
  }
33810
34714
  if (survivor !== "gone") throw survivorUnprovenRefusal(s, oldType, survivor);
33811
34715
  logger.info(safeMsg` Rollback: the old resource of ${safe(op.logicalId)} (${mask(String(prev.physicalId))}) is gone — re-creating it`);
@@ -33895,14 +34799,24 @@ async function replayReverseReplacement(s) {
33895
34799
  const { createResult, deletedNewFirst } = await recreateOldResource(s, scope);
33896
34800
  await finishReverseReplacement(s, scope, createResult, deletedNewFirst);
33897
34801
  }
34802
+ function warnUnverifiedSurvivor(s, oldType, uncompared) {
34803
+ const { op, logger, mask } = s;
34804
+ const cause = uncompared === void 0 ? unverifiedIdentityCause(oldType, op.previousState?.attributes, refusalResourceType(oldType)) : uncomparedIdentityCause(oldType, uncompared);
34805
+ logger.warn(mask(safeMsg` ⚠ Rollback: cdkd could not prove that the resource AWS reports under the old id of ` + safeMsg`${shownLogicalId(op.logicalId)} is the one cdkd created ` + safeMsg`(${cause}), so it was re-adopted because AWS reports it` + (uncompared === void 0 ? "" : ` and state still lists it as awaiting its delete`) + `. If it is not this stack's, leave it alone and drop ` + safeMsg`its record after the rollback with ${stateOrphanRecordRemedy(void 0, String(op.logicalId))}.`));
34806
+ }
34807
+ function uncomparedIdentityCause(oldType, verdict) {
34808
+ const key = SURVIVOR_IDENTITY_ATTRIBUTES[oldType] ?? "identity";
34809
+ return verdict === "identity-unread" ? `the read of its ${key} failed, so cdkd could not compare it with the recorded one` : `cdkd could not compare it with the recorded ${key}: the recorded value is redacted, or the read could not name the resource`;
34810
+ }
33898
34811
  function survivorUnprovenRefusal(s, oldType, verdict) {
33899
34812
  const { op, ctx, mask } = s;
33900
34813
  const remedy = orphanRemedy(op.logicalId, ctx);
33901
34814
  const oldId = op.previousState?.physicalId;
33902
34815
  const oldShown = hasAddressablePhysicalId({ physicalId: oldId }) ? refusalPhysicalId(mask(String(oldId))) : "no recorded id";
33903
34816
  const rerun = rerunRollbackPhrase(ctx, cdkdRemedy("cdkd rollback"));
33904
- const why = verdict === "free-unreadable" ? `nothing held that name when this rollback started, and its current state could not be read; re-running ${rerun} reads it again` : verdict === "vacated" ? `the name went free while this rollback read it (AWS reported it, then a second read found no bucket under it), so re-adopting it would delete the new resource for nothing; re-running ${rerun} reads it again` : verdict === "owner-unverified" ? `cdkd could not read whether it does, nor whether it belongs to this account (this account's bucket list could not be read; it needs s3:ListAllMyBuckets). Re-adopting another owner's bucket would delete the new one; re-running ${rerun} reads both again` : verdict === "unreadable" ? "cdkd has no read for this resource type that can tell whether it does. Re-creating it could duplicate it or collide with it" : verdict === "interrupted" ? `the rollback was interrupted before cdkd could read whether it does; re-running ${rerun} reads it` : verdict === "unknown" ? `cdkd could not read whether it does (the read failed or did not answer in time); re-running ${rerun} reads it again. Re-creating it could duplicate it or collide with it` : `AWS still reports it, but its failed delete may have been accepted and still be running, or only partly ran. Re-adopting it could leave neither resource once a running delete finishes, or one that delete already stripped; once AWS reports it gone, re-running ${rerun} re-creates it. A refused delete is not running, so waiting does not help: if its delete was refused, delete it by hand, then re-run ${rerun}`;
33905
- return ownRemedyError(markNonRetryable(new CdkdError(`Cannot reverse the replacement of ${refusalLogicalId(op.logicalId)} (${refusalResourceType(oldType)}): ` + (verdict === "vacated" || verdict === "free-unreadable" ? `the old resource (${oldShown}) cannot be proven the stack's: ${why}.` : `the deploy did not confirm that it deleted the old resource (${oldShown}), so it may still exist, and ${why}.`) + ` Nothing was sent and the journal is kept.` + (remedy.offered ? ` To keep the new resource in its place instead, re-run with the command below, ` + (verdict === "vacated" || verdict === "free-unreadable" ? `and leave anything under the old id alone unless it is this stack's.` : `then delete the old resource by hand if it still exists.`) : "") + `${remedy.clause}${describedPhysicalIdPointer(oldShown)}` + remedy.line, "REPLACED_SURVIVOR_UNPROVEN")));
34817
+ const identity = verdict === "identity-uncompared" || verdict === "identity-unread";
34818
+ const why = verdict === "identity-uncompared" ? `AWS reports a resource under that id, but ${uncomparedIdentityCause(oldType, verdict)}, so cdkd cannot tell whether it is the one this stack created; a re-run meets the same answer. Re-adopting another owner's resource would delete the new one` : verdict === "identity-unread" ? `AWS reports a resource under that id, but ${uncomparedIdentityCause(oldType, verdict)}; re-running ${rerun} reads it again. Re-adopting another owner's resource would delete the new one` : verdict === "free-unreadable" ? `nothing held that name when this rollback started, and its current state could not be read; re-running ${rerun} reads it again` : verdict === "vacated" ? `the name went free while this rollback read it (AWS reported it, then a second read found no bucket under it), so re-adopting it would delete the new resource for nothing; re-running ${rerun} reads it again` : verdict === "owner-unverified" ? `cdkd could not read whether it does, nor whether it belongs to this account (this account's bucket list could not be read; it needs s3:ListAllMyBuckets). Re-adopting another owner's bucket would delete the new one; re-running ${rerun} reads both again` : verdict === "unreadable" ? "cdkd has no read for this resource type that can tell whether it does. Re-creating it could duplicate it or collide with it" : verdict === "interrupted" ? `the rollback was interrupted before cdkd could read whether it does; re-running ${rerun} reads it` : verdict === "unknown" ? `cdkd could not read whether it does (the read failed or did not answer in time); re-running ${rerun} reads it again. Re-creating it could duplicate it or collide with it` : `AWS still reports it, but its failed delete may have been accepted and still be running, or only partly ran. Re-adopting it could leave neither resource once a running delete finishes, or one that delete already stripped; once AWS reports it gone, re-running ${rerun} re-creates it. A refused delete is not running, so waiting does not help: if its delete was refused, delete it by hand, then re-run ${rerun}`;
34819
+ return ownRemedyError(markNonRetryable(new CdkdError(`Cannot reverse the replacement of ${refusalLogicalId(op.logicalId)} (${refusalResourceType(oldType)}): ` + (identity || verdict === "vacated" || verdict === "free-unreadable" ? `the old resource (${oldShown}) cannot be proven the stack's: ${why}.` : `the deploy did not confirm that it deleted the old resource (${oldShown}), so it may still exist, and ${why}.`) + ` Nothing was sent and the journal is kept.` + (remedy.offered ? ` To keep the new resource in its place instead, re-run with the command below, ` + (identity || verdict === "vacated" || verdict === "free-unreadable" ? `and leave anything under the old id alone unless it is this stack's.` : `then delete the old resource by hand if it still exists.`) : "") + `${remedy.clause}${describedPhysicalIdPointer(oldShown)}` + remedy.line, "REPLACED_SURVIVOR_UNPROVEN")));
33906
34820
  }
33907
34821
  function foreignSurvivorRefusal(s, oldType, verdict) {
33908
34822
  const { op, ctx, mask } = s;
@@ -34257,6 +35171,7 @@ async function replayFailedOperationsUnbound(failedOps, stateResources, stackNam
34257
35171
  const secrets = /* @__PURE__ */ new Map();
34258
35172
  const opMasker = createOpMasker(logger, secrets, ctx.logOnlyNeedlesFor?.(op.logicalId));
34259
35173
  const mask = opMasker.mask;
35174
+ const warnIdentity = identityWarner(logger, mask, op);
34260
35175
  const skipScope = {
34261
35176
  ctx,
34262
35177
  stackName,
@@ -34523,7 +35438,7 @@ async function replayFailedOperationsUnbound(failedOps, stateResources, stackNam
34523
35438
  }
34524
35439
  ], op.logicalId, logger, options.isInterrupted, secrets, mask));
34525
35440
  if (revertFailedResult) recordNoEchoAttributeValues(revertFailedResult, secrets, desiredProps);
34526
- stateResources[op.logicalId] = maskRestoredNoEchoRecord(redactRollbackRecord(withNameGenerationReached(await withRefreshedObservedBaseline(recordAfterRollbackUpdate(prev, revertFailedResult), {
35441
+ stateResources[op.logicalId] = maskRestoredNoEchoRecord(redactRollbackRecord(withNameGenerationReached(await withRefreshedObservedBaseline(recordAfterRollbackUpdate(prev, revertFailedResult, warnIdentity), {
34527
35442
  provider,
34528
35443
  op,
34529
35444
  desiredProps,
@@ -34745,6 +35660,11 @@ function cfnIngressPortValue(value) {
34745
35660
  }
34746
35661
  return NaN;
34747
35662
  }
35663
+ const SG_RULE_ID_PATTERN = /^sgr-[0-9a-f]+$/;
35664
+ function recordedSgRuleId(attributes) {
35665
+ const recorded = attributes?.["Id"];
35666
+ return typeof recorded === "string" && SG_RULE_ID_PATTERN.test(recorded) ? recorded : void 0;
35667
+ }
34748
35668
 
34749
35669
  // src/provisioning/sg-sibling-rules.ts
34750
35670
  const RULE_TYPE = {
@@ -34791,11 +35711,12 @@ function sgRuleOwnershipIdentity(rule, direction) {
34791
35711
  ...PEER_KEYS[direction].map((key) => rule[key] ?? null)
34792
35712
  ]);
34793
35713
  }
34794
- function siblingOwnedSgRuleIdentities(groupId, direction, properties, context) {
35714
+ function siblingOwnedSgRuleIdentities(groupId, direction, properties, context, skip) {
34795
35715
  const owned = /* @__PURE__ */ new Set();
34796
35716
  if (typeof groupId !== "string" || groupId === "") return owned;
34797
- for (const sibling of Object.values(context?.siblings ?? {})) {
35717
+ for (const [lid, sibling] of Object.entries(context?.siblings ?? {})) {
34798
35718
  if (sibling.resourceType !== RULE_TYPE[direction]) continue;
35719
+ if (skip?.(lid, sibling) === true) continue;
34799
35720
  const props = sibling.properties;
34800
35721
  if (!isPlainRecord$3(props) || props["GroupId"] !== groupId) continue;
34801
35722
  const identity = sgRuleOwnershipIdentity(props, direction);
@@ -34809,6 +35730,64 @@ function siblingOwnedSgRuleIdentities(groupId, direction, properties, context) {
34809
35730
  }
34810
35731
  return owned;
34811
35732
  }
35733
+ const INGRESS_IDENTITY_KEYS = [
35734
+ "IpProtocol",
35735
+ "FromPort",
35736
+ "ToPort",
35737
+ "CidrIp",
35738
+ "CidrIpv6",
35739
+ "SourceSecurityGroupId",
35740
+ "SourceSecurityGroupName",
35741
+ "SourceSecurityGroupOwnerId",
35742
+ "SourcePrefixListId"
35743
+ ];
35744
+ function sgSiblingDecidedById(selfLogicalId, self, records, groupProperties) {
35745
+ if (!isPlainRecord$3(self)) return false;
35746
+ const direction = self.resourceType === RULE_TYPE.ingress ? "ingress" : self.resourceType === RULE_TYPE.egress ? "egress" : void 0;
35747
+ const props = self.properties;
35748
+ const id = recordedRuleIdOf(self);
35749
+ if (direction === void 0 || !isPlainRecord$3(props) || id === void 0) return false;
35750
+ const groupId = props["GroupId"];
35751
+ if (typeof groupId !== "string" || groupId === "") return false;
35752
+ if (INGRESS_IDENTITY_KEYS.some((key) => isRedactedRecordedValue(props[key]))) return false;
35753
+ if (props["SourceSecurityGroupName"] != null && props["SourceSecurityGroupId"] == null) return false;
35754
+ const identity = sgRuleOwnershipIdentity(props, direction);
35755
+ if (identity === void 0) return false;
35756
+ for (const [lid, other] of records) {
35757
+ if (lid === selfLogicalId || !isPlainRecord$3(other)) continue;
35758
+ if (other.resourceType !== RULE_TYPE[direction]) continue;
35759
+ const otherProps = other.properties;
35760
+ if (!isPlainRecord$3(otherProps) || otherProps["GroupId"] !== groupId) continue;
35761
+ if (recordedRuleIdOf(other) === id) return false;
35762
+ if (sgRuleOwnershipIdentity(otherProps, direction) === identity) return false;
35763
+ }
35764
+ const inline = groupProperties?.[LIST_KEY[direction]];
35765
+ if (Array.isArray(inline) && inline.some((e) => sgRuleOwnershipIdentity(e, direction) === identity)) return false;
35766
+ return true;
35767
+ }
35768
+ function skipSiblingsDecidedById(properties, context) {
35769
+ if (context?.ccApiRead === true) return void 0;
35770
+ const records = Object.entries(context?.siblings ?? {});
35771
+ return (lid, sibling) => sgSiblingDecidedById(lid, sibling, records, properties);
35772
+ }
35773
+ function recordedRuleIdOf(record) {
35774
+ return recordedSgRuleId(record.attributes) ?? (typeof record.physicalId === "string" && SG_RULE_ID_PATTERN.test(record.physicalId) ? record.physicalId : void 0);
35775
+ }
35776
+ function siblingRecordedSgRuleIds(groupId, records, direction) {
35777
+ const ids = /* @__PURE__ */ new Map();
35778
+ if (typeof groupId !== "string" || groupId === "" || records === void 0) return ids;
35779
+ for (const [, record] of records) {
35780
+ if (!isPlainRecord$3(record)) continue;
35781
+ const recordDirection = record.resourceType === RULE_TYPE.ingress ? "ingress" : record.resourceType === RULE_TYPE.egress ? "egress" : void 0;
35782
+ if (recordDirection === void 0) continue;
35783
+ if (direction !== void 0 && recordDirection !== direction) continue;
35784
+ const props = record.properties;
35785
+ if (!isPlainRecord$3(props) || props["GroupId"] !== groupId) continue;
35786
+ const id = recordedRuleIdOf(record);
35787
+ if (id !== void 0) ids.set(id, sgRuleOwnershipIdentity(props, recordDirection));
35788
+ }
35789
+ return ids;
35790
+ }
34812
35791
  function withoutSiblingOwnedSgRules(rules, owned, direction) {
34813
35792
  if (owned.size === 0) return [...rules];
34814
35793
  return rules.filter((rule) => {
@@ -34828,19 +35807,20 @@ function stripSiblingOwnedSgRules(resourceType, physicalId, baseline, aws, prope
34828
35807
  for (const direction of ["ingress", "egress"]) {
34829
35808
  const owned = siblingOwnedSgRuleIdentities(physicalId, direction, properties, context);
34830
35809
  if (owned.size === 0) continue;
35810
+ const liveOwned = siblingOwnedSgRuleIdentities(physicalId, direction, properties, context, skipSiblingsDecidedById(properties, context));
34831
35811
  const key = LIST_KEY[direction];
34832
- const strip = (bag) => {
35812
+ const strip = (bag, drop) => {
34833
35813
  const list = bag[key];
34834
- if (!Array.isArray(list)) return bag;
34835
- const kept = withoutSiblingOwnedSgRules(list, owned, direction);
35814
+ if (!Array.isArray(list) || drop.size === 0) return bag;
35815
+ const kept = withoutSiblingOwnedSgRules(list, drop, direction);
34836
35816
  return kept.length === list.length ? bag : {
34837
35817
  ...bag,
34838
35818
  [key]: kept
34839
35819
  };
34840
35820
  };
34841
35821
  out = {
34842
- baseline: strip(out.baseline),
34843
- aws: strip(out.aws)
35822
+ baseline: strip(out.baseline, owned),
35823
+ aws: strip(out.aws, liveOwned)
34844
35824
  };
34845
35825
  }
34846
35826
  return out;
@@ -35187,7 +36167,7 @@ function helperOwnedLists(resourceType, physicalId, properties, context) {
35187
36167
  if (resourceType === "AWS::EC2::SecurityGroup") for (const [key, direction] of [["SecurityGroupIngress", "ingress"], ["SecurityGroupEgress", "egress"]]) out.push({
35188
36168
  key,
35189
36169
  keyOf: (m) => sgRuleOwnershipIdentity(m, direction),
35190
- owned: siblingOwnedSgRuleIdentities(physicalId, direction, properties, context)
36170
+ owned: siblingOwnedSgRuleIdentities(physicalId, direction, properties, context, skipSiblingsDecidedById(properties, context))
35191
36171
  });
35192
36172
  return out.filter((l) => l.owned.size > 0);
35193
36173
  }
@@ -38033,22 +39013,22 @@ function sameJournaledOrphans(a, b) {
38033
39013
  }
38034
39014
 
38035
39015
  // src/provisioning/nested-stack-context.ts
38036
- const storage = new AsyncLocalStorage();
39016
+ const storage$1 = new AsyncLocalStorage();
38037
39017
  function withNestedStackContext(ctx, fn) {
38038
- return storage.run(ctx, fn);
39018
+ return storage$1.run(ctx, fn);
38039
39019
  }
38040
39020
  function getCurrentNestedStackContext() {
38041
- return storage.getStore();
39021
+ return storage$1.getStore();
38042
39022
  }
38043
39023
  async function collectNestedChildUnaddressed(fn) {
38044
- const ctx = storage.getStore();
39024
+ const ctx = storage$1.getStore();
38045
39025
  if (!ctx) return {
38046
39026
  value: await fn(),
38047
39027
  unaddressed: void 0
38048
39028
  };
38049
39029
  const slot = {};
38050
39030
  return {
38051
- value: await storage.run({
39031
+ value: await storage$1.run({
38052
39032
  ...ctx,
38053
39033
  childUnaddressed: slot
38054
39034
  }, fn),
@@ -39408,6 +40388,7 @@ var GeneratedNameMismatchError = class extends Error {
39408
40388
  function provenNothingCreated(error, logicalId, resourceType) {
39409
40389
  if (createdBeforeFailure(error, logicalId, resourceType) !== void 0) return false;
39410
40390
  if (isAmbiguousOutcomeError(error) || isThrottlingError(error)) return false;
40391
+ if (isNameCollisionErrorFrom(error, logicalId)) return false;
39411
40392
  let current = error;
39412
40393
  for (let depth = 0; depth < 8 && current !== null && typeof current === "object"; depth++) {
39413
40394
  const status = current.$metadata?.httpStatusCode;
@@ -39955,6 +40936,15 @@ function formatResourceLine(op, logicalId, resourceType, verbOverride) {
39955
40936
  }
39956
40937
  }
39957
40938
 
40939
+ // src/provisioning/licensed-name-holder.ts
40940
+ const storage = new AsyncLocalStorage();
40941
+ function withLicensedNameHolder(holder, fn) {
40942
+ return storage.run({ holder }, fn);
40943
+ }
40944
+ function licensedNameHolder() {
40945
+ return storage.getStore()?.holder;
40946
+ }
40947
+
39958
40948
  // src/deployment/deploy-engine/update/noecho-macs.ts
39959
40949
  function covers(coordinate, key, leafPath) {
39960
40950
  if (coordinate[0] !== key) return false;
@@ -40187,7 +41177,7 @@ async function provisionCreate(engine, logicalId, change, stateResources, stackN
40187
41177
  engine.generatedNameGuard?.noteSent(logicalId);
40188
41178
  result = resumed;
40189
41179
  } else {
40190
- await refuseUnlicensedGeneratedName(engine, {
41180
+ const licensedHolder = await refuseUnlicensedGeneratedName(engine, {
40191
41181
  logicalId,
40192
41182
  resourceType,
40193
41183
  stackName,
@@ -40206,10 +41196,10 @@ async function provisionCreate(engine, logicalId, change, stateResources, stackN
40206
41196
  });
40207
41197
  engine.generatedNameGuard?.noteSent(logicalId);
40208
41198
  try {
40209
- result = await engine.withRetry(() => withCurrentResourceSecrets(createSecrets, () => createProvider.create(logicalId, resourceType, createProps, {
41199
+ result = await engine.withRetry(() => withCurrentResourceSecrets(createSecrets, () => withLicensedNameHolder(licensedHolder, () => createProvider.create(logicalId, resourceType, createProps, {
40210
41200
  maskSecrets: createSecretMasker(createSecrets),
40211
41201
  ...typedPayloadLeaves !== void 0 && { typedPayloadLeaves }
40212
- })), logicalId, void 0, void 0, createProvider);
41202
+ }))), logicalId, void 0, void 0, createProvider);
40213
41203
  } catch (error) {
40214
41204
  engine.generatedNameGuard?.noteFailed(logicalId, error);
40215
41205
  throw error;
@@ -40254,11 +41244,11 @@ async function provisionCreate(engine, logicalId, change, stateResources, stackN
40254
41244
  async function guardedReplacementCreate(engine, input, create) {
40255
41245
  const guard = engine.generatedNameGuard;
40256
41246
  if (input.keepsName === true || guard?.candidate(input.logicalId) === void 0) return create();
40257
- await refuseUnlicensedGeneratedName(engine, input);
41247
+ const licensedHolder = await refuseUnlicensedGeneratedName(engine, input);
40258
41248
  guard.noteSent(input.logicalId);
40259
41249
  let result;
40260
41250
  try {
40261
- result = await create();
41251
+ result = await withLicensedNameHolder(licensedHolder, create);
40262
41252
  } catch (error) {
40263
41253
  guard.noteFailed(input.logicalId, error);
40264
41254
  throw error;
@@ -40275,13 +41265,14 @@ async function refuseUnlicensedGeneratedName(engine, input) {
40275
41265
  const subject = `${displaySafe(logicalId)} (${displaySafe(resourceType)})`;
40276
41266
  const checked = engine.generatedNameGuard.candidate(logicalId) ?? asked;
40277
41267
  const named = `the cdkd-generated ${checked.property ?? "name"} ${displaySafe(checked.name)}`;
40278
- const adoptsText = "its create API hands back or overwrites an existing resource of that name instead of refusing it";
41268
+ const refusesItself = resourceType === "AWS::Logs::LogGroup";
41269
+ const adoptsText = refusesItself ? `cdkd checks a log group's name before its create, as CloudFormation refuses a taken one` : "its create API hands back or overwrites an existing resource of that name instead of refusing it";
40279
41270
  const refuse = (message) => {
40280
41271
  throw markNonRetryable(markRefusedBeforeApplying(new CdkdError(message, "GENERATED_NAME_HELD")));
40281
41272
  };
40282
41273
  switch (verdict.kind) {
40283
- case "free":
40284
- case "licensed": return;
41274
+ case "free": return;
41275
+ case "licensed": return verdict.holder;
40285
41276
  case "unchecked":
40286
41277
  engine.logger.warn(safeMsg`${subject} is created with ${named} without checking whether another resource already ` + safeMsg`holds it: the lookup was refused (${describeAwsFailure(verdict.error).summary}). ` + "Grant this identity the type's Describe / List permission to have cdkd refuse taking over another deployment's resource.");
40287
41278
  return;
@@ -40302,9 +41293,9 @@ async function refuseUnlicensedGeneratedName(engine, input) {
40302
41293
  }], recoveryCommandFlags(engine.options.refusalRecovery).flags).command, "`")}`;
40303
41294
  if (verdict.ownIntent !== void 0) {
40304
41295
  const why = verdict.ownIntent === "abandoned" ? "a deploy of this stack that was killed or force-unlocked" : "a create of this stack that came back failed (a timeout or a server error)";
40305
- return refuse(`${subject} would be created with ${named}, which an existing resource (${displaySafe(verdict.holder)}) already holds. This stack's create-token ledger records that ${why} sent this name, but this type reports no creation time, so cdkd cannot tell that resource is the one it made rather than another deployment's created since. Since ${adoptsText}, creating it would take that resource over. ${displaySafe(logicalId)} was not created. The likely cause: the resource is this stack's own, from that deploy. If it is, ${importLine} and re-run; if it is not, this stack is also deployed under another state backend.`);
41296
+ return refuse(`${subject} would be created with ${named}, which an existing resource (${displaySafe(verdict.holder)}) already holds. This stack's create-token ledger records that ${why} sent this name, but this type reports no creation time, so cdkd cannot tell that resource is the one it made rather than another deployment's created since. ` + (refusesItself ? "" : `Since ${adoptsText}, creating it would take that resource over. `) + `${displaySafe(logicalId)} was not created. The likely cause: the resource is this stack's own, from that deploy. If it is, ${importLine} and re-run; if it is not, this stack is also deployed under another state backend.`);
40306
41297
  }
40307
- return refuse(`${subject} would be created with ${named}, which an existing resource (${displaySafe(verdict.holder)}) already holds, and nothing this stack records names that resource: not its state, its rollback journal or create-token ledger, nor what a destroy of it under this state prefix kept. Since ${adoptsText}, creating it would take that resource over, as CloudFormation refuses with "already exists". ${displaySafe(logicalId)} was not created. The likely cause: this stack is also deployed under another state backend (another --state-prefix, --state-bucket or account), where cdkd generates the same names. One stack name per account and region is supported: deploy it under one backend only, or give this stack another name. If the resource is this stack's own, ${importLine} and re-run.`);
41298
+ return refuse(`${subject} would be created with ${named}, which an existing resource (${displaySafe(verdict.holder)}) already holds, and nothing this stack records names that resource: not its state, its rollback journal or create-token ledger, nor what a destroy of it under this state prefix kept. ` + (refusesItself ? `CloudFormation refuses it with "already exists". ` : `Since ${adoptsText}, creating it would take that resource over, as CloudFormation refuses with "already exists". `) + `${displaySafe(logicalId)} was not created. The likely cause: this stack is also deployed under another state backend (another --state-prefix, --state-bucket or account), where cdkd generates the same names. One stack name per account and region is supported: deploy it under one backend only, or give this stack another name. If the resource is this stack's own, ${importLine} and re-run.`);
40308
41299
  }
40309
41300
  }
40310
41301
  }
@@ -40322,7 +41313,8 @@ async function refuseTakenCreateName(engine, input) {
40322
41313
  const shown = (value) => displaySafe(maskName(value));
40323
41314
  const subject = `${displaySafe(logicalId)} (${displaySafe(resourceType)})`;
40324
41315
  const named = `${question.property} ${shown(question.desiredName)}`;
40325
- const adoptsText = "its create API hands back or overwrites an existing resource of that name instead of refusing it";
41316
+ const refusesItself = resourceType === "AWS::Logs::LogGroup";
41317
+ const adoptsText = refusesItself ? `cdkd checks a log group's name before its create, as CloudFormation refuses a taken one` : "its create API hands back or overwrites an existing resource of that name instead of refusing it";
40326
41318
  const refuse = (message, cause, redactedCause = false) => {
40327
41319
  const refusal = new CdkdError(maskName(message), "NAMED_CREATE_COLLISION", cause instanceof Error ? cause : void 0);
40328
41320
  throw markNonRetryable(markRefusedBeforeApplying(redactedCause && cause instanceof Error ? markRedactedCause(refusal) : refusal));
@@ -40358,7 +41350,7 @@ async function refuseTakenCreateName(engine, input) {
40358
41350
  if (found === null) return;
40359
41351
  const holderId = found.physicalId;
40360
41352
  const ownHolder = Object.entries(input.stateResources).find(([otherId, record]) => otherId !== logicalId && record.resourceType === resourceType && probeFoundSameId(resourceType, record.physicalId, holderId));
40361
- if (ownHolder !== void 0) return refuse(`${subject} is created with ${named}, which this stack's ${displaySafe(ownHolder[0])} (${shown(holderId)}) already holds — a construct moved or renamed keeps its explicit name under a new logical id. Since ${adoptsText}, the create would hand back that resource and the removal of ${displaySafe(ownHolder[0])} would then delete it. Nothing was created. Give the new resource another name, or deploy the removal of ${displaySafe(ownHolder[0])} first. Do not delete or import that resource: it is already this stack's.`);
41353
+ if (ownHolder !== void 0) return refuse(`${subject} is created with ${named}, which this stack's ${displaySafe(ownHolder[0])} (${shown(holderId)}) already holds — a construct moved or renamed keeps its explicit name under a new logical id. ` + (refusesItself ? "" : `Since ${adoptsText}, the create would hand back that resource and the removal of ${displaySafe(ownHolder[0])} would then delete it. `) + `Nothing was created. Give the new resource another name, or deploy the removal of ${displaySafe(ownHolder[0])} first. Do not delete or import that resource: it is already this stack's.`);
40362
41354
  const ownCase = "if the resource is this stack's own (left by an earlier interrupted deploy, or kept by an earlier `cdkd destroy` under DeletionPolicy: Retain)";
40363
41355
  const built = input.stackName.includes("~") || resourceType === "AWS::S3::Bucket" ? void 0 : pasteableCommand("cdkd import", [{
40364
41356
  value: input.stackName,
@@ -40371,7 +41363,7 @@ async function refuseTakenCreateName(engine, input) {
40371
41363
  const adopt = built !== void 0 && maskName(built.command) === built.command ? built : void 0;
40372
41364
  const ownRemedy = input.stackName.includes("~") ? `${ownCase}, delete it and re-run.` : adopt !== void 0 ? `${ownCase}, delete it, or adopt it with ${proseQuoted(cdkdRemedy("cdkd import"), "`")} using the command below and re-run.` : `${ownCase}, delete it or adopt it with ${proseQuoted(cdkdRemedy("cdkd import"), "`")} and re-run.`;
40373
41365
  const holeNote = adopt === void 0 || adopt.withheld.length === 0 ? "" : " The command below prints a quoted hole in place of a value cdkd will not name on a command line; replace it whole, quotes included, with your stack name or '<logicalId>=<physicalId>', shell-quoted.";
40374
- return refuse(`${subject} is created with ${named}, and an existing resource (${shown(holderId)}) already holds that name. Since ${adoptsText}, creating it would take that resource over and record it as this stack's, for a later \`cdkd destroy\` to delete. Nothing was created. Choose a name no other resource holds; ` + ownRemedy + holeNote + (adopt === void 0 ? "" : `
41366
+ return refuse(`${subject} is created with ${named}, and an existing resource (${shown(holderId)}) already holds that name. ` + (refusesItself ? `A log group's create refuses a taken name, as CloudFormation's does. ` : `Since ${adoptsText}, creating it would take that resource over and record it as this stack's, for a later \`cdkd destroy\` to delete. `) + `Nothing was created. Choose a name no other resource holds; ` + ownRemedy + holeNote + (adopt === void 0 ? "" : `
40375
41367
  CONFIRM IT IS YOURS FIRST: another stack or app may own a resource of that name, and adopting it hands that resource to this stack's \`cdkd destroy\`.\nAdopt with: ${adopt.command}`));
40376
41368
  }
40377
41369
  async function resumeAbandonedCreate(engine, args) {
@@ -40979,6 +41971,8 @@ async function retryCarriedSupersededResources(engine, host, carried, resources,
40979
41971
  maskSecrets: createSecretMasker(bag),
40980
41972
  stop: () => engine.interrupted,
40981
41973
  once: options.waitInUse !== true,
41974
+ holderProvider: () => engine.providerRegistry.getProvider(resourceType),
41975
+ warn: (message) => engine.logger.warn(safeMsg` ⚠ Old ${logicalId} (${physicalId}): ${message}`),
40982
41976
  preDeleteSnapshot: {
40983
41977
  clients: engine.options.finalSnapshotClients ?? getAwsClients(),
40984
41978
  logger: {
@@ -41004,6 +41998,14 @@ async function retryCarriedSupersededResources(engine, host, carried, resources,
41004
41998
  }
41005
41999
  removeSuperseded(host, entry);
41006
42000
  changed = true;
42001
+ if (outcome.kind === "gone") {
42002
+ engine.logger.info(safeMsg` ${green("✓")} Old ${logicalId} (${physicalId}) is already gone; no delete was sent`);
42003
+ return;
42004
+ }
42005
+ if (outcome.kind === "notOurs") {
42006
+ engine.logger.warn(safeMsg` ⚠ Old ${logicalId} (${physicalId}) was not deleted: ${outcome.cause}. The replaced resource is gone, and cdkd no longer tracks it in state.`);
42007
+ return;
42008
+ }
41007
42009
  if (outcome.kind === "notDeleted") {
41008
42010
  engine.logger.warn(safeMsg` ⚠ ${deleteSkippedMessage(logicalId, physicalId, outcome.reason, "while cleaning up the superseded resource", { commandFreeLine: true })}. Delete it manually — it is no longer tracked in state.`);
41009
42011
  return;
@@ -44712,6 +45714,136 @@ function protectedDeleteMessage(logicalId, shownTable, regions, stackDestroy, al
44712
45714
  return safeMsg`DynamoDB GlobalTable ${logicalId} (${shownTable}) has deletion protection enabled in ${regions.join(", ")}; ` + `${changed} ${remedy}`;
44713
45715
  }
44714
45716
 
45717
+ // src/provisioning/tags-own-write-baseline.ts
45718
+ const TAGS_BASELINE_REREAD_DELAYS_MS = [
45719
+ 500,
45720
+ 1e3,
45721
+ 2e3,
45722
+ 4e3
45723
+ ];
45724
+ const tagWrites = /* @__PURE__ */ new Map();
45725
+ function recordTagWrite(resourceType, id, set, removed) {
45726
+ let byId = tagWrites.get(resourceType);
45727
+ if (byId === void 0) {
45728
+ byId = /* @__PURE__ */ new Map();
45729
+ tagWrites.set(resourceType, byId);
45730
+ }
45731
+ const write = byId.get(id) ?? {
45732
+ set: /* @__PURE__ */ new Map(),
45733
+ removed: /* @__PURE__ */ new Set()
45734
+ };
45735
+ for (const key of removed) {
45736
+ write.set.delete(key);
45737
+ write.removed.add(key);
45738
+ }
45739
+ for (const [key, value] of set) {
45740
+ write.removed.delete(key);
45741
+ write.set.set(key, value);
45742
+ }
45743
+ byId.set(id, write);
45744
+ }
45745
+ function takeTagWrite(resourceType, id) {
45746
+ const byId = tagWrites.get(resourceType);
45747
+ const write = byId?.get(id);
45748
+ byId?.delete(id);
45749
+ return write;
45750
+ }
45751
+ function clearTagWrites(resourceType, owned) {
45752
+ const byId = tagWrites.get(resourceType);
45753
+ if (byId === void 0) return;
45754
+ for (const id of byId.keys()) if (owned(id)) byId.delete(id);
45755
+ }
45756
+ function isDynamoDBTableArnIn(arn, tableName, regions) {
45757
+ const parts = arn.split(":");
45758
+ return parts.length === 6 && parts[2] === "dynamodb" && regions.has(parts[3] ?? "") && parts[5] === `table/${tableName}`;
45759
+ }
45760
+ function tagsShowWrite(read, write) {
45761
+ if (!Array.isArray(read)) return false;
45762
+ const live = /* @__PURE__ */ new Map();
45763
+ for (const entry of read) {
45764
+ if (typeof entry !== "object" || entry === null) return false;
45765
+ const { Key: key, Value: value } = entry;
45766
+ if (typeof key !== "string") return false;
45767
+ live.set(key, value);
45768
+ }
45769
+ for (const [key, value] of write.set) if (live.get(key) !== value) return false;
45770
+ for (const key of write.removed) if (live.has(key)) return false;
45771
+ return true;
45772
+ }
45773
+ function overlayTagWrite(read, write) {
45774
+ const seen = /* @__PURE__ */ new Set();
45775
+ const out = [];
45776
+ for (const tag of read) {
45777
+ if (write.removed.has(tag.Key) || seen.has(tag.Key)) continue;
45778
+ seen.add(tag.Key);
45779
+ const value = write.set.get(tag.Key);
45780
+ out.push(value === void 0 ? tag : {
45781
+ Key: tag.Key,
45782
+ Value: value
45783
+ });
45784
+ }
45785
+ for (const [Key, Value] of write.set) if (!seen.has(Key)) out.push({
45786
+ Key,
45787
+ Value
45788
+ });
45789
+ return out;
45790
+ }
45791
+ async function settleWrittenTags(first, reRead, write, delaysMs, onUnsettled, terminal = () => false) {
45792
+ let newest;
45793
+ let firstError;
45794
+ let answered = false;
45795
+ const take = (answer) => {
45796
+ if (terminal(answer) || tagsShowWrite(answer, write)) return true;
45797
+ newest = answer;
45798
+ return false;
45799
+ };
45800
+ try {
45801
+ const answer = await first();
45802
+ answered = true;
45803
+ if (take(answer)) return answer;
45804
+ } catch (err) {
45805
+ if (memberReadFailure(err) === "refused") throw err;
45806
+ firstError = err;
45807
+ }
45808
+ for (const delayMs of delaysMs) {
45809
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
45810
+ let answer;
45811
+ try {
45812
+ answer = await reRead();
45813
+ } catch (err) {
45814
+ if (!answered && memberReadFailure(err) === "failed") continue;
45815
+ break;
45816
+ }
45817
+ answered = true;
45818
+ if (take(answer)) return answer;
45819
+ }
45820
+ if (newest === void 0) throw firstError;
45821
+ onUnsettled();
45822
+ return overlayTagWrite(newest, write);
45823
+ }
45824
+ function declaredTagsReadback(desired) {
45825
+ const read = readTagList(desired, "desired");
45826
+ if (read.kind !== "tags") return void 0;
45827
+ const byKey = /* @__PURE__ */ new Map();
45828
+ for (const tag of read.tags) byKey.set(tag.Key, tag.Value);
45829
+ return [...byKey].filter(([key]) => !key.startsWith("aws:")).map(([Key, Value]) => ({
45830
+ Key,
45831
+ Value
45832
+ }));
45833
+ }
45834
+ function tagsMatchDeclared(read, declared) {
45835
+ if (!Array.isArray(read)) return false;
45836
+ const live = /* @__PURE__ */ new Map();
45837
+ for (const entry of read) {
45838
+ if (typeof entry !== "object" || entry === null) return false;
45839
+ const { Key: key, Value: value } = entry;
45840
+ if (typeof key !== "string") return false;
45841
+ if (!key.startsWith("aws:")) live.set(key, value);
45842
+ }
45843
+ const want = declared.filter((t) => !t.Key.startsWith("aws:"));
45844
+ return live.size === want.length && want.every((t) => live.get(t.Key) === t.Value);
45845
+ }
45846
+
44715
45847
  // src/provisioning/providers/dynamodb-globaltable/update-plan.ts
44716
45848
  async function updatePhasePlan(scope) {
44717
45849
  const { physicalId, logicalId, maskSecrets, currentRegion, properties, previousProperties, context, warn, resourceType, log } = scope;
@@ -45365,6 +46497,8 @@ async function updatePhaseIndexes(scope) {
45365
46497
 
45366
46498
  // src/provisioning/providers/dynamodb-globaltable/update.ts
45367
46499
  async function update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
46500
+ const replicaRegions = /* @__PURE__ */ new Set([...declaredReplicaRegions(properties), ...declaredReplicaRegions(previousProperties)]);
46501
+ clearTagWrites("AWS::DynamoDB::GlobalTable", (arn) => isDynamoDBTableArnIn(arn, physicalId, replicaRegions));
45368
46502
  return unsettledScope.run({
45369
46503
  mark: (key) => context?.markUnsettled?.(key),
45370
46504
  unsettled: context?.unsettledProperties ?? /* @__PURE__ */ new Set(),
@@ -45595,6 +46729,7 @@ async function applyTagDiffOnClient(client, tableArn, resourceType, id, oldTagsR
45595
46729
  ResourceArn: tableArn,
45596
46730
  TagKeys: tagsToRemove
45597
46731
  }));
46732
+ recordTagWrite("AWS::DynamoDB::GlobalTable", tableArn, [], tagsToRemove);
45598
46733
  this.logger.debug(maskSecrets(`Removed ${tagsToRemove.length} tag(s) from DynamoDB GlobalTable ${tableArn}`));
45599
46734
  }
45600
46735
  if (tagsToAdd.length > 0) {
@@ -45602,6 +46737,7 @@ async function applyTagDiffOnClient(client, tableArn, resourceType, id, oldTagsR
45602
46737
  ResourceArn: tableArn,
45603
46738
  Tags: tagsToAdd
45604
46739
  }));
46740
+ recordTagWrite("AWS::DynamoDB::GlobalTable", tableArn, tagsToAdd.map((t) => [t.Key, t.Value]), []);
45605
46741
  if (region !== void 0 && REGION_SEGMENT.test(region)) {
45606
46742
  let recordedKeys;
45607
46743
  try {
@@ -45614,6 +46750,14 @@ async function applyTagDiffOnClient(client, tableArn, resourceType, id, oldTagsR
45614
46750
  this.logger.debug(maskSecrets(`Added/updated ${tagsToAdd.length} tag(s) on DynamoDB GlobalTable ${tableArn}`));
45615
46751
  }
45616
46752
  }
46753
+ function declaredReplicaRegions(bag) {
46754
+ const replicas = bag["Replicas"];
46755
+ if (!Array.isArray(replicas)) return [];
46756
+ return replicas.flatMap((r) => {
46757
+ const region = typeof r === "object" && r !== null ? r["Region"] : void 0;
46758
+ return typeof region === "string" ? [region] : [];
46759
+ });
46760
+ }
45617
46761
 
45618
46762
  // src/provisioning/providers/dynamodb-globaltable/autoscaling.ts
45619
46763
  async function applyAutoScalingDiff(tableName, dimension, oldSettings, newSettings, client, indexName, budget, maskSecrets = (text) => text, progress) {
@@ -46068,6 +47212,344 @@ async function deleteGlobalTableResource(logicalId, physicalId, resourceType, co
46068
47212
  }
46069
47213
  }
46070
47214
 
47215
+ // src/provisioning/dynamodb-stream-members.ts
47216
+ const STREAM_SPECIFICATION_KEY = "StreamSpecification";
47217
+ const STREAM_POLICY_KEY = "ResourcePolicy";
47218
+ const STREAM_TAGS_KEY = "Tags";
47219
+ const POLICY_PATH = `${STREAM_SPECIFICATION_KEY}.${STREAM_POLICY_KEY}`;
47220
+ const TAGS_PATH = `${STREAM_SPECIFICATION_KEY}.${STREAM_TAGS_KEY}`;
47221
+ function isPlainObject$2(value) {
47222
+ return typeof value === "object" && value !== null && !Array.isArray(value);
47223
+ }
47224
+ function refusalOf(guard) {
47225
+ try {
47226
+ guard();
47227
+ return;
47228
+ } catch (error) {
47229
+ return describeAwsFailure(error).detail;
47230
+ }
47231
+ }
47232
+ function blockMembers(block) {
47233
+ return isPlainObject$2(block) ? block : {};
47234
+ }
47235
+ function readStreamPolicy(block) {
47236
+ const value = blockMembers(block)[STREAM_POLICY_KEY];
47237
+ if (value === void 0 || value === null) return { kind: "absent" };
47238
+ const containerRefusal = refusalOf(() => requireConfigObject(value, POLICY_PATH));
47239
+ if (containerRefusal !== void 0) return {
47240
+ kind: "unusable",
47241
+ reason: containerRefusal
47242
+ };
47243
+ const documentPath = `${POLICY_PATH}.PolicyDocument`;
47244
+ const document = value["PolicyDocument"];
47245
+ if (typeof document === "string") return document.trim() === "" ? {
47246
+ kind: "unusable",
47247
+ reason: `${documentPath} must not be a blank string`
47248
+ } : {
47249
+ kind: "usable",
47250
+ document
47251
+ };
47252
+ if (document === void 0 || document === null) return {
47253
+ kind: "unusable",
47254
+ reason: `${documentPath} is required when ${POLICY_PATH} is declared`
47255
+ };
47256
+ const documentRefusal = refusalOf(() => requireConfigObject(document, documentPath));
47257
+ if (documentRefusal !== void 0) return {
47258
+ kind: "unusable",
47259
+ reason: documentRefusal
47260
+ };
47261
+ return {
47262
+ kind: "usable",
47263
+ document: JSON.stringify(document)
47264
+ };
47265
+ }
47266
+ function readStreamTags(block) {
47267
+ const value = blockMembers(block)[STREAM_TAGS_KEY];
47268
+ if (value === void 0 || value === null) return { kind: "absent" };
47269
+ if (!Array.isArray(value)) return {
47270
+ kind: "unusable",
47271
+ reason: `${TAGS_PATH} must be an array of {Key, Value} entries`
47272
+ };
47273
+ const tags = /* @__PURE__ */ new Map();
47274
+ for (const [position, entry] of value.entries()) {
47275
+ const entryPath = `${TAGS_PATH}[${position}]`;
47276
+ const refusal = refusalOf(() => requireConfigObject(entry, entryPath)) ?? configStringRefusal(entry, "Key", "required", entryPath) ?? configStringRefusal(entry, "Value", "", entryPath);
47277
+ if (refusal !== void 0) return {
47278
+ kind: "unusable",
47279
+ reason: refusal
47280
+ };
47281
+ const { Key: key, Value: tagValue } = entry;
47282
+ if (typeof key !== "string") return {
47283
+ kind: "unusable",
47284
+ reason: `${entryPath}.Key is required`
47285
+ };
47286
+ tags.set(key, typeof tagValue === "string" ? tagValue : "");
47287
+ }
47288
+ return {
47289
+ kind: "usable",
47290
+ tags
47291
+ };
47292
+ }
47293
+ function streamMemberRefusals(block) {
47294
+ const refusals = [];
47295
+ const policy = readStreamPolicy(block);
47296
+ if (policy.kind === "unusable") refusals.push(policy.reason);
47297
+ const tags = readStreamTags(block);
47298
+ if (tags.kind === "unusable") refusals.push(tags.reason);
47299
+ return refusals;
47300
+ }
47301
+ function planStreamMemberOps(desiredBlock, previousBlock, options, onUnusable) {
47302
+ let desiredPolicy = readStreamPolicy(desiredBlock);
47303
+ let desiredTags = readStreamTags(desiredBlock);
47304
+ if (desiredPolicy.kind === "unusable") onUnusable(desiredPolicy.reason);
47305
+ if (desiredTags.kind === "unusable") onUnusable(desiredTags.reason);
47306
+ let previousPolicy = readStreamPolicy(previousBlock);
47307
+ let previousTags = readStreamTags(previousBlock);
47308
+ if (options.freshStream) {
47309
+ if (desiredPolicy.kind === "unusable" && previousPolicy.kind === "usable") desiredPolicy = previousPolicy;
47310
+ if (desiredTags.kind === "unusable" && previousTags.kind === "usable") desiredTags = previousTags;
47311
+ previousPolicy = { kind: "absent" };
47312
+ previousTags = { kind: "absent" };
47313
+ } else if (options.contentsUnknown === true) {
47314
+ previousPolicy = {
47315
+ kind: "unusable",
47316
+ reason: ""
47317
+ };
47318
+ previousTags = { kind: "absent" };
47319
+ }
47320
+ const tagOps = [];
47321
+ if (desiredTags.kind !== "unusable") {
47322
+ const desired = desiredTags.kind === "usable" ? desiredTags.tags : /* @__PURE__ */ new Map();
47323
+ const previous = previousTags.kind === "usable" ? previousTags.tags : /* @__PURE__ */ new Map();
47324
+ const keysToRemove = [...previous.keys()].filter((key) => !desired.has(key));
47325
+ if (keysToRemove.length > 0) tagOps.push({
47326
+ kind: "untag",
47327
+ keys: keysToRemove
47328
+ });
47329
+ const tagsToSet = [...desired].filter(([key, value]) => previous.get(key) !== value).map(([Key, Value]) => ({
47330
+ Key,
47331
+ Value
47332
+ }));
47333
+ if (tagsToSet.length > 0) tagOps.push({
47334
+ kind: "tag",
47335
+ tags: tagsToSet
47336
+ });
47337
+ }
47338
+ const policyPut = desiredPolicy.kind === "usable" && !(previousPolicy.kind === "usable" && samePolicyDocument(previousPolicy.document, desiredPolicy.document));
47339
+ const policyDelete = previousPolicy.kind !== "absent" && (desiredPolicy.kind === "absent" || policyPut && tagOps.length > 0);
47340
+ const ops = [];
47341
+ if (policyDelete) ops.push({ kind: "deletePolicy" });
47342
+ ops.push(...tagOps);
47343
+ if (policyPut && desiredPolicy.kind === "usable") ops.push({
47344
+ kind: "putPolicy",
47345
+ document: desiredPolicy.document
47346
+ });
47347
+ return ops;
47348
+ }
47349
+ function samePolicyDocument(left, right) {
47350
+ if (left === right) return true;
47351
+ try {
47352
+ return canonicalJson$1(JSON.parse(left)) === canonicalJson$1(JSON.parse(right));
47353
+ } catch {
47354
+ return false;
47355
+ }
47356
+ }
47357
+ function streamDeclaresPolicy(desiredBlock) {
47358
+ return readStreamPolicy(desiredBlock).kind === "usable";
47359
+ }
47360
+ function streamDeclaresTags(desiredBlock) {
47361
+ return readStreamTags(desiredBlock).kind === "usable";
47362
+ }
47363
+ function reverseMapStreamPolicy(livePolicy, desiredBlock) {
47364
+ if (livePolicy === void 0 || livePolicy === "") return void 0;
47365
+ const declared = blockMembers(blockMembers(desiredBlock)[STREAM_POLICY_KEY])["PolicyDocument"];
47366
+ let parsed;
47367
+ try {
47368
+ parsed = JSON.parse(livePolicy);
47369
+ } catch {
47370
+ return { PolicyDocument: livePolicy };
47371
+ }
47372
+ if (typeof declared !== "string") return { PolicyDocument: parsed };
47373
+ let declaredParsed;
47374
+ try {
47375
+ declaredParsed = JSON.parse(declared);
47376
+ } catch {
47377
+ return { PolicyDocument: livePolicy };
47378
+ }
47379
+ return { PolicyDocument: canonicalJson$1(declaredParsed) === canonicalJson$1(parsed) ? declared : livePolicy };
47380
+ }
47381
+ function streamPolicyMatchesDeclared(livePolicy, desiredBlock) {
47382
+ const declared = readStreamPolicy(desiredBlock);
47383
+ if (declared.kind !== "usable" || livePolicy === void 0) return false;
47384
+ try {
47385
+ return canonicalJson$1(JSON.parse(livePolicy)) === canonicalJson$1(JSON.parse(declared.document));
47386
+ } catch {
47387
+ return false;
47388
+ }
47389
+ }
47390
+ function declaredStreamPolicyMember(desiredBlock) {
47391
+ const declared = readStreamPolicy(desiredBlock);
47392
+ return declared.kind === "usable" ? reverseMapStreamPolicy(declared.document, desiredBlock) : void 0;
47393
+ }
47394
+ function declaredStreamTagsMember(desiredBlock) {
47395
+ const declared = readStreamTags(desiredBlock);
47396
+ return declared.kind === "usable" ? [...declared.tags].map(([Key, Value]) => ({
47397
+ Key,
47398
+ Value
47399
+ })) : void 0;
47400
+ }
47401
+ function streamTagsMatchDeclared(liveTags, desiredBlock) {
47402
+ const declared = readStreamTags(desiredBlock);
47403
+ if (declared.kind !== "usable" || liveTags.length !== declared.tags.size) return false;
47404
+ return liveTags.every((tag) => declared.tags.get(tag.Key) === tag.Value);
47405
+ }
47406
+ function canonicalJson$1(value) {
47407
+ if (Array.isArray(value)) return `[${value.map(canonicalJson$1).join(",")}]`;
47408
+ if (isPlainObject$2(value)) return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson$1(value[key])}`).join(",")}}`;
47409
+ return JSON.stringify(value) ?? "null";
47410
+ }
47411
+
47412
+ // src/provisioning/providers/dynamodb-globaltable/read-support.ts
47413
+ async function readReplicaSubSpecs(client, tableName, regionLabel, declaredReplica) {
47414
+ const out = {};
47415
+ try {
47416
+ const ci = await client.send(new DescribeContributorInsightsCommand({ TableName: tableName }));
47417
+ const block = reverseMapReplicaContributorInsights(ci.ContributorInsightsStatus, ci.ContributorInsightsMode, declaredReplica?.["ContributorInsightsSpecification"]);
47418
+ if (block !== void 0) out["ContributorInsightsSpecification"] = block;
47419
+ } catch (err) {
47420
+ if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
47421
+ this.logger.debug(`Could not read ContributorInsights for ${tableName} in ${regionLabel}: ${describeAwsFailure(err).detail}`);
47422
+ }
47423
+ try {
47424
+ const description = (await client.send(new DescribeContinuousBackupsCommand({ TableName: tableName }))).ContinuousBackupsDescription?.PointInTimeRecoveryDescription;
47425
+ const block = reverseMapReplicaPitr(description?.PointInTimeRecoveryStatus, description?.RecoveryPeriodInDays, declaredReplica?.["PointInTimeRecoverySpecification"]);
47426
+ if (block !== void 0) out["PointInTimeRecoverySpecification"] = block;
47427
+ } catch (err) {
47428
+ if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
47429
+ this.logger.debug(`Could not read PointInTimeRecovery for ${tableName} in ${regionLabel}: ${describeAwsFailure(err).detail}`);
47430
+ }
47431
+ try {
47432
+ const active = ((await client.send(new DescribeKinesisStreamingDestinationCommand({ TableName: tableName }))).KinesisDataStreamDestinations ?? []).find((d) => d.DestinationStatus === "ACTIVE" || d.DestinationStatus === "ENABLING");
47433
+ if (active?.StreamArn) {
47434
+ const ksOut = { StreamArn: active.StreamArn };
47435
+ if (active.ApproximateCreationDateTimePrecision !== void 0) ksOut["ApproximateCreationDateTimePrecision"] = active.ApproximateCreationDateTimePrecision;
47436
+ out["KinesisStreamSpecification"] = ksOut;
47437
+ }
47438
+ } catch (err) {
47439
+ if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
47440
+ this.logger.debug(`Could not read KinesisStreamingDestination for ${tableName} in ${regionLabel}: ${describeAwsFailure(err).detail}`);
47441
+ }
47442
+ return out;
47443
+ }
47444
+ async function readReplicaPolicies(client, tableName, regionLabel, tableArn, streamArn, declaredReplica, afterOwnWrite, entry) {
47445
+ if (declaredReplica === void 0) return;
47446
+ const readOne = async (what, arn, container) => {
47447
+ if (arn === void 0 || arn === "") return void 0;
47448
+ const declaredMember = () => declaredStreamPolicyMember(container);
47449
+ let last;
47450
+ const read = async () => {
47451
+ try {
47452
+ last = (await client.send(new GetResourcePolicyCommand({ ResourceArn: arn }))).Policy;
47453
+ } catch (err) {
47454
+ if (!(err instanceof PolicyNotFoundException)) throw err;
47455
+ last = void 0;
47456
+ }
47457
+ return last;
47458
+ };
47459
+ try {
47460
+ let live = await read();
47461
+ for (const delayMs of afterOwnWrite ? this.policyRereadDelaysMs : []) {
47462
+ if (streamPolicyMatchesDeclared(live, container)) break;
47463
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
47464
+ live = await read();
47465
+ }
47466
+ if (afterOwnWrite && !streamPolicyMatchesDeclared(live, container)) {
47467
+ this.logger.debug(safeMsg`Kept the declared ${what} of the ${regionLabel} replica of ${tableName} in the baseline captured after its write: the read never settled on it`);
47468
+ return declaredMember();
47469
+ }
47470
+ return reverseMapStreamPolicy(live, container);
47471
+ } catch (err) {
47472
+ if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
47473
+ this.logger.debug(safeMsg`Could not read the ${what} of the ${regionLabel} replica of ${tableName}: ${describeAwsFailure(err).detail}`);
47474
+ if (afterOwnWrite && (last !== void 0 && last !== "" || isThrottlingError(err) || isTransientServerError(err) || isAmbiguousOutcomeError(err) || err instanceof ResourceNotFoundException$1)) return declaredMember();
47475
+ return;
47476
+ }
47477
+ };
47478
+ if (readTablePolicy(declaredReplica).kind === "usable") {
47479
+ const member = await readOne("ResourcePolicy", tableArn, declaredReplica);
47480
+ if (member !== void 0) entry["ResourcePolicy"] = member;
47481
+ }
47482
+ if (readStreamPolicy$1(declaredReplica).kind === "usable") {
47483
+ const member = await readOne("stream ResourcePolicy", streamArn, declaredReplica["ReplicaStreamSpecification"]);
47484
+ if (member !== void 0) entry["ReplicaStreamSpecification"] = { ResourcePolicy: member };
47485
+ }
47486
+ }
47487
+ async function readAutoScalingSettings(tableName, scalableDimension, client, indexName) {
47488
+ const resourceId = autoScalingResourceId(tableName, indexName);
47489
+ try {
47490
+ const asClient = client ?? new ApplicationAutoScalingClient({
47491
+ ...ambientClientDefaults(),
47492
+ region: await this.dynamoDBClient.config.region() ?? ""
47493
+ });
47494
+ const targets = (await asClient.send(new DescribeScalableTargetsCommand({
47495
+ ServiceNamespace: "dynamodb",
47496
+ ResourceIds: [resourceId],
47497
+ ScalableDimension: scalableDimension
47498
+ }))).ScalableTargets ?? [];
47499
+ if (targets.length === 0) return null;
47500
+ const target = targets[0];
47501
+ if (target.MinCapacity === void 0 || target.MaxCapacity === void 0) return null;
47502
+ const targetTracking = ((await asClient.send(new DescribeScalingPoliciesCommand({
47503
+ ServiceNamespace: "dynamodb",
47504
+ ResourceId: resourceId,
47505
+ ScalableDimension: scalableDimension
47506
+ }))).ScalingPolicies ?? []).find((p) => p.PolicyType === "TargetTrackingScaling");
47507
+ if (!targetTracking) return null;
47508
+ const cfg = targetTracking.TargetTrackingScalingPolicyConfiguration;
47509
+ if (!cfg || cfg.TargetValue === void 0) return null;
47510
+ const tttConfig = { TargetValue: cfg.TargetValue };
47511
+ if (cfg.DisableScaleIn !== void 0) tttConfig["DisableScaleIn"] = cfg.DisableScaleIn;
47512
+ if (cfg.ScaleInCooldown !== void 0) tttConfig["ScaleInCooldown"] = cfg.ScaleInCooldown;
47513
+ if (cfg.ScaleOutCooldown !== void 0) tttConfig["ScaleOutCooldown"] = cfg.ScaleOutCooldown;
47514
+ return {
47515
+ MinCapacity: target.MinCapacity,
47516
+ MaxCapacity: target.MaxCapacity,
47517
+ TargetTrackingScalingPolicyConfiguration: tttConfig
47518
+ };
47519
+ } catch (err) {
47520
+ if (strictFor(indexName !== void 0 ? "GlobalSecondaryIndexes" : scalableDimension.includes("Write") ? "WriteProvisionedThroughputSettings" : "Replicas")) throw err;
47521
+ this.logger.debug(`Could not read application-autoscaling settings for ${resourceId} (${scalableDimension}): ${describeAwsFailure(err).detail}`);
47522
+ return null;
47523
+ }
47524
+ }
47525
+ async function importResource(input) {
47526
+ const explicit = resolveExplicitPhysicalId(input, "TableName");
47527
+ if (explicit) try {
47528
+ const resp = await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: explicit }));
47529
+ return {
47530
+ physicalId: explicit,
47531
+ attributes: definedAttributes({
47532
+ Arn: resp.Table?.TableArn,
47533
+ TableId: resp.Table?.TableId,
47534
+ StreamArn: resp.Table?.LatestStreamArn,
47535
+ TableName: resp.Table?.TableName ?? explicit
47536
+ })
47537
+ };
47538
+ } catch (err) {
47539
+ if (err instanceof ResourceNotFoundException$1) return null;
47540
+ throw err;
47541
+ }
47542
+ return null;
47543
+ }
47544
+ function writtenReplicaTags(afterOwnWrite, replicaArn, declaredReplica) {
47545
+ if (!afterOwnWrite) return void 0;
47546
+ const written = takeTagWrite("AWS::DynamoDB::GlobalTable", replicaArn);
47547
+ return declaredReplica === void 0 ? void 0 : written;
47548
+ }
47549
+ function settleReplicaTags(listTags, written, logicalId) {
47550
+ return settleWrittenTags(listTags, listTags, written, this.tagsBaselineRereadDelaysMs, () => warnUnsettledMember(this.logger, logicalId, "AWS::DynamoDB::GlobalTable", "Tags"));
47551
+ }
47552
+
46071
47553
  // src/provisioning/providers/dynamodb-globaltable/read.ts
46072
47554
  async function isSameResource(journaledPhysicalId, record, resourceType, context) {
46073
47555
  if (resourceType !== "AWS::DynamoDB::GlobalTable") return "unknown";
@@ -46164,7 +47646,7 @@ async function unsettledInTransition(physicalId, _logicalId, _resourceType, name
46164
47646
  return names;
46165
47647
  }
46166
47648
  }
46167
- async function readCurrentState(physicalId, _logicalId, _resourceType, properties, context) {
47649
+ async function readCurrentState(physicalId, logicalId, _resourceType, properties, context) {
46168
47650
  const afterOwnWrite = context?.afterOwnWrite === true;
46169
47651
  try {
46170
47652
  const table = (await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: physicalId }))).Table;
@@ -46224,21 +47706,23 @@ async function readCurrentState(physicalId, _logicalId, _resourceType, propertie
46224
47706
  if (typeof protection === "boolean") entry["DeletionProtectionEnabled"] = protection;
46225
47707
  if (typeof disassociationProtection === "boolean" && declaredReplica?.["DisassociationProtectionEnabled"] !== void 0) entry[DISASSOCIATION_PROTECTION_KEY] = disassociationProtection;
46226
47708
  await this.readReplicaPolicies(client, tableNameForSubs, regionLabel, replicaArn, streamArn, declaredReplica, afterOwnWrite, entry);
46227
- if (replicaArn) try {
46228
- const tagsResp = await client.send(new ListTagsOfResourceCommand({ ResourceArn: replicaArn }));
46229
- entry["Tags"] = normalizeAwsTagsToCfn(tagsResp.Tags);
46230
- } catch (tagErr) {
46231
- if (strictFor("Replicas") && !(tagErr instanceof ResourceNotFoundException$1)) throw tagErr;
46232
- if (tagErr instanceof ResourceNotFoundException$1) {
46233
- if (isLocal) throw tagErr;
46234
- this.logger.debug(`Cross-region replica ${regionLabel} returned RNF on ListTagsOfResource; omitting Tags`);
46235
- entry["Tags"] = [];
46236
- } else {
46237
- this.logger.warn(`Could not fetch tags for DynamoDB GlobalTable ${tableNameForSubs} in ${regionLabel}: ${describeAwsFailure(tagErr).detail}`);
46238
- entry["Tags"] = [];
47709
+ if (replicaArn) {
47710
+ const listTags = async () => normalizeAwsTagsToCfn((await client.send(new ListTagsOfResourceCommand({ ResourceArn: replicaArn }))).Tags);
47711
+ const tagsDeclared = writtenReplicaTags(afterOwnWrite, replicaArn, declaredReplica);
47712
+ try {
47713
+ entry["Tags"] = tagsDeclared === void 0 ? await listTags() : await this.settleReplicaTags(listTags, tagsDeclared, logicalId);
47714
+ } catch (tagErr) {
47715
+ if (strictFor("Replicas") && !(tagErr instanceof ResourceNotFoundException$1)) throw tagErr;
47716
+ if (tagErr instanceof ResourceNotFoundException$1) {
47717
+ if (isLocal) throw tagErr;
47718
+ this.logger.debug(`Cross-region replica ${regionLabel} returned RNF on ListTagsOfResource; omitting Tags`);
47719
+ entry["Tags"] = [];
47720
+ } else {
47721
+ this.logger.warn(`Could not fetch tags for DynamoDB GlobalTable ${tableNameForSubs} in ${regionLabel}: ${describeAwsFailure(tagErr).detail}`);
47722
+ entry["Tags"] = [];
47723
+ }
46239
47724
  }
46240
- }
46241
- else entry["Tags"] = [];
47725
+ } else entry["Tags"] = [];
46242
47726
  if (billingMode === "PROVISIONED") {
46243
47727
  const replicaAutoScalingClient = isLocal ? void 0 : this.getRegionalAutoScalingClient(regionLabel);
46244
47728
  const readAutoScaling = await this.readAutoScalingSettings(tableNameForSubs, "dynamodb:table:ReadCapacityUnits", replicaAutoScalingClient);
@@ -46327,336 +47811,6 @@ async function readCurrentState(physicalId, _logicalId, _resourceType, propertie
46327
47811
  }
46328
47812
  }
46329
47813
 
46330
- // src/provisioning/dynamodb-stream-members.ts
46331
- const STREAM_SPECIFICATION_KEY = "StreamSpecification";
46332
- const STREAM_POLICY_KEY = "ResourcePolicy";
46333
- const STREAM_TAGS_KEY = "Tags";
46334
- const POLICY_PATH = `${STREAM_SPECIFICATION_KEY}.${STREAM_POLICY_KEY}`;
46335
- const TAGS_PATH = `${STREAM_SPECIFICATION_KEY}.${STREAM_TAGS_KEY}`;
46336
- function isPlainObject$2(value) {
46337
- return typeof value === "object" && value !== null && !Array.isArray(value);
46338
- }
46339
- function refusalOf(guard) {
46340
- try {
46341
- guard();
46342
- return;
46343
- } catch (error) {
46344
- return describeAwsFailure(error).detail;
46345
- }
46346
- }
46347
- function blockMembers(block) {
46348
- return isPlainObject$2(block) ? block : {};
46349
- }
46350
- function readStreamPolicy(block) {
46351
- const value = blockMembers(block)[STREAM_POLICY_KEY];
46352
- if (value === void 0 || value === null) return { kind: "absent" };
46353
- const containerRefusal = refusalOf(() => requireConfigObject(value, POLICY_PATH));
46354
- if (containerRefusal !== void 0) return {
46355
- kind: "unusable",
46356
- reason: containerRefusal
46357
- };
46358
- const documentPath = `${POLICY_PATH}.PolicyDocument`;
46359
- const document = value["PolicyDocument"];
46360
- if (typeof document === "string") return document.trim() === "" ? {
46361
- kind: "unusable",
46362
- reason: `${documentPath} must not be a blank string`
46363
- } : {
46364
- kind: "usable",
46365
- document
46366
- };
46367
- if (document === void 0 || document === null) return {
46368
- kind: "unusable",
46369
- reason: `${documentPath} is required when ${POLICY_PATH} is declared`
46370
- };
46371
- const documentRefusal = refusalOf(() => requireConfigObject(document, documentPath));
46372
- if (documentRefusal !== void 0) return {
46373
- kind: "unusable",
46374
- reason: documentRefusal
46375
- };
46376
- return {
46377
- kind: "usable",
46378
- document: JSON.stringify(document)
46379
- };
46380
- }
46381
- function readStreamTags(block) {
46382
- const value = blockMembers(block)[STREAM_TAGS_KEY];
46383
- if (value === void 0 || value === null) return { kind: "absent" };
46384
- if (!Array.isArray(value)) return {
46385
- kind: "unusable",
46386
- reason: `${TAGS_PATH} must be an array of {Key, Value} entries`
46387
- };
46388
- const tags = /* @__PURE__ */ new Map();
46389
- for (const [position, entry] of value.entries()) {
46390
- const entryPath = `${TAGS_PATH}[${position}]`;
46391
- const refusal = refusalOf(() => requireConfigObject(entry, entryPath)) ?? configStringRefusal(entry, "Key", "required", entryPath) ?? configStringRefusal(entry, "Value", "", entryPath);
46392
- if (refusal !== void 0) return {
46393
- kind: "unusable",
46394
- reason: refusal
46395
- };
46396
- const { Key: key, Value: tagValue } = entry;
46397
- if (typeof key !== "string") return {
46398
- kind: "unusable",
46399
- reason: `${entryPath}.Key is required`
46400
- };
46401
- tags.set(key, typeof tagValue === "string" ? tagValue : "");
46402
- }
46403
- return {
46404
- kind: "usable",
46405
- tags
46406
- };
46407
- }
46408
- function streamMemberRefusals(block) {
46409
- const refusals = [];
46410
- const policy = readStreamPolicy(block);
46411
- if (policy.kind === "unusable") refusals.push(policy.reason);
46412
- const tags = readStreamTags(block);
46413
- if (tags.kind === "unusable") refusals.push(tags.reason);
46414
- return refusals;
46415
- }
46416
- function planStreamMemberOps(desiredBlock, previousBlock, options, onUnusable) {
46417
- let desiredPolicy = readStreamPolicy(desiredBlock);
46418
- let desiredTags = readStreamTags(desiredBlock);
46419
- if (desiredPolicy.kind === "unusable") onUnusable(desiredPolicy.reason);
46420
- if (desiredTags.kind === "unusable") onUnusable(desiredTags.reason);
46421
- let previousPolicy = readStreamPolicy(previousBlock);
46422
- let previousTags = readStreamTags(previousBlock);
46423
- if (options.freshStream) {
46424
- if (desiredPolicy.kind === "unusable" && previousPolicy.kind === "usable") desiredPolicy = previousPolicy;
46425
- if (desiredTags.kind === "unusable" && previousTags.kind === "usable") desiredTags = previousTags;
46426
- previousPolicy = { kind: "absent" };
46427
- previousTags = { kind: "absent" };
46428
- } else if (options.contentsUnknown === true) {
46429
- previousPolicy = {
46430
- kind: "unusable",
46431
- reason: ""
46432
- };
46433
- previousTags = { kind: "absent" };
46434
- }
46435
- const tagOps = [];
46436
- if (desiredTags.kind !== "unusable") {
46437
- const desired = desiredTags.kind === "usable" ? desiredTags.tags : /* @__PURE__ */ new Map();
46438
- const previous = previousTags.kind === "usable" ? previousTags.tags : /* @__PURE__ */ new Map();
46439
- const keysToRemove = [...previous.keys()].filter((key) => !desired.has(key));
46440
- if (keysToRemove.length > 0) tagOps.push({
46441
- kind: "untag",
46442
- keys: keysToRemove
46443
- });
46444
- const tagsToSet = [...desired].filter(([key, value]) => previous.get(key) !== value).map(([Key, Value]) => ({
46445
- Key,
46446
- Value
46447
- }));
46448
- if (tagsToSet.length > 0) tagOps.push({
46449
- kind: "tag",
46450
- tags: tagsToSet
46451
- });
46452
- }
46453
- const policyPut = desiredPolicy.kind === "usable" && !(previousPolicy.kind === "usable" && samePolicyDocument(previousPolicy.document, desiredPolicy.document));
46454
- const policyDelete = previousPolicy.kind !== "absent" && (desiredPolicy.kind === "absent" || policyPut && tagOps.length > 0);
46455
- const ops = [];
46456
- if (policyDelete) ops.push({ kind: "deletePolicy" });
46457
- ops.push(...tagOps);
46458
- if (policyPut && desiredPolicy.kind === "usable") ops.push({
46459
- kind: "putPolicy",
46460
- document: desiredPolicy.document
46461
- });
46462
- return ops;
46463
- }
46464
- function samePolicyDocument(left, right) {
46465
- if (left === right) return true;
46466
- try {
46467
- return canonicalJson$1(JSON.parse(left)) === canonicalJson$1(JSON.parse(right));
46468
- } catch {
46469
- return false;
46470
- }
46471
- }
46472
- function streamDeclaresPolicy(desiredBlock) {
46473
- return readStreamPolicy(desiredBlock).kind === "usable";
46474
- }
46475
- function streamDeclaresTags(desiredBlock) {
46476
- return readStreamTags(desiredBlock).kind === "usable";
46477
- }
46478
- function reverseMapStreamPolicy(livePolicy, desiredBlock) {
46479
- if (livePolicy === void 0 || livePolicy === "") return void 0;
46480
- const declared = blockMembers(blockMembers(desiredBlock)[STREAM_POLICY_KEY])["PolicyDocument"];
46481
- let parsed;
46482
- try {
46483
- parsed = JSON.parse(livePolicy);
46484
- } catch {
46485
- return { PolicyDocument: livePolicy };
46486
- }
46487
- if (typeof declared !== "string") return { PolicyDocument: parsed };
46488
- let declaredParsed;
46489
- try {
46490
- declaredParsed = JSON.parse(declared);
46491
- } catch {
46492
- return { PolicyDocument: livePolicy };
46493
- }
46494
- return { PolicyDocument: canonicalJson$1(declaredParsed) === canonicalJson$1(parsed) ? declared : livePolicy };
46495
- }
46496
- function streamPolicyMatchesDeclared(livePolicy, desiredBlock) {
46497
- const declared = readStreamPolicy(desiredBlock);
46498
- if (declared.kind !== "usable" || livePolicy === void 0) return false;
46499
- try {
46500
- return canonicalJson$1(JSON.parse(livePolicy)) === canonicalJson$1(JSON.parse(declared.document));
46501
- } catch {
46502
- return false;
46503
- }
46504
- }
46505
- function declaredStreamPolicyMember(desiredBlock) {
46506
- const declared = readStreamPolicy(desiredBlock);
46507
- return declared.kind === "usable" ? reverseMapStreamPolicy(declared.document, desiredBlock) : void 0;
46508
- }
46509
- function declaredStreamTagsMember(desiredBlock) {
46510
- const declared = readStreamTags(desiredBlock);
46511
- return declared.kind === "usable" ? [...declared.tags].map(([Key, Value]) => ({
46512
- Key,
46513
- Value
46514
- })) : void 0;
46515
- }
46516
- function streamTagsMatchDeclared(liveTags, desiredBlock) {
46517
- const declared = readStreamTags(desiredBlock);
46518
- if (declared.kind !== "usable" || liveTags.length !== declared.tags.size) return false;
46519
- return liveTags.every((tag) => declared.tags.get(tag.Key) === tag.Value);
46520
- }
46521
- function canonicalJson$1(value) {
46522
- if (Array.isArray(value)) return `[${value.map(canonicalJson$1).join(",")}]`;
46523
- if (isPlainObject$2(value)) return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson$1(value[key])}`).join(",")}}`;
46524
- return JSON.stringify(value) ?? "null";
46525
- }
46526
-
46527
- // src/provisioning/providers/dynamodb-globaltable/read-support.ts
46528
- async function readReplicaSubSpecs(client, tableName, regionLabel, declaredReplica) {
46529
- const out = {};
46530
- try {
46531
- const ci = await client.send(new DescribeContributorInsightsCommand({ TableName: tableName }));
46532
- const block = reverseMapReplicaContributorInsights(ci.ContributorInsightsStatus, ci.ContributorInsightsMode, declaredReplica?.["ContributorInsightsSpecification"]);
46533
- if (block !== void 0) out["ContributorInsightsSpecification"] = block;
46534
- } catch (err) {
46535
- if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
46536
- this.logger.debug(`Could not read ContributorInsights for ${tableName} in ${regionLabel}: ${describeAwsFailure(err).detail}`);
46537
- }
46538
- try {
46539
- const description = (await client.send(new DescribeContinuousBackupsCommand({ TableName: tableName }))).ContinuousBackupsDescription?.PointInTimeRecoveryDescription;
46540
- const block = reverseMapReplicaPitr(description?.PointInTimeRecoveryStatus, description?.RecoveryPeriodInDays, declaredReplica?.["PointInTimeRecoverySpecification"]);
46541
- if (block !== void 0) out["PointInTimeRecoverySpecification"] = block;
46542
- } catch (err) {
46543
- if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
46544
- this.logger.debug(`Could not read PointInTimeRecovery for ${tableName} in ${regionLabel}: ${describeAwsFailure(err).detail}`);
46545
- }
46546
- try {
46547
- const active = ((await client.send(new DescribeKinesisStreamingDestinationCommand({ TableName: tableName }))).KinesisDataStreamDestinations ?? []).find((d) => d.DestinationStatus === "ACTIVE" || d.DestinationStatus === "ENABLING");
46548
- if (active?.StreamArn) {
46549
- const ksOut = { StreamArn: active.StreamArn };
46550
- if (active.ApproximateCreationDateTimePrecision !== void 0) ksOut["ApproximateCreationDateTimePrecision"] = active.ApproximateCreationDateTimePrecision;
46551
- out["KinesisStreamSpecification"] = ksOut;
46552
- }
46553
- } catch (err) {
46554
- if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
46555
- this.logger.debug(`Could not read KinesisStreamingDestination for ${tableName} in ${regionLabel}: ${describeAwsFailure(err).detail}`);
46556
- }
46557
- return out;
46558
- }
46559
- async function readReplicaPolicies(client, tableName, regionLabel, tableArn, streamArn, declaredReplica, afterOwnWrite, entry) {
46560
- if (declaredReplica === void 0) return;
46561
- const readOne = async (what, arn, container) => {
46562
- if (arn === void 0 || arn === "") return void 0;
46563
- const declaredMember = () => declaredStreamPolicyMember(container);
46564
- let last;
46565
- const read = async () => {
46566
- try {
46567
- last = (await client.send(new GetResourcePolicyCommand({ ResourceArn: arn }))).Policy;
46568
- } catch (err) {
46569
- if (!(err instanceof PolicyNotFoundException)) throw err;
46570
- last = void 0;
46571
- }
46572
- return last;
46573
- };
46574
- try {
46575
- let live = await read();
46576
- for (const delayMs of afterOwnWrite ? this.policyRereadDelaysMs : []) {
46577
- if (streamPolicyMatchesDeclared(live, container)) break;
46578
- await new Promise((resolve) => setTimeout(resolve, delayMs));
46579
- live = await read();
46580
- }
46581
- if (afterOwnWrite && !streamPolicyMatchesDeclared(live, container)) {
46582
- this.logger.debug(safeMsg`Kept the declared ${what} of the ${regionLabel} replica of ${tableName} in the baseline captured after its write: the read never settled on it`);
46583
- return declaredMember();
46584
- }
46585
- return reverseMapStreamPolicy(live, container);
46586
- } catch (err) {
46587
- if (strictFor("Replicas") && !(err instanceof ResourceNotFoundException$1)) throw err;
46588
- this.logger.debug(safeMsg`Could not read the ${what} of the ${regionLabel} replica of ${tableName}: ${describeAwsFailure(err).detail}`);
46589
- if (afterOwnWrite && (last !== void 0 && last !== "" || isThrottlingError(err) || isTransientServerError(err) || isAmbiguousOutcomeError(err) || err instanceof ResourceNotFoundException$1)) return declaredMember();
46590
- return;
46591
- }
46592
- };
46593
- if (readTablePolicy(declaredReplica).kind === "usable") {
46594
- const member = await readOne("ResourcePolicy", tableArn, declaredReplica);
46595
- if (member !== void 0) entry["ResourcePolicy"] = member;
46596
- }
46597
- if (readStreamPolicy$1(declaredReplica).kind === "usable") {
46598
- const member = await readOne("stream ResourcePolicy", streamArn, declaredReplica["ReplicaStreamSpecification"]);
46599
- if (member !== void 0) entry["ReplicaStreamSpecification"] = { ResourcePolicy: member };
46600
- }
46601
- }
46602
- async function readAutoScalingSettings(tableName, scalableDimension, client, indexName) {
46603
- const resourceId = autoScalingResourceId(tableName, indexName);
46604
- try {
46605
- const asClient = client ?? new ApplicationAutoScalingClient({
46606
- ...ambientClientDefaults(),
46607
- region: await this.dynamoDBClient.config.region() ?? ""
46608
- });
46609
- const targets = (await asClient.send(new DescribeScalableTargetsCommand({
46610
- ServiceNamespace: "dynamodb",
46611
- ResourceIds: [resourceId],
46612
- ScalableDimension: scalableDimension
46613
- }))).ScalableTargets ?? [];
46614
- if (targets.length === 0) return null;
46615
- const target = targets[0];
46616
- if (target.MinCapacity === void 0 || target.MaxCapacity === void 0) return null;
46617
- const targetTracking = ((await asClient.send(new DescribeScalingPoliciesCommand({
46618
- ServiceNamespace: "dynamodb",
46619
- ResourceId: resourceId,
46620
- ScalableDimension: scalableDimension
46621
- }))).ScalingPolicies ?? []).find((p) => p.PolicyType === "TargetTrackingScaling");
46622
- if (!targetTracking) return null;
46623
- const cfg = targetTracking.TargetTrackingScalingPolicyConfiguration;
46624
- if (!cfg || cfg.TargetValue === void 0) return null;
46625
- const tttConfig = { TargetValue: cfg.TargetValue };
46626
- if (cfg.DisableScaleIn !== void 0) tttConfig["DisableScaleIn"] = cfg.DisableScaleIn;
46627
- if (cfg.ScaleInCooldown !== void 0) tttConfig["ScaleInCooldown"] = cfg.ScaleInCooldown;
46628
- if (cfg.ScaleOutCooldown !== void 0) tttConfig["ScaleOutCooldown"] = cfg.ScaleOutCooldown;
46629
- return {
46630
- MinCapacity: target.MinCapacity,
46631
- MaxCapacity: target.MaxCapacity,
46632
- TargetTrackingScalingPolicyConfiguration: tttConfig
46633
- };
46634
- } catch (err) {
46635
- if (strictFor(indexName !== void 0 ? "GlobalSecondaryIndexes" : scalableDimension.includes("Write") ? "WriteProvisionedThroughputSettings" : "Replicas")) throw err;
46636
- this.logger.debug(`Could not read application-autoscaling settings for ${resourceId} (${scalableDimension}): ${describeAwsFailure(err).detail}`);
46637
- return null;
46638
- }
46639
- }
46640
- async function importResource(input) {
46641
- const explicit = resolveExplicitPhysicalId(input, "TableName");
46642
- if (explicit) try {
46643
- const resp = await this.dynamoDBClient.send(new DescribeTableCommand({ TableName: explicit }));
46644
- return {
46645
- physicalId: explicit,
46646
- attributes: definedAttributes({
46647
- Arn: resp.Table?.TableArn,
46648
- TableId: resp.Table?.TableId,
46649
- StreamArn: resp.Table?.LatestStreamArn,
46650
- TableName: resp.Table?.TableName ?? explicit
46651
- })
46652
- };
46653
- } catch (err) {
46654
- if (err instanceof ResourceNotFoundException$1) return null;
46655
- throw err;
46656
- }
46657
- return null;
46658
- }
46659
-
46660
47814
  // src/provisioning/providers/dynamodb-globaltable/drift.ts
46661
47815
  function getDriftUnknownPaths(_resourceType, properties) {
46662
47816
  const paths = ["TableType"];
@@ -47099,6 +48253,10 @@ var DynamoDBGlobalTableProvider = class {
47099
48253
  readReplicaPolicies(...args) {
47100
48254
  return readReplicaPolicies.call(this, ...args);
47101
48255
  }
48256
+ tagsBaselineRereadDelaysMs = TAGS_BASELINE_REREAD_DELAYS_MS;
48257
+ settleReplicaTags(...args) {
48258
+ return settleReplicaTags.call(this, ...args);
48259
+ }
47102
48260
  readAutoScalingSettings(...args) {
47103
48261
  return readAutoScalingSettings.call(this, ...args);
47104
48262
  }
@@ -49867,7 +51025,7 @@ async function updateInPlace(engine, { changedProperties, noEchoOnlyChangedPrope
49867
51025
  }
49868
51026
  const dischargedByReplacement = result.wasReplaced === true && result.physicalId !== currentResource.physicalId;
49869
51027
  const keepsParameterRefusal = !dischargedByReplacement && hasUnverifiableParameterRefusal(currentResource);
49870
- const carriedAttributes = result.attributes ?? (result.wasReplaced ? void 0 : currentResource.attributes);
51028
+ const carriedAttributes = attributesAfterUpdate(resourceType, currentResource.attributes, result, (key) => engine.logger.warn(differingIdentityWarning(logicalId, resourceType, key)));
49871
51029
  registerNoEchoAttributes(engine.secretsRun, engine.maskingDeps(), logicalId, {
49872
51030
  ...carriedAttributes && { attributes: carriedAttributes },
49873
51031
  ...result.noEchoAttributes === true && { noEchoAttributes: true },
@@ -50870,6 +52028,14 @@ async function provisionCreateUpdateNode(run, createUpdateExecutor, enqueueLostC
50870
52028
  ...journaledUpdatePolicyField(change.changeType, engine.options.updatePolicy, template, logicalId, engine.resolvedUpdatePolicies.get(logicalId))
50871
52029
  };
50872
52030
  failedOperations.push(failedOp);
52031
+ const deadRecord = newResources[logicalId];
52032
+ if (change.changeType === "UPDATE" && engine.replacementRun.oldDeletedBeforeCreate.has(logicalId) && deadRecord !== void 0) {
52033
+ const attributes = replaceDeadIdentity(deadRecord.resourceType, deadRecord.attributes, previousState?.attributes, markedCreatedId === deadRecord.physicalId ? createdResourceIdentityBeforeFailure(provisionError, logicalId, change.resourceType) : void 0);
52034
+ if (attributes !== deadRecord.attributes) newResources[logicalId] = {
52035
+ ...deadRecord,
52036
+ ...attributes && { attributes }
52037
+ };
52038
+ }
50873
52039
  const heldNow = newResources[logicalId];
50874
52040
  if (attemptedGeneration !== void 0 && heldNow !== void 0) newResources[logicalId] = withNameGenerationReached(heldNow, logicalId, attemptedGeneration);
50875
52041
  let replacementOrphanOp;
@@ -53319,5 +54485,5 @@ var DeployEngine = class {
53319
54485
  }
53320
54486
  };
53321
54487
 
53322
- export { sendTtlWaitingOutRateLimit as $, getReadOnlyPropertyPaths as $a, findSdkUnwiredProperties as $c, secretNamePrintingBag as $i, parseAssetManifestBody as $l, sgProtocolKey as $n, referenceProvenanceOf as $o, reachableDivergentParameters as $r, malformedScrubResourceEntriesRefusalMessage as $s, displacedPhysicalIdShown as $t, recordedProtectionEvidence as A, responsePresignClient as Aa, refuseMalformedOutputs as Ac, isSupersededResourceRecord as Ai, renderNestedTemplateTreeDefect as Al, findDestructiveChanges as An, regionLessSecretName as Ao, replacementNeverSwapped as Ar, maskedPropertyFingerprintsOf as As, S3_AUTO_DELETE_OBJECTS_TAG as At, declaredStreamTagsMember as B, localCustomResourceCommand as Ba, refuseMalformedResourcesForExport as Bc, red as Bi, buildAssetRedirectMap as Bl, differingRemedy as Bn, cfnRefValueFromPhysicalId as Bo, removeProtectionTypeList as Br, malformedOrphanRecordsWarning as Bs, sameMove as Bt, pendingMovesOutOf as C, ProviderRegistry as Ca, repairMalformedOrphansForReadOnly as Cc, replacedDeleteFailureVerdict as Ci, isSecretValuedAttribute as Cl, NOECHO_MAC_KEY_ALIAS as Cn, AWS_CREDENTIAL_ENV_KEYS as Co, seedsDeleteFirstGuard as Cr, isWarmThroughputDecrease as Cs, INDEX_SETTLE_POLL_INTERVAL_MS as Ct, describeFileReadFailure as Cu, findServiceTokenRefusals as D, CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID as Da, malformedOutputsRefusalMessage as Dc, findNestedStackTypeChanges as Di, findNestedTemplateTreeDefect as Dl, noEchoMacVerdict as Dn, classifyRecordedSecretRegion as Do, planFailedOps as Dr, getTopLevelKeysHoldingUnreadableCreateOnly as Ds, relayedIndexBusyDelete as Dt, resolveAssemblyPath as Du, deferredServiceTokenWarning as E, wouldReturnToSdkProvider as Ea, malformedLocalOutputsWarning as Ec, withPreviousPolicies as Ei, missingStateBucketRemedy as El, noEchoMacParametersOf as En, envCredentialsAreAssumedRole as Eo, isReplacementOrphan as Er, getSettledWriteOnlyPropertyPaths as Es, maskedLogger as Et, renderAssemblyPathEscape as Eu, readProtection as F, withPrintingSecrets as Fa, malformedRenderedContainersWarning as Fc, withoutSuperseded as Fi, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Fl, rollbackOrphanIds as Fn, s3BucketWebsiteUrl as Fo, REDACTED_DELETE_ADDRESS_SKIP_REASON as Fr, declaresNoEcho as Fs, readRefactorMarker as Ft, streamDeclaresTags as G, CloudControlProvider as Ga, withheldAccountClause as Gc, noEchoParameterNamesOf as Gi, isDefaultBootstrapRepoName as Gl, propertiesChangedReason as Gn, parseWebACLArn as Go, retiredAfterRollback as Gr, refuseMalformedOrphansForOrphan as Gs, chunks as Gt, readStreamPolicy as H, setLocalCustomResourceRuntimeEnabled as Ha, repairMalformedResourcesForReadOnly as Hc, noEchoAttributeNamesOf as Hi, createLazyAssetModeContext as Hl, looselyEqual as Hn, refStateLookupFromResource as Ho, nameGenerationCarriedFrom as Hr, previewableOrphanRecords as Hs, macWriteOnlyKeys as Ht, DynamoDBGlobalTableProvider as I, NO_LOCAL_CUSTOM_RESOURCES_FLAG as Ia, malformedResourcesWarning as Ic, bold as Ii, purgeNoncurrentKeyVersions as Il, withMovedTo as In, coerceParameterTypedValue as Io, isRedactedRecordedValue as Ir, maskedPropertyFingerprint as Is, readRefactorMarkerOnce as It, streamTagsMatchDeclared as J, UNSPECIFIED_SKIP_REASON as Ja, displayLogicalId as Jc, completedReplayEntries as Ji, redirectFileAsset as Jl, siblingOwnedRevertDesired as Jn, keepHeldTokenProvenance as Jo, withNameGenerationReached as Jr, unreadableOrphanRecords as Js, withApiLimit as Jt, streamMemberRefusals as K, waitForGoneAfterDelete as Ka, STATE_RESOURCES_MALFORMED as Kc, withAttemptedItemsMasked as Ki, loadPublishableAssetManifest as Kl, proposeRenames as Kn, extractGetAttRefs as Ko, retiredNameGenerationsAfter as Kr, repairMalformedOrphanRecordsForReadOnly as Ks, isAccessDeniedError as Kt, STREAM_POLICY_KEY as L, customResourceStackName as La, malformedStateRefusalMessage as Lc, cyan as Li, decodeListingKey as Ll, changedReferenceInDiff as Ln, isUnboundTemplateParameter as Lo, redactedDeleteAddressFields as Lr, deployRefusesOrphanRowsReason as Ls, refactorMarkerMovesOf as Lt, PROTECTION_PROPERTY_BY_TYPE as M, readsNoEchoDeleteValues as Ma, repairMalformedOutputsForReadOnly as Mc, supersededHeldByOtherTypeWarning as Mi, SSM_PARAMETER_VALUE_PREFIX as Ml, findRefactorHints as Mn, s3BucketDomainName as Mo, computeImplicitDeleteEdges as Mr, parameterInputsFor as Ms, isTruthyCfnBoolean as Mt, isProtectionValueActive as N, isCustomResourceType as Na, STATE_REGION_DIVERGED as Nc, supersededHolderOf as Ni, isListParameterType as Nl, hintSidesOf as Nn, s3BucketDualStackDomainName as No, attemptUsesCompletedCreate as Nr, maskedInputProof as Ns, keptForRetainedRecord as Nt, serviceTokenBlockingReason as O, applyCustomResourceResponseExpiration as Oa, malformedOutputsWarning as Oc, deleteSupersededEntry as Oi, isAbsoluteAssetPath as Ol, noEchoValueMacsOf as On, classifyReplaySecretRegion as Oo, recheckFailedPlan as Or, tryGetTopLevelWriteOnlyProperties as Os, waitForIndexesSettled as Ot, clearBucketRegionCache as Ou, perType as P, getCurrentResourceSecrets as Pa, refuseDivergentRecordRegionForDestroy as Pc, supersededResourcesOf as Pi, ssmResolvedValueType as Pl, movedToHint as Pn, s3BucketRegionalDomainName as Po, readsRegeneratingSecret as Pr, passedParameterClassesOf as Ps, recordRetainedForReadoption as Pt, readTtlSpec as Q, withIndeterminateGuard as Qa, findHandledUnwrittenCreateOnly as Qc, orphanRecordsPrintingBag as Qi, isCfnTemplateAssetPath as Ql, cfnIngressPortValue as Qn, recordedReferenceRegions as Qo, namesAnyDeclaredParameter as Qr, malformedResourceEntriesWarning as Qs, displacedOpClause as Qt, STREAM_TAGS_KEY as R, customResourcesFailedWithoutApp as Ra, refuseMalformedResourcesForDeploy as Rc, gray as Ri, rememberSynthesizedStacks as Rl, changedReferencePath as Rn, parameterTypeMayLoseSecretIdentity as Ro, redactedDeleteAddressSkip as Rr, isReadableOrphanRecord as Rs, refactorMarkerRefusalMessage as Rt, hasPendingMovesOut as S, CC_BROKEN_REASON as Sa, refuseMalformedOrphansForDestroy as Sc, withStackRecords as Si, withStackInstanceIdWithheld as Sl, crossStackReadsForPartialSave as Sn, sendableAssumeRoleCommand as So, planRollback as Sr, coerceWarmThroughput as Ss, DELETE_INDEX_WAIT_PROCEED_NOTE as St, assemblyPathEscape as Su, refusePendingMovesOut as T, isCustomResource as Ta, malformedExportSourceWarning as Tc, resolveReplacementOldType as Ti, stringifyValue as Tl, noEchoMacBinding as Tn, callerEnvCredentials as To, isJournaledOrphan as Tr, toFiniteNumber as Ts, deleteTableWithIndexBusyRetry as Tt, namesTheSameDirectory as Tu, reverseMapStreamPolicy as U, withCustomResourceStack as Ua, JSON_LISTING_HOLE_VALUE as Uc, noEchoComparisonForTemplate as Ui, flattenAssetPlaceholders as Ul, mappingPairs as Un, lacksRecordedRefArn as Uo, nameGenerationHighWaterOf as Ur, refuseMalformedOrphanRecords as Us, readsOnlyNoEchoParameters as Ut, planStreamMemberOps as V, localCustomResourceRuntimeActive as Va, refuseMalformedState as Vc, yellow as Vi, createAssetRedirectResolver as Vl, isPairableType as Vn, isStalePlaceholderArnAttribute as Vo, orphanNeedsIdentity as Vr, malformedOrphanRowsKeptWarning as Vs, updateRefactorMarker as Vt, streamDeclaresPolicy as W, waitForLambdaFunctionActive as Wa, accountArgs as Wc, noEchoExactEchoLeavesOf as Wi, isDefaultBootstrapBucketName as Wl, parseMappingFile as Wn, lacksRecordedTableArn as Wo, nameScopeOf as Wr, refuseMalformedOrphanRecordsForDestroy as Ws, formatResourceLine as Wt, isTtlRateLimited as X, deleteLeftInPlace as Xa, hasReadableResources as Xc, maskEventTextWithBoundBags as Xi, AssetManifestLoader as Xl, siblingOwnedSgRuleIdentities as Xn, recordedOutputReferenceRegions as Xo, inheritProducerRegions as Xr, malformedLocalResourceEntriesWarning as Xs, resolvePendingCloudControlRequests as Xt, isTtlAlreadyDisabled as Y, deleteIndeterminateGuards as Ya, hasReadableOutputs as Yc, journaledOrphanPrintingBag as Yi, rewriteTemplateAssetReferences as Yl, stripSiblingOwnedParentMembers as Yn, outputReferenceProvenanceOf as Yo, getCurrentProducerRegions as Yr, isReadableResourceEntry as Ys, pendingRequestCount as Yt, planTimeToLive as Z, deleteSkipReason as Za, findActionableSdkUnwired as Zc, namingSecretsWithRecordedNoEcho as Zi, getDockerImageBySourceHash as Zl, withoutSiblingOwnedSgRules as Zn, recordedProvenanceOf as Zo, computeParameterTaint as Zr, malformedLocalResourcesWarning as Zs, NESTED_PENDING_PARENT_REASON as Zt, conditionFingerprint as _, collectManagedPolicyArnsAttachedBySiblings as _a, UNREADABLE_ORPHANS_CONTAINER_ROW as _c, DEFAULT_RESOURCE_WARN_AFTER_MS as _i, applyCrossPrefixScan as _l, makeForeignHolderScan as _n, assertFlagRoleArn as _o, earliestDefined as _r, MULTI_REGION_RECREATE_BLOCKED_TYPES as _s, beginDeleteWait as _t, hasOwnKey as _u, scanActiveConsumers as a, extractDeploymentEventError as aa, refuseMalformedResourceEntriesForImportSave as ac, secretBearingStateKeyWarning as ai, hasNoCloudControlHandlers as al, revertedNestedRowIds as an, poisonRenderedSpellingsCollidingIn as ao, recordAfterRollbackUpdate as ar, carriesDynamicReference as as, CONTRIBUTOR_INSIGHTS_KEY as at, buildDenyExternalAccessPolicy as au, readRecordedConditionVerdicts as b, withoutSiblingAttachedArns as ba, malformedOrphansWarning as bc, destroyStackRecordsView as bi, isNotImplemented as bl, DeploymentEventsReader as bn, isIamRoleArn as bo, withCreateTokenLedger as br, renderStatefulReason as bs, resolveDynamoDbDeleteBudgetClock as bt, ownValue as bu, nestedSsmNameDeferredNote as c, ccRoutedFinalSnapshotError as ca, unreadableResourceEntries as cc, exportNameNoEchoParameters as ci, S3StateBackend as cl, getCurrentNestedStackContext as cn, APPSYNC_APIKEY_ARN_RESOURCE_PATH as co, calculateResourceDrift as cr, namesRecreatedParent as cs, planContributorInsightsOp as ct, getBootstrapMarkerKey as cu, slashedSsmNameHealAdoptedNote as d, isFinalSnapshotError as da, refuseMalformedResourceProperties as dc, noEchoParameterValueSeed as di, readOnlyStateVersionOf as dl, dropFailedCommands as dn, secretSegmentsOfState as do, undeclaredEmptyObservedKeys as dr, markNewValueKnownAfterDeploy as ds, reverseMapIndexContributorInsights as dt, validateAssetBucketName as du, secretNamePrintingBags as ea, refuseMalformedResourceAttributesForOrphan as ec, resourcesNamingDeclaredParameter as ei, unwrittenCreateOnlyReplacement as el, dropSettledNestedJournals as en, isWaitAbandonedError as eo, canonicalizeIpProtocolValue as er, referenceTokensIn as es, planVectorIndexUpdates as et, resolveFileAssetSourcePath as eu, slashedSsmNameHealNote as f, refusesFinalSnapshot as fa, refuseMalformedResourcePropertiesForDestroy as fc, collectDeclaredOutputNames as fi, hasReasonlessBaselineRefusal as fl, dropFailedHint as fn, withSecretPhysicalIdsMaskedInState as fo, verbatimEchoDriftKeys as fr, replacementSidesForLog as fs, reverseMapTableContributorInsights as ft, validateContainerRepoName as fu, makeCanonicalizePropertiesFn as g, collectGroupsAddedBySiblings as ga, repairMalformedResourcePropertiesForReadOnly as gc, DEFAULT_RESOURCE_TIMEOUT_MS as gi, CrossPrefixScanCache as gl, sameJournaledOrphans as gn, applyRoleArnIfSet as go, replacementCreateRoutesToCloudControl as gr, shownType as gs, DYNAMODB_DELETE_POLL_COST_MS as gt, defineOwnKey as gu, inheritedProvenanceForChildDiff as h, buildFinalSnapshotIdentifier as ha, refuseMalformedResourcePropertiesForOrphan as hc, bindingSkippedOutputs as hi, CrossPrefixReadError as hl, loadJournaledOrphans as hn, refuseUnreadableCdkCrossAccountRefs as ho, findUpdatePolicyReplacementRefusals as hr, isPlainReferenceTo as hs, DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS as ht, getCdkdContainerRepoName as hu, mergeNoChangeOutputs as i, storedSecretNameNeedles as ia, refuseMalformedResourceEntriesForImport as ic, secretBearing as ii, NO_CC_HANDLERS_REASON as il, revertNestedChildFromJournal as in, isAlwaysLiveAttribute as io, buildReadCurrentStateContext as ir, isNamelessDynamicReferenceError as is, vectorIndexesShapeDetail as it, ensureAssetStorage as iu, recordedProtectionNote as j, TemplateNoEchoReresolver as ja, refuseMalformedOutputsForDestroy as jc, supersededAfterRollback as ji, templateIdentity as jl, formatDestructiveChange as jn, s3BucketArn as jo, IMPLICIT_DELETE_DEPENDENCIES as jr, movedMaskedProperties as js, hasCdkAutoDeleteTag as jt, diffSecurity as k, customResourceResponseExpirationWarning as ka, refuseMalformedNestedChildOutputs as kc, holdsSupersededResources as ki, listNestedTemplateRows as kl, constructPathOf as kn, producerRegionsFromState as ko, recordUnderIdIsNotOwn as kr, inputFingerprinter as ks, ECR_AUTO_DELETE_IMAGES_TAG as kt, resolveBucketRegion as ku, nestedSsmNameRowNote as l, ccRoutedInstanceTakesNoSnapshot as la, malformedDriftResourcePropertiesWarning as lc, exportNameSecretExposure as li, splitImportedOps as ll, withNestedStackContext as ln, maskedSecretSegment as lo, equalModuloMarkedMask as lr, INTRINSIC_KEYS as ls, planIndexContributorInsightsOps as lt, parseBootstrapMarker as lu, crossStackOutputProvenanceSource as m, createPreDeleteFinalSnapshot as ma, refuseMalformedResourcePropertiesForExport as mc, isExportAliasCollision as mi, rebuildClientForBucketRegion as ml, journaledOrphanLines as mn, producerLookupOver as mo, updatePartialReason as mr, findReplacedReadersOfRecreateTargets as ms, DYNAMODB_DELETE_DEADLINE_MARGIN_MS as mt, getCdkdAssetBucketName as mu, isSecretBearingReferenceString as n, secretNamedRecordNeedles as na, refuseMalformedResourceEntriesForDeploy as nc, displayTextOrWithheld as ni, withoutSdkUnwiredProperties as nl, nestedChildStackName as nn, IntrinsicFunctionResolver as no, replayRollback as nr, isImpossibleEmptyStoredAttribute as ns, vectorIndexesForCreate as nt, warnWholeAssemblyAsSource as nu, inRunStackKey as o, ATOMIC_FINAL_SNAPSHOT_TYPES as oa, refuseMalformedResourceEntriesForOrphan as oc, secretSafeKeyDisplay as oi, PROPERTY_COVERAGE_BY_TYPE as ol, withNestedRevertRun as on, stackIdTailOf as oo, settleUnsettledPrevious as or, keepsSecretReferenceToken as os, contributorInsightsRefusals as ot, assertAssetBucketRegion as ou, slashedSsmNameHealPendingNote as p, unsupportedFinalSnapshotError as pa, refuseMalformedResourcePropertiesForDrift as pc, collectPublishedOutputNames as pi, hasUnverifiableParameterRefusal as pl, isHandledOrphan as pn, resolveDynamicReferences as po, updatePartialMessage as pr, siblingsOf as ps, stripIndexContributorInsights as pt, BOOTSTRAP_MARKER_PREFIX as pu, streamPolicyMatchesDeclared as q, RollbackInlinePolicyWriters as qa, UNREADABLE_RESOURCES_MAP_ROW as qc, createReadOnlyAttributeHealerFactory as qi, redirectDockerAsset as ql, referencedLogicalIds as qn, promoteInPlaceAttributeDependents as qo, retiredNameGenerationsLeaving as qr, unpreviewableOrphanRecords as qs, lookupEachName as qt, keptWholeReasonText as r, stateSecretNameNeedles as ra, refuseMalformedResourceEntriesForDestroy as rc, exportAliasCollisionScrubWarning as ri, withoutUnwrittenSdkUnwiredProperties as rl, recordDisplacedSkips as rn, isSelectOutOfBounds as ro, DELETED_RESOURCE_REMEDY as rr, carriesFetchableDynamicReference as rs, vectorIndexesSettled as rt, AssetModeResolver as ru, checkNestedSsmNames as s, PRE_DELETE_SNAPSHOT_TYPES as sa, repairMalformedResourceEntriesForReadOnly as sc, carriedExportAliasExposure as si, TemplateParser as sl, collectNestedChildUnaddressed as sn, isSettledInstanceState as so, withUnprovenUnsettled as sr, withSharedDrainBudget as ss, indexDeclaresContributorInsights as st, isCrossRegionRedirect as su, DeployEngine as t, secretNamedAttributeNamesOf as ta, refuseMalformedResourceEntries as tc, WITHHELD_NAME_DISPLAY as ti, withoutAcceptedSdkUnwiredProperties as tl, getNestedRevertRun as tn, markWaitAbandoned as to, replayFailedOperations as tr, getAccountInfo as ts, readbackVectorIndexes as tt, warnAbsoluteAssetPath as tu, healSlashedSsmParameterNames as u, effectiveDeletionPolicy as ua, malformedResourcePropertiesWarning as uc, isWholeDynamicReferenceValue as ui, isKnownTokenFreeState as ul, deleteJournaledOrphans as un, secretPhysicalIdSegment as uo, equalModuloMask as ur, containsIntrinsic as us, readContributorInsightsSpec as ut, readBootstrapMarkerBody as uu, conditionInputsFrom as v, collectPrincipalsAttachingPolicy as va, hasReadableOrphans as vc, maskingRetryLogger as vi, crossPrefixDeniedWarning as vl, makeSiblingClaimReader as vn, assertSendableRoleArn as vo, ledgerForStack as vr, isStatefulRecreateTargetForReplace as vs, compensateRemovedDeletionProtection as vt, hasPlainPrototype as vu, pendingMovesRefusalMessage as w, ccBrokenReason as wa, malformedExportNamesWarning as wc, snapshotSegmentSurvivors as wi, isSensitiveAttributeName as wl, createNoEchoValueMacs as wn, applyCallerIdentityCredentials as wo, demoteSupersededOrphans as wr, toCfnInteger as ws, TABLE_INDEX_NOUN as wt, displayAssemblyPath as wu, childTemplateLoader as x, withoutSiblingOwned as xa, refuseMalformedOrphans as xc, getStackRecords as xi, stackInstanceIdOf as xl, DeploymentEventsStore as xn, parseIamRoleArn as xo, acquireIdempotencyToken as xr, WARM_THROUGHPUT_MEMBERS as xs, resolveDynamoDbDeleteBudgetMs as xt, absoluteAssemblyPathEscape as xu, parentSuppliedValues as y, isStoredExpression as ya, malformedOrphansRefusalMessage as yc, awaitInFlightSibling as yi, isAccessDenied$1 as yl, planOrphanAdoption as yn, explicitRoleArnOrThrow as yo, reserveStackCreateToken as yr, isStatefulRecreateTargetSync as ys, deleteBudgetKey as yt, nullPrototypeRecord as yu, declaredStreamPolicyMember as z, customResourcesRunWithoutApp as za, refuseMalformedResourcesForDestroy as zc, green as zi, synthesizedStacks as zl, changedReferenceReason as zn, AWS_NO_VALUE as zo, segmentCleanupOptions as zr, malformedOrphanRecordsRefusalMessage as zs, refuseRefactorMarker as zt };
53323
- //# sourceMappingURL=deploy-engine-Db00WvIx.js.map
54488
+ export { recordTagWrite as $, ProviderRegistry as $a, refuseMalformedResourcePropertiesForDrift as $c, gray as $i, hasUnverifiableParameterRefusal as $l, parseMappingFile as $n, producerLookupOver as $o, redactedDeleteAddressSkip as $r, siblingsOf as $s, formatResourceLine as $t, BOOTSTRAP_MARKER_PREFIX as $u, recordedProtectionEvidence as A, buildFinalSnapshotIdentifier as Aa, refuseMalformedOrphanRecordsForDestroy as Ac, bindingSkippedOutputs as Ai, accountArgs as Al, DeploymentEventsStore as An, differingIdentityWarning as Ao, findUpdatePolicyReplacementRefusals as Ar, lacksRecordedTableArn as As, DELETE_INDEX_WAIT_PROCEED_NOTE as At, isDefaultBootstrapBucketName as Au, declaredStreamTagsMember as B, SNS_DEFAULT_POLICY_ID as Ba, refuseMalformedResourceAttributesForOrphan as Bc, isSupersededResourceRecord as Bi, unwrittenCreateOnlyReplacement as Bl, formatDestructiveChange as Bn, IntrinsicFunctionResolver as Bo, isJournaledOrphan as Br, referenceTokensIn as Bs, isTruthyCfnBoolean as Bt, resolveFileAssetSourcePath as Bu, pendingMovesOutOf as C, ccRoutedFinalSnapshotError as Ca, deployRefusesOrphanRowsReason as Cc, exportNameNoEchoParameters as Ci, malformedStateRefusalMessage as Cl, journaledOrphanLines as Cn, withCustomResourceStack as Co, calculateResourceDrift as Cr, isUnboundTemplateParameter as Cs, DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS as Ct, decodeListingKey as Cu, findServiceTokenRefusals as D, refusesFinalSnapshot as Da, malformedOrphanRowsKeptWarning as Dc, collectDeclaredOutputNames as Di, refuseMalformedState as Dl, makeSiblingClaimReader as Dn, RecordedIdentityError as Do, verbatimEchoDriftKeys as Dr, isStalePlaceholderArnAttribute as Ds, deleteBudgetKey as Dt, createAssetRedirectResolver as Du, deferredServiceTokenWarning as E, isFinalSnapshotError as Ea, malformedOrphanRecordsWarning as Ec, noEchoParameterValueSeed as Ei, refuseMalformedResourcesForExport as El, makeForeignHolderScan as En, waitForGoneAfterDelete as Eo, undeclaredEmptyObservedKeys as Er, cfnRefValueFromPhysicalId as Es, compensateRemovedDeletionProtection as Et, buildAssetRedirectMap as Eu, readProtection as F, withoutSiblingAttachedArns as Fa, isReadableResourceEntry as Fc, destroyStackRecordsView as Fi, hasReadableOutputs as Fl, noEchoMacParametersOf as Fn, deleteSkipReason as Fo, withCreateTokenLedger as Fr, outputReferenceProvenanceOf as Fs, relayedIndexBusyDelete as Ft, rewriteTemplateAssetReferences as Fu, streamDeclaresTags as G, memberReadFailure as Ga, refuseMalformedResourceEntriesForImportSave as Gc, withoutSuperseded as Gi, hasNoCloudControlHandlers as Gl, withMovedTo as Gn, isSettledInstanceState as Go, replacementNeverSwapped as Gr, carriesDynamicReference as Gs, refactorMarkerMovesOf as Gt, buildDenyExternalAccessPolicy as Gu, readStreamPolicy as H, declaredPolicyDocument as Ha, refuseMalformedResourceEntriesForDeploy as Hc, supersededHeldByOtherTypeWarning as Hi, withoutSdkUnwiredProperties as Hl, hintSidesOf as Hn, isAlwaysLiveAttribute as Ho, planFailedOps as Hr, isImpossibleEmptyStoredAttribute as Hs, recordRetainedForReadoption as Ht, warnWholeAssemblyAsSource as Hu, DynamoDBGlobalTableProvider as I, withoutSiblingOwned as Ia, malformedLocalResourceEntriesWarning as Ic, getStackRecords as Ii, hasReadableResources as Il, noEchoMacVerdict as In, withIndeterminateGuard as Io, acquireIdempotencyToken as Ir, recordedOutputReferenceRegions as Is, waitForIndexesSettled as It, AssetManifestLoader as Iu, streamTagsMatchDeclared as J, settleDeclaredMember as Ja, unreadableResourceEntries as Jc, resolveReplacementOldType as Ji, S3StateBackend as Jl, changedReferenceReason as Jn, maskedSecretSegment as Jo, attemptUsesCompletedCreate as Jr, namesRecreatedParent as Js, sameMove as Jt, getBootstrapMarkerKey as Ju, streamMemberRefusals as K, policyDocumentMatchesDeclared as Ka, refuseMalformedResourceEntriesForOrphan as Kc, replacedDeleteFailureVerdict as Ki, PROPERTY_COVERAGE_BY_TYPE as Kl, changedReferenceInDiff as Kn, APPSYNC_APIKEY_ARN_RESOURCE_PATH as Ko, IMPLICIT_DELETE_DEPENDENCIES as Kr, keepsSecretReferenceToken as Ks, refactorMarkerRefusalMessage as Kt, assertAssetBucketRegion as Ku, STREAM_POLICY_KEY as L, KMS_DEFAULT_KEY_POLICY_ID as La, malformedLocalResourcesWarning as Lc, withStackRecords as Li, findActionableSdkUnwired as Ll, noEchoValueMacsOf as Ln, getReadOnlyPropertyPaths as Lo, planRollback as Lr, recordedProvenanceOf as Ls, ECR_AUTO_DELETE_IMAGES_TAG as Lt, getDockerImageBySourceHash as Lu, PROTECTION_PROPERTY_BY_TYPE as M, collectManagedPolicyArnsAttachedBySiblings as Ma, repairMalformedOrphanRecordsForReadOnly as Mc, DEFAULT_RESOURCE_WARN_AFTER_MS as Mi, STATE_RESOURCES_MALFORMED as Ml, NOECHO_MAC_KEY_ALIAS as Mn, UNSPECIFIED_SKIP_REASON as Mo, earliestDefined as Mr, extractGetAttRefs as Ms, TABLE_INDEX_NOUN as Mt, loadPublishableAssetManifest as Mu, isProtectionValueActive as N, collectPrincipalsAttachingPolicy as Na, unpreviewableOrphanRecords as Nc, maskingRetryLogger as Ni, UNREADABLE_RESOURCES_MAP_ROW as Nl, createNoEchoValueMacs as Nn, deleteIndeterminateGuards as No, ledgerForStack as Nr, promoteInPlaceAttributeDependents as Ns, deleteTableWithIndexBusyRetry as Nt, redirectDockerAsset as Nu, serviceTokenBlockingReason as O, unsupportedFinalSnapshotError as Oa, previewableOrphanRecords as Oc, collectPublishedOutputNames as Oi, repairMalformedResourcesForReadOnly as Ol, planOrphanAdoption as On, RecordedIdentityMismatchError as Oo, updatePartialMessage as Or, refStateLookupFromResource as Os, resolveDynamoDbDeleteBudgetClock as Ot, createLazyAssetModeContext as Ou, perType as P, isStoredExpression as Pa, unreadableOrphanRecords as Pc, awaitInFlightSibling as Pi, displayLogicalId as Pl, noEchoMacBinding as Pn, deleteLeftInPlace as Po, reserveStackCreateToken as Pr, keepHeldTokenProvenance as Ps, maskedLogger as Pt, redirectFileAsset as Pu, isDynamoDBTableArnIn as Q, CC_BROKEN_REASON as Qa, refuseMalformedResourcePropertiesForDestroy as Qc, cyan as Qi, hasReasonlessBaselineRefusal as Ql, mappingPairs as Qn, resolveDynamicReferences as Qo, redactedDeleteAddressFields as Qr, replacementSidesForLog as Qs, licensedNameHolder as Qt, validateContainerRepoName as Qu, STREAM_TAGS_KEY as R, LAMBDA_PERMISSION_STATEMENT_KEYS as Ra, malformedResourceEntriesWarning as Rc, deleteSupersededEntry as Ri, findHandledUnwrittenCreateOnly as Rl, constructPathOf as Rn, isWaitAbandonedError as Ro, seedsDeleteFirstGuard as Rr, recordedReferenceRegions as Rs, S3_AUTO_DELETE_OBJECTS_TAG as Rt, isCfnTemplateAssetPath as Ru, hasPendingMovesOut as S, PRE_DELETE_SNAPSHOT_TYPES as Sa, maskedPropertyFingerprint as Sc, carriedExportAliasExposure as Si, malformedResourcesWarning as Sl, isHandledOrphan as Sn, setLocalCustomResourceRuntimeEnabled as So, withUnprovenUnsettled as Sr, coerceParameterTypedValue as Ss, DYNAMODB_DELETE_DEADLINE_MARGIN_MS as St, purgeNoncurrentKeyVersions as Su, refusePendingMovesOut as T, effectiveDeletionPolicy as Ta, malformedOrphanRecordsRefusalMessage as Tc, isWholeDynamicReferenceValue as Ti, refuseMalformedResourcesForDestroy as Tl, sameJournaledOrphans as Tn, CloudControlProvider as To, equalModuloMask as Tr, AWS_NO_VALUE as Ts, beginDeleteWait as Tt, synthesizedStacks as Tu, reverseMapStreamPolicy as U, efsPolicyMatchesDeclared as Ua, refuseMalformedResourceEntriesForDestroy as Uc, supersededHolderOf as Ui, withoutUnwrittenSdkUnwiredProperties as Ul, movedToHint as Un, poisonRenderedSpellingsCollidingIn as Uo, recheckFailedPlan as Ur, carriesFetchableDynamicReference as Us, readRefactorMarker as Ut, AssetModeResolver as Uu, planStreamMemberOps as V, declaredMemberDocument as Va, refuseMalformedResourceEntries as Vc, supersededAfterRollback as Vi, withoutAcceptedSdkUnwiredProperties as Vl, findRefactorHints as Vn, isSelectOutOfBounds as Vo, isReplacementOrphan as Vr, getAccountInfo as Vs, keptForRetainedRecord as Vt, warnAbsoluteAssetPath as Vu, streamDeclaresPolicy as W, lambdaPermissionMatchesDeclared as Wa, refuseMalformedResourceEntriesForImport as Wc, supersededResourcesOf as Wi, NO_CC_HANDLERS_REASON as Wl, rollbackOrphanIds as Wn, stackIdTailOf as Wo, recordUnderIdIsNotOwn as Wr, isNamelessDynamicReferenceError as Ws, readRefactorMarkerOnce as Wt, ensureAssetStorage as Wu, clearTagWrites as X, attemptedPolicyDocument as Xa, malformedResourcePropertiesWarning as Xc, findNestedStackTypeChanges as Xi, isKnownTokenFreeState as Xl, isPairableType as Xn, secretSegmentsOfState as Xo, REDACTED_DELETE_ADDRESS_SKIP_REASON as Xr, containsIntrinsic as Xs, macWriteOnlyKeys as Xt, readBootstrapMarkerBody as Xu, TAGS_BASELINE_REREAD_DELAYS_MS as Y, warnUnsettledMember as Ya, malformedDriftResourcePropertiesWarning as Yc, withPreviousPolicies as Yi, splitImportedOps as Yl, differingRemedy as Yn, secretPhysicalIdSegment as Yo, readsRegeneratingSecret as Yr, INTRINSIC_KEYS as Ys, updateRefactorMarker as Yt, parseBootstrapMarker as Yu, declaredTagsReadback as Z, policyContentKey as Za, refuseMalformedResourceProperties as Zc, bold as Zi, readOnlyStateVersionOf as Zl, looselyEqual as Zn, withSecretPhysicalIdsMaskedInState as Zo, isRedactedRecordedValue as Zr, markNewValueKnownAfterDeploy as Zs, readsOnlyNoEchoParameters as Zt, validateAssetBucketName as Zu, conditionFingerprint as _, secretNamedRecordNeedles as _a, movedMaskedProperties as _c, displayTextOrWithheld as _i, refuseMalformedOutputsForDestroy as _l, getCurrentNestedStackContext as _n, customResourceStackName as _o, replayRollback as _r, s3BucketArn as _s, planIndexContributorInsightsOps as _t, templateIdentity as _u, scanActiveConsumers as a, noEchoExactEchoLeavesOf as aa, isStatefulRecreateTargetSync as ac, nullPrototypeRecord as ad, nameScopeOf as ai, malformedOrphansRefusalMessage as al, resolvePendingCloudControlRequests as an, classifyHandleUrl as ao, recordedRuleIdOf as ar, isIamRoleArn as as, planTimeToLive as at, isAccessDenied$1 as au, readRecordedConditionVerdicts as b, extractDeploymentEventError as ba, passedParameterClassesOf as bc, secretBearingStateKeyWarning as bi, refuseDivergentRecordRegionForDestroy as bl, dropFailedCommands as bn, localCustomResourceCommand as bo, recordAfterRollbackUpdate as br, s3BucketRegionalDomainName as bs, reverseMapTableContributorInsights as bt, ssmResolvedValueType as bu, nestedSsmNameDeferredNote as c, createReadOnlyAttributeHealerFactory as ca, coerceWarmThroughput as cc, assemblyPathEscape as cd, retiredNameGenerationsLeaving as ci, refuseMalformedOrphansForDestroy as cl, displacedPhysicalIdShown as cn, applyCustomResourceResponseExpiration as co, siblingOwnedSgRuleIdentities as cr, AWS_CREDENTIAL_ENV_KEYS as cs, planVectorIndexUpdates as ct, withStackInstanceIdWithheld as cu, slashedSsmNameHealAdoptedNote as d, maskEventTextWithBoundBags as da, toFiniteNumber as dc, namesTheSameDirectory as dd, inheritProducerRegions as di, malformedExportSourceWarning as dl, nestedChildStackName as dn, TemplateNoEchoReresolver as do, SG_RULE_ID_PATTERN as dr, envCredentialsAreAssumedRole as ds, vectorIndexesSettled as dt, stringifyValue as du, green as ea, findReplacedReadersOfRecreateTargets as ec, getCdkdAssetBucketName as ed, segmentCleanupOptions as ei, refuseMalformedResourcePropertiesForExport as el, chunks as en, ccBrokenReason as eo, propertiesChangedReason as er, refuseUnreadableCdkCrossAccountRefs as es, settleWrittenTags as et, rebuildClientForBucketRegion as eu, slashedSsmNameHealNote as f, namingSecretsWithRecordedNoEcho as fa, getSettledWriteOnlyPropertyPaths as fc, renderAssemblyPathEscape as fd, computeParameterTaint as fi, malformedLocalOutputsWarning as fl, recordDisplacedSkips as fn, readsNoEchoDeleteValues as fo, cfnIngressPortValue as fr, classifyRecordedSecretRegion as fs, vectorIndexesShapeDetail as ft, missingStateBucketRemedy as fu, makeCanonicalizePropertiesFn as g, secretNamedAttributeNamesOf as ga, maskedPropertyFingerprintsOf as gc, WITHHELD_NAME_DISPLAY as gi, refuseMalformedOutputs as gl, collectNestedChildUnaddressed as gn, NO_LOCAL_CUSTOM_RESOURCES_FLAG as go, replayFailedOperations as gr, isUnexposedRecordedIdentity as gs, planContributorInsightsOp as gt, renderNestedTemplateTreeDefect as gu, inheritedProvenanceForChildDiff as h, secretNamePrintingBags as ha, inputFingerprinter as hc, resolveBucketRegion as hd, resourcesNamingDeclaredParameter as hi, refuseMalformedNestedChildOutputs as hl, withNestedRevertRun as hn, withPrintingSecrets as ho, canonicalizeIpProtocolValue as hr, regionLessSecretName as hs, indexDeclaresContributorInsights as ht, listNestedTemplateRows as hu, mergeNoChangeOutputs as i, noEchoComparisonForTemplate as ia, isStatefulRecreateTargetForReplace as ic, hasPlainPrototype as id, nameGenerationHighWaterOf as ii, hasReadableOrphans as il, pendingRequestCount as in, WaitConditionSignalStore as io, stripSiblingOwnedParentMembers as ir, explicitRoleArnOrThrow as is, isTtlRateLimited as it, crossPrefixDeniedWarning as iu, recordedProtectionNote as j, collectGroupsAddedBySiblings as ja, refuseMalformedOrphansForOrphan as jc, DEFAULT_RESOURCE_TIMEOUT_MS as ji, withheldAccountClause as jl, crossStackReadsForPartialSave as jn, RollbackInlinePolicyWriters as jo, replacementCreateRoutesToCloudControl as jr, parseWebACLArn as js, INDEX_SETTLE_POLL_INTERVAL_MS as jt, isDefaultBootstrapRepoName as ju, diffSecurity as k, createPreDeleteFinalSnapshot as ka, refuseMalformedOrphanRecords as kc, isExportAliasCollision as ki, JSON_LISTING_HOLE_VALUE as kl, DeploymentEventsReader as kn, assertRecordedIdentity as ko, updatePartialReason as kr, lacksRecordedRefArn as ks, resolveDynamoDbDeleteBudgetMs as kt, flattenAssetPlaceholders as ku, nestedSsmNameRowNote as l, completedReplayEntries as la, isWarmThroughputDecrease as lc, describeFileReadFailure as ld, withNameGenerationReached as li, repairMalformedOrphansForReadOnly as ll, dropSettledNestedJournals as ln, customResourceResponseExpirationWarning as lo, siblingRecordedSgRuleIds as lr, applyCallerIdentityCredentials as ls, readbackVectorIndexes as lt, isSecretValuedAttribute as lu, crossStackOutputProvenanceSource as m, secretNamePrintingBag as ma, tryGetTopLevelWriteOnlyProperties as mc, clearBucketRegionCache as md, reachableDivergentParameters as mi, malformedOutputsWarning as ml, revertedNestedRowIds as mn, getCurrentResourceSecrets as mo, sgProtocolKey as mr, producerRegionsFromState as ms, contributorInsightsRefusals as mt, isAbsoluteAssetPath as mu, isSecretBearingReferenceString as n, yellow as na, shownType as nc, defineOwnKey as nd, orphanNeedsIdentity as ni, repairMalformedResourcePropertiesForReadOnly as nl, lookupEachName as nn, wouldReturnToSdkProvider as no, referencedLogicalIds as nr, assertFlagRoleArn as ns, takeTagWrite as nt, CrossPrefixScanCache as nu, inRunStackKey as o, noEchoParameterNamesOf as oa, renderStatefulReason as oc, ownValue as od, retiredAfterRollback as oi, malformedOrphansWarning as ol, NESTED_PENDING_PARENT_REASON as on, evaluateSignals as oo, sgRuleOwnershipIdentity as or, parseIamRoleArn as os, readTtlSpec as ot, isNotImplemented as ou, slashedSsmNameHealPendingNote as p, orphanRecordsPrintingBag as pa, getTopLevelKeysHoldingUnreadableCreateOnly as pc, resolveAssemblyPath as pd, namesAnyDeclaredParameter as pi, malformedOutputsRefusalMessage as pl, revertNestedChildFromJournal as pn, isCustomResourceType as po, recordedSgRuleId as pr, classifyReplaySecretRegion as ps, CONTRIBUTOR_INSIGHTS_KEY as pt, findNestedTemplateTreeDefect as pu, streamPolicyMatchesDeclared as q, reReadUntilSettled as qa, repairMalformedResourceEntriesForReadOnly as qc, snapshotSegmentSurvivors as qi, TemplateParser as ql, changedReferencePath as qn, displayPhysicalId as qo, computeImplicitDeleteEdges as qr, withSharedDrainBudget as qs, refuseRefactorMarker as qt, isCrossRegionRedirect as qu, keptWholeReasonText as r, noEchoAttributeNamesOf as ra, MULTI_REGION_RECREATE_BLOCKED_TYPES as rc, hasOwnKey as rd, nameGenerationCarriedFrom as ri, UNREADABLE_ORPHANS_CONTAINER_ROW as rl, withApiLimit as rn, LEGACY_HANDLE_ID_PREFIX as ro, siblingOwnedRevertDesired as rr, assertSendableRoleArn as rs, isTtlAlreadyDisabled as rt, applyCrossPrefixScan as ru, checkNestedSsmNames as s, withAttemptedItemsMasked as sa, WARM_THROUGHPUT_MEMBERS as sc, absoluteAssemblyPathEscape as sd, retiredNameGenerationsAfter as si, refuseMalformedOrphans as sl, displacedOpClause as sn, CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID as so, sgSiblingDecidedById as sr, sendableAssumeRoleCommand as ss, sendTtlWaitingOutRateLimit as st, stackInstanceIdOf as su, DeployEngine as t, red as ta, isPlainReferenceTo as tc, getCdkdContainerRepoName as td, removeProtectionTypeList as ti, refuseMalformedResourcePropertiesForOrphan as tl, isAccessDeniedError as tn, isCustomResource as to, proposeRenames as tr, applyRoleArnIfSet as ts, tagsMatchDeclared as tt, CrossPrefixReadError as tu, healSlashedSsmParameterNames as u, journaledOrphanPrintingBag as ua, toCfnInteger as uc, displayAssemblyPath as ud, getCurrentProducerRegions as ui, malformedExportNamesWarning as ul, getNestedRevertRun as un, responsePresignClient as uo, withoutSiblingOwnedSgRules as ur, callerEnvCredentials as us, vectorIndexesForCreate as ut, isSensitiveAttributeName as uu, conditionInputsFrom as v, stateSecretNameNeedles as va, parameterInputsFor as vc, exportAliasCollisionScrubWarning as vi, repairMalformedOutputsForReadOnly as vl, withNestedStackContext as vn, customResourcesFailedWithoutApp as vo, DELETED_RESOURCE_REMEDY as vr, s3BucketDomainName as vs, readContributorInsightsSpec as vt, SSM_PARAMETER_VALUE_PREFIX as vu, pendingMovesRefusalMessage as w, ccRoutedInstanceTakesNoSnapshot as wa, isReadableOrphanRecord as wc, exportNameSecretExposure as wi, refuseMalformedResourcesForDeploy as wl, loadJournaledOrphans as wn, waitForLambdaFunctionActive as wo, equalModuloMarkedMask as wr, parameterTypeMayLoseSecretIdentity as ws, DYNAMODB_DELETE_POLL_COST_MS as wt, rememberSynthesizedStacks as wu, childTemplateLoader as x, ATOMIC_FINAL_SNAPSHOT_TYPES as xa, declaresNoEcho as xc, secretSafeKeyDisplay as xi, malformedRenderedContainersWarning as xl, dropFailedHint as xn, localCustomResourceRuntimeActive as xo, settleUnsettledPrevious as xr, s3BucketWebsiteUrl as xs, stripIndexContributorInsights as xt, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as xu, parentSuppliedValues as y, storedSecretNameNeedles as ya, maskedInputProof as yc, secretBearing as yi, STATE_REGION_DIVERGED as yl, deleteJournaledOrphans as yn, customResourcesRunWithoutApp as yo, buildReadCurrentStateContext as yr, s3BucketDualStackDomainName as ys, reverseMapIndexContributorInsights as yt, isListParameterType as yu, declaredStreamPolicyMember as z, OWN_WRITE_REREAD_DELAYS_MS as za, malformedScrubResourceEntriesRefusalMessage as zc, holdsSupersededResources as zi, findSdkUnwiredProperties as zl, findDestructiveChanges as zn, markWaitAbandoned as zo, demoteSupersededOrphans as zr, referenceProvenanceOf as zs, hasCdkAutoDeleteTag as zt, parseAssetManifestBody as zu };
54489
+ //# sourceMappingURL=deploy-engine-BjSv27_M.js.map