cdk-real-drift 0.9.7 → 0.9.8

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
@@ -4023,6 +4023,40 @@ function typeChangeReplaceInfo(changed, templateResources, deployedTypeOf, stack
4023
4023
  const more = changed.length > shown.length ? `, …(+${changed.length - shown.length} more)` : "";
4024
4024
  return `info: ${stackName}: ${changed.length} resource(s) changed Type at the same logical id — the next deploy will REPLACE them (old resource deleted, new created): ${shown.join(", ")}${more}`;
4025
4025
  }
4026
+ function collectReferencedNames(node, out = /* @__PURE__ */ new Set()) {
4027
+ if (Array.isArray(node)) {
4028
+ for (const x of node) collectReferencedNames(x, out);
4029
+ return out;
4030
+ }
4031
+ if (node && typeof node === "object") for (const [k, v] of Object.entries(node)) if (k === "Ref" && typeof v === "string") out.add(v);
4032
+ else if (k === "Fn::Sub") {
4033
+ const tmpl = Array.isArray(v) ? v[0] : v;
4034
+ if (typeof tmpl === "string") for (const m of tmpl.matchAll(/\$\{([^}]+)\}/g)) {
4035
+ const name = m[1]?.trim();
4036
+ if (!name || name.startsWith("!")) continue;
4037
+ const base = name.split(".")[0];
4038
+ if (base) out.add(base);
4039
+ }
4040
+ collectReferencedNames(v, out);
4041
+ } else collectReferencedNames(v, out);
4042
+ return out;
4043
+ }
4044
+ function unpreviewableParamInfo(template, stackParams, stackName) {
4045
+ const paramDefs = template.Parameters ?? {};
4046
+ const noValue = Object.entries(paramDefs).filter(([k, def]) => {
4047
+ if (def?.NoEcho === true || def?.NoEcho === "true") return false;
4048
+ if ((def?.Type ?? "").includes("::Parameter::Value<")) return false;
4049
+ if (def && "Default" in def) return false;
4050
+ return !(k in stackParams);
4051
+ }).map(([k]) => k);
4052
+ if (noValue.length === 0) return null;
4053
+ const referenced = collectReferencedNames(template.Resources ?? {});
4054
+ const unpreviewable = noValue.filter((k) => referenced.has(k)).sort();
4055
+ if (unpreviewable.length === 0) return null;
4056
+ const shown = unpreviewable.slice(0, 10);
4057
+ const more = unpreviewable.length > shown.length ? `, …(+${unpreviewable.length - shown.length} more)` : "";
4058
+ return `warning: ${stackName}: ${unpreviewable.length} local parameter(s) have NO value under --pre-deploy (new/renamed, no Default, absent from the deployed stack) — every declared property that Refs them resolves UNRESOLVED and was NOT compared (cannot preview): ${shown.join(", ")}${more}`;
4059
+ }
4026
4060
  function partitionForRegion(region) {
4027
4061
  if (region.startsWith("us-gov-")) return {
4028
4062
  partition: "aws-us-gov",
@@ -4157,6 +4191,8 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
4157
4191
  if (templateOverride) {
4158
4192
  const deletedInfo = deletedResourceInfo(physIds, template, stackName);
4159
4193
  if (deletedInfo) console.error(deletedInfo);
4194
+ const noValueInfo = unpreviewableParamInfo(template, stackParams, stackName);
4195
+ if (noValueInfo) console.error(noValueInfo);
4160
4196
  }
4161
4197
  const templateResourcesForTypeCheck = template.Resources ?? {};
4162
4198
  const typeChanged = new Set(typeChangedResources(templateResourcesForTypeCheck, deployedTypeOf));