cdk-real-drift 0.3.3 → 0.3.5

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
@@ -4629,7 +4629,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4629
4629
  };
4630
4630
  }
4631
4631
  if (resourceType === "AWS::KMS::Key" && opts.accountId !== void 0) {
4632
- const partition = opts.region?.startsWith("cn-") ? "aws-cn" : opts.region?.startsWith("us-gov-") ? "aws-us-gov" : "aws";
4632
+ const partition = opts.region !== void 0 ? partitionForRegion(opts.region).partition : "aws";
4633
4633
  knownDef = {
4634
4634
  ...knownDef,
4635
4635
  KeyPolicy: canonicalizePolicy({
@@ -4658,7 +4658,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
4658
4658
  };
4659
4659
  }
4660
4660
  if (physicalId && opts.accountId !== void 0 && declared["Policy"]) {
4661
- const arnPrefix = `arn:${opts.region?.startsWith("cn-") ? "aws-cn" : opts.region?.startsWith("us-gov-") ? "aws-us-gov" : "aws"}:execute-api:${opts.region ?? ""}:${opts.accountId}:${physicalId}`;
4661
+ const arnPrefix = `arn:${opts.region !== void 0 ? partitionForRegion(opts.region).partition : "aws"}:execute-api:${opts.region ?? ""}:${opts.accountId}:${physicalId}`;
4662
4662
  declared["Policy"] = canonicalizePolicy(expandExecuteApiResources(declared["Policy"], arnPrefix));
4663
4663
  }
4664
4664
  }
@@ -5072,7 +5072,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
5072
5072
  }
5073
5073
  const ctxArnTemplate = CONTEXT_ARN_DEFAULTS[resourceType]?.[k];
5074
5074
  if (ctxArnTemplate !== void 0 && opts.region !== void 0 && opts.accountId !== void 0 && typeof v === "string") {
5075
- const partition = opts.region.startsWith("cn-") ? "aws-cn" : opts.region.startsWith("us-gov-") ? "aws-us-gov" : "aws";
5075
+ const partition = partitionForRegion(opts.region).partition;
5076
5076
  if (v === ctxArnTemplate.replace("{partition}", partition).replace("{region}", opts.region).replace("{accountId}", opts.accountId)) {
5077
5077
  findings.push({
5078
5078
  tier: "atDefault",
@@ -12974,6 +12974,7 @@ async function runRecord(args) {
12974
12974
  config = await loadConfig();
12975
12975
  } catch (e) {
12976
12976
  console.error(`error: ${e.message}`);
12977
+ if (a.json) emitJsonArray([]);
12977
12978
  return 2;
12978
12979
  }
12979
12980
  let stacks;
@@ -13081,6 +13082,7 @@ async function runIgnore(args) {
13081
13082
  config = await loadConfig();
13082
13083
  } catch (e) {
13083
13084
  console.error(`error: ${e.message}`);
13085
+ if (a.json) emitJsonArray([]);
13084
13086
  return 2;
13085
13087
  }
13086
13088
  let stacks;
@@ -14289,6 +14291,7 @@ async function runRevert(args) {
14289
14291
  config = await loadConfig();
14290
14292
  } catch (e) {
14291
14293
  console.error(`error: ${e.message}`);
14294
+ if (a.json) emitJsonArray([]);
14292
14295
  return 2;
14293
14296
  }
14294
14297
  let stacks;
@@ -14502,12 +14505,14 @@ async function main(argv) {
14502
14505
  return 2;
14503
14506
  }
14504
14507
  }
14505
- main(process.argv.slice(2)).then((code) => flushAndExit(code)).catch((e) => {
14508
+ const argv = process.argv.slice(2);
14509
+ main(argv).then((code) => flushAndExit(code)).catch((e) => {
14506
14510
  const msg = e?.message ?? String(e);
14507
14511
  if (/credential|could not load cred|security token/i.test(msg)) console.error("error: no AWS credentials available. Configure them (aws configure / AWS_PROFILE / env vars) and retry.");
14508
14512
  else if (/stack/i.test(msg) && /(does not exist|ValidationError)/i.test(msg)) console.error("error: stack not found in this account/region. Check the stack name and --region.");
14509
14513
  else if (/AccessDenied|not authorized/i.test(msg)) console.error(`error: access denied — ${msg}`);
14510
14514
  else console.error(`error: ${msg}`);
14515
+ if (argv.includes("--json")) console.log("[]");
14511
14516
  return flushAndExit(2);
14512
14517
  });
14513
14518