cdk-real-drift 0.9.5 → 0.9.6

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
@@ -3593,6 +3593,7 @@ function alignNameValueSubset(declared, live, spec) {
3593
3593
  }
3594
3594
  const UNORDERED_ARRAY_PROPS = {
3595
3595
  "AWS::CloudFront::Distribution": new Set(["DistributionConfig.Restrictions.GeoRestriction.Locations"]),
3596
+ "AWS::Cognito::UserPool": new Set(["EnabledMfas"]),
3596
3597
  "AWS::Cognito::UserPoolClient": new Set([
3597
3598
  "AllowedOAuthFlows",
3598
3599
  "AllowedOAuthScopes",
@@ -6958,6 +6959,7 @@ function diffEventBusChildren(input) {
6958
6959
  const added = [];
6959
6960
  for (const r of input.liveRules) {
6960
6961
  if (declared.has(r.name)) continue;
6962
+ const siblingLookupId = input.isDefaultBus ? r.name : `${input.busName}|${r.name}`;
6961
6963
  added.push({
6962
6964
  resourceType: "AWS::Events::Rule",
6963
6965
  identifier: r.arn,
@@ -6965,7 +6967,8 @@ function diffEventBusChildren(input) {
6965
6967
  live: {
6966
6968
  Name: r.name,
6967
6969
  Arn: r.arn
6968
- }
6970
+ },
6971
+ siblingLookupId
6969
6972
  });
6970
6973
  }
6971
6974
  return added;
@@ -6997,16 +7000,19 @@ async function enumerateEventBusChildren(ctx) {
6997
7000
  const raw = r.physicalId ?? (typeof r.declared.Name === "string" ? r.declared.Name : void 0);
6998
7001
  if (raw) declaredRuleNames.push(raw.includes("|") ? raw.slice(raw.lastIndexOf("|") + 1) : raw);
6999
7002
  }
7003
+ const liveRules = (await pageRules(new EventBridgeClient({
7004
+ region,
7005
+ ...READ_RETRY
7006
+ }), busName)).filter((r) => typeof r.Name === "string" && typeof r.Arn === "string" && !r.ManagedBy).map((r) => ({
7007
+ name: r.Name,
7008
+ arn: r.Arn,
7009
+ label: r.Name
7010
+ }));
7000
7011
  return diffEventBusChildren({
7012
+ busName,
7013
+ isDefaultBus: busName === "default",
7001
7014
  declaredRuleNames,
7002
- liveRules: (await pageRules(new EventBridgeClient({
7003
- region,
7004
- ...READ_RETRY
7005
- }), busName)).filter((r) => typeof r.Name === "string" && typeof r.Arn === "string" && !r.ManagedBy).map((r) => ({
7006
- name: r.Name,
7007
- arn: r.Arn,
7008
- label: r.Name
7009
- }))
7015
+ liveRules
7010
7016
  });
7011
7017
  }
7012
7018
  function diffUserPoolChildren(input) {
@@ -10412,8 +10418,8 @@ async function readAddedModel(cc, cfn, c, schemas, oaiCanonicalIds) {
10412
10418
  }
10413
10419
  }
10414
10420
  async function isManagedBySiblingStack(cfn, c, cache) {
10415
- const physicalId = c.identifier;
10416
- if (physicalId.includes("|")) return "notManaged";
10421
+ const physicalId = c.siblingLookupId ?? c.identifier;
10422
+ if (c.siblingLookupId === void 0 && physicalId.includes("|")) return "notManaged";
10417
10423
  const cached = cache.get(physicalId);
10418
10424
  if (cached !== void 0) return cached;
10419
10425
  let managed = false;
@@ -14392,6 +14398,7 @@ async function applyRevertDelete(cc, item, identifier = item.physicalId, retry =
14392
14398
  const isDrift = (f) => (f.tier === "deleted" || f.tier === "added" || f.tier === "declared" || f.tier === "undeclared") && !f.unrecorded;
14393
14399
  const driftCount = (findings) => findings.filter(isDrift).length;
14394
14400
  const unrecordedCount = (findings) => findings.filter((f) => f.unrecorded === true).length;
14401
+ const findingKeyOf = (f) => `${f.logicalId}::${f.path}${f.attributeKey !== void 0 ? `[${f.attributeKey}]` : ""}`;
14395
14402
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
14396
14403
  /**
14397
14404
  * The per-stack label shown in a DECISION prompt — the SAME `Name (region)` form the
@@ -14976,7 +14983,7 @@ function augmentRevertPlan(plan, schemas, liveByLogical, declaredByLogical) {
14976
14983
  };
14977
14984
  }
14978
14985
  async function revertStack(p) {
14979
- const { stackName, region, gathered, baseline, config, dryRun, yes, removeUnrecorded, verbose, interactive, autoSelectAll, waitMs, waitNow, waitSleep } = p;
14986
+ const { stackName, region, gathered, baseline, config, dryRun, yes, removeUnrecorded, verbose, interactive, autoSelectAll, selectedFindingKeys, waitMs, waitNow, waitSleep } = p;
14980
14987
  const out = p.json ? () => {} : console.log;
14981
14988
  let worst = 0;
14982
14989
  const includeRemovals = includeUnrecordedRemovals(removeUnrecorded, interactive, yes);
@@ -14986,7 +14993,7 @@ async function revertStack(p) {
14986
14993
  constructPathByLogical: constructPathsByLogical(gathered.desired.resources),
14987
14994
  allLogicalIds: gathered.desired.resources.map((r) => r.logicalId)
14988
14995
  };
14989
- const drifted = applyIgnores(applyBaseline(gathered.findings, baseline, {
14996
+ const reconciled = applyIgnores(applyBaseline(gathered.findings, baseline, {
14990
14997
  ...baselineOpts,
14991
14998
  warn: console.error
14992
14999
  }), {
@@ -14994,6 +15001,7 @@ async function revertStack(p) {
14994
15001
  accountId: gathered.desired.accountId,
14995
15002
  region
14996
15003
  }, config);
15004
+ const drifted = selectedFindingKeys === void 0 ? reconciled : reconciled.filter((f) => selectedFindingKeys.has(findingKeyOf(f)));
14997
15005
  const resByLogical = new Map(gathered.desired.resources.map((res) => [res.logicalId, res]));
14998
15006
  const declaredForLogical = (logicalId) => resByLogical.get(logicalId)?.declared;
14999
15007
  const augment = (pl) => augmentRevertPlan(pl, gathered.schemas, gathered.liveByLogical, declaredForLogical);
@@ -16310,11 +16318,12 @@ async function perFinding(p, decidable) {
16310
16318
  region: p.region,
16311
16319
  gathered: {
16312
16320
  desired: p.desired,
16313
- findings: p.findings.filter((f) => revertKeys.has(keyOf(f))),
16321
+ findings: p.findings,
16314
16322
  schemas: p.schemas,
16315
16323
  liveByLogical: p.liveByLogical
16316
16324
  },
16317
16325
  baseline: p.baseline,
16326
+ selectedFindingKeys: revertKeys,
16318
16327
  config: p.config,
16319
16328
  dryRun: false,
16320
16329
  yes: false,