cdk-real-drift 0.5.2 → 0.5.3
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 +26 -2
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10657,7 +10657,12 @@ function carryForwardUnreadable(recorded, existing, findings) {
|
|
|
10657
10657
|
const unreadable = new Set(findings.filter((f) => f.tier === "skipped" || f.modelReadFailed).map((f) => f.logicalId));
|
|
10658
10658
|
if (unreadable.size === 0) return recorded;
|
|
10659
10659
|
const present = new Set(recorded.map(recordedKey));
|
|
10660
|
-
const
|
|
10660
|
+
const isUnread = (e) => {
|
|
10661
|
+
if (unreadable.has(e.logicalId)) return true;
|
|
10662
|
+
const parent = addedChildParentLogicalId(e.logicalId);
|
|
10663
|
+
return parent !== void 0 && unreadable.has(parent);
|
|
10664
|
+
};
|
|
10665
|
+
const preserved = prior.filter((e) => isUnread(e) && !present.has(recordedKey(e)));
|
|
10661
10666
|
return preserved.length === 0 ? recorded : [...recorded, ...preserved];
|
|
10662
10667
|
}
|
|
10663
10668
|
/**
|
|
@@ -10861,6 +10866,10 @@ function selectRecorded(findings, selectedKeys) {
|
|
|
10861
10866
|
function pathSegments$1(path) {
|
|
10862
10867
|
return path.replace(/\[([^\]]*)\]/g, ".$1").split(".").filter((s) => s.length > 0);
|
|
10863
10868
|
}
|
|
10869
|
+
function addedChildParentLogicalId(logicalId) {
|
|
10870
|
+
const slash = logicalId.indexOf("/");
|
|
10871
|
+
return slash < 0 ? void 0 : logicalId.slice(0, slash);
|
|
10872
|
+
}
|
|
10864
10873
|
function descendDeclared(node, seg) {
|
|
10865
10874
|
if (node === null || typeof node !== "object") return void 0;
|
|
10866
10875
|
if (Array.isArray(node)) {
|
|
@@ -10979,6 +10988,8 @@ function applyBaseline(findings, baseline, opts = {}) {
|
|
|
10979
10988
|
const currentPaths = new Set(findings.filter((f) => f.tier === "undeclared" || f.tier === "atDefault" || f.tier === "generated").map((f) => `${f.logicalId}.${f.path}`));
|
|
10980
10989
|
const skippedLogical = new Set(findings.filter((f) => f.tier === "skipped").map((f) => f.logicalId));
|
|
10981
10990
|
const deletedLogical = new Set(findings.filter((f) => f.tier === "deleted").map((f) => f.logicalId));
|
|
10991
|
+
const presentAddedLogical = new Set(findings.filter((f) => f.tier === "added").map((f) => f.logicalId));
|
|
10992
|
+
const readParentLogical = new Set(findings.filter((f) => f.tier !== "skipped" && f.tier !== "deleted").map((f) => f.logicalId));
|
|
10982
10993
|
const declaredDriftByLogical = /* @__PURE__ */ new Map();
|
|
10983
10994
|
for (const f of findings) {
|
|
10984
10995
|
if (f.tier !== "declared") continue;
|
|
@@ -10992,7 +11003,20 @@ function applyBaseline(findings, baseline, opts = {}) {
|
|
|
10992
11003
|
const replacedStale = [];
|
|
10993
11004
|
const typeMismatchStale = [];
|
|
10994
11005
|
for (const a of recorded) {
|
|
10995
|
-
if (a.path === "")
|
|
11006
|
+
if (a.path === "") {
|
|
11007
|
+
if (presentAddedLogical.has(a.logicalId)) continue;
|
|
11008
|
+
const parent = addedChildParentLogicalId(a.logicalId);
|
|
11009
|
+
if (!(parent !== void 0 && readParentLogical.has(parent))) continue;
|
|
11010
|
+
kept.push({
|
|
11011
|
+
tier: "deleted",
|
|
11012
|
+
logicalId: a.logicalId,
|
|
11013
|
+
resourceType: a.resourceType,
|
|
11014
|
+
...opts.constructPathByLogical?.get(a.logicalId) !== void 0 && { constructPath: opts.constructPathByLogical.get(a.logicalId) },
|
|
11015
|
+
path: "",
|
|
11016
|
+
note: "recorded added resource removed since record"
|
|
11017
|
+
});
|
|
11018
|
+
continue;
|
|
11019
|
+
}
|
|
10996
11020
|
if (isTypeVoid(a)) {
|
|
10997
11021
|
typeMismatchStale.push(`${a.logicalId}.${a.path}`);
|
|
10998
11022
|
continue;
|