cdk-real-drift 0.2.48 → 0.2.50
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 +60 -17
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -744,7 +744,12 @@ async function resolveStacks(a) {
|
|
|
744
744
|
};
|
|
745
745
|
const known = () => discovered.map((s) => s.stackName).join(", ") || "none";
|
|
746
746
|
for (const name of a.stackNames) if (isGlob(name)) {
|
|
747
|
-
|
|
747
|
+
let matched = 0;
|
|
748
|
+
for (const s of discovered) if (matchesGlob(name, s.stackName)) {
|
|
749
|
+
matched++;
|
|
750
|
+
add(s.stackName, s.region ?? fallbackRegion, s.template);
|
|
751
|
+
}
|
|
752
|
+
if (matched === 0) throw new Error(`glob "${name}" matched no stacks defined by the CDK app (found: ${known()})`);
|
|
748
753
|
} else {
|
|
749
754
|
const hit = discovered.find((s) => s.stackName === name);
|
|
750
755
|
if (!hit) throw new Error(`stack "${name}" is not defined by the CDK app (found: ${known()})`);
|
|
@@ -2888,9 +2893,13 @@ function isEqualUnorderedScalarSet(a, b) {
|
|
|
2888
2893
|
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
2889
2894
|
const scalar = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean";
|
|
2890
2895
|
if (!a.every(scalar) || !b.every(scalar)) return false;
|
|
2891
|
-
const
|
|
2892
|
-
|
|
2893
|
-
|
|
2896
|
+
const key = (v) => {
|
|
2897
|
+
if (typeof v === "number") return `num:${v}`;
|
|
2898
|
+
if (typeof v === "string" && DECIMAL_RE.test(v.trim())) return `num:${Number(v)}`;
|
|
2899
|
+
return `${typeof v}:${String(v)}`;
|
|
2900
|
+
};
|
|
2901
|
+
const sa = a.map(key).sort();
|
|
2902
|
+
const sb = b.map(key).sort();
|
|
2894
2903
|
return sa.every((v, i) => v === sb[i]);
|
|
2895
2904
|
}
|
|
2896
2905
|
const READGAP_COLLECTION_PATHS = {
|
|
@@ -3008,6 +3017,12 @@ function isStringlyEqualScalar(a, b) {
|
|
|
3008
3017
|
if (prim(b) && typeof a === "string") return eq(b, a);
|
|
3009
3018
|
return false;
|
|
3010
3019
|
}
|
|
3020
|
+
function isNumericStringEqualScalar(a, b) {
|
|
3021
|
+
const num = (v) => typeof v === "number" ? v : typeof v === "string" && DECIMAL_RE.test(v.trim()) ? Number(v) : void 0;
|
|
3022
|
+
const na = num(a);
|
|
3023
|
+
const nb = num(b);
|
|
3024
|
+
return na !== void 0 && nb !== void 0 && na === nb;
|
|
3025
|
+
}
|
|
3011
3026
|
function isStringlyEqualScalarArray(a, b) {
|
|
3012
3027
|
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
3013
3028
|
const scalar = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean";
|
|
@@ -3248,8 +3263,9 @@ function buildResolverContext(template, stackParams, physIds, region, accountId,
|
|
|
3248
3263
|
};
|
|
3249
3264
|
}
|
|
3250
3265
|
const exportsCache = /* @__PURE__ */ new Map();
|
|
3251
|
-
async function listExports(client, region) {
|
|
3252
|
-
const
|
|
3266
|
+
async function listExports(client, accountId, region) {
|
|
3267
|
+
const cacheKey = `${accountId}:${region}`;
|
|
3268
|
+
const cached = exportsCache.get(cacheKey);
|
|
3253
3269
|
if (cached) return cached;
|
|
3254
3270
|
const exports = {};
|
|
3255
3271
|
let next;
|
|
@@ -3258,7 +3274,7 @@ async function listExports(client, region) {
|
|
|
3258
3274
|
for (const e of res.Exports ?? []) if (e.Name) exports[e.Name] = e.Value ?? "";
|
|
3259
3275
|
next = res.NextToken;
|
|
3260
3276
|
} while (next);
|
|
3261
|
-
exportsCache.set(
|
|
3277
|
+
exportsCache.set(cacheKey, exports);
|
|
3262
3278
|
return exports;
|
|
3263
3279
|
}
|
|
3264
3280
|
async function listStackResources(client, stackName) {
|
|
@@ -3309,7 +3325,12 @@ async function loadDesired(client, stackName, region, templateOverride, recovery
|
|
|
3309
3325
|
const ctx = buildResolverContext(template, stackParams, physIds, region, accountId, stackName, stackId);
|
|
3310
3326
|
const notificationArns = stack?.NotificationARNs ?? [];
|
|
3311
3327
|
if (notificationArns.length > 0) ctx.params["AWS::NotificationARNs"] = notificationArns;
|
|
3312
|
-
if (JSON.stringify(template).includes("Fn::ImportValue"))
|
|
3328
|
+
if (JSON.stringify(template).includes("Fn::ImportValue")) try {
|
|
3329
|
+
ctx.exports = await listExports(client, accountId, region);
|
|
3330
|
+
} catch (err) {
|
|
3331
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
3332
|
+
console.error(`warning: ${stackName}: cloudformation:ListExports failed — Fn::ImportValue references will resolve UNRESOLVED (their declared properties are skipped, not compared). Grant cloudformation:ListExports for full coverage. (${msg})`);
|
|
3333
|
+
}
|
|
3313
3334
|
const resources = [];
|
|
3314
3335
|
const principalsWithSiblingPolicy = collectPrincipalsWithSiblingPolicies(template.Resources ?? {}, ctx);
|
|
3315
3336
|
const clustersWithSiblingCapacityProviders = collectClustersWithSiblingCapacityProviders(template.Resources ?? {});
|
|
@@ -4030,6 +4051,7 @@ function isPolicySubsetOf(sub, sup) {
|
|
|
4030
4051
|
}
|
|
4031
4052
|
function matchesKnownDefault(live, def) {
|
|
4032
4053
|
if (deepEqual(live, def)) return true;
|
|
4054
|
+
if (!isNestedObject(live) && !isNestedObject(def)) return isNumericStringEqualScalar(live, def);
|
|
4033
4055
|
if (!isNestedObject(live) || !isNestedObject(def)) return false;
|
|
4034
4056
|
return Object.entries(live).every(([k, v]) => k in def ? matchesKnownDefault(v, def[k]) : isTrivialEmpty(v));
|
|
4035
4057
|
}
|
|
@@ -4866,11 +4888,22 @@ const READ_RETRY = {
|
|
|
4866
4888
|
//#endregion
|
|
4867
4889
|
//#region src/read/kms-aliases.ts
|
|
4868
4890
|
const cache$1 = /* @__PURE__ */ new Map();
|
|
4891
|
+
/** True when the error is a DEFINITIVE access-denial (cacheable), NOT a transient blip.
|
|
4892
|
+
* Matches an AccessDenied(Exception) / UnauthorizedOperation by name or code, or the AWS
|
|
4893
|
+
* HTTP 403 status. Anything else (throttle, network, 5xx, timeout) is treated as
|
|
4894
|
+
* transient and must NOT be cached. */
|
|
4895
|
+
function isDefinitiveDenial(err) {
|
|
4896
|
+
const e = err;
|
|
4897
|
+
if (!e) return false;
|
|
4898
|
+
const definitive = /^(AccessDenied(Exception)?|UnauthorizedOperation)$/;
|
|
4899
|
+
if (e.name && definitive.test(e.name)) return true;
|
|
4900
|
+
if (e.code && definitive.test(e.code)) return true;
|
|
4901
|
+
return e.$metadata?.httpStatusCode === 403;
|
|
4902
|
+
}
|
|
4869
4903
|
async function fetchManagedAliasTargets(region) {
|
|
4870
4904
|
const cached = cache$1.get(region);
|
|
4871
4905
|
if (cached) return cached;
|
|
4872
4906
|
const targets = {};
|
|
4873
|
-
let result;
|
|
4874
4907
|
try {
|
|
4875
4908
|
const c = new KMSClient({
|
|
4876
4909
|
region,
|
|
@@ -4885,18 +4918,27 @@ async function fetchManagedAliasTargets(region) {
|
|
|
4885
4918
|
for (const a of r.Aliases ?? []) if (a.AliasName?.startsWith("alias/aws/") && a.TargetKeyId) targets[a.AliasName] = a.TargetKeyId;
|
|
4886
4919
|
marker = r.Truncated ? r.NextMarker : void 0;
|
|
4887
4920
|
} while (marker);
|
|
4888
|
-
result = {
|
|
4921
|
+
const result = {
|
|
4889
4922
|
targets,
|
|
4890
4923
|
denied: false
|
|
4891
4924
|
};
|
|
4892
|
-
|
|
4893
|
-
result
|
|
4925
|
+
cache$1.set(region, result);
|
|
4926
|
+
return result;
|
|
4927
|
+
} catch (e) {
|
|
4928
|
+
if (isDefinitiveDenial(e)) {
|
|
4929
|
+
const result = {
|
|
4930
|
+
targets: {},
|
|
4931
|
+
denied: true
|
|
4932
|
+
};
|
|
4933
|
+
cache$1.set(region, result);
|
|
4934
|
+
return result;
|
|
4935
|
+
}
|
|
4936
|
+
return {
|
|
4894
4937
|
targets: {},
|
|
4895
|
-
denied: true
|
|
4938
|
+
denied: true,
|
|
4939
|
+
transient: true
|
|
4896
4940
|
};
|
|
4897
4941
|
}
|
|
4898
|
-
cache$1.set(region, result);
|
|
4899
|
-
return result;
|
|
4900
4942
|
}
|
|
4901
4943
|
/** The one-line warning emitted when ListAliases is denied but the stack declares an
|
|
4902
4944
|
* AWS-managed alias: the managed-vs-customer key check degrades to shape-only, which
|
|
@@ -8397,10 +8439,11 @@ const EMPTY = {
|
|
|
8397
8439
|
freeFormMapPaths: []
|
|
8398
8440
|
};
|
|
8399
8441
|
async function getSchemaInfo(client, resourceType) {
|
|
8400
|
-
const
|
|
8442
|
+
const cacheKey = `${await client.config.region()}\0${resourceType}`;
|
|
8443
|
+
const cached = cache.get(cacheKey);
|
|
8401
8444
|
if (cached) return cached;
|
|
8402
8445
|
const info = await fetch$1(client, resourceType);
|
|
8403
|
-
cache.set(
|
|
8446
|
+
cache.set(cacheKey, info);
|
|
8404
8447
|
return info;
|
|
8405
8448
|
}
|
|
8406
8449
|
const OVERRIDE_READABLE_WRITEONLY = {
|