cdk-real-drift 0.12.47 → 0.12.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3835,16 +3835,7 @@ function parseIpv6Groups(addr) {
3835
3835
  ...tailGroups
3836
3836
  ];
3837
3837
  }
3838
- function canonicalIpv6Cidr(s) {
3839
- const slash = s.indexOf("/");
3840
- if (slash === -1) return void 0;
3841
- const addr = s.slice(0, slash);
3842
- const prefixStr = s.slice(slash + 1);
3843
- if (!/^\d{1,3}$/.test(prefixStr)) return void 0;
3844
- const prefix = Number.parseInt(prefixStr, 10);
3845
- if (prefix < 0 || prefix > 128) return void 0;
3846
- const groups = parseIpv6Groups(addr);
3847
- if (!groups) return void 0;
3838
+ function formatCanonicalIpv6(groups) {
3848
3839
  let bestStart = -1;
3849
3840
  let bestLen = 0;
3850
3841
  let curStart = -1;
@@ -3861,13 +3852,29 @@ function canonicalIpv6Cidr(s) {
3861
3852
  curLen = 0;
3862
3853
  }
3863
3854
  const hex = groups.map((g) => g.toString(16));
3864
- let addrOut;
3865
- if (bestLen >= 2) addrOut = `${hex.slice(0, bestStart).join(":")}::${hex.slice(bestStart + bestLen).join(":")}`;
3866
- else addrOut = hex.join(":");
3867
- return `${addrOut}/${prefix}`;
3855
+ if (bestLen >= 2) return `${hex.slice(0, bestStart).join(":")}::${hex.slice(bestStart + bestLen).join(":")}`;
3856
+ return hex.join(":");
3857
+ }
3858
+ function canonicalIpv6Cidr(s) {
3859
+ const slash = s.indexOf("/");
3860
+ if (slash === -1) return void 0;
3861
+ const addr = s.slice(0, slash);
3862
+ const prefixStr = s.slice(slash + 1);
3863
+ if (!/^\d{1,3}$/.test(prefixStr)) return void 0;
3864
+ const prefix = Number.parseInt(prefixStr, 10);
3865
+ if (prefix < 0 || prefix > 128) return void 0;
3866
+ const groups = parseIpv6Groups(addr);
3867
+ if (!groups) return void 0;
3868
+ return `${formatCanonicalIpv6(groups)}/${prefix}`;
3869
+ }
3870
+ function canonicalIpv6Address(s) {
3871
+ if (s.includes("/")) return void 0;
3872
+ const groups = parseIpv6Groups(s);
3873
+ if (!groups) return void 0;
3874
+ return formatCanonicalIpv6(groups);
3868
3875
  }
3869
3876
  function canonicalizeIpv6CidrsDeep(v) {
3870
- if (typeof v === "string") return canonicalIpv6Cidr(v) ?? v;
3877
+ if (typeof v === "string") return canonicalIpv6Cidr(v) ?? canonicalIpv6Address(v) ?? v;
3871
3878
  if (Array.isArray(v)) return v.map(canonicalizeIpv6CidrsDeep);
3872
3879
  if (v && typeof v === "object") {
3873
3880
  const out = {};
@@ -5453,13 +5460,12 @@ function twinOverlapEchoes(source, twin) {
5453
5460
  return true;
5454
5461
  }
5455
5462
  function applyDefinitionSubstitutions(definitionString, substitutions) {
5456
- let out = definitionString;
5457
- for (const [key, value] of Object.entries(substitutions)) {
5458
- if (value === null || typeof value === "object") continue;
5459
- const token = `\${${key}}`;
5460
- out = out.split(token).join(String(value));
5461
- }
5462
- return out;
5463
+ return definitionString.replace(/\$\{([^}]+)\}/g, (match, key) => {
5464
+ if (!(key in substitutions)) return match;
5465
+ const value = substitutions[key];
5466
+ if (value === null || typeof value === "object") return match;
5467
+ return String(value);
5468
+ });
5463
5469
  }
5464
5470
  const IAM_ATTACHMENT_SUBSET = { "AWS::IAM::ManagedPolicy": new Set([
5465
5471
  "Roles",
@@ -7451,7 +7457,9 @@ function diffSnsTopicChildren(input) {
7451
7457
  resourceType: "AWS::SNS::Subscription",
7452
7458
  identifier: s.arn,
7453
7459
  label: s.label ?? s.arn,
7454
- live: { SubscriptionArn: s.arn }
7460
+ live: { SubscriptionArn: s.arn },
7461
+ ownerAccountId: s.owner,
7462
+ scopeArns: s.endpoint?.startsWith("arn:") ? [s.endpoint] : void 0
7455
7463
  });
7456
7464
  }
7457
7465
  return added;
@@ -7483,7 +7491,8 @@ async function enumerateSnsTopicChildren(ctx) {
7483
7491
  }), topicArn)).filter((s) => typeof s.SubscriptionArn === "string" && s.SubscriptionArn.startsWith("arn:")).map((s) => ({
7484
7492
  arn: s.SubscriptionArn,
7485
7493
  label: s.Protocol ? `${s.Protocol} ${s.Endpoint ?? ""}`.trim() : s.SubscriptionArn,
7486
- endpoint: s.Endpoint
7494
+ endpoint: s.Endpoint,
7495
+ owner: s.Owner
7487
7496
  }))
7488
7497
  });
7489
7498
  }
@@ -11921,6 +11930,11 @@ function isDefinitiveNotManaged(physicalId, accountId, region) {
11921
11930
  if (arnAccount !== "" && arnAccount !== accountId) return false;
11922
11931
  return true;
11923
11932
  }
11933
+ function hasForeignScopeSignal(c, accountId, region) {
11934
+ const owner = c.ownerAccountId;
11935
+ if (typeof owner === "string" && owner !== "" && owner !== accountId) return true;
11936
+ return (c.scopeArns ?? []).some((arn) => arn.startsWith("arn:") && !isDefinitiveNotManaged(arn, accountId, region));
11937
+ }
11924
11938
  async function probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, region) {
11925
11939
  const cached = cache.get(physicalId);
11926
11940
  if (cached !== void 0) return cached;
@@ -11948,7 +11962,7 @@ async function probeSiblingPhysicalId(cfn, c, physicalId, cache, accountId, regi
11948
11962
  }
11949
11963
  }
11950
11964
  } catch (e) {
11951
- if (e.name === "ValidationError" && isDefinitiveNotManaged(physicalId, accountId, region)) {
11965
+ if (e.name === "ValidationError" && isDefinitiveNotManaged(physicalId, accountId, region) && !hasForeignScopeSignal(c, accountId, region)) {
11952
11966
  cache.set(physicalId, "notManaged");
11953
11967
  return "notManaged";
11954
11968
  }