@cdkd/cli 0.371.0 → 0.372.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 (69) hide show
  1. package/dist/{ambient-client-defaults-DzKSQvWN.js → ambient-client-defaults-B9_o60dB.js} +3 -3
  2. package/dist/{ambient-client-defaults-DzKSQvWN.js.map → ambient-client-defaults-B9_o60dB.js.map} +1 -1
  3. package/dist/{asg-provider-BkR7gv40.js → asg-provider-D6gQPSZu.js} +8 -8
  4. package/dist/{asg-provider-BkR7gv40.js.map → asg-provider-D6gQPSZu.js.map} +1 -1
  5. package/dist/cli.js +3 -3
  6. package/dist/{created-resource-sink-D7FufEaB.js → created-resource-sink-CxezDoaQ.js} +4 -4
  7. package/dist/{created-resource-sink-D7FufEaB.js.map → created-resource-sink-CxezDoaQ.js.map} +1 -1
  8. package/dist/{custom-resource-runtime-DyUvtovF.js → custom-resource-runtime-BiP0vn3W.js} +6 -6
  9. package/dist/{custom-resource-runtime-DyUvtovF.js.map → custom-resource-runtime-BiP0vn3W.js.map} +1 -1
  10. package/dist/{db-associated-roles-Dq-VSmuu.js → db-associated-roles-BfvrD9UK.js} +2 -2
  11. package/dist/{db-associated-roles-Dq-VSmuu.js.map → db-associated-roles-BfvrD9UK.js.map} +1 -1
  12. package/dist/{delete-started-C8fWcehI.js → delete-started-BtXSEHsh.js} +4 -4
  13. package/dist/{delete-started-C8fWcehI.js.map → delete-started-BtXSEHsh.js.map} +1 -1
  14. package/dist/{deploy-engine-BsKzx9ys.js → deploy-engine-D6iEbD4R.js} +1889 -301
  15. package/dist/deploy-engine-D6iEbD4R.js.map +1 -0
  16. package/dist/{ec2-termination-protection-CJjU7OpO.js → ec2-termination-protection-DXZyU3Q0.js} +3 -3
  17. package/dist/{ec2-termination-protection-CJjU7OpO.js.map → ec2-termination-protection-DXZyU3Q0.js.map} +1 -1
  18. package/dist/{ecr-uri-BYBZlAlS.js → ecr-uri-C0JbYdmm.js} +2 -2
  19. package/dist/{ecr-uri-BYBZlAlS.js.map → ecr-uri-C0JbYdmm.js.map} +1 -1
  20. package/dist/{emr-cluster-provider-Cz2_BHvv.js → emr-cluster-provider-BCu1qq9J.js} +10 -10
  21. package/dist/{emr-cluster-provider-Cz2_BHvv.js.map → emr-cluster-provider-BCu1qq9J.js.map} +1 -1
  22. package/dist/{expected-bucket-owner-Dr7zxlJn.js → expected-bucket-owner-C2OXO5oD.js} +2 -2
  23. package/dist/{expected-bucket-owner-Dr7zxlJn.js.map → expected-bucket-owner-C2OXO5oD.js.map} +1 -1
  24. package/dist/{iam-role-provider-C27pVBaA.js → iam-role-provider-DFBJRsvA.js} +12 -12
  25. package/dist/{iam-role-provider-C27pVBaA.js.map → iam-role-provider-DFBJRsvA.js.map} +1 -1
  26. package/dist/{identity-read-denied-DHWVUHrX.js → identity-read-denied-C17mECu-.js} +5 -5
  27. package/dist/{identity-read-denied-DHWVUHrX.js.map → identity-read-denied-C17mECu-.js.map} +1 -1
  28. package/dist/{image-plan-D2uTAfxX.js → image-plan-sEIpoR31.js} +18 -11
  29. package/dist/image-plan-sEIpoR31.js.map +1 -0
  30. package/dist/index.d.ts +6 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +5 -5
  33. package/dist/{logger-DVdLGob_.js → logger-BoDS8cs5.js} +2 -2
  34. package/dist/{logger-DVdLGob_.js.map → logger-BoDS8cs5.js.map} +1 -1
  35. package/dist/{neptune-provider-CkbTF9aG.js → neptune-provider-CL5WtULJ.js} +9 -9
  36. package/dist/{neptune-provider-CkbTF9aG.js.map → neptune-provider-CL5WtULJ.js.map} +1 -1
  37. package/dist/{program-BBg-9V23.js → program-BBXUa34K.js} +530 -59
  38. package/dist/program-BBXUa34K.js.map +1 -0
  39. package/dist/{provider-classes-DWi0yjHc.js → provider-classes-BiWcIBLc.js} +32 -25
  40. package/dist/{provider-classes-DWi0yjHc.js.map → provider-classes-BiWcIBLc.js.map} +1 -1
  41. package/dist/{rds-provider-BV4XW4wv.js → rds-provider--XBD_TS8.js} +25 -14
  42. package/dist/{rds-provider-BV4XW4wv.js.map → rds-provider--XBD_TS8.js.map} +1 -1
  43. package/dist/{read-replica-B08_DZNH.js → read-replica-apcXpKN9.js} +3 -3
  44. package/dist/{read-replica-B08_DZNH.js.map → read-replica-apcXpKN9.js.map} +1 -1
  45. package/dist/{redacted-delete-address-Be4d3ZWA.js → redacted-delete-address-S_A40Diz.js} +4 -4
  46. package/dist/{redacted-delete-address-Be4d3ZWA.js.map → redacted-delete-address-S_A40Diz.js.map} +1 -1
  47. package/dist/{replacement-rules-DL9MZWSp.js → replacement-rules-BArdRPgU.js} +125 -26
  48. package/dist/replacement-rules-BArdRPgU.js.map +1 -0
  49. package/dist/{resource-deadline-D65EA80y.js → resource-deadline-DWvjidOS.js} +2 -2
  50. package/dist/{resource-deadline-D65EA80y.js.map → resource-deadline-DWvjidOS.js.map} +1 -1
  51. package/dist/{restore-source-guard-ClcpxInI.js → restore-source-guard-k9BQAviV.js} +4 -4
  52. package/dist/{restore-source-guard-ClcpxInI.js.map → restore-source-guard-k9BQAviV.js.map} +1 -1
  53. package/dist/{run-cli-zFQkbzGk.js → run-cli-DEVVmR3v.js} +2 -2
  54. package/dist/{run-cli-zFQkbzGk.js.map → run-cli-DEVVmR3v.js.map} +1 -1
  55. package/dist/{secret-reference-immutable-Bh9gCLFt.js → secret-reference-immutable-0mb2D0J5.js} +20 -11
  56. package/dist/secret-reference-immutable-0mb2D0J5.js.map +1 -0
  57. package/dist/{settle-own-write-members-B-g5oflo.js → settle-own-write-members-DPTK_vVK.js} +13 -684
  58. package/dist/settle-own-write-members-DPTK_vVK.js.map +1 -0
  59. package/dist/{tag-list-DX_Ke9se.js → tag-list-B19O4m3W.js} +4 -4
  60. package/dist/{tag-list-DX_Ke9se.js.map → tag-list-B19O4m3W.js.map} +1 -1
  61. package/dist/{version-G1wdb4QW.js → version-Byf_RTiH.js} +2 -2
  62. package/dist/{version-G1wdb4QW.js.map → version-Byf_RTiH.js.map} +1 -1
  63. package/package.json +1 -1
  64. package/dist/deploy-engine-BsKzx9ys.js.map +0 -1
  65. package/dist/image-plan-D2uTAfxX.js.map +0 -1
  66. package/dist/program-BBg-9V23.js.map +0 -1
  67. package/dist/replacement-rules-DL9MZWSp.js.map +0 -1
  68. package/dist/secret-reference-immutable-Bh9gCLFt.js.map +0 -1
  69. package/dist/settle-own-write-members-B-g5oflo.js.map +0 -1
@@ -1,17 +1,14 @@
1
- import { A as displayStackName, C as STACK_REF_MAX_CODE_POINTS, D as displayAwsMessage, O as displayIdent, P as safeMsg, _ as shellQuote, k as displaySafe, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, r as SHELL_ACTIVE, w as UNRENDERABLE } from "./version-G1wdb4QW.js";
2
- import { _ as currentLogLineMasker, l as describeAwsErrorDiagnostics, m as verboseAwareText, n as getLogger, p as safeStringify$1, r as isStdoutReservedForPayload, u as describeAwsFailure } from "./logger-DVdLGob_.js";
3
- import { $ as AssetError, G as markRedactedCause, ct as SynthesisError, d as MacroExpansionError, et as CdkdError, it as LockError, k as escapeRegExp, lt as isSoftAbort, nt as DeploymentNotApprovedError, p as DependencyError, st as StateError, t as ambientClientDefaults } from "./ambient-client-defaults-DzKSQvWN.js";
1
+ import { A as displayStackName, C as STACK_REF_MAX_CODE_POINTS, D as displayAwsMessage, O as displayIdent, P as safeMsg, _ as shellQuote, k as displaySafe, m as proseQuoted, o as cdkdRemedy, p as plainOrDescribed, r as SHELL_ACTIVE, w as UNRENDERABLE } from "./version-Byf_RTiH.js";
2
+ import { _ as currentLogLineMasker, l as describeAwsErrorDiagnostics, m as verboseAwareText, n as getLogger, p as safeStringify$1, r as isStdoutReservedForPayload, u as describeAwsFailure } from "./logger-BoDS8cs5.js";
3
+ import { $ as AssetError, G as markRedactedCause, ct as SynthesisError, d as MacroExpansionError, et as CdkdError, it as LockError, k as escapeRegExp, lt as isSoftAbort, nt as DeploymentNotApprovedError, p as DependencyError, st as StateError, t as ambientClientDefaults } from "./ambient-client-defaults-B9_o60dB.js";
4
4
  import { n as awsClientDefaults, r as awsEndpointOverrideActive } from "./aws-client-defaults-DAebi99J.js";
5
5
  import { l as s3ClientDefaults } from "./aws-clients-DOkPjjAW.js";
6
- import { $d as getCdkdAssetBucketName, $u as rebuildClientForBucketRegion, Ad as isDefaultBootstrapRepoName, Bc as siblingsOf, Bd as warnAbsoluteAssetPath, Bu as dropSupersededProviderReplacements, Cc as recordedProvenanceOf, Cd as rememberSynthesizedStacks, Dd as createLazyAssetModeContext, Ec as referenceTokensIn, Fc as namesRecreatedParent, Fl as refuseMalformedResourceEntriesForDeploy, Hc as isLegacyHandleId, Hu as providerReplacementReason, Ic as INTRINSIC_KEYS, Iu as withoutUnwrittenSdkUnwiredProperties, Ku as TemplateParser, Lc as containsIntrinsic, Ld as isCfnTemplateAssetPath, Md as redirectDockerAsset, Nd as redirectFileAsset, Od as flattenAssetPlaceholders, Pu as withoutAcceptedSdkUnwiredProperties, Rc as markNewValueKnownAfterDeploy, Rd as parseAssetManifestBody, Tc as referenceProvenanceOf, Vd as warnWholeAssemblyAsSource, Vo as settleDeclaredMember, Wc as isPlainReferenceTo, Wl as refuseMalformedResourceProperties, Yu as isKnownTokenFreeState, _d as SSM_PARAMETER_VALUE_PREFIX, cf as describeFileReadFailure, cl as inputFingerprinter, dc as AWS_NO_VALUE, dd as missingStateBucketRemedy, df as renderAssemblyPathEscape, ef as getCdkdContainerRepoName, ff as resolveAssemblyPath, if as nullPrototypeRecord, jd as loadPublishableAssetManifest, kd as isDefaultBootstrapBucketName, lf as displayAssemblyPath, md as listNestedTemplateRows, mf as resolveBucketRegion, of as absoluteAssemblyPathEscape, sf as assemblyPathEscape, sl as tryGetTopLevelWriteOnlyProperties, tf as defineOwnKey, ud as stringifyValue, uf as namesTheSameDirectory, ul as movedMaskedProperties, vc as extractGetAttRefs, vd as isListParameterType, xd as purgeNoncurrentKeyVersions, yc as promoteInPlaceAttributeDependents, yd as ssmResolvedValueType, zc as replacementSidesForLog, zd as resolveFileAssetSourcePath, zo as policyDocumentMatchesDeclared } from "./deploy-engine-BsKzx9ys.js";
7
- import { D as parseFailureDebugDetail, E as jsonParseFailureStandIn, T as describeJsonParseFailure, a as getCreateOnlyPropertyPaths, i as createOnlyChangeRequiresReplacement, k as utf8ByteLength } from "./secret-reference-immutable-Bh9gCLFt.js";
6
+ import { $d as resolveAssemblyPath, Bd as getCdkdAssetBucketName, Bu as rebuildClientForBucketRegion, Dd as warnAbsoluteAssetPath, Ed as resolveFileAssetSourcePath, Gd as nullPrototypeRecord, Hd as defineOwnKey, Ho as policyDocumentMatchesDeclared, Jd as assemblyPathEscape, Od as warnWholeAssemblyAsSource, Pu as TemplateParser, Qd as renderAssemblyPathEscape, Qu as missingStateBucketRemedy, Td as parseAssetManifestBody, Vd as getCdkdContainerRepoName, Wo as settleDeclaredMember, Xd as displayAssemblyPath, Yd as describeFileReadFailure, Zd as namesTheSameDirectory, Zu as stringifyValue, _d as isDefaultBootstrapRepoName, ad as isListParameterType, bd as redirectFileAsset, cd as purgeNoncurrentKeyVersions, gd as isDefaultBootstrapBucketName, hd as flattenAssetPlaceholders, id as SSM_PARAMETER_VALUE_PREFIX, md as createLazyAssetModeContext, od as ssmResolvedValueType, qd as absoluteAssemblyPathEscape, td as listNestedTemplateRows, tf as resolveBucketRegion, ud as rememberSynthesizedStacks, vd as loadPublishableAssetManifest, wd as isCfnTemplateAssetPath, yd as redirectDockerAsset } from "./deploy-engine-D6iEbD4R.js";
7
+ import { D as parseFailureDebugDetail, E as jsonParseFailureStandIn, T as describeJsonParseFailure, k as utf8ByteLength } from "./secret-reference-immutable-0mb2D0J5.js";
8
8
  import { r as derivePartitionAndUrlSuffix } from "./aws-partition-DA0r2sr-.js";
9
- import { Lt as maskerOrIdentity, Qt as buildForceUnlockCommand, Zt as UNREPRODUCIBLE_LOCK_CLAUSE, dn as withPasteableAwsProfile, fn as injectiveKey, nn as formatLockOperation, rn as formatLockOwner, tn as formatLockExpiry } from "./created-resource-sink-D7FufEaB.js";
10
- import { t as expectedOwnerParam } from "./expected-bucket-owner-Dr7zxlJn.js";
11
- import { _t as acceptedCreateOnlyDropsOf } from "./delete-started-C8fWcehI.js";
12
- import { _n as splitGetAttStringForm, t as ReplacementRulesRegistry } from "./replacement-rules-DL9MZWSp.js";
13
- import { S as willReplaceGroup, v as REPLACEMENT_TRIGGER_PROPERTIES, y as changedTriggers } from "./ec2-termination-protection-CJjU7OpO.js";
14
- import { S as unsettledPropertiesOf } from "./restore-source-guard-ClcpxInI.js";
9
+ import { Qt as buildForceUnlockCommand, Zt as UNREPRODUCIBLE_LOCK_CLAUSE, dn as withPasteableAwsProfile, fn as injectiveKey, nn as formatLockOperation, rn as formatLockOwner, tn as formatLockExpiry } from "./created-resource-sink-CxezDoaQ.js";
10
+ import { t as expectedOwnerParam } from "./expected-bucket-owner-C2OXO5oD.js";
11
+ import { Cn as splitGetAttStringForm } from "./replacement-rules-BArdRPgU.js";
15
12
  import { randomBytes, randomUUID } from "node:crypto";
16
13
  import { AbortMultipartUploadCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, NoSuchKey, PutObjectCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
17
14
  import { CloudControlClient, GetResourceCommand, ListResourcesCommand } from "@aws-sdk/client-cloudcontrol";
@@ -1060,7 +1057,7 @@ var CcApiContextProvider = class {
1060
1057
  if (exactIdentifier && propertyMatch) throw new Error("CC API context provider: specify either exactIdentifier or propertyMatch, but not both");
1061
1058
  if (!exactIdentifier && !propertyMatch) throw new Error("CC API context provider: neither exactIdentifier nor propertyMatch is specified");
1062
1059
  if (ignoreErrorOnMissingContext && dummyValue === void 0) throw new Error("CC API context provider: if ignoreErrorOnMissingContext is set, a dummyValue must be supplied");
1063
- if (dummyValue !== void 0 && (!Array.isArray(dummyValue) || !dummyValue.every((v) => isPlainObject$1(v)))) throw new Error("CC API context provider: dummyValue must be an array of objects");
1060
+ if (dummyValue !== void 0 && (!Array.isArray(dummyValue) || !dummyValue.every((v) => isPlainObject(v)))) throw new Error("CC API context provider: dummyValue must be an array of objects");
1064
1061
  this.logger.debug(`CC API lookup: ${typeName}${exactIdentifier ? ` (id: ${exactIdentifier})` : ""} (region: ${region})`);
1065
1062
  const client = new CloudControlClient({
1066
1063
  ...ambientClientDefaults(),
@@ -1138,7 +1135,7 @@ var CcApiContextProvider = class {
1138
1135
  return result;
1139
1136
  }
1140
1137
  };
1141
- function isPlainObject$1(value) {
1138
+ function isPlainObject(value) {
1142
1139
  return typeof value === "object" && value !== null && !Array.isArray(value);
1143
1140
  }
1144
1141
  function expectedMatchCountText(expectedMatchCount) {
@@ -2025,7 +2022,7 @@ async function resolveStateBucketWithDefaultAndSource(cliBucket, region, legacyF
2025
2022
  const { GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
2026
2023
  const { S3Client, HeadBucketCommand, ListObjectsV2Command } = await import("@aws-sdk/client-s3");
2027
2024
  const { getAwsClients } = await import("./aws-clients-DOkPjjAW.js").then((n) => n.n);
2028
- const { expectedOwnerParam, recordResolvedAccountId } = await import("./expected-bucket-owner-Dr7zxlJn.js").then((n) => n.n);
2025
+ const { expectedOwnerParam, recordResolvedAccountId } = await import("./expected-bucket-owner-C2OXO5oD.js").then((n) => n.n);
2029
2026
  const probeDeps = {
2030
2027
  HeadBucketCommand,
2031
2028
  ListObjectsV2Command,
@@ -4839,674 +4836,6 @@ var DagBuilder = class {
4839
4836
  }
4840
4837
  };
4841
4838
 
4842
- // src/analyzer/diff-calculator/update-policy-replacement.ts
4843
- function markUpdatePolicyReplacements(changes, desiredTemplate) {
4844
- for (const [logicalId, change] of changes) {
4845
- if (change.changeType !== "UPDATE") continue;
4846
- if (change.resourceType !== "AWS::AutoScaling::AutoScalingGroup") continue;
4847
- const updatePolicy = desiredTemplate.Resources[logicalId]?.UpdatePolicy;
4848
- if (typeof updatePolicy !== "object" || updatePolicy === null) continue;
4849
- if (!willReplaceGroup(updatePolicy)) continue;
4850
- for (const pc of change.propertyChanges ?? []) {
4851
- if (pc.noEchoPromoted === true) continue;
4852
- const top = pc.path.split(/[.[]/)[0] ?? pc.path;
4853
- if (!REPLACEMENT_TRIGGER_PROPERTIES.includes(top)) continue;
4854
- if (pc.inPlacePropagated !== true && pc.replacementPropagated !== true && changedTriggers([top], change.desiredProperties ?? {}, change.currentProperties ?? {}).length === 0) continue;
4855
- pc.requiresReplacement = true;
4856
- pc.updatePolicyReplacement = true;
4857
- }
4858
- }
4859
- }
4860
-
4861
- // src/analyzer/diff-calculator/legacy-handle-heal.ts
4862
- const LEGACY_HANDLE_HEAL_REASON = "issues a signal URL in place of the placeholder id an earlier cdkd recorded";
4863
- function markLegacyHandleHeals(changes, currentResources, desiredTemplate, extractReferences) {
4864
- const legacy = /* @__PURE__ */ new Set();
4865
- for (const [logicalId, record] of Object.entries(currentResources)) if (record.resourceType === "AWS::CloudFormation::WaitConditionHandle" && isLegacyHandleId(record.physicalId) && desiredTemplate.Resources[logicalId]?.Type === "AWS::CloudFormation::WaitConditionHandle") legacy.add(logicalId);
4866
- if (legacy.size === 0) return [];
4867
- const waitedOn = /* @__PURE__ */ new Set();
4868
- for (const resource of Object.values(desiredTemplate.Resources)) {
4869
- if (resource.Type !== "AWS::CloudFormation::WaitCondition") continue;
4870
- for (const ref of extractReferences(resource.Properties?.["Handle"])) if (legacy.has(ref)) waitedOn.add(ref);
4871
- }
4872
- const healed = [];
4873
- for (const handleId of waitedOn) {
4874
- const change = changes.get(handleId);
4875
- if (change === void 0) continue;
4876
- if (change.changeType !== "NO_CHANGE" && change.changeType !== "UPDATE") continue;
4877
- change.changeType = "UPDATE";
4878
- change.propertyChanges ??= [];
4879
- change.providerReplacement = LEGACY_HANDLE_HEAL_REASON;
4880
- healed.push(handleId);
4881
- }
4882
- return healed;
4883
- }
4884
-
4885
- // src/analyzer/diff-calculator/calculate-diff.ts
4886
- async function calculateDiff(currentState, desiredTemplate, resolveFn, canonicalizeProperties, allowedUnsupportedProperties, freshParameters, maskForLog, recreateTargets, maskedInputs, refusalRecovery, noEchoCompare, readProvenance, forcedNestedChildRuns, updatePolicy) {
4887
- const changes = /* @__PURE__ */ new Map();
4888
- refuseMalformedResourceEntriesForDeploy(currentState, void 0, void 0, refusalRecovery);
4889
- refuseMalformedResourceProperties(currentState, void 0, void 0, refusalRecovery);
4890
- const currentResources = currentState.resources;
4891
- const desiredResources = desiredTemplate.Resources;
4892
- this.logger.debug("Calculating diff...");
4893
- this.logger.debug(`Current resources: ${Object.keys(currentResources).length}`);
4894
- this.logger.debug(`Desired resources: ${Object.keys(desiredResources).length}`);
4895
- const processedLogicalIds = /* @__PURE__ */ new Set();
4896
- const rawGetAttRefs = /* @__PURE__ */ new Map();
4897
- for (const [logicalId, desiredResource] of Object.entries(desiredResources)) {
4898
- if (desiredResource.Type === "AWS::CDK::Metadata") continue;
4899
- const perProp = /* @__PURE__ */ new Map();
4900
- for (const [propKey, propValue] of Object.entries(desiredResource.Properties ?? {})) {
4901
- const refs = DiffCalculator.extractGetAttRefs(propValue);
4902
- if (refs.size > 0) perProp.set(propKey, refs);
4903
- }
4904
- if (perProp.size > 0) rawGetAttRefs.set(logicalId, perProp);
4905
- }
4906
- for (const [logicalId, desiredResource] of Object.entries(desiredResources)) {
4907
- if (desiredResource.Type === "AWS::CDK::Metadata") {
4908
- this.logger.debug(`Skipping metadata resource: ${logicalId}`);
4909
- processedLogicalIds.add(logicalId);
4910
- continue;
4911
- }
4912
- processedLogicalIds.add(logicalId);
4913
- const currentResource = currentResources[logicalId];
4914
- if (!currentResource) {
4915
- changes.set(logicalId, {
4916
- logicalId,
4917
- changeType: "CREATE",
4918
- resourceType: desiredResource.Type,
4919
- desiredProperties: desiredResource.Properties || {}
4920
- });
4921
- this.logger.debug(`CREATE: ${logicalId} (${desiredResource.Type})`);
4922
- } else if (currentResource.resourceType !== desiredResource.Type) {
4923
- const propertyChanges = [{
4924
- path: "Type",
4925
- oldValue: currentResource.resourceType,
4926
- newValue: desiredResource.Type,
4927
- requiresReplacement: true
4928
- }];
4929
- changes.set(logicalId, {
4930
- logicalId,
4931
- changeType: "UPDATE",
4932
- resourceType: desiredResource.Type,
4933
- currentProperties: currentResource.properties,
4934
- desiredProperties: desiredResource.Properties || {},
4935
- propertyChanges
4936
- });
4937
- this.logger.debug(`UPDATE (Type change): ${logicalId} (from ${currentResource.resourceType} to ${desiredResource.Type})`);
4938
- } else {
4939
- const rawDesiredProps = desiredResource.Properties || {};
4940
- const resolvedDesiredProps = resolveFn ? await this.resolveBestEffort(rawDesiredProps, resolveFn) : rawDesiredProps;
4941
- const sdkRouted = currentResource.provisionedBy !== "cc-api";
4942
- const desiredAfterDrops = sdkRouted && allowedUnsupportedProperties ? withoutAcceptedSdkUnwiredProperties(desiredResource.Type, resolvedDesiredProps, allowedUnsupportedProperties, currentResource.properties) : resolvedDesiredProps;
4943
- const currentAfterDrops = sdkRouted ? withoutUnwrittenSdkUnwiredProperties(desiredResource.Type, currentResource.properties, resolvedDesiredProps, allowedUnsupportedProperties ?? /* @__PURE__ */ new Set(), acceptedCreateOnlyDropsOf(currentResource)) : currentResource.properties;
4944
- const desiredPropsForCompare = canonicalizeProperties ? canonicalizeProperties(desiredResource.Type, desiredAfterDrops) : desiredAfterDrops;
4945
- const currentPropsForCompare = canonicalizeProperties && sdkRouted ? canonicalizeProperties(desiredResource.Type, currentAfterDrops) : currentAfterDrops;
4946
- const droppedKeys = canonicalizeProperties ? Object.keys(desiredAfterDrops).filter((key) => !Object.hasOwn(desiredPropsForCompare, key)) : [];
4947
- if (droppedKeys.length > 0) this.logger.warn(`${logicalId} (${desiredResource.Type}): part of the declared properties cannot be sent as declared and is ignored when comparing against deployed state — the provider narrows them (${droppedKeys.join(", ")}). Fix the template to declare only what the resource supports; until then changes to the ignored keys have no effect.`);
4948
- else if (canonicalizeProperties && !this.valuesEqual(desiredPropsForCompare, desiredAfterDrops)) this.logger.debug(`${logicalId} (${desiredResource.Type}): the provider normalizes part of the declared properties before sending them; the comparison uses the normalized form. Nothing is dropped.`);
4949
- const noEchoCompared = noEchoCompare?.({
4950
- logicalId,
4951
- resourceType: desiredResource.Type,
4952
- templateProperties: rawDesiredProps,
4953
- desired: desiredPropsForCompare,
4954
- current: currentPropsForCompare
4955
- });
4956
- const desiredCompared = noEchoCompared?.desired ?? desiredPropsForCompare;
4957
- const currentCompared = noEchoCompared?.current ?? currentPropsForCompare;
4958
- const propertyChanges = await this.compareProperties(desiredResource.Type, currentCompared, desiredCompared, maskForLog);
4959
- const reported = new Set(propertyChanges.map((pc) => pc.path));
4960
- const rebaselined = [];
4961
- const moved = await movedMaskedProperties(currentResource, rawDesiredProps, maskedInputs && inputFingerprinter(rawDesiredProps, maskedInputs.sources), maskedInputs?.rebaselined && ((key, fingerprint) => rebaselined.push([key, fingerprint])));
4962
- if (rebaselined.length > 0) maskedInputs.rebaselined.set(logicalId, Object.fromEntries(rebaselined));
4963
- for (const key of moved) {
4964
- if (reported.has(key)) continue;
4965
- if (!Object.hasOwn(currentCompared, key)) continue;
4966
- if (!Object.hasOwn(desiredCompared, key)) continue;
4967
- const oldValue = currentCompared[key];
4968
- const newValue = desiredCompared[key];
4969
- propertyChanges.push({
4970
- path: key,
4971
- oldValue,
4972
- newValue,
4973
- requiresReplacement: await this.maskedEditRequiresReplacement(desiredResource.Type, key, oldValue, newValue, {
4974
- oldProperties: currentCompared,
4975
- newProperties: desiredCompared
4976
- }),
4977
- maskedExpressionChanged: true
4978
- });
4979
- this.logger.debug(safeMsg`${logicalId}: ${key} is recorded masked and its template expression or a resolved input changed`);
4980
- }
4981
- const listed = new Set(propertyChanges.map((pc) => pc.path));
4982
- for (const key of unsettledPropertiesOf(currentResource)) {
4983
- if (listed.has(key)) continue;
4984
- propertyChanges.push({
4985
- path: key,
4986
- oldValue: currentCompared[key],
4987
- newValue: desiredCompared[key],
4988
- requiresReplacement: false,
4989
- unsettled: true
4990
- });
4991
- this.logger.debug(safeMsg`${logicalId}: ${key} is unsettled after a failed update and is sent again`);
4992
- }
4993
- const attributeChanges = this.compareAttributes(currentResource, desiredResource);
4994
- if (propertyChanges.length > 0 || attributeChanges.length > 0) {
4995
- const providerReplacement = propertyChanges.length > 0 ? providerReplacementReason(desiredResource.Type, currentResource, resolvedDesiredProps) : void 0;
4996
- changes.set(logicalId, {
4997
- logicalId,
4998
- changeType: "UPDATE",
4999
- resourceType: desiredResource.Type,
5000
- currentProperties: currentResource.properties,
5001
- desiredProperties: rawDesiredProps,
5002
- propertyChanges,
5003
- ...attributeChanges.length > 0 && { attributeChanges },
5004
- ...providerReplacement !== void 0 && { providerReplacement }
5005
- });
5006
- this.logger.debug(`UPDATE: ${logicalId} (${propertyChanges.length} property changes, ${attributeChanges.length} attribute changes)`);
5007
- } else {
5008
- changes.set(logicalId, {
5009
- logicalId,
5010
- changeType: "NO_CHANGE",
5011
- resourceType: desiredResource.Type,
5012
- currentProperties: currentResource.properties,
5013
- desiredProperties: rawDesiredProps
5014
- });
5015
- this.logger.debug(`NO_CHANGE: ${logicalId}`);
5016
- }
5017
- }
5018
- }
5019
- for (const [logicalId, currentResource] of Object.entries(currentResources)) if (!processedLogicalIds.has(logicalId)) {
5020
- changes.set(logicalId, {
5021
- logicalId,
5022
- changeType: "DELETE",
5023
- resourceType: currentResource.resourceType,
5024
- currentProperties: currentResource.properties
5025
- });
5026
- this.logger.debug(`DELETE: ${logicalId} (${currentResource.resourceType})`);
5027
- }
5028
- for (const logicalId of forcedNestedChildRuns ?? []) {
5029
- const change = changes.get(logicalId);
5030
- if (change?.resourceType !== "AWS::CloudFormation::Stack") continue;
5031
- if (change.changeType === "NO_CHANGE") {
5032
- change.changeType = "UPDATE";
5033
- change.propertyChanges = [];
5034
- }
5035
- if (change.changeType === "UPDATE") change.nestedChildHeal = true;
5036
- }
5037
- const forcedReplacements = /* @__PURE__ */ new Set();
5038
- for (const logicalId of recreateTargets ?? []) {
5039
- const changeType = changes.get(logicalId)?.changeType;
5040
- if (changeType === "NO_CHANGE" || changeType === "UPDATE") forcedReplacements.add(logicalId);
5041
- }
5042
- for (const logicalId of markLegacyHandleHeals(changes, currentResources, desiredTemplate, (v) => this.parser.extractReferences(v))) forcedReplacements.add(logicalId);
5043
- const provenanceChanges = await this.promoteReadProvenanceDependents(changes, currentState, desiredTemplate, readProvenance);
5044
- const syntheticCreateOnlyPaths = await this.loadSyntheticCreateOnlyPaths(changes, desiredTemplate, rawGetAttRefs, freshParameters, forcedReplacements);
5045
- for (const { change, pc, upstreams } of provenanceChanges) {
5046
- const templateValue = desiredTemplate.Resources[change.logicalId]?.Properties?.[pc.path];
5047
- pc.requiresReplacement = this.syntheticRequiresReplacement(change.resourceType, pc.path, syntheticCreateOnlyPaths, upstreams.some((id) => isPlainReferenceTo(templateValue, id, desiredTemplate.Resources[id]?.Type)), siblingsOf(change));
5048
- }
5049
- do {
5050
- if (updatePolicy === true) markUpdatePolicyReplacements(changes, desiredTemplate);
5051
- this.promoteReplacementDependents(changes, desiredTemplate, syntheticCreateOnlyPaths, forcedReplacements);
5052
- } while (this.promoteInPlaceAttributeDependents(changes, desiredTemplate, rawGetAttRefs, syntheticCreateOnlyPaths, freshParameters));
5053
- dropSupersededProviderReplacements(changes);
5054
- const summary = this.getSummary(changes);
5055
- this.logger.debug(`Diff calculated: ${summary.create} CREATE, ${summary.update} UPDATE, ${summary.delete} DELETE, ${summary.noChange} NO_CHANGE`);
5056
- return changes;
5057
- }
5058
-
5059
- // src/analyzer/read-provenance-promotion.ts
5060
- function isPlainObject(value) {
5061
- return value !== null && typeof value === "object" && !Array.isArray(value);
5062
- }
5063
- function readsAcrossStacks(value) {
5064
- if (Array.isArray(value)) return value.some(readsAcrossStacks);
5065
- if (!isPlainObject(value)) return false;
5066
- if (Object.hasOwn(value, "Fn::ImportValue") || Object.hasOwn(value, "Fn::GetStackOutput")) return true;
5067
- return Object.values(value).some(readsAcrossStacks);
5068
- }
5069
- function recordedReadVersions(record) {
5070
- if (!isPlainObject(record) || !Object.hasOwn(record, "referenceProvenance")) return void 0;
5071
- const field = referenceProvenanceOf(record);
5072
- if (field === void 0) return void 0;
5073
- let out;
5074
- for (const [token, entry] of Object.entries(field)) if (entry.readVersions !== void 0 && entry.readVersions.length > 0) (out ??= /* @__PURE__ */ new Map()).set(token, entry.readVersions);
5075
- return out;
5076
- }
5077
- async function readProvenancePromotions(args) {
5078
- const { currentState, desiredTemplate, sources } = args;
5079
- const parser = args.parser ?? new TemplateParser();
5080
- const records = currentState.resources;
5081
- const parameters = isPlainObject(desiredTemplate.Parameters) ? desiredTemplate.Parameters : void 0;
5082
- const out = [];
5083
- for (const { logicalId, changeType } of args.rows) {
5084
- if (changeType !== "NO_CHANGE" && changeType !== "UPDATE") continue;
5085
- const record = Object.hasOwn(records, logicalId) ? records[logicalId] : void 0;
5086
- const readVersions = recordedReadVersions(record);
5087
- if (readVersions === void 0) continue;
5088
- const resource = Object.hasOwn(desiredTemplate.Resources, logicalId) ? desiredTemplate.Resources[logicalId] : void 0;
5089
- const properties = isPlainObject(resource?.Properties) ? resource.Properties : {};
5090
- const reads = [];
5091
- for (const [key, value] of Object.entries(properties)) {
5092
- const referenced = [...parser.extractReferences(value)].filter((id) => id !== logicalId);
5093
- const resourceIds = referenced.filter((id) => Object.hasOwn(desiredTemplate.Resources, id));
5094
- const readsParameter = parameters !== void 0 && referenced.some((id) => Object.hasOwn(parameters, id));
5095
- const crossStack = readsAcrossStacks(value);
5096
- if (resourceIds.length === 0 && !readsParameter && !crossStack) continue;
5097
- reads.push({
5098
- key,
5099
- value,
5100
- resources: resourceIds,
5101
- parameters: readsParameter,
5102
- crossStack
5103
- });
5104
- }
5105
- if (reads.length === 0) continue;
5106
- let crossStackBags = [];
5107
- if (sources?.crossStackOutputs !== void 0) {
5108
- const crossValues = reads.filter((r) => r.crossStack).map((r) => r.value);
5109
- if (crossValues.length > 0) crossStackBags = await sources.crossStackOutputs(crossValues);
5110
- }
5111
- const upstreamIds = new Set(reads.flatMap((r) => r.resources));
5112
- const readsAnyParameter = reads.some((r) => r.parameters);
5113
- const moved = [];
5114
- for (const [token, recorded] of readVersions) {
5115
- const domain = /* @__PURE__ */ new Set();
5116
- let member = false;
5117
- const join = (versions) => {
5118
- if (versions === void 0 || versions.length === 0) return;
5119
- member = true;
5120
- for (const version of versions) domain.add(version);
5121
- };
5122
- for (const id of upstreamIds) {
5123
- const upstream = Object.hasOwn(records, id) ? records[id] : void 0;
5124
- join(recordedProvenanceOf(upstream, token)?.versions);
5125
- }
5126
- if (readsAnyParameter && sources?.inherited !== void 0) join(sources.inherited.get(token)?.versions);
5127
- for (const bag of crossStackBags) if (Object.hasOwn(bag, token)) join(bag[token]?.versions);
5128
- if (!member) continue;
5129
- if (recorded.some((version) => !domain.has(version))) moved.push(token);
5130
- }
5131
- if (moved.length === 0) continue;
5132
- const recordProperties = isPlainObject(record?.properties) ? record.properties : {};
5133
- const keys = [];
5134
- for (const r of reads) {
5135
- if (!Object.hasOwn(recordProperties, r.key)) continue;
5136
- const held = referenceTokensIn(recordProperties[r.key]);
5137
- if (!moved.some((token) => held.has(token))) continue;
5138
- keys.push({
5139
- key: r.key,
5140
- upstreams: r.resources
5141
- });
5142
- }
5143
- if (keys.length === 0) continue;
5144
- out.push({
5145
- logicalId,
5146
- keys,
5147
- tokens: moved
5148
- });
5149
- }
5150
- return out;
5151
- }
5152
-
5153
- // src/analyzer/diff-calculator/promotion.ts
5154
- async function promoteReadProvenanceDependents(changes, currentState, desiredTemplate, sources) {
5155
- if (isKnownTokenFreeState(currentState)) return [];
5156
- const promotions = await readProvenancePromotions({
5157
- rows: changes.values(),
5158
- currentState,
5159
- desiredTemplate,
5160
- sources,
5161
- parser: this.parser
5162
- });
5163
- const out = [];
5164
- for (const promotion of promotions) {
5165
- const change = changes.get(promotion.logicalId);
5166
- if (change === void 0) continue;
5167
- const existingPaths = new Set((change.propertyChanges ?? []).map((pc) => pc.path));
5168
- const synthetic = [];
5169
- for (const { key, upstreams } of promotion.keys) {
5170
- if (existingPaths.has(key)) continue;
5171
- const pc = {
5172
- path: key,
5173
- oldValue: change.currentProperties?.[key],
5174
- newValue: change.desiredProperties?.[key],
5175
- requiresReplacement: false,
5176
- inPlacePropagated: true,
5177
- readProvenancePromoted: true
5178
- };
5179
- synthetic.push(pc);
5180
- out.push({
5181
- change,
5182
- pc,
5183
- upstreams
5184
- });
5185
- }
5186
- if (synthetic.length === 0) continue;
5187
- if (change.changeType === "NO_CHANGE") {
5188
- change.changeType = "UPDATE";
5189
- change.propertyChanges = synthetic;
5190
- } else change.propertyChanges = [...change.propertyChanges ?? [], ...synthetic];
5191
- this.logger.debug(safeMsg`UPDATE (promoted): ${promotion.logicalId} holds a secret reference read at a version its upstream no longer records (${synthetic.map((pc) => pc.path).join(", ")})`);
5192
- }
5193
- return out;
5194
- }
5195
- async function loadSyntheticCreateOnlyPaths(changes, desiredTemplate, rawGetAttRefs, freshParameters, forcedReplacements) {
5196
- const loaded = /* @__PURE__ */ new Map();
5197
- const queue = [...freshParameters ?? []];
5198
- for (const [logicalId, change] of changes) if (change.changeType === "UPDATE" || forcedReplacements.has(logicalId)) queue.push(logicalId);
5199
- if (queue.length === 0) return loaded;
5200
- const readersOf = /* @__PURE__ */ new Map();
5201
- const addEdge = (referencedId, readerId) => {
5202
- if (referencedId === readerId) return;
5203
- let readers = readersOf.get(referencedId);
5204
- if (!readers) {
5205
- readers = /* @__PURE__ */ new Set();
5206
- readersOf.set(referencedId, readers);
5207
- }
5208
- readers.add(readerId);
5209
- };
5210
- for (const [logicalId, resource] of Object.entries(desiredTemplate.Resources)) {
5211
- if (resource.Type === "AWS::CDK::Metadata") continue;
5212
- for (const value of Object.values(resource.Properties ?? {})) for (const referencedId of this.parser.extractReferences(value)) addEdge(referencedId, logicalId);
5213
- for (const perUpstream of rawGetAttRefs.get(logicalId)?.values() ?? []) for (const referencedId of perUpstream.keys()) addEdge(referencedId, logicalId);
5214
- }
5215
- const reached = new Set(queue);
5216
- while (queue.length > 0) for (const readerId of readersOf.get(queue.shift()) ?? []) {
5217
- if (reached.has(readerId)) continue;
5218
- reached.add(readerId);
5219
- queue.push(readerId);
5220
- }
5221
- const candidateKeys = /* @__PURE__ */ new Map();
5222
- for (const logicalId of reached) {
5223
- const change = changes.get(logicalId);
5224
- if (!change) continue;
5225
- if (change.changeType !== "NO_CHANGE" && change.changeType !== "UPDATE") continue;
5226
- for (const [key, value] of Object.entries(change.desiredProperties ?? {})) {
5227
- if (this.replacementRules.isClassified(change.resourceType, key)) continue;
5228
- if (!containsIntrinsic(value)) continue;
5229
- let keys = candidateKeys.get(change.resourceType);
5230
- if (!keys) {
5231
- keys = /* @__PURE__ */ new Set();
5232
- candidateKeys.set(change.resourceType, keys);
5233
- }
5234
- keys.add(key);
5235
- }
5236
- }
5237
- const types = candidateKeys.keys();
5238
- await Promise.all([...types].map(async (type) => {
5239
- const whole = new Set((await getCreateOnlyPropertyPaths(type)).filter((path) => path.length === 1).map((path) => path[0]));
5240
- if (![...candidateKeys.get(type)].some((key) => whole.has(key))) {
5241
- loaded.set(type, {
5242
- whole,
5243
- unconfirmable: /* @__PURE__ */ new Set()
5244
- });
5245
- return;
5246
- }
5247
- const writeOnly = await tryGetTopLevelWriteOnlyProperties(type);
5248
- if (writeOnly === void 0) {
5249
- this.logger.debug(safeMsg`Write-only properties of ${type} unknown: no create-only replacement ceiling for its promoted readers but a plain reference to a replaced resource`);
5250
- loaded.set(type, {
5251
- whole,
5252
- unconfirmable: "all"
5253
- });
5254
- return;
5255
- }
5256
- loaded.set(type, {
5257
- whole,
5258
- unconfirmable: new Set([...whole].filter((key) => writeOnly.has(key)))
5259
- });
5260
- }));
5261
- return loaded;
5262
- }
5263
- function syntheticRequiresReplacement(resourceType, propKey, syntheticCreateOnlyPaths, plainReference, siblings) {
5264
- if (this.replacementRules.requiresReplacement(resourceType, propKey, void 0, void 0, siblings)) return true;
5265
- if (this.replacementRules.isClassified(resourceType, propKey)) return false;
5266
- const createOnly = syntheticCreateOnlyPaths.get(resourceType);
5267
- if (createOnly === void 0 || !createOnly.whole.has(propKey)) return false;
5268
- if (plainReference) return true;
5269
- return createOnly.unconfirmable !== "all" && !createOnly.unconfirmable.has(propKey);
5270
- }
5271
- function promoteReplacementDependents(changes, desiredTemplate, syntheticCreateOnlyPaths, forcedReplacements) {
5272
- const queue = [];
5273
- for (const [logicalId, change] of changes) if (forcedReplacements.has(logicalId) || change.changeType === "UPDATE" && change.propertyChanges?.some((pc) => pc.requiresReplacement && pc.noEchoPromoted !== true)) queue.push(logicalId);
5274
- if (queue.length === 0) return;
5275
- const dependentsOf = /* @__PURE__ */ new Map();
5276
- for (const [logicalId, resource] of Object.entries(desiredTemplate.Resources)) {
5277
- if (resource.Type === "AWS::CDK::Metadata") continue;
5278
- for (const [propKey, propValue] of Object.entries(resource.Properties ?? {})) for (const referencedId of this.parser.extractReferences(propValue)) {
5279
- if (referencedId === logicalId) continue;
5280
- let dependents = dependentsOf.get(referencedId);
5281
- if (!dependents) {
5282
- dependents = /* @__PURE__ */ new Map();
5283
- dependentsOf.set(referencedId, dependents);
5284
- }
5285
- let propKeys = dependents.get(logicalId);
5286
- if (!propKeys) {
5287
- propKeys = /* @__PURE__ */ new Set();
5288
- dependents.set(logicalId, propKeys);
5289
- }
5290
- propKeys.add(propKey);
5291
- }
5292
- }
5293
- const enqueued = new Set(queue);
5294
- while (queue.length > 0) {
5295
- const replacedId = queue.shift();
5296
- const dependents = dependentsOf.get(replacedId);
5297
- if (!dependents) continue;
5298
- for (const [dependentId, refPropKeys] of dependents) {
5299
- const change = changes.get(dependentId);
5300
- if (!change) continue;
5301
- if (change.changeType !== "NO_CHANGE" && change.changeType !== "UPDATE") continue;
5302
- const existingPaths = new Set((change.propertyChanges ?? []).map((pc) => pc.path));
5303
- const syntheticChanges = [];
5304
- for (const propKey of refPropKeys) {
5305
- if (existingPaths.has(propKey)) {
5306
- markNewValueKnownAfterDeploy(change, propKey);
5307
- continue;
5308
- }
5309
- const oldValue = change.currentProperties?.[propKey];
5310
- const newValue = change.desiredProperties?.[propKey];
5311
- syntheticChanges.push({
5312
- path: propKey,
5313
- oldValue,
5314
- newValue,
5315
- replacementPropagated: true,
5316
- requiresReplacement: this.syntheticRequiresReplacement(change.resourceType, propKey, syntheticCreateOnlyPaths, isPlainReferenceTo(desiredTemplate.Resources[dependentId]?.Properties?.[propKey], replacedId, desiredTemplate.Resources[replacedId]?.Type), siblingsOf(change)) || namesRecreatedParent(change.resourceType, propKey, changes.get(replacedId)?.resourceType)
5317
- });
5318
- }
5319
- if (syntheticChanges.length === 0) continue;
5320
- if (change.changeType === "NO_CHANGE") {
5321
- change.changeType = "UPDATE";
5322
- change.propertyChanges = syntheticChanges;
5323
- this.logger.debug(`UPDATE (promoted): ${dependentId} references replaced resource ${replacedId} via ${[...refPropKeys].join(", ")}`);
5324
- } else {
5325
- change.propertyChanges = [...change.propertyChanges ?? [], ...syntheticChanges];
5326
- this.logger.debug(`UPDATE (augmented): ${dependentId} references replaced resource ${replacedId} via ${[...refPropKeys].join(", ")}`);
5327
- }
5328
- if (!enqueued.has(dependentId) && change.propertyChanges.some((pc) => pc.requiresReplacement)) {
5329
- enqueued.add(dependentId);
5330
- queue.push(dependentId);
5331
- }
5332
- }
5333
- }
5334
- }
5335
-
5336
- // src/analyzer/diff-calculator/compare.ts
5337
- async function resolveBestEffort(properties, resolveFn) {
5338
- const resolved = {};
5339
- for (const [key, value] of Object.entries(properties)) try {
5340
- const resolvedValue = await resolveFn(structuredClone(value));
5341
- if (resolvedValue === AWS_NO_VALUE) continue;
5342
- resolved[key] = resolvedValue;
5343
- } catch {
5344
- resolved[key] = value;
5345
- }
5346
- return resolved;
5347
- }
5348
- function compareAttributes(currentResource, desiredResource) {
5349
- const changes = [];
5350
- if (currentResource.deletionPolicy !== desiredResource.DeletionPolicy) changes.push({
5351
- attribute: "DeletionPolicy",
5352
- oldValue: currentResource.deletionPolicy,
5353
- newValue: desiredResource.DeletionPolicy
5354
- });
5355
- if (currentResource.updateReplacePolicy !== desiredResource.UpdateReplacePolicy) changes.push({
5356
- attribute: "UpdateReplacePolicy",
5357
- oldValue: currentResource.updateReplacePolicy,
5358
- newValue: desiredResource.UpdateReplacePolicy
5359
- });
5360
- return changes;
5361
- }
5362
- async function compareProperties(resourceType, currentProperties, desiredProperties, maskForLog) {
5363
- const changes = [];
5364
- const allKeys = /* @__PURE__ */ new Set([...Object.keys(currentProperties), ...Object.keys(desiredProperties)]);
5365
- let createOnlyPaths;
5366
- for (const key of allKeys) {
5367
- const oldValue = currentProperties[key];
5368
- const newValue = desiredProperties[key];
5369
- if (!this.valuesEqual(oldValue, newValue)) {
5370
- let requiresReplacement = this.replacementRules.requiresReplacement(resourceType, key, oldValue, newValue, {
5371
- oldProperties: currentProperties,
5372
- newProperties: desiredProperties
5373
- });
5374
- if (!requiresReplacement && !this.replacementRules.isClassified(resourceType, key)) {
5375
- if (createOnlyPaths === void 0) createOnlyPaths = await getCreateOnlyPropertyPaths(resourceType);
5376
- if (createOnlyChangeRequiresReplacement(createOnlyPaths, key, oldValue, newValue, (a, b) => this.valuesEqual(a, b))) {
5377
- requiresReplacement = true;
5378
- this.logger.debug(`Property ${key} of ${resourceType} changed a createOnly path per the CFn schema — requires replacement`);
5379
- }
5380
- }
5381
- changes.push({
5382
- path: key,
5383
- oldValue,
5384
- newValue,
5385
- requiresReplacement
5386
- });
5387
- if (requiresReplacement) {
5388
- const mask = maskerOrIdentity(maskForLog);
5389
- const [oldText, newText] = replacementSidesForLog(oldValue, newValue, mask);
5390
- this.logger.debug(mask(safeMsg`Property ${mask(key)} of ${mask(resourceType)} requires replacement (from ${oldText} to ${newText})`));
5391
- }
5392
- }
5393
- }
5394
- return changes;
5395
- }
5396
- async function maskedEditRequiresReplacement(resourceType, key, oldValue, newValue, siblings) {
5397
- if (this.replacementRules.requiresReplacement(resourceType, key, oldValue, newValue, siblings)) return true;
5398
- if (this.replacementRules.isClassified(resourceType, key) && this.replacementRules.conditionalReplacementVerdict(resourceType, key, oldValue, newValue, siblings) === void 0) return false;
5399
- return (await getCreateOnlyPropertyPaths(resourceType)).some((path) => path.length === 1 && path[0] === key);
5400
- }
5401
- function isIntrinsic(value) {
5402
- if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) return false;
5403
- const keys = Object.keys(value);
5404
- return keys.length === 1 && DiffCalculator.INTRINSIC_KEYS.has(keys[0]);
5405
- }
5406
- function valuesEqual(a, b) {
5407
- if (a === b) return true;
5408
- if (a == null || b == null) return a === b;
5409
- if (DiffCalculator.isIntrinsic(a) !== DiffCalculator.isIntrinsic(b)) return false;
5410
- if (Array.isArray(a) && Array.isArray(b)) {
5411
- if (a.length !== b.length) return false;
5412
- return a.every((val, index) => this.valuesEqual(val, b[index]));
5413
- }
5414
- if (typeof a === "object" && typeof b === "object") {
5415
- const aObj = a;
5416
- const bObj = b;
5417
- const aKeys = Object.keys(aObj);
5418
- const bKeys = Object.keys(bObj);
5419
- if (aKeys.length !== bKeys.length) return false;
5420
- for (const key of bKeys) {
5421
- if (!Object.hasOwn(aObj, key)) return false;
5422
- if (!this.valuesEqual(aObj[key], bObj[key])) return false;
5423
- }
5424
- return true;
5425
- }
5426
- return false;
5427
- }
5428
-
5429
- // src/analyzer/diff-calculator.ts
5430
- var DiffCalculator = class {
5431
- logger = getLogger().child("DiffCalculator");
5432
- replacementRules = new ReplacementRulesRegistry();
5433
- parser = new TemplateParser();
5434
- conditionalReplacementVerdict(resourceType, propertyPath, oldValue, newValue, siblings) {
5435
- return this.replacementRules.conditionalReplacementVerdict(resourceType, propertyPath, oldValue, newValue, siblings);
5436
- }
5437
- calculateDiff(currentState, desiredTemplate, resolveFn, canonicalizeProperties, allowedUnsupportedProperties, freshParameters, maskForLog, recreateTargets, maskedInputs, refusalRecovery, noEchoCompare, readProvenance, forcedNestedChildRuns, updatePolicy) {
5438
- return calculateDiff.call(this, currentState, desiredTemplate, resolveFn, canonicalizeProperties, allowedUnsupportedProperties, freshParameters, maskForLog, recreateTargets, maskedInputs, refusalRecovery, noEchoCompare, readProvenance, forcedNestedChildRuns, updatePolicy);
5439
- }
5440
- promoteReadProvenanceDependents(changes, currentState, desiredTemplate, sources) {
5441
- return promoteReadProvenanceDependents.call(this, changes, currentState, desiredTemplate, sources);
5442
- }
5443
- loadSyntheticCreateOnlyPaths(changes, desiredTemplate, rawGetAttRefs, freshParameters, forcedReplacements) {
5444
- return loadSyntheticCreateOnlyPaths.call(this, changes, desiredTemplate, rawGetAttRefs, freshParameters, forcedReplacements);
5445
- }
5446
- syntheticRequiresReplacement(resourceType, propKey, syntheticCreateOnlyPaths, plainReference, siblings) {
5447
- return syntheticRequiresReplacement.call(this, resourceType, propKey, syntheticCreateOnlyPaths, plainReference, siblings);
5448
- }
5449
- promoteReplacementDependents(changes, desiredTemplate, syntheticCreateOnlyPaths, forcedReplacements) {
5450
- return promoteReplacementDependents.call(this, changes, desiredTemplate, syntheticCreateOnlyPaths, forcedReplacements);
5451
- }
5452
- promoteInPlaceAttributeDependents(changes, desiredTemplate, rawGetAttRefs, syntheticCreateOnlyPaths, freshParameters) {
5453
- return promoteInPlaceAttributeDependents.call(this, changes, desiredTemplate, rawGetAttRefs, syntheticCreateOnlyPaths, freshParameters);
5454
- }
5455
- static extractGetAttRefs(value) {
5456
- return extractGetAttRefs(value);
5457
- }
5458
- resolveBestEffort(properties, resolveFn) {
5459
- return resolveBestEffort.call(this, properties, resolveFn);
5460
- }
5461
- compareAttributes(currentResource, desiredResource) {
5462
- return compareAttributes.call(this, currentResource, desiredResource);
5463
- }
5464
- compareProperties(resourceType, currentProperties, desiredProperties, maskForLog) {
5465
- return compareProperties.call(this, resourceType, currentProperties, desiredProperties, maskForLog);
5466
- }
5467
- maskedEditRequiresReplacement(resourceType, key, oldValue, newValue, siblings) {
5468
- return maskedEditRequiresReplacement.call(this, resourceType, key, oldValue, newValue, siblings);
5469
- }
5470
- static INTRINSIC_KEYS = INTRINSIC_KEYS;
5471
- static isIntrinsic(value) {
5472
- return isIntrinsic(value);
5473
- }
5474
- valuesEqual(a, b) {
5475
- return valuesEqual.call(this, a, b);
5476
- }
5477
- getSummary(changes) {
5478
- const summary = {
5479
- create: 0,
5480
- update: 0,
5481
- delete: 0,
5482
- noChange: 0,
5483
- total: changes.size
5484
- };
5485
- for (const change of changes.values()) switch (change.changeType) {
5486
- case "CREATE":
5487
- summary.create++;
5488
- break;
5489
- case "UPDATE":
5490
- summary.update++;
5491
- break;
5492
- case "DELETE":
5493
- summary.delete++;
5494
- break;
5495
- case "NO_CHANGE": summary.noChange++;
5496
- }
5497
- return summary;
5498
- }
5499
- filterByType(changes, type) {
5500
- return Array.from(changes.values()).filter((change) => change.changeType === type);
5501
- }
5502
- hasChanges(changes) {
5503
- return Array.from(changes.values()).some((change) => change.changeType !== "NO_CHANGE");
5504
- }
5505
- getReplacementChanges(changes) {
5506
- return Array.from(changes.values()).filter((change) => change.changeType === "UPDATE" && change.propertyChanges?.some((pc) => pc.requiresReplacement));
5507
- }
5508
- };
5509
-
5510
4839
  // src/provisioning/settle-own-write-members.ts
5511
4840
  async function settleOwnWriteMembers(result, members, delaysMs, unsettled) {
5512
4841
  await Promise.all(members.map(async (member) => {
@@ -5639,5 +4968,5 @@ function principalOwnWriteMembers(properties, reads, removed) {
5639
4968
  return members;
5640
4969
  }
5641
4970
 
5642
- export { MIGRATE_TMP_PREFIX as $, formatDockerLoginError as A, resolveApp as B, redactDockerArgvValues as C, warnFinchArgvExposure as D, partitionSensitiveEnv as E, Synthesizer as F, resolveStateBucketWithDefaultAndSource as G, resolveCaptureObservedState as H, synthesisStatusMessage as I, resolveUseCdkBootstrapAssets as J, resolveStateBucketWithSource as K, getDefaultStateBucketName as L, runDockerForeground as M, runDockerStreaming as N, isDockerClientEnvKey as O, abortInFlightMultipartUploads as P, CFN_TEMPLATE_URL_LIMIT as Q, getLegacyStateBucketName as R, redactedDockerCause as S, finchSecretArgvRefusal as T, resolveSkipPrefix as U, resolveAutoAssetStorage as V, resolveStateBucketWithDefault as W, warnDeprecatedNoPrefixCliFlag as X, stateBucketExistenceConfirmed as Y, CFN_TEMPLATE_BODY_LIMIT as Z, resolveDockerContextDirectory as _, principalOwnWriteMembers as a, bindLegacyStackAssetParameters as at, describeDockerFailure as b, stringListMember as c, predictedAutoCreatedAssetMode as ct, DagBuilder as d, processStackMessages as dt, findLargeInlineResources as et, LockManager as f, setChildProcessAwsEnv as ft, buildDockerImage as g, WorkGraph as h, mergeDeclaredEntries as i, StageLoadError as it, getDockerCmd as j, isMalformedEnvKey as k, DiffCalculator as l, prepareLegacyStackAssets as lt, AssetPublisher as m, injectedAwsRegionValue as mt, declaredStringList as n, refuseFailedLookups as nt, settleOwnWriteMembers as o, createLegacyAssetParameterBinder as ot, isLockInfoExpired as p, injectAwsRegion as pt, resolveUpdatePolicy as q, inlinePoliciesAreDeclared as r, AssemblyReader as rt, stringListIsDeclared as s, legacyPlanAssetCount as st, declaredInlinePolicies as t, uploadCfnTemplate as tt, LEGACY_HANDLE_HEAL_REASON as u, CdkToolkitBucketMissingError as ut, describeDockerCapturedOutput as v, dockerSpawnEnvWithSensitive as w, redactedCause as x, describeDockerExecFailure as y, loadCdkJson as z };
5643
- //# sourceMappingURL=settle-own-write-members-B-g5oflo.js.map
4971
+ export { uploadCfnTemplate as $, runDockerForeground as A, resolveCaptureObservedState as B, finchSecretArgvRefusal as C, isMalformedEnvKey as D, isDockerClientEnvKey as E, getDefaultStateBucketName as F, resolveUpdatePolicy as G, resolveStateBucketWithDefault as H, getLegacyStateBucketName as I, warnDeprecatedNoPrefixCliFlag as J, resolveUseCdkBootstrapAssets as K, loadCdkJson as L, abortInFlightMultipartUploads as M, Synthesizer as N, formatDockerLoginError as O, synthesisStatusMessage as P, findLargeInlineResources as Q, resolveApp as R, dockerSpawnEnvWithSensitive as S, warnFinchArgvExposure as T, resolveStateBucketWithDefaultAndSource as U, resolveSkipPrefix as V, resolveStateBucketWithSource as W, CFN_TEMPLATE_URL_LIMIT as X, CFN_TEMPLATE_BODY_LIMIT as Y, MIGRATE_TMP_PREFIX as Z, describeDockerExecFailure as _, principalOwnWriteMembers as a, legacyPlanAssetCount as at, redactedDockerCause as b, stringListMember as c, CdkToolkitBucketMissingError as ct, isLockInfoExpired as d, injectAwsRegion as dt, refuseFailedLookups as et, AssetPublisher as f, injectedAwsRegionValue as ft, describeDockerCapturedOutput as g, resolveDockerContextDirectory as h, mergeDeclaredEntries as i, createLegacyAssetParameterBinder as it, runDockerStreaming as j, getDockerCmd as k, DagBuilder as l, processStackMessages as lt, buildDockerImage as m, declaredStringList as n, StageLoadError as nt, settleOwnWriteMembers as o, predictedAutoCreatedAssetMode as ot, WorkGraph as p, stateBucketExistenceConfirmed as q, inlinePoliciesAreDeclared as r, bindLegacyStackAssetParameters as rt, stringListIsDeclared as s, prepareLegacyStackAssets as st, declaredInlinePolicies as t, AssemblyReader as tt, LockManager as u, setChildProcessAwsEnv as ut, describeDockerFailure as v, partitionSensitiveEnv as w, redactDockerArgvValues as x, redactedCause as y, resolveAutoAssetStorage as z };
4972
+ //# sourceMappingURL=settle-own-write-members-DPTK_vVK.js.map