cdk-real-drift 0.2.58 → 0.2.59

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
@@ -12728,9 +12728,9 @@ const INFO_TIERS = [
12728
12728
  ];
12729
12729
  function formatFinding(f, stackName = "") {
12730
12730
  const id = f.constructPath ? withinStackPath(f.constructPath, stackName) : f.logicalId;
12731
- const pathDisplay = f.attributeKey ? `${f.path}[${f.attributeKey}]` : f.path;
12731
+ const pathDisplay = f.attributeKey ? `${f.path}[${sanitizeForTerminal(f.attributeKey)}]` : f.path;
12732
12732
  let s = `${pathDisplay ? `${id}.${pathDisplay}` : id} (${f.resourceType})`;
12733
- if (f.note) s += ` — ${f.note}`;
12733
+ if (f.note) s += ` — ${sanitizeForTerminal(f.note)}`;
12734
12734
  if (f.tier === "declared") if (isRecord(f.desired) && isRecord(f.actual)) s += formatMapDelta(f.desired, f.actual, false);
12735
12735
  else {
12736
12736
  const { a: d, b: act } = jPair(f.desired, f.actual);
@@ -12743,7 +12743,7 @@ function formatFinding(f, stackName = "") {
12743
12743
  }
12744
12744
  else if (f.tier === "undeclared" && f.arrayDelta) s += formatArrayDelta(f.arrayDelta);
12745
12745
  else if (f.tier === "undeclared" || f.tier === "atDefault" || f.tier === "generated") s += `\n actual =${style.actual(j(f.actual))}`;
12746
- if (f.hint) s += `\n ${style.note(`↳ ${f.hint}`)}`;
12746
+ if (f.hint) s += `\n ${style.note(`↳ ${sanitizeForTerminal(f.hint)}`)}`;
12747
12747
  return s;
12748
12748
  }
12749
12749
  const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -12757,9 +12757,10 @@ function formatMapDelta(desired, actual, baselineLabels) {
12757
12757
  if (inD && Object.hasOwn(actual, k)) {
12758
12758
  if (deepEqual(desired[k], actual[k])) continue;
12759
12759
  const { a, b } = jPair(desired[k], actual[k]);
12760
- s += `\n ~ ${k}\n ${lhs}=${style.desired(a)}\n ${rhs}=${style.actual(b)}`;
12761
- } else if (inD) s += `\n - ${k} (in ${baselineLabels ? "baseline" : "template"}, absent in live)\n ${lhs}=${style.desired(j(desired[k]))}`;
12762
- else s += `\n + ${k} (in live, not in ${baselineLabels ? "baseline" : "template"})\n ${rhs}=${style.actual(j(actual[k]))}`;
12760
+ const sk = sanitizeForTerminal(k);
12761
+ s += `\n ~ ${sk}\n ${lhs}=${style.desired(a)}\n ${rhs}=${style.actual(b)}`;
12762
+ } else if (inD) s += `\n - ${sanitizeForTerminal(k)} (in ${baselineLabels ? "baseline" : "template"}, absent in live)\n ${lhs}=${style.desired(j(desired[k]))}`;
12763
+ else s += `\n + ${sanitizeForTerminal(k)} (in live, not in ${baselineLabels ? "baseline" : "template"})\n ${rhs}=${style.actual(j(actual[k]))}`;
12763
12764
  }
12764
12765
  if (s === "") {
12765
12766
  const { a, b } = jPair(desired, actual);
@@ -12770,13 +12771,13 @@ function formatMapDelta(desired, actual, baselineLabels) {
12770
12771
  function formatArrayDelta(d) {
12771
12772
  const baseline = (v) => `\n baseline=${style.desired(j(v))}`;
12772
12773
  const actual = (v) => `\n actual =${style.actual(j(v))}`;
12773
- let s = ` — ${d.identityField}-keyed element(s) changed vs .cdkrd baseline:`;
12774
- for (const a of d.added) s += `\n + [${a.id}]${actual(a.value)}`;
12774
+ let s = ` — ${sanitizeForTerminal(d.identityField)}-keyed element(s) changed vs .cdkrd baseline:`;
12775
+ for (const a of d.added) s += `\n + [${sanitizeForTerminal(a.id)}]${actual(a.value)}`;
12775
12776
  for (const c of d.changed) {
12776
12777
  const { a: base, b: act } = jPair(c.recorded, c.actual);
12777
- s += `\n ~ [${c.id}]\n baseline=${style.desired(base)}\n actual =${style.actual(act)}`;
12778
+ s += `\n ~ [${sanitizeForTerminal(c.id)}]\n baseline=${style.desired(base)}\n actual =${style.actual(act)}`;
12778
12779
  }
12779
- for (const r of d.removed) s += `\n - [${r.id}]${baseline(r.value)}`;
12780
+ for (const r of d.removed) s += `\n - [${sanitizeForTerminal(r.id)}]${baseline(r.value)}`;
12780
12781
  return s;
12781
12782
  }
12782
12783
  function tierStyle(t) {
@@ -12919,6 +12920,14 @@ function j(v) {
12919
12920
  const s = JSON.stringify(v);
12920
12921
  return s && s.length > VALUE_CAP ? safeSlice(s, 0, VALUE_CAP) + "…" : s ?? String(v);
12921
12922
  }
12923
+ function sanitizeForTerminal(s) {
12924
+ let out = "";
12925
+ for (const ch of s) {
12926
+ const code = ch.charCodeAt(0);
12927
+ out += code < 32 || code === 127 ? `\\x${code.toString(16).padStart(2, "0")}` : ch;
12928
+ }
12929
+ return out;
12930
+ }
12922
12931
  function jPair(a, b) {
12923
12932
  const as = JSON.stringify(a) ?? String(a);
12924
12933
  const bs = JSON.stringify(b) ?? String(b);