@cdkd/cli 0.352.12 → 0.353.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 (57) hide show
  1. package/dist/{ambient-client-defaults-zXLYCPYh.js → ambient-client-defaults-z2kbR8l-.js} +3 -3
  2. package/dist/{ambient-client-defaults-zXLYCPYh.js.map → ambient-client-defaults-z2kbR8l-.js.map} +1 -1
  3. package/dist/{asg-provider-vzD1uanW.js → asg-provider-CM19nSRR.js} +14 -9
  4. package/dist/asg-provider-CM19nSRR.js.map +1 -0
  5. package/dist/cli.js +3 -3
  6. package/dist/{custom-resource-runtime-5yuSHn1E.js → custom-resource-runtime-gD0yCVTA.js} +6 -6
  7. package/dist/{custom-resource-runtime-5yuSHn1E.js.map → custom-resource-runtime-gD0yCVTA.js.map} +1 -1
  8. package/dist/{db-associated-roles-D6FzrHrq.js → db-associated-roles-CwKvJHmW.js} +2 -2
  9. package/dist/{db-associated-roles-D6FzrHrq.js.map → db-associated-roles-CwKvJHmW.js.map} +1 -1
  10. package/dist/{delete-started-BYb5bEiw.js → delete-started-BR6VF4-U.js} +4 -4
  11. package/dist/{delete-started-BYb5bEiw.js.map → delete-started-BR6VF4-U.js.map} +1 -1
  12. package/dist/{deploy-engine-DIe64g1M.js → deploy-engine-axD9sX_9.js} +1493 -1056
  13. package/dist/deploy-engine-axD9sX_9.js.map +1 -0
  14. package/dist/{diff-calculator-e0X8wg5d.js → diff-calculator-Dych6a6c.js} +302 -23
  15. package/dist/diff-calculator-Dych6a6c.js.map +1 -0
  16. package/dist/{ecr-uri-B4jEXWEo.js → ecr-uri-CmjaicP1.js} +2 -2
  17. package/dist/{ecr-uri-B4jEXWEo.js.map → ecr-uri-CmjaicP1.js.map} +1 -1
  18. package/dist/{expected-bucket-owner-BiM4Hy8G.js → expected-bucket-owner-BUXAXOgl.js} +2 -2
  19. package/dist/{expected-bucket-owner-BiM4Hy8G.js.map → expected-bucket-owner-BUXAXOgl.js.map} +1 -1
  20. package/dist/{iam-role-provider-CRAkOXUR.js → iam-role-provider-C92_i6aW.js} +8 -8
  21. package/dist/{iam-role-provider-CRAkOXUR.js.map → iam-role-provider-C92_i6aW.js.map} +1 -1
  22. package/dist/{image-plan-BZ-0TCSM.js → image-plan-Cu3b26DY.js} +10 -8
  23. package/dist/image-plan-Cu3b26DY.js.map +1 -0
  24. package/dist/index.d.ts +121 -13
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +5 -5
  27. package/dist/{logger-DGUlDiYH.js → logger-oZMfcKSj.js} +2 -2
  28. package/dist/{logger-DGUlDiYH.js.map → logger-oZMfcKSj.js.map} +1 -1
  29. package/dist/{neptune-provider-CHVuPvHJ.js → neptune-provider-CN3MA8Cw.js} +7 -7
  30. package/dist/{neptune-provider-CHVuPvHJ.js.map → neptune-provider-CN3MA8Cw.js.map} +1 -1
  31. package/dist/{program-pfwGZi1I.js → program-BfTCUNof.js} +156 -40
  32. package/dist/program-BfTCUNof.js.map +1 -0
  33. package/dist/{provider-classes-CaogwY3K.js → provider-classes-BbS4iho1.js} +22 -22
  34. package/dist/{provider-classes-CaogwY3K.js.map → provider-classes-BbS4iho1.js.map} +1 -1
  35. package/dist/{rds-provider-I6YAiIv3.js → rds-provider-k-7oWDtG.js} +10 -10
  36. package/dist/{rds-provider-I6YAiIv3.js.map → rds-provider-k-7oWDtG.js.map} +1 -1
  37. package/dist/{read-replica-BbDOKi8I.js → read-replica-Dx5O9bW4.js} +3 -3
  38. package/dist/{read-replica-BbDOKi8I.js.map → read-replica-Dx5O9bW4.js.map} +1 -1
  39. package/dist/{replacement-rules-DEMSUsSU.js → replacement-rules-SPQJMbC6.js} +3 -3
  40. package/dist/{replacement-rules-DEMSUsSU.js.map → replacement-rules-SPQJMbC6.js.map} +1 -1
  41. package/dist/{resource-deadline-B34RyqEU.js → resource-deadline-CImbEePa.js} +4 -4
  42. package/dist/{resource-deadline-B34RyqEU.js.map → resource-deadline-CImbEePa.js.map} +1 -1
  43. package/dist/{run-cli-D_mCCBi9.js → run-cli-B637Czto.js} +2 -2
  44. package/dist/{run-cli-D_mCCBi9.js.map → run-cli-B637Czto.js.map} +1 -1
  45. package/dist/{ec2-termination-protection-BhINWGSK.js → update-policy-C3iCsDhx.js} +15 -7
  46. package/dist/update-policy-C3iCsDhx.js.map +1 -0
  47. package/dist/{update-removal-Cr8BZ_MT.js → update-removal-TXGn1k50.js} +22 -22
  48. package/dist/{update-removal-Cr8BZ_MT.js.map → update-removal-TXGn1k50.js.map} +1 -1
  49. package/dist/{version-C3ovda8-.js → version-HusdN8vD.js} +2 -2
  50. package/dist/{version-C3ovda8-.js.map → version-HusdN8vD.js.map} +1 -1
  51. package/package.json +2 -2
  52. package/dist/asg-provider-vzD1uanW.js.map +0 -1
  53. package/dist/deploy-engine-DIe64g1M.js.map +0 -1
  54. package/dist/diff-calculator-e0X8wg5d.js.map +0 -1
  55. package/dist/ec2-termination-protection-BhINWGSK.js.map +0 -1
  56. package/dist/image-plan-BZ-0TCSM.js.map +0 -1
  57. package/dist/program-pfwGZi1I.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-C3ovda8-.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-DGUlDiYH.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, 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-zXLYCPYh.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-HusdN8vD.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-oZMfcKSj.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, 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-z2kbR8l-.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 describeJsonParseFailure, C as PhaseClock, E as recordPhase, M as parseFailureDebugDetail, N as parseJsonNamingNoBody, O as timePhase, P as utf8ByteLength, S as CREATE_ONLY_PATHS_SNAPSHOT, T as phaseTimingsEnabled, _ as hasNoRegistrySchema, a as reDisableInstanceApiTermination, b as IAM_PROPAGATION_MAX_DELAY_MS, c as unchangedBehindSecretReference, d as getCreateOnlyPropertyPaths, f as isIntrinsicShaped, g as describeTypeWithThrottleRetry, h as parseCreateOnlyPropertyPointers, i as observeThenDisableInstanceApiTermination, j as jsonParseFailureStandIn, k as timePhaseSync, l as cachedCreateOnlyPropertyPaths, m as templateResourceTypes, n as ec2InstanceProtectionSite, o as reEnableInstanceApiTermination, p as prefetchCreateOnlyPropertyPaths, r as isTerminationProtectionPropagationError, v as isAwsEmulatorRegistryMiss, w as phaseScopeForStack, x as withRetry, y as reportAwsEmulatorRegistryMiss } from "./ec2-termination-protection-BhINWGSK.js";
6
+ import { A as timePhaseSync, C as CREATE_ONLY_PATHS_SNAPSHOT, D as recordPhase, E as phaseTimingsEnabled, F as utf8ByteLength, M as jsonParseFailureStandIn, N as parseFailureDebugDetail, P as parseJsonNamingNoBody, S as withRetry, T as phaseScopeForStack, _ as describeTypeWithThrottleRetry, a as observeThenDisableInstanceApiTermination, b as reportAwsEmulatorRegistryMiss, f as getCreateOnlyPropertyPaths, g as parseCreateOnlyPropertyPointers, h as templateResourceTypes, i as isTerminationProtectionPropagationError, j as describeJsonParseFailure, k as timePhase, l as unchangedBehindSecretReference, m as prefetchCreateOnlyPropertyPaths, o as reDisableInstanceApiTermination, p as isIntrinsicShaped, r as ec2InstanceProtectionSite, s as reEnableInstanceApiTermination, t as ignoresUnmodifiedGroupSize, u as cachedCreateOnlyPropertyPaths, v as hasNoRegistrySchema, w as PhaseClock, x as IAM_PROPAGATION_MAX_DELAY_MS, y as isAwsEmulatorRegistryMiss } from "./update-policy-C3iCsDhx.js";
7
7
  import { i as sameRegion, n as canonicalizeRegion, r as derivePartitionAndUrlSuffix } from "./aws-partition-DA0r2sr-.js";
8
- import { t as expectedOwnerParam } from "./expected-bucket-owner-BiM4Hy8G.js";
9
- import { B as refusalTypeShown, Bt as RETRY_AUXILIARY_OWNER, Ct as isInterruptedWaitError, Dt as compositeIdSeparatorRefusal, Ft as createMaskedRetryLogger, G as isMarkedNotGone, H as resolveExplicitPhysicalId, It as isSecretDerivedValue, J as deleteWithProtectionCompensation, Jt as markAuxiliaryFailure, K as markNotGone, Kt as isAuxiliaryFailure, L as isQuotableImportValue, Lt as maskDeep, M as withoutServerErrorRetries, Mt as segmentAfterAnchor, Nt as stateOrphanRecordRemedy, Pt as createMaskedLogSinks, R as normalizeAwsTagsToCfn, Rt as maskerOrIdentity, Tt as canonicalizeRoute53QueryName, U as RESOURCE_NOT_FOUND, Ut as createdBeforeFailure, W as assertRegionMatch, Wt as createdResourceIdentityBeforeFailure, X as observeThenDisableProtection, Yt as markCreatedBeforeFailure, _t as pasteableAwsCommand, an as recoveryCommandFlags, c as clearCreatedReport, cn as DEFAULT_STATE_PREFIX, ct as protectionFlipKey, dt as ElapsedBudgetRegistry, f as retractCreatedResource, fn as producerRecordKey, ft as monotonicNowMs, hn as withPasteableAwsProfile, jt as resourceTypeShown, kt as logicalIdShown, l as collectCreatedResources, ln as injectiveKey, lt as runDeleteAttempt, n as prepareRemovalForUpdate, o as withoutInjectedRemovals, on as sanitizeRecoveryValue, ot as ProtectionFlipRegistry, pt as DELETION_PROTECTION_DOC_POINTER, q as compensateProtectionFlip, qt as isAuxiliaryMarkOf, r as removalWarning, s as CreatedResourceSink, sn as CUSTOM_RESOURCE_RESPONSE_PREFIX, st as isTerminalDeleteFailure, u as reportCreatedResource, ut as ElapsedBudget, vt as protectedReplacementAdvice, wt as startInterruptWatch, x as withUnchangedSecretPrincipalLists, z as quotedRemedyLogicalId, zt as withDerivedNameMasks } from "./update-removal-Cr8BZ_MT.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-BYb5bEiw.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$5, 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, 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-DEMSUsSU.js";
12
- import { C as unsettledItemsField, D as withUnsettledItems, E as unsettledPropertiesOf, O as withUnsettledProperties, S as unsettledContextOf, T as unsettledItemsTopKey, c as refuseRestoreFromItself, f as planTagDiff, g as tagPlanWarning, i as withResourceDeadline, k as withoutUnsettledProperties, m as refuseMalformedDesiredTags, n as enclosingDeadlineRemainingMs, p as readTagList, r as whileEnclosingDeadlinesPaused, t as enclosingDeadlineExpired, w as unsettledItemsOf, x as isUsableAttemptedName, y as definedAttributes } from "./resource-deadline-B34RyqEU.js";
8
+ import { B as refusalTypeShown, Bt as RETRY_AUXILIARY_OWNER, Ct as isInterruptedWaitError, Dt as compositeIdSeparatorRefusal, Ft as createMaskedRetryLogger, G as isMarkedNotGone, H as resolveExplicitPhysicalId, It as isSecretDerivedValue, J as deleteWithProtectionCompensation, Jt as markAuxiliaryFailure, K as markNotGone, Kt as isAuxiliaryFailure, L as isQuotableImportValue, Lt as maskDeep, M as withoutServerErrorRetries, Mt as segmentAfterAnchor, Nt as stateOrphanRecordRemedy, Pt as createMaskedLogSinks, R as normalizeAwsTagsToCfn, Rt as maskerOrIdentity, Tt as canonicalizeRoute53QueryName, U as RESOURCE_NOT_FOUND, Ut as createdBeforeFailure, W as assertRegionMatch, Wt as createdResourceIdentityBeforeFailure, X as observeThenDisableProtection, Yt as markCreatedBeforeFailure, _t as pasteableAwsCommand, an as recoveryCommandFlags, c as clearCreatedReport, cn as DEFAULT_STATE_PREFIX, ct as protectionFlipKey, dn as withPasteableAwsProfile, dt as ElapsedBudgetRegistry, f as retractCreatedResource, fn as injectiveKey, ft as monotonicNowMs, hn as producerRecordKey, jt as resourceTypeShown, kt as logicalIdShown, l as collectCreatedResources, lt as runDeleteAttempt, n as prepareRemovalForUpdate, o as withoutInjectedRemovals, on as sanitizeRecoveryValue, ot as ProtectionFlipRegistry, pt as DELETION_PROTECTION_DOC_POINTER, q as compensateProtectionFlip, qt as isAuxiliaryMarkOf, r as removalWarning, s as CreatedResourceSink, sn as CUSTOM_RESOURCE_RESPONSE_PREFIX, st as isTerminalDeleteFailure, u as reportCreatedResource, ut as ElapsedBudget, vt as protectedReplacementAdvice, wt as startInterruptWatch, x as withUnchangedSecretPrincipalLists, z as quotedRemedyLogicalId, zt as withDerivedNameMasks } from "./update-removal-TXGn1k50.js";
9
+ import { t as expectedOwnerParam } from "./expected-bucket-owner-BUXAXOgl.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-BR6VF4-U.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$5, 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, 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-SPQJMbC6.js";
12
+ import { C as unsettledItemsField, D as withUnsettledItems, E as unsettledPropertiesOf, O as withUnsettledProperties, S as unsettledContextOf, T as unsettledItemsTopKey, c as refuseRestoreFromItself, f as planTagDiff, g as tagPlanWarning, i as withResourceDeadline, k as withoutUnsettledProperties, m as refuseMalformedDesiredTags, n as enclosingDeadlineRemainingMs, p as readTagList, r as whileEnclosingDeadlinesPaused, t as enclosingDeadlineExpired, w as unsettledItemsOf, x as isUsableAttemptedName, y as definedAttributes } from "./resource-deadline-CImbEePa.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";
@@ -30,10 +30,10 @@ import { CreateSnapshotCommand as CreateSnapshotCommand$1, DescribeReplicationGr
30
30
  import * as fs from "node:fs";
31
31
  import { readFileSync } from "node:fs";
32
32
  import * as path from "node:path";
33
- import { DescribeKeyCommand, GenerateMacCommand, KMSClient } from "@aws-sdk/client-kms";
33
+ import { CreateRepositoryCommand, DescribeRepositoriesCommand, ECRClient, PutImageTagMutabilityCommand } from "@aws-sdk/client-ecr";
34
34
  import { readFile } from "fs/promises";
35
35
  import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, resolve as resolve$1 } from "path";
36
- import { CreateRepositoryCommand, DescribeRepositoriesCommand, ECRClient, PutImageTagMutabilityCommand } from "@aws-sdk/client-ecr";
36
+ import { DescribeKeyCommand, GenerateMacCommand, KMSClient } from "@aws-sdk/client-kms";
37
37
  import { getActiveWorkloadAwsWiring } from "cdk-local/internal";
38
38
  import { isDeepStrictEqual } from "node:util";
39
39
  import { DescribeDBClustersCommand, DescribeDBInstancesCommand, RDSClient } from "@aws-sdk/client-rds";
@@ -82,7 +82,7 @@ async function resolveBucketRegion(bucketName, opts = {}) {
82
82
  });
83
83
  }
84
84
  try {
85
- const { expectedOwnerParam } = await import("./expected-bucket-owner-BiM4Hy8G.js").then((n) => n.n);
85
+ const { expectedOwnerParam } = await import("./expected-bucket-owner-BUXAXOgl.js").then((n) => n.n);
86
86
  return (await client.send(new GetBucketLocationCommand({
87
87
  Bucket: bucketName,
88
88
  ...await expectedOwnerParam(client)
@@ -278,833 +278,224 @@ function nullPrototypeRecord() {
278
278
  return Object.create(null);
279
279
  }
280
280
 
281
- // src/synthesis/synthesized-stacks.ts
282
- let lastSynthesizedStacks = [];
283
- function rememberSynthesizedStacks(stacks) {
284
- lastSynthesizedStacks = stacks;
281
+ // src/assets/asset-storage/names.ts
282
+ const BOOTSTRAP_MARKER_PREFIX = "cdkd-bootstrap/";
283
+ function getCdkdAssetBucketName(accountId, region) {
284
+ return `cdkd-assets-${accountId}-${region}`;
285
285
  }
286
- function synthesizedStacks() {
287
- return lastSynthesizedStacks;
286
+ function getCdkdContainerRepoName(accountId, region) {
287
+ return `cdkd-container-assets-${accountId}-${region}`;
288
288
  }
289
289
 
290
- // src/utils/s3-listing-keys.ts
291
- function decodeListingKey(value) {
292
- if (value === void 0) return void 0;
293
- try {
294
- return decodeURIComponent(value.replace(/\+/g, "%20"));
295
- } catch (error) {
296
- throw new Error(`S3 returned a listing key that is not valid URL encoding: ${JSON.stringify(value)}. cdkd takes every listing with EncodingType='url' so a key containing a carriage return survives the XML round-trip; a value that will not decode cannot be addressed safely, so this listing is refused rather than acted on.`, { cause: error });
297
- }
290
+ // src/assets/asset-storage/marker.ts
291
+ function getBootstrapMarkerKey(region) {
292
+ return `${BOOTSTRAP_MARKER_PREFIX}${region}.json`;
298
293
  }
299
-
300
- // src/state/s3-replication-purge-gap.ts
301
- const DEFAULT_PURGED_OBJECT_DESCRIPTION = "the body of an object cdkd has just reported as removed";
302
- const replicationProbeCache = /* @__PURE__ */ new Map();
303
- const warnedWarnings = /* @__PURE__ */ new Set();
304
- const MAX_NAMED_DESTINATIONS = 3;
305
- const UNNAMED_DESTINATION = "<destination not named by the replication rule>";
306
- const PERMANENT_DENIALS = /* @__PURE__ */ new Set([
307
- "AccessDenied",
308
- "AccessDeniedException",
309
- "AllAccessDisabled",
310
- "MethodNotAllowed",
311
- "NotImplemented"
312
- ]);
313
- const TRANSIENT_CREDENTIAL_CODES = /* @__PURE__ */ new Set([
314
- "InvalidAccessKeyId",
315
- "ExpiredToken",
316
- "ExpiredTokenException",
317
- "InvalidToken",
318
- "TokenRefreshRequired",
319
- "RequestTimeTooSkewed",
320
- "RequestExpired"
321
- ]);
322
- const describe$1 = (error) => describeAwsFailure(error).detail;
323
- const errorCodes = (error) => {
324
- if (error === null || typeof error !== "object" && typeof error !== "function") return [];
325
- const e = error;
326
- const codes = [];
327
- if (typeof e.name === "string" && e.name.length > 0) codes.push(e.name);
328
- if (typeof e.Code === "string" && e.Code.length > 0) codes.push(e.Code);
329
- return codes;
330
- };
331
- const hasCode = (error, set) => errorCodes(error).some((code) => set.has(code));
332
- const httpStatus = (error) => {
333
- if (error === null || typeof error !== "object" && typeof error !== "function") return void 0;
334
- const meta = error.$metadata;
335
- return typeof meta?.httpStatusCode === "number" ? meta.httpStatusCode : void 0;
336
- };
337
- function destinationName(bucketArn, account) {
338
- if (bucketArn === void 0 || bucketArn === "") return UNNAMED_DESTINATION;
339
- const name = bucketArn.replace(/^arn:[^:]*:s3:::/, "");
340
- return account !== void 0 && account !== "" ? `${name} (account ${account})` : name;
294
+ async function readBootstrapMarkerBody(stateBackend, rawRegion, opts = {}) {
295
+ const canonicalKey = getBootstrapMarkerKey(canonicalizeRegion(rawRegion));
296
+ const rawKey = getBootstrapMarkerKey(rawRegion);
297
+ const body = await stateBackend.getRawObject(canonicalKey);
298
+ if (body !== null || rawKey === canonicalKey) return {
299
+ body,
300
+ resolvedKey: canonicalKey
301
+ };
302
+ const rawBody = await stateBackend.getRawObject(rawKey);
303
+ if (rawBody === null) return {
304
+ body: null,
305
+ resolvedKey: canonicalKey
306
+ };
307
+ const subject = opts.logPrefix ? `${opts.logPrefix}: bootstrap marker` : "Bootstrap marker";
308
+ getLogger().debug(`${subject} found at the un-folded key '${rawKey}' (none at '${canonicalKey}') — an upper-cased region was used at 'cdkd bootstrap' time.`);
309
+ return {
310
+ body: rawBody,
311
+ resolvedKey: rawKey
312
+ };
341
313
  }
342
- function normalizeReplicationRules(config) {
343
- const targets = [];
344
- for (const rule of config.Rules ?? []) {
345
- const prefix = rule.Filter !== void 0 ? rule.Filter.Prefix ?? rule.Filter.And?.Prefix ?? "" : rule.Prefix ?? "";
346
- targets.push({
347
- prefix,
348
- destination: destinationName(rule.Destination?.Bucket, rule.Destination?.Account),
349
- enabled: rule.Status !== "Disabled"
350
- });
351
- }
352
- return targets;
314
+ const ASSET_BUCKET_NAME_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
315
+ const CONTAINER_REPO_NAME_PATTERN = /^[a-z0-9]+(?:[._\-/][a-z0-9]+)*$/;
316
+ function validateAssetBucketName(name) {
317
+ if (!ASSET_BUCKET_NAME_PATTERN.test(name)) throw new CdkdError(`--asset-bucket '${name}' is not a valid S3 bucket name. Bucket names must be 3-63 characters of lowercase letters, digits, dots, and hyphens, and must start and end with a letter or digit.`, "INVALID_ASSET_STORAGE_NAME");
353
318
  }
354
- async function runProbe(s3Client, bucket, requestFields) {
355
- try {
356
- const config = (await s3Client.send(new GetBucketReplicationCommand({
357
- Bucket: bucket,
358
- ...requestFields
359
- }))).ReplicationConfiguration;
360
- if (config === void 0) return { kind: "none" };
361
- const rules = normalizeReplicationRules(config);
362
- return rules.length === 0 ? { kind: "none" } : {
363
- kind: "rules",
364
- rules
365
- };
366
- } catch (error) {
367
- if (errorCodes(error).includes("ReplicationConfigurationNotFoundError")) return { kind: "none" };
368
- if (hasCode(error, TRANSIENT_CREDENTIAL_CODES)) return {
369
- kind: "unknown",
370
- reason: describe$1(error),
371
- retry: true
372
- };
373
- const permanent = hasCode(error, PERMANENT_DENIALS) || httpStatus(error) === 403;
374
- return {
375
- kind: "unknown",
376
- reason: describe$1(error),
377
- retry: !permanent
378
- };
379
- }
319
+ function isValidContainerRepoName(name) {
320
+ return name.length >= 2 && name.length <= 256 && CONTAINER_REPO_NAME_PATTERN.test(name);
380
321
  }
381
- function probe(s3Client, bucket, requestFields) {
382
- const key = injectiveKey(bucket, requestFields.ExpectedBucketOwner ?? "");
383
- const cached = replicationProbeCache.get(key);
384
- if (cached) return cached;
385
- const pending = runProbe(s3Client, bucket, requestFields).then((result) => {
386
- if (result.kind === "unknown" && result.retry) evictIfOwn(key, pending);
387
- return result;
388
- }, (error) => {
389
- evictIfOwn(key, pending);
390
- return {
391
- kind: "unknown",
392
- reason: describe$1(error),
393
- retry: true
394
- };
395
- });
396
- replicationProbeCache.set(key, pending);
397
- return pending;
322
+ function validateContainerRepoName(name) {
323
+ if (!isValidContainerRepoName(name)) throw new CdkdError(`--container-repo '${name}' is not a valid ECR repository name. Repository names must be 2-256 characters of lowercase letters and digits, optionally separated by single '.', '_', '-', or '/' characters (no leading, trailing, or doubled separators).`, "INVALID_ASSET_STORAGE_NAME");
398
324
  }
399
- function evictIfOwn(key, own) {
400
- if (replicationProbeCache.get(key) === own) replicationProbeCache.delete(key);
325
+ function quotedIfPlain(value, description) {
326
+ return isPlainName$1(value) ? `'${value}'` : description;
401
327
  }
402
- async function warnIfPurgeIsReplicated(s3Client, bucket, keys, options = {}) {
403
- if (keys.length === 0) return;
404
- const emitDebug = (message) => {
405
- const sink = options.logger;
406
- if (sink?.debug) sink.debug(message);
407
- else getLogger().child("s3-replication-check").debug(message);
408
- };
409
- try {
410
- const safeBucket = displaySafe(bucket, { asciiOnly: true });
411
- const result = await probe(s3Client, bucket, options.requestFields ?? {});
412
- if (result.kind === "none") return;
413
- if (result.kind === "unknown") {
414
- emitDebug(`Could not determine whether s3://${safeBucket} is replicated (grant s3:GetReplicationConfiguration to enable the check): ${displaySafe(result.reason)}`);
415
- return;
416
- }
417
- const covered = result.rules.filter((rule) => keys.some((key) => key.startsWith(rule.prefix)));
418
- if (covered.length === 0) return;
419
- const destinations = [...new Set(covered.map((rule) => rule.enabled ? rule.destination : `${rule.destination} (rule currently Disabled -- it stops FUTURE replication, not what it already copied)`))].sort();
420
- const warnKey = injectiveKey(bucket, options.objectDescription ?? "", ...destinations);
421
- if (warnedWarnings.has(warnKey)) {
422
- emitDebug(`S3 replication on s3://${safeBucket} still covers purged keys (${options.objectDescription ?? "the body of an object cdkd has just reported as removed"}); already reported once this run for ${destinations.map((d) => displaySafe(d, { asciiOnly: true })).join(", ")}.`);
423
- return;
424
- }
425
- const named = destinations.slice(0, MAX_NAMED_DESTINATIONS).map((d) => displaySafe(d, { asciiOnly: true }));
426
- const elided = destinations.length - named.length;
427
- (options.logger ?? getLogger().child("s3-replication-check")).warn(`S3 replication is enabled on s3://${safeBucket} and covers the key(s) cdkd just purged. S3 NEVER replicates a version-id delete, so the purge removed those versions from THIS bucket only — the copies in the destination bucket survive and remain readable there via GetObject with a VersionId (${options.objectDescription ?? "the body of an object cdkd has just reported as removed"}). cdkd cannot delete them. Remove them in the destination bucket yourself (aws s3api list-object-versions, then delete-object --version-id), or narrow the replication rule so it excludes the prefixes cdkd purges under. Destination(s): ${named.join(", ")}` + (elided > 0 ? ` (and ${elided} more; ${withPasteableAwsProfile("aws s3api get-bucket-replication")} --bucket ${safeBucket} lists them all)` : ""));
428
- warnedWarnings.add(warnKey);
429
- } catch {}
328
+ function isPlainName$1(value) {
329
+ return !/\s/.test(value) && displayIdent(value, { maxCodePoints: 1152 }) === value;
430
330
  }
431
-
432
- // src/state/s3-noncurrent-version-purge.ts
433
- const CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION = "a custom-resource response object, which is the handler's full cfn-response body including `Data`";
434
- const DELETE_BATCH_SIZE = 1e3;
435
- const MAX_NAMED_FAILURES = 5;
436
- const UNKNOWN_KEY_PREFIX = "<unknown key #";
437
- const TRUNCATED_NO_MARKER = "listing reported IsTruncated with no NextKeyMarker; the walk stopped early and versions may remain";
438
- function recordFailure(failed, key, reason) {
439
- const existing = failed.get(key);
440
- if (existing) existing.push(reason);
441
- else failed.set(key, [reason]);
331
+ function shownName(value) {
332
+ return displayIdent(value, { maxCodePoints: STACK_REF_MAX_CODE_POINTS });
442
333
  }
443
- const describe = (error) => describeAwsFailure(error).detail;
444
- const PREFIX_HANDLE_SUFFIX = "* (every key under this prefix)";
445
- async function purgeNoncurrentVersionsUnderPrefix(s3Client, bucket, prefix, options = {}) {
446
- const logger = options.logger ?? getLogger().child("s3-version-purge");
447
- if (!prefix.endsWith("/") || prefix.replace(/\/+/g, "") === "") {
448
- logger.warn(safeMsg`Refused to purge noncurrent versions under ${JSON.stringify(prefix)}: ` + `a prefix-wide purge needs a non-empty prefix ending in '/'. Nothing was purged.`);
449
- return {
450
- deletedBodies: 0,
451
- complete: false
452
- };
334
+ function droppedMarkerNames(body, assetBucket, containerRepo) {
335
+ let parsed;
336
+ try {
337
+ parsed = JSON.parse(body);
338
+ } catch {
339
+ return "";
453
340
  }
454
- const handle = `${prefix}${PREFIX_HANDLE_SUFFIX}`;
455
- return purgeWalk(s3Client, bucket, [prefix], {
456
- scope: {
457
- covers: (key) => key.startsWith(prefix),
458
- unsettledUnder: () => [handle],
459
- ownsEveryListedKey: true
460
- },
461
- listingFailureHandles: () => [handle],
462
- options: {
463
- ...options,
464
- logger
465
- }
466
- });
341
+ const fields = parsed ?? {};
342
+ const dropped = (value, kept) => typeof value === "string" && value !== "" && value !== kept;
343
+ const named = [dropped(fields.assetBucket, assetBucket) ? `asset bucket ${shownName(fields.assetBucket)}` : void 0, dropped(fields.containerRepo, containerRepo) ? `container repository ${shownName(fields.containerRepo)}` : void 0].filter((n) => n !== void 0);
344
+ return named.length === 0 ? "" : ` It recorded ${named.join(" and ")}; storage under those names is no longer tracked by cdkd.`;
467
345
  }
468
- async function purgeNoncurrentKeyVersions(s3Client, bucket, keys, options = {}) {
469
- if (keys.length === 0) return;
470
- const wanted = new Set(keys);
471
- await purgeWalk(s3Client, bucket, options.listPrefix !== void 0 ? [options.listPrefix] : keys, {
472
- scope: {
473
- covers: (key) => wanted.has(key),
474
- unsettledUnder: (prefix) => [...wanted].filter((key) => key.startsWith(prefix)),
475
- ownsEveryListedKey: false
476
- },
477
- listingFailureHandles: (prefix) => options.listPrefix !== void 0 ? [...keys] : [prefix],
478
- options
479
- });
346
+ function bucketNameSubject(bucketName) {
347
+ return isPlainName$1(bucketName) ? `Asset bucket name '${bucketName}'` : "An asset bucket name that is not a plain identifier";
480
348
  }
481
- async function purgeWalk(s3Client, bucket, prefixes, params) {
482
- const { scope, listingFailureHandles, options } = params;
483
- const logger = options.logger ?? getLogger().child("s3-version-purge");
484
- const requestFields = options.requestFields ?? {};
485
- const failed = /* @__PURE__ */ new Map();
486
- const unknown = { n: 0 };
487
- const purged = /* @__PURE__ */ new Set();
488
- const unsettledBodies = /* @__PURE__ */ new Set();
489
- const removed = { n: 0 };
490
- for (const prefix of prefixes) try {
491
- await purgeUnderPrefix(s3Client, bucket, prefix, scope, requestFields, failed, unknown, purged, unsettledBodies, removed);
349
+ function markerSubject(markerKey) {
350
+ return isPlainName$1(markerKey) ? `Bootstrap marker '${markerKey}'` : "A bootstrap marker whose key is not a plain identifier";
351
+ }
352
+ function parseBootstrapMarker(body, markerKey) {
353
+ let parsed;
354
+ try {
355
+ parsed = JSON.parse(body);
492
356
  } catch (error) {
493
- for (const key of listingFailureHandles(prefix)) {
494
- recordFailure(failed, key, describe(error));
495
- unsettledBodies.add(key);
496
- }
497
- }
498
- if (failed.size > 0) {
499
- const named = [...failed.entries()].slice(0, MAX_NAMED_FAILURES).map(([key, reasons]) => displaySafe(`${key} (${reasons.join("; ")})`));
500
- const elided = failed.size - named.length;
501
- const prefixCount = [...failed.keys()].filter((k) => k.endsWith(PREFIX_HANDLE_SUFFIX)).length;
502
- const keyCount = failed.size - prefixCount;
503
- const subject = [keyCount > 0 ? `${keyCount} key(s)` : "", prefixCount > 0 ? `every key under ${prefixCount} prefix(es)` : ""].filter((part) => part !== "").join(" and ");
504
- logger.warn(`Could not purge noncurrent versions of ${subject} in s3://${displaySafe(bucket, { asciiOnly: true })}. Their previous versions survive and remain readable via GetObject with a VersionId (${options.objectDescription ?? "the body of an object cdkd has just reported as removed"}). Grant s3:ListBucketVersions and s3:DeleteObjectVersion on the state bucket, or purge the key(s) by hand. Failures: ${named.join(", ")}` + (elided > 0 ? ` (and ${elided} more)` : ""));
357
+ getLogger().debug(safeMsg`${markerSubject(markerKey)} failed to parse: ${parseFailureDebugDetail(error)}`);
358
+ throw new CdkdError(`${markerSubject(markerKey)} in the state bucket is not valid JSON. Re-run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} for this region to rewrite it.`, "INVALID_BOOTSTRAP_MARKER", jsonParseFailureStandIn(error, utf8ByteLength(body)));
505
359
  }
506
- const replicationKeys = [.../* @__PURE__ */ new Set([...purged, ...unsettledBodies])];
507
- await warnIfPurgeIsReplicated(s3Client, bucket, replicationKeys, {
508
- requestFields,
509
- logger,
510
- ...options.objectDescription !== void 0 && { objectDescription: options.objectDescription }
511
- });
360
+ const marker = parsed;
361
+ if (typeof marker.assetSupportVersion === "number" && marker.assetSupportVersion > 1) throw new CdkdError(`${markerSubject(markerKey)} has assetSupportVersion ${marker.assetSupportVersion}, but this cdkd only understands up to ${1}. Upgrade cdkd to deploy in this region.`, "UNSUPPORTED_BOOTSTRAP_MARKER_VERSION");
362
+ if (typeof marker.assetBucket !== "string" || marker.assetBucket.length === 0 || typeof marker.containerRepo !== "string" || marker.containerRepo.length === 0 || typeof marker.assetSupportVersion !== "number") throw new CdkdError(`${markerSubject(markerKey)} in the state bucket is malformed (missing assetBucket / containerRepo / assetSupportVersion). Re-run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} for this region to rewrite it.`, "INVALID_BOOTSTRAP_MARKER");
363
+ if (!ASSET_BUCKET_NAME_PATTERN.test(marker.assetBucket) || !isValidContainerRepoName(marker.containerRepo)) throw new CdkdError(`${markerSubject(markerKey)} in the state bucket is malformed (its asset bucket or container repository name is not a valid name). Re-run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} for this region to rewrite it.`, "INVALID_BOOTSTRAP_MARKER");
512
364
  return {
513
- deletedBodies: removed.n,
514
- complete: failed.size === 0
365
+ assetBucket: marker.assetBucket,
366
+ containerRepo: marker.containerRepo,
367
+ assetSupportVersion: marker.assetSupportVersion,
368
+ createdAt: typeof marker.createdAt === "string" ? marker.createdAt : ""
515
369
  };
516
370
  }
517
- async function purgeUnderPrefix(s3Client, bucket, prefix, scope, requestFields, failed, unknown, purged, unsettledBodies, removed) {
518
- let keyMarker;
519
- let versionIdMarker;
520
- do {
521
- const resp = await s3Client.send(new ListObjectVersionsCommand({
522
- Bucket: bucket,
523
- ...requestFields,
524
- Prefix: prefix,
525
- EncodingType: "url",
526
- ...keyMarker !== void 0 && { KeyMarker: keyMarker },
527
- ...versionIdMarker !== void 0 && { VersionIdMarker: versionIdMarker }
371
+
372
+ // src/assets/asset-storage/bucket-region.ts
373
+ function readBucketRegionHeader(error) {
374
+ const headers = error?.$response?.headers;
375
+ if (!headers) return void 0;
376
+ for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "x-amz-bucket-region" && value) return value;
377
+ }
378
+ function bucketLocationToRegion$1(constraint) {
379
+ if (!constraint) return "us-east-1";
380
+ if (constraint === "EU") return "eu-west-1";
381
+ return constraint;
382
+ }
383
+ function isCrossRegionRedirect(error) {
384
+ const status = error?.$metadata?.httpStatusCode;
385
+ if (status === 301) return true;
386
+ return status === 400 && readBucketRegionHeader(error) !== void 0;
387
+ }
388
+ async function assertAssetBucketRegion(s3Client, bucketName, expectedRegion, accountId, cause) {
389
+ const want = canonicalizeRegion(expectedRegion);
390
+ const wantShown = plainIdentOr(want, "this deploy region");
391
+ const remedy = `Either bootstrap ${wantShown} with an asset-bucket name unique to it, or run this against the bucket's own region.\nBootstrap with: ${pasteableCommand("cdkd bootstrap", [{
392
+ flag: "--region",
393
+ value: want,
394
+ hole: "region"
395
+ }, {
396
+ flag: "--asset-bucket",
397
+ hole: "name"
398
+ }]).command}`;
399
+ let actual;
400
+ const fromHeader = readBucketRegionHeader(cause);
401
+ if (fromHeader) actual = canonicalizeRegion(fromHeader);
402
+ else try {
403
+ const location = await s3Client.send(new GetBucketLocationCommand({
404
+ Bucket: bucketName,
405
+ ExpectedBucketOwner: accountId
528
406
  }));
529
- const stale = [];
530
- const staleBodies = /* @__PURE__ */ new Map();
531
- const isStaleBody = (key, versionId) => key !== void 0 && versionId !== void 0 && staleBodies.get(key)?.has(versionId) === true;
532
- const entries = [...(resp.Versions ?? []).map((entry) => ({
533
- entry,
534
- hasBody: true
535
- })), ...(resp.DeleteMarkers ?? []).map((entry) => ({
536
- entry,
537
- hasBody: false
538
- }))];
539
- for (const { entry, hasBody } of entries) {
540
- let decodedKey;
541
- try {
542
- decodedKey = decodeListingKey(entry.Key);
543
- } catch {
544
- if (hasBody && entry.Key !== void 0) unsettledBodies.add(`${entry.Key} [key not decodable; shown as S3 returned it]`);
545
- if (scope.ownsEveryListedKey && entry.Key !== void 0 && entry.IsLatest !== true) recordFailure(failed, `${entry.Key} [key not decodable; shown as S3 returned it]`, `version ${entry.VersionId ?? "<unknown>"}: listing key could not be decoded, so the entry was left alone`);
546
- continue;
547
- }
548
- if (decodedKey === void 0 || !scope.covers(decodedKey)) continue;
549
- if (entry.IsLatest === void 0) {
550
- recordFailure(failed, decodedKey, `version ${entry.VersionId ?? "<unknown>"}: listing omitted IsLatest, so the entry was left alone rather than risk deleting a current version`);
551
- if (hasBody) unsettledBodies.add(decodedKey);
552
- }
553
- if (entry.IsLatest !== false) continue;
554
- if (!entry.VersionId) {
555
- recordFailure(failed, decodedKey, `listing returned a noncurrent entry with no VersionId, so it could not be deleted`);
556
- if (hasBody) unsettledBodies.add(decodedKey);
557
- continue;
558
- }
559
- stale.push({
560
- Key: decodedKey,
561
- VersionId: entry.VersionId
562
- });
563
- if (hasBody) {
564
- const ids = staleBodies.get(decodedKey) ?? /* @__PURE__ */ new Set();
565
- ids.add(entry.VersionId);
566
- staleBodies.set(decodedKey, ids);
567
- }
568
- if (hasBody) purged.add(decodedKey);
407
+ actual = canonicalizeRegion(bucketLocationToRegion$1(location.LocationConstraint));
408
+ } catch (probeError) {
409
+ const fromProbe = readBucketRegionHeader(probeError);
410
+ if (fromProbe) actual = canonicalizeRegion(fromProbe);
411
+ else {
412
+ const failure = describeAwsFailure(probeError);
413
+ if (failure.redacted) getLogger().debug(`GetBucketLocation failed for asset bucket ${quotedIfPlain(bucketName, "with a name that is not a plain identifier")} while confirming it belongs to ${wantShown}: ${failure.detail}`);
414
+ throw new CdkdError(`${isPlainName$1(bucketName) ? `Asset bucket '${bucketName}'` : "An asset bucket whose name is not a plain identifier"} is claimed by an existing bucket, but cdkd could not determine which region that bucket is in, so it cannot confirm it belongs to ${wantShown}. Refusing to adopt it. (region probe failed: ${failure.summary}) ${remedy}`, "ASSET_STORAGE_FOREIGN_REGION_BUCKET", cause);
569
415
  }
570
- for (let i = 0; i < stale.length; i += DELETE_BATCH_SIZE) {
571
- const batch = stale.slice(i, i + DELETE_BATCH_SIZE);
572
- try {
573
- const deleted = await s3Client.send(new DeleteObjectsCommand({
574
- Bucket: bucket,
575
- ...requestFields,
576
- Delete: {
577
- Objects: batch,
578
- Quiet: true
579
- }
580
- }));
581
- let bodiesRemoved = batch.filter((o) => isStaleBody(o.Key, o.VersionId)).length;
582
- for (const err of deleted.Errors ?? []) if (err.Key === void 0 || err.VersionId === void 0 || isStaleBody(err.Key, err.VersionId)) bodiesRemoved -= 1;
583
- removed.n += Math.max(0, bodiesRemoved);
584
- for (const err of deleted.Errors ?? []) {
585
- if (err.Code === "NoSuchVersion") continue;
586
- const reason = `version ${err.VersionId ?? "<unknown>"}: ${err.Code ?? "Error"}` + (err.Message ? ` - ${err.Message}` : "");
587
- if (err.Key !== void 0) recordFailure(failed, err.Key, reason);
588
- else {
589
- unknown.n += 1;
590
- recordFailure(failed, `${UNKNOWN_KEY_PREFIX}${unknown.n}>`, reason);
591
- }
592
- }
593
- } catch (error) {
594
- for (const object of batch) recordFailure(failed, object.Key, describe(error));
416
+ }
417
+ if (actual === want) return;
418
+ const actualShown = plainIdentOr(actual, "another region");
419
+ throw new CdkdError(`${bucketNameSubject(bucketName)} resolves to a bucket in ${actualShown}, while this operation targets ${wantShown}. S3 bucket names are globally unique, and both 'BucketAlreadyOwnedByYou' and a cross-region redirect report ACCOUNT ownership rather than the bucket's region, so cdkd cannot treat it as ${wantShown}'s asset bucket. cdkd asset storage is per-region by design: adopting it would publish ${wantShown}'s assets into ${actualShown} and apply ${wantShown}'s bucket configuration there. ${remedy}`, "ASSET_STORAGE_FOREIGN_REGION_BUCKET", cause);
420
+ }
421
+
422
+ // src/assets/asset-storage/verify.ts
423
+ async function verifyAssetStorageExists(marker, accountId, region, opts = {}) {
424
+ const rebootstrapHint = `cdkd never silently falls back to CDK bootstrap asset storage once a region is opted in.\nRecreate it with: ${pasteableCommand("cdkd bootstrap", [{
425
+ flag: "--region",
426
+ value: region,
427
+ hole: "region"
428
+ }]).command}`;
429
+ const clientOpts = {
430
+ region,
431
+ ...opts.profile && { profile: opts.profile }
432
+ };
433
+ const s3Client = new S3Client({
434
+ ...awsClientDefaults({ profile: opts.profile }),
435
+ ...s3ClientDefaults(),
436
+ ...clientOpts
437
+ });
438
+ const ecrClient = new ECRClient({
439
+ ...awsClientDefaults({ profile: opts.profile }),
440
+ ...clientOpts
441
+ });
442
+ try {
443
+ try {
444
+ await s3Client.send(new HeadBucketCommand({
445
+ Bucket: marker.assetBucket,
446
+ ExpectedBucketOwner: accountId
447
+ }));
448
+ } catch (error) {
449
+ const err = error;
450
+ if (err.name === "NotFound" || err.name === "NoSuchBucket") throw new CdkdError(`cdkd asset storage is bootstrapped for region '${region}' but the asset bucket ${quotedIfPlain(marker.assetBucket, "named by its marker")} is missing. ${rebootstrapHint}`, "ASSET_STORAGE_MISSING");
451
+ if (err.$metadata?.httpStatusCode === 403) throw new CdkdError(`${isPlainName$1(marker.assetBucket) ? `Asset bucket '${marker.assetBucket}'` : "The asset bucket named by the marker"} exists but is not owned by account ${accountId} (or access is denied). Refusing to use it. ${rebootstrapHint}`, "ASSET_STORAGE_FOREIGN_BUCKET", error);
452
+ if (isCrossRegionRedirect(error)) {
453
+ await assertAssetBucketRegion(s3Client, marker.assetBucket, region, accountId, error);
454
+ throw normalizeAwsError(error, {
455
+ bucket: marker.assetBucket,
456
+ operation: "HeadBucket"
457
+ });
595
458
  }
459
+ throw error;
596
460
  }
597
- if (resp.IsTruncated === true && resp.NextKeyMarker === void 0) for (const key of scope.unsettledUnder(prefix)) {
598
- recordFailure(failed, key, TRUNCATED_NO_MARKER);
599
- unsettledBodies.add(key);
461
+ try {
462
+ await ecrClient.send(new DescribeRepositoriesCommand({ repositoryNames: [marker.containerRepo] }));
463
+ } catch (error) {
464
+ if (error.name === "RepositoryNotFoundException") throw new CdkdError(`cdkd asset storage is bootstrapped for region '${region}' but the container-asset ECR repository ${quotedIfPlain(marker.containerRepo, "named by its marker")} is missing. ${rebootstrapHint}`, "ASSET_STORAGE_MISSING");
465
+ throw error;
600
466
  }
601
- keyMarker = resp.IsTruncated === true ? decodeListingKey(resp.NextKeyMarker) : void 0;
602
- versionIdMarker = keyMarker !== void 0 ? resp.NextVersionIdMarker : void 0;
603
- } while (keyMarker !== void 0);
467
+ } finally {
468
+ s3Client.destroy();
469
+ ecrClient.destroy();
470
+ }
604
471
  }
605
472
 
606
- // src/utils/parameter-types.ts
607
- function isListParameterType(type) {
608
- if (type === "CommaDelimitedList") return true;
609
- return type.length > 6 && type.startsWith("List<") && type.endsWith(">");
610
- }
611
- const SSM_PARAMETER_VALUE_PREFIX = "AWS::SSM::Parameter::Value<";
612
- function ssmResolvedValueType(type) {
613
- if (!type.startsWith("AWS::SSM::Parameter::Value<") || !type.endsWith(">")) return void 0;
614
- const inner = type.slice(27, -1);
615
- return inner.length > 0 ? inner : void 0;
473
+ // src/utils/deny-external-access-policy.ts
474
+ function buildDenyExternalAccessPolicy(bucketName, accountId, region) {
475
+ const { partition } = derivePartitionAndUrlSuffix(region);
476
+ return {
477
+ Version: "2012-10-17",
478
+ Statement: [{
479
+ Sid: "DenyExternalAccess",
480
+ Effect: "Deny",
481
+ Principal: "*",
482
+ Action: "s3:*",
483
+ Resource: [`arn:${partition}:s3:::${bucketName}`, `arn:${partition}:s3:::${bucketName}/*`],
484
+ Condition: { StringNotEquals: { "aws:PrincipalAccount": accountId } }
485
+ }]
486
+ };
616
487
  }
617
488
 
618
- // src/utils/nested-template-cycle.ts
619
- const NESTED_STACK_TYPE$5 = "AWS::CloudFormation::Stack";
620
- function isAbsoluteAssetPath(p) {
621
- return path.isAbsolute(p) || p.startsWith("/");
622
- }
623
- function templateIdentity(templatePath) {
624
- const dir = path.dirname(templatePath);
625
- let realDir;
626
- try {
627
- realDir = fs.realpathSync.native(dir);
628
- } catch {
629
- realDir = path.resolve(dir);
630
- }
631
- return path.join(realDir, path.basename(templatePath));
632
- }
633
- function listNestedTemplateRows(template) {
634
- if (template === null || typeof template !== "object") return [];
635
- const resources = template.Resources;
636
- if (resources === null || resources === void 0) return [];
637
- const rows = [];
638
- for (const [logicalId, resource] of Object.entries(resources)) {
639
- const row = resource;
640
- if (row?.Type !== NESTED_STACK_TYPE$5) continue;
641
- const assetPath = row.Metadata?.["aws:asset:path"];
642
- if (typeof assetPath !== "string" || assetPath.length === 0) continue;
643
- rows.push({
644
- logicalId,
645
- assetPath
646
- });
647
- }
648
- return rows;
649
- }
650
- function readNestedRows(templatePath) {
651
- let parsed;
652
- try {
653
- parsed = JSON.parse(fs.readFileSync(templatePath, "utf-8"));
654
- } catch {
655
- return;
656
- }
657
- return listNestedTemplateRows(parsed);
658
- }
659
- const MAX_NESTING_DEPTH = 512;
660
- const MAX_ROWS_FOLLOWED = 1e4;
661
- function findNestedTemplateTreeDefect(nestedTemplates, ancestorTemplatePaths = []) {
662
- const onChain = /* @__PURE__ */ new Set();
663
- for (const p of ancestorTemplatePaths) onChain.add(templateIdentity(p));
664
- const clean = /* @__PURE__ */ new Set();
665
- const chain = [];
666
- let rowsFollowed = 0;
667
- const visit = (logicalId, templatePath) => {
668
- if (typeof templatePath !== "string") return void 0;
669
- const identity = templateIdentity(templatePath);
670
- const lexical = path.resolve(templatePath);
671
- chain.push({
672
- logicalId,
673
- templatePath: identity
674
- });
675
- try {
676
- if (onChain.has(identity)) return {
677
- kind: "cycle",
678
- chain: [...chain]
679
- };
680
- if (chain.length > 512) return {
681
- kind: "too-deep",
682
- chain: [...chain]
683
- };
684
- if (++rowsFollowed > 1e4) return {
685
- kind: "too-large",
686
- chain: [...chain]
687
- };
688
- if (clean.has(lexical)) return void 0;
689
- const rows = readNestedRows(templatePath);
690
- if (rows === void 0) return void 0;
691
- onChain.add(identity);
692
- try {
693
- const dir = path.dirname(templatePath);
694
- for (const row of rows) {
695
- if (isAbsoluteAssetPath(row.assetPath)) return {
696
- kind: "absolute-path",
697
- chain: [...chain],
698
- logicalId: row.logicalId,
699
- assetPath: row.assetPath
700
- };
701
- const resolved = resolveAssemblyPath(dir, row.assetPath);
702
- if (!resolved.contained) return {
703
- kind: "escaping-path",
704
- chain: [...chain],
705
- logicalId: row.logicalId,
706
- assetPath: row.assetPath,
707
- escape: resolved,
708
- dir
709
- };
710
- const defect = visit(row.logicalId, resolved.path);
711
- if (defect) return defect;
712
- }
713
- } finally {
714
- onChain.delete(identity);
715
- }
716
- clean.add(lexical);
717
- return;
718
- } finally {
719
- chain.pop();
720
- }
721
- };
722
- for (const [logicalId, templatePath] of Object.entries(nestedTemplates)) {
723
- const defect = visit(logicalId, templatePath);
724
- if (defect) return defect;
725
- }
726
- }
727
- const MAX_RENDERED_HOPS = 8;
728
- function renderChain(chain) {
729
- const hop = (h) => `${displayIdent(h.logicalId)} (${displayAssemblyPath(h.templatePath)})`;
730
- if (chain.length <= MAX_RENDERED_HOPS) return chain.map(hop).join(" then ");
731
- const keep = MAX_RENDERED_HOPS / 2;
732
- return [
733
- ...chain.slice(0, keep).map(hop),
734
- `... ${chain.length - 8} more ...`,
735
- ...chain.slice(-4).map(hop)
736
- ].join(" then ");
737
- }
738
- function renderNestedTemplateTreeDefect(defect, stackName, action) {
739
- const provenance = `CDK emits an acyclic nested template tree with relative asset paths, so this indicates the synth output was hand-modified or generated by a non-CDK toolchain. Refusing to ${action}.`;
740
- const owner = (chain) => {
741
- const ids = chain.slice(0, -1).map((h) => h.logicalId);
742
- const keep = MAX_RENDERED_HOPS / 2;
743
- if (ids.length <= MAX_RENDERED_HOPS) return displayStackName([stackName, ...ids].join("~"));
744
- const head = displayStackName([stackName, ...ids.slice(0, keep)].join("~"));
745
- const tail = displayStackName(ids.slice(-4).join("~"));
746
- return `${head}~...${ids.length - 8} more...~${tail}`;
747
- };
748
- if (defect.kind === "cycle") {
749
- const closing = defect.chain[defect.chain.length - 1];
750
- return `The nested template tree under stack ${displayStackName(stackName)} contains a cycle: ${renderChain(defect.chain)}. Nested stack ${displayIdent(closing.logicalId)} (declared in stack ${owner(defect.chain)}) resolves to a template that is already on that nesting chain, so its Metadata['aws:asset:path'] closes a cycle. ${provenance}`;
751
- }
752
- if (defect.kind === "too-large") return `The nested template tree under stack ${displayStackName(stackName)} has more than ${MAX_ROWS_FOLLOWED} nested-stack rows to follow (the walk stopped at ${renderChain(defect.chain)}). That is far beyond any CDK-generated assembly. Symlinked directories can give one template file many paths, which multiplies the tree without ever repeating on one chain. Refusing to ${action}.`;
753
- if (defect.kind === "too-deep") return `The nested template tree under stack ${displayStackName(stackName)} nests more than ${512} levels deep: ${renderChain(defect.chain)}. No tree that deep can deploy, because each level lengthens the child's state key and S3 caps a key at 1024 bytes. ${provenance}`;
754
- if (defect.kind === "escaping-path") return `The nested template tree under stack ${displayStackName(stackName)} has nested stack ${displayIdent(defect.logicalId)} (reached through ${renderChain(defect.chain)}) with Metadata['aws:asset:path']=${displayAssemblyPath(defect.assetPath)} which ${renderAssemblyPathEscape(defect.escape, defect.dir, action)}`;
755
- return `The nested template tree under stack ${displayStackName(stackName)} has nested stack ${displayIdent(defect.logicalId)} (reached through ${renderChain(defect.chain)}) with Metadata['aws:asset:path']=${displayAssemblyPath(defect.assetPath)} which is absolute. ${provenance}`;
756
- }
757
-
758
- // src/utils/missing-state-bucket-remedy.ts
759
- function missingStateBucketRemedy(what) {
760
- if (!awsEndpointOverrideActive()) return `Run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} to create ${what}.`;
761
- return `AWS Emulator keeps nothing across restarts, so a new or restarted emulator has no cdkd bootstrap yet. A cdkd deploy without --dry-run creates the state bucket on its own; or bootstrap the emulator now with:\n${cdkdRemedy("cdkd bootstrap")}`;
762
- }
763
-
764
- // src/assets/absolute-asset-path-warning.ts
765
- function warnWholeAssemblyAsSource(w) {
766
- getLogger().child("assets").warn(`${w.subject} has ${w.field} naming the output directory ITSELF: ${displayAssemblyPath(w.outdir)}. cdkd will ${w.sink} — that is the WHOLE assembly, every template and every staged asset, not one asset directory. No CDK synth emits this, so treat this assembly as untrusted unless you wrote that path yourself.`);
767
- }
768
- function warnAbsoluteAssetPath(w) {
769
- getLogger().child("assets").warn(`${w.subject} has an absolute ${w.field} pointing outside the assembly: ${displayAssemblyPath(w.absolute)}` + (w.escape.escape === "symlink" ? ` (through a symbolic link to ${displayAssemblyPath(w.escape.realPath)})` : "") + `. cdkd will ${w.sink}. This is what cdk synth --no-staging emits, and is expected for it; if you did not synthesize with that flag, treat this assembly as untrusted: an absolute source path is honoured as written, so nothing but this line stands between it and that step.`);
770
- }
771
-
772
- // src/assets/asset-manifest-loader.ts
773
- function resolveFileAssetSourcePath(manifestDir, asset, opts) {
774
- const { assetOutdir, sink } = opts;
775
- if (isAbsolute$1(asset.source.path)) {
776
- const absolute = resolve$1(asset.source.path);
777
- const escape = absoluteAssemblyPathEscape(assetOutdir, absolute);
778
- if (escape !== void 0) warnAbsoluteAssetPath({
779
- subject: `File asset ${displayAssemblyPath(asset.displayName)}`,
780
- field: "source.path",
781
- absolute,
782
- escape,
783
- sink
784
- });
785
- else if (namesTheSameDirectory(assetOutdir, absolute)) warnWholeAssemblyAsSource({
786
- subject: `File asset ${displayAssemblyPath(asset.displayName)}`,
787
- field: "source.path",
788
- outdir: absolute,
789
- sink
790
- });
791
- return absolute;
792
- }
793
- const resolved = resolveAssemblyPath(manifestDir, asset.source.path, { containWithin: assetOutdir });
794
- if (!resolved.contained && namesTheSameDirectory(assetOutdir, resolved.path)) {
795
- warnWholeAssemblyAsSource({
796
- subject: `File asset ${displayAssemblyPath(asset.displayName)}`,
797
- field: "source.path",
798
- outdir: resolved.path,
799
- sink
800
- });
801
- return resolved.path;
802
- }
803
- if (!resolved.contained) throw new Error(`File asset ${displayAssemblyPath(asset.displayName)} has source.path=${displayAssemblyPath(asset.source.path)} which ${renderAssemblyPathEscape(resolved, assetOutdir, "publish it")}`);
804
- return resolved.path;
805
- }
806
- function isCfnTemplateAssetPath(sourcePath) {
807
- return sourcePath.endsWith(".template.json");
808
- }
809
- function parseAssetManifestBody(content, manifestPath) {
810
- try {
811
- return JSON.parse(content);
812
- } catch (err) {
813
- getLogger().child("AssetManifestLoader").debug(safeMsg`Asset manifest ${manifestPath} failed to parse: ${parseFailureDebugDetail(err)}`);
814
- throw new Error(`Failed to load asset manifest from ${manifestPath}: ${describeJsonParseFailure(err, utf8ByteLength(content))}`);
815
- }
816
- }
817
- var AssetManifestLoader = class {
818
- logger = getLogger().child("AssetManifestLoader");
819
- async loadStackManifest(stack, fallbackDir) {
820
- if (stack.assetManifestPath) return this.loadManifest(dirname$1(stack.assetManifestPath), stack.stackName, basename$1(stack.assetManifestPath));
821
- return this.loadManifest(fallbackDir, stack.stackName);
822
- }
823
- async loadManifest(cdkOutputDir, stackName, fileName = `${stackName}.assets.json`) {
824
- const resolved = resolveAssemblyPath(cdkOutputDir, fileName);
825
- if (!resolved.contained) throw new Error(`Asset manifest for stack ${displayStackName(stackName)} ${renderAssemblyPathEscape(resolved, cdkOutputDir)}`);
826
- const manifestPath = resolved.path;
827
- let content;
828
- try {
829
- this.logger.debug(`Loading asset manifest from: ${manifestPath}`);
830
- content = await readFile(manifestPath, "utf-8");
831
- const manifest = JSON.parse(content);
832
- this.logger.debug(`Loaded asset manifest: ${Object.keys(manifest.files).length} file assets, ${Object.keys(manifest.dockerImages).length} docker image assets`);
833
- return manifest;
834
- } catch (error) {
835
- if (error.code === "ENOENT") {
836
- this.logger.debug(`Asset manifest not found: ${manifestPath}`);
837
- return null;
838
- }
839
- if (error instanceof SyntaxError && content !== void 0) {
840
- this.logger.debug(safeMsg`Asset manifest ${manifestPath} failed to parse: ${parseFailureDebugDetail(error)}`);
841
- throw new Error(`Failed to load asset manifest from ${manifestPath}: ${describeJsonParseFailure(error, utf8ByteLength(content))}`);
842
- }
843
- throw new Error(`Failed to load asset manifest from ${manifestPath}: ${describeAwsFailure(error).detail}`);
844
- }
845
- }
846
- getFileAssets(manifest) {
847
- const fileAssets = /* @__PURE__ */ new Map();
848
- for (const [assetHash, asset] of Object.entries(manifest.files)) {
849
- if (isCfnTemplateAssetPath(asset.source.path)) {
850
- this.logger.debug(`Skipping CloudFormation template asset: ${asset.displayName}`);
851
- continue;
852
- }
853
- fileAssets.set(assetHash, asset);
854
- }
855
- this.logger.debug(`Found ${fileAssets.size} file assets (excluding templates)`);
856
- return fileAssets;
857
- }
858
- getAssetSourcePath(cdkOutputDir, asset, opts) {
859
- return resolveFileAssetSourcePath(cdkOutputDir, asset, opts);
860
- }
861
- resolveAssetDestinationValue(value, accountId, region, partition = "aws") {
862
- return value.replace(/\$\{AWS::AccountId\}/g, accountId).replace(/\$\{AWS::Region\}/g, region).replace(/\$\{AWS::Partition\}/g, partition);
863
- }
864
- };
865
- function getDockerImageBySourceHash(manifest, imageUri) {
866
- const dockerImages = manifest.dockerImages ?? {};
867
- const entries = Object.entries(dockerImages);
868
- if (entries.length === 0) return void 0;
869
- const hash = extractHashFromImageUri(imageUri);
870
- if (hash !== void 0) {
871
- const asset = dockerImages[hash];
872
- if (asset) return {
873
- hash,
874
- asset
875
- };
876
- }
877
- if (entries.length === 1) {
878
- const [singleHash, singleAsset] = entries[0];
879
- return {
880
- hash: singleHash,
881
- asset: singleAsset
882
- };
883
- }
884
- }
885
- function extractHashFromImageUri(imageUri) {
886
- if (imageUri.includes("@sha256:")) return void 0;
887
- return /:([a-f0-9]{8,})$/.exec(imageUri)?.[1];
888
- }
889
-
890
- // src/assets/asset-storage/names.ts
891
- const BOOTSTRAP_MARKER_PREFIX = "cdkd-bootstrap/";
892
- function getCdkdAssetBucketName(accountId, region) {
893
- return `cdkd-assets-${accountId}-${region}`;
894
- }
895
- function getCdkdContainerRepoName(accountId, region) {
896
- return `cdkd-container-assets-${accountId}-${region}`;
897
- }
898
-
899
- // src/assets/asset-storage/marker.ts
900
- function getBootstrapMarkerKey(region) {
901
- return `${BOOTSTRAP_MARKER_PREFIX}${region}.json`;
902
- }
903
- async function readBootstrapMarkerBody(stateBackend, rawRegion, opts = {}) {
904
- const canonicalKey = getBootstrapMarkerKey(canonicalizeRegion(rawRegion));
905
- const rawKey = getBootstrapMarkerKey(rawRegion);
906
- const body = await stateBackend.getRawObject(canonicalKey);
907
- if (body !== null || rawKey === canonicalKey) return {
908
- body,
909
- resolvedKey: canonicalKey
910
- };
911
- const rawBody = await stateBackend.getRawObject(rawKey);
912
- if (rawBody === null) return {
913
- body: null,
914
- resolvedKey: canonicalKey
915
- };
916
- const subject = opts.logPrefix ? `${opts.logPrefix}: bootstrap marker` : "Bootstrap marker";
917
- getLogger().debug(`${subject} found at the un-folded key '${rawKey}' (none at '${canonicalKey}') — an upper-cased region was used at 'cdkd bootstrap' time.`);
918
- return {
919
- body: rawBody,
920
- resolvedKey: rawKey
921
- };
922
- }
923
- const ASSET_BUCKET_NAME_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
924
- const CONTAINER_REPO_NAME_PATTERN = /^[a-z0-9]+(?:[._\-/][a-z0-9]+)*$/;
925
- function validateAssetBucketName(name) {
926
- if (!ASSET_BUCKET_NAME_PATTERN.test(name)) throw new CdkdError(`--asset-bucket '${name}' is not a valid S3 bucket name. Bucket names must be 3-63 characters of lowercase letters, digits, dots, and hyphens, and must start and end with a letter or digit.`, "INVALID_ASSET_STORAGE_NAME");
927
- }
928
- function isValidContainerRepoName(name) {
929
- return name.length >= 2 && name.length <= 256 && CONTAINER_REPO_NAME_PATTERN.test(name);
930
- }
931
- function validateContainerRepoName(name) {
932
- if (!isValidContainerRepoName(name)) throw new CdkdError(`--container-repo '${name}' is not a valid ECR repository name. Repository names must be 2-256 characters of lowercase letters and digits, optionally separated by single '.', '_', '-', or '/' characters (no leading, trailing, or doubled separators).`, "INVALID_ASSET_STORAGE_NAME");
933
- }
934
- function quotedIfPlain(value, description) {
935
- return isPlainName$1(value) ? `'${value}'` : description;
936
- }
937
- function isPlainName$1(value) {
938
- return !/\s/.test(value) && displayIdent(value, { maxCodePoints: 1152 }) === value;
939
- }
940
- function shownName(value) {
941
- return displayIdent(value, { maxCodePoints: STACK_REF_MAX_CODE_POINTS });
942
- }
943
- function droppedMarkerNames(body, assetBucket, containerRepo) {
944
- let parsed;
945
- try {
946
- parsed = JSON.parse(body);
947
- } catch {
948
- return "";
949
- }
950
- const fields = parsed ?? {};
951
- const dropped = (value, kept) => typeof value === "string" && value !== "" && value !== kept;
952
- const named = [dropped(fields.assetBucket, assetBucket) ? `asset bucket ${shownName(fields.assetBucket)}` : void 0, dropped(fields.containerRepo, containerRepo) ? `container repository ${shownName(fields.containerRepo)}` : void 0].filter((n) => n !== void 0);
953
- return named.length === 0 ? "" : ` It recorded ${named.join(" and ")}; storage under those names is no longer tracked by cdkd.`;
954
- }
955
- function bucketNameSubject(bucketName) {
956
- return isPlainName$1(bucketName) ? `Asset bucket name '${bucketName}'` : "An asset bucket name that is not a plain identifier";
957
- }
958
- function markerSubject(markerKey) {
959
- return isPlainName$1(markerKey) ? `Bootstrap marker '${markerKey}'` : "A bootstrap marker whose key is not a plain identifier";
960
- }
961
- function parseBootstrapMarker(body, markerKey) {
962
- let parsed;
963
- try {
964
- parsed = JSON.parse(body);
965
- } catch (error) {
966
- getLogger().debug(safeMsg`${markerSubject(markerKey)} failed to parse: ${parseFailureDebugDetail(error)}`);
967
- throw new CdkdError(`${markerSubject(markerKey)} in the state bucket is not valid JSON. Re-run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} for this region to rewrite it.`, "INVALID_BOOTSTRAP_MARKER", jsonParseFailureStandIn(error, utf8ByteLength(body)));
968
- }
969
- const marker = parsed;
970
- if (typeof marker.assetSupportVersion === "number" && marker.assetSupportVersion > 1) throw new CdkdError(`${markerSubject(markerKey)} has assetSupportVersion ${marker.assetSupportVersion}, but this cdkd only understands up to ${1}. Upgrade cdkd to deploy in this region.`, "UNSUPPORTED_BOOTSTRAP_MARKER_VERSION");
971
- if (typeof marker.assetBucket !== "string" || marker.assetBucket.length === 0 || typeof marker.containerRepo !== "string" || marker.containerRepo.length === 0 || typeof marker.assetSupportVersion !== "number") throw new CdkdError(`${markerSubject(markerKey)} in the state bucket is malformed (missing assetBucket / containerRepo / assetSupportVersion). Re-run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} for this region to rewrite it.`, "INVALID_BOOTSTRAP_MARKER");
972
- if (!ASSET_BUCKET_NAME_PATTERN.test(marker.assetBucket) || !isValidContainerRepoName(marker.containerRepo)) throw new CdkdError(`${markerSubject(markerKey)} in the state bucket is malformed (its asset bucket or container repository name is not a valid name). Re-run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} for this region to rewrite it.`, "INVALID_BOOTSTRAP_MARKER");
973
- return {
974
- assetBucket: marker.assetBucket,
975
- containerRepo: marker.containerRepo,
976
- assetSupportVersion: marker.assetSupportVersion,
977
- createdAt: typeof marker.createdAt === "string" ? marker.createdAt : ""
978
- };
979
- }
980
-
981
- // src/assets/asset-storage/bucket-region.ts
982
- function readBucketRegionHeader(error) {
983
- const headers = error?.$response?.headers;
984
- if (!headers) return void 0;
985
- for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "x-amz-bucket-region" && value) return value;
986
- }
987
- function bucketLocationToRegion$1(constraint) {
988
- if (!constraint) return "us-east-1";
989
- if (constraint === "EU") return "eu-west-1";
990
- return constraint;
991
- }
992
- function isCrossRegionRedirect(error) {
993
- const status = error?.$metadata?.httpStatusCode;
994
- if (status === 301) return true;
995
- return status === 400 && readBucketRegionHeader(error) !== void 0;
996
- }
997
- async function assertAssetBucketRegion(s3Client, bucketName, expectedRegion, accountId, cause) {
998
- const want = canonicalizeRegion(expectedRegion);
999
- const wantShown = plainIdentOr(want, "this deploy region");
1000
- const remedy = `Either bootstrap ${wantShown} with an asset-bucket name unique to it, or run this against the bucket's own region.\nBootstrap with: ${pasteableCommand("cdkd bootstrap", [{
1001
- flag: "--region",
1002
- value: want,
1003
- hole: "region"
1004
- }, {
1005
- flag: "--asset-bucket",
1006
- hole: "name"
1007
- }]).command}`;
1008
- let actual;
1009
- const fromHeader = readBucketRegionHeader(cause);
1010
- if (fromHeader) actual = canonicalizeRegion(fromHeader);
1011
- else try {
1012
- const location = await s3Client.send(new GetBucketLocationCommand({
1013
- Bucket: bucketName,
1014
- ExpectedBucketOwner: accountId
1015
- }));
1016
- actual = canonicalizeRegion(bucketLocationToRegion$1(location.LocationConstraint));
1017
- } catch (probeError) {
1018
- const fromProbe = readBucketRegionHeader(probeError);
1019
- if (fromProbe) actual = canonicalizeRegion(fromProbe);
1020
- else {
1021
- const failure = describeAwsFailure(probeError);
1022
- if (failure.redacted) getLogger().debug(`GetBucketLocation failed for asset bucket ${quotedIfPlain(bucketName, "with a name that is not a plain identifier")} while confirming it belongs to ${wantShown}: ${failure.detail}`);
1023
- throw new CdkdError(`${isPlainName$1(bucketName) ? `Asset bucket '${bucketName}'` : "An asset bucket whose name is not a plain identifier"} is claimed by an existing bucket, but cdkd could not determine which region that bucket is in, so it cannot confirm it belongs to ${wantShown}. Refusing to adopt it. (region probe failed: ${failure.summary}) ${remedy}`, "ASSET_STORAGE_FOREIGN_REGION_BUCKET", cause);
1024
- }
1025
- }
1026
- if (actual === want) return;
1027
- const actualShown = plainIdentOr(actual, "another region");
1028
- throw new CdkdError(`${bucketNameSubject(bucketName)} resolves to a bucket in ${actualShown}, while this operation targets ${wantShown}. S3 bucket names are globally unique, and both 'BucketAlreadyOwnedByYou' and a cross-region redirect report ACCOUNT ownership rather than the bucket's region, so cdkd cannot treat it as ${wantShown}'s asset bucket. cdkd asset storage is per-region by design: adopting it would publish ${wantShown}'s assets into ${actualShown} and apply ${wantShown}'s bucket configuration there. ${remedy}`, "ASSET_STORAGE_FOREIGN_REGION_BUCKET", cause);
1029
- }
1030
-
1031
- // src/assets/asset-storage/verify.ts
1032
- async function verifyAssetStorageExists(marker, accountId, region, opts = {}) {
1033
- const rebootstrapHint = `cdkd never silently falls back to CDK bootstrap asset storage once a region is opted in.\nRecreate it with: ${pasteableCommand("cdkd bootstrap", [{
1034
- flag: "--region",
1035
- value: region,
1036
- hole: "region"
1037
- }]).command}`;
1038
- const clientOpts = {
1039
- region,
1040
- ...opts.profile && { profile: opts.profile }
1041
- };
1042
- const s3Client = new S3Client({
1043
- ...awsClientDefaults({ profile: opts.profile }),
1044
- ...s3ClientDefaults(),
1045
- ...clientOpts
1046
- });
1047
- const ecrClient = new ECRClient({
1048
- ...awsClientDefaults({ profile: opts.profile }),
1049
- ...clientOpts
1050
- });
1051
- try {
1052
- try {
1053
- await s3Client.send(new HeadBucketCommand({
1054
- Bucket: marker.assetBucket,
1055
- ExpectedBucketOwner: accountId
1056
- }));
1057
- } catch (error) {
1058
- const err = error;
1059
- if (err.name === "NotFound" || err.name === "NoSuchBucket") throw new CdkdError(`cdkd asset storage is bootstrapped for region '${region}' but the asset bucket ${quotedIfPlain(marker.assetBucket, "named by its marker")} is missing. ${rebootstrapHint}`, "ASSET_STORAGE_MISSING");
1060
- if (err.$metadata?.httpStatusCode === 403) throw new CdkdError(`${isPlainName$1(marker.assetBucket) ? `Asset bucket '${marker.assetBucket}'` : "The asset bucket named by the marker"} exists but is not owned by account ${accountId} (or access is denied). Refusing to use it. ${rebootstrapHint}`, "ASSET_STORAGE_FOREIGN_BUCKET", error);
1061
- if (isCrossRegionRedirect(error)) {
1062
- await assertAssetBucketRegion(s3Client, marker.assetBucket, region, accountId, error);
1063
- throw normalizeAwsError(error, {
1064
- bucket: marker.assetBucket,
1065
- operation: "HeadBucket"
1066
- });
1067
- }
1068
- throw error;
1069
- }
1070
- try {
1071
- await ecrClient.send(new DescribeRepositoriesCommand({ repositoryNames: [marker.containerRepo] }));
1072
- } catch (error) {
1073
- if (error.name === "RepositoryNotFoundException") throw new CdkdError(`cdkd asset storage is bootstrapped for region '${region}' but the container-asset ECR repository ${quotedIfPlain(marker.containerRepo, "named by its marker")} is missing. ${rebootstrapHint}`, "ASSET_STORAGE_MISSING");
1074
- throw error;
1075
- }
1076
- } finally {
1077
- s3Client.destroy();
1078
- ecrClient.destroy();
1079
- }
1080
- }
1081
-
1082
- // src/utils/deny-external-access-policy.ts
1083
- function buildDenyExternalAccessPolicy(bucketName, accountId, region) {
1084
- const { partition } = derivePartitionAndUrlSuffix(region);
1085
- return {
1086
- Version: "2012-10-17",
1087
- Statement: [{
1088
- Sid: "DenyExternalAccess",
1089
- Effect: "Deny",
1090
- Principal: "*",
1091
- Action: "s3:*",
1092
- Resource: [`arn:${partition}:s3:::${bucketName}`, `arn:${partition}:s3:::${bucketName}/*`],
1093
- Condition: { StringNotEquals: { "aws:PrincipalAccount": accountId } }
1094
- }]
1095
- };
1096
- }
1097
-
1098
- // src/assets/asset-storage/lifecycle.ts
1099
- const ABORT_INCOMPLETE_MULTIPART_LIFECYCLE_RULE_ID = "cdkd-abort-incomplete-multipart-uploads";
1100
- const ABORT_INCOMPLETE_MULTIPART_DAYS = 1;
1101
- function buildAbortIncompleteMultipartRule(legacyPrefix) {
1102
- return {
1103
- ID: ABORT_INCOMPLETE_MULTIPART_LIFECYCLE_RULE_ID,
1104
- Status: "Enabled",
1105
- ...legacyPrefix ? { Prefix: "" } : { Filter: { Prefix: "" } },
1106
- AbortIncompleteMultipartUpload: { DaysAfterInitiation: 1 }
1107
- };
489
+ // src/assets/asset-storage/lifecycle.ts
490
+ const ABORT_INCOMPLETE_MULTIPART_LIFECYCLE_RULE_ID = "cdkd-abort-incomplete-multipart-uploads";
491
+ const ABORT_INCOMPLETE_MULTIPART_DAYS = 1;
492
+ function buildAbortIncompleteMultipartRule(legacyPrefix) {
493
+ return {
494
+ ID: ABORT_INCOMPLETE_MULTIPART_LIFECYCLE_RULE_ID,
495
+ Status: "Enabled",
496
+ ...legacyPrefix ? { Prefix: "" } : { Filter: { Prefix: "" } },
497
+ AbortIncompleteMultipartUpload: { DaysAfterInitiation: 1 }
498
+ };
1108
499
  }
1109
500
  async function applyAbortIncompleteMultipartUpload(s3, bucket, opts = {}) {
1110
501
  const owner = opts.expectedBucketOwner ? { ExpectedBucketOwner: opts.expectedBucketOwner } : {};
@@ -1397,34 +788,160 @@ var AssetModeResolver = class {
1397
788
  }
1398
789
  };
1399
790
 
1400
- // src/assets/asset-redirect.ts
1401
- function flattenAssetPlaceholders(value, accountId, region, partition = "aws") {
1402
- return value.replace(/\$\{AWS::AccountId\}/g, accountId).replace(/\$\{AWS::Region\}/g, region).replace(/\$\{AWS::Partition\}/g, partition);
1403
- }
1404
- function isDefaultBootstrapBucketName(name, accountId, region) {
1405
- return new RegExp(`^cdk-[a-z0-9]+-assets-${accountId}-${escapeRegExp$1(region)}$`).test(name);
791
+ // src/assets/absolute-asset-path-warning.ts
792
+ function warnWholeAssemblyAsSource(w) {
793
+ getLogger().child("assets").warn(`${w.subject} has ${w.field} naming the output directory ITSELF: ${displayAssemblyPath(w.outdir)}. cdkd will ${w.sink} — that is the WHOLE assembly, every template and every staged asset, not one asset directory. No CDK synth emits this, so treat this assembly as untrusted unless you wrote that path yourself.`);
1406
794
  }
1407
- function isDefaultBootstrapRepoName(name, accountId, region) {
1408
- return new RegExp(`^cdk-[a-z0-9]+-container-assets-${accountId}-${escapeRegExp$1(region)}$`).test(name);
795
+ function warnAbsoluteAssetPath(w) {
796
+ getLogger().child("assets").warn(`${w.subject} has an absolute ${w.field} pointing outside the assembly: ${displayAssemblyPath(w.absolute)}` + (w.escape.escape === "symlink" ? ` (through a symbolic link to ${displayAssemblyPath(w.escape.realPath)})` : "") + `. cdkd will ${w.sink}. This is what cdk synth --no-staging emits, and is expected for it; if you did not synthesize with that flag, treat this assembly as untrusted: an absolute source path is honoured as written, so nothing but this line stands between it and that step.`);
1409
797
  }
1410
- function buildAssetRedirectMap(manifest, marker, accountId, region, partition = "aws") {
1411
- const buckets = /* @__PURE__ */ new Map();
1412
- const repos = /* @__PURE__ */ new Map();
1413
- const sources = /* @__PURE__ */ new Map();
1414
- const addForms = (rawName, flattened, target) => {
1415
- sources.set(flattened, target);
1416
- if (rawName !== flattened) sources.set(rawName, target);
1417
- const suffixRe = new RegExp(`-${accountId}-${escapeRegExp$1(region)}$`);
1418
- for (const suffix of [
1419
- "-${AWS::AccountId}-${AWS::Region}",
1420
- `-\${AWS::AccountId}-${region}`,
1421
- `-${accountId}-\${AWS::Region}`
1422
- ]) {
1423
- const form = flattened.replace(suffixRe, suffix);
1424
- if (form !== flattened) sources.set(form, target);
1425
- }
1426
- };
1427
- const destTargetsDeployRegion = (dest) => {
798
+
799
+ // src/assets/asset-manifest-loader.ts
800
+ function resolveFileAssetSourcePath(manifestDir, asset, opts) {
801
+ const { assetOutdir, sink } = opts;
802
+ if (isAbsolute$1(asset.source.path)) {
803
+ const absolute = resolve$1(asset.source.path);
804
+ const escape = absoluteAssemblyPathEscape(assetOutdir, absolute);
805
+ if (escape !== void 0) warnAbsoluteAssetPath({
806
+ subject: `File asset ${displayAssemblyPath(asset.displayName)}`,
807
+ field: "source.path",
808
+ absolute,
809
+ escape,
810
+ sink
811
+ });
812
+ else if (namesTheSameDirectory(assetOutdir, absolute)) warnWholeAssemblyAsSource({
813
+ subject: `File asset ${displayAssemblyPath(asset.displayName)}`,
814
+ field: "source.path",
815
+ outdir: absolute,
816
+ sink
817
+ });
818
+ return absolute;
819
+ }
820
+ const resolved = resolveAssemblyPath(manifestDir, asset.source.path, { containWithin: assetOutdir });
821
+ if (!resolved.contained && namesTheSameDirectory(assetOutdir, resolved.path)) {
822
+ warnWholeAssemblyAsSource({
823
+ subject: `File asset ${displayAssemblyPath(asset.displayName)}`,
824
+ field: "source.path",
825
+ outdir: resolved.path,
826
+ sink
827
+ });
828
+ return resolved.path;
829
+ }
830
+ if (!resolved.contained) throw new Error(`File asset ${displayAssemblyPath(asset.displayName)} has source.path=${displayAssemblyPath(asset.source.path)} which ${renderAssemblyPathEscape(resolved, assetOutdir, "publish it")}`);
831
+ return resolved.path;
832
+ }
833
+ function isCfnTemplateAssetPath(sourcePath) {
834
+ return sourcePath.endsWith(".template.json");
835
+ }
836
+ function parseAssetManifestBody(content, manifestPath) {
837
+ try {
838
+ return JSON.parse(content);
839
+ } catch (err) {
840
+ getLogger().child("AssetManifestLoader").debug(safeMsg`Asset manifest ${manifestPath} failed to parse: ${parseFailureDebugDetail(err)}`);
841
+ throw new Error(`Failed to load asset manifest from ${manifestPath}: ${describeJsonParseFailure(err, utf8ByteLength(content))}`);
842
+ }
843
+ }
844
+ var AssetManifestLoader = class {
845
+ logger = getLogger().child("AssetManifestLoader");
846
+ async loadStackManifest(stack, fallbackDir) {
847
+ if (stack.assetManifestPath) return this.loadManifest(dirname$1(stack.assetManifestPath), stack.stackName, basename$1(stack.assetManifestPath));
848
+ return this.loadManifest(fallbackDir, stack.stackName);
849
+ }
850
+ async loadManifest(cdkOutputDir, stackName, fileName = `${stackName}.assets.json`) {
851
+ const resolved = resolveAssemblyPath(cdkOutputDir, fileName);
852
+ if (!resolved.contained) throw new Error(`Asset manifest for stack ${displayStackName(stackName)} ${renderAssemblyPathEscape(resolved, cdkOutputDir)}`);
853
+ const manifestPath = resolved.path;
854
+ let content;
855
+ try {
856
+ this.logger.debug(`Loading asset manifest from: ${manifestPath}`);
857
+ content = await readFile(manifestPath, "utf-8");
858
+ const manifest = JSON.parse(content);
859
+ this.logger.debug(`Loaded asset manifest: ${Object.keys(manifest.files).length} file assets, ${Object.keys(manifest.dockerImages).length} docker image assets`);
860
+ return manifest;
861
+ } catch (error) {
862
+ if (error.code === "ENOENT") {
863
+ this.logger.debug(`Asset manifest not found: ${manifestPath}`);
864
+ return null;
865
+ }
866
+ if (error instanceof SyntaxError && content !== void 0) {
867
+ this.logger.debug(safeMsg`Asset manifest ${manifestPath} failed to parse: ${parseFailureDebugDetail(error)}`);
868
+ throw new Error(`Failed to load asset manifest from ${manifestPath}: ${describeJsonParseFailure(error, utf8ByteLength(content))}`);
869
+ }
870
+ throw new Error(`Failed to load asset manifest from ${manifestPath}: ${describeAwsFailure(error).detail}`);
871
+ }
872
+ }
873
+ getFileAssets(manifest) {
874
+ const fileAssets = /* @__PURE__ */ new Map();
875
+ for (const [assetHash, asset] of Object.entries(manifest.files)) {
876
+ if (isCfnTemplateAssetPath(asset.source.path)) {
877
+ this.logger.debug(`Skipping CloudFormation template asset: ${asset.displayName}`);
878
+ continue;
879
+ }
880
+ fileAssets.set(assetHash, asset);
881
+ }
882
+ this.logger.debug(`Found ${fileAssets.size} file assets (excluding templates)`);
883
+ return fileAssets;
884
+ }
885
+ getAssetSourcePath(cdkOutputDir, asset, opts) {
886
+ return resolveFileAssetSourcePath(cdkOutputDir, asset, opts);
887
+ }
888
+ resolveAssetDestinationValue(value, accountId, region, partition = "aws") {
889
+ return value.replace(/\$\{AWS::AccountId\}/g, accountId).replace(/\$\{AWS::Region\}/g, region).replace(/\$\{AWS::Partition\}/g, partition);
890
+ }
891
+ };
892
+ function getDockerImageBySourceHash(manifest, imageUri) {
893
+ const dockerImages = manifest.dockerImages ?? {};
894
+ const entries = Object.entries(dockerImages);
895
+ if (entries.length === 0) return void 0;
896
+ const hash = extractHashFromImageUri(imageUri);
897
+ if (hash !== void 0) {
898
+ const asset = dockerImages[hash];
899
+ if (asset) return {
900
+ hash,
901
+ asset
902
+ };
903
+ }
904
+ if (entries.length === 1) {
905
+ const [singleHash, singleAsset] = entries[0];
906
+ return {
907
+ hash: singleHash,
908
+ asset: singleAsset
909
+ };
910
+ }
911
+ }
912
+ function extractHashFromImageUri(imageUri) {
913
+ if (imageUri.includes("@sha256:")) return void 0;
914
+ return /:([a-f0-9]{8,})$/.exec(imageUri)?.[1];
915
+ }
916
+
917
+ // src/assets/asset-redirect.ts
918
+ function flattenAssetPlaceholders(value, accountId, region, partition = "aws") {
919
+ return value.replace(/\$\{AWS::AccountId\}/g, accountId).replace(/\$\{AWS::Region\}/g, region).replace(/\$\{AWS::Partition\}/g, partition);
920
+ }
921
+ function isDefaultBootstrapBucketName(name, accountId, region) {
922
+ return new RegExp(`^cdk-[a-z0-9]+-assets-${accountId}-${escapeRegExp$1(region)}$`).test(name);
923
+ }
924
+ function isDefaultBootstrapRepoName(name, accountId, region) {
925
+ return new RegExp(`^cdk-[a-z0-9]+-container-assets-${accountId}-${escapeRegExp$1(region)}$`).test(name);
926
+ }
927
+ function buildAssetRedirectMap(manifest, marker, accountId, region, partition = "aws") {
928
+ const buckets = /* @__PURE__ */ new Map();
929
+ const repos = /* @__PURE__ */ new Map();
930
+ const sources = /* @__PURE__ */ new Map();
931
+ const addForms = (rawName, flattened, target) => {
932
+ sources.set(flattened, target);
933
+ if (rawName !== flattened) sources.set(rawName, target);
934
+ const suffixRe = new RegExp(`-${accountId}-${escapeRegExp$1(region)}$`);
935
+ for (const suffix of [
936
+ "-${AWS::AccountId}-${AWS::Region}",
937
+ `-\${AWS::AccountId}-${region}`,
938
+ `-${accountId}-\${AWS::Region}`
939
+ ]) {
940
+ const form = flattened.replace(suffixRe, suffix);
941
+ if (form !== flattened) sources.set(form, target);
942
+ }
943
+ };
944
+ const destTargetsDeployRegion = (dest) => {
1428
945
  if (!dest.region) return true;
1429
946
  return flattenAssetPlaceholders(dest.region, accountId, region, partition) === region;
1430
947
  };
@@ -1519,152 +1036,645 @@ function foldAndRewriteJoinParts(delimiter, parts, map, counter) {
1519
1036
  if (v === void 0) break;
1520
1037
  runValues.push(v);
1521
1038
  }
1522
- const literal = runValues.join(delimiter);
1523
- if (j - i > 1 && containsAnySource(literal, map)) {
1524
- out.push(rewriteString(literal, map, counter));
1525
- changed = true;
1526
- } else for (let k = i; k < j; k++) out.push(parts[k]);
1527
- i = j;
1528
- }
1529
- return changed ? out : parts;
1530
- }
1531
- function rewriteNode(node, map, counter) {
1532
- if (typeof node === "string") return rewriteString(node, map, counter);
1533
- if (Array.isArray(node)) {
1534
- for (let i = 0; i < node.length; i++) node[i] = rewriteNode(node[i], map, counter);
1535
- return node;
1536
- }
1537
- if (node !== null && typeof node === "object") {
1538
- const obj = node;
1539
- const joinArgs = obj["Fn::Join"];
1540
- if (Object.keys(obj).length === 1 && Array.isArray(joinArgs) && joinArgs.length === 2 && typeof joinArgs[0] === "string" && Array.isArray(joinArgs[1])) {
1541
- const foldedParts = foldAndRewriteJoinParts(joinArgs[0], joinArgs[1], map, counter);
1542
- obj["Fn::Join"] = [joinArgs[0], rewriteNode(foldedParts, map, counter)];
1543
- return obj;
1039
+ const literal = runValues.join(delimiter);
1040
+ if (j - i > 1 && containsAnySource(literal, map)) {
1041
+ out.push(rewriteString(literal, map, counter));
1042
+ changed = true;
1043
+ } else for (let k = i; k < j; k++) out.push(parts[k]);
1044
+ i = j;
1045
+ }
1046
+ return changed ? out : parts;
1047
+ }
1048
+ function rewriteNode(node, map, counter) {
1049
+ if (typeof node === "string") return rewriteString(node, map, counter);
1050
+ if (Array.isArray(node)) {
1051
+ for (let i = 0; i < node.length; i++) node[i] = rewriteNode(node[i], map, counter);
1052
+ return node;
1053
+ }
1054
+ if (node !== null && typeof node === "object") {
1055
+ const obj = node;
1056
+ const joinArgs = obj["Fn::Join"];
1057
+ if (Object.keys(obj).length === 1 && Array.isArray(joinArgs) && joinArgs.length === 2 && typeof joinArgs[0] === "string" && Array.isArray(joinArgs[1])) {
1058
+ const foldedParts = foldAndRewriteJoinParts(joinArgs[0], joinArgs[1], map, counter);
1059
+ obj["Fn::Join"] = [joinArgs[0], rewriteNode(foldedParts, map, counter)];
1060
+ return obj;
1061
+ }
1062
+ for (const key of Object.keys(obj)) obj[key] = rewriteNode(obj[key], map, counter);
1063
+ return obj;
1064
+ }
1065
+ return node;
1066
+ }
1067
+ function rewriteTemplateAssetReferences(template, map) {
1068
+ if (map.entries.length === 0) return 0;
1069
+ const counter = { n: 0 };
1070
+ rewriteNode(template, map, counter);
1071
+ return counter.n;
1072
+ }
1073
+ function auditNode(node, map, path, findings) {
1074
+ if (typeof node === "string") {
1075
+ for (const { source } of map.entries) {
1076
+ if (!node.includes(source)) continue;
1077
+ if (buildBoundaryRegex(source).test(node)) {
1078
+ findings.push({
1079
+ path,
1080
+ source
1081
+ });
1082
+ return;
1083
+ }
1084
+ }
1085
+ return;
1086
+ }
1087
+ if (Array.isArray(node)) {
1088
+ node.forEach((item, i) => auditNode(item, map, `${path}[${i}]`, findings));
1089
+ return;
1090
+ }
1091
+ if (node !== null && typeof node === "object") for (const [key, value] of Object.entries(node)) auditNode(value, map, path ? `${path}.${key}` : key, findings);
1092
+ }
1093
+ function findUnrewrittenAssetReferences(resolvedProperties, map) {
1094
+ const findings = [];
1095
+ auditNode(resolvedProperties, map, "", findings);
1096
+ return findings;
1097
+ }
1098
+ function redirectFileAsset(asset, map) {
1099
+ let changed = false;
1100
+ const destinations = {};
1101
+ for (const [id, dest] of Object.entries(asset.destinations ?? {})) {
1102
+ const flattened = flattenAssetPlaceholders(dest.bucketName, map.accountId, map.region, map.partition);
1103
+ const target = map.buckets.get(flattened);
1104
+ if (target && destRegionMatches(dest, map)) {
1105
+ destinations[id] = {
1106
+ ...dest,
1107
+ bucketName: target
1108
+ };
1109
+ changed = true;
1110
+ } else destinations[id] = dest;
1111
+ }
1112
+ return changed ? {
1113
+ ...asset,
1114
+ destinations
1115
+ } : asset;
1116
+ }
1117
+ function redirectDockerAsset(asset, map) {
1118
+ let changed = false;
1119
+ const destinations = {};
1120
+ for (const [id, dest] of Object.entries(asset.destinations ?? {})) {
1121
+ const flattened = flattenAssetPlaceholders(dest.repositoryName, map.accountId, map.region, map.partition);
1122
+ const target = map.repos.get(flattened);
1123
+ if (target && destRegionMatches(dest, map)) {
1124
+ destinations[id] = {
1125
+ ...dest,
1126
+ repositoryName: target
1127
+ };
1128
+ changed = true;
1129
+ } else destinations[id] = dest;
1130
+ }
1131
+ return changed ? {
1132
+ ...asset,
1133
+ destinations
1134
+ } : asset;
1135
+ }
1136
+ function destRegionMatches(dest, map) {
1137
+ if (!dest.region) return true;
1138
+ return flattenAssetPlaceholders(dest.region, map.accountId, map.region, map.partition) === map.region;
1139
+ }
1140
+ function loadPublishableAssetManifest(manifestPath) {
1141
+ let raw;
1142
+ try {
1143
+ raw = readFileSync(manifestPath, "utf-8");
1144
+ } catch (error) {
1145
+ if (error.code === "ENOENT") return null;
1146
+ throw error;
1147
+ }
1148
+ const manifest = parseAssetManifestBody(raw, manifestPath);
1149
+ if (Object.values(manifest.files ?? {}).filter((asset) => !isCfnTemplateAssetPath(asset.source.path)).length + Object.keys(manifest.dockerImages ?? {}).length === 0) return null;
1150
+ return manifest;
1151
+ }
1152
+ function createAssetRedirectResolver(opts, context = createLazyAssetModeContext(opts)) {
1153
+ return async (manifestPath, region) => {
1154
+ if (opts.useCdkBootstrapAssets || !manifestPath) return void 0;
1155
+ const manifest = loadPublishableAssetManifest(manifestPath);
1156
+ if (!manifest) return void 0;
1157
+ const accountId = await context.accountId();
1158
+ const mode = await context.resolveMode(region);
1159
+ if (mode.mode !== "cdkd-assets") return void 0;
1160
+ const map = buildAssetRedirectMap(manifest, mode.marker, accountId, region);
1161
+ return map.entries.length > 0 ? map : void 0;
1162
+ };
1163
+ }
1164
+ function createLazyAssetModeContext(opts) {
1165
+ let accountIdPromise;
1166
+ let modeResolver;
1167
+ const accountId = () => {
1168
+ accountIdPromise ??= (async () => {
1169
+ const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
1170
+ const stsClient = new STSClient({
1171
+ ...awsClientDefaults({ profile: opts.profile }),
1172
+ region: opts.stsRegion,
1173
+ ...opts.profile && { profile: opts.profile }
1174
+ });
1175
+ try {
1176
+ return (await stsClient.send(new GetCallerIdentityCommand({}))).Account;
1177
+ } finally {
1178
+ stsClient.destroy();
1179
+ }
1180
+ })();
1181
+ return accountIdPromise;
1182
+ };
1183
+ const resolveMode = async (region) => {
1184
+ if (opts.useCdkBootstrapAssets) return { mode: "legacy" };
1185
+ modeResolver ??= new AssetModeResolver(opts.stateBackend, await accountId(), {
1186
+ ...opts.profile && { profile: opts.profile },
1187
+ ...opts.suppressLegacyNotice && { suppressLegacyNotice: true }
1188
+ });
1189
+ return modeResolver.resolve(region);
1190
+ };
1191
+ return {
1192
+ accountId,
1193
+ resolveMode
1194
+ };
1195
+ }
1196
+
1197
+ // src/synthesis/synthesized-stacks.ts
1198
+ let lastSynthesizedStacks = [];
1199
+ function rememberSynthesizedStacks(stacks) {
1200
+ lastSynthesizedStacks = stacks;
1201
+ }
1202
+ function synthesizedStacks() {
1203
+ return lastSynthesizedStacks;
1204
+ }
1205
+
1206
+ // src/utils/s3-listing-keys.ts
1207
+ function decodeListingKey(value) {
1208
+ if (value === void 0) return void 0;
1209
+ try {
1210
+ return decodeURIComponent(value.replace(/\+/g, "%20"));
1211
+ } catch (error) {
1212
+ throw new Error(`S3 returned a listing key that is not valid URL encoding: ${JSON.stringify(value)}. cdkd takes every listing with EncodingType='url' so a key containing a carriage return survives the XML round-trip; a value that will not decode cannot be addressed safely, so this listing is refused rather than acted on.`, { cause: error });
1213
+ }
1214
+ }
1215
+
1216
+ // src/state/s3-replication-purge-gap.ts
1217
+ const DEFAULT_PURGED_OBJECT_DESCRIPTION = "the body of an object cdkd has just reported as removed";
1218
+ const replicationProbeCache = /* @__PURE__ */ new Map();
1219
+ const warnedWarnings = /* @__PURE__ */ new Set();
1220
+ const MAX_NAMED_DESTINATIONS = 3;
1221
+ const UNNAMED_DESTINATION = "<destination not named by the replication rule>";
1222
+ const PERMANENT_DENIALS = /* @__PURE__ */ new Set([
1223
+ "AccessDenied",
1224
+ "AccessDeniedException",
1225
+ "AllAccessDisabled",
1226
+ "MethodNotAllowed",
1227
+ "NotImplemented"
1228
+ ]);
1229
+ const TRANSIENT_CREDENTIAL_CODES = /* @__PURE__ */ new Set([
1230
+ "InvalidAccessKeyId",
1231
+ "ExpiredToken",
1232
+ "ExpiredTokenException",
1233
+ "InvalidToken",
1234
+ "TokenRefreshRequired",
1235
+ "RequestTimeTooSkewed",
1236
+ "RequestExpired"
1237
+ ]);
1238
+ const describe$1 = (error) => describeAwsFailure(error).detail;
1239
+ const errorCodes = (error) => {
1240
+ if (error === null || typeof error !== "object" && typeof error !== "function") return [];
1241
+ const e = error;
1242
+ const codes = [];
1243
+ if (typeof e.name === "string" && e.name.length > 0) codes.push(e.name);
1244
+ if (typeof e.Code === "string" && e.Code.length > 0) codes.push(e.Code);
1245
+ return codes;
1246
+ };
1247
+ const hasCode = (error, set) => errorCodes(error).some((code) => set.has(code));
1248
+ const httpStatus = (error) => {
1249
+ if (error === null || typeof error !== "object" && typeof error !== "function") return void 0;
1250
+ const meta = error.$metadata;
1251
+ return typeof meta?.httpStatusCode === "number" ? meta.httpStatusCode : void 0;
1252
+ };
1253
+ function destinationName(bucketArn, account) {
1254
+ if (bucketArn === void 0 || bucketArn === "") return UNNAMED_DESTINATION;
1255
+ const name = bucketArn.replace(/^arn:[^:]*:s3:::/, "");
1256
+ return account !== void 0 && account !== "" ? `${name} (account ${account})` : name;
1257
+ }
1258
+ function normalizeReplicationRules(config) {
1259
+ const targets = [];
1260
+ for (const rule of config.Rules ?? []) {
1261
+ const prefix = rule.Filter !== void 0 ? rule.Filter.Prefix ?? rule.Filter.And?.Prefix ?? "" : rule.Prefix ?? "";
1262
+ targets.push({
1263
+ prefix,
1264
+ destination: destinationName(rule.Destination?.Bucket, rule.Destination?.Account),
1265
+ enabled: rule.Status !== "Disabled"
1266
+ });
1267
+ }
1268
+ return targets;
1269
+ }
1270
+ async function runProbe(s3Client, bucket, requestFields) {
1271
+ try {
1272
+ const config = (await s3Client.send(new GetBucketReplicationCommand({
1273
+ Bucket: bucket,
1274
+ ...requestFields
1275
+ }))).ReplicationConfiguration;
1276
+ if (config === void 0) return { kind: "none" };
1277
+ const rules = normalizeReplicationRules(config);
1278
+ return rules.length === 0 ? { kind: "none" } : {
1279
+ kind: "rules",
1280
+ rules
1281
+ };
1282
+ } catch (error) {
1283
+ if (errorCodes(error).includes("ReplicationConfigurationNotFoundError")) return { kind: "none" };
1284
+ if (hasCode(error, TRANSIENT_CREDENTIAL_CODES)) return {
1285
+ kind: "unknown",
1286
+ reason: describe$1(error),
1287
+ retry: true
1288
+ };
1289
+ const permanent = hasCode(error, PERMANENT_DENIALS) || httpStatus(error) === 403;
1290
+ return {
1291
+ kind: "unknown",
1292
+ reason: describe$1(error),
1293
+ retry: !permanent
1294
+ };
1295
+ }
1296
+ }
1297
+ function probe(s3Client, bucket, requestFields) {
1298
+ const key = injectiveKey(bucket, requestFields.ExpectedBucketOwner ?? "");
1299
+ const cached = replicationProbeCache.get(key);
1300
+ if (cached) return cached;
1301
+ const pending = runProbe(s3Client, bucket, requestFields).then((result) => {
1302
+ if (result.kind === "unknown" && result.retry) evictIfOwn(key, pending);
1303
+ return result;
1304
+ }, (error) => {
1305
+ evictIfOwn(key, pending);
1306
+ return {
1307
+ kind: "unknown",
1308
+ reason: describe$1(error),
1309
+ retry: true
1310
+ };
1311
+ });
1312
+ replicationProbeCache.set(key, pending);
1313
+ return pending;
1314
+ }
1315
+ function evictIfOwn(key, own) {
1316
+ if (replicationProbeCache.get(key) === own) replicationProbeCache.delete(key);
1317
+ }
1318
+ async function warnIfPurgeIsReplicated(s3Client, bucket, keys, options = {}) {
1319
+ if (keys.length === 0) return;
1320
+ const emitDebug = (message) => {
1321
+ const sink = options.logger;
1322
+ if (sink?.debug) sink.debug(message);
1323
+ else getLogger().child("s3-replication-check").debug(message);
1324
+ };
1325
+ try {
1326
+ const safeBucket = displaySafe(bucket, { asciiOnly: true });
1327
+ const result = await probe(s3Client, bucket, options.requestFields ?? {});
1328
+ if (result.kind === "none") return;
1329
+ if (result.kind === "unknown") {
1330
+ emitDebug(`Could not determine whether s3://${safeBucket} is replicated (grant s3:GetReplicationConfiguration to enable the check): ${displaySafe(result.reason)}`);
1331
+ return;
1332
+ }
1333
+ const covered = result.rules.filter((rule) => keys.some((key) => key.startsWith(rule.prefix)));
1334
+ if (covered.length === 0) return;
1335
+ const destinations = [...new Set(covered.map((rule) => rule.enabled ? rule.destination : `${rule.destination} (rule currently Disabled -- it stops FUTURE replication, not what it already copied)`))].sort();
1336
+ const warnKey = injectiveKey(bucket, options.objectDescription ?? "", ...destinations);
1337
+ if (warnedWarnings.has(warnKey)) {
1338
+ emitDebug(`S3 replication on s3://${safeBucket} still covers purged keys (${options.objectDescription ?? "the body of an object cdkd has just reported as removed"}); already reported once this run for ${destinations.map((d) => displaySafe(d, { asciiOnly: true })).join(", ")}.`);
1339
+ return;
1340
+ }
1341
+ const named = destinations.slice(0, MAX_NAMED_DESTINATIONS).map((d) => displaySafe(d, { asciiOnly: true }));
1342
+ const elided = destinations.length - named.length;
1343
+ (options.logger ?? getLogger().child("s3-replication-check")).warn(`S3 replication is enabled on s3://${safeBucket} and covers the key(s) cdkd just purged. S3 NEVER replicates a version-id delete, so the purge removed those versions from THIS bucket only — the copies in the destination bucket survive and remain readable there via GetObject with a VersionId (${options.objectDescription ?? "the body of an object cdkd has just reported as removed"}). cdkd cannot delete them. Remove them in the destination bucket yourself (aws s3api list-object-versions, then delete-object --version-id), or narrow the replication rule so it excludes the prefixes cdkd purges under. Destination(s): ${named.join(", ")}` + (elided > 0 ? ` (and ${elided} more; ${withPasteableAwsProfile("aws s3api get-bucket-replication")} --bucket ${safeBucket} lists them all)` : ""));
1344
+ warnedWarnings.add(warnKey);
1345
+ } catch {}
1346
+ }
1347
+
1348
+ // src/state/s3-noncurrent-version-purge.ts
1349
+ const CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION = "a custom-resource response object, which is the handler's full cfn-response body including `Data`";
1350
+ const DELETE_BATCH_SIZE = 1e3;
1351
+ const MAX_NAMED_FAILURES = 5;
1352
+ const UNKNOWN_KEY_PREFIX = "<unknown key #";
1353
+ const TRUNCATED_NO_MARKER = "listing reported IsTruncated with no NextKeyMarker; the walk stopped early and versions may remain";
1354
+ function recordFailure(failed, key, reason) {
1355
+ const existing = failed.get(key);
1356
+ if (existing) existing.push(reason);
1357
+ else failed.set(key, [reason]);
1358
+ }
1359
+ const describe = (error) => describeAwsFailure(error).detail;
1360
+ const PREFIX_HANDLE_SUFFIX = "* (every key under this prefix)";
1361
+ async function purgeNoncurrentVersionsUnderPrefix(s3Client, bucket, prefix, options = {}) {
1362
+ const logger = options.logger ?? getLogger().child("s3-version-purge");
1363
+ if (!prefix.endsWith("/") || prefix.replace(/\/+/g, "") === "") {
1364
+ logger.warn(safeMsg`Refused to purge noncurrent versions under ${JSON.stringify(prefix)}: ` + `a prefix-wide purge needs a non-empty prefix ending in '/'. Nothing was purged.`);
1365
+ return {
1366
+ deletedBodies: 0,
1367
+ complete: false
1368
+ };
1369
+ }
1370
+ const handle = `${prefix}${PREFIX_HANDLE_SUFFIX}`;
1371
+ return purgeWalk(s3Client, bucket, [prefix], {
1372
+ scope: {
1373
+ covers: (key) => key.startsWith(prefix),
1374
+ unsettledUnder: () => [handle],
1375
+ ownsEveryListedKey: true
1376
+ },
1377
+ listingFailureHandles: () => [handle],
1378
+ options: {
1379
+ ...options,
1380
+ logger
1381
+ }
1382
+ });
1383
+ }
1384
+ async function purgeNoncurrentKeyVersions(s3Client, bucket, keys, options = {}) {
1385
+ if (keys.length === 0) return;
1386
+ const wanted = new Set(keys);
1387
+ await purgeWalk(s3Client, bucket, options.listPrefix !== void 0 ? [options.listPrefix] : keys, {
1388
+ scope: {
1389
+ covers: (key) => wanted.has(key),
1390
+ unsettledUnder: (prefix) => [...wanted].filter((key) => key.startsWith(prefix)),
1391
+ ownsEveryListedKey: false
1392
+ },
1393
+ listingFailureHandles: (prefix) => options.listPrefix !== void 0 ? [...keys] : [prefix],
1394
+ options
1395
+ });
1396
+ }
1397
+ async function purgeWalk(s3Client, bucket, prefixes, params) {
1398
+ const { scope, listingFailureHandles, options } = params;
1399
+ const logger = options.logger ?? getLogger().child("s3-version-purge");
1400
+ const requestFields = options.requestFields ?? {};
1401
+ const failed = /* @__PURE__ */ new Map();
1402
+ const unknown = { n: 0 };
1403
+ const purged = /* @__PURE__ */ new Set();
1404
+ const unsettledBodies = /* @__PURE__ */ new Set();
1405
+ const removed = { n: 0 };
1406
+ for (const prefix of prefixes) try {
1407
+ await purgeUnderPrefix(s3Client, bucket, prefix, scope, requestFields, failed, unknown, purged, unsettledBodies, removed);
1408
+ } catch (error) {
1409
+ for (const key of listingFailureHandles(prefix)) {
1410
+ recordFailure(failed, key, describe(error));
1411
+ unsettledBodies.add(key);
1412
+ }
1413
+ }
1414
+ if (failed.size > 0) {
1415
+ const named = [...failed.entries()].slice(0, MAX_NAMED_FAILURES).map(([key, reasons]) => displaySafe(`${key} (${reasons.join("; ")})`));
1416
+ const elided = failed.size - named.length;
1417
+ const prefixCount = [...failed.keys()].filter((k) => k.endsWith(PREFIX_HANDLE_SUFFIX)).length;
1418
+ const keyCount = failed.size - prefixCount;
1419
+ const subject = [keyCount > 0 ? `${keyCount} key(s)` : "", prefixCount > 0 ? `every key under ${prefixCount} prefix(es)` : ""].filter((part) => part !== "").join(" and ");
1420
+ logger.warn(`Could not purge noncurrent versions of ${subject} in s3://${displaySafe(bucket, { asciiOnly: true })}. Their previous versions survive and remain readable via GetObject with a VersionId (${options.objectDescription ?? "the body of an object cdkd has just reported as removed"}). Grant s3:ListBucketVersions and s3:DeleteObjectVersion on the state bucket, or purge the key(s) by hand. Failures: ${named.join(", ")}` + (elided > 0 ? ` (and ${elided} more)` : ""));
1421
+ }
1422
+ const replicationKeys = [.../* @__PURE__ */ new Set([...purged, ...unsettledBodies])];
1423
+ await warnIfPurgeIsReplicated(s3Client, bucket, replicationKeys, {
1424
+ requestFields,
1425
+ logger,
1426
+ ...options.objectDescription !== void 0 && { objectDescription: options.objectDescription }
1427
+ });
1428
+ return {
1429
+ deletedBodies: removed.n,
1430
+ complete: failed.size === 0
1431
+ };
1432
+ }
1433
+ async function purgeUnderPrefix(s3Client, bucket, prefix, scope, requestFields, failed, unknown, purged, unsettledBodies, removed) {
1434
+ let keyMarker;
1435
+ let versionIdMarker;
1436
+ do {
1437
+ const resp = await s3Client.send(new ListObjectVersionsCommand({
1438
+ Bucket: bucket,
1439
+ ...requestFields,
1440
+ Prefix: prefix,
1441
+ EncodingType: "url",
1442
+ ...keyMarker !== void 0 && { KeyMarker: keyMarker },
1443
+ ...versionIdMarker !== void 0 && { VersionIdMarker: versionIdMarker }
1444
+ }));
1445
+ const stale = [];
1446
+ const staleBodies = /* @__PURE__ */ new Map();
1447
+ const isStaleBody = (key, versionId) => key !== void 0 && versionId !== void 0 && staleBodies.get(key)?.has(versionId) === true;
1448
+ const entries = [...(resp.Versions ?? []).map((entry) => ({
1449
+ entry,
1450
+ hasBody: true
1451
+ })), ...(resp.DeleteMarkers ?? []).map((entry) => ({
1452
+ entry,
1453
+ hasBody: false
1454
+ }))];
1455
+ for (const { entry, hasBody } of entries) {
1456
+ let decodedKey;
1457
+ try {
1458
+ decodedKey = decodeListingKey(entry.Key);
1459
+ } catch {
1460
+ if (hasBody && entry.Key !== void 0) unsettledBodies.add(`${entry.Key} [key not decodable; shown as S3 returned it]`);
1461
+ if (scope.ownsEveryListedKey && entry.Key !== void 0 && entry.IsLatest !== true) recordFailure(failed, `${entry.Key} [key not decodable; shown as S3 returned it]`, `version ${entry.VersionId ?? "<unknown>"}: listing key could not be decoded, so the entry was left alone`);
1462
+ continue;
1463
+ }
1464
+ if (decodedKey === void 0 || !scope.covers(decodedKey)) continue;
1465
+ if (entry.IsLatest === void 0) {
1466
+ recordFailure(failed, decodedKey, `version ${entry.VersionId ?? "<unknown>"}: listing omitted IsLatest, so the entry was left alone rather than risk deleting a current version`);
1467
+ if (hasBody) unsettledBodies.add(decodedKey);
1468
+ }
1469
+ if (entry.IsLatest !== false) continue;
1470
+ if (!entry.VersionId) {
1471
+ recordFailure(failed, decodedKey, `listing returned a noncurrent entry with no VersionId, so it could not be deleted`);
1472
+ if (hasBody) unsettledBodies.add(decodedKey);
1473
+ continue;
1474
+ }
1475
+ stale.push({
1476
+ Key: decodedKey,
1477
+ VersionId: entry.VersionId
1478
+ });
1479
+ if (hasBody) {
1480
+ const ids = staleBodies.get(decodedKey) ?? /* @__PURE__ */ new Set();
1481
+ ids.add(entry.VersionId);
1482
+ staleBodies.set(decodedKey, ids);
1483
+ }
1484
+ if (hasBody) purged.add(decodedKey);
1485
+ }
1486
+ for (let i = 0; i < stale.length; i += DELETE_BATCH_SIZE) {
1487
+ const batch = stale.slice(i, i + DELETE_BATCH_SIZE);
1488
+ try {
1489
+ const deleted = await s3Client.send(new DeleteObjectsCommand({
1490
+ Bucket: bucket,
1491
+ ...requestFields,
1492
+ Delete: {
1493
+ Objects: batch,
1494
+ Quiet: true
1495
+ }
1496
+ }));
1497
+ let bodiesRemoved = batch.filter((o) => isStaleBody(o.Key, o.VersionId)).length;
1498
+ for (const err of deleted.Errors ?? []) if (err.Key === void 0 || err.VersionId === void 0 || isStaleBody(err.Key, err.VersionId)) bodiesRemoved -= 1;
1499
+ removed.n += Math.max(0, bodiesRemoved);
1500
+ for (const err of deleted.Errors ?? []) {
1501
+ if (err.Code === "NoSuchVersion") continue;
1502
+ const reason = `version ${err.VersionId ?? "<unknown>"}: ${err.Code ?? "Error"}` + (err.Message ? ` - ${err.Message}` : "");
1503
+ if (err.Key !== void 0) recordFailure(failed, err.Key, reason);
1504
+ else {
1505
+ unknown.n += 1;
1506
+ recordFailure(failed, `${UNKNOWN_KEY_PREFIX}${unknown.n}>`, reason);
1507
+ }
1508
+ }
1509
+ } catch (error) {
1510
+ for (const object of batch) recordFailure(failed, object.Key, describe(error));
1511
+ }
1544
1512
  }
1545
- for (const key of Object.keys(obj)) obj[key] = rewriteNode(obj[key], map, counter);
1546
- return obj;
1547
- }
1548
- return node;
1513
+ if (resp.IsTruncated === true && resp.NextKeyMarker === void 0) for (const key of scope.unsettledUnder(prefix)) {
1514
+ recordFailure(failed, key, TRUNCATED_NO_MARKER);
1515
+ unsettledBodies.add(key);
1516
+ }
1517
+ keyMarker = resp.IsTruncated === true ? decodeListingKey(resp.NextKeyMarker) : void 0;
1518
+ versionIdMarker = keyMarker !== void 0 ? resp.NextVersionIdMarker : void 0;
1519
+ } while (keyMarker !== void 0);
1549
1520
  }
1550
- function rewriteTemplateAssetReferences(template, map) {
1551
- if (map.entries.length === 0) return 0;
1552
- const counter = { n: 0 };
1553
- rewriteNode(template, map, counter);
1554
- return counter.n;
1521
+
1522
+ // src/utils/parameter-types.ts
1523
+ function isListParameterType(type) {
1524
+ if (type === "CommaDelimitedList") return true;
1525
+ return type.length > 6 && type.startsWith("List<") && type.endsWith(">");
1555
1526
  }
1556
- function auditNode(node, map, path, findings) {
1557
- if (typeof node === "string") {
1558
- for (const { source } of map.entries) {
1559
- if (!node.includes(source)) continue;
1560
- if (buildBoundaryRegex(source).test(node)) {
1561
- findings.push({
1562
- path,
1563
- source
1564
- });
1565
- return;
1566
- }
1567
- }
1568
- return;
1569
- }
1570
- if (Array.isArray(node)) {
1571
- node.forEach((item, i) => auditNode(item, map, `${path}[${i}]`, findings));
1572
- return;
1573
- }
1574
- if (node !== null && typeof node === "object") for (const [key, value] of Object.entries(node)) auditNode(value, map, path ? `${path}.${key}` : key, findings);
1527
+ const SSM_PARAMETER_VALUE_PREFIX = "AWS::SSM::Parameter::Value<";
1528
+ function ssmResolvedValueType(type) {
1529
+ if (!type.startsWith("AWS::SSM::Parameter::Value<") || !type.endsWith(">")) return void 0;
1530
+ const inner = type.slice(27, -1);
1531
+ return inner.length > 0 ? inner : void 0;
1575
1532
  }
1576
- function findUnrewrittenAssetReferences(resolvedProperties, map) {
1577
- const findings = [];
1578
- auditNode(resolvedProperties, map, "", findings);
1579
- return findings;
1533
+
1534
+ // src/utils/nested-template-cycle.ts
1535
+ const NESTED_STACK_TYPE$5 = "AWS::CloudFormation::Stack";
1536
+ function isAbsoluteAssetPath(p) {
1537
+ return path.isAbsolute(p) || p.startsWith("/");
1580
1538
  }
1581
- function redirectFileAsset(asset, map) {
1582
- let changed = false;
1583
- const destinations = {};
1584
- for (const [id, dest] of Object.entries(asset.destinations ?? {})) {
1585
- const flattened = flattenAssetPlaceholders(dest.bucketName, map.accountId, map.region, map.partition);
1586
- const target = map.buckets.get(flattened);
1587
- if (target && destRegionMatches(dest, map)) {
1588
- destinations[id] = {
1589
- ...dest,
1590
- bucketName: target
1591
- };
1592
- changed = true;
1593
- } else destinations[id] = dest;
1539
+ function templateIdentity(templatePath) {
1540
+ const dir = path.dirname(templatePath);
1541
+ let realDir;
1542
+ try {
1543
+ realDir = fs.realpathSync.native(dir);
1544
+ } catch {
1545
+ realDir = path.resolve(dir);
1594
1546
  }
1595
- return changed ? {
1596
- ...asset,
1597
- destinations
1598
- } : asset;
1547
+ return path.join(realDir, path.basename(templatePath));
1599
1548
  }
1600
- function redirectDockerAsset(asset, map) {
1601
- let changed = false;
1602
- const destinations = {};
1603
- for (const [id, dest] of Object.entries(asset.destinations ?? {})) {
1604
- const flattened = flattenAssetPlaceholders(dest.repositoryName, map.accountId, map.region, map.partition);
1605
- const target = map.repos.get(flattened);
1606
- if (target && destRegionMatches(dest, map)) {
1607
- destinations[id] = {
1608
- ...dest,
1609
- repositoryName: target
1610
- };
1611
- changed = true;
1612
- } else destinations[id] = dest;
1549
+ function listNestedTemplateRows(template) {
1550
+ if (template === null || typeof template !== "object") return [];
1551
+ const resources = template.Resources;
1552
+ if (resources === null || resources === void 0) return [];
1553
+ const rows = [];
1554
+ for (const [logicalId, resource] of Object.entries(resources)) {
1555
+ const row = resource;
1556
+ if (row?.Type !== NESTED_STACK_TYPE$5) continue;
1557
+ const assetPath = row.Metadata?.["aws:asset:path"];
1558
+ if (typeof assetPath !== "string" || assetPath.length === 0) continue;
1559
+ rows.push({
1560
+ logicalId,
1561
+ assetPath
1562
+ });
1613
1563
  }
1614
- return changed ? {
1615
- ...asset,
1616
- destinations
1617
- } : asset;
1618
- }
1619
- function destRegionMatches(dest, map) {
1620
- if (!dest.region) return true;
1621
- return flattenAssetPlaceholders(dest.region, map.accountId, map.region, map.partition) === map.region;
1564
+ return rows;
1622
1565
  }
1623
- function loadPublishableAssetManifest(manifestPath) {
1624
- let raw;
1566
+ function readNestedRows(templatePath) {
1567
+ let parsed;
1625
1568
  try {
1626
- raw = readFileSync(manifestPath, "utf-8");
1627
- } catch (error) {
1628
- if (error.code === "ENOENT") return null;
1629
- throw error;
1569
+ parsed = JSON.parse(fs.readFileSync(templatePath, "utf-8"));
1570
+ } catch {
1571
+ return;
1630
1572
  }
1631
- const manifest = parseAssetManifestBody(raw, manifestPath);
1632
- if (Object.values(manifest.files ?? {}).filter((asset) => !isCfnTemplateAssetPath(asset.source.path)).length + Object.keys(manifest.dockerImages ?? {}).length === 0) return null;
1633
- return manifest;
1573
+ return listNestedTemplateRows(parsed);
1634
1574
  }
1635
- function createAssetRedirectResolver(opts) {
1636
- let accountIdPromise;
1637
- let modeResolver;
1638
- const getAccountId = () => {
1639
- accountIdPromise ??= (async () => {
1640
- const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
1641
- const stsClient = new STSClient({
1642
- ...awsClientDefaults({ profile: opts.profile }),
1643
- region: opts.stsRegion,
1644
- ...opts.profile && { profile: opts.profile }
1645
- });
1575
+ const MAX_NESTING_DEPTH = 512;
1576
+ const MAX_ROWS_FOLLOWED = 1e4;
1577
+ function findNestedTemplateTreeDefect(nestedTemplates, ancestorTemplatePaths = []) {
1578
+ const onChain = /* @__PURE__ */ new Set();
1579
+ for (const p of ancestorTemplatePaths) onChain.add(templateIdentity(p));
1580
+ const clean = /* @__PURE__ */ new Set();
1581
+ const chain = [];
1582
+ let rowsFollowed = 0;
1583
+ const visit = (logicalId, templatePath) => {
1584
+ if (typeof templatePath !== "string") return void 0;
1585
+ const identity = templateIdentity(templatePath);
1586
+ const lexical = path.resolve(templatePath);
1587
+ chain.push({
1588
+ logicalId,
1589
+ templatePath: identity
1590
+ });
1591
+ try {
1592
+ if (onChain.has(identity)) return {
1593
+ kind: "cycle",
1594
+ chain: [...chain]
1595
+ };
1596
+ if (chain.length > 512) return {
1597
+ kind: "too-deep",
1598
+ chain: [...chain]
1599
+ };
1600
+ if (++rowsFollowed > 1e4) return {
1601
+ kind: "too-large",
1602
+ chain: [...chain]
1603
+ };
1604
+ if (clean.has(lexical)) return void 0;
1605
+ const rows = readNestedRows(templatePath);
1606
+ if (rows === void 0) return void 0;
1607
+ onChain.add(identity);
1646
1608
  try {
1647
- return (await stsClient.send(new GetCallerIdentityCommand({}))).Account;
1609
+ const dir = path.dirname(templatePath);
1610
+ for (const row of rows) {
1611
+ if (isAbsoluteAssetPath(row.assetPath)) return {
1612
+ kind: "absolute-path",
1613
+ chain: [...chain],
1614
+ logicalId: row.logicalId,
1615
+ assetPath: row.assetPath
1616
+ };
1617
+ const resolved = resolveAssemblyPath(dir, row.assetPath);
1618
+ if (!resolved.contained) return {
1619
+ kind: "escaping-path",
1620
+ chain: [...chain],
1621
+ logicalId: row.logicalId,
1622
+ assetPath: row.assetPath,
1623
+ escape: resolved,
1624
+ dir
1625
+ };
1626
+ const defect = visit(row.logicalId, resolved.path);
1627
+ if (defect) return defect;
1628
+ }
1648
1629
  } finally {
1649
- stsClient.destroy();
1630
+ onChain.delete(identity);
1650
1631
  }
1651
- })();
1652
- return accountIdPromise;
1632
+ clean.add(lexical);
1633
+ return;
1634
+ } finally {
1635
+ chain.pop();
1636
+ }
1653
1637
  };
1654
- return async (manifestPath, region) => {
1655
- if (opts.useCdkBootstrapAssets || !manifestPath) return void 0;
1656
- const manifest = loadPublishableAssetManifest(manifestPath);
1657
- if (!manifest) return void 0;
1658
- const accountId = await getAccountId();
1659
- modeResolver ??= new AssetModeResolver(opts.stateBackend, accountId, {
1660
- ...opts.profile && { profile: opts.profile },
1661
- ...opts.suppressLegacyNotice && { suppressLegacyNotice: true }
1662
- });
1663
- const mode = await modeResolver.resolve(region);
1664
- if (mode.mode !== "cdkd-assets") return void 0;
1665
- const map = buildAssetRedirectMap(manifest, mode.marker, accountId, region);
1666
- return map.entries.length > 0 ? map : void 0;
1638
+ for (const [logicalId, templatePath] of Object.entries(nestedTemplates)) {
1639
+ const defect = visit(logicalId, templatePath);
1640
+ if (defect) return defect;
1641
+ }
1642
+ }
1643
+ const MAX_RENDERED_HOPS = 8;
1644
+ function renderChain(chain) {
1645
+ const hop = (h) => `${displayIdent(h.logicalId)} (${displayAssemblyPath(h.templatePath)})`;
1646
+ if (chain.length <= MAX_RENDERED_HOPS) return chain.map(hop).join(" then ");
1647
+ const keep = MAX_RENDERED_HOPS / 2;
1648
+ return [
1649
+ ...chain.slice(0, keep).map(hop),
1650
+ `... ${chain.length - 8} more ...`,
1651
+ ...chain.slice(-4).map(hop)
1652
+ ].join(" then ");
1653
+ }
1654
+ function renderNestedTemplateTreeDefect(defect, stackName, action) {
1655
+ const provenance = `CDK emits an acyclic nested template tree with relative asset paths, so this indicates the synth output was hand-modified or generated by a non-CDK toolchain. Refusing to ${action}.`;
1656
+ const owner = (chain) => {
1657
+ const ids = chain.slice(0, -1).map((h) => h.logicalId);
1658
+ const keep = MAX_RENDERED_HOPS / 2;
1659
+ if (ids.length <= MAX_RENDERED_HOPS) return displayStackName([stackName, ...ids].join("~"));
1660
+ const head = displayStackName([stackName, ...ids.slice(0, keep)].join("~"));
1661
+ const tail = displayStackName(ids.slice(-4).join("~"));
1662
+ return `${head}~...${ids.length - 8} more...~${tail}`;
1667
1663
  };
1664
+ if (defect.kind === "cycle") {
1665
+ const closing = defect.chain[defect.chain.length - 1];
1666
+ return `The nested template tree under stack ${displayStackName(stackName)} contains a cycle: ${renderChain(defect.chain)}. Nested stack ${displayIdent(closing.logicalId)} (declared in stack ${owner(defect.chain)}) resolves to a template that is already on that nesting chain, so its Metadata['aws:asset:path'] closes a cycle. ${provenance}`;
1667
+ }
1668
+ if (defect.kind === "too-large") return `The nested template tree under stack ${displayStackName(stackName)} has more than ${MAX_ROWS_FOLLOWED} nested-stack rows to follow (the walk stopped at ${renderChain(defect.chain)}). That is far beyond any CDK-generated assembly. Symlinked directories can give one template file many paths, which multiplies the tree without ever repeating on one chain. Refusing to ${action}.`;
1669
+ if (defect.kind === "too-deep") return `The nested template tree under stack ${displayStackName(stackName)} nests more than ${512} levels deep: ${renderChain(defect.chain)}. No tree that deep can deploy, because each level lengthens the child's state key and S3 caps a key at 1024 bytes. ${provenance}`;
1670
+ if (defect.kind === "escaping-path") return `The nested template tree under stack ${displayStackName(stackName)} has nested stack ${displayIdent(defect.logicalId)} (reached through ${renderChain(defect.chain)}) with Metadata['aws:asset:path']=${displayAssemblyPath(defect.assetPath)} which ${renderAssemblyPathEscape(defect.escape, defect.dir, action)}`;
1671
+ return `The nested template tree under stack ${displayStackName(stackName)} has nested stack ${displayIdent(defect.logicalId)} (reached through ${renderChain(defect.chain)}) with Metadata['aws:asset:path']=${displayAssemblyPath(defect.assetPath)} which is absolute. ${provenance}`;
1672
+ }
1673
+
1674
+ // src/utils/missing-state-bucket-remedy.ts
1675
+ function missingStateBucketRemedy(what) {
1676
+ if (!awsEndpointOverrideActive()) return `Run ${proseQuoted(cdkdRemedy("cdkd bootstrap"))} to create ${what}.`;
1677
+ return `AWS Emulator keeps nothing across restarts, so a new or restarted emulator has no cdkd bootstrap yet. A cdkd deploy without --dry-run creates the state bucket on its own; or bootstrap the emulator now with:\n${cdkdRemedy("cdkd bootstrap")}`;
1668
1678
  }
1669
1679
 
1670
1680
  // src/utils/stringify.ts
@@ -2346,6 +2356,31 @@ const STATE_SCHEMA_VERSIONS_READABLE = [
2346
2356
  16,
2347
2357
  17
2348
2358
  ];
2359
+ function classifyStateRecordAccess(version, minReaderVersion) {
2360
+ if (version === void 0) return { kind: "writable" };
2361
+ if (STATE_SCHEMA_VERSIONS_READABLE.includes(version)) return { kind: "writable" };
2362
+ if (typeof version === "number" && Number.isSafeInteger(version) && version > 17 && STATE_SCHEMA_VERSIONS_READABLE.includes(minReaderVersion)) return {
2363
+ kind: "read-only",
2364
+ version
2365
+ };
2366
+ return { kind: "unsupported" };
2367
+ }
2368
+ const READ_ONLY_STATE_MARK = Symbol("cdkd.readOnlyStateVersion");
2369
+ function markReadOnlyState(state, version) {
2370
+ Object.defineProperty(state, READ_ONLY_STATE_MARK, {
2371
+ value: version,
2372
+ enumerable: true,
2373
+ configurable: true,
2374
+ writable: false
2375
+ });
2376
+ return state;
2377
+ }
2378
+ function readOnlyStateVersionOf(state) {
2379
+ const marked = state[READ_ONLY_STATE_MARK];
2380
+ if (typeof marked === "number") return marked;
2381
+ const version = state.version;
2382
+ if (typeof version === "number" && version > 17) return version;
2383
+ }
2349
2384
 
2350
2385
  // src/state/create-token-ledger.ts
2351
2386
  const CREATE_TOKEN_LEDGER_VERSION = 1;
@@ -2520,7 +2555,7 @@ async function rawObjectExists(key) {
2520
2555
  await this.ensureClientForBucket();
2521
2556
  return this.headObject(key);
2522
2557
  }
2523
- async function getState(stackName, region) {
2558
+ async function getState(stackName, region, options = {}) {
2524
2559
  await this.ensureClientForBucket();
2525
2560
  const newKey = this.getStateKey(stackName, region);
2526
2561
  const shownStackName = this.displayName(stackName);
@@ -2535,7 +2570,7 @@ async function getState(stackName, region) {
2535
2570
  if (!response.Body) throw new StateError(`State file for stack ${shownStackName} (${shownRegionName}) has no body`);
2536
2571
  if (!response.ETag) throw new StateError(`State file for stack ${shownStackName} (${shownRegionName}) has no ETag`);
2537
2572
  const bodyString = await response.Body.transformToString();
2538
- const parsed = this.parseStateBody(bodyString, stackName);
2573
+ const parsed = this.parseStateBody(bodyString, stackName, options);
2539
2574
  const { state, divergentBodyRegion } = this.adoptKeyRegion(parsed, region, shownStackName, shownRegionName);
2540
2575
  if (!bodyMayCarryReferences(bodyString)) markTokenFreeState(state);
2541
2576
  this.logger.debug(`Retrieved state: ${shownStackName} (${shownRegionName}), ETag: ${response.ETag}`);
@@ -2551,7 +2586,7 @@ async function getState(stackName, region) {
2551
2586
  }
2552
2587
  this.logger.debug(`No state at new key for stack: ${shownStackName} (${shownRegionName})`);
2553
2588
  }
2554
- const legacy = await this.tryGetLegacy(stackName, region);
2589
+ const legacy = await this.tryGetLegacy(stackName, region, options);
2555
2590
  if (legacy) {
2556
2591
  const shownKey = displayIdent(this.getLegacyStateKey(stackName), { maxCodePoints: STACK_REF_MAX_CODE_POINTS });
2557
2592
  this.logger.warn(`Loaded legacy state for stack ${shownStackName} from ${shownKey}. It will be migrated to the region-scoped layout on next save.`);
@@ -2563,11 +2598,14 @@ async function getState(stackName, region) {
2563
2598
  return null;
2564
2599
  }
2565
2600
  async function saveState(stackName, region, state, options = {}) {
2601
+ const newerVersion = readOnlyStateVersionOf(state);
2602
+ if (newerVersion !== void 0) throw new StateError(`Refusing to save state for stack ${this.displayName(stackName)}: it was read from a record written by a newer cdkd (state schema version ${newerVersion}), which this cdkd binary can read but must not write. Upgrade cdkd to a version that supports schema ${newerVersion}.`);
2566
2603
  await this.ensureClientForBucket();
2567
2604
  const newKey = this.getStateKey(stackName, region);
2568
2605
  const { expectedEtag, migrateLegacy } = options;
2606
+ const { minReaderVersion: _minReaderVersion, ...stateFields } = state;
2569
2607
  const body = {
2570
- ...state,
2608
+ ...stateFields,
2571
2609
  ...stackInstanceIdCarriedFrom(state),
2572
2610
  version: stateSchemaVersionFor(state),
2573
2611
  stackName,
@@ -3762,7 +3800,7 @@ async function readLegacyRegion(stackName) {
3762
3800
  async function legacyBelongsToRegion(stackName, region) {
3763
3801
  return legacyProbeBelongsTo(await this.probeLegacyState(stackName), region);
3764
3802
  }
3765
- async function tryGetLegacy(stackName, region) {
3803
+ async function tryGetLegacy(stackName, region, options = {}) {
3766
3804
  try {
3767
3805
  const response = await this.s3Client.send(new GetObjectCommand({
3768
3806
  Bucket: this.config.bucket,
@@ -3771,7 +3809,7 @@ async function tryGetLegacy(stackName, region) {
3771
3809
  }));
3772
3810
  if (!response.Body || !response.ETag) return null;
3773
3811
  const bodyString = await response.Body.transformToString();
3774
- const state = this.parseStateBody(bodyString, stackName);
3812
+ const state = this.parseStateBody(bodyString, stackName, options);
3775
3813
  if (state.region && state.region !== region) {
3776
3814
  this.logger.debug(`Legacy state for stack ${this.displayName(stackName)} has region ${displayIdent(state.region)}, not ${displayIdent(region)} — skipping legacy fallback.`);
3777
3815
  return null;
@@ -3794,7 +3832,7 @@ async function tryGetLegacy(stackName, region) {
3794
3832
  throw this.wrapS3Failure(error, (text) => new StateError(`Failed to get legacy state for stack ${this.displayName(stackName)}: ${text}`, error instanceof Error ? error : void 0));
3795
3833
  }
3796
3834
  }
3797
- function parseStateBody(bodyString, stackName) {
3835
+ function parseStateBody(bodyString, stackName, options = {}) {
3798
3836
  let root;
3799
3837
  try {
3800
3838
  root = JSON.parse(bodyString);
@@ -3808,7 +3846,12 @@ function parseStateBody(bodyString, stackName) {
3808
3846
  }
3809
3847
  const parsed = root;
3810
3848
  const v = parsed.version;
3811
- if (v !== void 0 && !STATE_SCHEMA_VERSIONS_READABLE.includes(v)) {
3849
+ const access = classifyStateRecordAccess(v, parsed.minReaderVersion);
3850
+ if (access.kind === "read-only") {
3851
+ if (options.readOnly === true) return markReadOnlyState(parsed, access.version);
3852
+ throw new StateError(`State for stack ${this.displayName(stackName)} was written by a newer cdkd (state schema version ${access.version}). This cdkd binary can read it but must not write it: a write would drop the fields it does not know. Upgrade cdkd to a version that supports schema ${access.version}.`);
3853
+ }
3854
+ if (access.kind === "unsupported") {
3812
3855
  const vShown = v;
3813
3856
  const shown = displaySafe(vShown === null ? "null" : vShown, { asciiOnly: true }) || "<unrenderable>";
3814
3857
  throw new StateError(`Unsupported state schema version ${shown} for stack ${this.displayName(stackName)}. This cdkd binary supports versions ${STATE_SCHEMA_VERSIONS_READABLE.join(", ")}. Upgrade cdkd to a version that supports schema ${shown}.`);
@@ -3893,8 +3936,8 @@ var S3StateBackend = class S3StateBackend {
3893
3936
  rawObjectExists(key) {
3894
3937
  return rawObjectExists.call(this, key);
3895
3938
  }
3896
- getState(stackName, region) {
3897
- return getState.call(this, stackName, region);
3939
+ getState(stackName, region, options = {}) {
3940
+ return getState.call(this, stackName, region, options);
3898
3941
  }
3899
3942
  saveState(stackName, region, state, options = {}) {
3900
3943
  return saveState.call(this, stackName, region, state, options);
@@ -4152,11 +4195,11 @@ var S3StateBackend = class S3StateBackend {
4152
4195
  legacyBelongsToRegion(stackName, region) {
4153
4196
  return legacyBelongsToRegion.call(this, stackName, region);
4154
4197
  }
4155
- tryGetLegacy(stackName, region) {
4156
- return tryGetLegacy.call(this, stackName, region);
4198
+ tryGetLegacy(stackName, region, options = {}) {
4199
+ return tryGetLegacy.call(this, stackName, region, options);
4157
4200
  }
4158
- parseStateBody(bodyString, stackName) {
4159
- return parseStateBody.call(this, bodyString, stackName);
4201
+ parseStateBody(bodyString, stackName, options = {}) {
4202
+ return parseStateBody.call(this, bodyString, stackName, options);
4160
4203
  }
4161
4204
  };
4162
4205
 
@@ -13542,7 +13585,7 @@ async function applyRoleArnIfSet(opts) {
13542
13585
  // src/deployment/intrinsic-resolver/stack-state.ts
13543
13586
  async function getSameAccountStackState(stackName, region, context) {
13544
13587
  if (!context.stateBackend) throw markNonRetryable(/* @__PURE__ */ new Error("Fn::GetStackOutput: state backend is required for cross-stack references"));
13545
- return context.stateBackend.getState(stackName, region);
13588
+ return context.stateBackend.getState(stackName, region, { readOnly: true });
13546
13589
  }
13547
13590
  async function getCrossAccountStackState(roleArn, stackName, region, context) {
13548
13591
  const parsed = parseIamRoleArn(roleArn);
@@ -13576,7 +13619,7 @@ async function getCrossAccountStackState(roleArn, stackName, region, context) {
13576
13619
  secretAccessKey: credentials.secretAccessKey,
13577
13620
  sessionToken: credentials.sessionToken
13578
13621
  }
13579
- }).getState(stackName, region);
13622
+ }).getState(stackName, region, { readOnly: true });
13580
13623
  }
13581
13624
 
13582
13625
  // src/deployment/intrinsic-resolver/cross-stack/producer-state.ts
@@ -13600,7 +13643,7 @@ async function readProducerStateOnce(scope, stateBackend, stackName, region, onF
13600
13643
  };
13601
13644
  try {
13602
13645
  return {
13603
- state: (await stateBackend.getState(stackName, region))?.state ?? void 0,
13646
+ state: (await stateBackend.getState(stackName, region, { readOnly: true }))?.state ?? void 0,
13604
13647
  failed: false
13605
13648
  };
13606
13649
  } catch {
@@ -13707,7 +13750,7 @@ async function reresolveCrossStackValue(resolver, value, producerRegion, context
13707
13750
  // src/deployment/intrinsic-resolver/cross-stack/import-value.ts
13708
13751
  async function sameRegionExportEntry(resolver, context, exportName, entry) {
13709
13752
  try {
13710
- const local = await context.stateBackend.getState(entry.producerStack, resolver.resolverRegion);
13753
+ const local = await context.stateBackend.getState(entry.producerStack, resolver.resolverRegion, { readOnly: true });
13711
13754
  if (!local || !importableOutputKeys(local.state).includes(exportName)) return void 0;
13712
13755
  return {
13713
13756
  value: local.state.outputs[exportName],
@@ -13762,7 +13805,7 @@ async function resolveImportValue(resolver, importValueArg, context) {
13762
13805
  resolver.logger.debug(`No region available for stack ${quotedRender(displayMasked(resolver, refStack, context), "'")} — skipping (cdkd cannot read state without a region)`);
13763
13806
  continue;
13764
13807
  }
13765
- const stateData = await context.stateBackend.getState(refStack, lookupRegion);
13808
+ const stateData = await context.stateBackend.getState(refStack, lookupRegion, { readOnly: true });
13766
13809
  if (!stateData) {
13767
13810
  resolver.logger.debug(`No state found for stack: ${displayMasked(resolver, refStack, context)} (${displayMasked(resolver, lookupRegion, context)})`);
13768
13811
  continue;
@@ -19124,7 +19167,7 @@ async function deleteInIdLogScope(logicalId, physicalId, resourceType, propertie
19124
19167
  const indeterminateGuard = await this.confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context);
19125
19168
  if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
19126
19169
  this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
19127
- const { ASGProvider } = await import("./asg-provider-vzD1uanW.js");
19170
+ const { ASGProvider } = await import("./asg-provider-CM19nSRR.js");
19128
19171
  const delegateRegion = ambientRegion();
19129
19172
  let asgProvider = this.asgDeleteDelegates.get(delegateRegion);
19130
19173
  if (asgProvider === void 0) {
@@ -19278,7 +19321,7 @@ async function sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId)
19278
19321
  const family = SDK_DELETE_FAMILIES.get(resourceType);
19279
19322
  const cached = this.sdkDeleteDelegates.get(family);
19280
19323
  if (cached !== void 0 && cached.region === ccRegion) return cached.provider;
19281
- const provider = family === "rds" ? new (await (import("./rds-provider-I6YAiIv3.js"))).RDSProvider({ region: ccRegion }) : new (await (import("./neptune-provider-CHVuPvHJ.js"))).NeptuneProvider({ region: ccRegion });
19324
+ const provider = family === "rds" ? new (await (import("./rds-provider-k-7oWDtG.js"))).RDSProvider({ region: ccRegion }) : new (await (import("./neptune-provider-CN3MA8Cw.js"))).NeptuneProvider({ region: ccRegion });
19282
19325
  this.sdkDeleteDelegates.set(family, {
19283
19326
  region: ccRegion,
19284
19327
  provider
@@ -21964,7 +22007,7 @@ async function publishToSns(topicArn, request) {
21964
22007
  }
21965
22008
  async function invokeLambda(serviceToken, request) {
21966
22009
  if (localCustomResourceRuntimeActive()) {
21967
- const { invokeCustomResourceFunctionLocally } = await import("./custom-resource-runtime-5yuSHn1E.js");
22010
+ const { invokeCustomResourceFunctionLocally } = await import("./custom-resource-runtime-gD0yCVTA.js");
21968
22011
  const local = await invokeCustomResourceFunctionLocally({
21969
22012
  lambda: this.lambdaClient,
21970
22013
  s3: this.s3Client
@@ -22445,21 +22488,6 @@ var CustomResourceProvider = class CustomResourceProvider {
22445
22488
  }
22446
22489
  };
22447
22490
 
22448
- // src/provisioning/sticky-exempt-physical-id.ts
22449
- const ECS_SERVICE_CC_ID = /^(arn:aws[-a-z]*:ecs:[a-z0-9-]+:\d{12}:service\/([A-Za-z0-9_-]+)(?:\/([A-Za-z0-9_-]+))?)\|([^|\s]+)$/;
22450
- const CLUSTER_ARN = /^arn:aws[-a-z]*:ecs:[a-z0-9-]+:\d{12}:cluster\/([A-Za-z0-9_-]+)$/;
22451
- const CLUSTER_NAME = /^[A-Za-z0-9_-]+$/;
22452
- function ecsServiceSdkPhysicalId(ccPhysicalId) {
22453
- const match = ECS_SERVICE_CC_ID.exec(ccPhysicalId);
22454
- if (match === null) throw new Error("its recorded physical id is not the `<serviceArn>|<cluster>` form Cloud Control records for AWS::ECS::Service");
22455
- const [, serviceArn, first, second, clusterSegment] = match;
22456
- const clusterArn = CLUSTER_ARN.exec(clusterSegment);
22457
- if (clusterArn === null && !CLUSTER_NAME.test(clusterSegment)) throw new Error("the cluster segment of its recorded physical id is neither a cluster name nor a cluster ARN");
22458
- const clusterName = clusterArn === null ? clusterSegment : clusterArn[1];
22459
- if (second !== void 0 && first !== clusterName) throw new Error("its recorded physical id names one cluster in the service ARN and another after the `|`");
22460
- return serviceArn;
22461
- }
22462
-
22463
22491
  // src/provisioning/provider-registry/routing.ts
22464
22492
  function getProviderFor(input) {
22465
22493
  const debug = (message) => {
@@ -24450,7 +24478,22 @@ function findAutoRouteHits(resources) {
24450
24478
  return hits;
24451
24479
  }
24452
24480
 
24453
- // src/provisioning/provider-registry.ts
24481
+ // src/provisioning/sticky-exempt-physical-id.ts
24482
+ const ECS_SERVICE_CC_ID = /^(arn:aws[-a-z]*:ecs:[a-z0-9-]+:\d{12}:service\/([A-Za-z0-9_-]+)(?:\/([A-Za-z0-9_-]+))?)\|([^|\s]+)$/;
24483
+ const CLUSTER_ARN = /^arn:aws[-a-z]*:ecs:[a-z0-9-]+:\d{12}:cluster\/([A-Za-z0-9_-]+)$/;
24484
+ const CLUSTER_NAME = /^[A-Za-z0-9_-]+$/;
24485
+ function ecsServiceSdkPhysicalId(ccPhysicalId) {
24486
+ const match = ECS_SERVICE_CC_ID.exec(ccPhysicalId);
24487
+ if (match === null) throw new Error("its recorded physical id is not the `<serviceArn>|<cluster>` form Cloud Control records for AWS::ECS::Service");
24488
+ const [, serviceArn, first, second, clusterSegment] = match;
24489
+ const clusterArn = CLUSTER_ARN.exec(clusterSegment);
24490
+ if (clusterArn === null && !CLUSTER_NAME.test(clusterSegment)) throw new Error("the cluster segment of its recorded physical id is neither a cluster name nor a cluster ARN");
24491
+ const clusterName = clusterArn === null ? clusterSegment : clusterArn[1];
24492
+ if (second !== void 0 && first !== clusterName) throw new Error("its recorded physical id names one cluster in the service ARN and another after the `|`");
24493
+ return serviceArn;
24494
+ }
24495
+
24496
+ // src/provisioning/provider-registry/sticky-exempt.ts
24454
24497
  const STICKY_CC_MIGRATION_EXEMPT = /* @__PURE__ */ new Map([
24455
24498
  ["AWS::Scheduler::Schedule", {
24456
24499
  mode: "cc-broken",
@@ -24536,8 +24579,136 @@ const STICKY_CC_MIGRATION_EXEMPT = /* @__PURE__ */ new Map([
24536
24579
  physicalIdForm: "both layers store the bare REST API id: the schema primaryIdentifier is RestApiId and ApiGatewayProvider.create records the CreateRestApi id (observed equal on a live API by the fixture)",
24537
24580
  issue: "https://github.com/go-to-k/cdkd/issues/6141",
24538
24581
  integFixture: "cc-to-sdk-reroute-rest-api"
24582
+ }],
24583
+ ["AWS::EC2::SecurityGroup", {
24584
+ mode: "sdk-coverage",
24585
+ physicalIdForm: "both layers store the bare `sg-...` group id: the schema primaryIdentifier is Id and EC2Provider.create records the CreateSecurityGroup GroupId",
24586
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24587
+ integFixture: "cc-to-sdk-reroute-common-types"
24588
+ }],
24589
+ ["AWS::EC2::RouteTable", {
24590
+ mode: "sdk-coverage",
24591
+ physicalIdForm: "both layers store the bare `rtb-...` id: the schema primaryIdentifier is RouteTableId and EC2Provider.create records the CreateRouteTable RouteTableId",
24592
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24593
+ integFixture: "cc-to-sdk-reroute-common-types"
24594
+ }],
24595
+ ["AWS::ElasticLoadBalancingV2::TargetGroup", {
24596
+ mode: "sdk-coverage",
24597
+ physicalIdForm: "both layers store the target group ARN: the schema primaryIdentifier is TargetGroupArn and ELBv2Provider.create records the CreateTargetGroup TargetGroupArn",
24598
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24599
+ integFixture: "cc-to-sdk-reroute-common-types"
24600
+ }],
24601
+ ["AWS::KMS::Key", {
24602
+ mode: "sdk-coverage",
24603
+ physicalIdForm: "both layers store the bare key id, not the key ARN (observed as a UUID; a multi-region `mrk-...` id was not exercised): the schema primaryIdentifier is KeyId and the KMS provider records the CreateKey KeyId",
24604
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24605
+ integFixture: "cc-to-sdk-reroute-common-types"
24606
+ }],
24607
+ ["AWS::SecretsManager::Secret", {
24608
+ mode: "sdk-coverage",
24609
+ physicalIdForm: "both layers store the secret ARN, random suffix included: the schema primaryIdentifier is Id (the ARN) and SecretsManagerSecretProvider.create records the CreateSecret ARN",
24610
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24611
+ integFixture: "cc-to-sdk-reroute-common-types"
24612
+ }],
24613
+ ["AWS::Lambda::EventSourceMapping", {
24614
+ mode: "sdk-coverage",
24615
+ physicalIdForm: "both layers store the mapping UUID: the schema primaryIdentifier is Id and LambdaEventSourceMappingProvider.create records the CreateEventSourceMapping UUID",
24616
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24617
+ integFixture: "cc-to-sdk-reroute-common-types"
24618
+ }],
24619
+ ["AWS::IAM::Role", {
24620
+ mode: "sdk-coverage",
24621
+ physicalIdForm: "both layers store the bare role name: the schema primaryIdentifier is RoleName and IAMRoleProvider.create records the name it created the role under",
24622
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24623
+ integFixture: "cc-to-sdk-reroute-common-types"
24624
+ }],
24625
+ ["AWS::IAM::ManagedPolicy", {
24626
+ mode: "sdk-coverage",
24627
+ physicalIdForm: "both layers store the policy ARN: the schema primaryIdentifier is PolicyArn and IAMManagedPolicyProvider.create records the CreatePolicy Arn",
24628
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24629
+ integFixture: "cc-to-sdk-reroute-common-types"
24630
+ }],
24631
+ ["AWS::SQS::Queue", {
24632
+ mode: "sdk-coverage",
24633
+ physicalIdForm: "both layers store the queue URL: the schema primaryIdentifier is QueueUrl and SQSQueueProvider.create records the CreateQueue QueueUrl",
24634
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24635
+ integFixture: "cc-to-sdk-reroute-common-types"
24636
+ }],
24637
+ ["AWS::SSM::Parameter", {
24638
+ mode: "sdk-coverage",
24639
+ physicalIdForm: "both layers store the bare parameter name: the schema primaryIdentifier is Name and SSMParameterProvider.create records the name it put the parameter under",
24640
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24641
+ integFixture: "cc-to-sdk-reroute-common-types"
24642
+ }],
24643
+ ["AWS::EC2::VPC", {
24644
+ mode: "sdk-coverage",
24645
+ physicalIdForm: "both layers store the bare `vpc-...` id: the schema primaryIdentifier is VpcId and EC2Provider.create records the CreateVpc VpcId",
24646
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24647
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24648
+ }],
24649
+ ["AWS::EC2::InternetGateway", {
24650
+ mode: "sdk-coverage",
24651
+ physicalIdForm: "both layers store the bare `igw-...` id: the schema primaryIdentifier is InternetGatewayId and EC2Provider.create records the CreateInternetGateway id",
24652
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24653
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24654
+ }],
24655
+ ["AWS::EC2::NetworkAcl", {
24656
+ mode: "sdk-coverage",
24657
+ physicalIdForm: "both layers store the bare `acl-...` id: the schema primaryIdentifier is Id and EC2Provider.create records the CreateNetworkAcl NetworkAclId",
24658
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24659
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24660
+ }],
24661
+ ["AWS::IAM::User", {
24662
+ mode: "sdk-coverage",
24663
+ physicalIdForm: "both layers store the bare user name: the schema primaryIdentifier is UserName and the IAM user provider records the name it created the user under",
24664
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24665
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24666
+ }],
24667
+ ["AWS::IAM::Group", {
24668
+ mode: "sdk-coverage",
24669
+ physicalIdForm: "both layers store the bare group name: the schema primaryIdentifier is GroupName and the IAM group provider records the name it created the group under",
24670
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24671
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24672
+ }],
24673
+ ["AWS::IAM::InstanceProfile", {
24674
+ mode: "sdk-coverage",
24675
+ physicalIdForm: "both layers store the bare instance profile name: the schema primaryIdentifier is InstanceProfileName and IAMInstanceProfileProvider.create records that name",
24676
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24677
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24678
+ }],
24679
+ ["AWS::StepFunctions::StateMachine", {
24680
+ mode: "sdk-coverage",
24681
+ physicalIdForm: "both layers store the state machine ARN: the schema primaryIdentifier is Arn and StepFunctionsProvider.create records the CreateStateMachine stateMachineArn",
24682
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24683
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24684
+ }],
24685
+ ["AWS::Lambda::Url", {
24686
+ mode: "sdk-coverage",
24687
+ physicalIdForm: "both layers store the function ARN the URL is on, alias-qualified when Qualifier is set: the schema primaryIdentifier is FunctionArn and LambdaUrlProvider.create records the CreateFunctionUrlConfig FunctionArn (the fixture observed both the unqualified and the qualified form)",
24688
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24689
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24690
+ }],
24691
+ ["AWS::Cognito::UserPool", {
24692
+ mode: "sdk-coverage",
24693
+ physicalIdForm: "both layers store the bare `<region>_...` pool id: the schema primaryIdentifier is UserPoolId and CognitoUserPoolProvider.create records the CreateUserPool Id",
24694
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24695
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24696
+ }],
24697
+ ["AWS::CloudFront::OriginAccessControl", {
24698
+ mode: "sdk-coverage",
24699
+ physicalIdForm: "both layers store the bare origin access control id: the schema primaryIdentifier is Id and CloudFrontOACProvider.create records the CreateOriginAccessControl Id",
24700
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24701
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24702
+ }],
24703
+ ["AWS::KMS::Alias", {
24704
+ mode: "sdk-coverage",
24705
+ physicalIdForm: "both layers store the `alias/...` name: the schema primaryIdentifier is AliasName and the KMS alias provider records the name it created the alias under",
24706
+ issue: "https://github.com/go-to-k/cdkd/issues/6454",
24707
+ integFixture: "cc-to-sdk-reroute-common-types-2"
24539
24708
  }]
24540
24709
  ]);
24710
+
24711
+ // src/provisioning/provider-registry.ts
24541
24712
  function sdkAddressedPhysicalId(resourceType, physicalId, logicalId) {
24542
24713
  const entry = STICKY_CC_MIGRATION_EXEMPT.get(resourceType);
24543
24714
  const normalize = entry?.normalizeCcPhysicalId;
@@ -25483,7 +25654,7 @@ async function ccRoutedInstanceTakesNoSnapshot(input) {
25483
25654
  if (resourceType !== "AWS::RDS::DBInstance") return false;
25484
25655
  if (region === void 0 || region === "") return false;
25485
25656
  const mask = input.mask ?? ((text) => text);
25486
- const { describeDBInstanceInRegion, isLiveReadReplica } = await import("./read-replica-BbDOKi8I.js").then((n) => n.l);
25657
+ const { describeDBInstanceInRegion, isLiveReadReplica } = await import("./read-replica-Dx5O9bW4.js").then((n) => n.l);
25487
25658
  let reason;
25488
25659
  try {
25489
25660
  const live = await describeDBInstanceInRegion(physicalId, region);
@@ -27392,6 +27563,9 @@ function isSupersededResourceRecord(row) {
27392
27563
  const { physicalId, resourceType, properties } = record;
27393
27564
  return typeof physicalId === "string" && physicalId !== "" && typeof resourceType === "string" && resourceType !== "" && typeof properties === "object" && properties !== null && !Array.isArray(properties);
27394
27565
  }
27566
+ function isSupersededHeld(entry, resources) {
27567
+ return supersededHolderOf(entry, resources) !== void 0;
27568
+ }
27395
27569
  function supersededHolderOf(entry, resources) {
27396
27570
  const holders = Object.values(resources).filter((record) => typeof record === "object" && record !== null && record.physicalId === entry.state.physicalId);
27397
27571
  return holders.find((record) => record.resourceType === entry.state.resourceType) ?? holders[0];
@@ -27854,9 +28028,9 @@ async function retryDeferredReplacedDeletes(run, deps, stackName, counts) {
27854
28028
  function warnUnretriedReplacedDeletes(run, deps, why) {
27855
28029
  const deferred = run.deferredReplacedDeletes;
27856
28030
  run.deferredReplacedDeletes = void 0;
27857
- const cause = why === "failed" ? "the deploy failed first" : "the deploy was interrupted";
28031
+ const cause = why === "failed" ? "the deploy failed first" : why === "interrupted" ? "the deploy was interrupted" : "its nested stack's cleanup could not run";
27858
28032
  const noteFor = (logicalId) => run.supersededEntries.has(logicalId) ? `not retried: ${cause}; cdkd keeps it in state, and the next deploy retries the delete` : `not retried: ${cause}; it is no longer tracked in state, so delete it manually`;
27859
- for (const [logicalId, entry] of deferred ?? []) withPrintingSecrets(secretNameBagFor(deps.secretsRun(), logicalId), () => entry.cleanupPhase === true ? deps.logger.info(safeMsg` Old ${logicalId} (${entry.physicalId}) was not deleted: ${cause}. A rollback of the deploy adopts it again; otherwise ${run.supersededEntries.has(logicalId) ? "cdkd keeps it in state, and the next deploy deletes it" : "it is no longer tracked in state, so delete it manually"}`) : deps.logger.warn(entry.failureMessage === void 0 ? safeMsg` ⚠ The old physical id of ${logicalId} (${entry.physicalId}) was not sent its Delete: ${cause}. A rollback sends the new id an Update with the old properties, and this id is tracked again if the handler answers it; otherwise ${run.supersededEntries.has(logicalId) ? "cdkd keeps it in state, and the next deploy sends the Delete" : "it is no longer tracked in state, so delete it manually"}` : safeMsg` ⚠ Failed to delete old resource ${logicalId} (${entry.physicalId}): ${entry.failureMessage} (${noteFor(logicalId)})`));
28033
+ for (const [logicalId, entry] of deferred ?? []) withPrintingSecrets(secretNameBagFor(deps.secretsRun(), logicalId), () => why === "cleanup-failed" && entry.failureMessage === void 0 ? deps.logger.warn(safeMsg` ⚠ Old ${logicalId} (${entry.physicalId}) was not deleted: ${cause}. ${run.supersededEntries.has(logicalId) ? "cdkd keeps it in state, and the next deploy deletes it" : "It is no longer tracked in state, so delete it manually"}`) : entry.cleanupPhase === true ? deps.logger.info(safeMsg` Old ${logicalId} (${entry.physicalId}) was not deleted: ${cause}. A rollback of the deploy adopts it again; otherwise ${run.supersededEntries.has(logicalId) ? "cdkd keeps it in state, and the next deploy deletes it" : "it is no longer tracked in state, so delete it manually"}`) : deps.logger.warn(entry.failureMessage === void 0 ? safeMsg` ⚠ The old physical id of ${logicalId} (${entry.physicalId}) was not sent its Delete: ${cause}. A rollback sends the new id an Update with the old properties, and this id is tracked again if the handler answers it; otherwise ${run.supersededEntries.has(logicalId) ? "cdkd keeps it in state, and the next deploy sends the Delete" : "it is no longer tracked in state, so delete it manually"}` : safeMsg` ⚠ Failed to delete old resource ${logicalId} (${entry.physicalId}): ${entry.failureMessage} (${noteFor(logicalId)})`));
27860
28034
  }
27861
28035
 
27862
28036
  // src/deployment/masking-retry-logger.ts
@@ -30035,7 +30209,7 @@ function someStringLeaf(value, test, depth = 0) {
30035
30209
  // src/deployment/rollback-executor/plan.ts
30036
30210
  function planRollback(operations, stateResources, orphanLogicalIds = /* @__PURE__ */ new Set()) {
30037
30211
  const { createOps, otherOps } = partitionOps(operations);
30038
- return [...[...otherOps].reverse(), ...sortRollbackCreates(createOps, stateResources)].map((op) => {
30212
+ return [...orderDeleteFirstAfterDependencies([...otherOps].reverse(), stateResources, orphanLogicalIds), ...sortRollbackCreates(createOps, stateResources)].map((op) => {
30039
30213
  const action = classifyRollbackOp(op, stateResources, orphanLogicalIds);
30040
30214
  return {
30041
30215
  op,
@@ -30070,6 +30244,30 @@ function revertReferences(op, stateResources) {
30070
30244
  }
30071
30245
  return refs;
30072
30246
  }
30247
+ function orderDeleteFirstAfterDependencies(ops, stateResources, orphanLogicalIds = /* @__PURE__ */ new Set()) {
30248
+ const out = [...ops];
30249
+ const renamed = new Set(ops.filter((op) => renamedReverseReplacement(op, stateResources, orphanLogicalIds)).map((op) => op.logicalId));
30250
+ for (let pass = 0; pass < out.length; pass++) {
30251
+ let moved = false;
30252
+ for (const op of [...out].reverse()) {
30253
+ if (op.changeType !== "UPDATE" || op.oldDeletedBeforeCreate !== true) continue;
30254
+ const deps = new Set((Array.isArray(op.previousState?.dependencies) ? op.previousState.dependencies : []).filter((id) => typeof id === "string" && id !== op.logicalId && !renamed.has(id)));
30255
+ if (deps.size === 0) continue;
30256
+ const from = out.indexOf(op);
30257
+ let last = -1;
30258
+ out.forEach((other, at) => {
30259
+ if (other !== op && deps.has(other.logicalId)) last = at;
30260
+ });
30261
+ if (last <= from) continue;
30262
+ if (out.slice(from + 1, last + 1).some((other) => isStandaloneInlinePolicyType(other.resourceType) || revertReferences(other, stateResources).has(op.logicalId))) continue;
30263
+ out.splice(from, 1);
30264
+ out.splice(last, 0, op);
30265
+ moved = true;
30266
+ }
30267
+ if (!moved) break;
30268
+ }
30269
+ return out;
30270
+ }
30073
30271
  function partitionOps(operations) {
30074
30272
  const createOps = [];
30075
30273
  const otherOps = [];
@@ -32095,7 +32293,7 @@ async function replayRollbackUnbound(operations, stateResources, stackName, ctx,
32095
32293
  markDeleteFirstBlocked(operations, options.failedOperations);
32096
32294
  const { createOps, otherOps } = partitionOps(operations);
32097
32295
  const createdInSegment = new Set(createOps.map((o) => o.logicalId));
32098
- const stepOne = orderInlinePolicyReversals([...otherOps].reverse(), stateResources);
32296
+ const stepOne = orderDeleteFirstAfterDependencies(orderInlinePolicyReversals([...otherOps].reverse(), stateResources), stateResources, orphanLogicalIds);
32099
32297
  const stepOneIds = /* @__PURE__ */ new Map();
32100
32298
  const stepOneIndex = /* @__PURE__ */ new Map();
32101
32299
  stepOne.forEach((op, at) => {
@@ -34767,7 +34965,7 @@ function makeSiblingClaimReader(params) {
34767
34965
  if (ref.stackName === selfStackName && ref.region === selfRegion) continue;
34768
34966
  if (ref.region === void 0) continue;
34769
34967
  try {
34770
- const sibling = await stateBackend.getState(ref.stackName, ref.region);
34968
+ const sibling = await stateBackend.getState(ref.stackName, ref.region, { readOnly: true });
34771
34969
  if (!sibling) continue;
34772
34970
  const bag = sibling.state.resources;
34773
34971
  if (typeof bag !== "object" || bag === null) {
@@ -34986,7 +35184,7 @@ function makeForeignHolderScan(stateBackend) {
34986
35184
  const region = ref.region;
34987
35185
  let state;
34988
35186
  try {
34989
- state = (await stateBackend.getState(ref.stackName, region))?.state;
35187
+ state = (await stateBackend.getState(ref.stackName, region, { readOnly: true }))?.state;
34990
35188
  } catch {
34991
35189
  unreadable ??= named("it could not be read");
34992
35190
  return;
@@ -38262,6 +38460,47 @@ Drop the record with: ${dropCommand}`);
38262
38460
  deps.logger.info(safeMsg`${deletePrefix}${formatResourceLine("deleted", logicalId, resourceType)}`);
38263
38461
  }
38264
38462
 
38463
+ // src/deployment/nested-cleanup-scope.ts
38464
+ var NestedCleanupQueue = class {
38465
+ entries = [];
38466
+ open = true;
38467
+ enqueue(entry) {
38468
+ if (!this.open) return false;
38469
+ this.entries.push(entry);
38470
+ return true;
38471
+ }
38472
+ async runAll(context, logger) {
38473
+ this.open = false;
38474
+ let updatePartial = 0;
38475
+ for (let entry = this.entries.shift(); entry !== void 0; entry = this.entries.shift()) {
38476
+ if (context.interrupted()) {
38477
+ entry.abandon("interrupted");
38478
+ for (const rest of this.entries.splice(0)) rest.abandon("interrupted");
38479
+ break;
38480
+ }
38481
+ logger.info(safeMsg`Deleting the replaced resources of nested stack ${displayStackName(entry.stackName)}`);
38482
+ try {
38483
+ updatePartial += (await entry.run(context)).updatePartial;
38484
+ } catch (error) {
38485
+ logger.warn(safeMsg` ⚠ The cleanup of nested stack ${displayStackName(entry.stackName)} failed: ${asIsMessage(describeAwsFailure(error).summary)}. Its old resources were not deleted`);
38486
+ updatePartial += entry.fail().updatePartial;
38487
+ }
38488
+ }
38489
+ return { updatePartial };
38490
+ }
38491
+ abandon(why) {
38492
+ this.open = false;
38493
+ for (const entry of this.entries.splice(0)) entry.abandon(why);
38494
+ }
38495
+ };
38496
+ const nestedCleanupStore = new AsyncLocalStorage();
38497
+ function withNestedCleanupQueue(queue, fn) {
38498
+ return nestedCleanupStore.run(queue, fn);
38499
+ }
38500
+ function getNestedCleanupQueue() {
38501
+ return nestedCleanupStore.getStore();
38502
+ }
38503
+
38265
38504
  // src/deployment/deploy-engine/superseded-retry.ts
38266
38505
  async function retryCarriedSupersededResources(engine, host, carried, resources, options = {}) {
38267
38506
  let changed = false;
@@ -38324,6 +38563,141 @@ async function retryCarriedSupersededResources(engine, host, carried, resources,
38324
38563
  return changed;
38325
38564
  }
38326
38565
 
38566
+ // src/deployment/deploy-engine/nested-cleanup.ts
38567
+ async function runCleanupPhase(engine, { stackName, counts, completedOperations, host, carried, resources, releasedSomething }) {
38568
+ try {
38569
+ await retryDeferredReplacedDeletes(engine.replacementRun, engine.replacementDeps(), stackName, counts);
38570
+ } finally {
38571
+ for (const op of completedOperations) {
38572
+ if (op.changeType !== "UPDATE") continue;
38573
+ const verdict = engine.replacementRun.replacedOldMaySurvive.get(op.logicalId);
38574
+ if (verdict !== void 0) op.oldResourceMaySurvive = verdict;
38575
+ else delete op.oldResourceMaySurvive;
38576
+ }
38577
+ }
38578
+ await retryCarriedSupersededResources(engine, host, carried, resources, { waitInUse: releasedSomething });
38579
+ }
38580
+ function queueNestedCleanup(engine, stackName, host, pass) {
38581
+ if (engine.options.parentStackInfo === void 0) return false;
38582
+ if ((engine.replacementRun.deferredReplacedDeletes?.size ?? 0) === 0 && supersededResourcesOf(host).length === 0) return false;
38583
+ const queue = getNestedCleanupQueue();
38584
+ if (queue === void 0) return false;
38585
+ return queue.enqueue({
38586
+ stackName,
38587
+ run: (context) => runQueuedNestedCleanup(engine, stackName, host, pass, context),
38588
+ abandon: (why) => warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), why),
38589
+ fail: () => passCouldNotRun(engine)
38590
+ });
38591
+ }
38592
+ function passCouldNotRun(engine) {
38593
+ const left = engine.replacementRun.deferredReplacedDeletes?.size ?? 0;
38594
+ warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), "cleanup-failed");
38595
+ return { updatePartial: left };
38596
+ }
38597
+ async function runQueuedNestedCleanup(engine, stackName, host, pass, context) {
38598
+ const region = engine.stackRegion;
38599
+ const display = displayStackName(stackName);
38600
+ const onSigint = () => {
38601
+ engine.interrupted = true;
38602
+ engine.interruptCause ??= "user";
38603
+ engine.userInterrupted = true;
38604
+ };
38605
+ if (context.interrupted()) onSigint();
38606
+ process.on("SIGINT", onSigint);
38607
+ try {
38608
+ try {
38609
+ await engine.lockManager.acquireLockWithRetry(stackName, region, void 0, "deploy");
38610
+ } catch (error) {
38611
+ engine.logger.warn(safeMsg` ⚠ Could not lock nested stack ${display} to delete its replaced resources: ${asIsMessage(describeAwsFailure(error).summary)}`);
38612
+ return passCouldNotRun(engine);
38613
+ }
38614
+ try {
38615
+ let fresh;
38616
+ try {
38617
+ fresh = await engine.stateBackend.getState(stackName, region);
38618
+ } catch (error) {
38619
+ engine.logger.warn(safeMsg` ⚠ Could not read the state of nested stack ${display} to delete its replaced resources: ${asIsMessage(describeAwsFailure(error).summary)}`);
38620
+ return passCouldNotRun(engine);
38621
+ }
38622
+ if (fresh === null || fresh === void 0) {
38623
+ engine.logger.warn(safeMsg` ⚠ Nested stack ${display} has no state record any more: its replaced resources were not deleted`);
38624
+ return passCouldNotRun(engine);
38625
+ }
38626
+ const read = fresh;
38627
+ const persisted = supersededResourcesOf(fresh.state);
38628
+ const stillOwed = (entry) => persisted.some((row) => sameSuperseded(row, entry)) && !isSupersededHeld(entry, read.state.resources);
38629
+ const run = engine.replacementRun;
38630
+ for (const [logicalId] of run.deferredReplacedDeletes ?? []) {
38631
+ const recorded = run.supersededEntries.get(logicalId);
38632
+ if (recorded !== void 0 && !stillOwed(recorded)) {
38633
+ run.deferredReplacedDeletes?.delete(logicalId);
38634
+ engine.logger.debug(safeMsg`Old ${logicalId} of nested stack ${display} is no longer awaiting its delete; not deleting it`);
38635
+ }
38636
+ }
38637
+ const before = supersededResourcesOf(host);
38638
+ const counts = {
38639
+ updated: 0,
38640
+ updatePartial: 0
38641
+ };
38642
+ await pass(stillOwed, counts);
38643
+ const remaining = new Set(Array.isArray(host.supersededResources) ? host.supersededResources : []);
38644
+ const dropped = before.filter((entry) => !remaining.has(entry));
38645
+ const unrecorded = dropped.length > 0 ? await persistDropped(engine, stackName, read, dropped) : 0;
38646
+ return { updatePartial: counts.updatePartial + unrecorded };
38647
+ } finally {
38648
+ try {
38649
+ await engine.lockManager.releaseLock(stackName, region);
38650
+ } catch (error) {
38651
+ engine.logger.warn(safeMsg`Failed to release the lock of nested stack ${display}: ${asIsMessage(describeAwsFailure(error).detail)}`);
38652
+ }
38653
+ }
38654
+ } finally {
38655
+ process.removeListener("SIGINT", onSigint);
38656
+ }
38657
+ }
38658
+ function sameSuperseded(row, entry) {
38659
+ return row.logicalId === entry.logicalId && row.state.physicalId === entry.state.physicalId && row.state.resourceType === entry.state.resourceType;
38660
+ }
38661
+ const PERSIST_DROPPED_ATTEMPTS = 4;
38662
+ async function persistDropped(engine, stackName, fresh, dropped) {
38663
+ const region = engine.stackRegion;
38664
+ let current = fresh;
38665
+ for (let attempt = 1;; attempt++) {
38666
+ const rows = current.state.supersededResources;
38667
+ if (!Array.isArray(rows)) return 0;
38668
+ const kept = rows.filter((row) => !isSupersededResourceRecord(row) || !dropped.some((entry) => sameSuperseded(row, entry)));
38669
+ if (kept.length === rows.length) return 0;
38670
+ const { supersededResources: _rows, ...rest } = current.state;
38671
+ const next = {
38672
+ ...rest,
38673
+ ...stackInstanceIdCarriedFrom(rest),
38674
+ ...kept.length > 0 && { supersededResources: kept },
38675
+ lastModified: Date.now()
38676
+ };
38677
+ let failure;
38678
+ try {
38679
+ await engine.stateBackend.saveState(stackName, region, engine.withParentInfo(next), { expectedEtag: current.etag });
38680
+ return 0;
38681
+ } catch (error) {
38682
+ failure = error;
38683
+ }
38684
+ const again = attempt < 4 && isEtagConflict(failure) ? await engine.stateBackend.getState(stackName, region).catch(() => null) : null;
38685
+ if (again === null || again === void 0) {
38686
+ const ids = dropped.map((entry) => `${entry.logicalId} (${entry.state.physicalId})`).join(", ");
38687
+ engine.logger.warn(safeMsg` ⚠ Could not record in the state of nested stack ${displayStackName(stackName)} (region ${region}) that these replaced resources were deleted: ${ids}: ${asIsMessage(describeAwsFailure(failure).summary)}. They stay listed there, and its next deploy sends their deletes again`);
38688
+ return dropped.length;
38689
+ }
38690
+ current = again;
38691
+ }
38692
+ }
38693
+ function isEtagConflict(error) {
38694
+ for (let link = error, depth = 0; link !== void 0 && link !== null && depth < 5; depth++) {
38695
+ if (isConditionFailure(link)) return true;
38696
+ link = link.cause;
38697
+ }
38698
+ return false;
38699
+ }
38700
+
38327
38701
  // src/provisioning/changed-properties-consumers.ts
38328
38702
  const CHANGED_PROPERTIES_CONSUMER_TYPES = /* @__PURE__ */ new Set(["AWS::ServiceDiscovery::Service"]);
38329
38703
 
@@ -46564,6 +46938,31 @@ function unsettledMarkSinks(engine, logicalId, resolvedProps, currentResource) {
46564
46938
  };
46565
46939
  }
46566
46940
 
46941
+ // src/deployment/deploy-engine/update-policy.ts
46942
+ const HONORED_UPDATE_POLICIES = { "AWS::AutoScaling::AutoScalingGroup": [{
46943
+ key: "AutoScalingScheduledAction",
46944
+ asksForIt: ignoresUnmodifiedGroupSize
46945
+ }] };
46946
+ function honoredKeysPresent(resourceType, updatePolicy) {
46947
+ return (HONORED_UPDATE_POLICIES[resourceType] ?? []).filter((entry) => entry.asksForIt(updatePolicy)).map((entry) => entry.key);
46948
+ }
46949
+ function updatePolicyContext(updatePolicyOption, logger, logicalId, resourceType, resource, provisionedBy) {
46950
+ const updatePolicy = resource?.UpdatePolicy;
46951
+ if (typeof updatePolicy !== "object" || updatePolicy === null) return {};
46952
+ if (updatePolicyOption === false) return {};
46953
+ const keys = honoredKeysPresent(resourceType, updatePolicy);
46954
+ if (updatePolicyOption === true) {
46955
+ if (provisionedBy !== "sdk" && keys.length > 0) logger.warn(safeMsg`${logicalId}: UpdatePolicy ${keys.join(", ")} is not applied by cdkd on the Cloud Control route this update takes.`);
46956
+ return { updatePolicy };
46957
+ }
46958
+ if (provisionedBy === "sdk" && keys.length > 0) logger.info(safeMsg`${logicalId}: UpdatePolicy ${keys.join(", ")} is skipped by default; pass --update-policy to honor it.`);
46959
+ return {};
46960
+ }
46961
+ function warnUnhonoredCreationPolicy(logger, logicalId, resource) {
46962
+ if (resource?.CreationPolicy === void 0) return;
46963
+ logger.warn(safeMsg`${logicalId}: CreationPolicy is not honored; cdkd does not wait for cfn-signal success signals.`);
46964
+ }
46965
+
46567
46966
  // src/deployment/deploy-engine/replacement/cleanup-old-id.ts
46568
46967
  async function deleteOldIdAfterDeploy(run, deps, input) {
46569
46968
  const { logicalId, oldResource } = input;
@@ -46893,6 +47292,7 @@ async function updateInPlace(engine, { changedProperties, noEchoOnlyChangedPrope
46893
47292
  let replacedAtGeneration;
46894
47293
  const inlinePolicyClaimed = engine.inlinePolicyClaimedFor(resourceType, logicalId, stateResources);
46895
47294
  const typedPayloadLeaves = customResourcePayloadLeaves(resourceType, template?.Resources?.[logicalId]?.Properties, resolvedProps, template, conditions, stateResources);
47295
+ const updatePolicy = updatePolicyContext(engine.options.updatePolicy, engine.logger, logicalId, resourceType, template?.Resources?.[logicalId], updateDecision.provisionedBy);
46896
47296
  try {
46897
47297
  result = await engine.withRetry(() => withCurrentResourceSecrets(updateSecrets, () => updateProvider.update(logicalId, currentResource.physicalId, resourceType, removal.properties, previousSettled, {
46898
47298
  maskSecrets: createSecretMasker(updateSecrets),
@@ -46909,7 +47309,8 @@ async function updateInPlace(engine, { changedProperties, noEchoOnlyChangedPrope
46909
47309
  ...noEchoUpdateContext(engine, logicalId, noEchoOnlyForProvider, changedForProvider),
46910
47310
  ...unsettledMarkSinks(engine, logicalId, resolvedProps, currentResource),
46911
47311
  ...unsettled.size > 0 && { unsettledProperties: unsettled },
46912
- ...unsettledItems.size > 0 && { unsettledItems }
47312
+ ...unsettledItems.size > 0 && { unsettledItems },
47313
+ ...updatePolicy
46913
47314
  })), logicalId, void 0, void 0, updateProvider);
46914
47315
  if (result.sentNothing === true) engine.replacementRun.updatesThatSentNothing.add(logicalId);
46915
47316
  engine.unsettledMarks.delete(logicalId);
@@ -46947,6 +47348,7 @@ async function updateInPlace(engine, { changedProperties, noEchoOnlyChangedPrope
46947
47348
  logicalId,
46948
47349
  generation: fallbackGeneration
46949
47350
  }, replaceFallback));
47351
+ warnUnhonoredCreationPolicy(engine.logger, logicalId, template?.Resources?.[logicalId]);
46950
47352
  engine.unsettledMarks.delete(logicalId);
46951
47353
  engine.unsettledItemMarks.delete(logicalId);
46952
47354
  result = fallbackOutcome.result;
@@ -47242,10 +47644,12 @@ async function finishUpdate(engine, input) {
47242
47644
  lostWithParent,
47243
47645
  nameGenerationFields
47244
47646
  });
47245
- return markRestored(await (nextGeneration === void 0 ? replace() : withNameGeneration({
47647
+ const replaced = await (nextGeneration === void 0 ? replace() : withNameGeneration({
47246
47648
  logicalId,
47247
47649
  generation: nextGeneration
47248
- }, replace)));
47650
+ }, replace));
47651
+ warnUnhonoredCreationPolicy(engine.logger, logicalId, template?.Resources?.[logicalId]);
47652
+ return markRestored(replaced);
47249
47653
  }
47250
47654
  const serviceTokenRefusal = serviceTokenUpdateRefusal({
47251
47655
  logicalId,
@@ -47799,7 +48203,10 @@ async function provisionResourceBody(engine, logicalId, change, stateResources,
47799
48203
  if (change.changeType === "CREATE" || change.changeType === "UPDATE") await awaitNoEchoMacsFor(engine, logicalId, stateResources, template, conditions);
47800
48204
  return withStackRecords(engine.stackRecordsView, () => {
47801
48205
  switch (change.changeType) {
47802
- case "CREATE": return withPriorAttempts(priorAttempts, () => provisionCreate(engine, logicalId, change, stateResources, stackName, template, parameterValues, conditions, counts, progress));
48206
+ case "CREATE": return withPriorAttempts(priorAttempts, () => provisionCreate(engine, logicalId, change, stateResources, stackName, template, parameterValues, conditions, counts, progress)).then((outcome) => {
48207
+ warnUnhonoredCreationPolicy(engine.logger, logicalId, template?.Resources?.[logicalId]);
48208
+ return outcome;
48209
+ });
47803
48210
  case "UPDATE": return withPriorAttempts(priorAttempts, () => provisionUpdate(engine, logicalId, change, stateResources, stackName, template, parameterValues, conditions, counts, progress));
47804
48211
  case "DELETE": return provisionDelete(engine.deleteDeps(), logicalId, change, stateResources, stackName, template, counts, progress);
47805
48212
  }
@@ -48221,8 +48628,14 @@ async function rollbackFailedDeploy(run, error, initialDeploy, currentEtag) {
48221
48628
  }
48222
48629
 
48223
48630
  // src/deployment/deploy-engine/execute.ts
48224
- async function executeDeployment(engine, template, currentState, changes, dag, executionLevels, stackName, outputsDigestSource, parameterValues, conditions, currentEtag, progress, migrationPending = false) {
48631
+ function executeDeployment(...args) {
48632
+ const [engine] = args;
48633
+ if (engine.options.parentStackInfo !== void 0) return executeDeploymentBody(...args);
48634
+ return withNestedCleanupQueue(new NestedCleanupQueue(), () => executeDeploymentBody(...args));
48635
+ }
48636
+ async function executeDeploymentBody(engine, template, currentState, changes, dag, executionLevels, stackName, outputsDigestSource, parameterValues, conditions, currentEtag, progress, migrationPending = false) {
48225
48637
  const concurrency = engine.options.concurrency;
48638
+ const nestedCleanups = engine.options.parentStackInfo === void 0 ? getNestedCleanupQueue() : void 0;
48226
48639
  engine.deployChanges = changes;
48227
48640
  const newResources = { ...currentState.resources };
48228
48641
  engine.deployStateResources = newResources;
@@ -48402,24 +48815,10 @@ async function executeDeployment(engine, template, currentState, changes, dag, e
48402
48815
  }
48403
48816
  if (engine.interrupted && hasPending(deleteExecutor)) throw new InterruptedError(engine.interruptCause ?? "user");
48404
48817
  }
48405
- if (engine.interrupted) warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), "interrupted");
48406
- else {
48407
- try {
48408
- await retryDeferredReplacedDeletes(engine.replacementRun, engine.replacementDeps(), stackName, actualCounts);
48409
- } finally {
48410
- for (const op of completedOperations) {
48411
- if (op.changeType !== "UPDATE") continue;
48412
- const verdict = engine.replacementRun.replacedOldMaySurvive.get(op.logicalId);
48413
- if (verdict !== void 0) op.oldResourceMaySurvive = verdict;
48414
- else delete op.oldResourceMaySurvive;
48415
- }
48416
- }
48417
- const releasedSomething = deleteChanges.size > 0 || completedOperations.some((op) => op.changeType === "UPDATE" && op.previousState !== void 0 && op.physicalId !== void 0 && op.physicalId !== op.previousState.physicalId);
48418
- await retryCarriedSupersededResources(engine, currentState, carriedSuperseded, newResources, { waitInUse: releasedSomething });
48419
- }
48420
48818
  } catch (error) {
48421
48819
  recordUnsettledMarks(engine, newResources);
48422
48820
  warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), engine.interruptCause === "user" ? "interrupted" : "failed");
48821
+ nestedCleanups?.abandon(engine.interruptCause === "user" ? "interrupted" : "failed");
48423
48822
  const initialDeploy = currentEtag === void 0;
48424
48823
  await settleFailedDeployRecords(run);
48425
48824
  pruneStoppedSiblingMembersBestEffort(engine.logger, currentState.resources, newResources, engine.replacementRun, template);
@@ -48458,33 +48857,69 @@ async function executeDeployment(engine, template, currentState, changes, dag, e
48458
48857
  outputs = redactOutputs(engine.maskingDeps(), outputs);
48459
48858
  rememberRecoverableMaskedOutputs(engine.maskingDeps(), stackName, resolvedOutputsBeforeRedaction, outputs);
48460
48859
  } catch (outputError) {
48860
+ warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), "failed");
48861
+ nestedCleanups?.abandon("failed");
48461
48862
  pruneStoppedSiblingMembersBestEffort(engine.logger, currentState.resources, newResources, engine.replacementRun, template);
48462
48863
  await persistStateAfterOutputFailure(engine, stackName, currentState, newResources, currentEtag, pendingMigration);
48463
48864
  await writeRollbackJournalSegment(engine.rollbackDeps(), stackName, completedOperations, failedOperations, "no-rollback-failure", currentEtag === void 0);
48464
48865
  throw outputError;
48465
48866
  }
48867
+ const successState = () => ({
48868
+ version: 17,
48869
+ region: engine.stackRegion,
48870
+ stackName: currentState.stackName,
48871
+ resources: newResources,
48872
+ ...orphansCarriedFrom(currentState),
48873
+ ...stackInstanceIdCarriedFrom(currentState),
48874
+ outputs,
48875
+ exportNames: [...engine.outputsRun.resolvedExportNames],
48876
+ ...engine.outputsRun.skippedOutputs && { skippedOutputs: { ...engine.outputsRun.skippedOutputs } },
48877
+ ...engine.recordedImports.length > 0 && { imports: [...engine.recordedImports] },
48878
+ ...engine.recordedOutputReads.length > 0 && { outputReads: [...engine.recordedOutputReads] },
48879
+ lastModified: Date.now()
48880
+ });
48881
+ if (engine.interrupted) {
48882
+ warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), "interrupted");
48883
+ nestedCleanups?.abandon("interrupted");
48884
+ } else {
48885
+ const releasedSomething = deleteChanges.size > 0 || completedOperations.some((op) => op.changeType === "UPDATE" && op.previousState !== void 0 && op.physicalId !== void 0 && op.physicalId !== op.previousState.physicalId);
48886
+ const cleanup = (carried, counts) => runCleanupPhase(engine, {
48887
+ stackName,
48888
+ counts,
48889
+ completedOperations,
48890
+ host: currentState,
48891
+ carried,
48892
+ resources: newResources,
48893
+ releasedSomething
48894
+ });
48895
+ if (nestedCleanups !== void 0) {
48896
+ const { updatePartial } = await nestedCleanups.runAll({ interrupted: () => engine.interrupted }, engine.logger);
48897
+ actualCounts.updatePartial += updatePartial;
48898
+ actualCounts.nestedUpdatePartial += updatePartial;
48899
+ }
48900
+ if (queueNestedCleanup(engine, stackName, currentState, (stillOwed, counts) => cleanup(carriedSuperseded.filter(stillOwed), counts))) engine.logger.debug(safeMsg`Cleanup of ${stackName} waits for the root stack's deploy to succeed`);
48901
+ else try {
48902
+ await cleanup(carriedSuperseded, actualCounts);
48903
+ } catch (cleanupError) {
48904
+ warnUnretriedReplacedDeletes(engine.replacementRun, engine.replacementDeps(), "failed");
48905
+ await persistStateAfterOutputFailure(engine, stackName, currentState, newResources, currentEtag, pendingMigration, {
48906
+ state: successState,
48907
+ after: "the cleanup phase failed"
48908
+ });
48909
+ await writeRollbackJournalSegment(engine.rollbackDeps(), stackName, completedOperations, failedOperations, "no-rollback-failure", currentEtag === void 0);
48910
+ throw cleanupError;
48911
+ }
48912
+ }
48466
48913
  Object.assign(newResources, withTemplateDependencies(newResources, template, { removalsOnly: engine.options.parentStackInfo !== void 0 }));
48467
48914
  return {
48468
- state: {
48469
- version: 17,
48470
- region: engine.stackRegion,
48471
- stackName: currentState.stackName,
48472
- resources: newResources,
48473
- ...orphansCarriedFrom(currentState),
48474
- ...stackInstanceIdCarriedFrom(currentState),
48475
- outputs,
48476
- exportNames: [...engine.outputsRun.resolvedExportNames],
48477
- ...engine.outputsRun.skippedOutputs && { skippedOutputs: { ...engine.outputsRun.skippedOutputs } },
48478
- ...engine.recordedImports.length > 0 && { imports: [...engine.recordedImports] },
48479
- ...engine.recordedOutputReads.length > 0 && { outputReads: [...engine.recordedOutputReads] },
48480
- lastModified: Date.now()
48481
- },
48915
+ state: successState(),
48482
48916
  actualCounts,
48483
48917
  completedOperations
48484
48918
  };
48485
48919
  }
48486
- async function persistStateAfterOutputFailure(engine, stackName, currentState, newResources, currentEtag, pendingMigration) {
48487
- const buildState = () => ({
48920
+ async function persistStateAfterOutputFailure(engine, stackName, currentState, newResources, currentEtag, pendingMigration, override) {
48921
+ const after = override?.after ?? "output resolution failure";
48922
+ const buildState = override?.state ?? (() => ({
48488
48923
  version: 17,
48489
48924
  region: engine.stackRegion,
48490
48925
  stackName: currentState.stackName,
@@ -48496,22 +48931,22 @@ async function persistStateAfterOutputFailure(engine, stackName, currentState, n
48496
48931
  ...stackInstanceIdCarriedFrom(currentState),
48497
48932
  ...crossStackReadsForPartialSave(currentState, engine.recordedImports, engine.recordedOutputReads, engine.crossStackReadKeyNormalizer()),
48498
48933
  lastModified: Date.now()
48499
- });
48934
+ }));
48500
48935
  try {
48501
48936
  const expectedEtag = pendingMigration ? void 0 : currentEtag;
48502
48937
  await engine.stateBackend.saveState(stackName, engine.stackRegion, engine.withParentInfo(buildState()), {
48503
48938
  ...expectedEtag !== void 0 && { expectedEtag },
48504
48939
  migrateLegacy: pendingMigration
48505
48940
  });
48506
- engine.logger.debug("State saved after output resolution failure");
48941
+ engine.logger.debug(safeMsg`State saved after ${after}`);
48507
48942
  } catch (saveError) {
48508
- engine.logger.debug(safeMsg`Retrying state save after output resolution failure (ETag mismatch): ${asIsMessage(describeAwsFailure(saveError).detail)}`);
48943
+ engine.logger.debug(safeMsg`Retrying state save after ${after} (ETag mismatch): ${asIsMessage(describeAwsFailure(saveError).detail)}`);
48509
48944
  try {
48510
48945
  const freshEtag = (await engine.stateBackend.getState(stackName, engine.stackRegion))?.etag;
48511
48946
  await engine.stateBackend.saveState(stackName, engine.stackRegion, engine.withParentInfo(buildState()), { ...freshEtag !== void 0 && { expectedEtag: freshEtag } });
48512
- engine.logger.debug("State saved after output resolution failure (retry succeeded)");
48947
+ engine.logger.debug(safeMsg`State saved after ${after} (retry succeeded)`);
48513
48948
  } catch (retryError) {
48514
- engine.logger.warn(safeMsg`Failed to save state after output resolution failure: ${asIsMessage(describeAwsFailure(retryError).detail)} — resources were provisioned but not recorded; run deploy again to reconcile.`);
48949
+ engine.logger.warn(safeMsg`Failed to save state after ${after}: ${asIsMessage(describeAwsFailure(retryError).detail)} — resources were provisioned but not recorded; run deploy again to reconcile.`);
48515
48950
  }
48516
48951
  }
48517
48952
  }
@@ -49412,7 +49847,7 @@ async function scanActiveConsumers(producerStack, producerRegion, ctx, onUnreada
49412
49847
  const region = ref.region ?? ctx.baseRegion;
49413
49848
  if (ref.stackName === producerStack && region === producerRegion) return null;
49414
49849
  try {
49415
- const imports = (await ctx.stateBackend.getState(ref.stackName, region))?.state.imports;
49850
+ const imports = (await ctx.stateBackend.getState(ref.stackName, region, { readOnly: true }))?.state.imports;
49416
49851
  if (!imports || imports.length === 0) return null;
49417
49852
  const matches = imports.filter((entry) => entry.sourceStack === producerStack && canonicalizeRegion(entry.sourceRegion) === canonicalizeRegion(producerRegion));
49418
49853
  if (matches.length === 0) return null;
@@ -49588,7 +50023,9 @@ function keptWholeReasonText(reason) {
49588
50023
  async function deployWithoutChanges(engine, { stackName, template, currentState, currentEtag, effectiveTemplate, outputsDigestSource, parameterValues, conditions, conditionVerdicts, migrationPending, maskedFingerprintsBackfilled, orphansChanged, terminationProtectionChanged, ssmNamesHealed, nestedSsmNamesMarked, resolveStackInstanceId, startProvenanceCapture, startTime, clock }) {
49589
50024
  engine.logger.info("No changes detected. Stack is up to date.");
49590
50025
  startProvenanceCapture();
49591
- const supersededChanged = engine.options.dryRun ? false : await retryCarriedSupersededResources(engine, currentState, supersededResourcesOf(currentState), currentState.resources);
50026
+ const supersededChanged = engine.options.dryRun || queueNestedCleanup(engine, stackName, currentState, async (stillOwed) => {
50027
+ await retryCarriedSupersededResources(engine, currentState, supersededResourcesOf(currentState).filter(stillOwed), currentState.resources);
50028
+ }) ? false : await retryCarriedSupersededResources(engine, currentState, supersededResourcesOf(currentState), currentState.resources);
49592
50029
  let persistedOutputs = currentState.outputs ?? {};
49593
50030
  if (!engine.options.dryRun) {
49594
50031
  const resolvedOutputs = redactOutputs(engine.maskingDeps(), await withSharedDrainBudget(() => resolveOutputs(engine.outputsRun, engine.outputsDeps(), effectiveTemplate, currentState.resources, stackName, outputsDigestSource, parameterValues, conditions)));
@@ -50408,5 +50845,5 @@ var DeployEngine = class {
50408
50845
  }
50409
50846
  };
50410
50847
 
50411
- export { planVectorIndexUpdates as $, stackIdTailOf as $a, S3StateBackend as $c, ATOMIC_FINAL_SNAPSHOT_TYPES as $i, purgeNoncurrentKeyVersions as $l, sgProtocolKey as $n, keepsSecretReferenceToken as $o, displayTextOrWithheld as $r, unreadableResourceEntries as $s, displacedOpClause as $t, recordedProtectionEvidence as A, customResourceStackName as Aa, refuseMalformedResourcesForDestroy as Ac, cyan as Ai, getBootstrapMarkerKey as Al, constructPathOf as An, isUnboundTemplateParameter as Ao, withPreviousPolicies as Ar, malformedOrphanRecordsRefusalMessage as As, hasCdkAutoDeleteTag as At, declaredStreamTagsMember as B, resolvedResourceTimeoutMs as Ba, hasReadableOutputs as Bc, createReadOnlyAttributeHealerFactory as Bi, resolveFileAssetSourcePath as Bl, changedReferenceReason as Bn, promoteInPlaceAttributeDependents as Bo, nameGenerationHighWaterOf as Br, isReadableResourceEntry as Bs, updateRefactorMarker as Bt, pendingMovesOutOf as C, responsePresignClient as Ca, repairMalformedOutputsForReadOnly as Cc, isSupersededResourceRecord as Ci, redirectFileAsset as Cl, crossStackReadsForPartialSave as Cn, regionLessSecretName as Co, planFailedOps as Cr, parameterInputsFor as Cs, TABLE_INDEX_NOUN as Ct, findServiceTokenRefusals as D, getCurrentResourceSecrets as Da, malformedResourcesWarning as Dc, supersededResourcesOf as Di, buildDenyExternalAccessPolicy as Dl, noEchoMacParametersOf as Dn, s3BucketRegionalDomainName as Do, IMPLICIT_DELETE_DEPENDENCIES as Dr, maskedPropertyFingerprint as Ds, waitForIndexesSettled as Dt, deferredServiceTokenWarning as E, isCustomResourceType as Ea, malformedRenderedContainersWarning as Ec, supersededHolderOf as Ei, ensureAssetStorage as El, noEchoMacBinding as En, s3BucketDualStackDomainName as Eo, replacementNeverSwapped as Er, declaresNoEcho as Es, relayedIndexBusyDelete as Et, readProtection as F, setLocalCustomResourceRuntimeEnabled as Fa, accountArgs as Fc, noEchoAttributeNamesOf as Fi, BOOTSTRAP_MARKER_PREFIX as Fl, movedToHint as Fn, refStateLookupFromResource as Fo, redactedDeleteAddressSkip as Fr, refuseMalformedOrphanRecordsForDestroy as Fs, readRefactorMarkerOnce as Ft, streamMemberRefusals as G, deleteLeftInPlace as Ga, unwrittenCreateOnlyReplacement as Gc, orphanRecordsPrintingBag as Gi, isAbsoluteAssetPath as Gl, parseMappingFile as Gn, recordedReferenceRegions as Go, withNameGenerationReached as Gr, refuseMalformedResourceAttributesForOrphan as Gs, formatResourceLine as Gt, reverseMapStreamPolicy as H, RollbackInlinePolicyWriters as Ha, findActionableSdkUnwired as Hc, journaledOrphanPrintingBag as Hi, warnWholeAssemblyAsSource as Hl, isPairableType as Hn, outputReferenceProvenanceOf as Ho, retiredAfterRollback as Hr, malformedLocalResourcesWarning as Hs, readsOnlyNoEchoParameters as Ht, DynamoDBGlobalTableProvider as I, withCustomResourceStack as Ia, withheldAccountClause as Ic, noEchoComparisonForTemplate as Ii, AssetManifestLoader as Il, rollbackOrphanIds as In, lacksRecordedRefArn as Io, segmentCleanupOptions as Ir, refuseMalformedOrphansForOrphan as Is, refactorMarkerMovesOf as It, isTtlAlreadyDisabled as J, isWaitAbandonedError as Ja, withoutUnwrittenSdkUnwiredProperties as Jc, secretNamedAttributeNamesOf as Ji, templateIdentity as Jl, referencedLogicalIds as Jn, getAccountInfo as Jo, computeParameterTaint as Jr, refuseMalformedResourceEntriesForDestroy as Js, lookupEachName as Jt, streamPolicyMatchesDeclared as K, deleteSkipReason as Ka, withoutAcceptedSdkUnwiredProperties as Kc, secretNamePrintingBag as Ki, listNestedTemplateRows as Kl, propertiesChangedReason as Kn, referenceProvenanceOf as Ko, getCurrentProducerRegions as Kr, refuseMalformedResourceEntries as Ks, chunks as Kt, STREAM_POLICY_KEY as L, waitForLambdaFunctionActive as La, STATE_RESOURCES_MALFORMED as Lc, noEchoExactEchoLeavesOf as Li, getDockerImageBySourceHash as Ll, withMovedTo as Ln, lacksRecordedTableArn as Lo, removeProtectionTypeList as Lr, repairMalformedOrphanRecordsForReadOnly as Ls, refactorMarkerRefusalMessage as Lt, PROTECTION_PROPERTY_BY_TYPE as M, customResourcesRunWithoutApp as Ma, refuseMalformedState as Mc, green as Mi, readBootstrapMarkerBody as Ml, formatDestructiveChange as Mn, AWS_NO_VALUE as Mo, REDACTED_DELETE_ADDRESS_SKIP_REASON as Mr, malformedOrphanRowsKeptWarning as Ms, keptForRetainedRecord as Mt, isProtectionValueActive as N, localCustomResourceCommand as Na, repairMalformedResourcesForReadOnly as Nc, red as Ni, validateAssetBucketName as Nl, findRefactorHints as Nn, cfnRefValueFromPhysicalId as No, isRedactedRecordedValue as Nr, previewableOrphanRecords as Ns, recordRetainedForReadoption as Nt, serviceTokenBlockingReason as O, withPrintingSecrets as Oa, malformedStateRefusalMessage as Oc, withoutSuperseded as Oi, assertAssetBucketRegion as Ol, noEchoMacVerdict as On, s3BucketWebsiteUrl as Oo, computeImplicitDeleteEdges as Or, deployRefusesOrphanRowsReason as Os, ECR_AUTO_DELETE_IMAGES_TAG as Ot, perType as P, localCustomResourceRuntimeActive as Pa, JSON_LISTING_HOLE_VALUE as Pc, yellow as Pi, validateContainerRepoName as Pl, hintSidesOf as Pn, isStalePlaceholderArnAttribute as Po, redactedDeleteAddressFields as Pr, refuseMalformedOrphanRecords as Ps, readRefactorMarker as Pt, sendTtlWaitingOutRateLimit as Q, poisonRenderedSpellingsCollidingIn as Qa, TemplateParser as Qc, extractDeploymentEventError as Qi, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Ql, cfnIngressPortValue as Qn, carriesDynamicReference as Qo, WITHHELD_NAME_DISPLAY as Qr, repairMalformedResourceEntriesForReadOnly as Qs, NESTED_PENDING_PARENT_REASON as Qt, STREAM_TAGS_KEY as R, CloudControlProvider as Ra, UNREADABLE_RESOURCES_MAP_ROW as Rc, noEchoParameterNamesOf as Ri, isCfnTemplateAssetPath as Rl, changedReferenceInDiff as Rn, parseWebACLArn as Ro, orphanNeedsIdentity as Rr, unpreviewableOrphanRecords as Rs, refuseRefactorMarker as Rt, hasPendingMovesOut as S, customResourceResponseExpirationWarning as Sa, refuseMalformedOutputsForDestroy as Sc, holdsSupersededResources as Si, redirectDockerAsset as Sl, DeploymentEventsStore as Sn, producerRegionsFromState as So, isReplacementOrphan as Sr, movedMaskedProperties as Ss, INDEX_SETTLE_POLL_INTERVAL_MS as St, refusePendingMovesOut as T, readsNoEchoDeleteValues as Ta, refuseDivergentRecordRegionForDestroy as Tc, supersededHeldByOtherTypeWarning as Ti, AssetModeResolver as Tl, createNoEchoValueMacs as Tn, s3BucketDomainName as To, recordUnderIdIsNotOwn as Tr, passedParameterClassesOf as Ts, maskedLogger as Tt, streamDeclaresPolicy as U, UNSPECIFIED_SKIP_REASON as Ua, findHandledUnwrittenCreateOnly as Uc, maskEventTextWithBoundBags as Ui, missingStateBucketRemedy as Ul, looselyEqual as Un, recordedOutputReferenceRegions as Uo, retiredNameGenerationsAfter as Ur, malformedResourceEntriesWarning as Us, getPriorAttempts as Ut, planStreamMemberOps as V, setResolvedResourceTimeouts as Va, hasReadableResources as Vc, completedReplayEntries as Vi, warnAbsoluteAssetPath as Vl, differingRemedy as Vn, keepHeldTokenProvenance as Vo, nameScopeOf as Vr, malformedLocalResourceEntriesWarning as Vs, macWriteOnlyKeys as Vt, streamDeclaresTags as W, deleteIndeterminateGuards as Wa, findSdkUnwiredProperties as Wc, namingSecretsWithRecordedNoEcho as Wi, findNestedTemplateTreeDefect as Wl, mappingPairs as Wn, recordedProvenanceOf as Wo, retiredNameGenerationsLeaving as Wr, malformedScrubResourceEntriesRefusalMessage as Ws, markRefusedBeforeApplying as Wt, planTimeToLive as X, isSelectOutOfBounds as Xa, hasNoCloudControlHandlers as Xc, stateSecretNameNeedles as Xi, isListParameterType as Xl, stripSiblingOwnedSgRules as Xn, carriesFetchableDynamicReference as Xo, reachableDivergentParameters as Xr, refuseMalformedResourceEntriesForImportSave as Xs, pendingRequestCount as Xt, isTtlRateLimited as Y, IntrinsicFunctionResolver as Ya, NO_CC_HANDLERS_REASON as Yc, secretNamedRecordNeedles as Yi, SSM_PARAMETER_VALUE_PREFIX as Yl, siblingOwnedSgRuleIdentities as Yn, isImpossibleEmptyStoredAttribute as Yo, namesAnyDeclaredParameter as Yr, refuseMalformedResourceEntriesForImport as Ys, withApiLimit as Yt, readTtlSpec as Z, isAlwaysLiveAttribute as Za, PROPERTY_COVERAGE_BY_TYPE as Zc, storedSecretNameNeedles as Zi, ssmResolvedValueType as Zl, withoutSiblingOwnedSgRules as Zn, isNamelessDynamicReferenceError as Zo, resourcesNamingDeclaredParameter as Zr, refuseMalformedResourceEntriesForOrphan as Zs, resolvePendingCloudControlRequests as Zt, conditionFingerprint as _, ccBrokenReason as _a, malformedLocalOutputsWarning as _c, destroyStackRecordsView as _i, createAssetRedirectResolver as _l, sameJournaledOrphans as _n, applyCallerIdentityCredentials as _o, acquireIdempotencyToken as _r, toCfnInteger as _s, compensateRemovedDeletionProtection as _t, scanActiveConsumers as a, refusesFinalSnapshot as aa, refuseMalformedResourcePropertiesForExport as ac, exportNameNoEchoParameters as ai, CrossPrefixReadError as al, revertNestedChildFromJournal as an, withSecretPhysicalIdsMaskedInState as ao, settleUnsettledPrevious as ar, replacementSidesForLog as as, contributorInsightsRefusals as at, hasPlainPrototype as au, readRecordedConditionVerdicts as b, CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID as ba, refuseMalformedNestedChildOutputs as bc, replacedDeleteFailureVerdict as bi, isDefaultBootstrapRepoName as bl, planOrphanAdoption as bn, classifyRecordedSecretRegion as bo, demoteSupersededOrphans as br, inputFingerprinter as bs, resolveDynamoDbDeleteBudgetMs as bt, nestedSsmNameDeferredNote as c, buildFinalSnapshotIdentifier as ca, UNREADABLE_ORPHANS_CONTAINER_ROW as cc, noEchoParameterValueSeed as ci, crossPrefixDeniedWarning as cl, collectNestedChildUnaddressed as cn, refuseUnreadableCdkCrossAccountRefs as co, equalModuloMarkedMask as cr, isPlainReferenceTo as cs, planIndexContributorInsightsOps as ct, absoluteAssemblyPathEscape as cu, slashedSsmNameHealAdoptedNote as d, collectPrincipalsAttachingPolicy as da, malformedOrphansWarning as dc, isExportAliasCollision as di, stackInstanceIdOf as dl, deleteJournaledOrphans as dn, assertSendableRoleArn as do, updatePartialMessage as dr, isStatefulRecreateTargetForReplace as ds, reverseMapTableContributorInsights as dt, displayAssemblyPath as du, PRE_DELETE_SNAPSHOT_TYPES as ea, malformedDriftResourcePropertiesWarning as ec, exportAliasCollisionScrubWarning as ei, splitImportedOps as el, displacedPhysicalIdShown as en, isSettledInstanceState as eo, canonicalizeIpProtocolValue as er, withSharedDrainBudget as es, readbackVectorIndexes as et, decodeListingKey as eu, slashedSsmNameHealNote as f, stripSiblingOwnedMembers as fa, refuseMalformedOrphans as fc, bindingSkippedOutputs as fi, withStackInstanceIdWithheld as fl, dropFailedCommands as fn, explicitRoleArnOrThrow as fo, updatePartialReason as fr, isStatefulRecreateTargetSync as fs, stripIndexContributorInsights as ft, namesTheSameDirectory as fu, makeCanonicalizePropertiesFn as g, ProviderRegistry as ga, malformedExportSourceWarning as gc, awaitInFlightSibling as gi, buildAssetRedirectMap as gl, loadJournaledOrphans as gn, AWS_CREDENTIAL_ENV_KEYS as go, withCreateTokenLedger as gr, isWarmThroughputDecrease as gs, beginDeleteWait as gt, resolveBucketRegion as gu, inheritedProvenanceForChildDiff as h, CC_BROKEN_REASON as ha, malformedExportNamesWarning as hc, maskingRetryLogger as hi, stringifyValue as hl, journaledOrphanLines as hn, sendableAssumeRoleCommand as ho, reserveStackCreateToken as hr, coerceWarmThroughput as hs, DYNAMODB_DELETE_POLL_COST_MS as ht, clearBucketRegionCache as hu, mergeNoChangeOutputs as i, isFinalSnapshotError as ia, refuseMalformedResourcePropertiesForDrift as ic, carriedExportAliasExposure as ii, rebuildClientForBucketRegion as il, recordDisplacedSkips as in, secretSegmentsOfState as io, recordAfterRollbackUpdate as ir, markNewValueKnownAfterDeploy as is, CONTRIBUTOR_INSIGHTS_KEY as it, hasOwnKey as iu, recordedProtectionNote as j, customResourcesFailedWithoutApp as ja, refuseMalformedResourcesForExport as jc, gray as ji, parseBootstrapMarker as jl, findDestructiveChanges as jn, parameterTypeMayLoseSecretIdentity as jo, findNestedStackTypeChanges as jr, malformedOrphanRecordsWarning as js, isTruthyCfnBoolean as jt, diffSecurity as k, NO_LOCAL_CUSTOM_RESOURCES_FLAG as ka, refuseMalformedResourcesForDeploy as kc, bold as ki, isCrossRegionRedirect as kl, noEchoValueMacsOf as kn, coerceParameterTypedValue as ko, resolveReplacementOldType as kr, isReadableOrphanRecord as ks, S3_AUTO_DELETE_OBJECTS_TAG as kt, nestedSsmNameRowNote as l, collectGroupsAddedBySiblings as la, hasReadableOrphans as lc, collectDeclaredOutputNames as li, isAccessDenied$1 as ll, getCurrentNestedStackContext as ln, applyRoleArnIfSet as lo, equalModuloMask as lr, shownType as ls, readContributorInsightsSpec as lt, assemblyPathEscape as lu, crossStackOutputProvenanceSource as m, withoutSiblingOwned as ma, repairMalformedOrphansForReadOnly as mc, DEFAULT_RESOURCE_WARN_AFTER_MS as mi, isSensitiveAttributeName as ml, isHandledOrphan as mn, parseIamRoleArn as mo, ledgerForStack as mr, WARM_THROUGHPUT_MEMBERS as ms, DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS as mt, resolveAssemblyPath as mu, isSecretBearingReferenceString as n, ccRoutedInstanceTakesNoSnapshot as na, refuseMalformedResourceProperties as nc, secretBearingStateKeyWarning as ni, hasReasonlessBaselineRefusal as nl, getNestedRevertRun as nn, maskedSecretSegment as no, replayRollback as nr, INTRINSIC_KEYS as ns, vectorIndexesSettled as nt, synthesizedStacks as nu, inRunStackKey as o, unsupportedFinalSnapshotError as oa, refuseMalformedResourcePropertiesForOrphan as oc, exportNameSecretExposure as oi, CrossPrefixScanCache as ol, revertedNestedRowIds as on, resolveDynamicReferences as oo, withUnprovenUnsettled as or, siblingsOf as os, indexDeclaresContributorInsights as ot, nullPrototypeRecord as ou, slashedSsmNameHealPendingNote as p, withoutSiblingAttachedArns as pa, refuseMalformedOrphansForDestroy as pc, DEFAULT_RESOURCE_TIMEOUT_MS as pi, isSecretValuedAttribute as pl, dropFailedHint as pn, isIamRoleArn as po, earliestDefined as pr, renderStatefulReason as ps, DYNAMODB_DELETE_DEADLINE_MARGIN_MS as pt, renderAssemblyPathEscape as pu, streamTagsMatchDeclared as q, withIndeterminateGuard as qa, withoutSdkUnwiredProperties as qc, secretNamePrintingBags as qi, renderNestedTemplateTreeDefect as ql, proposeRenames as qn, referenceTokensIn as qo, inheritProducerRegions as qr, refuseMalformedResourceEntriesForDeploy as qs, isAccessDeniedError as qt, keptWholeReasonText as r, effectiveDeletionPolicy as ra, refuseMalformedResourcePropertiesForDestroy as rc, secretSafeKeyDisplay as ri, hasUnverifiableParameterRefusal as rl, nestedChildStackName as rn, secretPhysicalIdSegment as ro, DELETED_RESOURCE_REMEDY as rr, containsIntrinsic as rs, vectorIndexesShapeDetail as rt, defineOwnKey as ru, checkNestedSsmNames as s, createPreDeleteFinalSnapshot as sa, repairMalformedResourcePropertiesForReadOnly as sc, isWholeDynamicReferenceValue as si, applyCrossPrefixScan as sl, withNestedRevertRun as sn, producerLookupOver as so, calculateResourceDrift as sr, findReplacedReadersOfRecreateTargets as ss, planContributorInsightsOp as st, ownValue as su, DeployEngine as t, ccRoutedFinalSnapshotError as ta, malformedResourcePropertiesWarning as tc, secretBearing as ti, isKnownTokenFreeState as tl, dropSettledNestedJournals as tn, APPSYNC_APIKEY_ARN_RESOURCE_PATH as to, replayFailedOperations as tr, namesRecreatedParent as ts, vectorIndexesForCreate as tt, rememberSynthesizedStacks as tu, healSlashedSsmParameterNames as u, collectManagedPolicyArnsAttachedBySiblings as ua, malformedOrphansRefusalMessage as uc, collectPublishedOutputNames as ui, isNotImplemented as ul, withNestedStackContext as un, assertFlagRoleArn as uo, undeclaredEmptyObservedKeys as ur, MULTI_REGION_RECREATE_BLOCKED_TYPES as us, reverseMapIndexContributorInsights as ut, describeFileReadFailure as uu, conditionInputsFrom as v, isCustomResource as va, malformedOutputsRefusalMessage as vc, getStackRecords as vi, flattenAssetPlaceholders as vl, makeForeignHolderScan as vn, callerEnvCredentials as vo, planRollback as vr, toFiniteNumber as vs, deleteBudgetKey as vt, pendingMovesRefusalMessage as w, TemplateNoEchoReresolver as wa, STATE_REGION_DIVERGED as wc, supersededAfterRollback as wi, rewriteTemplateAssetReferences as wl, NOECHO_MAC_KEY_ALIAS as wn, s3BucketArn as wo, recheckFailedPlan as wr, maskedInputProof as ws, deleteTableWithIndexBusyRetry as wt, childTemplateLoader as x, applyCustomResourceResponseExpiration as xa, refuseMalformedOutputs as xc, deleteSupersededEntry as xi, loadPublishableAssetManifest as xl, DeploymentEventsReader as xn, classifyReplaySecretRegion as xo, isJournaledOrphan as xr, maskedPropertyFingerprintsOf as xs, DELETE_INDEX_WAIT_PROCEED_NOTE as xt, parentSuppliedValues as y, wouldReturnToSdkProvider as ya, malformedOutputsWarning as yc, withStackRecords as yi, isDefaultBootstrapBucketName as yl, makeSiblingClaimReader as yn, envCredentialsAreAssumedRole as yo, seedsDeleteFirstGuard as yr, tryGetTopLevelWriteOnlyProperties as ys, resolveDynamoDbDeleteBudgetClock as yt, declaredStreamPolicyMember as z, waitForGoneAfterDelete as za, displayLogicalId as zc, withAttemptedItemsMasked as zi, parseAssetManifestBody as zl, changedReferencePath as zn, extractGetAttRefs as zo, nameGenerationCarriedFrom as zr, unreadableOrphanRecords as zs, sameMove as zt };
50412
- //# sourceMappingURL=deploy-engine-DIe64g1M.js.map
50848
+ export { planVectorIndexUpdates as $, stackIdTailOf as $a, S3StateBackend as $c, ATOMIC_FINAL_SNAPSHOT_TYPES as $i, getBootstrapMarkerKey as $l, sgProtocolKey as $n, keepsSecretReferenceToken as $o, displayTextOrWithheld as $r, unreadableResourceEntries as $s, displacedOpClause as $t, recordedProtectionEvidence as A, customResourceStackName as Aa, refuseMalformedResourcesForDestroy as Ac, cyan as Ai, synthesizedStacks as Al, constructPathOf as An, isUnboundTemplateParameter as Ao, withPreviousPolicies as Ar, malformedOrphanRecordsRefusalMessage as As, hasCdkAutoDeleteTag as At, declaredStreamTagsMember as B, resolvedResourceTimeoutMs as Ba, hasReadableOutputs as Bc, createReadOnlyAttributeHealerFactory as Bi, rewriteTemplateAssetReferences as Bl, changedReferenceReason as Bn, promoteInPlaceAttributeDependents as Bo, nameGenerationHighWaterOf as Br, isReadableResourceEntry as Bs, updateRefactorMarker as Bt, pendingMovesOutOf as C, responsePresignClient as Ca, repairMalformedOutputsForReadOnly as Cc, isSupersededResourceRecord as Ci, SSM_PARAMETER_VALUE_PREFIX as Cl, crossStackReadsForPartialSave as Cn, regionLessSecretName as Co, planFailedOps as Cr, parameterInputsFor as Cs, TABLE_INDEX_NOUN as Ct, findServiceTokenRefusals as D, getCurrentResourceSecrets as Da, malformedResourcesWarning as Dc, supersededResourcesOf as Di, purgeNoncurrentKeyVersions as Dl, noEchoMacParametersOf as Dn, s3BucketRegionalDomainName as Do, IMPLICIT_DELETE_DEPENDENCIES as Dr, maskedPropertyFingerprint as Ds, waitForIndexesSettled as Dt, deferredServiceTokenWarning as E, isCustomResourceType as Ea, malformedRenderedContainersWarning as Ec, supersededHolderOf as Ei, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as El, noEchoMacBinding as En, s3BucketDualStackDomainName as Eo, replacementNeverSwapped as Er, declaresNoEcho as Es, relayedIndexBusyDelete as Et, readProtection as F, setLocalCustomResourceRuntimeEnabled as Fa, accountArgs as Fc, noEchoAttributeNamesOf as Fi, isDefaultBootstrapBucketName as Fl, movedToHint as Fn, refStateLookupFromResource as Fo, redactedDeleteAddressSkip as Fr, refuseMalformedOrphanRecordsForDestroy as Fs, readRefactorMarkerOnce as Ft, streamMemberRefusals as G, deleteLeftInPlace as Ga, unwrittenCreateOnlyReplacement as Gc, orphanRecordsPrintingBag as Gi, resolveFileAssetSourcePath as Gl, parseMappingFile as Gn, recordedReferenceRegions as Go, withNameGenerationReached as Gr, refuseMalformedResourceAttributesForOrphan as Gs, formatResourceLine as Gt, reverseMapStreamPolicy as H, RollbackInlinePolicyWriters as Ha, findActionableSdkUnwired as Hc, journaledOrphanPrintingBag as Hi, getDockerImageBySourceHash as Hl, isPairableType as Hn, outputReferenceProvenanceOf as Ho, retiredAfterRollback as Hr, malformedLocalResourcesWarning as Hs, readsOnlyNoEchoParameters as Ht, DynamoDBGlobalTableProvider as I, withCustomResourceStack as Ia, withheldAccountClause as Ic, noEchoComparisonForTemplate as Ii, isDefaultBootstrapRepoName as Il, rollbackOrphanIds as In, lacksRecordedRefArn as Io, segmentCleanupOptions as Ir, refuseMalformedOrphansForOrphan as Is, refactorMarkerMovesOf as It, isTtlAlreadyDisabled as J, isWaitAbandonedError as Ja, withoutUnwrittenSdkUnwiredProperties as Jc, secretNamedAttributeNamesOf as Ji, AssetModeResolver as Jl, referencedLogicalIds as Jn, getAccountInfo as Jo, computeParameterTaint as Jr, refuseMalformedResourceEntriesForDestroy as Js, lookupEachName as Jt, streamPolicyMatchesDeclared as K, deleteSkipReason as Ka, withoutAcceptedSdkUnwiredProperties as Kc, secretNamePrintingBag as Ki, warnAbsoluteAssetPath as Kl, propertiesChangedReason as Kn, referenceProvenanceOf as Ko, getCurrentProducerRegions as Kr, refuseMalformedResourceEntries as Ks, chunks as Kt, STREAM_POLICY_KEY as L, waitForLambdaFunctionActive as La, STATE_RESOURCES_MALFORMED as Lc, noEchoExactEchoLeavesOf as Li, loadPublishableAssetManifest as Ll, withMovedTo as Ln, lacksRecordedTableArn as Lo, removeProtectionTypeList as Lr, repairMalformedOrphanRecordsForReadOnly as Ls, refactorMarkerRefusalMessage as Lt, PROTECTION_PROPERTY_BY_TYPE as M, customResourcesRunWithoutApp as Ma, refuseMalformedState as Mc, green as Mi, createAssetRedirectResolver as Ml, formatDestructiveChange as Mn, AWS_NO_VALUE as Mo, REDACTED_DELETE_ADDRESS_SKIP_REASON as Mr, malformedOrphanRowsKeptWarning as Ms, keptForRetainedRecord as Mt, isProtectionValueActive as N, localCustomResourceCommand as Na, repairMalformedResourcesForReadOnly as Nc, red as Ni, createLazyAssetModeContext as Nl, findRefactorHints as Nn, cfnRefValueFromPhysicalId as No, isRedactedRecordedValue as Nr, previewableOrphanRecords as Ns, recordRetainedForReadoption as Nt, serviceTokenBlockingReason as O, withPrintingSecrets as Oa, malformedStateRefusalMessage as Oc, withoutSuperseded as Oi, decodeListingKey as Ol, noEchoMacVerdict as On, s3BucketWebsiteUrl as Oo, computeImplicitDeleteEdges as Or, deployRefusesOrphanRowsReason as Os, ECR_AUTO_DELETE_IMAGES_TAG as Ot, perType as P, localCustomResourceRuntimeActive as Pa, JSON_LISTING_HOLE_VALUE as Pc, yellow as Pi, flattenAssetPlaceholders as Pl, hintSidesOf as Pn, isStalePlaceholderArnAttribute as Po, redactedDeleteAddressFields as Pr, refuseMalformedOrphanRecords as Ps, readRefactorMarker as Pt, sendTtlWaitingOutRateLimit as Q, poisonRenderedSpellingsCollidingIn as Qa, TemplateParser as Qc, extractDeploymentEventError as Qi, isCrossRegionRedirect as Ql, cfnIngressPortValue as Qn, carriesDynamicReference as Qo, WITHHELD_NAME_DISPLAY as Qr, repairMalformedResourceEntriesForReadOnly as Qs, NESTED_PENDING_PARENT_REASON as Qt, STREAM_TAGS_KEY as R, CloudControlProvider as Ra, UNREADABLE_RESOURCES_MAP_ROW as Rc, noEchoParameterNamesOf as Ri, redirectDockerAsset as Rl, changedReferenceInDiff as Rn, parseWebACLArn as Ro, orphanNeedsIdentity as Rr, unpreviewableOrphanRecords as Rs, refuseRefactorMarker as Rt, hasPendingMovesOut as S, customResourceResponseExpirationWarning as Sa, refuseMalformedOutputsForDestroy as Sc, holdsSupersededResources as Si, templateIdentity as Sl, DeploymentEventsStore as Sn, producerRegionsFromState as So, isReplacementOrphan as Sr, movedMaskedProperties as Ss, INDEX_SETTLE_POLL_INTERVAL_MS as St, refusePendingMovesOut as T, readsNoEchoDeleteValues as Ta, refuseDivergentRecordRegionForDestroy as Tc, supersededHeldByOtherTypeWarning as Ti, ssmResolvedValueType as Tl, createNoEchoValueMacs as Tn, s3BucketDomainName as To, recordUnderIdIsNotOwn as Tr, passedParameterClassesOf as Ts, maskedLogger as Tt, streamDeclaresPolicy as U, UNSPECIFIED_SKIP_REASON as Ua, findHandledUnwrittenCreateOnly as Uc, maskEventTextWithBoundBags as Ui, isCfnTemplateAssetPath as Ul, looselyEqual as Un, recordedOutputReferenceRegions as Uo, retiredNameGenerationsAfter as Ur, malformedResourceEntriesWarning as Us, getPriorAttempts as Ut, planStreamMemberOps as V, setResolvedResourceTimeouts as Va, hasReadableResources as Vc, completedReplayEntries as Vi, AssetManifestLoader as Vl, differingRemedy as Vn, keepHeldTokenProvenance as Vo, nameScopeOf as Vr, malformedLocalResourceEntriesWarning as Vs, macWriteOnlyKeys as Vt, streamDeclaresTags as W, deleteIndeterminateGuards as Wa, findSdkUnwiredProperties as Wc, namingSecretsWithRecordedNoEcho as Wi, parseAssetManifestBody as Wl, mappingPairs as Wn, recordedProvenanceOf as Wo, retiredNameGenerationsLeaving as Wr, malformedScrubResourceEntriesRefusalMessage as Ws, markRefusedBeforeApplying as Wt, planTimeToLive as X, isSelectOutOfBounds as Xa, hasNoCloudControlHandlers as Xc, stateSecretNameNeedles as Xi, buildDenyExternalAccessPolicy as Xl, stripSiblingOwnedSgRules as Xn, carriesFetchableDynamicReference as Xo, reachableDivergentParameters as Xr, refuseMalformedResourceEntriesForImportSave as Xs, pendingRequestCount as Xt, isTtlRateLimited as Y, IntrinsicFunctionResolver as Ya, NO_CC_HANDLERS_REASON as Yc, secretNamedRecordNeedles as Yi, ensureAssetStorage as Yl, siblingOwnedSgRuleIdentities as Yn, isImpossibleEmptyStoredAttribute as Yo, namesAnyDeclaredParameter as Yr, refuseMalformedResourceEntriesForImport as Ys, withApiLimit as Yt, readTtlSpec as Z, isAlwaysLiveAttribute as Za, PROPERTY_COVERAGE_BY_TYPE as Zc, storedSecretNameNeedles as Zi, assertAssetBucketRegion as Zl, withoutSiblingOwnedSgRules as Zn, isNamelessDynamicReferenceError as Zo, resourcesNamingDeclaredParameter as Zr, refuseMalformedResourceEntriesForOrphan as Zs, resolvePendingCloudControlRequests as Zt, conditionFingerprint as _, ccBrokenReason as _a, malformedLocalOutputsWarning as _c, destroyStackRecordsView as _i, missingStateBucketRemedy as _l, sameJournaledOrphans as _n, applyCallerIdentityCredentials as _o, acquireIdempotencyToken as _r, toCfnInteger as _s, compensateRemovedDeletionProtection as _t, renderAssemblyPathEscape as _u, scanActiveConsumers as a, refusesFinalSnapshot as aa, refuseMalformedResourcePropertiesForExport as ac, exportNameNoEchoParameters as ai, rebuildClientForBucketRegion as al, revertNestedChildFromJournal as an, withSecretPhysicalIdsMaskedInState as ao, settleUnsettledPrevious as ar, replacementSidesForLog as as, contributorInsightsRefusals as at, getCdkdAssetBucketName as au, readRecordedConditionVerdicts as b, CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID as ba, refuseMalformedNestedChildOutputs as bc, replacedDeleteFailureVerdict as bi, listNestedTemplateRows as bl, planOrphanAdoption as bn, classifyRecordedSecretRegion as bo, demoteSupersededOrphans as br, inputFingerprinter as bs, resolveDynamoDbDeleteBudgetMs as bt, resolveBucketRegion as bu, nestedSsmNameDeferredNote as c, buildFinalSnapshotIdentifier as ca, UNREADABLE_ORPHANS_CONTAINER_ROW as cc, noEchoParameterValueSeed as ci, applyCrossPrefixScan as cl, collectNestedChildUnaddressed as cn, refuseUnreadableCdkCrossAccountRefs as co, equalModuloMarkedMask as cr, isPlainReferenceTo as cs, planIndexContributorInsightsOps as ct, hasOwnKey as cu, slashedSsmNameHealAdoptedNote as d, collectPrincipalsAttachingPolicy as da, malformedOrphansWarning as dc, isExportAliasCollision as di, isNotImplemented as dl, deleteJournaledOrphans as dn, assertSendableRoleArn as do, updatePartialMessage as dr, isStatefulRecreateTargetForReplace as ds, reverseMapTableContributorInsights as dt, ownValue as du, PRE_DELETE_SNAPSHOT_TYPES as ea, malformedDriftResourcePropertiesWarning as ec, exportAliasCollisionScrubWarning as ei, splitImportedOps as el, displacedPhysicalIdShown as en, isSettledInstanceState as eo, canonicalizeIpProtocolValue as er, withSharedDrainBudget as es, readbackVectorIndexes as et, parseBootstrapMarker as eu, slashedSsmNameHealNote as f, stripSiblingOwnedMembers as fa, refuseMalformedOrphans as fc, bindingSkippedOutputs as fi, stackInstanceIdOf as fl, dropFailedCommands as fn, explicitRoleArnOrThrow as fo, updatePartialReason as fr, isStatefulRecreateTargetSync as fs, stripIndexContributorInsights as ft, absoluteAssemblyPathEscape as fu, makeCanonicalizePropertiesFn as g, ProviderRegistry as ga, malformedExportSourceWarning as gc, awaitInFlightSibling as gi, stringifyValue as gl, loadJournaledOrphans as gn, AWS_CREDENTIAL_ENV_KEYS as go, withCreateTokenLedger as gr, isWarmThroughputDecrease as gs, beginDeleteWait as gt, namesTheSameDirectory as gu, inheritedProvenanceForChildDiff as h, CC_BROKEN_REASON as ha, malformedExportNamesWarning as hc, maskingRetryLogger as hi, isSensitiveAttributeName as hl, journaledOrphanLines as hn, sendableAssumeRoleCommand as ho, reserveStackCreateToken as hr, coerceWarmThroughput as hs, DYNAMODB_DELETE_POLL_COST_MS as ht, displayAssemblyPath as hu, mergeNoChangeOutputs as i, isFinalSnapshotError as ia, refuseMalformedResourcePropertiesForDrift as ic, carriedExportAliasExposure as ii, hasUnverifiableParameterRefusal as il, recordDisplacedSkips as in, secretSegmentsOfState as io, recordAfterRollbackUpdate as ir, markNewValueKnownAfterDeploy as is, CONTRIBUTOR_INSIGHTS_KEY as it, BOOTSTRAP_MARKER_PREFIX as iu, recordedProtectionNote as j, customResourcesFailedWithoutApp as ja, refuseMalformedResourcesForExport as jc, gray as ji, buildAssetRedirectMap as jl, findDestructiveChanges as jn, parameterTypeMayLoseSecretIdentity as jo, findNestedStackTypeChanges as jr, malformedOrphanRecordsWarning as js, isTruthyCfnBoolean as jt, diffSecurity as k, NO_LOCAL_CUSTOM_RESOURCES_FLAG as ka, refuseMalformedResourcesForDeploy as kc, bold as ki, rememberSynthesizedStacks as kl, noEchoValueMacsOf as kn, coerceParameterTypedValue as ko, resolveReplacementOldType as kr, isReadableOrphanRecord as ks, S3_AUTO_DELETE_OBJECTS_TAG as kt, nestedSsmNameRowNote as l, collectGroupsAddedBySiblings as la, hasReadableOrphans as lc, collectDeclaredOutputNames as li, crossPrefixDeniedWarning as ll, getCurrentNestedStackContext as ln, applyRoleArnIfSet as lo, equalModuloMask as lr, shownType as ls, readContributorInsightsSpec as lt, hasPlainPrototype as lu, crossStackOutputProvenanceSource as m, withoutSiblingOwned as ma, repairMalformedOrphansForReadOnly as mc, DEFAULT_RESOURCE_WARN_AFTER_MS as mi, isSecretValuedAttribute as ml, isHandledOrphan as mn, parseIamRoleArn as mo, ledgerForStack as mr, WARM_THROUGHPUT_MEMBERS as ms, DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS as mt, describeFileReadFailure as mu, isSecretBearingReferenceString as n, ccRoutedInstanceTakesNoSnapshot as na, refuseMalformedResourceProperties as nc, secretBearingStateKeyWarning as ni, readOnlyStateVersionOf as nl, getNestedRevertRun as nn, maskedSecretSegment as no, replayRollback as nr, INTRINSIC_KEYS as ns, vectorIndexesSettled as nt, validateAssetBucketName as nu, inRunStackKey as o, unsupportedFinalSnapshotError as oa, refuseMalformedResourcePropertiesForOrphan as oc, exportNameSecretExposure as oi, CrossPrefixReadError as ol, revertedNestedRowIds as on, resolveDynamicReferences as oo, withUnprovenUnsettled as or, siblingsOf as os, indexDeclaresContributorInsights as ot, getCdkdContainerRepoName as ou, slashedSsmNameHealPendingNote as p, withoutSiblingAttachedArns as pa, refuseMalformedOrphansForDestroy as pc, DEFAULT_RESOURCE_TIMEOUT_MS as pi, withStackInstanceIdWithheld as pl, dropFailedHint as pn, isIamRoleArn as po, earliestDefined as pr, renderStatefulReason as ps, DYNAMODB_DELETE_DEADLINE_MARGIN_MS as pt, assemblyPathEscape as pu, streamTagsMatchDeclared as q, withIndeterminateGuard as qa, withoutSdkUnwiredProperties as qc, secretNamePrintingBags as qi, warnWholeAssemblyAsSource as ql, proposeRenames as qn, referenceTokensIn as qo, inheritProducerRegions as qr, refuseMalformedResourceEntriesForDeploy as qs, isAccessDeniedError as qt, keptWholeReasonText as r, effectiveDeletionPolicy as ra, refuseMalformedResourcePropertiesForDestroy as rc, secretSafeKeyDisplay as ri, hasReasonlessBaselineRefusal as rl, nestedChildStackName as rn, secretPhysicalIdSegment as ro, DELETED_RESOURCE_REMEDY as rr, containsIntrinsic as rs, vectorIndexesShapeDetail as rt, validateContainerRepoName as ru, checkNestedSsmNames as s, createPreDeleteFinalSnapshot as sa, repairMalformedResourcePropertiesForReadOnly as sc, isWholeDynamicReferenceValue as si, CrossPrefixScanCache as sl, withNestedRevertRun as sn, producerLookupOver as so, calculateResourceDrift as sr, findReplacedReadersOfRecreateTargets as ss, planContributorInsightsOp as st, defineOwnKey as su, DeployEngine as t, ccRoutedFinalSnapshotError as ta, malformedResourcePropertiesWarning as tc, secretBearing as ti, isKnownTokenFreeState as tl, dropSettledNestedJournals as tn, APPSYNC_APIKEY_ARN_RESOURCE_PATH as to, replayFailedOperations as tr, namesRecreatedParent as ts, vectorIndexesForCreate as tt, readBootstrapMarkerBody as tu, healSlashedSsmParameterNames as u, collectManagedPolicyArnsAttachedBySiblings as ua, malformedOrphansRefusalMessage as uc, collectPublishedOutputNames as ui, isAccessDenied$1 as ul, withNestedStackContext as un, assertFlagRoleArn as uo, undeclaredEmptyObservedKeys as ur, MULTI_REGION_RECREATE_BLOCKED_TYPES as us, reverseMapIndexContributorInsights as ut, nullPrototypeRecord as uu, conditionInputsFrom as v, isCustomResource as va, malformedOutputsRefusalMessage as vc, getStackRecords as vi, findNestedTemplateTreeDefect as vl, makeForeignHolderScan as vn, callerEnvCredentials as vo, planRollback as vr, toFiniteNumber as vs, deleteBudgetKey as vt, resolveAssemblyPath as vu, pendingMovesRefusalMessage as w, TemplateNoEchoReresolver as wa, STATE_REGION_DIVERGED as wc, supersededAfterRollback as wi, isListParameterType as wl, NOECHO_MAC_KEY_ALIAS as wn, s3BucketArn as wo, recheckFailedPlan as wr, maskedInputProof as ws, deleteTableWithIndexBusyRetry as wt, childTemplateLoader as x, applyCustomResourceResponseExpiration as xa, refuseMalformedOutputs as xc, deleteSupersededEntry as xi, renderNestedTemplateTreeDefect as xl, DeploymentEventsReader as xn, classifyReplaySecretRegion as xo, isJournaledOrphan as xr, maskedPropertyFingerprintsOf as xs, DELETE_INDEX_WAIT_PROCEED_NOTE as xt, parentSuppliedValues as y, wouldReturnToSdkProvider as ya, malformedOutputsWarning as yc, withStackRecords as yi, isAbsoluteAssetPath as yl, makeSiblingClaimReader as yn, envCredentialsAreAssumedRole as yo, seedsDeleteFirstGuard as yr, tryGetTopLevelWriteOnlyProperties as ys, resolveDynamoDbDeleteBudgetClock as yt, clearBucketRegionCache as yu, declaredStreamPolicyMember as z, waitForGoneAfterDelete as za, displayLogicalId as zc, withAttemptedItemsMasked as zi, redirectFileAsset as zl, changedReferencePath as zn, extractGetAttRefs as zo, nameGenerationCarriedFrom as zr, unreadableOrphanRecords as zs, sameMove as zt };
50849
+ //# sourceMappingURL=deploy-engine-axD9sX_9.js.map