aws-cdk 2.1029.4 → 2.1031.0

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/lib/index.js CHANGED
@@ -3478,7 +3478,7 @@ var require_semver2 = __commonJS({
3478
3478
  // ../@aws-cdk/cloud-assembly-schema/cli-version.json
3479
3479
  var require_cli_version = __commonJS({
3480
3480
  "../@aws-cdk/cloud-assembly-schema/cli-version.json"(exports2, module2) {
3481
- module2.exports = { version: "2.1029.4" };
3481
+ module2.exports = { version: "2.1031.0" };
3482
3482
  }
3483
3483
  });
3484
3484
 
@@ -6781,7 +6781,7 @@ var require_cloud_assembly = __commonJS({
6781
6781
  var jsiiDeprecationWarnings = require_warnings_jsii();
6782
6782
  var JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
6783
6783
  var fs43 = require("fs");
6784
- var os13 = require("os");
6784
+ var os14 = require("os");
6785
6785
  var path38 = require("path");
6786
6786
  var cloudformation_artifact_1 = require_cloudformation_artifact();
6787
6787
  var nested_cloud_assembly_artifact_1 = require_nested_cloud_assembly_artifact();
@@ -7094,7 +7094,7 @@ var require_cloud_assembly = __commonJS({
7094
7094
  }
7095
7095
  __name(ignore, "ignore");
7096
7096
  function determineOutputDirectory(outdir) {
7097
- return outdir ?? fs43.mkdtempSync(path38.join(fs43.realpathSync(os13.tmpdir()), "cdk.out"));
7097
+ return outdir ?? fs43.mkdtempSync(path38.join(fs43.realpathSync(os14.tmpdir()), "cdk.out"));
7098
7098
  }
7099
7099
  __name(determineOutputDirectory, "determineOutputDirectory");
7100
7100
  function ensureDirSync(dir) {
@@ -62467,7 +62467,7 @@ var require_dist_cjs2 = __commonJS({
62467
62467
  Fields: /* @__PURE__ */ __name(() => Fields, "Fields"),
62468
62468
  HttpRequest: /* @__PURE__ */ __name(() => HttpRequest10, "HttpRequest"),
62469
62469
  HttpResponse: /* @__PURE__ */ __name(() => HttpResponse4, "HttpResponse"),
62470
- IHttpRequest: /* @__PURE__ */ __name(() => import_types5.HttpRequest, "IHttpRequest"),
62470
+ IHttpRequest: /* @__PURE__ */ __name(() => import_types6.HttpRequest, "IHttpRequest"),
62471
62471
  getHttpHandlerExtensionConfiguration: /* @__PURE__ */ __name(() => getHttpHandlerExtensionConfiguration3, "getHttpHandlerExtensionConfiguration"),
62472
62472
  isValidHostname: /* @__PURE__ */ __name(() => isValidHostname, "isValidHostname"),
62473
62473
  resolveHttpHandlerRuntimeConfig: /* @__PURE__ */ __name(() => resolveHttpHandlerRuntimeConfig3, "resolveHttpHandlerRuntimeConfig")
@@ -62494,7 +62494,7 @@ var require_dist_cjs2 = __commonJS({
62494
62494
  httpHandler: httpHandlerExtensionConfiguration.httpHandler()
62495
62495
  };
62496
62496
  }, "resolveHttpHandlerRuntimeConfig");
62497
- var import_types5 = require_dist_cjs();
62497
+ var import_types6 = require_dist_cjs();
62498
62498
  var Field = class {
62499
62499
  static {
62500
62500
  __name(this, "Field");
@@ -62502,7 +62502,7 @@ var require_dist_cjs2 = __commonJS({
62502
62502
  static {
62503
62503
  __name2(this, "Field");
62504
62504
  }
62505
- constructor({ name, kind = import_types5.FieldPosition.HEADER, values = [] }) {
62505
+ constructor({ name, kind = import_types6.FieldPosition.HEADER, values = [] }) {
62506
62506
  this.name = name;
62507
62507
  this.kind = kind;
62508
62508
  this.values = values;
@@ -63042,8 +63042,8 @@ var require_dist_cjs6 = __commonJS({
63042
63042
  normalizeProvider: /* @__PURE__ */ __name(() => normalizeProvider4, "normalizeProvider")
63043
63043
  });
63044
63044
  module2.exports = __toCommonJS2(index_exports);
63045
- var import_types5 = require_dist_cjs();
63046
- var getSmithyContext9 = /* @__PURE__ */ __name2((context) => context[import_types5.SMITHY_CONTEXT_KEY] || (context[import_types5.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext");
63045
+ var import_types6 = require_dist_cjs();
63046
+ var getSmithyContext9 = /* @__PURE__ */ __name2((context) => context[import_types6.SMITHY_CONTEXT_KEY] || (context[import_types6.SMITHY_CONTEXT_KEY] = {}), "getSmithyContext");
63047
63047
  var normalizeProvider4 = /* @__PURE__ */ __name2((input) => {
63048
63048
  if (typeof input === "function") return input;
63049
63049
  const promisified = Promise.resolve(input);
@@ -72765,7 +72765,7 @@ var require_dist_cjs26 = __commonJS({
72765
72765
  }
72766
72766
  };
72767
72767
  var import_protocols12 = (init_protocols(), __toCommonJS(protocols_exports));
72768
- var import_types5 = require_dist_cjs();
72768
+ var import_types6 = require_dist_cjs();
72769
72769
  var import_schema25 = (init_schema4(), __toCommonJS(schema_exports));
72770
72770
  var SENSITIVE_STRING3 = "***SensitiveInformation***";
72771
72771
  function schemaLogFilter(schema, data3) {
@@ -72841,7 +72841,7 @@ var require_dist_cjs26 = __commonJS({
72841
72841
  commandName,
72842
72842
  inputFilterSensitiveLog,
72843
72843
  outputFilterSensitiveLog,
72844
- [import_types5.SMITHY_CONTEXT_KEY]: {
72844
+ [import_types6.SMITHY_CONTEXT_KEY]: {
72845
72845
  commandInstance: this,
72846
72846
  ...smithyContext
72847
72847
  },
@@ -73124,8 +73124,8 @@ var require_dist_cjs26 = __commonJS({
73124
73124
  }, "emitWarningIfUnsupportedVersion");
73125
73125
  var getChecksumConfiguration = /* @__PURE__ */ __name2((runtimeConfig) => {
73126
73126
  const checksumAlgorithms = [];
73127
- for (const id in import_types5.AlgorithmId) {
73128
- const algorithmId = import_types5.AlgorithmId[id];
73127
+ for (const id in import_types6.AlgorithmId) {
73128
+ const algorithmId = import_types6.AlgorithmId[id];
73129
73129
  if (runtimeConfig[algorithmId] === void 0) {
73130
73130
  continue;
73131
73131
  }
@@ -77291,17 +77291,17 @@ var require_dist_cjs32 = __commonJS({
77291
77291
  var getProfileName = /* @__PURE__ */ __name2((init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE, "getProfileName");
77292
77292
  __reExport(index_exports, require_getSSOTokenFilepath(), module2.exports);
77293
77293
  var import_getSSOTokenFromFile2 = require_getSSOTokenFromFile();
77294
- var import_types5 = require_dist_cjs();
77294
+ var import_types6 = require_dist_cjs();
77295
77295
  var getConfigData = /* @__PURE__ */ __name2((data3) => Object.entries(data3).filter(([key]) => {
77296
77296
  const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
77297
77297
  if (indexOfSeparator === -1) {
77298
77298
  return false;
77299
77299
  }
77300
- return Object.values(import_types5.IniSectionType).includes(key.substring(0, indexOfSeparator));
77300
+ return Object.values(import_types6.IniSectionType).includes(key.substring(0, indexOfSeparator));
77301
77301
  }).reduce(
77302
77302
  (acc, [key, value]) => {
77303
77303
  const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
77304
- const updatedKey = key.substring(0, indexOfSeparator) === import_types5.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
77304
+ const updatedKey = key.substring(0, indexOfSeparator) === import_types6.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
77305
77305
  acc[updatedKey] = value;
77306
77306
  return acc;
77307
77307
  },
@@ -77334,7 +77334,7 @@ var require_dist_cjs32 = __commonJS({
77334
77334
  const matches = prefixKeyRegex.exec(sectionName);
77335
77335
  if (matches) {
77336
77336
  const [, prefix2, , name] = matches;
77337
- if (Object.values(import_types5.IniSectionType).includes(prefix2)) {
77337
+ if (Object.values(import_types6.IniSectionType).includes(prefix2)) {
77338
77338
  currentSection = [prefix2, name].join(CONFIG_PREFIX_SEPARATOR);
77339
77339
  }
77340
77340
  } else {
@@ -77393,7 +77393,7 @@ var require_dist_cjs32 = __commonJS({
77393
77393
  credentialsFile: parsedFiles[1]
77394
77394
  };
77395
77395
  }, "loadSharedConfigFiles");
77396
- var getSsoSessionData = /* @__PURE__ */ __name2((data3) => Object.entries(data3).filter(([key]) => key.startsWith(import_types5.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData");
77396
+ var getSsoSessionData = /* @__PURE__ */ __name2((data3) => Object.entries(data3).filter(([key]) => key.startsWith(import_types6.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {}), "getSsoSessionData");
77397
77397
  var import_slurpFile2 = require_slurpFile();
77398
77398
  var swallowError2 = /* @__PURE__ */ __name2(() => ({}), "swallowError");
77399
77399
  var loadSsoSessionData = /* @__PURE__ */ __name2(async (init = {}) => (0, import_slurpFile2.slurpFile)(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2), "loadSsoSessionData");
@@ -111905,13 +111905,13 @@ var require_dist_cjs78 = __commonJS({
111905
111905
  var index_exports = {};
111906
111906
  __export2(index_exports, {
111907
111907
  AbortController: /* @__PURE__ */ __name(() => AbortController2, "AbortController"),
111908
- AbortHandler: /* @__PURE__ */ __name(() => import_types5.AbortHandler, "AbortHandler"),
111908
+ AbortHandler: /* @__PURE__ */ __name(() => import_types6.AbortHandler, "AbortHandler"),
111909
111909
  AbortSignal: /* @__PURE__ */ __name(() => AbortSignal2, "AbortSignal"),
111910
- IAbortController: /* @__PURE__ */ __name(() => import_types5.AbortController, "IAbortController"),
111911
- IAbortSignal: /* @__PURE__ */ __name(() => import_types5.AbortSignal, "IAbortSignal")
111910
+ IAbortController: /* @__PURE__ */ __name(() => import_types6.AbortController, "IAbortController"),
111911
+ IAbortSignal: /* @__PURE__ */ __name(() => import_types6.AbortSignal, "IAbortSignal")
111912
111912
  });
111913
111913
  module2.exports = __toCommonJS2(index_exports);
111914
- var import_types5 = require_dist_cjs();
111914
+ var import_types6 = require_dist_cjs();
111915
111915
  var AbortSignal2 = class {
111916
111916
  static {
111917
111917
  __name(this, "AbortSignal");
@@ -113760,7 +113760,7 @@ var require_has_flag = __commonJS({
113760
113760
  var require_supports_color = __commonJS({
113761
113761
  "../../node_modules/supports-color/index.js"(exports2, module2) {
113762
113762
  "use strict";
113763
- var os13 = require("os");
113763
+ var os14 = require("os");
113764
113764
  var tty = require("tty");
113765
113765
  var hasFlag = require_has_flag();
113766
113766
  var { env: env2 } = process;
@@ -113809,7 +113809,7 @@ var require_supports_color = __commonJS({
113809
113809
  return min;
113810
113810
  }
113811
113811
  if (process.platform === "win32") {
113812
- const osRelease = os13.release().split(".");
113812
+ const osRelease = os14.release().split(".");
113813
113813
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
113814
113814
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
113815
113815
  }
@@ -123645,7 +123645,7 @@ var init_messages = __esm({
123645
123645
  description: "Refactor result",
123646
123646
  interface: "RefactorResult"
123647
123647
  }),
123648
- CDK_TOOLKIT_I8910: question({
123648
+ CDK_TOOLKIT_I8910: confirm({
123649
123649
  code: "CDK_TOOLKIT_I8910",
123650
123650
  description: "Confirm refactor",
123651
123651
  interface: "ConfirmationRequest"
@@ -330532,7 +330532,7 @@ var require_constants7 = __commonJS({
330532
330532
  "use strict";
330533
330533
  var { sep: sep5 } = require("path");
330534
330534
  var { platform: platform3 } = process;
330535
- var os13 = require("os");
330535
+ var os14 = require("os");
330536
330536
  exports2.EV_ALL = "all";
330537
330537
  exports2.EV_READY = "ready";
330538
330538
  exports2.EV_ADD = "add";
@@ -330586,7 +330586,7 @@ var require_constants7 = __commonJS({
330586
330586
  exports2.isWindows = platform3 === "win32";
330587
330587
  exports2.isMacos = platform3 === "darwin";
330588
330588
  exports2.isLinux = platform3 === "linux";
330589
- exports2.isIBMi = os13.type() === "OS400";
330589
+ exports2.isIBMi = os14.type() === "OS400";
330590
330590
  }
330591
330591
  });
330592
330592
 
@@ -335430,7 +335430,7 @@ ${deployResult.stackArn}`));
335430
335430
  if (options.dryRun || context.mappings.length === 0 || context.ambiguousPaths.length > 0) {
335431
335431
  continue;
335432
335432
  }
335433
- if (process.stdout.isTTY && !await confirm4(options.force ?? false)) {
335433
+ if (process.stdout.isTTY && !await confirm3(options.force ?? false)) {
335434
335434
  await ioHelper.defaults.info(chalk23.red(`Refactoring canceled for environment aws://${environment.account}/${environment.region}
335435
335435
  `));
335436
335436
  continue;
@@ -335472,17 +335472,16 @@ ${deployResult.stackArn}`));
335472
335472
  throw new ToolkitError(`Cannot find resource in location ${location}`);
335473
335473
  }
335474
335474
  __name(getResourceLocation, "getResourceLocation");
335475
- async function confirm4(force) {
335475
+ async function confirm3(force) {
335476
335476
  if (force) {
335477
335477
  return true;
335478
335478
  }
335479
335479
  const question2 = "Do you wish to refactor these resources?";
335480
- const response = await ioHelper.requestResponse(IO.CDK_TOOLKIT_I8910.req(question2, {
335481
- responseDescription: "[Y]es/[n]o"
335482
- }, "y"));
335483
- return ["y", "yes"].includes(response.toLowerCase());
335480
+ return ioHelper.requestResponse(IO.CDK_TOOLKIT_I8910.req(question2, {
335481
+ motivation: "User input is needed"
335482
+ }));
335484
335483
  }
335485
- __name(confirm4, "confirm");
335484
+ __name(confirm3, "confirm");
335486
335485
  function formatError(error5) {
335487
335486
  try {
335488
335487
  const payload2 = JSON.parse(error5.message);
@@ -337518,384 +337517,6 @@ var require_lib13 = __commonJS({
337518
337517
  }
337519
337518
  });
337520
337519
 
337521
- // ../../node_modules/promptly/node_modules/mute-stream/mute.js
337522
- var require_mute = __commonJS({
337523
- "../../node_modules/promptly/node_modules/mute-stream/mute.js"(exports2, module2) {
337524
- var Stream2 = require("stream");
337525
- module2.exports = MuteStream;
337526
- function MuteStream(opts) {
337527
- Stream2.apply(this);
337528
- opts = opts || {};
337529
- this.writable = this.readable = true;
337530
- this.muted = false;
337531
- this.on("pipe", this._onpipe);
337532
- this.replace = opts.replace;
337533
- this._prompt = opts.prompt || null;
337534
- this._hadControl = false;
337535
- }
337536
- __name(MuteStream, "MuteStream");
337537
- MuteStream.prototype = Object.create(Stream2.prototype);
337538
- Object.defineProperty(MuteStream.prototype, "constructor", {
337539
- value: MuteStream,
337540
- enumerable: false
337541
- });
337542
- MuteStream.prototype.mute = function() {
337543
- this.muted = true;
337544
- };
337545
- MuteStream.prototype.unmute = function() {
337546
- this.muted = false;
337547
- };
337548
- Object.defineProperty(MuteStream.prototype, "_onpipe", {
337549
- value: onPipe,
337550
- enumerable: false,
337551
- writable: true,
337552
- configurable: true
337553
- });
337554
- function onPipe(src) {
337555
- this._src = src;
337556
- }
337557
- __name(onPipe, "onPipe");
337558
- Object.defineProperty(MuteStream.prototype, "isTTY", {
337559
- get: getIsTTY,
337560
- set: setIsTTY,
337561
- enumerable: true,
337562
- configurable: true
337563
- });
337564
- function getIsTTY() {
337565
- return this._dest ? this._dest.isTTY : this._src ? this._src.isTTY : false;
337566
- }
337567
- __name(getIsTTY, "getIsTTY");
337568
- function setIsTTY(isTTY2) {
337569
- Object.defineProperty(this, "isTTY", {
337570
- value: isTTY2,
337571
- enumerable: true,
337572
- writable: true,
337573
- configurable: true
337574
- });
337575
- }
337576
- __name(setIsTTY, "setIsTTY");
337577
- Object.defineProperty(MuteStream.prototype, "rows", {
337578
- get: /* @__PURE__ */ __name(function() {
337579
- return this._dest ? this._dest.rows : this._src ? this._src.rows : void 0;
337580
- }, "get"),
337581
- enumerable: true,
337582
- configurable: true
337583
- });
337584
- Object.defineProperty(MuteStream.prototype, "columns", {
337585
- get: /* @__PURE__ */ __name(function() {
337586
- return this._dest ? this._dest.columns : this._src ? this._src.columns : void 0;
337587
- }, "get"),
337588
- enumerable: true,
337589
- configurable: true
337590
- });
337591
- MuteStream.prototype.pipe = function(dest, options) {
337592
- this._dest = dest;
337593
- return Stream2.prototype.pipe.call(this, dest, options);
337594
- };
337595
- MuteStream.prototype.pause = function() {
337596
- if (this._src) return this._src.pause();
337597
- };
337598
- MuteStream.prototype.resume = function() {
337599
- if (this._src) return this._src.resume();
337600
- };
337601
- MuteStream.prototype.write = function(c3) {
337602
- if (this.muted) {
337603
- if (!this.replace) return true;
337604
- if (c3.match(/^\u001b/)) {
337605
- if (c3.indexOf(this._prompt) === 0) {
337606
- c3 = c3.substr(this._prompt.length);
337607
- c3 = c3.replace(/./g, this.replace);
337608
- c3 = this._prompt + c3;
337609
- }
337610
- this._hadControl = true;
337611
- return this.emit("data", c3);
337612
- } else {
337613
- if (this._prompt && this._hadControl && c3.indexOf(this._prompt) === 0) {
337614
- this._hadControl = false;
337615
- this.emit("data", this._prompt);
337616
- c3 = c3.substr(this._prompt.length);
337617
- }
337618
- c3 = c3.toString().replace(/./g, this.replace);
337619
- }
337620
- }
337621
- this.emit("data", c3);
337622
- };
337623
- MuteStream.prototype.end = function(c3) {
337624
- if (this.muted) {
337625
- if (c3 && this.replace) {
337626
- c3 = c3.toString().replace(/./g, this.replace);
337627
- } else {
337628
- c3 = null;
337629
- }
337630
- }
337631
- if (c3) this.emit("data", c3);
337632
- this.emit("end");
337633
- };
337634
- function proxy(fn) {
337635
- return function() {
337636
- var d3 = this._dest;
337637
- var s3 = this._src;
337638
- if (d3 && d3[fn]) d3[fn].apply(d3, arguments);
337639
- if (s3 && s3[fn]) s3[fn].apply(s3, arguments);
337640
- };
337641
- }
337642
- __name(proxy, "proxy");
337643
- MuteStream.prototype.destroy = proxy("destroy");
337644
- MuteStream.prototype.destroySoon = proxy("destroySoon");
337645
- MuteStream.prototype.close = proxy("close");
337646
- }
337647
- });
337648
-
337649
- // ../../node_modules/promptly/node_modules/read/lib/read.js
337650
- var require_read = __commonJS({
337651
- "../../node_modules/promptly/node_modules/read/lib/read.js"(exports2, module2) {
337652
- module2.exports = read;
337653
- var readline = require("readline");
337654
- var Mute = require_mute();
337655
- function read(opts, cb) {
337656
- if (opts.num) {
337657
- throw new Error("read() no longer accepts a char number limit");
337658
- }
337659
- if (typeof opts.default !== "undefined" && typeof opts.default !== "string" && typeof opts.default !== "number") {
337660
- throw new Error("default value must be string or number");
337661
- }
337662
- var input = opts.input || process.stdin;
337663
- var output = opts.output || process.stdout;
337664
- var prompt2 = (opts.prompt || "").trim() + " ";
337665
- var silent = opts.silent;
337666
- var editDef = false;
337667
- var timeout = opts.timeout;
337668
- var def = opts.default || "";
337669
- if (def) {
337670
- if (silent) {
337671
- prompt2 += "(<default hidden>) ";
337672
- } else if (opts.edit) {
337673
- editDef = true;
337674
- } else {
337675
- prompt2 += "(" + def + ") ";
337676
- }
337677
- }
337678
- var terminal = !!(opts.terminal || output.isTTY);
337679
- var m3 = new Mute({ replace: opts.replace, prompt: prompt2 });
337680
- m3.pipe(output, { end: false });
337681
- output = m3;
337682
- var rlOpts = { input, output, terminal };
337683
- if (process.version.match(/^v0\.6/)) {
337684
- var rl = readline.createInterface(rlOpts.input, rlOpts.output);
337685
- } else {
337686
- var rl = readline.createInterface(rlOpts);
337687
- }
337688
- output.unmute();
337689
- rl.setPrompt(prompt2);
337690
- rl.prompt();
337691
- if (silent) {
337692
- output.mute();
337693
- } else if (editDef) {
337694
- rl.line = def;
337695
- rl.cursor = def.length;
337696
- rl._refreshLine();
337697
- }
337698
- var called = false;
337699
- rl.on("line", onLine);
337700
- rl.on("error", onError);
337701
- rl.on("SIGINT", function() {
337702
- rl.close();
337703
- onError(new Error("canceled"));
337704
- });
337705
- var timer;
337706
- if (timeout) {
337707
- timer = setTimeout(function() {
337708
- onError(new Error("timed out"));
337709
- }, timeout);
337710
- }
337711
- function done() {
337712
- called = true;
337713
- rl.close();
337714
- if (process.version.match(/^v0\.6/)) {
337715
- rl.input.removeAllListeners("data");
337716
- rl.input.removeAllListeners("keypress");
337717
- rl.input.pause();
337718
- }
337719
- clearTimeout(timer);
337720
- output.mute();
337721
- output.end();
337722
- }
337723
- __name(done, "done");
337724
- function onError(er) {
337725
- if (called) return;
337726
- done();
337727
- return cb(er);
337728
- }
337729
- __name(onError, "onError");
337730
- function onLine(line) {
337731
- if (called) return;
337732
- if (silent && terminal) {
337733
- output.unmute();
337734
- output.write("\r\n");
337735
- }
337736
- done();
337737
- line = line.replace(/\r?\n$/, "");
337738
- var isDefault = !!(editDef && line === def);
337739
- if (def && !line) {
337740
- isDefault = true;
337741
- line = def;
337742
- }
337743
- cb(null, line, isDefault);
337744
- }
337745
- __name(onLine, "onLine");
337746
- }
337747
- __name(read, "read");
337748
- }
337749
- });
337750
-
337751
- // ../../node_modules/promptly/lib/prompt.js
337752
- var require_prompt = __commonJS({
337753
- "../../node_modules/promptly/lib/prompt.js"(exports2, module2) {
337754
- "use strict";
337755
- var { EOL } = require("os");
337756
- var { promisify: promisify4 } = require("util");
337757
- var read = promisify4(require_read());
337758
- async function prompt2(message2, options) {
337759
- let value;
337760
- try {
337761
- value = await read({
337762
- prompt: message2,
337763
- silent: options.silent,
337764
- replace: options.replace,
337765
- input: options.input,
337766
- output: options.output,
337767
- timeout: options.timeout
337768
- });
337769
- } catch (err) {
337770
- if (err.message !== "timed out" || options.default === void 0 || !options.useDefaultOnTimeout) {
337771
- throw Object.assign(new Error(err.message), { code: "TIMEDOUT" });
337772
- }
337773
- value = options.default;
337774
- }
337775
- if (options.trim) {
337776
- value = value.trim();
337777
- }
337778
- if (!value) {
337779
- if (options.default === void 0) {
337780
- return prompt2(message2, options);
337781
- }
337782
- value = options.default;
337783
- }
337784
- try {
337785
- for (const i3 in options.validator) {
337786
- value = await options.validator[i3](value);
337787
- }
337788
- } catch (err) {
337789
- if (options.retry) {
337790
- err.message && options.output.write(err.message + EOL);
337791
- return prompt2(message2, options);
337792
- }
337793
- throw err;
337794
- }
337795
- return value;
337796
- }
337797
- __name(prompt2, "prompt");
337798
- module2.exports = prompt2;
337799
- }
337800
- });
337801
-
337802
- // ../../node_modules/promptly/lib/getOptions.js
337803
- var require_getOptions = __commonJS({
337804
- "../../node_modules/promptly/lib/getOptions.js"(exports2, module2) {
337805
- "use strict";
337806
- function getOptions(options) {
337807
- options = {
337808
- // Own options
337809
- validator: void 0,
337810
- retry: true,
337811
- trim: true,
337812
- default: void 0,
337813
- useDefaultOnTimeout: false,
337814
- // `read` package options
337815
- silent: false,
337816
- replace: "",
337817
- input: process.stdin,
337818
- output: process.stdout,
337819
- timeout: 0,
337820
- ...options
337821
- };
337822
- if (options.default !== void 0 && typeof options.default !== "string") {
337823
- throw new Error("The default option value must be a string");
337824
- }
337825
- if (!Array.isArray(options.validator)) {
337826
- options.validator = options.validator ? [options.validator] : [];
337827
- }
337828
- return options;
337829
- }
337830
- __name(getOptions, "getOptions");
337831
- module2.exports = getOptions;
337832
- }
337833
- });
337834
-
337835
- // ../../node_modules/promptly/index.js
337836
- var require_promptly = __commonJS({
337837
- "../../node_modules/promptly/index.js"(exports2, module2) {
337838
- "use strict";
337839
- var prompt2 = require_prompt();
337840
- var getOptions = require_getOptions();
337841
- var promptly3 = module2.exports;
337842
- promptly3.prompt = (message2, options) => {
337843
- options = getOptions(options);
337844
- return prompt2(message2, options);
337845
- };
337846
- promptly3.password = (message2, options) => {
337847
- options = getOptions({
337848
- silent: true,
337849
- // Hide password chars
337850
- trim: false,
337851
- // Do not trim so that spaces can be part of the password
337852
- default: "",
337853
- // Allow empty passwords
337854
- ...options
337855
- });
337856
- return prompt2(message2, options);
337857
- };
337858
- promptly3.confirm = (message2, options) => {
337859
- options = getOptions({
337860
- trim: false,
337861
- // Do not trim so that only exact matches pass the validator
337862
- ...options
337863
- });
337864
- options.validator.unshift((value) => {
337865
- value = value.toLowerCase();
337866
- switch (value) {
337867
- case "y":
337868
- case "yes":
337869
- case "1":
337870
- return true;
337871
- case "n":
337872
- case "no":
337873
- case "0":
337874
- return false;
337875
- default:
337876
- throw new Error(`Invalid choice: ${value}`);
337877
- }
337878
- });
337879
- return prompt2(message2, options);
337880
- };
337881
- promptly3.choose = (message2, choices, options) => {
337882
- options = getOptions({
337883
- trim: false,
337884
- // Do not trim so that only exact matches pass the validator
337885
- ...options
337886
- });
337887
- options.validator.unshift((value) => {
337888
- const index = choices.findIndex((choice) => value == choice);
337889
- if (index === -1) {
337890
- throw new Error(`Invalid choice: ${value}`);
337891
- }
337892
- return choices[index];
337893
- });
337894
- return prompt2(message2, options);
337895
- };
337896
- }
337897
- });
337898
-
337899
337520
  // node_modules/uuid/dist/esm/stringify.js
337900
337521
  function unsafeStringify3(arr, offset = 0) {
337901
337522
  return (byteToHex3[arr[offset + 0]] + byteToHex3[arr[offset + 1]] + byteToHex3[arr[offset + 2]] + byteToHex3[arr[offset + 3]] + "-" + byteToHex3[arr[offset + 4]] + byteToHex3[arr[offset + 5]] + "-" + byteToHex3[arr[offset + 6]] + byteToHex3[arr[offset + 7]] + "-" + byteToHex3[arr[offset + 8]] + byteToHex3[arr[offset + 9]] + "-" + byteToHex3[arr[offset + 10]] + byteToHex3[arr[offset + 11]] + byteToHex3[arr[offset + 12]] + byteToHex3[arr[offset + 13]] + byteToHex3[arr[offset + 14]] + byteToHex3[arr[offset + 15]]).toLowerCase();
@@ -337980,6 +337601,384 @@ var init_esm10 = __esm({
337980
337601
  }
337981
337602
  });
337982
337603
 
337604
+ // ../../node_modules/promptly/node_modules/mute-stream/mute.js
337605
+ var require_mute = __commonJS({
337606
+ "../../node_modules/promptly/node_modules/mute-stream/mute.js"(exports2, module2) {
337607
+ var Stream2 = require("stream");
337608
+ module2.exports = MuteStream;
337609
+ function MuteStream(opts) {
337610
+ Stream2.apply(this);
337611
+ opts = opts || {};
337612
+ this.writable = this.readable = true;
337613
+ this.muted = false;
337614
+ this.on("pipe", this._onpipe);
337615
+ this.replace = opts.replace;
337616
+ this._prompt = opts.prompt || null;
337617
+ this._hadControl = false;
337618
+ }
337619
+ __name(MuteStream, "MuteStream");
337620
+ MuteStream.prototype = Object.create(Stream2.prototype);
337621
+ Object.defineProperty(MuteStream.prototype, "constructor", {
337622
+ value: MuteStream,
337623
+ enumerable: false
337624
+ });
337625
+ MuteStream.prototype.mute = function() {
337626
+ this.muted = true;
337627
+ };
337628
+ MuteStream.prototype.unmute = function() {
337629
+ this.muted = false;
337630
+ };
337631
+ Object.defineProperty(MuteStream.prototype, "_onpipe", {
337632
+ value: onPipe,
337633
+ enumerable: false,
337634
+ writable: true,
337635
+ configurable: true
337636
+ });
337637
+ function onPipe(src) {
337638
+ this._src = src;
337639
+ }
337640
+ __name(onPipe, "onPipe");
337641
+ Object.defineProperty(MuteStream.prototype, "isTTY", {
337642
+ get: getIsTTY,
337643
+ set: setIsTTY,
337644
+ enumerable: true,
337645
+ configurable: true
337646
+ });
337647
+ function getIsTTY() {
337648
+ return this._dest ? this._dest.isTTY : this._src ? this._src.isTTY : false;
337649
+ }
337650
+ __name(getIsTTY, "getIsTTY");
337651
+ function setIsTTY(isTTY2) {
337652
+ Object.defineProperty(this, "isTTY", {
337653
+ value: isTTY2,
337654
+ enumerable: true,
337655
+ writable: true,
337656
+ configurable: true
337657
+ });
337658
+ }
337659
+ __name(setIsTTY, "setIsTTY");
337660
+ Object.defineProperty(MuteStream.prototype, "rows", {
337661
+ get: /* @__PURE__ */ __name(function() {
337662
+ return this._dest ? this._dest.rows : this._src ? this._src.rows : void 0;
337663
+ }, "get"),
337664
+ enumerable: true,
337665
+ configurable: true
337666
+ });
337667
+ Object.defineProperty(MuteStream.prototype, "columns", {
337668
+ get: /* @__PURE__ */ __name(function() {
337669
+ return this._dest ? this._dest.columns : this._src ? this._src.columns : void 0;
337670
+ }, "get"),
337671
+ enumerable: true,
337672
+ configurable: true
337673
+ });
337674
+ MuteStream.prototype.pipe = function(dest, options) {
337675
+ this._dest = dest;
337676
+ return Stream2.prototype.pipe.call(this, dest, options);
337677
+ };
337678
+ MuteStream.prototype.pause = function() {
337679
+ if (this._src) return this._src.pause();
337680
+ };
337681
+ MuteStream.prototype.resume = function() {
337682
+ if (this._src) return this._src.resume();
337683
+ };
337684
+ MuteStream.prototype.write = function(c3) {
337685
+ if (this.muted) {
337686
+ if (!this.replace) return true;
337687
+ if (c3.match(/^\u001b/)) {
337688
+ if (c3.indexOf(this._prompt) === 0) {
337689
+ c3 = c3.substr(this._prompt.length);
337690
+ c3 = c3.replace(/./g, this.replace);
337691
+ c3 = this._prompt + c3;
337692
+ }
337693
+ this._hadControl = true;
337694
+ return this.emit("data", c3);
337695
+ } else {
337696
+ if (this._prompt && this._hadControl && c3.indexOf(this._prompt) === 0) {
337697
+ this._hadControl = false;
337698
+ this.emit("data", this._prompt);
337699
+ c3 = c3.substr(this._prompt.length);
337700
+ }
337701
+ c3 = c3.toString().replace(/./g, this.replace);
337702
+ }
337703
+ }
337704
+ this.emit("data", c3);
337705
+ };
337706
+ MuteStream.prototype.end = function(c3) {
337707
+ if (this.muted) {
337708
+ if (c3 && this.replace) {
337709
+ c3 = c3.toString().replace(/./g, this.replace);
337710
+ } else {
337711
+ c3 = null;
337712
+ }
337713
+ }
337714
+ if (c3) this.emit("data", c3);
337715
+ this.emit("end");
337716
+ };
337717
+ function proxy(fn) {
337718
+ return function() {
337719
+ var d3 = this._dest;
337720
+ var s3 = this._src;
337721
+ if (d3 && d3[fn]) d3[fn].apply(d3, arguments);
337722
+ if (s3 && s3[fn]) s3[fn].apply(s3, arguments);
337723
+ };
337724
+ }
337725
+ __name(proxy, "proxy");
337726
+ MuteStream.prototype.destroy = proxy("destroy");
337727
+ MuteStream.prototype.destroySoon = proxy("destroySoon");
337728
+ MuteStream.prototype.close = proxy("close");
337729
+ }
337730
+ });
337731
+
337732
+ // ../../node_modules/promptly/node_modules/read/lib/read.js
337733
+ var require_read = __commonJS({
337734
+ "../../node_modules/promptly/node_modules/read/lib/read.js"(exports2, module2) {
337735
+ module2.exports = read;
337736
+ var readline = require("readline");
337737
+ var Mute = require_mute();
337738
+ function read(opts, cb) {
337739
+ if (opts.num) {
337740
+ throw new Error("read() no longer accepts a char number limit");
337741
+ }
337742
+ if (typeof opts.default !== "undefined" && typeof opts.default !== "string" && typeof opts.default !== "number") {
337743
+ throw new Error("default value must be string or number");
337744
+ }
337745
+ var input = opts.input || process.stdin;
337746
+ var output = opts.output || process.stdout;
337747
+ var prompt2 = (opts.prompt || "").trim() + " ";
337748
+ var silent = opts.silent;
337749
+ var editDef = false;
337750
+ var timeout = opts.timeout;
337751
+ var def = opts.default || "";
337752
+ if (def) {
337753
+ if (silent) {
337754
+ prompt2 += "(<default hidden>) ";
337755
+ } else if (opts.edit) {
337756
+ editDef = true;
337757
+ } else {
337758
+ prompt2 += "(" + def + ") ";
337759
+ }
337760
+ }
337761
+ var terminal = !!(opts.terminal || output.isTTY);
337762
+ var m3 = new Mute({ replace: opts.replace, prompt: prompt2 });
337763
+ m3.pipe(output, { end: false });
337764
+ output = m3;
337765
+ var rlOpts = { input, output, terminal };
337766
+ if (process.version.match(/^v0\.6/)) {
337767
+ var rl = readline.createInterface(rlOpts.input, rlOpts.output);
337768
+ } else {
337769
+ var rl = readline.createInterface(rlOpts);
337770
+ }
337771
+ output.unmute();
337772
+ rl.setPrompt(prompt2);
337773
+ rl.prompt();
337774
+ if (silent) {
337775
+ output.mute();
337776
+ } else if (editDef) {
337777
+ rl.line = def;
337778
+ rl.cursor = def.length;
337779
+ rl._refreshLine();
337780
+ }
337781
+ var called = false;
337782
+ rl.on("line", onLine);
337783
+ rl.on("error", onError);
337784
+ rl.on("SIGINT", function() {
337785
+ rl.close();
337786
+ onError(new Error("canceled"));
337787
+ });
337788
+ var timer;
337789
+ if (timeout) {
337790
+ timer = setTimeout(function() {
337791
+ onError(new Error("timed out"));
337792
+ }, timeout);
337793
+ }
337794
+ function done() {
337795
+ called = true;
337796
+ rl.close();
337797
+ if (process.version.match(/^v0\.6/)) {
337798
+ rl.input.removeAllListeners("data");
337799
+ rl.input.removeAllListeners("keypress");
337800
+ rl.input.pause();
337801
+ }
337802
+ clearTimeout(timer);
337803
+ output.mute();
337804
+ output.end();
337805
+ }
337806
+ __name(done, "done");
337807
+ function onError(er) {
337808
+ if (called) return;
337809
+ done();
337810
+ return cb(er);
337811
+ }
337812
+ __name(onError, "onError");
337813
+ function onLine(line) {
337814
+ if (called) return;
337815
+ if (silent && terminal) {
337816
+ output.unmute();
337817
+ output.write("\r\n");
337818
+ }
337819
+ done();
337820
+ line = line.replace(/\r?\n$/, "");
337821
+ var isDefault = !!(editDef && line === def);
337822
+ if (def && !line) {
337823
+ isDefault = true;
337824
+ line = def;
337825
+ }
337826
+ cb(null, line, isDefault);
337827
+ }
337828
+ __name(onLine, "onLine");
337829
+ }
337830
+ __name(read, "read");
337831
+ }
337832
+ });
337833
+
337834
+ // ../../node_modules/promptly/lib/prompt.js
337835
+ var require_prompt = __commonJS({
337836
+ "../../node_modules/promptly/lib/prompt.js"(exports2, module2) {
337837
+ "use strict";
337838
+ var { EOL } = require("os");
337839
+ var { promisify: promisify4 } = require("util");
337840
+ var read = promisify4(require_read());
337841
+ async function prompt2(message2, options) {
337842
+ let value;
337843
+ try {
337844
+ value = await read({
337845
+ prompt: message2,
337846
+ silent: options.silent,
337847
+ replace: options.replace,
337848
+ input: options.input,
337849
+ output: options.output,
337850
+ timeout: options.timeout
337851
+ });
337852
+ } catch (err) {
337853
+ if (err.message !== "timed out" || options.default === void 0 || !options.useDefaultOnTimeout) {
337854
+ throw Object.assign(new Error(err.message), { code: "TIMEDOUT" });
337855
+ }
337856
+ value = options.default;
337857
+ }
337858
+ if (options.trim) {
337859
+ value = value.trim();
337860
+ }
337861
+ if (!value) {
337862
+ if (options.default === void 0) {
337863
+ return prompt2(message2, options);
337864
+ }
337865
+ value = options.default;
337866
+ }
337867
+ try {
337868
+ for (const i3 in options.validator) {
337869
+ value = await options.validator[i3](value);
337870
+ }
337871
+ } catch (err) {
337872
+ if (options.retry) {
337873
+ err.message && options.output.write(err.message + EOL);
337874
+ return prompt2(message2, options);
337875
+ }
337876
+ throw err;
337877
+ }
337878
+ return value;
337879
+ }
337880
+ __name(prompt2, "prompt");
337881
+ module2.exports = prompt2;
337882
+ }
337883
+ });
337884
+
337885
+ // ../../node_modules/promptly/lib/getOptions.js
337886
+ var require_getOptions = __commonJS({
337887
+ "../../node_modules/promptly/lib/getOptions.js"(exports2, module2) {
337888
+ "use strict";
337889
+ function getOptions(options) {
337890
+ options = {
337891
+ // Own options
337892
+ validator: void 0,
337893
+ retry: true,
337894
+ trim: true,
337895
+ default: void 0,
337896
+ useDefaultOnTimeout: false,
337897
+ // `read` package options
337898
+ silent: false,
337899
+ replace: "",
337900
+ input: process.stdin,
337901
+ output: process.stdout,
337902
+ timeout: 0,
337903
+ ...options
337904
+ };
337905
+ if (options.default !== void 0 && typeof options.default !== "string") {
337906
+ throw new Error("The default option value must be a string");
337907
+ }
337908
+ if (!Array.isArray(options.validator)) {
337909
+ options.validator = options.validator ? [options.validator] : [];
337910
+ }
337911
+ return options;
337912
+ }
337913
+ __name(getOptions, "getOptions");
337914
+ module2.exports = getOptions;
337915
+ }
337916
+ });
337917
+
337918
+ // ../../node_modules/promptly/index.js
337919
+ var require_promptly = __commonJS({
337920
+ "../../node_modules/promptly/index.js"(exports2, module2) {
337921
+ "use strict";
337922
+ var prompt2 = require_prompt();
337923
+ var getOptions = require_getOptions();
337924
+ var promptly2 = module2.exports;
337925
+ promptly2.prompt = (message2, options) => {
337926
+ options = getOptions(options);
337927
+ return prompt2(message2, options);
337928
+ };
337929
+ promptly2.password = (message2, options) => {
337930
+ options = getOptions({
337931
+ silent: true,
337932
+ // Hide password chars
337933
+ trim: false,
337934
+ // Do not trim so that spaces can be part of the password
337935
+ default: "",
337936
+ // Allow empty passwords
337937
+ ...options
337938
+ });
337939
+ return prompt2(message2, options);
337940
+ };
337941
+ promptly2.confirm = (message2, options) => {
337942
+ options = getOptions({
337943
+ trim: false,
337944
+ // Do not trim so that only exact matches pass the validator
337945
+ ...options
337946
+ });
337947
+ options.validator.unshift((value) => {
337948
+ value = value.toLowerCase();
337949
+ switch (value) {
337950
+ case "y":
337951
+ case "yes":
337952
+ case "1":
337953
+ return true;
337954
+ case "n":
337955
+ case "no":
337956
+ case "0":
337957
+ return false;
337958
+ default:
337959
+ throw new Error(`Invalid choice: ${value}`);
337960
+ }
337961
+ });
337962
+ return prompt2(message2, options);
337963
+ };
337964
+ promptly2.choose = (message2, choices, options) => {
337965
+ options = getOptions({
337966
+ trim: false,
337967
+ // Do not trim so that only exact matches pass the validator
337968
+ ...options
337969
+ });
337970
+ options.validator.unshift((value) => {
337971
+ const index = choices.findIndex((choice) => value == choice);
337972
+ if (index === -1) {
337973
+ throw new Error(`Invalid choice: ${value}`);
337974
+ }
337975
+ return choices[index];
337976
+ });
337977
+ return prompt2(message2, options);
337978
+ };
337979
+ }
337980
+ });
337981
+
337983
337982
  // lib/api-private.ts
337984
337983
  var init_api_private = __esm({
337985
337984
  "lib/api-private.ts"() {
@@ -338629,8 +338628,21 @@ var require_cli_type_registry = __commonJS({
338629
338628
  alias: [
338630
338629
  "i"
338631
338630
  ],
338632
- desc: "Interactive option for the flags command",
338631
+ desc: "Interactive option for the flags command"
338632
+ },
338633
+ safe: {
338634
+ type: "boolean",
338635
+ desc: "Enable all feature flags that do not impact the user's application",
338633
338636
  requiresArg: false
338637
+ },
338638
+ concurrency: {
338639
+ type: "number",
338640
+ alias: [
338641
+ "n"
338642
+ ],
338643
+ desc: "Maximum number of simultaneous synths to execute.",
338644
+ default: 4,
338645
+ requiresArg: true
338634
338646
  }
338635
338647
  }
338636
338648
  },
@@ -342482,20 +342494,24 @@ var init_init_hooks = __esm({
342482
342494
  function getLanguageFromAlias(alias) {
342483
342495
  return SUPPORTED_LANGUAGES.find((l3) => l3.alias === alias || l3.name === alias)?.name;
342484
342496
  }
342497
+ function getLanguageExtensions(language) {
342498
+ return SUPPORTED_LANGUAGES.find((l3) => l3.name === language || l3.alias === language)?.extensions ?? [];
342499
+ }
342485
342500
  var SUPPORTED_LANGUAGES;
342486
342501
  var init_language = __esm({
342487
342502
  "lib/commands/language.ts"() {
342488
342503
  "use strict";
342489
342504
  SUPPORTED_LANGUAGES = [
342490
- { name: "csharp", alias: "cs" },
342491
- { name: "fsharp", alias: "fs" },
342492
- { name: "go", alias: "go" },
342493
- { name: "java", alias: "java" },
342494
- { name: "javascript", alias: "js" },
342495
- { name: "python", alias: "py" },
342496
- { name: "typescript", alias: "ts" }
342505
+ { name: "csharp", alias: "cs", extensions: [".cs"] },
342506
+ { name: "fsharp", alias: "fs", extensions: [".fs"] },
342507
+ { name: "go", alias: "go", extensions: [".go"] },
342508
+ { name: "java", alias: "java", extensions: [".java"] },
342509
+ { name: "javascript", alias: "js", extensions: [".js"] },
342510
+ { name: "python", alias: "py", extensions: [".py"] },
342511
+ { name: "typescript", alias: "ts", extensions: [".ts", ".js"] }
342497
342512
  ];
342498
342513
  __name(getLanguageFromAlias, "getLanguageFromAlias");
342514
+ __name(getLanguageExtensions, "getLanguageExtensions");
342499
342515
  }
342500
342516
  });
342501
342517
 
@@ -342719,47 +342735,36 @@ async function resolveLanguage(ioHelper, template, requestedLanguage, type) {
342719
342735
  })();
342720
342736
  }
342721
342737
  async function findPotentialTemplates(repositoryPath) {
342722
- try {
342723
- const entries = await fs35.readdir(repositoryPath, { withFileTypes: true });
342724
- const potentialTemplates = [];
342725
- for (const entry of entries) {
342726
- if (entry.isDirectory() && !entry.name.startsWith(".")) {
342727
- const templatePath = path33.join(repositoryPath, entry.name);
342728
- const languages = await getLanguageDirectories(templatePath);
342729
- if (languages.length > 0) {
342730
- potentialTemplates.push(entry.name);
342731
- }
342732
- }
342738
+ const entries = await fs35.readdir(repositoryPath, { withFileTypes: true });
342739
+ const templateValidationPromises = entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map(async (entry) => {
342740
+ try {
342741
+ const templatePath = path33.join(repositoryPath, entry.name);
342742
+ const { languages } = await getLanguageDirectories(templatePath);
342743
+ return languages.length > 0 ? entry.name : null;
342744
+ } catch (error5) {
342745
+ return null;
342733
342746
  }
342734
- return potentialTemplates;
342735
- } catch (error5) {
342736
- return [];
342737
- }
342747
+ });
342748
+ const validationResults = await Promise.all(templateValidationPromises);
342749
+ return validationResults.filter((templateName) => templateName !== null);
342738
342750
  }
342739
342751
  async function getLanguageDirectories(templatePath) {
342740
- const cdkSupportedLanguages = ["typescript", "javascript", "python", "java", "csharp", "fsharp", "go"];
342741
- const languageExtensions = {
342742
- typescript: [".ts", ".js"],
342743
- javascript: [".js"],
342744
- python: [".py"],
342745
- java: [".java"],
342746
- csharp: [".cs"],
342747
- fsharp: [".fs"],
342748
- go: [".go"]
342749
- };
342750
342752
  try {
342751
342753
  const entries = await fs35.readdir(templatePath, { withFileTypes: true });
342752
- const languageValidationPromises = entries.filter((directoryEntry) => directoryEntry.isDirectory() && cdkSupportedLanguages.includes(directoryEntry.name)).map(async (directoryEntry) => {
342754
+ const languageValidationPromises = entries.filter((directoryEntry) => directoryEntry.isDirectory() && SUPPORTED_LANGUAGE_NAMES.includes(directoryEntry.name)).map(async (directoryEntry) => {
342753
342755
  const languageDirectoryPath = path33.join(templatePath, directoryEntry.name);
342754
342756
  try {
342755
- const hasValidLanguageFiles = await hasLanguageFiles(languageDirectoryPath, languageExtensions[directoryEntry.name]);
342757
+ const hasValidLanguageFiles = await hasLanguageFiles(languageDirectoryPath, getLanguageExtensions(directoryEntry.name));
342756
342758
  return hasValidLanguageFiles ? directoryEntry.name : null;
342757
342759
  } catch (error5) {
342758
342760
  throw new import_toolkit_lib12.ToolkitError(`Cannot read language directory '${directoryEntry.name}': ${error5.message}`);
342759
342761
  }
342760
342762
  });
342761
342763
  const validationResults = await Promise.all(languageValidationPromises);
342762
- return validationResults.filter((languageName) => languageName !== null);
342764
+ return {
342765
+ languages: validationResults.filter((languageName) => languageName !== null),
342766
+ entries
342767
+ };
342763
342768
  } catch (error5) {
342764
342769
  throw new import_toolkit_lib12.ToolkitError(`Cannot read template directory '${templatePath}': ${error5.message}`);
342765
342770
  }
@@ -342860,16 +342865,27 @@ async function initializeProject(ioHelper, template, language, canUseNetwork, ge
342860
342865
  }
342861
342866
  async function assertIsEmptyDirectory(workDir) {
342862
342867
  try {
342868
+ const stats = await fs35.stat(workDir);
342869
+ if (!stats.isDirectory()) {
342870
+ throw new import_toolkit_lib12.ToolkitError(`Path exists but is not a directory: ${workDir}`);
342871
+ }
342863
342872
  const files = await fs35.readdir(workDir);
342864
- if (files.filter((f3) => !f3.startsWith(".")).length !== 0) {
342865
- throw new import_toolkit_lib12.ToolkitError("`cdk init` cannot be run in a non-empty directory!");
342873
+ const visibleFiles = files.filter((f3) => !f3.startsWith("."));
342874
+ if (visibleFiles.length > 0) {
342875
+ throw new import_toolkit_lib12.ToolkitError(
342876
+ `\`cdk init\` cannot be run in a non-empty directory!
342877
+ Found ${visibleFiles.length} visible files in ${workDir}:
342878
+ ` + visibleFiles.map((f3) => ` - ${f3}`).join("\n")
342879
+ );
342866
342880
  }
342867
342881
  } catch (e3) {
342868
342882
  if (e3.code === "ENOENT") {
342869
- throw new import_toolkit_lib12.ToolkitError(`Directory does not exist: ${workDir}. Please create the directory first.`);
342870
- } else {
342871
- throw e3;
342883
+ throw new import_toolkit_lib12.ToolkitError(
342884
+ `Directory does not exist: ${workDir}
342885
+ Please create the directory first using: mkdir -p ` + workDir
342886
+ );
342872
342887
  }
342888
+ throw new import_toolkit_lib12.ToolkitError(`Failed to validate directory ${workDir}: ${e3.message}`);
342873
342889
  }
342874
342890
  }
342875
342891
  async function initializeGitRepository(ioHelper, workDir) {
@@ -343056,7 +343072,7 @@ async function currentlyRecommendedAwsCdkLibFlags() {
343056
343072
  const recommendedFlagsFile = path33.join(cliRootDir(), "lib", "init-templates", ".recommended-feature-flags.json");
343057
343073
  return JSON.parse(await fs35.readFile(recommendedFlagsFile, { encoding: "utf-8" }));
343058
343074
  }
343059
- var childProcess2, path33, import_toolkit_lib12, chalk26, fs35, camelCase, decamelize, INFO_DOT_JSON, InitTemplate;
343075
+ var childProcess2, path33, import_toolkit_lib12, chalk26, fs35, camelCase, decamelize, SUPPORTED_LANGUAGE_NAMES, INFO_DOT_JSON, InitTemplate;
343060
343076
  var init_init = __esm({
343061
343077
  "lib/commands/init/init.ts"() {
343062
343078
  "use strict";
@@ -343072,6 +343088,7 @@ var init_init = __esm({
343072
343088
  init_language();
343073
343089
  camelCase = require_camelcase();
343074
343090
  decamelize = require_decamelize();
343091
+ SUPPORTED_LANGUAGE_NAMES = SUPPORTED_LANGUAGES.map((l3) => l3.name);
343075
343092
  __name(cliInit, "cliInit");
343076
343093
  __name(loadLocalTemplate, "loadLocalTemplate");
343077
343094
  __name(loadBuiltinTemplate, "loadBuiltinTemplate");
@@ -343109,9 +343126,23 @@ var init_init = __esm({
343109
343126
  if (!await fs35.pathExists(basePath)) {
343110
343127
  throw new import_toolkit_lib12.ToolkitError(`Template path does not exist: ${basePath}`);
343111
343128
  }
343112
- const languages = await getLanguageDirectories(basePath);
343129
+ let templateSourcePath = basePath;
343130
+ let { languages, entries } = await getLanguageDirectories(basePath);
343131
+ if (languages.length === 0) {
343132
+ const languageDirs = entries.filter(
343133
+ (entry) => entry.isDirectory() && SUPPORTED_LANGUAGE_NAMES.includes(entry.name)
343134
+ );
343135
+ if (languageDirs.length === 1) {
343136
+ const langDir = languageDirs[0].name;
343137
+ templateSourcePath = path33.join(basePath, langDir);
343138
+ const hasValidFiles = await hasLanguageFiles(templateSourcePath, getLanguageExtensions(langDir));
343139
+ if (!hasValidFiles) {
343140
+ throw new import_toolkit_lib12.ToolkitError(`Found '${langDir}' directory but it doesn't contain the expected language files. Ensure the template contains ${langDir} source files.`);
343141
+ }
343142
+ }
343143
+ }
343113
343144
  const name = path33.basename(basePath);
343114
- return new _InitTemplate(basePath, name, languages, null, "custom" /* CUSTOM */);
343145
+ return new _InitTemplate(templateSourcePath, name, languages, null, "custom" /* CUSTOM */);
343115
343146
  }
343116
343147
  /**
343117
343148
  * @param name - the name that is being checked
@@ -343145,7 +343176,10 @@ var init_init = __esm({
343145
343176
  if (libVersion) {
343146
343177
  projectInfo.versions["aws-cdk-lib"] = libVersion;
343147
343178
  }
343148
- const sourceDirectory = path33.join(this.basePath, language);
343179
+ let sourceDirectory = path33.join(this.basePath, language);
343180
+ if (this.templateType === "custom" /* CUSTOM */ && this.languages.length === 1 && path33.basename(this.basePath) === language) {
343181
+ sourceDirectory = this.basePath;
343182
+ }
343149
343183
  if (this.templateType === "custom" /* CUSTOM */) {
343150
343184
  await this.installFilesWithoutProcessing(sourceDirectory, targetDirectory);
343151
343185
  } else {
@@ -343916,18 +343950,9 @@ function buildParameterMap2(parameters) {
343916
343950
  }
343917
343951
  return parameterMap;
343918
343952
  }
343919
- async function askUserConfirmation(ioHost, concurrency, motivation, question2) {
343953
+ async function askUserConfirmation(ioHost, req) {
343920
343954
  await ioHost.withCorkedLogging(async () => {
343921
- if (!TESTING && !process.stdin.isTTY) {
343922
- throw new import_toolkit_lib14.ToolkitError(`${motivation}, but terminal (TTY) is not attached so we are unable to get a confirmation from the user`);
343923
- }
343924
- if (concurrency > 1) {
343925
- throw new import_toolkit_lib14.ToolkitError(`${motivation}, but concurrency is greater than 1 so we are unable to get a confirmation from the user`);
343926
- }
343927
- const confirmed = await promptly2.confirm(`${chalk28.cyan(question2)} (y/n)?`);
343928
- if (!confirmed) {
343929
- throw new import_toolkit_lib14.ToolkitError("Aborted by user");
343930
- }
343955
+ await ioHost.asIoHelper().requestResponse(req);
343931
343956
  });
343932
343957
  }
343933
343958
  async function displayFlagsMessage(ioHost, toolkit, cloudExecutable) {
@@ -343963,7 +343988,7 @@ function stackMetadataLogger(ioHelper, verbose) {
343963
343988
  function requiresApproval(requireApproval, permissionChangeType) {
343964
343989
  return requireApproval === import_cloud_assembly_schema8.RequireApproval.ANYCHANGE || requireApproval === import_cloud_assembly_schema8.RequireApproval.BROADENING && permissionChangeType === import_toolkit_lib14.PermissionChangeType.BROADENING;
343965
343990
  }
343966
- var path35, import_util71, import_cloud_assembly_schema8, cxapi10, import_toolkit_lib14, chalk28, chokidar2, fs37, promptly2, pLimit5, TESTING, InternalToolkit, CdkToolkit;
343991
+ var path35, import_util71, import_cloud_assembly_schema8, cxapi10, import_toolkit_lib14, chalk28, chokidar2, fs37, pLimit5, InternalToolkit, CdkToolkit;
343967
343992
  var init_cdk_toolkit = __esm({
343968
343993
  "lib/cli/cdk-toolkit.ts"() {
343969
343994
  "use strict";
@@ -343975,7 +344000,6 @@ var init_cdk_toolkit = __esm({
343975
344000
  chalk28 = __toESM(require_source());
343976
344001
  chokidar2 = __toESM(require_chokidar());
343977
344002
  fs37 = __toESM(require_lib13());
343978
- promptly2 = __toESM(require_promptly());
343979
344003
  init_esm10();
343980
344004
  init_io_host2();
343981
344005
  init_user_configuration();
@@ -343994,7 +344018,6 @@ var init_cdk_toolkit = __esm({
343994
344018
  init_error();
343995
344019
  init_messages2();
343996
344020
  pLimit5 = require_p_limit();
343997
- TESTING = false;
343998
344021
  InternalToolkit = class extends import_toolkit_lib14.Toolkit {
343999
344022
  static {
344000
344023
  __name(this, "InternalToolkit");
@@ -344279,12 +344302,16 @@ var init_cdk_toolkit = __esm({
344279
344302
  });
344280
344303
  const securityDiff = formatter.formatSecurityDiff();
344281
344304
  if (requiresApproval(requireApproval, securityDiff.permissionChangeType)) {
344305
+ const motivation = '"--require-approval" is enabled and stack includes security-sensitive updates';
344282
344306
  await this.ioHost.asIoHelper().defaults.info(securityDiff.formattedDiff);
344283
344307
  await askUserConfirmation(
344284
344308
  this.ioHost,
344285
- concurrency,
344286
- '"--require-approval" is enabled and stack includes security-sensitive updates',
344287
- "Do you wish to deploy these changes"
344309
+ IO.CDK_TOOLKIT_I5060.req(`${motivation}: 'Do you wish to deploy these changes'`, {
344310
+ motivation,
344311
+ concurrency,
344312
+ permissionChangeType: securityDiff.permissionChangeType,
344313
+ templateDiffs: formatter.diffs
344314
+ })
344288
344315
  );
344289
344316
  }
344290
344317
  }
@@ -344342,9 +344369,10 @@ var init_cdk_toolkit = __esm({
344342
344369
  } else {
344343
344370
  await askUserConfirmation(
344344
344371
  this.ioHost,
344345
- concurrency,
344346
- motivation,
344347
- `${motivation}. Roll back first and then proceed with deployment`
344372
+ IO.CDK_TOOLKIT_I5050.req(`${motivation}. Roll back first and then proceed with deployment`, {
344373
+ motivation,
344374
+ concurrency
344375
+ })
344348
344376
  );
344349
344377
  }
344350
344378
  await this.rollback({
@@ -344362,9 +344390,10 @@ var init_cdk_toolkit = __esm({
344362
344390
  } else {
344363
344391
  await askUserConfirmation(
344364
344392
  this.ioHost,
344365
- concurrency,
344366
- motivation,
344367
- `${motivation}. Perform a regular deployment`
344393
+ IO.CDK_TOOLKIT_I5050.req(`${motivation}. Perform a regular deployment`, {
344394
+ concurrency,
344395
+ motivation
344396
+ })
344368
344397
  );
344369
344398
  }
344370
344399
  rollback = true;
@@ -344639,29 +344668,34 @@ var init_cdk_toolkit = __esm({
344639
344668
  }
344640
344669
  }
344641
344670
  async destroy(options) {
344642
- let stacks = await this.selectStacksForDestroy(options.selector, options.exclusively);
344643
- stacks = stacks.reversed();
344671
+ const ioHelper = this.ioHost.asIoHelper();
344672
+ const stacks = (await this.selectStacksForDestroy(options.selector, options.exclusively)).reversed();
344644
344673
  if (!options.force) {
344645
- const confirmed = await promptly2.confirm(
344646
- `Are you sure you want to delete: ${chalk28.blue(stacks.stackArtifacts.map((s3) => s3.hierarchicalId).join(", "))} (y/n)?`
344647
- );
344648
- if (!confirmed) {
344674
+ const motivation = "Destroying stacks is an irreversible action";
344675
+ const question2 = `Are you sure you want to delete: ${chalk28.blue(stacks.stackArtifacts.map((s3) => s3.hierarchicalId).join(", "))}`;
344676
+ try {
344677
+ await ioHelper.requestResponse(IO.CDK_TOOLKIT_I7010.req(question2, { motivation }));
344678
+ } catch (err) {
344679
+ if (!import_toolkit_lib14.ToolkitError.isToolkitError(err) || err.message != "Aborted by user") {
344680
+ throw err;
344681
+ }
344682
+ await ioHelper.notify(IO.CDK_TOOLKIT_E7010.msg(err.message));
344649
344683
  return;
344650
344684
  }
344651
344685
  }
344652
344686
  const action = options.fromDeploy ? "deploy" : "destroy";
344653
344687
  for (const [index, stack] of stacks.stackArtifacts.entries()) {
344654
- await this.ioHost.asIoHelper().defaults.info(chalk28.green("%s: destroying... [%s/%s]"), chalk28.blue(stack.displayName), index + 1, stacks.stackCount);
344688
+ await ioHelper.defaults.info(chalk28.green("%s: destroying... [%s/%s]"), chalk28.blue(stack.displayName), index + 1, stacks.stackCount);
344655
344689
  try {
344656
344690
  await this.props.deployments.destroyStack({
344657
344691
  stack,
344658
344692
  deployName: stack.stackName,
344659
344693
  roleArn: options.roleArn
344660
344694
  });
344661
- await this.ioHost.asIoHelper().defaults.info(chalk28.green(`
344695
+ await ioHelper.defaults.info(chalk28.green(`
344662
344696
  \u2705 %s: ${action}ed`), chalk28.blue(stack.displayName));
344663
344697
  } catch (e3) {
344664
- await this.ioHost.asIoHelper().defaults.error(`
344698
+ await ioHelper.defaults.error(`
344665
344699
  \u274C %s: ${action} failed`, chalk28.blue(stack.displayName), e3);
344666
344700
  throw e3;
344667
344701
  }
@@ -344815,7 +344849,7 @@ var init_cdk_toolkit = __esm({
344815
344849
  } else if (scanType == "path" /* PATH */) {
344816
344850
  const templateBody = readFromPath(options.fromPath);
344817
344851
  const parsedTemplate = deserializeStructure(templateBody);
344818
- const templateId = parsedTemplate.Metadata?.TemplateId?.toString();
344852
+ const templateId = parsedTemplate.Metadata?.AWSToolsMetrics?.IaC_Generator?.toString();
344819
344853
  if (templateId) {
344820
344854
  cfn = new CfnTemplateGeneratorProvider(await buildCfnClient(this.props.sdkProvider, environment), this.ioHost.asIoHelper());
344821
344855
  const generatedTemplateSummary = await cfn.describeGeneratedTemplate(templateId);
@@ -350331,8 +350365,18 @@ function parseCommandLineArguments(args) {
350331
350365
  default: void 0,
350332
350366
  type: "boolean",
350333
350367
  alias: ["i"],
350334
- desc: "Interactive option for the flags command",
350368
+ desc: "Interactive option for the flags command"
350369
+ }).option("safe", {
350370
+ default: void 0,
350371
+ type: "boolean",
350372
+ desc: "Enable all feature flags that do not impact the user's application",
350335
350373
  requiresArg: false
350374
+ }).option("concurrency", {
350375
+ default: 4,
350376
+ type: "number",
350377
+ alias: ["n"],
350378
+ desc: "Maximum number of simultaneous synths to execute.",
350379
+ requiresArg: true
350336
350380
  })
350337
350381
  ).command(
350338
350382
  "deploy [STACKS..]",
@@ -355853,412 +355897,1270 @@ var require_enquirer = __commonJS({
355853
355897
  }
355854
355898
  });
355855
355899
 
355856
- // lib/commands/flag-operations.ts
355857
- async function handleFlags(flagData, ioHelper, options, toolkit) {
355858
- flagData = flagData.filter((flag) => !OBSOLETE_FLAGS.includes(flag.name));
355859
- if (flagData.length == 0) {
355860
- await ioHelper.defaults.error("The 'cdk flags' command is not compatible with the AWS CDK library used by your application. Please upgrade to 2.212.0 or above.");
355861
- return;
355862
- }
355863
- let params = {
355864
- flagData,
355865
- toolkit,
355866
- ioHelper,
355867
- recommended: options.recommended,
355868
- all: options.all,
355869
- value: options.value,
355870
- flagName: options.FLAGNAME,
355871
- default: options.default,
355872
- unconfigured: options.unconfigured
355873
- };
355874
- const interactiveOptions = Object.values(FlagsMenuOptions);
355875
- if (options.interactive) {
355876
- const prompt2 = new import_enquirer.Select({
355877
- name: "option",
355878
- message: "Menu",
355879
- choices: interactiveOptions
355880
- });
355881
- const answer = await prompt2.run();
355882
- if (answer == "Set all flags to recommended values" /* ALL_TO_RECOMMENDED */) {
355883
- params = {
355884
- ...params,
355885
- recommended: true,
355886
- all: true
355887
- };
355888
- await setMultipleFlags(params);
355889
- } else if (answer == "Set unconfigured flags to recommended values" /* UNCONFIGURED_TO_RECOMMENDED */) {
355890
- params = {
355891
- ...params,
355892
- recommended: true,
355893
- unconfigured: true
355894
- };
355895
- await setMultipleFlags(params);
355896
- } else if (answer == "Set unconfigured flags to their implied configuration (record current behavior)" /* UNCONFIGURED_TO_DEFAULT */) {
355897
- params = {
355898
- ...params,
355899
- default: true,
355900
- unconfigured: true
355901
- };
355902
- await setMultipleFlagsIfSupported(params);
355903
- } else if (answer == "Modify a specific flag" /* MODIFY_SPECIFIC_FLAG */) {
355904
- await setFlag(params, true);
355905
- } else if (answer == "Exit" /* EXIT */) {
355906
- return;
355907
- }
355908
- return;
355909
- }
355910
- if (options.FLAGNAME && options.all) {
355911
- await ioHelper.defaults.error("Error: Cannot use both --all and a specific flag name. Please use either --all to show all flags or specify a single flag name.");
355912
- return;
355913
- }
355914
- if ((options.value || options.recommended || options.default || options.unconfigured) && !options.set) {
355915
- await ioHelper.defaults.error("Error: This option can only be used with --set.");
355916
- return;
355917
- }
355918
- if (options.value && !options.FLAGNAME) {
355919
- await ioHelper.defaults.error("Error: --value requires a specific flag name. Please specify a flag name when providing a value.");
355920
- return;
355921
- }
355922
- if (options.recommended && options.default) {
355923
- await ioHelper.defaults.error("Error: Cannot use both --recommended and --default. Please choose one option.");
355924
- return;
355925
- }
355926
- if (options.unconfigured && options.all) {
355927
- await ioHelper.defaults.error("Error: Cannot use both --unconfigured and --all. Please choose one option.");
355928
- return;
355929
- }
355930
- if (options.unconfigured && options.FLAGNAME) {
355931
- await ioHelper.defaults.error("Error: Cannot use --unconfigured with a specific flag name. --unconfigured works with multiple flags.");
355932
- return;
355933
- }
355934
- if (options.set && options.FLAGNAME && !options.value) {
355935
- await ioHelper.defaults.error("Error: When setting a specific flag, you must provide a --value.");
355936
- return;
355937
- }
355938
- if (options.set && options.all && !options.recommended && !options.default) {
355939
- await ioHelper.defaults.error("Error: When using --set with --all, you must specify either --recommended or --default.");
355940
- return;
355941
- }
355942
- if (options.set && options.unconfigured && !options.recommended && !options.default) {
355943
- await ioHelper.defaults.error("Error: When using --set with --unconfigured, you must specify either --recommended or --default.");
355944
- return;
355945
- }
355946
- if (options.set && !options.all && !options.unconfigured && !options.FLAGNAME) {
355947
- await ioHelper.defaults.error("Error: When using --set, you must specify either --all, --unconfigured, or provide a specific flag name.");
355948
- return;
355949
- }
355950
- if (options.FLAGNAME && !options.set && !options.value) {
355951
- await displayFlags(params);
355952
- return;
355953
- }
355954
- if (options.all && !options.set) {
355955
- await displayFlags(params);
355956
- return;
355957
- }
355958
- if (options.set && options.FLAGNAME && options.value) {
355959
- await setFlag(params);
355960
- return;
355961
- }
355962
- if (!options.FLAGNAME && !options.all && !options.set) {
355963
- await displayFlags(params);
355964
- return;
355965
- }
355966
- if (options.set && options.all && options.recommended) {
355967
- await setMultipleFlags(params);
355968
- return;
355969
- }
355970
- if (options.set && options.all && options.default) {
355971
- await setMultipleFlagsIfSupported(params);
355972
- }
355973
- if (options.set && options.unconfigured && options.recommended) {
355974
- await setMultipleFlags(params);
355975
- return;
355976
- }
355977
- if (options.set && options.unconfigured && options.default) {
355978
- await setMultipleFlagsIfSupported(params);
355979
- }
355980
- }
355981
- async function setMultipleFlagsIfSupported(params) {
355982
- const { flagData, ioHelper } = params;
355983
- if (flagData[0].unconfiguredBehavesLike) {
355984
- await setMultipleFlags(params);
355985
- return;
355900
+ // lib/commands/flags/types.ts
355901
+ var FlagsMenuOptions;
355902
+ var init_types9 = __esm({
355903
+ "lib/commands/flags/types.ts"() {
355904
+ "use strict";
355905
+ FlagsMenuOptions = /* @__PURE__ */ ((FlagsMenuOptions2) => {
355906
+ FlagsMenuOptions2["ALL_TO_RECOMMENDED"] = "Set all flags to recommended values";
355907
+ FlagsMenuOptions2["UNCONFIGURED_TO_RECOMMENDED"] = "Set unconfigured flags to recommended values";
355908
+ FlagsMenuOptions2["UNCONFIGURED_TO_DEFAULT"] = "Set unconfigured flags to their implied configuration (record current behavior)";
355909
+ FlagsMenuOptions2["MODIFY_SPECIFIC_FLAG"] = "Modify a specific flag";
355910
+ FlagsMenuOptions2["EXIT"] = "Exit";
355911
+ return FlagsMenuOptions2;
355912
+ })(FlagsMenuOptions || {});
355986
355913
  }
355987
- await ioHelper.defaults.error("The --default options are not compatible with the AWS CDK library used by your application. Please upgrade to 2.212.0 or above.");
355988
- }
355989
- async function setFlag(params, interactive) {
355990
- const { flagData, ioHelper, flagName } = params;
355991
- let updatedParams = params;
355992
- let updatedFlagName = flagName;
355993
- if (interactive) {
355994
- const allFlagNames = flagData.filter((flag) => isBooleanFlag(flag) == true).map((flag) => flag.name);
355995
- const prompt2 = new import_enquirer.Select({
355996
- name: "flag",
355997
- message: "Select which flag you would like to modify:",
355998
- limit: 100,
355999
- choices: allFlagNames
356000
- });
356001
- const selectedFlagName = await prompt2.run();
356002
- updatedFlagName = [selectedFlagName];
356003
- const valuePrompt = new import_enquirer.Select({
356004
- name: "value",
356005
- message: "Select a value:",
356006
- choices: ["true", "false"]
356007
- });
356008
- const updatedValue = await valuePrompt.run();
356009
- updatedParams = {
356010
- ...params,
356011
- value: updatedValue,
356012
- flagName: updatedFlagName
355914
+ });
355915
+
355916
+ // lib/commands/flags/interactive-handler.ts
355917
+ var import_enquirer, InteractiveHandler;
355918
+ var init_interactive_handler = __esm({
355919
+ "lib/commands/flags/interactive-handler.ts"() {
355920
+ "use strict";
355921
+ import_enquirer = __toESM(require_enquirer());
355922
+ init_types9();
355923
+ InteractiveHandler = class {
355924
+ constructor(flags, flagOperations) {
355925
+ this.flags = flags;
355926
+ this.flagOperations = flagOperations;
355927
+ }
355928
+ static {
355929
+ __name(this, "InteractiveHandler");
355930
+ }
355931
+ /** Displays flags that have differences between user and recommended values */
355932
+ async displayFlagsWithDifferences() {
355933
+ const flagsWithDifferences = this.flags.filter((flag) => flag.userValue === void 0 || !this.isUserValueEqualToRecommended(flag));
355934
+ if (flagsWithDifferences.length > 0) {
355935
+ await this.flagOperations.displayFlagTable(flagsWithDifferences);
355936
+ }
355937
+ }
355938
+ /** Checks if user value matches recommended value */
355939
+ isUserValueEqualToRecommended(flag) {
355940
+ return String(flag.userValue) === String(flag.recommendedValue);
355941
+ }
355942
+ /** Main interactive mode handler that shows menu and processes user selection */
355943
+ async handleInteractiveMode() {
355944
+ await this.displayFlagsWithDifferences();
355945
+ const prompt2 = new import_enquirer.Select({
355946
+ name: "option",
355947
+ message: "Menu",
355948
+ choices: Object.values(FlagsMenuOptions)
355949
+ });
355950
+ const answer = await prompt2.run();
355951
+ switch (answer) {
355952
+ case "Set all flags to recommended values" /* ALL_TO_RECOMMENDED */:
355953
+ return { recommended: true, all: true, set: true };
355954
+ case "Set unconfigured flags to recommended values" /* UNCONFIGURED_TO_RECOMMENDED */:
355955
+ return { recommended: true, unconfigured: true, set: true };
355956
+ case "Set unconfigured flags to their implied configuration (record current behavior)" /* UNCONFIGURED_TO_DEFAULT */:
355957
+ return { default: true, unconfigured: true, set: true };
355958
+ case "Modify a specific flag" /* MODIFY_SPECIFIC_FLAG */:
355959
+ return this.handleSpecificFlagSelection();
355960
+ case "Exit" /* EXIT */:
355961
+ return null;
355962
+ default:
355963
+ return null;
355964
+ }
355965
+ }
355966
+ /** Handles the specific flag selection flow with flag and value prompts */
355967
+ async handleSpecificFlagSelection() {
355968
+ const booleanFlags = this.flags.filter((flag) => this.flagOperations.isBooleanFlag(flag));
355969
+ const flagPrompt = new import_enquirer.Select({
355970
+ name: "flag",
355971
+ message: "Select which flag you would like to modify:",
355972
+ limit: 100,
355973
+ choices: booleanFlags.map((flag) => flag.name)
355974
+ });
355975
+ const selectedFlagName = await flagPrompt.run();
355976
+ const valuePrompt = new import_enquirer.Select({
355977
+ name: "value",
355978
+ message: "Select a value:",
355979
+ choices: ["true", "false"]
355980
+ });
355981
+ const value = await valuePrompt.run();
355982
+ return {
355983
+ FLAGNAME: [selectedFlagName],
355984
+ value,
355985
+ set: true
355986
+ };
355987
+ }
356013
355988
  };
356014
- } else {
356015
- const flag = flagData.find((f3) => f3.name === flagName[0]);
356016
- if (!flag) {
356017
- await ioHelper.defaults.error("Flag not found.");
356018
- return;
355989
+ }
355990
+ });
355991
+
355992
+ // ../../node_modules/eventemitter3/index.js
355993
+ var require_eventemitter3 = __commonJS({
355994
+ "../../node_modules/eventemitter3/index.js"(exports2, module2) {
355995
+ "use strict";
355996
+ var has = Object.prototype.hasOwnProperty;
355997
+ var prefix2 = "~";
355998
+ function Events() {
356019
355999
  }
356020
- if (!isBooleanFlag(flag)) {
356021
- await ioHelper.defaults.error(`Flag '${flagName}' is not a boolean flag. Only boolean flags are currently supported.`);
356022
- return;
356000
+ __name(Events, "Events");
356001
+ if (Object.create) {
356002
+ Events.prototype = /* @__PURE__ */ Object.create(null);
356003
+ if (!new Events().__proto__) prefix2 = false;
356023
356004
  }
356024
- }
356025
- const prototypeSuccess = await prototypeChanges(updatedParams, updatedFlagName);
356026
- if (prototypeSuccess) {
356027
- await handleUserResponse(updatedParams, updatedFlagName);
356028
- }
356029
- }
356030
- async function prototypeChanges(params, flagNames) {
356031
- const { flagData, toolkit, ioHelper, recommended, value } = params;
356032
- const baseContext = new import_toolkit_lib18.CdkAppMultiContext(process.cwd());
356033
- const baseContextValues = await baseContext.read();
356034
- const memoryContext = new import_toolkit_lib18.MemoryContext(baseContextValues);
356035
- const cdkJson = await JSON.parse(await fs40.readFile(path37.join(process.cwd(), "cdk.json"), "utf-8"));
356036
- const app = cdkJson.app;
356037
- const source = await toolkit.fromCdkApp(app, {
356038
- contextStore: baseContext,
356039
- outdir: path37.join(process.cwd(), "original")
356040
- });
356041
- const updateObj = {};
356042
- const boolValue = toBooleanValue(value);
356043
- if (flagNames.length === 1 && value !== void 0) {
356044
- const flagName = flagNames[0];
356045
- if (baseContextValues[flagName] == boolValue) {
356046
- await ioHelper.defaults.info("Flag is already set to the specified value. No changes needed.");
356047
- return false;
356005
+ function EE(fn, context, once) {
356006
+ this.fn = fn;
356007
+ this.context = context;
356008
+ this.once = once || false;
356048
356009
  }
356049
- updateObj[flagName] = boolValue;
356050
- } else {
356051
- for (const flagName of flagNames) {
356052
- const flag = flagData.find((f3) => f3.name === flagName);
356053
- if (!flag) {
356054
- await ioHelper.defaults.error(`Flag ${flagName} not found.`);
356055
- return false;
356010
+ __name(EE, "EE");
356011
+ function addListener(emitter, event, fn, context, once) {
356012
+ if (typeof fn !== "function") {
356013
+ throw new TypeError("The listener must be a function");
356014
+ }
356015
+ var listener = new EE(fn, context || emitter, once), evt = prefix2 ? prefix2 + event : event;
356016
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
356017
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
356018
+ else emitter._events[evt] = [emitter._events[evt], listener];
356019
+ return emitter;
356020
+ }
356021
+ __name(addListener, "addListener");
356022
+ function clearEvent(emitter, evt) {
356023
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
356024
+ else delete emitter._events[evt];
356025
+ }
356026
+ __name(clearEvent, "clearEvent");
356027
+ function EventEmitter2() {
356028
+ this._events = new Events();
356029
+ this._eventsCount = 0;
356030
+ }
356031
+ __name(EventEmitter2, "EventEmitter");
356032
+ EventEmitter2.prototype.eventNames = /* @__PURE__ */ __name(function eventNames() {
356033
+ var names = [], events, name;
356034
+ if (this._eventsCount === 0) return names;
356035
+ for (name in events = this._events) {
356036
+ if (has.call(events, name)) names.push(prefix2 ? name.slice(1) : name);
356056
356037
  }
356057
- const newValue = recommended ? toBooleanValue(flag.recommendedValue) : String(flag.unconfiguredBehavesLike?.v2) === "true";
356058
- updateObj[flagName] = newValue;
356059
- }
356060
- }
356061
- await memoryContext.update(updateObj);
356062
- const cx = await toolkit.synth(source);
356063
- const assembly = cx.cloudAssembly;
356064
- const modifiedSource = await toolkit.fromCdkApp(app, {
356065
- contextStore: memoryContext,
356066
- outdir: path37.join(process.cwd(), "temp")
356067
- });
356068
- const modifiedCx = await toolkit.synth(modifiedSource);
356069
- const allStacks = assembly.stacksRecursively;
356070
- for (const stack of allStacks) {
356071
- const templatePath = stack.templateFullPath;
356072
- await toolkit.diff(modifiedCx, {
356073
- method: import_toolkit_lib18.DiffMethod.LocalFile(templatePath),
356074
- stacks: {
356075
- strategy: "pattern-must-match-single" /* PATTERN_MUST_MATCH_SINGLE */,
356076
- patterns: [stack.hierarchicalId]
356038
+ if (Object.getOwnPropertySymbols) {
356039
+ return names.concat(Object.getOwnPropertySymbols(events));
356040
+ }
356041
+ return names;
356042
+ }, "eventNames");
356043
+ EventEmitter2.prototype.listeners = /* @__PURE__ */ __name(function listeners(event) {
356044
+ var evt = prefix2 ? prefix2 + event : event, handlers = this._events[evt];
356045
+ if (!handlers) return [];
356046
+ if (handlers.fn) return [handlers.fn];
356047
+ for (var i3 = 0, l3 = handlers.length, ee = new Array(l3); i3 < l3; i3++) {
356048
+ ee[i3] = handlers[i3].fn;
356049
+ }
356050
+ return ee;
356051
+ }, "listeners");
356052
+ EventEmitter2.prototype.listenerCount = /* @__PURE__ */ __name(function listenerCount(event) {
356053
+ var evt = prefix2 ? prefix2 + event : event, listeners = this._events[evt];
356054
+ if (!listeners) return 0;
356055
+ if (listeners.fn) return 1;
356056
+ return listeners.length;
356057
+ }, "listenerCount");
356058
+ EventEmitter2.prototype.emit = /* @__PURE__ */ __name(function emit(event, a1, a22, a3, a4, a5) {
356059
+ var evt = prefix2 ? prefix2 + event : event;
356060
+ if (!this._events[evt]) return false;
356061
+ var listeners = this._events[evt], len = arguments.length, args, i3;
356062
+ if (listeners.fn) {
356063
+ if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
356064
+ switch (len) {
356065
+ case 1:
356066
+ return listeners.fn.call(listeners.context), true;
356067
+ case 2:
356068
+ return listeners.fn.call(listeners.context, a1), true;
356069
+ case 3:
356070
+ return listeners.fn.call(listeners.context, a1, a22), true;
356071
+ case 4:
356072
+ return listeners.fn.call(listeners.context, a1, a22, a3), true;
356073
+ case 5:
356074
+ return listeners.fn.call(listeners.context, a1, a22, a3, a4), true;
356075
+ case 6:
356076
+ return listeners.fn.call(listeners.context, a1, a22, a3, a4, a5), true;
356077
+ }
356078
+ for (i3 = 1, args = new Array(len - 1); i3 < len; i3++) {
356079
+ args[i3 - 1] = arguments[i3];
356080
+ }
356081
+ listeners.fn.apply(listeners.context, args);
356082
+ } else {
356083
+ var length = listeners.length, j3;
356084
+ for (i3 = 0; i3 < length; i3++) {
356085
+ if (listeners[i3].once) this.removeListener(event, listeners[i3].fn, void 0, true);
356086
+ switch (len) {
356087
+ case 1:
356088
+ listeners[i3].fn.call(listeners[i3].context);
356089
+ break;
356090
+ case 2:
356091
+ listeners[i3].fn.call(listeners[i3].context, a1);
356092
+ break;
356093
+ case 3:
356094
+ listeners[i3].fn.call(listeners[i3].context, a1, a22);
356095
+ break;
356096
+ case 4:
356097
+ listeners[i3].fn.call(listeners[i3].context, a1, a22, a3);
356098
+ break;
356099
+ default:
356100
+ if (!args) for (j3 = 1, args = new Array(len - 1); j3 < len; j3++) {
356101
+ args[j3 - 1] = arguments[j3];
356102
+ }
356103
+ listeners[i3].fn.apply(listeners[i3].context, args);
356104
+ }
356105
+ }
356077
356106
  }
356078
- });
356079
- }
356080
- return true;
356081
- }
356082
- async function setMultipleFlags(params) {
356083
- const { flagData, all } = params;
356084
- let flagsToSet;
356085
- if (all) {
356086
- flagsToSet = flagData.filter((flag) => flag.userValue === void 0 || !isUserValueEqualToRecommended(flag)).filter((flag) => isBooleanFlag(flag)).map((flag) => flag.name);
356087
- } else {
356088
- flagsToSet = flagData.filter((flag) => flag.userValue === void 0).filter((flag) => isBooleanFlag(flag)).map((flag) => flag.name);
356089
- }
356090
- const prototypeSuccess = await prototypeChanges(params, flagsToSet);
356091
- if (prototypeSuccess) {
356092
- await handleUserResponse(params, flagsToSet);
356093
- }
356094
- }
356095
- async function handleUserResponse(params, flagNames) {
356096
- const { ioHelper } = params;
356097
- const userAccepted = await ioHelper.requestResponse({
356098
- time: /* @__PURE__ */ new Date(),
356099
- level: "info",
356100
- code: "CDK_TOOLKIT_I9300",
356101
- message: "Do you want to accept these changes?",
356102
- data: {
356103
- flagNames,
356104
- responseDescription: 'Enter "y" to apply changes or "n" to cancel'
356105
- },
356106
- defaultResponse: false
356107
- });
356108
- if (userAccepted) {
356109
- await modifyValues(params, flagNames);
356110
- await ioHelper.defaults.info("Flag value(s) updated successfully.");
356111
- } else {
356112
- await ioHelper.defaults.info("Operation cancelled");
356113
- }
356114
- const originalDir = path37.join(process.cwd(), "original");
356115
- const tempDir = path37.join(process.cwd(), "temp");
356116
- await fs40.remove(originalDir);
356117
- await fs40.remove(tempDir);
356118
- }
356119
- async function modifyValues(params, flagNames) {
356120
- const { flagData, ioHelper, value, recommended } = params;
356121
- const cdkJsonPath = path37.join(process.cwd(), "cdk.json");
356122
- const cdkJsonContent = await fs40.readFile(cdkJsonPath, "utf-8");
356123
- const cdkJson = JSON.parse(cdkJsonContent);
356124
- if (flagNames.length == 1) {
356125
- const boolValue = toBooleanValue(value);
356126
- cdkJson.context[String(flagNames[0])] = boolValue;
356127
- await ioHelper.defaults.info(`Setting flag '${flagNames}' to: ${boolValue}`);
356128
- } else {
356129
- for (const flagName of flagNames) {
356130
- const flag = flagData.find((f3) => f3.name === flagName);
356131
- const newValue = recommended ? toBooleanValue(flag.recommendedValue) : String(flag.unconfiguredBehavesLike?.v2) === "true";
356132
- cdkJson.context[flagName] = newValue;
356107
+ return true;
356108
+ }, "emit");
356109
+ EventEmitter2.prototype.on = /* @__PURE__ */ __name(function on(event, fn, context) {
356110
+ return addListener(this, event, fn, context, false);
356111
+ }, "on");
356112
+ EventEmitter2.prototype.once = /* @__PURE__ */ __name(function once(event, fn, context) {
356113
+ return addListener(this, event, fn, context, true);
356114
+ }, "once");
356115
+ EventEmitter2.prototype.removeListener = /* @__PURE__ */ __name(function removeListener(event, fn, context, once) {
356116
+ var evt = prefix2 ? prefix2 + event : event;
356117
+ if (!this._events[evt]) return this;
356118
+ if (!fn) {
356119
+ clearEvent(this, evt);
356120
+ return this;
356121
+ }
356122
+ var listeners = this._events[evt];
356123
+ if (listeners.fn) {
356124
+ if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
356125
+ clearEvent(this, evt);
356126
+ }
356127
+ } else {
356128
+ for (var i3 = 0, events = [], length = listeners.length; i3 < length; i3++) {
356129
+ if (listeners[i3].fn !== fn || once && !listeners[i3].once || context && listeners[i3].context !== context) {
356130
+ events.push(listeners[i3]);
356131
+ }
356132
+ }
356133
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
356134
+ else clearEvent(this, evt);
356135
+ }
356136
+ return this;
356137
+ }, "removeListener");
356138
+ EventEmitter2.prototype.removeAllListeners = /* @__PURE__ */ __name(function removeAllListeners(event) {
356139
+ var evt;
356140
+ if (event) {
356141
+ evt = prefix2 ? prefix2 + event : event;
356142
+ if (this._events[evt]) clearEvent(this, evt);
356143
+ } else {
356144
+ this._events = new Events();
356145
+ this._eventsCount = 0;
356146
+ }
356147
+ return this;
356148
+ }, "removeAllListeners");
356149
+ EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
356150
+ EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
356151
+ EventEmitter2.prefixed = prefix2;
356152
+ EventEmitter2.EventEmitter = EventEmitter2;
356153
+ if ("undefined" !== typeof module2) {
356154
+ module2.exports = EventEmitter2;
356133
356155
  }
356134
356156
  }
356135
- await fs40.writeFile(cdkJsonPath, JSON.stringify(cdkJson, null, 2), "utf-8");
356136
- }
356137
- function getFlagSortOrder(flag) {
356138
- if (flag.userValue === void 0) {
356139
- return 3;
356140
- } else if (isUserValueEqualToRecommended(flag)) {
356141
- return 1;
356142
- } else {
356143
- return 2;
356144
- }
356145
- }
356146
- async function displayFlagTable(flags, ioHelper) {
356147
- const filteredFlags = flags.filter((flag) => flag.unconfiguredBehavesLike?.v2 !== flag.recommendedValue);
356148
- const sortedFlags = [...filteredFlags].sort((a3, b3) => {
356149
- const orderA = getFlagSortOrder(a3);
356150
- const orderB = getFlagSortOrder(b3);
356151
- if (orderA !== orderB) {
356152
- return orderA - orderB;
356153
- }
356154
- if (a3.module !== b3.module) {
356155
- return a3.module.localeCompare(b3.module);
356156
- }
356157
- return a3.name.localeCompare(b3.name);
356158
- });
356159
- const rows = [];
356160
- rows.push(["Feature Flag Name", "Recommended Value", "User Value"]);
356161
- let currentModule = "";
356162
- sortedFlags.forEach((flag) => {
356163
- if (flag.module !== currentModule) {
356164
- rows.push([chalk34.bold(`Module: ${flag.module}`), "", ""]);
356165
- currentModule = flag.module;
356166
- }
356167
- rows.push([
356168
- ` ${flag.name}`,
356169
- String(flag.recommendedValue),
356170
- flag.userValue === void 0 ? "<unset>" : String(flag.userValue)
356171
- ]);
356172
- });
356173
- const formattedTable = (0, import_cloudformation_diff4.formatTable)(rows, void 0, true);
356174
- await ioHelper.defaults.info(formattedTable);
356175
- }
356176
- async function displayFlags(params) {
356177
- const { flagData, ioHelper, flagName, all } = params;
356178
- if (flagName && flagName.length > 0) {
356179
- const matchingFlags = flagData.filter(
356180
- (f3) => flagName.some((searchTerm) => f3.name.toLowerCase().includes(searchTerm.toLowerCase()))
356181
- );
356182
- if (matchingFlags.length === 0) {
356183
- await ioHelper.defaults.error(`Flag matching "${flagName.join(", ")}" not found.`);
356184
- return;
356185
- }
356186
- if (matchingFlags.length === 1) {
356187
- const flag = matchingFlags[0];
356188
- await ioHelper.defaults.info(`Flag name: ${flag.name}`);
356189
- await ioHelper.defaults.info(`Description: ${flag.explanation}`);
356190
- await ioHelper.defaults.info(`Recommended value: ${flag.recommendedValue}`);
356191
- await ioHelper.defaults.info(`User value: ${flag.userValue}`);
356192
- return;
356193
- }
356194
- await ioHelper.defaults.info(`Found ${matchingFlags.length} flags matching "${flagName.join(", ")}":`);
356195
- await displayFlagTable(matchingFlags, ioHelper);
356196
- return;
356157
+ });
356158
+
356159
+ // ../../node_modules/p-finally/index.js
356160
+ var require_p_finally = __commonJS({
356161
+ "../../node_modules/p-finally/index.js"(exports2, module2) {
356162
+ "use strict";
356163
+ module2.exports = (promise, onFinally) => {
356164
+ onFinally = onFinally || (() => {
356165
+ });
356166
+ return promise.then(
356167
+ (val) => new Promise((resolve13) => {
356168
+ resolve13(onFinally());
356169
+ }).then(() => val),
356170
+ (err) => new Promise((resolve13) => {
356171
+ resolve13(onFinally());
356172
+ }).then(() => {
356173
+ throw err;
356174
+ })
356175
+ );
356176
+ };
356197
356177
  }
356198
- let flagsToDisplay;
356199
- if (all) {
356200
- flagsToDisplay = flagData;
356201
- } else {
356202
- flagsToDisplay = flagData.filter(
356203
- (flag) => flag.userValue === void 0 || !isUserValueEqualToRecommended(flag)
356204
- );
356178
+ });
356179
+
356180
+ // ../../node_modules/p-timeout/index.js
356181
+ var require_p_timeout = __commonJS({
356182
+ "../../node_modules/p-timeout/index.js"(exports2, module2) {
356183
+ "use strict";
356184
+ var pFinally = require_p_finally();
356185
+ var TimeoutError = class extends Error {
356186
+ static {
356187
+ __name(this, "TimeoutError");
356188
+ }
356189
+ constructor(message2) {
356190
+ super(message2);
356191
+ this.name = "TimeoutError";
356192
+ }
356193
+ };
356194
+ var pTimeout = /* @__PURE__ */ __name((promise, milliseconds, fallback) => new Promise((resolve13, reject) => {
356195
+ if (typeof milliseconds !== "number" || milliseconds < 0) {
356196
+ throw new TypeError("Expected `milliseconds` to be a positive number");
356197
+ }
356198
+ if (milliseconds === Infinity) {
356199
+ resolve13(promise);
356200
+ return;
356201
+ }
356202
+ const timer = setTimeout(() => {
356203
+ if (typeof fallback === "function") {
356204
+ try {
356205
+ resolve13(fallback());
356206
+ } catch (error5) {
356207
+ reject(error5);
356208
+ }
356209
+ return;
356210
+ }
356211
+ const message2 = typeof fallback === "string" ? fallback : `Promise timed out after ${milliseconds} milliseconds`;
356212
+ const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message2);
356213
+ if (typeof promise.cancel === "function") {
356214
+ promise.cancel();
356215
+ }
356216
+ reject(timeoutError);
356217
+ }, milliseconds);
356218
+ pFinally(
356219
+ // eslint-disable-next-line promise/prefer-await-to-then
356220
+ promise.then(resolve13, reject),
356221
+ () => {
356222
+ clearTimeout(timer);
356223
+ }
356224
+ );
356225
+ }), "pTimeout");
356226
+ module2.exports = pTimeout;
356227
+ module2.exports.default = pTimeout;
356228
+ module2.exports.TimeoutError = TimeoutError;
356205
356229
  }
356206
- await displayFlagTable(flagsToDisplay, ioHelper);
356207
- if (!all && flagsToDisplay.length === 0) {
356208
- await ioHelper.defaults.info("");
356209
- await ioHelper.defaults.info("\u2705 All feature flags are already set to their recommended values.");
356210
- await ioHelper.defaults.info("Use 'cdk flags --all --unstable=flags' to see all flags and their current values.");
356230
+ });
356231
+
356232
+ // ../../node_modules/p-queue/dist/lower-bound.js
356233
+ var require_lower_bound = __commonJS({
356234
+ "../../node_modules/p-queue/dist/lower-bound.js"(exports2) {
356235
+ "use strict";
356236
+ Object.defineProperty(exports2, "__esModule", { value: true });
356237
+ function lowerBound(array, value, comparator) {
356238
+ let first = 0;
356239
+ let count = array.length;
356240
+ while (count > 0) {
356241
+ const step = count / 2 | 0;
356242
+ let it = first + step;
356243
+ if (comparator(array[it], value) <= 0) {
356244
+ first = ++it;
356245
+ count -= step + 1;
356246
+ } else {
356247
+ count = step;
356248
+ }
356249
+ }
356250
+ return first;
356251
+ }
356252
+ __name(lowerBound, "lowerBound");
356253
+ exports2.default = lowerBound;
356211
356254
  }
356212
- }
356213
- function isUserValueEqualToRecommended(flag) {
356214
- return String(flag.userValue) === String(flag.recommendedValue);
356215
- }
356216
- function toBooleanValue(value) {
356217
- if (typeof value === "boolean") {
356218
- return value;
356255
+ });
356256
+
356257
+ // ../../node_modules/p-queue/dist/priority-queue.js
356258
+ var require_priority_queue = __commonJS({
356259
+ "../../node_modules/p-queue/dist/priority-queue.js"(exports2) {
356260
+ "use strict";
356261
+ Object.defineProperty(exports2, "__esModule", { value: true });
356262
+ var lower_bound_1 = require_lower_bound();
356263
+ var PriorityQueue = class {
356264
+ static {
356265
+ __name(this, "PriorityQueue");
356266
+ }
356267
+ constructor() {
356268
+ this._queue = [];
356269
+ }
356270
+ enqueue(run, options) {
356271
+ options = Object.assign({ priority: 0 }, options);
356272
+ const element = {
356273
+ priority: options.priority,
356274
+ run
356275
+ };
356276
+ if (this.size && this._queue[this.size - 1].priority >= options.priority) {
356277
+ this._queue.push(element);
356278
+ return;
356279
+ }
356280
+ const index = lower_bound_1.default(this._queue, element, (a3, b3) => b3.priority - a3.priority);
356281
+ this._queue.splice(index, 0, element);
356282
+ }
356283
+ dequeue() {
356284
+ const item = this._queue.shift();
356285
+ return item === null || item === void 0 ? void 0 : item.run;
356286
+ }
356287
+ filter(options) {
356288
+ return this._queue.filter((element) => element.priority === options.priority).map((element) => element.run);
356289
+ }
356290
+ get size() {
356291
+ return this._queue.length;
356292
+ }
356293
+ };
356294
+ exports2.default = PriorityQueue;
356219
356295
  }
356220
- if (typeof value === "string") {
356221
- return value.toLowerCase() === "true";
356296
+ });
356297
+
356298
+ // ../../node_modules/p-queue/dist/index.js
356299
+ var require_dist3 = __commonJS({
356300
+ "../../node_modules/p-queue/dist/index.js"(exports2) {
356301
+ "use strict";
356302
+ Object.defineProperty(exports2, "__esModule", { value: true });
356303
+ var EventEmitter2 = require_eventemitter3();
356304
+ var p_timeout_1 = require_p_timeout();
356305
+ var priority_queue_1 = require_priority_queue();
356306
+ var empty = /* @__PURE__ */ __name(() => {
356307
+ }, "empty");
356308
+ var timeoutError = new p_timeout_1.TimeoutError();
356309
+ var PQueue2 = class extends EventEmitter2 {
356310
+ static {
356311
+ __name(this, "PQueue");
356312
+ }
356313
+ constructor(options) {
356314
+ var _a2, _b, _c, _d;
356315
+ super();
356316
+ this._intervalCount = 0;
356317
+ this._intervalEnd = 0;
356318
+ this._pendingCount = 0;
356319
+ this._resolveEmpty = empty;
356320
+ this._resolveIdle = empty;
356321
+ options = Object.assign({ carryoverConcurrencyCount: false, intervalCap: Infinity, interval: 0, concurrency: Infinity, autoStart: true, queueClass: priority_queue_1.default }, options);
356322
+ if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
356323
+ throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(_b = (_a2 = options.intervalCap) === null || _a2 === void 0 ? void 0 : _a2.toString()) !== null && _b !== void 0 ? _b : ""}\` (${typeof options.intervalCap})`);
356324
+ }
356325
+ if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
356326
+ throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(_d = (_c = options.interval) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ""}\` (${typeof options.interval})`);
356327
+ }
356328
+ this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;
356329
+ this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;
356330
+ this._intervalCap = options.intervalCap;
356331
+ this._interval = options.interval;
356332
+ this._queue = new options.queueClass();
356333
+ this._queueClass = options.queueClass;
356334
+ this.concurrency = options.concurrency;
356335
+ this._timeout = options.timeout;
356336
+ this._throwOnTimeout = options.throwOnTimeout === true;
356337
+ this._isPaused = options.autoStart === false;
356338
+ }
356339
+ get _doesIntervalAllowAnother() {
356340
+ return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
356341
+ }
356342
+ get _doesConcurrentAllowAnother() {
356343
+ return this._pendingCount < this._concurrency;
356344
+ }
356345
+ _next() {
356346
+ this._pendingCount--;
356347
+ this._tryToStartAnother();
356348
+ this.emit("next");
356349
+ }
356350
+ _resolvePromises() {
356351
+ this._resolveEmpty();
356352
+ this._resolveEmpty = empty;
356353
+ if (this._pendingCount === 0) {
356354
+ this._resolveIdle();
356355
+ this._resolveIdle = empty;
356356
+ this.emit("idle");
356357
+ }
356358
+ }
356359
+ _onResumeInterval() {
356360
+ this._onInterval();
356361
+ this._initializeIntervalIfNeeded();
356362
+ this._timeoutId = void 0;
356363
+ }
356364
+ _isIntervalPaused() {
356365
+ const now = Date.now();
356366
+ if (this._intervalId === void 0) {
356367
+ const delay = this._intervalEnd - now;
356368
+ if (delay < 0) {
356369
+ this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
356370
+ } else {
356371
+ if (this._timeoutId === void 0) {
356372
+ this._timeoutId = setTimeout(() => {
356373
+ this._onResumeInterval();
356374
+ }, delay);
356375
+ }
356376
+ return true;
356377
+ }
356378
+ }
356379
+ return false;
356380
+ }
356381
+ _tryToStartAnother() {
356382
+ if (this._queue.size === 0) {
356383
+ if (this._intervalId) {
356384
+ clearInterval(this._intervalId);
356385
+ }
356386
+ this._intervalId = void 0;
356387
+ this._resolvePromises();
356388
+ return false;
356389
+ }
356390
+ if (!this._isPaused) {
356391
+ const canInitializeInterval = !this._isIntervalPaused();
356392
+ if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
356393
+ const job = this._queue.dequeue();
356394
+ if (!job) {
356395
+ return false;
356396
+ }
356397
+ this.emit("active");
356398
+ job();
356399
+ if (canInitializeInterval) {
356400
+ this._initializeIntervalIfNeeded();
356401
+ }
356402
+ return true;
356403
+ }
356404
+ }
356405
+ return false;
356406
+ }
356407
+ _initializeIntervalIfNeeded() {
356408
+ if (this._isIntervalIgnored || this._intervalId !== void 0) {
356409
+ return;
356410
+ }
356411
+ this._intervalId = setInterval(() => {
356412
+ this._onInterval();
356413
+ }, this._interval);
356414
+ this._intervalEnd = Date.now() + this._interval;
356415
+ }
356416
+ _onInterval() {
356417
+ if (this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId) {
356418
+ clearInterval(this._intervalId);
356419
+ this._intervalId = void 0;
356420
+ }
356421
+ this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
356422
+ this._processQueue();
356423
+ }
356424
+ /**
356425
+ Executes all queued functions until it reaches the limit.
356426
+ */
356427
+ _processQueue() {
356428
+ while (this._tryToStartAnother()) {
356429
+ }
356430
+ }
356431
+ get concurrency() {
356432
+ return this._concurrency;
356433
+ }
356434
+ set concurrency(newConcurrency) {
356435
+ if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
356436
+ throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
356437
+ }
356438
+ this._concurrency = newConcurrency;
356439
+ this._processQueue();
356440
+ }
356441
+ /**
356442
+ Adds a sync or async task to the queue. Always returns a promise.
356443
+ */
356444
+ async add(fn, options = {}) {
356445
+ return new Promise((resolve13, reject) => {
356446
+ const run = /* @__PURE__ */ __name(async () => {
356447
+ this._pendingCount++;
356448
+ this._intervalCount++;
356449
+ try {
356450
+ const operation = this._timeout === void 0 && options.timeout === void 0 ? fn() : p_timeout_1.default(Promise.resolve(fn()), options.timeout === void 0 ? this._timeout : options.timeout, () => {
356451
+ if (options.throwOnTimeout === void 0 ? this._throwOnTimeout : options.throwOnTimeout) {
356452
+ reject(timeoutError);
356453
+ }
356454
+ return void 0;
356455
+ });
356456
+ resolve13(await operation);
356457
+ } catch (error5) {
356458
+ reject(error5);
356459
+ }
356460
+ this._next();
356461
+ }, "run");
356462
+ this._queue.enqueue(run, options);
356463
+ this._tryToStartAnother();
356464
+ this.emit("add");
356465
+ });
356466
+ }
356467
+ /**
356468
+ Same as `.add()`, but accepts an array of sync or async functions.
356469
+
356470
+ @returns A promise that resolves when all functions are resolved.
356471
+ */
356472
+ async addAll(functions, options) {
356473
+ return Promise.all(functions.map(async (function_) => this.add(function_, options)));
356474
+ }
356475
+ /**
356476
+ Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
356477
+ */
356478
+ start() {
356479
+ if (!this._isPaused) {
356480
+ return this;
356481
+ }
356482
+ this._isPaused = false;
356483
+ this._processQueue();
356484
+ return this;
356485
+ }
356486
+ /**
356487
+ Put queue execution on hold.
356488
+ */
356489
+ pause() {
356490
+ this._isPaused = true;
356491
+ }
356492
+ /**
356493
+ Clear the queue.
356494
+ */
356495
+ clear() {
356496
+ this._queue = new this._queueClass();
356497
+ }
356498
+ /**
356499
+ Can be called multiple times. Useful if you for example add additional items at a later time.
356500
+
356501
+ @returns A promise that settles when the queue becomes empty.
356502
+ */
356503
+ async onEmpty() {
356504
+ if (this._queue.size === 0) {
356505
+ return;
356506
+ }
356507
+ return new Promise((resolve13) => {
356508
+ const existingResolve = this._resolveEmpty;
356509
+ this._resolveEmpty = () => {
356510
+ existingResolve();
356511
+ resolve13();
356512
+ };
356513
+ });
356514
+ }
356515
+ /**
356516
+ The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
356517
+
356518
+ @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
356519
+ */
356520
+ async onIdle() {
356521
+ if (this._pendingCount === 0 && this._queue.size === 0) {
356522
+ return;
356523
+ }
356524
+ return new Promise((resolve13) => {
356525
+ const existingResolve = this._resolveIdle;
356526
+ this._resolveIdle = () => {
356527
+ existingResolve();
356528
+ resolve13();
356529
+ };
356530
+ });
356531
+ }
356532
+ /**
356533
+ Size of the queue.
356534
+ */
356535
+ get size() {
356536
+ return this._queue.size;
356537
+ }
356538
+ /**
356539
+ Size of the queue, filtered by the given options.
356540
+
356541
+ For example, this can be used to find the number of items remaining in the queue with a specific priority level.
356542
+ */
356543
+ sizeBy(options) {
356544
+ return this._queue.filter(options).length;
356545
+ }
356546
+ /**
356547
+ Number of pending promises.
356548
+ */
356549
+ get pending() {
356550
+ return this._pendingCount;
356551
+ }
356552
+ /**
356553
+ Whether the queue is currently paused.
356554
+ */
356555
+ get isPaused() {
356556
+ return this._isPaused;
356557
+ }
356558
+ get timeout() {
356559
+ return this._timeout;
356560
+ }
356561
+ /**
356562
+ Set the timeout for future operations.
356563
+ */
356564
+ set timeout(milliseconds) {
356565
+ this._timeout = milliseconds;
356566
+ }
356567
+ };
356568
+ exports2.default = PQueue2;
356222
356569
  }
356223
- return false;
356224
- }
356225
- function isBooleanFlag(flag) {
356226
- const recommended = flag.recommendedValue;
356227
- return typeof recommended === "boolean" || recommended === "true" || recommended === "false";
356228
- }
356229
- var path37, import_cloudformation_diff4, import_toolkit_lib18, chalk34, import_enquirer, fs40, FlagsMenuOptions;
356230
- var init_flag_operations = __esm({
356231
- "lib/commands/flag-operations.ts"() {
356570
+ });
356571
+
356572
+ // lib/commands/flags/operations.ts
356573
+ var os12, path37, import_cloudformation_diff4, import_toolkit_lib18, chalk34, fs40, import_p_queue, FlagOperations;
356574
+ var init_operations = __esm({
356575
+ "lib/commands/flags/operations.ts"() {
356232
356576
  "use strict";
356577
+ os12 = __toESM(require("os"));
356233
356578
  path37 = __toESM(require("path"));
356234
356579
  import_cloudformation_diff4 = __toESM(require_lib11());
356235
356580
  import_toolkit_lib18 = __toESM(require_lib12());
356236
356581
  chalk34 = __toESM(require_source());
356237
- import_enquirer = __toESM(require_enquirer());
356238
356582
  fs40 = __toESM(require_lib13());
356583
+ import_p_queue = __toESM(require_dist3());
356239
356584
  init_api();
356585
+ FlagOperations = class {
356586
+ constructor(flags, toolkit, ioHelper) {
356587
+ this.flags = flags;
356588
+ this.toolkit = toolkit;
356589
+ this.ioHelper = ioHelper;
356590
+ this.app = "";
356591
+ this.baseContextValues = {};
356592
+ this.allStacks = [];
356593
+ this.queue = new import_p_queue.default({ concurrency: 4 });
356594
+ }
356595
+ static {
356596
+ __name(this, "FlagOperations");
356597
+ }
356598
+ /** Main entry point that routes to either flag setting or display operations */
356599
+ async execute(params) {
356600
+ if (params.set) {
356601
+ if (params.FLAGNAME && params.value) {
356602
+ await this.setFlag(params);
356603
+ } else {
356604
+ await this.setMultipleFlags(params);
356605
+ }
356606
+ } else {
356607
+ await this.displayFlags(params);
356608
+ }
356609
+ }
356610
+ /** Sets a single specific flag with validation and user confirmation */
356611
+ async setFlag(params) {
356612
+ const flagName = params.FLAGNAME[0];
356613
+ const flag = this.flags.find((f3) => f3.name === flagName);
356614
+ if (!flag) {
356615
+ await this.ioHelper.defaults.error("Flag not found.");
356616
+ return;
356617
+ }
356618
+ if (!this.isBooleanFlag(flag)) {
356619
+ await this.ioHelper.defaults.error(`Flag '${flagName}' is not a boolean flag. Only boolean flags are currently supported.`);
356620
+ return;
356621
+ }
356622
+ const prototypeSuccess = await this.prototypeChanges([flagName], params);
356623
+ if (prototypeSuccess) {
356624
+ await this.handleUserResponse([flagName], params);
356625
+ }
356626
+ }
356627
+ /** Sets multiple flags (all or unconfigured) with validation and user confirmation */
356628
+ async setMultipleFlags(params) {
356629
+ if (params.default && !this.flags.some((f3) => f3.unconfiguredBehavesLike)) {
356630
+ await this.ioHelper.defaults.error("The --default options are not compatible with the AWS CDK library used by your application. Please upgrade to 2.212.0 or above.");
356631
+ return;
356632
+ }
356633
+ const flagsToSet = this.getFlagsToSet(params);
356634
+ const prototypeSuccess = await this.prototypeChanges(flagsToSet, params);
356635
+ if (prototypeSuccess) {
356636
+ await this.handleUserResponse(flagsToSet, params);
356637
+ }
356638
+ }
356639
+ /** Determines which flags should be set based on the provided parameters */
356640
+ getFlagsToSet(params) {
356641
+ if (params.all && params.default) {
356642
+ return this.flags.filter((flag) => this.isBooleanFlag(flag)).map((flag) => flag.name);
356643
+ } else if (params.all) {
356644
+ return this.flags.filter((flag) => flag.userValue === void 0 || !this.isUserValueEqualToRecommended(flag)).filter((flag) => this.isBooleanFlag(flag)).map((flag) => flag.name);
356645
+ } else {
356646
+ return this.flags.filter((flag) => flag.userValue === void 0).filter((flag) => this.isBooleanFlag(flag)).map((flag) => flag.name);
356647
+ }
356648
+ }
356649
+ /** Sets flags that don't cause template changes */
356650
+ async setSafeFlags(params) {
356651
+ const cdkJson = await JSON.parse(await fs40.readFile(path37.join(process.cwd(), "cdk.json"), "utf-8"));
356652
+ this.app = params.app || cdkJson.app;
356653
+ const isUsingTsNode = this.app.includes("ts-node");
356654
+ if (isUsingTsNode && !this.app.includes("-T") && !this.app.includes("--transpileOnly")) {
356655
+ await this.ioHelper.defaults.info(`Repeated synths with ts-node will type-check the application on every synth. Add --transpileOnly to cdk.json's "app" command to make this operation faster.`);
356656
+ }
356657
+ const unconfiguredFlags = this.flags.filter((flag) => flag.userValue === void 0 && this.isBooleanFlag(flag));
356658
+ if (unconfiguredFlags.length === 0) {
356659
+ await this.ioHelper.defaults.info("All feature flags are configured.");
356660
+ return;
356661
+ }
356662
+ await this.initializeSafetyCheck();
356663
+ const safeFlags = await this.batchTestFlags(unconfiguredFlags);
356664
+ await this.cleanupSafetyCheck();
356665
+ if (safeFlags.length > 0) {
356666
+ await this.ioHelper.defaults.info("Flags that can be set without template changes:");
356667
+ for (const flag of safeFlags) {
356668
+ await this.ioHelper.defaults.info(`- ${flag.name} -> ${flag.recommendedValue}`);
356669
+ }
356670
+ await this.handleUserResponse(safeFlags.map((flag) => flag.name), { ...params, recommended: true });
356671
+ } else {
356672
+ await this.ioHelper.defaults.info("No more flags can be set without causing template changes.");
356673
+ }
356674
+ }
356675
+ /** Initializes the safety check by reading context and synthesizing baseline templates */
356676
+ async initializeSafetyCheck() {
356677
+ const baseContext = new import_toolkit_lib18.CdkAppMultiContext(process.cwd());
356678
+ this.baseContextValues = await baseContext.read();
356679
+ this.baselineTempDir = fs40.mkdtempSync(path37.join(os12.tmpdir(), "cdk-baseline-"));
356680
+ const baseSource = await this.toolkit.fromCdkApp(this.app, {
356681
+ contextStore: baseContext,
356682
+ outdir: this.baselineTempDir
356683
+ });
356684
+ const baseCx = await this.toolkit.synth(baseSource);
356685
+ const baseAssembly = baseCx.cloudAssembly;
356686
+ this.allStacks = baseAssembly.stacksRecursively;
356687
+ this.queue = new import_p_queue.default({ concurrency: 4 });
356688
+ }
356689
+ /** Cleans up temporary directories created during safety checks */
356690
+ async cleanupSafetyCheck() {
356691
+ if (this.baselineTempDir) {
356692
+ await fs40.remove(this.baselineTempDir);
356693
+ this.baselineTempDir = void 0;
356694
+ }
356695
+ }
356696
+ /** Tests multiple flags together and isolates unsafe ones using binary search */
356697
+ async batchTestFlags(flags) {
356698
+ if (flags.length === 0) return [];
356699
+ const allFlagsContext = { ...this.baseContextValues };
356700
+ flags.forEach((flag) => {
356701
+ allFlagsContext[flag.name] = flag.recommendedValue;
356702
+ });
356703
+ const allSafe = await this.testBatch(allFlagsContext);
356704
+ if (allSafe) return flags;
356705
+ return this.isolateUnsafeFlags(flags);
356706
+ }
356707
+ /** Tests if a set of context values causes template changes by synthesizing and diffing */
356708
+ async testBatch(contextValues) {
356709
+ const testContext = new import_toolkit_lib18.MemoryContext(contextValues);
356710
+ const tempDir = fs40.mkdtempSync(path37.join(os12.tmpdir(), "cdk-test-"));
356711
+ const testSource = await this.toolkit.fromCdkApp(this.app, {
356712
+ contextStore: testContext,
356713
+ outdir: tempDir
356714
+ });
356715
+ const testCx = await this.toolkit.synth(testSource);
356716
+ try {
356717
+ for (const stack of this.allStacks) {
356718
+ const templatePath = stack.templateFullPath;
356719
+ const diff = await this.toolkit.diff(testCx, {
356720
+ method: import_toolkit_lib18.DiffMethod.LocalFile(templatePath),
356721
+ stacks: {
356722
+ strategy: "pattern-must-match-single" /* PATTERN_MUST_MATCH_SINGLE */,
356723
+ patterns: [stack.hierarchicalId]
356724
+ }
356725
+ });
356726
+ for (const stackDiff of Object.values(diff)) {
356727
+ if (stackDiff.differenceCount > 0) {
356728
+ return false;
356729
+ }
356730
+ }
356731
+ }
356732
+ return true;
356733
+ } finally {
356734
+ await fs40.remove(tempDir);
356735
+ }
356736
+ }
356737
+ /** Uses binary search to isolate which flags are safe to set without template changes */
356738
+ async isolateUnsafeFlags(flags) {
356739
+ const safeFlags = [];
356740
+ const processBatch = /* @__PURE__ */ __name(async (batch, contextValues) => {
356741
+ if (batch.length === 1) {
356742
+ const isSafe = await this.testBatch(
356743
+ { ...contextValues, [batch[0].name]: batch[0].recommendedValue }
356744
+ );
356745
+ if (isSafe) safeFlags.push(batch[0]);
356746
+ return;
356747
+ }
356748
+ const batchContext = { ...contextValues };
356749
+ batch.forEach((flag) => {
356750
+ batchContext[flag.name] = flag.recommendedValue;
356751
+ });
356752
+ const isSafeBatch = await this.testBatch(batchContext);
356753
+ if (isSafeBatch) {
356754
+ safeFlags.push(...batch);
356755
+ return;
356756
+ }
356757
+ const mid = Math.floor(batch.length / 2);
356758
+ const left = batch.slice(0, mid);
356759
+ const right = batch.slice(mid);
356760
+ void this.queue.add(() => processBatch(left, contextValues));
356761
+ void this.queue.add(() => processBatch(right, contextValues));
356762
+ }, "processBatch");
356763
+ void this.queue.add(() => processBatch(flags, this.baseContextValues));
356764
+ await this.queue.onIdle();
356765
+ return safeFlags;
356766
+ }
356767
+ /** Prototypes flag changes by synthesizing templates and showing diffs to the user */
356768
+ async prototypeChanges(flagNames, params) {
356769
+ const baseContext = new import_toolkit_lib18.CdkAppMultiContext(process.cwd());
356770
+ const baseContextValues = await baseContext.read();
356771
+ const memoryContext = new import_toolkit_lib18.MemoryContext(baseContextValues);
356772
+ const cdkJson = await JSON.parse(await fs40.readFile(path37.join(process.cwd(), "cdk.json"), "utf-8"));
356773
+ const app = cdkJson.app;
356774
+ const source = await this.toolkit.fromCdkApp(app, {
356775
+ contextStore: baseContext,
356776
+ outdir: fs40.mkdtempSync(path37.join(os12.tmpdir(), "cdk-original-"))
356777
+ });
356778
+ const updateObj = await this.buildUpdateObject(flagNames, params, baseContextValues);
356779
+ if (!updateObj) return false;
356780
+ await memoryContext.update(updateObj);
356781
+ const cx = await this.toolkit.synth(source);
356782
+ const assembly = cx.cloudAssembly;
356783
+ const modifiedSource = await this.toolkit.fromCdkApp(app, {
356784
+ contextStore: memoryContext,
356785
+ outdir: fs40.mkdtempSync(path37.join(os12.tmpdir(), "cdk-temp-"))
356786
+ });
356787
+ const modifiedCx = await this.toolkit.synth(modifiedSource);
356788
+ const allStacks = assembly.stacksRecursively;
356789
+ for (const stack of allStacks) {
356790
+ const templatePath = stack.templateFullPath;
356791
+ await this.toolkit.diff(modifiedCx, {
356792
+ method: import_toolkit_lib18.DiffMethod.LocalFile(templatePath),
356793
+ stacks: {
356794
+ strategy: "pattern-must-match-single" /* PATTERN_MUST_MATCH_SINGLE */,
356795
+ patterns: [stack.hierarchicalId]
356796
+ }
356797
+ });
356798
+ }
356799
+ await this.displayFlagChanges(updateObj, baseContextValues);
356800
+ return true;
356801
+ }
356802
+ /** Displays a summary of flag changes showing old and new values */
356803
+ async displayFlagChanges(updateObj, baseContextValues) {
356804
+ await this.ioHelper.defaults.info("\nFlag changes:");
356805
+ for (const [flagName, newValue] of Object.entries(updateObj)) {
356806
+ const currentValue = baseContextValues[flagName];
356807
+ const currentDisplay = currentValue === void 0 ? "<unset>" : String(currentValue);
356808
+ await this.ioHelper.defaults.info(` ${flagName}: ${currentDisplay} \u2192 ${newValue}`);
356809
+ }
356810
+ }
356811
+ /** Builds the update object with new flag values based on parameters and current context */
356812
+ async buildUpdateObject(flagNames, params, baseContextValues) {
356813
+ const updateObj = {};
356814
+ if (flagNames.length === 1 && params.value !== void 0) {
356815
+ const flagName = flagNames[0];
356816
+ const boolValue = params.value === "true";
356817
+ if (baseContextValues[flagName] === boolValue) {
356818
+ await this.ioHelper.defaults.info("Flag is already set to the specified value. No changes needed.");
356819
+ return null;
356820
+ }
356821
+ updateObj[flagName] = boolValue;
356822
+ } else {
356823
+ for (const flagName of flagNames) {
356824
+ const flag = this.flags.find((f3) => f3.name === flagName);
356825
+ if (!flag) {
356826
+ await this.ioHelper.defaults.error(`Flag ${flagName} not found.`);
356827
+ return null;
356828
+ }
356829
+ const newValue = params.recommended ? flag.recommendedValue : String(flag.unconfiguredBehavesLike?.v2) === "true";
356830
+ updateObj[flagName] = newValue;
356831
+ }
356832
+ }
356833
+ return updateObj;
356834
+ }
356835
+ /** Prompts user for confirmation and applies changes if accepted */
356836
+ async handleUserResponse(flagNames, params) {
356837
+ const userAccepted = await this.ioHelper.requestResponse({
356838
+ time: /* @__PURE__ */ new Date(),
356839
+ level: "info",
356840
+ code: "CDK_TOOLKIT_I9300",
356841
+ message: "Do you want to accept these changes?",
356842
+ data: {
356843
+ flagNames,
356844
+ responseDescription: 'Enter "y" to apply changes or "n" to cancel'
356845
+ },
356846
+ defaultResponse: false
356847
+ });
356848
+ if (userAccepted) {
356849
+ await this.modifyValues(flagNames, params);
356850
+ await this.ioHelper.defaults.info("Flag value(s) updated successfully.");
356851
+ } else {
356852
+ await this.ioHelper.defaults.info("Operation cancelled");
356853
+ }
356854
+ await this.cleanupTempDirectories();
356855
+ }
356856
+ /** Removes temporary directories created during flag operations */
356857
+ async cleanupTempDirectories() {
356858
+ const originalDir = path37.join(process.cwd(), "original");
356859
+ const tempDir = path37.join(process.cwd(), "temp");
356860
+ await fs40.remove(originalDir);
356861
+ await fs40.remove(tempDir);
356862
+ }
356863
+ /** Actually modifies the cdk.json file with the new flag values */
356864
+ async modifyValues(flagNames, params) {
356865
+ const cdkJsonPath = path37.join(process.cwd(), "cdk.json");
356866
+ const cdkJsonContent = await fs40.readFile(cdkJsonPath, "utf-8");
356867
+ const cdkJson = JSON.parse(cdkJsonContent);
356868
+ if (flagNames.length === 1 && !params.safe) {
356869
+ const boolValue = params.value === "true";
356870
+ cdkJson.context[String(flagNames[0])] = boolValue;
356871
+ await this.ioHelper.defaults.info(`Setting flag '${flagNames}' to: ${boolValue}`);
356872
+ } else {
356873
+ for (const flagName of flagNames) {
356874
+ const flag = this.flags.find((f3) => f3.name === flagName);
356875
+ const newValue = params.recommended || params.safe ? flag.recommendedValue : String(flag.unconfiguredBehavesLike?.v2) === "true";
356876
+ cdkJson.context[flagName] = newValue;
356877
+ }
356878
+ }
356879
+ await fs40.writeFile(cdkJsonPath, JSON.stringify(cdkJson, null, 2), "utf-8");
356880
+ }
356881
+ /** Displays flags in a table format, either specific flags or filtered by criteria */
356882
+ async displayFlags(params) {
356883
+ const { FLAGNAME, all } = params;
356884
+ if (FLAGNAME && FLAGNAME.length > 0) {
356885
+ await this.displaySpecificFlags(FLAGNAME);
356886
+ return;
356887
+ }
356888
+ const flagsToDisplay = all ? this.flags : this.flags.filter((flag) => flag.userValue === void 0 || !this.isUserValueEqualToRecommended(flag));
356889
+ await this.displayFlagTable(flagsToDisplay);
356890
+ if (!all && flagsToDisplay.length === 0) {
356891
+ await this.ioHelper.defaults.info("");
356892
+ await this.ioHelper.defaults.info("\u2705 All feature flags are already set to their recommended values.");
356893
+ await this.ioHelper.defaults.info("Use 'cdk flags --all --unstable=flags' to see all flags and their current values.");
356894
+ }
356895
+ }
356896
+ /** Displays detailed information for specific flags matching the given names */
356897
+ async displaySpecificFlags(flagNames) {
356898
+ const matchingFlags = this.flags.filter((f3) => flagNames.some((searchTerm) => f3.name.toLowerCase().includes(searchTerm.toLowerCase())));
356899
+ if (matchingFlags.length === 0) {
356900
+ await this.ioHelper.defaults.error(`Flag matching "${flagNames.join(", ")}" not found.`);
356901
+ return;
356902
+ }
356903
+ if (matchingFlags.length === 1) {
356904
+ const flag = matchingFlags[0];
356905
+ await this.ioHelper.defaults.info(`Flag name: ${flag.name}`);
356906
+ await this.ioHelper.defaults.info(`Description: ${flag.explanation}`);
356907
+ await this.ioHelper.defaults.info(`Recommended value: ${flag.recommendedValue}`);
356908
+ await this.ioHelper.defaults.info(`User value: ${flag.userValue}`);
356909
+ return;
356910
+ }
356911
+ await this.ioHelper.defaults.info(`Found ${matchingFlags.length} flags matching "${flagNames.join(", ")}":`);
356912
+ await this.displayFlagTable(matchingFlags);
356913
+ }
356914
+ /** Returns sort order for flags */
356915
+ getFlagSortOrder(flag) {
356916
+ if (flag.userValue === void 0) return 3;
356917
+ if (this.isUserValueEqualToRecommended(flag)) return 1;
356918
+ return 2;
356919
+ }
356920
+ /** Displays flags in a formatted table grouped by module and sorted */
356921
+ async displayFlagTable(flags) {
356922
+ const sortedFlags = [...flags].sort((a3, b3) => {
356923
+ const orderA = this.getFlagSortOrder(a3);
356924
+ const orderB = this.getFlagSortOrder(b3);
356925
+ if (orderA !== orderB) return orderA - orderB;
356926
+ if (a3.module !== b3.module) return a3.module.localeCompare(b3.module);
356927
+ return a3.name.localeCompare(b3.name);
356928
+ });
356929
+ const rows = [["Feature Flag Name", "Recommended Value", "User Value"]];
356930
+ let currentModule = "";
356931
+ sortedFlags.forEach((flag) => {
356932
+ if (flag.module !== currentModule) {
356933
+ rows.push([chalk34.bold(`Module: ${flag.module}`), "", ""]);
356934
+ currentModule = flag.module;
356935
+ }
356936
+ rows.push([
356937
+ ` ${flag.name}`,
356938
+ String(flag.recommendedValue),
356939
+ flag.userValue === void 0 ? "<unset>" : String(flag.userValue)
356940
+ ]);
356941
+ });
356942
+ const formattedTable = (0, import_cloudformation_diff4.formatTable)(rows, void 0, true);
356943
+ await this.ioHelper.defaults.info(formattedTable);
356944
+ }
356945
+ /** Checks if a flag has a boolean recommended value */
356946
+ isBooleanFlag(flag) {
356947
+ const recommended = flag.recommendedValue;
356948
+ return typeof recommended === "boolean" || recommended === "true" || recommended === "false";
356949
+ }
356950
+ /** Checks if the user's current value matches the recommended value */
356951
+ isUserValueEqualToRecommended(flag) {
356952
+ return String(flag.userValue) === String(flag.recommendedValue);
356953
+ }
356954
+ /** Shows helpful usage examples and available command options */
356955
+ async displayHelpMessage() {
356956
+ await this.ioHelper.defaults.info("\n" + chalk34.bold("Available options:"));
356957
+ await this.ioHelper.defaults.info(" cdk flags --interactive # Interactive menu to manage flags");
356958
+ await this.ioHelper.defaults.info(" cdk flags --all # Show all flags (including configured ones)");
356959
+ await this.ioHelper.defaults.info(" cdk flags --set --all --recommended # Set all flags to recommended values");
356960
+ await this.ioHelper.defaults.info(" cdk flags --set --all --default # Set all flags to default values");
356961
+ await this.ioHelper.defaults.info(" cdk flags --set --unconfigured --recommended # Set unconfigured flags to recommended");
356962
+ await this.ioHelper.defaults.info(" cdk flags --set <flag-name> --value <true|false> # Set specific flag");
356963
+ await this.ioHelper.defaults.info(" cdk flags --safe # Safely set flags that don't change templates");
356964
+ }
356965
+ };
356966
+ }
356967
+ });
356968
+
356969
+ // lib/commands/flags/router.ts
356970
+ var FlagOperationRouter;
356971
+ var init_router = __esm({
356972
+ "lib/commands/flags/router.ts"() {
356973
+ "use strict";
356974
+ FlagOperationRouter = class {
356975
+ constructor(validator, interactiveHandler, flagOperations) {
356976
+ this.validator = validator;
356977
+ this.interactiveHandler = interactiveHandler;
356978
+ this.flagOperations = flagOperations;
356979
+ }
356980
+ static {
356981
+ __name(this, "FlagOperationRouter");
356982
+ }
356983
+ /** Routes flag operations to appropriate handlers based on parameters */
356984
+ async route(params) {
356985
+ if (params.interactive) {
356986
+ await this.handleInteractiveMode();
356987
+ return;
356988
+ }
356989
+ if (params.safe) {
356990
+ await this.flagOperations.setSafeFlags(params);
356991
+ return;
356992
+ }
356993
+ const isValid = await this.validator.validateParams(params);
356994
+ if (!isValid) return;
356995
+ if (params.set) {
356996
+ await this.handleSetOperations(params);
356997
+ } else {
356998
+ await this.flagOperations.displayFlags(params);
356999
+ await this.showHelpMessage(params);
357000
+ }
357001
+ }
357002
+ /** Handles flag setting operations, routing to single or multiple flag methods */
357003
+ async handleSetOperations(params) {
357004
+ if (params.FLAGNAME && params.value) {
357005
+ await this.flagOperations.setFlag(params);
357006
+ } else if (params.all || params.unconfigured) {
357007
+ await this.flagOperations.setMultipleFlags(params);
357008
+ }
357009
+ }
357010
+ /** Manages interactive mode */
357011
+ async handleInteractiveMode() {
357012
+ while (true) {
357013
+ const interactiveParams = await this.interactiveHandler.handleInteractiveMode();
357014
+ if (!interactiveParams) return;
357015
+ await this.flagOperations.execute(interactiveParams);
357016
+ if (!interactiveParams.FLAGNAME) {
357017
+ return;
357018
+ }
357019
+ }
357020
+ }
357021
+ /** Shows help message when no specific options are provided */
357022
+ async showHelpMessage(params) {
357023
+ if (!params.all && !params.FLAGNAME) {
357024
+ await this.flagOperations.displayHelpMessage();
357025
+ }
357026
+ }
357027
+ };
357028
+ }
357029
+ });
357030
+
357031
+ // lib/commands/flags/validator.ts
357032
+ var FlagValidator;
357033
+ var init_validator2 = __esm({
357034
+ "lib/commands/flags/validator.ts"() {
357035
+ "use strict";
357036
+ FlagValidator = class {
357037
+ constructor(ioHelper) {
357038
+ this.ioHelper = ioHelper;
357039
+ }
357040
+ static {
357041
+ __name(this, "FlagValidator");
357042
+ }
357043
+ /** Shows error message when CDK version is incompatible with flags command */
357044
+ async showIncompatibleVersionError() {
357045
+ await this.ioHelper.defaults.error("The 'cdk flags' command is not compatible with the AWS CDK library used by your application. Please upgrade to 2.212.0 or above.");
357046
+ }
357047
+ /** Validates all parameters and returns true if valid, false if any validation fails */
357048
+ async validateParams(params) {
357049
+ const validations = [
357050
+ () => this.validateFlagNameAndAll(params),
357051
+ () => this.validateSetRequirement(params),
357052
+ () => this.validateValueRequirement(params),
357053
+ () => this.validateMutuallyExclusive(params),
357054
+ () => this.validateUnconfiguredUsage(params),
357055
+ () => this.validateSetWithFlags(params)
357056
+ ];
357057
+ for (const validation of validations) {
357058
+ const isValid = await validation();
357059
+ if (!isValid) return false;
357060
+ }
357061
+ return true;
357062
+ }
357063
+ /** Validates that --all and specific flag names are not used together */
357064
+ async validateFlagNameAndAll(params) {
357065
+ if (params.FLAGNAME && params.all) {
357066
+ await this.ioHelper.defaults.error("Error: Cannot use both --all and a specific flag name. Please use either --all to show all flags or specify a single flag name.");
357067
+ return false;
357068
+ }
357069
+ return true;
357070
+ }
357071
+ /** Validates that modification options require --set flag */
357072
+ async validateSetRequirement(params) {
357073
+ if ((params.value || params.recommended || params.default || params.unconfigured) && !params.set) {
357074
+ await this.ioHelper.defaults.error("Error: This option can only be used with --set.");
357075
+ return false;
357076
+ }
357077
+ return true;
357078
+ }
357079
+ /** Validates that --value requires a specific flag name */
357080
+ async validateValueRequirement(params) {
357081
+ if (params.value && !params.FLAGNAME) {
357082
+ await this.ioHelper.defaults.error("Error: --value requires a specific flag name. Please specify a flag name when providing a value.");
357083
+ return false;
357084
+ }
357085
+ return true;
357086
+ }
357087
+ /** Validates that mutually exclusive options are not used together */
357088
+ async validateMutuallyExclusive(params) {
357089
+ if (params.recommended && params.default) {
357090
+ await this.ioHelper.defaults.error("Error: Cannot use both --recommended and --default. Please choose one option.");
357091
+ return false;
357092
+ }
357093
+ if (params.unconfigured && params.all) {
357094
+ await this.ioHelper.defaults.error("Error: Cannot use both --unconfigured and --all. Please choose one option.");
357095
+ return false;
357096
+ }
357097
+ return true;
357098
+ }
357099
+ /** Validates that --unconfigured is not used with specific flag names */
357100
+ async validateUnconfiguredUsage(params) {
357101
+ if (params.unconfigured && params.FLAGNAME) {
357102
+ await this.ioHelper.defaults.error("Error: Cannot use --unconfigured with a specific flag name. --unconfigured works with multiple flags.");
357103
+ return false;
357104
+ }
357105
+ return true;
357106
+ }
357107
+ /** Validates that --set operations have required accompanying options */
357108
+ async validateSetWithFlags(params) {
357109
+ if (params.set && params.FLAGNAME && !params.value) {
357110
+ await this.ioHelper.defaults.error("Error: When setting a specific flag, you must provide a --value.");
357111
+ return false;
357112
+ }
357113
+ if (params.set && params.all && !params.recommended && !params.default) {
357114
+ await this.ioHelper.defaults.error("Error: When using --set with --all, you must specify either --recommended or --default.");
357115
+ return false;
357116
+ }
357117
+ if (params.set && params.unconfigured && !params.recommended && !params.default) {
357118
+ await this.ioHelper.defaults.error("Error: When using --set with --unconfigured, you must specify either --recommended or --default.");
357119
+ return false;
357120
+ }
357121
+ if (params.set && !params.all && !params.unconfigured && !params.FLAGNAME) {
357122
+ await this.ioHelper.defaults.error("Error: When using --set, you must specify either --all, --unconfigured, or provide a specific flag name.");
357123
+ return false;
357124
+ }
357125
+ return true;
357126
+ }
357127
+ };
357128
+ }
357129
+ });
357130
+
357131
+ // lib/commands/flags/flags.ts
357132
+ var FlagCommandHandler;
357133
+ var init_flags = __esm({
357134
+ "lib/commands/flags/flags.ts"() {
357135
+ "use strict";
357136
+ init_interactive_handler();
357137
+ init_operations();
357138
+ init_router();
357139
+ init_validator2();
356240
357140
  init_obsolete_flags();
356241
- FlagsMenuOptions = /* @__PURE__ */ ((FlagsMenuOptions2) => {
356242
- FlagsMenuOptions2["ALL_TO_RECOMMENDED"] = "Set all flags to recommended values";
356243
- FlagsMenuOptions2["UNCONFIGURED_TO_RECOMMENDED"] = "Set unconfigured flags to recommended values";
356244
- FlagsMenuOptions2["UNCONFIGURED_TO_DEFAULT"] = "Set unconfigured flags to their implied configuration (record current behavior)";
356245
- FlagsMenuOptions2["MODIFY_SPECIFIC_FLAG"] = "Modify a specific flag";
356246
- FlagsMenuOptions2["EXIT"] = "Exit";
356247
- return FlagsMenuOptions2;
356248
- })(FlagsMenuOptions || {});
356249
- __name(handleFlags, "handleFlags");
356250
- __name(setMultipleFlagsIfSupported, "setMultipleFlagsIfSupported");
356251
- __name(setFlag, "setFlag");
356252
- __name(prototypeChanges, "prototypeChanges");
356253
- __name(setMultipleFlags, "setMultipleFlags");
356254
- __name(handleUserResponse, "handleUserResponse");
356255
- __name(modifyValues, "modifyValues");
356256
- __name(getFlagSortOrder, "getFlagSortOrder");
356257
- __name(displayFlagTable, "displayFlagTable");
356258
- __name(displayFlags, "displayFlags");
356259
- __name(isUserValueEqualToRecommended, "isUserValueEqualToRecommended");
356260
- __name(toBooleanValue, "toBooleanValue");
356261
- __name(isBooleanFlag, "isBooleanFlag");
357141
+ FlagCommandHandler = class {
357142
+ static {
357143
+ __name(this, "FlagCommandHandler");
357144
+ }
357145
+ /** Main component that sets up all flag operation components */
357146
+ constructor(flagData, ioHelper, options, toolkit) {
357147
+ this.flags = flagData.filter((flag) => !OBSOLETE_FLAGS.includes(flag.name));
357148
+ this.options = { ...options, concurrency: options.concurrency ?? 4 };
357149
+ this.ioHelper = ioHelper;
357150
+ const validator = new FlagValidator(ioHelper);
357151
+ const flagOperations = new FlagOperations(this.flags, toolkit, ioHelper);
357152
+ const interactiveHandler = new InteractiveHandler(this.flags, flagOperations);
357153
+ this.router = new FlagOperationRouter(validator, interactiveHandler, flagOperations);
357154
+ }
357155
+ /** Main entry point that processes the flags command */
357156
+ async processFlagsCommand() {
357157
+ if (this.flags.length === 0) {
357158
+ await this.ioHelper.defaults.error("The 'cdk flags' command is not compatible with the AWS CDK library used by your application. Please upgrade to 2.212.0 or above.");
357159
+ return;
357160
+ }
357161
+ await this.router.route(this.options);
357162
+ }
357163
+ };
356262
357164
  }
356263
357165
  });
356264
357166
 
@@ -357351,7 +358253,7 @@ var require_helpers2 = __commonJS({
357351
358253
  });
357352
358254
 
357353
358255
  // ../../node_modules/agent-base/dist/index.js
357354
- var require_dist3 = __commonJS({
358256
+ var require_dist4 = __commonJS({
357355
358257
  "../../node_modules/agent-base/dist/index.js"(exports2) {
357356
358258
  "use strict";
357357
358259
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -358258,7 +359160,7 @@ var require_proxy_from_env = __commonJS({
358258
359160
  });
358259
359161
 
358260
359162
  // ../../node_modules/http-proxy-agent/dist/index.js
358261
- var require_dist4 = __commonJS({
359163
+ var require_dist5 = __commonJS({
358262
359164
  "../../node_modules/http-proxy-agent/dist/index.js"(exports2) {
358263
359165
  "use strict";
358264
359166
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -358297,7 +359199,7 @@ var require_dist4 = __commonJS({
358297
359199
  var tls = __importStar2(require("tls"));
358298
359200
  var debug_1 = __importDefault2(require_src2());
358299
359201
  var events_1 = require("events");
358300
- var agent_base_1 = require_dist3();
359202
+ var agent_base_1 = require_dist4();
358301
359203
  var url_1 = require("url");
358302
359204
  var debug3 = (0, debug_1.default)("http-proxy-agent");
358303
359205
  var HttpProxyAgent = class extends agent_base_1.Agent {
@@ -358494,7 +359396,7 @@ var require_parse_proxy_response = __commonJS({
358494
359396
  });
358495
359397
 
358496
359398
  // ../../node_modules/https-proxy-agent/dist/index.js
358497
- var require_dist5 = __commonJS({
359399
+ var require_dist6 = __commonJS({
358498
359400
  "../../node_modules/https-proxy-agent/dist/index.js"(exports2) {
358499
359401
  "use strict";
358500
359402
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -358533,7 +359435,7 @@ var require_dist5 = __commonJS({
358533
359435
  var tls = __importStar2(require("tls"));
358534
359436
  var assert_1 = __importDefault2(require("assert"));
358535
359437
  var debug_1 = __importDefault2(require_src2());
358536
- var agent_base_1 = require_dist3();
359438
+ var agent_base_1 = require_dist4();
358537
359439
  var url_1 = require("url");
358538
359440
  var parse_proxy_response_1 = require_parse_proxy_response();
358539
359441
  var debug3 = (0, debug_1.default)("https-proxy-agent");
@@ -362468,7 +363370,7 @@ var require_build = __commonJS({
362468
363370
  });
362469
363371
 
362470
363372
  // ../../node_modules/socks-proxy-agent/dist/index.js
362471
- var require_dist6 = __commonJS({
363373
+ var require_dist7 = __commonJS({
362472
363374
  "../../node_modules/socks-proxy-agent/dist/index.js"(exports2) {
362473
363375
  "use strict";
362474
363376
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -362504,7 +363406,7 @@ var require_dist6 = __commonJS({
362504
363406
  Object.defineProperty(exports2, "__esModule", { value: true });
362505
363407
  exports2.SocksProxyAgent = void 0;
362506
363408
  var socks_1 = require_build();
362507
- var agent_base_1 = require_dist3();
363409
+ var agent_base_1 = require_dist4();
362508
363410
  var debug_1 = __importDefault2(require_src2());
362509
363411
  var dns = __importStar2(require("dns"));
362510
363412
  var net = __importStar2(require("net"));
@@ -364850,7 +365752,7 @@ var require_StringEncoding = __commonJS({
364850
365752
  });
364851
365753
 
364852
365754
  // ../../node_modules/basic-ftp/dist/index.js
364853
- var require_dist7 = __commonJS({
365755
+ var require_dist8 = __commonJS({
364854
365756
  "../../node_modules/basic-ftp/dist/index.js"(exports2) {
364855
365757
  "use strict";
364856
365758
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -364895,7 +365797,7 @@ var require_ftp = __commonJS({
364895
365797
  };
364896
365798
  Object.defineProperty(exports2, "__esModule", { value: true });
364897
365799
  exports2.ftp = void 0;
364898
- var basic_ftp_1 = require_dist7();
365800
+ var basic_ftp_1 = require_dist8();
364899
365801
  var stream_1 = require("stream");
364900
365802
  var path_1 = require("path");
364901
365803
  var debug_1 = __importDefault2(require_src2());
@@ -365162,7 +366064,7 @@ var require_https = __commonJS({
365162
366064
  });
365163
366065
 
365164
366066
  // ../../node_modules/get-uri/dist/index.js
365165
- var require_dist8 = __commonJS({
366067
+ var require_dist9 = __commonJS({
365166
366068
  "../../node_modules/get-uri/dist/index.js"(exports2) {
365167
366069
  "use strict";
365168
366070
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
@@ -379906,7 +380808,7 @@ ${err.cause.stack}`;
379906
380808
  });
379907
380809
 
379908
380810
  // ../../node_modules/degenerator/dist/index.js
379909
- var require_dist9 = __commonJS({
380811
+ var require_dist10 = __commonJS({
379910
380812
  "../../node_modules/degenerator/dist/index.js"(exports2) {
379911
380813
  "use strict";
379912
380814
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -380514,7 +381416,7 @@ var require_weekdayRange = __commonJS({
380514
381416
  });
380515
381417
 
380516
381418
  // ../../node_modules/pac-resolver/dist/index.js
380517
- var require_dist10 = __commonJS({
381419
+ var require_dist11 = __commonJS({
380518
381420
  "../../node_modules/pac-resolver/dist/index.js"(exports2) {
380519
381421
  "use strict";
380520
381422
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
@@ -380522,7 +381424,7 @@ var require_dist10 = __commonJS({
380522
381424
  };
380523
381425
  Object.defineProperty(exports2, "__esModule", { value: true });
380524
381426
  exports2.sandbox = exports2.createPacResolver = void 0;
380525
- var degenerator_1 = require_dist9();
381427
+ var degenerator_1 = require_dist10();
380526
381428
  var dateRange_1 = __importDefault2(require_dateRange());
380527
381429
  var dnsDomainIs_1 = __importDefault2(require_dnsDomainIs());
380528
381430
  var dnsDomainLevels_1 = __importDefault2(require_dnsDomainLevels());
@@ -382389,7 +383291,7 @@ var require_runtime_asyncify = __commonJS({
382389
383291
  "use strict";
382390
383292
  Object.defineProperty(exports2, "__esModule", { value: true });
382391
383293
  exports2.QuickJSAsyncRuntime = void 0;
382392
- var _1 = require_dist11();
383294
+ var _1 = require_dist12();
382393
383295
  var context_asyncify_1 = require_context_asyncify();
382394
383296
  var runtime_1 = require_runtime();
382395
383297
  var types_1 = require_types4();
@@ -383564,7 +384466,7 @@ var require_module_test = __commonJS({
383564
384466
  });
383565
384467
 
383566
384468
  // ../../node_modules/@tootallnate/quickjs-emscripten/dist/index.js
383567
- var require_dist11 = __commonJS({
384469
+ var require_dist12 = __commonJS({
383568
384470
  "../../node_modules/@tootallnate/quickjs-emscripten/dist/index.js"(exports2) {
383569
384471
  "use strict";
383570
384472
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -383666,7 +384568,7 @@ var require_dist11 = __commonJS({
383666
384568
  });
383667
384569
 
383668
384570
  // ../../node_modules/pac-proxy-agent/dist/index.js
383669
- var require_dist12 = __commonJS({
384571
+ var require_dist13 = __commonJS({
383670
384572
  "../../node_modules/pac-proxy-agent/dist/index.js"(exports2) {
383671
384573
  "use strict";
383672
384574
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -383707,10 +384609,10 @@ var require_dist12 = __commonJS({
383707
384609
  var events_1 = require("events");
383708
384610
  var debug_1 = __importDefault2(require_src2());
383709
384611
  var url_1 = require("url");
383710
- var agent_base_1 = require_dist3();
383711
- var get_uri_1 = require_dist8();
383712
- var pac_resolver_1 = require_dist10();
383713
- var quickjs_emscripten_1 = require_dist11();
384612
+ var agent_base_1 = require_dist4();
384613
+ var get_uri_1 = require_dist9();
384614
+ var pac_resolver_1 = require_dist11();
384615
+ var quickjs_emscripten_1 = require_dist12();
383714
384616
  var debug3 = (0, debug_1.default)("pac-proxy-agent");
383715
384617
  var setServernameFromNonIpHost = /* @__PURE__ */ __name((options) => {
383716
384618
  if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
@@ -383822,18 +384724,18 @@ var require_dist12 = __commonJS({
383822
384724
  socket = net.connect(opts);
383823
384725
  }
383824
384726
  } else if (type === "SOCKS" || type === "SOCKS5") {
383825
- const { SocksProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist6()));
384727
+ const { SocksProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist7()));
383826
384728
  agent = new SocksProxyAgent(`socks://${target}`, this.opts);
383827
384729
  } else if (type === "SOCKS4") {
383828
- const { SocksProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist6()));
384730
+ const { SocksProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist7()));
383829
384731
  agent = new SocksProxyAgent(`socks4a://${target}`, this.opts);
383830
384732
  } else if (type === "PROXY" || type === "HTTP" || type === "HTTPS") {
383831
384733
  const proxyURL = `${type === "HTTPS" ? "https" : "http"}://${target}`;
383832
384734
  if (secureEndpoint || isWebSocket) {
383833
- const { HttpsProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist5()));
384735
+ const { HttpsProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist6()));
383834
384736
  agent = new HttpsProxyAgent(proxyURL, this.opts);
383835
384737
  } else {
383836
- const { HttpProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist4()));
384738
+ const { HttpProxyAgent } = await Promise.resolve().then(() => __importStar2(require_dist5()));
383837
384739
  agent = new HttpProxyAgent(proxyURL, this.opts);
383838
384740
  }
383839
384741
  }
@@ -383872,7 +384774,7 @@ var require_dist12 = __commonJS({
383872
384774
  });
383873
384775
 
383874
384776
  // ../../node_modules/proxy-agent/dist/index.js
383875
- var require_dist13 = __commonJS({
384777
+ var require_dist14 = __commonJS({
383876
384778
  "../../node_modules/proxy-agent/dist/index.js"(exports2) {
383877
384779
  "use strict";
383878
384780
  var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? (function(o3, m3, k3, k22) {
@@ -383911,15 +384813,15 @@ var require_dist13 = __commonJS({
383911
384813
  var https2 = __importStar2(require("https"));
383912
384814
  var url_1 = require("url");
383913
384815
  var lru_cache_1 = __importDefault2(require_lru_cache());
383914
- var agent_base_1 = require_dist3();
384816
+ var agent_base_1 = require_dist4();
383915
384817
  var debug_1 = __importDefault2(require_src2());
383916
384818
  var proxy_from_env_1 = require_proxy_from_env();
383917
384819
  var debug3 = (0, debug_1.default)("proxy-agent");
383918
384820
  var wellKnownAgents = {
383919
- http: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist4()))).HttpProxyAgent, "http"),
383920
- https: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist5()))).HttpsProxyAgent, "https"),
383921
- socks: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist6()))).SocksProxyAgent, "socks"),
383922
- pac: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist12()))).PacProxyAgent, "pac")
384821
+ http: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist5()))).HttpProxyAgent, "http"),
384822
+ https: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist6()))).HttpsProxyAgent, "https"),
384823
+ socks: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist7()))).SocksProxyAgent, "socks"),
384824
+ pac: /* @__PURE__ */ __name(async () => (await Promise.resolve().then(() => __importStar2(require_dist13()))).PacProxyAgent, "pac")
383923
384825
  };
383924
384826
  exports2.proxies = {
383925
384827
  http: [wellKnownAgents.http, wellKnownAgents.https],
@@ -384001,7 +384903,7 @@ var init_proxy_agent = __esm({
384001
384903
  "lib/cli/proxy-agent.ts"() {
384002
384904
  "use strict";
384003
384905
  fs41 = __toESM(require_lib13());
384004
- import_proxy_agent = __toESM(require_dist13());
384906
+ import_proxy_agent = __toESM(require_dist14());
384005
384907
  ProxyAgentProvider = class {
384006
384908
  static {
384007
384909
  __name(this, "ProxyAgentProvider");
@@ -384078,11 +384980,7 @@ async function exec4(args, synthesizer) {
384078
384980
  stackProgress: argv.progress
384079
384981
  }, true);
384080
384982
  const ioHelper = asIoHelper(ioHost, ioHost.currentAction);
384081
- if (argv.debug || argv.verbose > 2) {
384082
- setSdkTracing(true);
384083
- } else {
384084
- setSdkTracing(false);
384085
- }
384983
+ setSdkTracing(argv.debug || argv.verbose > 2);
384086
384984
  try {
384087
384985
  await checkForPlatformWarnings(ioHelper);
384088
384986
  } catch (e3) {
@@ -384417,6 +385315,9 @@ async function exec4(args, synthesizer) {
384417
385315
  if (args2.bootstrapStackName) {
384418
385316
  await ioHost.defaults.warn("--bootstrap-stack-name is deprecated and will be removed when gc is GA. Use --toolkit-stack-name.");
384419
385317
  }
385318
+ if (args2.roleArn) {
385319
+ await ioHost.defaults.warn("The --role-arn option is not supported for the gc command and will be ignored.");
385320
+ }
384420
385321
  return cli2.garbageCollect(args2.ENVIRONMENTS, {
384421
385322
  action: args2.action,
384422
385323
  type: args2.type,
@@ -384436,7 +385337,8 @@ async function exec4(args, synthesizer) {
384436
385337
  unstableFeatures: configuration.settings.get(["unstable"])
384437
385338
  });
384438
385339
  const flagsData = await toolkit.flags(cloudExecutable);
384439
- return handleFlags(flagsData, ioHelper, args2, toolkit);
385340
+ const handler = new FlagCommandHandler(flagsData, ioHelper, args2, toolkit);
385341
+ return handler.processFlagsCommand();
384440
385342
  case "synthesize":
384441
385343
  case "synth":
384442
385344
  ioHost.currentAction = "synth";
@@ -384653,7 +385555,7 @@ var init_cli = __esm({
384653
385555
  init_context5();
384654
385556
  init_docs();
384655
385557
  init_doctor();
384656
- init_flag_operations();
385558
+ init_flags();
384657
385559
  init_init2();
384658
385560
  init_migrate();
384659
385561
  init_cxapp();
@@ -384864,7 +385766,7 @@ function warnAboutContextKey2(settings, prefix2, fileName) {
384864
385766
  }
384865
385767
  function expandHomeDir3(x3) {
384866
385768
  if (x3.startsWith("~")) {
384867
- return fs_path3.join(os12.homedir(), x3.slice(1));
385769
+ return fs_path3.join(os13.homedir(), x3.slice(1));
384868
385770
  }
384869
385771
  return x3;
384870
385772
  }
@@ -384979,11 +385881,11 @@ function parseStringTagsListToObject2(argTags) {
384979
385881
  }
384980
385882
  return tags.length > 0 ? tags : void 0;
384981
385883
  }
384982
- var os12, fs_path3, import_toolkit_lib20, fs42, PROJECT_CONTEXT2, PROJECT_CONFIG2, USER_DEFAULTS2, CONTEXT_KEY2, Command, BUNDLING_COMMANDS2, Configuration2;
385884
+ var os13, fs_path3, import_toolkit_lib20, fs42, PROJECT_CONTEXT2, PROJECT_CONFIG2, USER_DEFAULTS2, CONTEXT_KEY2, Command, BUNDLING_COMMANDS2, Configuration2;
384983
385885
  var init_configuration = __esm({
384984
385886
  "lib/legacy/configuration.ts"() {
384985
385887
  "use strict";
384986
- os12 = __toESM(require("os"));
385888
+ os13 = __toESM(require("os"));
384987
385889
  fs_path3 = __toESM(require("path"));
384988
385890
  import_toolkit_lib20 = __toESM(require_lib12());
384989
385891
  fs42 = __toESM(require_lib13());