@aws-cdk/toolkit-lib 0.1.5 → 0.1.6

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.
@@ -98,11 +98,10 @@ var path2 = __toESM(require("path"));
98
98
  var fs3 = __toESM(require("fs-extra"));
99
99
 
100
100
  // ../../aws-cdk/lib/logging.ts
101
- var util4 = __toESM(require("util"));
102
101
  var chalk4 = __toESM(require("chalk"));
103
102
 
104
103
  // ../../aws-cdk/lib/toolkit/cli-io-host.ts
105
- var util3 = __toESM(require("node:util"));
104
+ var util5 = __toESM(require("node:util"));
106
105
  var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
107
106
  var chalk3 = __toESM(require("chalk"));
108
107
  var promptly = __toESM(require("promptly"));
@@ -214,6 +213,7 @@ var ContextProviderError = class _ContextProviderError extends ToolkitError {
214
213
  };
215
214
 
216
215
  // ../tmp-toolkit-helpers/src/api/io/private/span.ts
216
+ var util = __toESM(require("node:util"));
217
217
  var uuid = __toESM(require("uuid"));
218
218
 
219
219
  // ../tmp-toolkit-helpers/src/util/archive.ts
@@ -401,6 +401,9 @@ function deepSet(x, path15, value) {
401
401
  }
402
402
  while (path15.length > 1 && isObject(x)) {
403
403
  const key = path15.shift();
404
+ if (isPrototypePollutingKey(key)) {
405
+ continue;
406
+ }
404
407
  if (!(key in x)) {
405
408
  x[key] = {};
406
409
  }
@@ -409,16 +412,23 @@ function deepSet(x, path15, value) {
409
412
  if (!isObject(x)) {
410
413
  throw new ToolkitError(`Expected an object, got '${x}'`);
411
414
  }
415
+ const finalKey = path15[0];
416
+ if (isPrototypePollutingKey(finalKey)) {
417
+ return;
418
+ }
412
419
  if (value !== void 0) {
413
- x[path15[0]] = value;
420
+ x[finalKey] = value;
414
421
  } else {
415
- delete x[path15[0]];
422
+ delete x[finalKey];
416
423
  }
417
424
  }
425
+ function isPrototypePollutingKey(key) {
426
+ return key === "__proto__" || key === "constructor" || key === "prototype";
427
+ }
418
428
  function deepMerge(...objects) {
419
429
  function mergeOne(target, source) {
420
430
  for (const key of Object.keys(source)) {
421
- if (key === "__proto__" || key === "constructor") {
431
+ if (isPrototypePollutingKey(key)) {
422
432
  continue;
423
433
  }
424
434
  const value = source[key];
@@ -578,6 +588,123 @@ function millisecondsToSeconds(num) {
578
588
  // ../tmp-toolkit-helpers/src/util/version-range.ts
579
589
  var semver = __toESM(require("semver"));
580
590
 
591
+ // ../tmp-toolkit-helpers/src/api/io/private/span.ts
592
+ var SpanMaker = class {
593
+ definition;
594
+ ioHelper;
595
+ constructor(ioHelper, definition) {
596
+ this.definition = definition;
597
+ this.ioHelper = ioHelper;
598
+ }
599
+ async begin(a, b) {
600
+ const spanId = uuid.v4();
601
+ const startTime = (/* @__PURE__ */ new Date()).getTime();
602
+ const notify = (msg) => {
603
+ return this.ioHelper.notify(withSpanId(spanId, msg));
604
+ };
605
+ const startInput = parseArgs(a, b);
606
+ const startMsg = startInput.message ?? `Starting ${this.definition.name} ...`;
607
+ const startPayload = startInput.payload;
608
+ await notify(this.definition.start.msg(
609
+ startMsg,
610
+ startPayload
611
+ ));
612
+ const timingMsgTemplate = "\n\u2728 %s time: %ds\n";
613
+ const time = () => {
614
+ const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - startTime;
615
+ return {
616
+ asMs: elapsedTime,
617
+ asSec: formatTime(elapsedTime)
618
+ };
619
+ };
620
+ return {
621
+ elapsedTime: async () => {
622
+ return time();
623
+ },
624
+ notify: async (msg) => {
625
+ await notify(msg);
626
+ },
627
+ timing: async (maker, message2) => {
628
+ const duration = time();
629
+ const timingMsg = message2 ? message2 : util.format(timingMsgTemplate, this.definition.name, duration.asSec);
630
+ await notify(maker.msg(timingMsg, {
631
+ duration: duration.asMs
632
+ }));
633
+ return duration;
634
+ },
635
+ end: async (x, y) => {
636
+ const duration = time();
637
+ const endInput = parseArgs(x, y);
638
+ const endMsg = endInput.message ?? util.format(timingMsgTemplate, this.definition.name, duration.asSec);
639
+ const endPayload = endInput.payload;
640
+ await notify(this.definition.end.msg(
641
+ endMsg,
642
+ {
643
+ duration: duration.asMs,
644
+ ...endPayload
645
+ }
646
+ ));
647
+ return duration;
648
+ }
649
+ };
650
+ }
651
+ };
652
+ function parseArgs(first, second) {
653
+ const firstIsMessage = typeof first === "string";
654
+ const message2 = firstIsMessage || second ? first : void 0;
655
+ const payload = firstIsMessage || second ? second : first;
656
+ return {
657
+ message: message2,
658
+ payload
659
+ };
660
+ }
661
+ function withSpanId(span, message2) {
662
+ return {
663
+ ...message2,
664
+ span
665
+ };
666
+ }
667
+
668
+ // ../tmp-toolkit-helpers/src/api/io/private/io-helper.ts
669
+ var IoHelper = class _IoHelper {
670
+ static fromIoHost(ioHost, action) {
671
+ return new _IoHelper(ioHost, action);
672
+ }
673
+ ioHost;
674
+ action;
675
+ constructor(ioHost, action) {
676
+ this.ioHost = ioHost;
677
+ this.action = action;
678
+ }
679
+ /**
680
+ * Forward a message to the IoHost, while injection the current action
681
+ */
682
+ notify(msg) {
683
+ return this.ioHost.notify({
684
+ ...msg,
685
+ action: this.action
686
+ });
687
+ }
688
+ /**
689
+ * Forward a request to the IoHost, while injection the current action
690
+ */
691
+ requestResponse(msg) {
692
+ return this.ioHost.requestResponse({
693
+ ...msg,
694
+ action: this.action
695
+ });
696
+ }
697
+ /**
698
+ * Create a new marker from a given registry entry
699
+ */
700
+ span(definition) {
701
+ return new SpanMaker(this, definition);
702
+ }
703
+ };
704
+ function asIoHelper(ioHost, action) {
705
+ return IoHelper.fromIoHost(ioHost, action);
706
+ }
707
+
581
708
  // ../tmp-toolkit-helpers/src/api/io/private/level-priority.ts
582
709
  var levels = [
583
710
  "trace",
@@ -639,7 +766,7 @@ var confirm = (details) => request("info", {
639
766
 
640
767
  // ../tmp-toolkit-helpers/src/api/io/private/messages.ts
641
768
  var IO = {
642
- // Defaults
769
+ // Defaults (0000)
643
770
  DEFAULT_TOOLKIT_INFO: info({
644
771
  code: "CDK_TOOLKIT_I0000",
645
772
  description: "Default info messages emitted from the Toolkit"
@@ -652,7 +779,15 @@ var IO = {
652
779
  code: "CDK_TOOLKIT_W0000",
653
780
  description: "Default warning messages emitted from the Toolkit"
654
781
  }),
655
- // 1: Synth
782
+ DEFAULT_TOOLKIT_ERROR: error({
783
+ code: "CDK_TOOLKIT_E0000",
784
+ description: "Default error messages emitted from the Toolkit"
785
+ }),
786
+ DEFAULT_TOOLKIT_TRACE: trace({
787
+ code: "CDK_TOOLKIT_I0000",
788
+ description: "Default trace messages emitted from the Toolkit"
789
+ }),
790
+ // 1: Synth (1xxx)
656
791
  CDK_TOOLKIT_I1000: info({
657
792
  code: "CDK_TOOLKIT_I1000",
658
793
  description: "Provides synthesis times.",
@@ -673,7 +808,7 @@ var IO = {
673
808
  description: "Successfully deployed stacks",
674
809
  interface: "AssemblyData"
675
810
  }),
676
- // 2: List
811
+ // 2: List (2xxx)
677
812
  CDK_TOOLKIT_I2901: result({
678
813
  code: "CDK_TOOLKIT_I2901",
679
814
  description: "Provides details on the selected stacks and their dependencies",
@@ -684,8 +819,8 @@ var IO = {
684
819
  code: "CDK_TOOLKIT_E3900",
685
820
  description: "Resource import failed"
686
821
  }),
687
- // 4: Diff
688
- // 5: Deploy & Watch
822
+ // 4: Diff (4xxx)
823
+ // 5: Deploy & Watch (5xxx)
689
824
  CDK_TOOLKIT_I5000: info({
690
825
  code: "CDK_TOOLKIT_I5000",
691
826
  description: "Provides deployment times",
@@ -747,7 +882,7 @@ var IO = {
747
882
  description: "Stack deploy progress",
748
883
  interface: "StackDeployProgress"
749
884
  }),
750
- // Assets
885
+ // Assets (52xx)
751
886
  CDK_TOOLKIT_I5210: trace({
752
887
  code: "CDK_TOOLKIT_I5210",
753
888
  description: "Started building a specific asset",
@@ -768,7 +903,7 @@ var IO = {
768
903
  description: "Publishing the asset has completed",
769
904
  interface: "Duration"
770
905
  }),
771
- // Watch
906
+ // Watch (53xx)
772
907
  CDK_TOOLKIT_I5310: debug({
773
908
  code: "CDK_TOOLKIT_I5310",
774
909
  description: "The computed settings used for file watching",
@@ -797,7 +932,18 @@ var IO = {
797
932
  code: "CDK_TOOLKIT_I5315",
798
933
  description: "Queued watch deployment started"
799
934
  }),
800
- // Stack Monitor
935
+ // Hotswap (54xx)
936
+ CDK_TOOLKIT_I5400: trace({
937
+ code: "CDK_TOOLKIT_I5400",
938
+ description: "Starting a hotswap deployment",
939
+ interface: "HotswapDeployment"
940
+ }),
941
+ CDK_TOOLKIT_I5410: info({
942
+ code: "CDK_TOOLKIT_I5410",
943
+ description: "Hotswap deployment has ended, a full deployment might still follow if needed",
944
+ interface: "Duration"
945
+ }),
946
+ // Stack Monitor (55xx)
801
947
  CDK_TOOLKIT_I5501: info({
802
948
  code: "CDK_TOOLKIT_I5501",
803
949
  description: "Stack Monitoring: Start monitoring of a single stack",
@@ -813,7 +959,7 @@ var IO = {
813
959
  description: "Stack Monitoring: Finished monitoring of a single stack",
814
960
  interface: "StackMonitoringControlEvent"
815
961
  }),
816
- // Success
962
+ // Success (59xx)
817
963
  CDK_TOOLKIT_I5900: result({
818
964
  code: "CDK_TOOLKIT_I5900",
819
965
  description: "Deployment results on success",
@@ -837,7 +983,7 @@ var IO = {
837
983
  description: "Stack Monitoring error",
838
984
  interface: "ErrorPayload"
839
985
  }),
840
- // 6: Rollback
986
+ // 6: Rollback (6xxx)
841
987
  CDK_TOOLKIT_I6000: info({
842
988
  code: "CDK_TOOLKIT_I6000",
843
989
  description: "Provides rollback times",
@@ -857,7 +1003,7 @@ var IO = {
857
1003
  description: "Rollback failed",
858
1004
  interface: "ErrorPayload"
859
1005
  }),
860
- // 7: Destroy
1006
+ // 7: Destroy (7xxx)
861
1007
  CDK_TOOLKIT_I7000: info({
862
1008
  code: "CDK_TOOLKIT_I7000",
863
1009
  description: "Provides destroy times",
@@ -897,7 +1043,7 @@ var IO = {
897
1043
  description: "Stack deletion failed",
898
1044
  interface: "ErrorPayload"
899
1045
  }),
900
- // 9: Bootstrap
1046
+ // 9: Bootstrap (9xxx)
901
1047
  CDK_TOOLKIT_I9000: info({
902
1048
  code: "CDK_TOOLKIT_I9000",
903
1049
  description: "Provides bootstrap times",
@@ -918,6 +1064,23 @@ var IO = {
918
1064
  description: "Bootstrap failed",
919
1065
  interface: "ErrorPayload"
920
1066
  }),
1067
+ // Notices
1068
+ CDK_TOOLKIT_I0100: info({
1069
+ code: "CDK_TOOLKIT_I0100",
1070
+ description: "Notices decoration (the header or footer of a list of notices)"
1071
+ }),
1072
+ CDK_TOOLKIT_W0101: warn({
1073
+ code: "CDK_TOOLKIT_W0101",
1074
+ description: "A notice that is marked as a warning"
1075
+ }),
1076
+ CDK_TOOLKIT_E0101: error({
1077
+ code: "CDK_TOOLKIT_E0101",
1078
+ description: "A notice that is marked as an error"
1079
+ }),
1080
+ CDK_TOOLKIT_I0101: info({
1081
+ code: "CDK_TOOLKIT_I0101",
1082
+ description: "A notice that is marked as informational"
1083
+ }),
921
1084
  // Assembly codes
922
1085
  CDK_ASSEMBLY_I0010: debug({
923
1086
  code: "CDK_ASSEMBLY_I0010",
@@ -1034,6 +1197,57 @@ var SPAN = {
1034
1197
  name: "Publish Asset",
1035
1198
  start: IO.CDK_TOOLKIT_I5220,
1036
1199
  end: IO.CDK_TOOLKIT_I5221
1200
+ },
1201
+ HOTSWAP: {
1202
+ name: "hotswap-deployment",
1203
+ start: IO.CDK_TOOLKIT_I5400,
1204
+ end: IO.CDK_TOOLKIT_I5410
1205
+ }
1206
+ };
1207
+
1208
+ // ../tmp-toolkit-helpers/src/api/io/private/io-default-messages.ts
1209
+ var util2 = __toESM(require("util"));
1210
+ var IoDefaultMessages = class {
1211
+ constructor(ioHelper) {
1212
+ this.ioHelper = ioHelper;
1213
+ }
1214
+ notify(msg) {
1215
+ return this.ioHelper.notify(msg);
1216
+ }
1217
+ requestResponse(msg) {
1218
+ return this.ioHelper.requestResponse(msg);
1219
+ }
1220
+ error(input, ...args) {
1221
+ this.emitMessage(IO.DEFAULT_TOOLKIT_ERROR, input, ...args);
1222
+ }
1223
+ warn(input, ...args) {
1224
+ this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
1225
+ }
1226
+ warning(input, ...args) {
1227
+ this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
1228
+ }
1229
+ info(input, ...args) {
1230
+ this.emitMessage(IO.DEFAULT_TOOLKIT_INFO, input, ...args);
1231
+ }
1232
+ debug(input, ...args) {
1233
+ this.emitMessage(IO.DEFAULT_TOOLKIT_DEBUG, input, ...args);
1234
+ }
1235
+ trace(input, ...args) {
1236
+ this.emitMessage(IO.DEFAULT_TOOLKIT_TRACE, input, ...args);
1237
+ }
1238
+ result(input, ...args) {
1239
+ const message2 = args.length > 0 ? util2.format(input, ...args) : input;
1240
+ void this.ioHelper.notify({
1241
+ time: /* @__PURE__ */ new Date(),
1242
+ code: IO.DEFAULT_TOOLKIT_INFO.code,
1243
+ level: "result",
1244
+ message: message2,
1245
+ data: void 0
1246
+ });
1247
+ }
1248
+ emitMessage(maker, input, ...args) {
1249
+ const message2 = args.length > 0 ? util2.format(input, ...args) : input;
1250
+ void this.ioHelper.notify(maker.msg(message2));
1037
1251
  }
1038
1252
  };
1039
1253
 
@@ -1142,7 +1356,7 @@ var ActivityPrinterBase = class {
1142
1356
  };
1143
1357
 
1144
1358
  // ../../aws-cdk/lib/cli/activity-printer/history.ts
1145
- var util = __toESM(require("util"));
1359
+ var util3 = __toESM(require("util"));
1146
1360
  var chalk = __toESM(require("chalk"));
1147
1361
  var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrinterBase {
1148
1362
  constructor(props) {
@@ -1202,7 +1416,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
1202
1416
  const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
1203
1417
  const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
1204
1418
  this.stream.write(
1205
- util.format(
1419
+ util3.format(
1206
1420
  "%s | %s%s | %s | %s | %s %s%s%s\n",
1207
1421
  event.StackName,
1208
1422
  progress !== false ? `${activity.progress.formatted} | ` : "",
@@ -1227,7 +1441,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
1227
1441
  }
1228
1442
  if (Object.keys(this.resourcesInProgress).length > 0) {
1229
1443
  this.stream.write(
1230
- util.format(
1444
+ util3.format(
1231
1445
  "%s Currently in progress: %s\n",
1232
1446
  progress,
1233
1447
  chalk.bold(Object.keys(this.resourcesInProgress).join(", "))
@@ -1254,7 +1468,7 @@ function colorFromStatusResult(status) {
1254
1468
  }
1255
1469
 
1256
1470
  // ../../aws-cdk/lib/cli/activity-printer/current.ts
1257
- var util2 = __toESM(require("util"));
1471
+ var util4 = __toESM(require("util"));
1258
1472
  var chalk2 = __toESM(require("chalk"));
1259
1473
 
1260
1474
  // ../../aws-cdk/lib/cli/activity-printer/display.ts
@@ -1338,7 +1552,7 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
1338
1552
  ...toPrint.map((res) => {
1339
1553
  const color = colorFromStatusActivity(res.event.ResourceStatus);
1340
1554
  const resourceName = res.metadata?.constructPath ?? res.event.LogicalResourceId ?? "";
1341
- return util2.format(
1555
+ return util4.format(
1342
1556
  "%s | %s | %s | %s%s",
1343
1557
  padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(res.event.Timestamp).toLocaleTimeString()),
1344
1558
  color(padRight(_CurrentActivityPrinter.STATUS_WIDTH, (res.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH))),
@@ -1358,7 +1572,7 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
1358
1572
  continue;
1359
1573
  }
1360
1574
  lines.push(
1361
- util2.format(
1575
+ util4.format(
1362
1576
  chalk2.red("%s | %s | %s | %s%s") + "\n",
1363
1577
  padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
1364
1578
  padRight(_CurrentActivityPrinter.STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH)),
@@ -1429,6 +1643,13 @@ function shorten(maxWidth, p) {
1429
1643
  // ../../aws-cdk/lib/toolkit/cli-io-host.ts
1430
1644
  var CliIoHost = class _CliIoHost {
1431
1645
  constructor(props = {}) {
1646
+ /**
1647
+ * Configure the target stream for notices
1648
+ *
1649
+ * (Not a setter because there's no need for additional logic when this value
1650
+ * is changed yet)
1651
+ */
1652
+ this.noticesDestination = "stderr";
1432
1653
  this._progress = "bar" /* BAR */;
1433
1654
  // Corked Logging
1434
1655
  this.corkedCounter = 0;
@@ -1532,8 +1753,8 @@ var CliIoHost = class _CliIoHost {
1532
1753
  return;
1533
1754
  }
1534
1755
  const output = this.formatMessage(msg);
1535
- const stream = this.selectStream(msg.level);
1536
- stream.write(output);
1756
+ const stream = this.selectStream(msg);
1757
+ stream?.write(output);
1537
1758
  }
1538
1759
  /**
1539
1760
  * Detect stack activity messages so they can be send to the printer.
@@ -1566,10 +1787,19 @@ var CliIoHost = class _CliIoHost {
1566
1787
  return ["none", "non-broadening"].includes(msg.data?.permissionChangeType);
1567
1788
  }
1568
1789
  }
1790
+ /**
1791
+ * Determines the output stream, based on message and configuration.
1792
+ */
1793
+ selectStream(msg) {
1794
+ if (isNoticesMessage(msg)) {
1795
+ return targetStreamObject(this.noticesDestination);
1796
+ }
1797
+ return this.selectStreamFromLevel(msg.level);
1798
+ }
1569
1799
  /**
1570
1800
  * Determines the output stream, based on message level and configuration.
1571
1801
  */
1572
- selectStream(level) {
1802
+ selectStreamFromLevel(level) {
1573
1803
  switch (level) {
1574
1804
  case "error":
1575
1805
  return process.stderr;
@@ -1640,7 +1870,7 @@ var CliIoHost = class _CliIoHost {
1640
1870
  */
1641
1871
  makeActivityPrinter() {
1642
1872
  const props = {
1643
- stream: this.selectStream("info")
1873
+ stream: this.selectStreamFromLevel("info")
1644
1874
  };
1645
1875
  switch (this.stackProgress) {
1646
1876
  case "events" /* EVENTS */:
@@ -1659,7 +1889,7 @@ function isConfirmationPrompt(msg) {
1659
1889
  function extractPromptInfo(msg) {
1660
1890
  const isNumber = typeof msg.defaultResponse === "number";
1661
1891
  return {
1662
- default: util3.format(msg.defaultResponse),
1892
+ default: util5.format(msg.defaultResponse),
1663
1893
  convertAnswer: isNumber ? (v) => Number(v) : (v) => String(v)
1664
1894
  };
1665
1895
  }
@@ -1674,41 +1904,50 @@ var styleMap = {
1674
1904
  function isCI() {
1675
1905
  return process.env.CI !== void 0 && process.env.CI !== "false" && process.env.CI !== "0";
1676
1906
  }
1907
+ function targetStreamObject(x) {
1908
+ switch (x) {
1909
+ case "stderr":
1910
+ return process.stderr;
1911
+ case "stdout":
1912
+ return process.stdout;
1913
+ case "drop":
1914
+ return void 0;
1915
+ }
1916
+ }
1917
+ function isNoticesMessage(msg) {
1918
+ return IO.CDK_TOOLKIT_I0100.is(msg) || IO.CDK_TOOLKIT_W0101.is(msg) || IO.CDK_TOOLKIT_E0101.is(msg) || IO.CDK_TOOLKIT_I0101.is(msg);
1919
+ }
1677
1920
 
1678
1921
  // ../../aws-cdk/lib/logging.ts
1679
- function formatMessageAndLog(level, input, style, ...args) {
1680
- const { message: message2, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
1681
- const formattedMessage = args.length > 0 ? util4.format(message2, ...args) : message2;
1682
- const finalMessage = style ? style(formattedMessage) : formattedMessage;
1683
- const ioHost = CliIoHost.instance();
1684
- const ioMessage = {
1685
- time: /* @__PURE__ */ new Date(),
1686
- action: ioHost.currentAction,
1687
- level,
1688
- message: finalMessage,
1689
- code,
1690
- data: void 0
1691
- };
1692
- void ioHost.notify(ioMessage);
1693
- }
1694
- function getDefaultCode(level, category = "TOOLKIT") {
1695
- const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
1696
- return `CDK_${category}_${levelIndicator}0000`;
1922
+ function formatMessageAndLog(level, input, ...args) {
1923
+ const singletonHost = CliIoHost.instance();
1924
+ const helper = asIoHelper(singletonHost, singletonHost.currentAction);
1925
+ if (typeof input === "string") {
1926
+ const messages = new IoDefaultMessages(helper);
1927
+ messages[level](input, ...args);
1928
+ } else {
1929
+ void helper.notify({
1930
+ data: void 0,
1931
+ time: /* @__PURE__ */ new Date(),
1932
+ level,
1933
+ ...input
1934
+ });
1935
+ }
1697
1936
  }
1698
1937
  var error2 = (input, ...args) => {
1699
- return formatMessageAndLog("error", input, void 0, ...args);
1938
+ return formatMessageAndLog("error", input, ...args);
1700
1939
  };
1701
1940
  var warning = (input, ...args) => {
1702
- return formatMessageAndLog("warn", input, void 0, ...args);
1941
+ return formatMessageAndLog("warn", input, ...args);
1703
1942
  };
1704
1943
  var info2 = (input, ...args) => {
1705
- return formatMessageAndLog("info", input, void 0, ...args);
1944
+ return formatMessageAndLog("info", input, ...args);
1706
1945
  };
1707
1946
  var debug2 = (input, ...args) => {
1708
- return formatMessageAndLog("debug", input, void 0, ...args);
1947
+ return formatMessageAndLog("debug", input, ...args);
1709
1948
  };
1710
1949
  var trace2 = (input, ...args) => {
1711
- return formatMessageAndLog("trace", input, void 0, ...args);
1950
+ return formatMessageAndLog("trace", input, ...args);
1712
1951
  };
1713
1952
 
1714
1953
  // ../../aws-cdk/lib/api/aws-auth/account-cache.ts
@@ -3135,8 +3374,7 @@ var trace3 = (message2, code, payload) => {
3135
3374
  };
3136
3375
 
3137
3376
  // ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
3138
- var util6 = __toESM(require("util"));
3139
- var import_cloud_assembly_schema2 = require("@aws-cdk/cloud-assembly-schema");
3377
+ var util7 = __toESM(require("util"));
3140
3378
  var uuid2 = __toESM(require("uuid"));
3141
3379
 
3142
3380
  // ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
@@ -3249,8 +3487,37 @@ function isStackTerminalState(state) {
3249
3487
  return !(state ?? "").endsWith("_IN_PROGRESS");
3250
3488
  }
3251
3489
 
3490
+ // ../tmp-toolkit-helpers/src/api/resource-metadata/resource-metadata.ts
3491
+ var import_cloud_assembly_schema2 = require("@aws-cdk/cloud-assembly-schema");
3492
+ function resourceMetadata(stack, logicalId) {
3493
+ const metadata = stack.manifest?.metadata;
3494
+ if (!metadata) {
3495
+ return void 0;
3496
+ }
3497
+ for (const path15 of Object.keys(metadata)) {
3498
+ const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema2.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
3499
+ if (entry) {
3500
+ return {
3501
+ entry,
3502
+ constructPath: simplifyConstructPath(path15, stack.stackName)
3503
+ };
3504
+ }
3505
+ }
3506
+ return void 0;
3507
+ }
3508
+ function simplifyConstructPath(path15, stackName) {
3509
+ path15 = path15.replace(/\/Resource$/, "");
3510
+ path15 = path15.replace(/^\//, "");
3511
+ if (stackName) {
3512
+ if (path15.startsWith(stackName + "/")) {
3513
+ path15 = path15.slice(stackName.length + 1);
3514
+ }
3515
+ }
3516
+ return path15;
3517
+ }
3518
+
3252
3519
  // ../../aws-cdk/lib/api/stack-events/stack-progress-monitor.ts
3253
- var util5 = __toESM(require("util"));
3520
+ var util6 = __toESM(require("util"));
3254
3521
  var StackProgressMonitor = class {
3255
3522
  constructor(resourcesTotal) {
3256
3523
  /**
@@ -3299,9 +3566,9 @@ var StackProgressMonitor = class {
3299
3566
  */
3300
3567
  get formatted() {
3301
3568
  if (this.resourcesTotal == null) {
3302
- return padLeft(3, util5.format("%s", this.resourcesDone));
3569
+ return padLeft(3, util6.format("%s", this.resourcesDone));
3303
3570
  }
3304
- return util5.format(
3571
+ return util6.format(
3305
3572
  "%s/%s",
3306
3573
  padLeft(this.resourceDigits, this.resourcesDone.toString()),
3307
3574
  padLeft(this.resourceDigits, this.resourcesTotal.toString())
@@ -3399,7 +3666,7 @@ var StackActivityMonitor = class {
3399
3666
  }
3400
3667
  } catch (e) {
3401
3668
  await this.ioHelper.notify(error3(
3402
- util6.format("Error occurred while monitoring stack: %s", e),
3669
+ util7.format("Error occurred while monitoring stack: %s", e),
3403
3670
  "CDK_TOOLKIT_E5500",
3404
3671
  { error: e }
3405
3672
  ));
@@ -3411,16 +3678,7 @@ var StackActivityMonitor = class {
3411
3678
  if (!logicalId || !metadata) {
3412
3679
  return void 0;
3413
3680
  }
3414
- for (const path15 of Object.keys(metadata)) {
3415
- const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema2.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
3416
- if (entry) {
3417
- return {
3418
- entry,
3419
- constructPath: this.simplifyConstructPath(path15)
3420
- };
3421
- }
3422
- }
3423
- return void 0;
3681
+ return resourceMetadata(this.stack, logicalId);
3424
3682
  }
3425
3683
  /**
3426
3684
  * Reads all new events from the stack history
@@ -3463,7 +3721,7 @@ var StackActivityMonitor = class {
3463
3721
  const metadata = activity.metadata;
3464
3722
  const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
3465
3723
  const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
3466
- return util6.format(
3724
+ return util7.format(
3467
3725
  "%s | %s%s | %s | %s | %s %s%s%s",
3468
3726
  event.StackName,
3469
3727
  progress !== false ? `${activity.progress.formatted} | ` : "",
@@ -3485,14 +3743,6 @@ var StackActivityMonitor = class {
3485
3743
  }
3486
3744
  }
3487
3745
  }
3488
- simplifyConstructPath(path15) {
3489
- path15 = path15.replace(/\/Resource$/, "");
3490
- path15 = path15.replace(/^\//, "");
3491
- if (path15.startsWith(this.stackName + "/")) {
3492
- path15 = path15.slice(this.stackName.length + 1);
3493
- }
3494
- return path15;
3495
- }
3496
3746
  };
3497
3747
 
3498
3748
  // ../../aws-cdk/lib/api/stack-events/stack-status.ts
@@ -4337,8 +4587,9 @@ var CfnEvaluationException = class extends Error {
4337
4587
  };
4338
4588
  var EvaluateCloudFormationTemplate = class _EvaluateCloudFormationTemplate {
4339
4589
  constructor(props) {
4340
- this.stackName = props.stackName;
4341
- this.template = props.template;
4590
+ this.stackArtifact = props.stackArtifact;
4591
+ this.stackName = props.stackName ?? props.stackArtifact.stackName;
4592
+ this.template = props.template ?? props.stackArtifact.template;
4342
4593
  this.context = {
4343
4594
  "AWS::AccountId": props.account,
4344
4595
  "AWS::Region": props.region,
@@ -4357,6 +4608,7 @@ var EvaluateCloudFormationTemplate = class _EvaluateCloudFormationTemplate {
4357
4608
  async createNestedEvaluateCloudFormationTemplate(stackName, nestedTemplate, nestedStackParameters) {
4358
4609
  const evaluatedParams = await this.evaluateCfnExpression(nestedStackParameters);
4359
4610
  return new _EvaluateCloudFormationTemplate({
4611
+ stackArtifact: this.stackArtifact,
4360
4612
  stackName,
4361
4613
  template: nestedTemplate,
4362
4614
  parameters: evaluatedParams,
@@ -4485,6 +4737,9 @@ var EvaluateCloudFormationTemplate = class _EvaluateCloudFormationTemplate {
4485
4737
  getResourceProperty(logicalId, propertyName) {
4486
4738
  return this.template.Resources?.[logicalId]?.Properties?.[propertyName];
4487
4739
  }
4740
+ metadataFor(logicalId) {
4741
+ return resourceMetadata(this.stackArtifact, logicalId);
4742
+ }
4488
4743
  references(logicalId, templateElement) {
4489
4744
  if (typeof templateElement === "string") {
4490
4745
  return logicalId === templateElement;
@@ -4893,16 +5148,17 @@ async function isHotswappableAppSyncChange(logicalId, change, evaluateCfnTemplat
4893
5148
  } else {
4894
5149
  physicalName = arn;
4895
5150
  }
5151
+ if (!physicalName) {
5152
+ return ret;
5153
+ }
4896
5154
  ret.push({
5155
+ change: {
5156
+ cause: change
5157
+ },
4897
5158
  hotswappable: true,
4898
- resourceType: change.newValue.Type,
4899
- propsChanged: namesOfHotswappableChanges,
4900
5159
  service: "appsync",
4901
5160
  resourceNames: [`${change.newValue.Type} '${physicalName}'`],
4902
5161
  apply: async (sdk) => {
4903
- if (!physicalName) {
4904
- return;
4905
- }
4906
5162
  const sdkProperties = {
4907
5163
  ...change.oldValue.Properties,
4908
5164
  Definition: change.newValue.Properties?.Definition,
@@ -5022,16 +5278,17 @@ async function isHotswappableCodeBuildProjectChange(logicalId, change, evaluateC
5022
5278
  logicalId,
5023
5279
  change.newValue.Properties?.Name
5024
5280
  );
5281
+ if (!projectName) {
5282
+ return ret;
5283
+ }
5025
5284
  ret.push({
5285
+ change: {
5286
+ cause: change
5287
+ },
5026
5288
  hotswappable: true,
5027
- resourceType: change.newValue.Type,
5028
- propsChanged: classifiedChanges.namesOfHotswappableProps,
5029
5289
  service: "codebuild",
5030
5290
  resourceNames: [`CodeBuild Project '${projectName}'`],
5031
5291
  apply: async (sdk) => {
5032
- if (!projectName) {
5033
- return;
5034
- }
5035
5292
  updateProjectInput.name = projectName;
5036
5293
  for (const updatedPropName in change.propertyUpdates) {
5037
5294
  const updatedProp = change.propertyUpdates[updatedPropName];
@@ -5067,6 +5324,7 @@ function convertSourceCloudformationKeyToSdkKey(key) {
5067
5324
  }
5068
5325
 
5069
5326
  // ../../aws-cdk/lib/api/hotswap/ecs-services.ts
5327
+ var ECS_SERVICE_RESOURCE_TYPE = "AWS::ECS::Service";
5070
5328
  async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemplate, hotswapPropertyOverrides) {
5071
5329
  if (change.newValue.Type !== "AWS::ECS::TaskDefinition") {
5072
5330
  return [];
@@ -5076,7 +5334,7 @@ async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemp
5076
5334
  classifiedChanges.reportNonHotswappablePropertyChanges(ret);
5077
5335
  const resourcesReferencingTaskDef = evaluateCfnTemplate.findReferencesTo(logicalId);
5078
5336
  const ecsServiceResourcesReferencingTaskDef = resourcesReferencingTaskDef.filter(
5079
- (r) => r.Type === "AWS::ECS::Service"
5337
+ (r) => r.Type === ECS_SERVICE_RESOURCE_TYPE
5080
5338
  );
5081
5339
  const ecsServicesReferencingTaskDef = new Array();
5082
5340
  for (const ecsServiceResource of ecsServiceResourcesReferencingTaskDef) {
@@ -5089,7 +5347,7 @@ async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemp
5089
5347
  reportNonHotswappableChange(ret, change, void 0, "No ECS services reference the changed task definition", false);
5090
5348
  }
5091
5349
  if (resourcesReferencingTaskDef.length > ecsServicesReferencingTaskDef.length) {
5092
- const nonEcsServiceTaskDefRefs = resourcesReferencingTaskDef.filter((r) => r.Type !== "AWS::ECS::Service");
5350
+ const nonEcsServiceTaskDefRefs = resourcesReferencingTaskDef.filter((r) => r.Type !== ECS_SERVICE_RESOURCE_TYPE);
5093
5351
  for (const taskRef of nonEcsServiceTaskDefRefs) {
5094
5352
  reportNonHotswappableChange(
5095
5353
  ret,
@@ -5103,9 +5361,10 @@ async function isHotswappableEcsServiceChange(logicalId, change, evaluateCfnTemp
5103
5361
  if (namesOfHotswappableChanges.length > 0) {
5104
5362
  const taskDefinitionResource = await prepareTaskDefinitionChange(evaluateCfnTemplate, logicalId, change);
5105
5363
  ret.push({
5364
+ change: {
5365
+ cause: change
5366
+ },
5106
5367
  hotswappable: true,
5107
- resourceType: change.newValue.Type,
5108
- propsChanged: namesOfHotswappableChanges,
5109
5368
  service: "ecs-service",
5110
5369
  resourceNames: [
5111
5370
  `ECS Task Definition '${await taskDefinitionResource.Family}'`,
@@ -5195,17 +5454,7 @@ var import_stream = require("stream");
5195
5454
  var archiver2 = require("archiver");
5196
5455
  async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfnTemplate) {
5197
5456
  if (change.newValue.Type === "AWS::Lambda::Version") {
5198
- return [
5199
- {
5200
- hotswappable: true,
5201
- resourceType: "AWS::Lambda::Version",
5202
- resourceNames: [],
5203
- propsChanged: [],
5204
- service: "lambda",
5205
- apply: async (_sdk) => {
5206
- }
5207
- }
5208
- ];
5457
+ return [];
5209
5458
  }
5210
5459
  if (change.newValue.Type === "AWS::Lambda::Alias") {
5211
5460
  return classifyAliasChanges(change);
@@ -5221,36 +5470,27 @@ async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfn
5221
5470
  change.newValue.Properties?.FunctionName
5222
5471
  );
5223
5472
  const namesOfHotswappableChanges = Object.keys(classifiedChanges.hotswappableProps);
5224
- if (namesOfHotswappableChanges.length > 0) {
5473
+ if (functionName && namesOfHotswappableChanges.length > 0) {
5474
+ const lambdaCodeChange = await evaluateLambdaFunctionProps(
5475
+ classifiedChanges.hotswappableProps,
5476
+ change.newValue.Properties?.Runtime,
5477
+ evaluateCfnTemplate
5478
+ );
5479
+ if (lambdaCodeChange === void 0) {
5480
+ return ret;
5481
+ }
5482
+ const dependencies = await dependantResources(logicalId, functionName, evaluateCfnTemplate);
5225
5483
  ret.push({
5484
+ change: {
5485
+ cause: change
5486
+ },
5226
5487
  hotswappable: true,
5227
- resourceType: change.newValue.Type,
5228
- propsChanged: namesOfHotswappableChanges,
5229
5488
  service: "lambda",
5230
5489
  resourceNames: [
5231
5490
  `Lambda Function '${functionName}'`,
5232
- // add Version here if we're publishing a new one
5233
- ...await renderVersions(logicalId, evaluateCfnTemplate, [`Lambda Version for Function '${functionName}'`]),
5234
- // add any Aliases that we are hotswapping here
5235
- ...await renderAliases(
5236
- logicalId,
5237
- evaluateCfnTemplate,
5238
- async (alias) => `Lambda Alias '${alias}' for Function '${functionName}'`
5239
- )
5491
+ ...dependencies.map((d) => d.description ?? `${d.resourceType} '${d.physicalName}'`)
5240
5492
  ],
5241
5493
  apply: async (sdk) => {
5242
- const lambdaCodeChange = await evaluateLambdaFunctionProps(
5243
- classifiedChanges.hotswappableProps,
5244
- change.newValue.Properties?.Runtime,
5245
- evaluateCfnTemplate
5246
- );
5247
- if (lambdaCodeChange === void 0) {
5248
- return;
5249
- }
5250
- if (!functionName) {
5251
- return;
5252
- }
5253
- const { versionsReferencingFunction, aliasesNames } = await versionsAndAliases(logicalId, evaluateCfnTemplate);
5254
5494
  const lambda = sdk.lambda();
5255
5495
  const operations = [];
5256
5496
  if (lambdaCodeChange.code !== void 0 || lambdaCodeChange.configurations !== void 0) {
@@ -5278,17 +5518,19 @@ async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfn
5278
5518
  const updateFunctionCodeResponse = await lambda.updateFunctionConfiguration(updateRequest);
5279
5519
  await waitForLambdasPropertiesUpdateToFinish(updateFunctionCodeResponse, lambda, functionName);
5280
5520
  }
5281
- if (versionsReferencingFunction.length > 0) {
5521
+ const versions = dependencies.filter((d) => d.resourceType === "AWS::Lambda::Version");
5522
+ if (versions.length) {
5282
5523
  const publishVersionPromise = lambda.publishVersion({
5283
5524
  FunctionName: functionName
5284
5525
  });
5285
- if (aliasesNames.length > 0) {
5526
+ const aliases = dependencies.filter((d) => d.resourceType === "AWS::Lambda::Alias");
5527
+ if (aliases.length) {
5286
5528
  const versionUpdate = await publishVersionPromise;
5287
- for (const alias of aliasesNames) {
5529
+ for (const alias of aliases) {
5288
5530
  operations.push(
5289
5531
  lambda.updateAlias({
5290
5532
  FunctionName: functionName,
5291
- Name: alias,
5533
+ Name: alias.physicalName,
5292
5534
  FunctionVersion: versionUpdate.Version
5293
5535
  })
5294
5536
  );
@@ -5308,18 +5550,6 @@ function classifyAliasChanges(change) {
5308
5550
  const ret = [];
5309
5551
  const classifiedChanges = classifyChanges(change, ["FunctionVersion"]);
5310
5552
  classifiedChanges.reportNonHotswappablePropertyChanges(ret);
5311
- const namesOfHotswappableChanges = Object.keys(classifiedChanges.hotswappableProps);
5312
- if (namesOfHotswappableChanges.length > 0) {
5313
- ret.push({
5314
- hotswappable: true,
5315
- resourceType: change.newValue.Type,
5316
- propsChanged: [],
5317
- service: "lambda",
5318
- resourceNames: [],
5319
- apply: async (_sdk) => {
5320
- }
5321
- });
5322
- }
5323
5553
  return ret;
5324
5554
  }
5325
5555
  async function evaluateLambdaFunctionProps(hotswappablePropChanges, runtime, evaluateCfnTemplate) {
@@ -5424,40 +5654,54 @@ function determineCodeFileExtFromRuntime(runtime) {
5424
5654
  async function versionsAndAliases(logicalId, evaluateCfnTemplate) {
5425
5655
  const versionsReferencingFunction = evaluateCfnTemplate.findReferencesTo(logicalId).filter((r) => r.Type === "AWS::Lambda::Version");
5426
5656
  const aliasesReferencingVersions = flatMap(versionsReferencingFunction, (v) => evaluateCfnTemplate.findReferencesTo(v.LogicalId));
5427
- const aliasesNames = await Promise.all(aliasesReferencingVersions.map((a) => evaluateCfnTemplate.evaluateCfnExpression(a.Properties?.Name)));
5428
- return { versionsReferencingFunction, aliasesNames };
5657
+ return { versionsReferencingFunction, aliasesReferencingVersions };
5429
5658
  }
5430
- async function renderAliases(logicalId, evaluateCfnTemplate, callbackfn) {
5431
- const aliasesNames = (await versionsAndAliases(logicalId, evaluateCfnTemplate)).aliasesNames;
5432
- return Promise.all(aliasesNames.map(callbackfn));
5433
- }
5434
- async function renderVersions(logicalId, evaluateCfnTemplate, versionString) {
5435
- const versions = (await versionsAndAliases(logicalId, evaluateCfnTemplate)).versionsReferencingFunction;
5436
- return versions.length > 0 ? versionString : [];
5659
+ async function dependantResources(logicalId, functionName, evaluateCfnTemplate) {
5660
+ const candidates = await versionsAndAliases(logicalId, evaluateCfnTemplate);
5661
+ const aliases = await Promise.all(candidates.aliasesReferencingVersions.map(async (a) => {
5662
+ const name = await evaluateCfnTemplate.evaluateCfnExpression(a.Properties?.Name);
5663
+ return {
5664
+ logicalId: a.LogicalId,
5665
+ physicalName: name,
5666
+ resourceType: "AWS::Lambda::Alias",
5667
+ description: `Lambda Alias '${name}' for Function '${functionName}'`
5668
+ };
5669
+ }));
5670
+ const versions = candidates.versionsReferencingFunction.map((v) => ({
5671
+ logicalId: v.LogicalId,
5672
+ resourceType: v.Type,
5673
+ description: `Lambda Version for Function '${functionName}'`
5674
+ }));
5675
+ return [
5676
+ ...versions,
5677
+ ...aliases
5678
+ ];
5437
5679
  }
5438
5680
 
5439
5681
  // ../../aws-cdk/lib/api/hotswap/s3-bucket-deployments.ts
5440
5682
  var REQUIRED_BY_CFN = "required-to-be-present-by-cfn";
5683
+ var CDK_BUCKET_DEPLOYMENT_CFN_TYPE = "Custom::CDKBucketDeployment";
5441
5684
  async function isHotswappableS3BucketDeploymentChange(_logicalId, change, evaluateCfnTemplate) {
5442
5685
  const ret = [];
5443
- if (change.newValue.Type !== "Custom::CDKBucketDeployment") {
5686
+ if (change.newValue.Type !== CDK_BUCKET_DEPLOYMENT_CFN_TYPE) {
5444
5687
  return [];
5445
5688
  }
5446
5689
  const customResourceProperties = await evaluateCfnTemplate.evaluateCfnExpression({
5447
5690
  ...change.newValue.Properties,
5448
5691
  ServiceToken: void 0
5449
5692
  });
5693
+ const functionName = await evaluateCfnTemplate.evaluateCfnExpression(change.newValue.Properties?.ServiceToken);
5694
+ if (!functionName) {
5695
+ return ret;
5696
+ }
5450
5697
  ret.push({
5698
+ change: {
5699
+ cause: change
5700
+ },
5451
5701
  hotswappable: true,
5452
- resourceType: change.newValue.Type,
5453
- propsChanged: ["*"],
5454
5702
  service: "custom-s3-deployment",
5455
5703
  resourceNames: [`Contents of S3 Bucket '${customResourceProperties.DestinationBucketName}'`],
5456
5704
  apply: async (sdk) => {
5457
- const functionName = await evaluateCfnTemplate.evaluateCfnExpression(change.newValue.Properties?.ServiceToken);
5458
- if (!functionName) {
5459
- return;
5460
- }
5461
5705
  await sdk.lambda().invokeCommand({
5462
5706
  FunctionName: functionName,
5463
5707
  // Lambda refuses to take a direct JSON object and requires it to be stringify()'d
@@ -5535,16 +5779,17 @@ async function isHotswappableStateMachineChange(logicalId, change, evaluateCfnTe
5535
5779
  const stateMachineArn = stateMachineNameInCfnTemplate ? await evaluateCfnTemplate.evaluateCfnExpression({
5536
5780
  "Fn::Sub": "arn:${AWS::Partition}:states:${AWS::Region}:${AWS::AccountId}:stateMachine:" + stateMachineNameInCfnTemplate
5537
5781
  }) : await evaluateCfnTemplate.findPhysicalNameFor(logicalId);
5782
+ if (!stateMachineArn) {
5783
+ return ret;
5784
+ }
5538
5785
  ret.push({
5786
+ change: {
5787
+ cause: change
5788
+ },
5539
5789
  hotswappable: true,
5540
- resourceType: change.newValue.Type,
5541
- propsChanged: namesOfHotswappableChanges,
5542
5790
  service: "stepfunctions-service",
5543
5791
  resourceNames: [`${change.newValue.Type} '${stateMachineArn?.split(":")[6]}'`],
5544
5792
  apply: async (sdk) => {
5545
- if (!stateMachineArn) {
5546
- return;
5547
- }
5548
5793
  await sdk.stepFunctions().updateStateMachine({
5549
5794
  stateMachineArn,
5550
5795
  definition: await evaluateCfnTemplate.evaluateCfnExpression(change.propertyUpdates.DefinitionString.newValue)
@@ -5580,12 +5825,35 @@ var RESOURCE_DETECTORS = {
5580
5825
  "AWS::CDK::Metadata": async () => []
5581
5826
  };
5582
5827
  async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFormationStack, stackArtifact, hotswapMode, hotswapPropertyOverrides) {
5583
- const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment);
5828
+ const hotswapSpan = await ioHelper.span(SPAN.HOTSWAP).begin({
5829
+ stack: stackArtifact,
5830
+ mode: hotswapMode
5831
+ });
5832
+ const result2 = await hotswapDeployment(
5833
+ sdkProvider,
5834
+ hotswapSpan,
5835
+ assetParams,
5836
+ stackArtifact,
5837
+ hotswapMode,
5838
+ hotswapPropertyOverrides
5839
+ );
5840
+ await hotswapSpan.end();
5841
+ if (result2?.hotswapped === true) {
5842
+ return {
5843
+ type: "did-deploy-stack",
5844
+ noOp: result2.hotswappableChanges.length === 0,
5845
+ stackArn: cloudFormationStack.stackId,
5846
+ outputs: cloudFormationStack.outputs
5847
+ };
5848
+ }
5849
+ return void 0;
5850
+ }
5851
+ async function hotswapDeployment(sdkProvider, ioSpan, assetParams, stack, hotswapMode, hotswapPropertyOverrides) {
5852
+ const resolvedEnv = await sdkProvider.resolveEnvironment(stack.environment);
5584
5853
  const sdk = (await sdkProvider.forEnvironment(resolvedEnv, 1 /* ForWriting */)).sdk;
5585
- const currentTemplate = await loadCurrentTemplateWithNestedStacks(stackArtifact, sdk);
5854
+ const currentTemplate = await loadCurrentTemplateWithNestedStacks(stack, sdk);
5586
5855
  const evaluateCfnTemplate = new EvaluateCloudFormationTemplate({
5587
- stackName: stackArtifact.stackName,
5588
- template: stackArtifact.template,
5856
+ stackArtifact: stack,
5589
5857
  parameters: assetParams,
5590
5858
  account: resolvedEnv.account,
5591
5859
  region: resolvedEnv.region,
@@ -5593,7 +5861,7 @@ async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFor
5593
5861
  sdk,
5594
5862
  nestedStacks: currentTemplate.nestedStacks
5595
5863
  });
5596
- const stackChanges = cfn_diff.fullDiff(currentTemplate.deployedRootTemplate, stackArtifact.template);
5864
+ const stackChanges = cfn_diff.fullDiff(currentTemplate.deployedRootTemplate, stack.template);
5597
5865
  const { hotswappableChanges, nonHotswappableChanges } = await classifyResourceChanges(
5598
5866
  stackChanges,
5599
5867
  evaluateCfnTemplate,
@@ -5601,18 +5869,23 @@ async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFor
5601
5869
  currentTemplate.nestedStacks,
5602
5870
  hotswapPropertyOverrides
5603
5871
  );
5604
- await logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotswapMode);
5605
- if (hotswapMode === "fall-back" /* FALL_BACK */) {
5872
+ await logNonHotswappableChanges(ioSpan, nonHotswappableChanges, hotswapMode);
5873
+ if (hotswapMode === "fall-back") {
5606
5874
  if (nonHotswappableChanges.length > 0) {
5607
- return void 0;
5875
+ return {
5876
+ stack,
5877
+ hotswapped: false,
5878
+ hotswappableChanges,
5879
+ nonHotswappableChanges
5880
+ };
5608
5881
  }
5609
5882
  }
5610
- await applyAllHotswappableChanges(sdk, ioHelper, hotswappableChanges);
5883
+ await applyAllHotswappableChanges(sdk, ioSpan, hotswappableChanges);
5611
5884
  return {
5612
- type: "did-deploy-stack",
5613
- noOp: hotswappableChanges.length === 0,
5614
- stackArn: cloudFormationStack.stackId,
5615
- outputs: cloudFormationStack.outputs
5885
+ stack,
5886
+ hotswapped: true,
5887
+ hotswappableChanges,
5888
+ nonHotswappableChanges
5616
5889
  };
5617
5890
  }
5618
5891
  async function classifyResourceChanges(stackChanges, evaluateCfnTemplate, sdk, nestedStackNames, hotswapPropertyOverrides) {
@@ -5798,21 +6071,21 @@ function isCandidateForHotswapping(change, logicalId) {
5798
6071
  propertyUpdates: change.propertyUpdates
5799
6072
  };
5800
6073
  }
5801
- async function applyAllHotswappableChanges(sdk, ioHelper, hotswappableChanges) {
6074
+ async function applyAllHotswappableChanges(sdk, ioSpan, hotswappableChanges) {
5802
6075
  if (hotswappableChanges.length > 0) {
5803
- await ioHelper.notify(info3(`
6076
+ await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`
5804
6077
  ${ICON} hotswapping resources:`));
5805
6078
  }
5806
6079
  const limit = pLimit(10);
5807
6080
  return Promise.all(hotswappableChanges.map((hotswapOperation) => limit(() => {
5808
- return applyHotswappableChange(sdk, ioHelper, hotswapOperation);
6081
+ return applyHotswappableChange(sdk, ioSpan, hotswapOperation);
5809
6082
  })));
5810
6083
  }
5811
- async function applyHotswappableChange(sdk, ioHelper, hotswapOperation) {
6084
+ async function applyHotswappableChange(sdk, ioSpan, hotswapOperation) {
5812
6085
  const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
5813
6086
  sdk.appendCustomUserAgent(customUserAgent);
5814
6087
  for (const name of hotswapOperation.resourceNames) {
5815
- await ioHelper.notify(info3((0, import_util23.format)(` ${ICON} %s`, chalk8.bold(name))));
6088
+ await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util23.format)(` ${ICON} %s`, chalk8.bold(name))));
5816
6089
  }
5817
6090
  try {
5818
6091
  await hotswapOperation.apply(sdk);
@@ -5826,7 +6099,7 @@ async function applyHotswappableChange(sdk, ioHelper, hotswapOperation) {
5826
6099
  throw e;
5827
6100
  }
5828
6101
  for (const name of hotswapOperation.resourceNames) {
5829
- await ioHelper.notify(info3((0, import_util23.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
6102
+ await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util23.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
5830
6103
  }
5831
6104
  sdk.removeCustomUserAgent(customUserAgent);
5832
6105
  }
@@ -5842,18 +6115,18 @@ ${observedResponses}`;
5842
6115
  }
5843
6116
  return main;
5844
6117
  }
5845
- async function logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotswapMode) {
6118
+ async function logNonHotswappableChanges(ioSpan, nonHotswappableChanges, hotswapMode) {
5846
6119
  if (nonHotswappableChanges.length === 0) {
5847
6120
  return;
5848
6121
  }
5849
- if (hotswapMode === "hotswap-only" /* HOTSWAP_ONLY */) {
6122
+ if (hotswapMode === "hotswap-only") {
5850
6123
  nonHotswappableChanges = nonHotswappableChanges.filter((change) => change.hotswapOnlyVisible === true);
5851
6124
  if (nonHotswappableChanges.length === 0) {
5852
6125
  return;
5853
6126
  }
5854
6127
  }
5855
6128
  const messages = [""];
5856
- if (hotswapMode === "hotswap-only" /* HOTSWAP_ONLY */) {
6129
+ if (hotswapMode === "hotswap-only") {
5857
6130
  messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
5858
6131
  } else {
5859
6132
  messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
@@ -5877,7 +6150,7 @@ async function logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotsw
5877
6150
  }
5878
6151
  }
5879
6152
  messages.push("");
5880
- await ioHelper.notify(info3(messages.join("\n")));
6153
+ await ioSpan.notify(IO.DEFAULT_TOOLKIT_INFO.msg(messages.join("\n")));
5881
6154
  }
5882
6155
 
5883
6156
  // ../../aws-cdk/lib/api/deployments/deploy-stack.ts
@@ -5889,7 +6162,7 @@ async function deployStack(options, ioHelper) {
5889
6162
  const deployName = options.deployName || stackArtifact.stackName;
5890
6163
  let cloudFormationStack = await CloudFormationStack.lookup(cfn, deployName);
5891
6164
  if (cloudFormationStack.stackStatus.isCreationFailure) {
5892
- await ioHelper.notify(debug3(
6165
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(
5893
6166
  `Found existing stack ${deployName} that had previously failed creation. Deleting it before attempting to re-create it.`
5894
6167
  ));
5895
6168
  await cfn.deleteStack({ StackName: deployName });
@@ -5915,9 +6188,9 @@ async function deployStack(options, ioHelper) {
5915
6188
  const hotswapMode = options.hotswap ?? "full-deployment" /* FULL_DEPLOYMENT */;
5916
6189
  const hotswapPropertyOverrides = options.hotswapPropertyOverrides ?? new HotswapPropertyOverrides();
5917
6190
  if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters), ioHelper)) {
5918
- await ioHelper.notify(debug3(`${deployName}: skipping deployment (use --force to override)`));
6191
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: skipping deployment (use --force to override)`));
5919
6192
  if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
5920
- await ioHelper.notify(info3(
6193
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(
5921
6194
  (0, import_util25.format)(
5922
6195
  `
5923
6196
  ${ICON} %s
@@ -5933,7 +6206,7 @@ async function deployStack(options, ioHelper) {
5933
6206
  stackArn: cloudFormationStack.stackId
5934
6207
  };
5935
6208
  } else {
5936
- await ioHelper.notify(debug3(`${deployName}: deploying...`));
6209
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: deploying...`));
5937
6210
  }
5938
6211
  const bodyParameter = await makeBodyParameter(
5939
6212
  stackArtifact,
@@ -5946,7 +6219,7 @@ async function deployStack(options, ioHelper) {
5946
6219
  try {
5947
6220
  bootstrapStackName = (await options.envResources.lookupToolkit()).stackName;
5948
6221
  } catch (e) {
5949
- await ioHelper.notify(debug3(`Could not determine the bootstrap stack name: ${e}`));
6222
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Could not determine the bootstrap stack name: ${e}`));
5950
6223
  }
5951
6224
  await publishAssets(legacyAssets.toManifest(stackArtifact.assembly.directory), options.sdkProvider, stackEnv, {
5952
6225
  parallel: options.assetParallelism,
@@ -5966,7 +6239,7 @@ async function deployStack(options, ioHelper) {
5966
6239
  if (hotswapDeploymentResult) {
5967
6240
  return hotswapDeploymentResult;
5968
6241
  }
5969
- await ioHelper.notify(info3((0, import_util25.format)(
6242
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)(
5970
6243
  "Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
5971
6244
  stackArtifact.displayName
5972
6245
  )));
@@ -5974,13 +6247,13 @@ async function deployStack(options, ioHelper) {
5974
6247
  if (!(e instanceof CfnEvaluationException)) {
5975
6248
  throw e;
5976
6249
  }
5977
- await ioHelper.notify(info3((0, import_util25.format)(
6250
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)(
5978
6251
  "Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
5979
6252
  formatErrorMessage(e)
5980
6253
  )));
5981
6254
  }
5982
6255
  if (hotswapMode === "fall-back" /* FALL_BACK */) {
5983
- await ioHelper.notify(info3("Falling back to doing a full deployment"));
6256
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg("Falling back to doing a full deployment"));
5984
6257
  options.sdk.appendCustomUserAgent("cdk-hotswap/fallback");
5985
6258
  } else {
5986
6259
  return {
@@ -6036,16 +6309,16 @@ var FullCloudFormationDeployment = class {
6036
6309
  const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
6037
6310
  await this.updateTerminationProtection();
6038
6311
  if (changeSetHasNoChanges(changeSetDescription)) {
6039
- await this.ioHelper.notify(debug3((0, import_util25.format)("No changes are to be performed on %s.", this.stackName)));
6312
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("No changes are to be performed on %s.", this.stackName)));
6040
6313
  if (execute) {
6041
- await this.ioHelper.notify(debug3((0, import_util25.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
6314
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
6042
6315
  await this.cfn.deleteChangeSet({
6043
6316
  StackName: this.stackName,
6044
6317
  ChangeSetName: changeSetName
6045
6318
  });
6046
6319
  }
6047
6320
  if (this.options.force) {
6048
- await this.ioHelper.notify(warn2(
6321
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_WARN.msg(
6049
6322
  [
6050
6323
  "You used the --force flag, but CloudFormation reported that the deployment would not make any changes.",
6051
6324
  "According to CloudFormation, all resources are already up-to-date with the state in your CDK app.",
@@ -6063,7 +6336,7 @@ var FullCloudFormationDeployment = class {
6063
6336
  };
6064
6337
  }
6065
6338
  if (!execute) {
6066
- await this.ioHelper.notify(info3((0, import_util25.format)(
6339
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)(
6067
6340
  "Changeset %s created and waiting in review for manual execution (--no-execute)",
6068
6341
  changeSetDescription.ChangeSetId
6069
6342
  )));
@@ -6090,8 +6363,8 @@ var FullCloudFormationDeployment = class {
6090
6363
  }
6091
6364
  async createChangeSet(changeSetName, willExecute, importExistingResources) {
6092
6365
  await this.cleanupOldChangeset(changeSetName);
6093
- await this.ioHelper.notify(debug3(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
6094
- await this.ioHelper.notify(info3((0, import_util25.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
6366
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
6367
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
6095
6368
  const changeSet = await this.cfn.createChangeSet({
6096
6369
  StackName: this.stackName,
6097
6370
  ChangeSetName: changeSetName,
@@ -6102,20 +6375,20 @@ var FullCloudFormationDeployment = class {
6102
6375
  ImportExistingResources: importExistingResources,
6103
6376
  ...this.commonPrepareOptions()
6104
6377
  });
6105
- await this.ioHelper.notify(debug3((0, import_util25.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
6378
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
6106
6379
  return waitForChangeSet(this.cfn, this.ioHelper, this.stackName, changeSetName, {
6107
6380
  fetchAll: willExecute
6108
6381
  });
6109
6382
  }
6110
6383
  async executeChangeSet(changeSet) {
6111
- await this.ioHelper.notify(debug3((0, import_util25.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
6384
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
6112
6385
  await this.cfn.executeChangeSet({
6113
6386
  StackName: this.stackName,
6114
6387
  ChangeSetName: changeSet.ChangeSetName,
6115
6388
  ClientRequestToken: `exec${this.uuid}`,
6116
6389
  ...this.commonExecuteOptions()
6117
6390
  });
6118
- await this.ioHelper.notify(debug3(
6391
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(
6119
6392
  (0, import_util25.format)(
6120
6393
  "Execution of changeset %s on stack %s has started; waiting for the update to complete...",
6121
6394
  changeSet.ChangeSetId,
@@ -6127,7 +6400,7 @@ var FullCloudFormationDeployment = class {
6127
6400
  }
6128
6401
  async cleanupOldChangeset(changeSetName) {
6129
6402
  if (this.cloudFormationStack.exists) {
6130
- await this.ioHelper.notify(debug3(`Removing existing change set with name ${changeSetName} if it exists`));
6403
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Removing existing change set with name ${changeSetName} if it exists`));
6131
6404
  await this.cfn.deleteChangeSet({
6132
6405
  StackName: this.stackName,
6133
6406
  ChangeSetName: changeSetName
@@ -6137,7 +6410,7 @@ var FullCloudFormationDeployment = class {
6137
6410
  async updateTerminationProtection() {
6138
6411
  const terminationProtection = this.stackArtifact.terminationProtection ?? false;
6139
6412
  if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
6140
- await this.ioHelper.notify(debug3(
6413
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(
6141
6414
  (0, import_util25.format)(
6142
6415
  "Updating termination protection from %s to %s for stack %s",
6143
6416
  this.cloudFormationStack.terminationProtection,
@@ -6149,11 +6422,11 @@ var FullCloudFormationDeployment = class {
6149
6422
  StackName: this.stackName,
6150
6423
  EnableTerminationProtection: terminationProtection
6151
6424
  });
6152
- await this.ioHelper.notify(debug3((0, import_util25.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
6425
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
6153
6426
  }
6154
6427
  }
6155
6428
  async directDeployment() {
6156
- await this.ioHelper.notify(info3((0, import_util25.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
6429
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util25.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
6157
6430
  const startTime = /* @__PURE__ */ new Date();
6158
6431
  if (this.update) {
6159
6432
  await this.updateTerminationProtection();
@@ -6166,7 +6439,7 @@ var FullCloudFormationDeployment = class {
6166
6439
  });
6167
6440
  } catch (err) {
6168
6441
  if (err.message === "No updates are to be performed.") {
6169
- await this.ioHelper.notify(debug3((0, import_util25.format)("No updates are to be performed for stack %s", this.stackName)));
6442
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("No updates are to be performed for stack %s", this.stackName)));
6170
6443
  return {
6171
6444
  type: "did-deploy-stack",
6172
6445
  noOp: true,
@@ -6211,7 +6484,7 @@ var FullCloudFormationDeployment = class {
6211
6484
  } finally {
6212
6485
  await monitor.stop();
6213
6486
  }
6214
- debug3((0, import_util25.format)("Stack %s has completed updating", this.stackName));
6487
+ await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util25.format)("Stack %s has completed updating", this.stackName)));
6215
6488
  return {
6216
6489
  type: "did-deploy-stack",
6217
6490
  noOp: false,
@@ -6277,45 +6550,45 @@ async function destroyStack(options, ioHelper) {
6277
6550
  }
6278
6551
  async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges, ioHelper) {
6279
6552
  const deployName = deployStackOptions.deployName || deployStackOptions.stack.stackName;
6280
- await ioHelper.notify(debug3(`${deployName}: checking if we can skip deploy`));
6553
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: checking if we can skip deploy`));
6281
6554
  if (deployStackOptions.force) {
6282
- await ioHelper.notify(debug3(`${deployName}: forced deployment`));
6555
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: forced deployment`));
6283
6556
  return false;
6284
6557
  }
6285
6558
  if (deployStackOptions.deploymentMethod?.method === "change-set" && deployStackOptions.deploymentMethod.execute === false) {
6286
- await ioHelper.notify(debug3(`${deployName}: --no-execute, always creating change set`));
6559
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: --no-execute, always creating change set`));
6287
6560
  return false;
6288
6561
  }
6289
6562
  if (!cloudFormationStack.exists) {
6290
- await ioHelper.notify(debug3(`${deployName}: no existing stack`));
6563
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: no existing stack`));
6291
6564
  return false;
6292
6565
  }
6293
6566
  if (JSON.stringify(deployStackOptions.stack.template) !== JSON.stringify(await cloudFormationStack.template())) {
6294
- await ioHelper.notify(debug3(`${deployName}: template has changed`));
6567
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: template has changed`));
6295
6568
  return false;
6296
6569
  }
6297
6570
  if (!compareTags(cloudFormationStack.tags, deployStackOptions.tags ?? [])) {
6298
- await ioHelper.notify(debug3(`${deployName}: tags have changed`));
6571
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: tags have changed`));
6299
6572
  return false;
6300
6573
  }
6301
6574
  if (!arrayEquals(cloudFormationStack.notificationArns, deployStackOptions.notificationArns ?? [])) {
6302
- await ioHelper.notify(debug3(`${deployName}: notification arns have changed`));
6575
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: notification arns have changed`));
6303
6576
  return false;
6304
6577
  }
6305
6578
  if (!!deployStackOptions.stack.terminationProtection !== !!cloudFormationStack.terminationProtection) {
6306
- await ioHelper.notify(debug3(`${deployName}: termination protection has been updated`));
6579
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: termination protection has been updated`));
6307
6580
  return false;
6308
6581
  }
6309
6582
  if (parameterChanges) {
6310
6583
  if (parameterChanges === "ssm") {
6311
- await ioHelper.notify(debug3(`${deployName}: some parameters come from SSM so we have to assume they may have changed`));
6584
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: some parameters come from SSM so we have to assume they may have changed`));
6312
6585
  } else {
6313
- await ioHelper.notify(debug3(`${deployName}: parameters have changed`));
6586
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: parameters have changed`));
6314
6587
  }
6315
6588
  return false;
6316
6589
  }
6317
6590
  if (cloudFormationStack.stackStatus.isFailure) {
6318
- await ioHelper.notify(debug3(`${deployName}: stack is in a failure state`));
6591
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`${deployName}: stack is in a failure state`));
6319
6592
  return false;
6320
6593
  }
6321
6594
  return true;
@@ -6422,18 +6695,21 @@ function loadTreeFromDir(outdir) {
6422
6695
 
6423
6696
  // ../../aws-cdk/lib/notices.ts
6424
6697
  var CACHE_FILE_PATH = path10.join(cdkCacheDir(), "notices.json");
6425
- var NoticesFilter = class _NoticesFilter {
6426
- static filter(options) {
6698
+ var NoticesFilter = class {
6699
+ constructor(ioMessages) {
6700
+ this.ioMessages = ioMessages;
6701
+ }
6702
+ filter(options) {
6427
6703
  const components = [
6428
- ..._NoticesFilter.constructTreeComponents(options.outDir),
6429
- ..._NoticesFilter.otherComponents(options)
6704
+ ...this.constructTreeComponents(options.outDir),
6705
+ ...this.otherComponents(options)
6430
6706
  ];
6431
- return _NoticesFilter.findForNamedComponents(options.data, components);
6707
+ return this.findForNamedComponents(options.data, components);
6432
6708
  }
6433
6709
  /**
6434
6710
  * From a set of input options, return the notices components we are searching for
6435
6711
  */
6436
- static otherComponents(options) {
6712
+ otherComponents(options) {
6437
6713
  return [
6438
6714
  // CLI
6439
6715
  {
@@ -6451,7 +6727,7 @@ var NoticesFilter = class _NoticesFilter {
6451
6727
  ...options.bootstrappedEnvironments.flatMap((env) => {
6452
6728
  const semverBootstrapVersion = semver4.coerce(env.bootstrapStackVersion);
6453
6729
  if (!semverBootstrapVersion) {
6454
- warning(`While filtering notices, could not coerce bootstrap version '${env.bootstrapStackVersion}' into semver`);
6730
+ this.ioMessages.warning(`While filtering notices, could not coerce bootstrap version '${env.bootstrapStackVersion}' into semver`);
6455
6731
  return [];
6456
6732
  }
6457
6733
  return [{
@@ -6466,14 +6742,14 @@ var NoticesFilter = class _NoticesFilter {
6466
6742
  /**
6467
6743
  * Based on a set of component names, find all notices that match one of the given components
6468
6744
  */
6469
- static findForNamedComponents(data, actualComponents) {
6745
+ findForNamedComponents(data, actualComponents) {
6470
6746
  return data.flatMap((notice) => {
6471
6747
  const ors = this.resolveAliases(normalizeComponents(notice.components));
6472
6748
  for (const ands of ors) {
6473
- const matched = ands.map((affected) => actualComponents.filter((actual) => _NoticesFilter.componentNameMatches(affected, actual) && semver4.satisfies(actual.version, affected.version, { includePrerelease: true })));
6749
+ const matched = ands.map((affected) => actualComponents.filter((actual) => this.componentNameMatches(affected, actual) && semver4.satisfies(actual.version, affected.version, { includePrerelease: true })));
6474
6750
  if (matched.every((xs) => xs.length > 0)) {
6475
6751
  const ret = new FilteredNotice(notice);
6476
- _NoticesFilter.addDynamicValues(matched.flatMap((x) => x), ret);
6752
+ this.addDynamicValues(matched.flatMap((x) => x), ret);
6477
6753
  return [ret];
6478
6754
  }
6479
6755
  }
@@ -6486,7 +6762,7 @@ var NoticesFilter = class _NoticesFilter {
6486
6762
  * The name matches if the name is exactly the same, or the name in the notice
6487
6763
  * is a prefix of the node name when the query ends in '.'.
6488
6764
  */
6489
- static componentNameMatches(pattern, actual) {
6765
+ componentNameMatches(pattern, actual) {
6490
6766
  return pattern.name.endsWith(".") ? actual.name.startsWith(pattern.name) : pattern.name === actual.name;
6491
6767
  }
6492
6768
  /**
@@ -6495,7 +6771,7 @@ var NoticesFilter = class _NoticesFilter {
6495
6771
  * If there are multiple components with the same dynamic name, they are joined
6496
6772
  * by a comma.
6497
6773
  */
6498
- static addDynamicValues(comps, notice) {
6774
+ addDynamicValues(comps, notice) {
6499
6775
  const dynamicValues = {};
6500
6776
  for (const comp of comps) {
6501
6777
  if (comp.dynamicName) {
@@ -6513,7 +6789,7 @@ var NoticesFilter = class _NoticesFilter {
6513
6789
  * Because it's EITHER `aws-cdk-lib` or `@aws-cdk/core`, we need to add multiple
6514
6790
  * arrays at the top level.
6515
6791
  */
6516
- static resolveAliases(ors) {
6792
+ resolveAliases(ors) {
6517
6793
  return ors.flatMap((ands) => {
6518
6794
  const hasFramework = ands.find((c) => c.name === "framework");
6519
6795
  if (!hasFramework) {
@@ -6528,7 +6804,7 @@ var NoticesFilter = class _NoticesFilter {
6528
6804
  /**
6529
6805
  * Load the construct tree from the given directory and return its components
6530
6806
  */
6531
- static constructTreeComponents(manifestDir) {
6807
+ constructTreeComponents(manifestDir) {
6532
6808
  const tree = loadTreeFromDir(manifestDir);
6533
6809
  if (!tree) {
6534
6810
  return [];
@@ -6558,8 +6834,12 @@ var Notices = class _Notices {
6558
6834
  this.acknowledgedIssueNumbers = new Set(this.context.get("acknowledged-issue-numbers") ?? []);
6559
6835
  this.includeAcknowlegded = props.includeAcknowledged ?? false;
6560
6836
  this.output = props.output ?? "cdk.out";
6561
- this.shouldDisplay = props.shouldDisplay ?? true;
6562
6837
  this.httpOptions = props.httpOptions ?? {};
6838
+ this.ioMessages = new IoDefaultMessages(asIoHelper(
6839
+ props.ioHost,
6840
+ "notices"
6841
+ /* forcing a CliAction to a ToolkitAction */
6842
+ ));
6563
6843
  }
6564
6844
  /**
6565
6845
  * Create an instance. Note that this replaces the singleton.
@@ -6595,54 +6875,54 @@ var Notices = class _Notices {
6595
6875
  * If context is configured to not display notices, this will no-op.
6596
6876
  */
6597
6877
  async refresh(options = {}) {
6598
- if (!this.shouldDisplay) {
6599
- return;
6600
- }
6601
6878
  try {
6602
- const underlyingDataSource = options.dataSource ?? new WebsiteNoticeDataSource(this.httpOptions);
6603
- const dataSource = new CachedDataSource(CACHE_FILE_PATH, underlyingDataSource, options.force ?? false);
6879
+ const underlyingDataSource = options.dataSource ?? new WebsiteNoticeDataSource(this.ioMessages, this.httpOptions);
6880
+ const dataSource = new CachedDataSource(this.ioMessages, CACHE_FILE_PATH, underlyingDataSource, options.force ?? false);
6604
6881
  const notices = await dataSource.fetch();
6605
6882
  this.data = new Set(this.includeAcknowlegded ? notices : notices.filter((n) => !this.acknowledgedIssueNumbers.has(n.issueNumber)));
6606
6883
  } catch (e) {
6607
- debug2(`Could not refresh notices: ${e}`);
6884
+ this.ioMessages.debug(`Could not refresh notices: ${e}`);
6608
6885
  }
6609
6886
  }
6610
6887
  /**
6611
6888
  * Display the relevant notices (unless context dictates we shouldn't).
6612
6889
  */
6613
6890
  display(options = {}) {
6614
- if (!this.shouldDisplay) {
6615
- return;
6616
- }
6617
- const filteredNotices = NoticesFilter.filter({
6891
+ const filteredNotices = new NoticesFilter(this.ioMessages).filter({
6618
6892
  data: Array.from(this.data),
6619
6893
  cliVersion: versionNumber(),
6620
6894
  outDir: this.output,
6621
6895
  bootstrappedEnvironments: Array.from(this.bootstrappedEnvironments.values())
6622
6896
  });
6623
6897
  if (filteredNotices.length > 0) {
6624
- info2("");
6625
- info2("NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)");
6626
- info2("");
6898
+ void this.ioMessages.notify(IO.CDK_TOOLKIT_I0100.msg([
6899
+ "",
6900
+ "NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)",
6901
+ ""
6902
+ ].join("\n")));
6627
6903
  for (const filtered of filteredNotices) {
6628
- const formatted = filtered.format();
6904
+ const formatted = filtered.format() + "\n";
6629
6905
  switch (filtered.notice.severity) {
6630
6906
  case "warning":
6631
- warning(formatted);
6907
+ void this.ioMessages.notify(IO.CDK_TOOLKIT_W0101.msg(formatted));
6632
6908
  break;
6633
6909
  case "error":
6634
- error2(formatted);
6910
+ void this.ioMessages.notify(IO.CDK_TOOLKIT_E0101.msg(formatted));
6635
6911
  break;
6636
6912
  default:
6637
- info2(formatted);
6913
+ void this.ioMessages.notify(IO.CDK_TOOLKIT_I0101.msg(formatted));
6914
+ break;
6638
6915
  }
6639
- info2("");
6640
6916
  }
6641
- info2(`If you don\u2019t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge ${filteredNotices[0].notice.issueNumber}".`);
6917
+ void this.ioMessages.notify(IO.CDK_TOOLKIT_I0100.msg(
6918
+ `If you don\u2019t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge ${filteredNotices[0].notice.issueNumber}".`
6919
+ ));
6642
6920
  }
6643
6921
  if (options.showTotal ?? false) {
6644
- info2("");
6645
- info2(`There are ${filteredNotices.length} unacknowledged notice(s).`);
6922
+ void this.ioMessages.notify(IO.CDK_TOOLKIT_I0100.msg(
6923
+ `
6924
+ There are ${filteredNotices.length} unacknowledged notice(s).`
6925
+ ));
6646
6926
  }
6647
6927
  }
6648
6928
  };
@@ -6683,7 +6963,8 @@ var FilteredNotice = class {
6683
6963
  }
6684
6964
  };
6685
6965
  var WebsiteNoticeDataSource = class {
6686
- constructor(options = {}) {
6966
+ constructor(ioMessages, options = {}) {
6967
+ this.ioMessages = ioMessages;
6687
6968
  this.options = options;
6688
6969
  }
6689
6970
  fetch() {
@@ -6716,7 +6997,7 @@ var WebsiteNoticeDataSource = class {
6716
6997
  if (!data) {
6717
6998
  throw new ToolkitError("'notices' key is missing");
6718
6999
  }
6719
- debug2("Notices refreshed");
7000
+ this.ioMessages.debug("Notices refreshed");
6720
7001
  resolve3(data ?? []);
6721
7002
  } catch (e) {
6722
7003
  reject(new ToolkitError(`Failed to parse notices: ${formatErrorMessage(e)}`));
@@ -6740,7 +7021,8 @@ var WebsiteNoticeDataSource = class {
6740
7021
  var TIME_TO_LIVE_SUCCESS = 60 * 60 * 1e3;
6741
7022
  var TIME_TO_LIVE_ERROR = 1 * 60 * 1e3;
6742
7023
  var CachedDataSource = class {
6743
- constructor(fileName, dataSource, skipCache) {
7024
+ constructor(ioMessages, fileName, dataSource, skipCache) {
7025
+ this.ioMessages = ioMessages;
6744
7026
  this.fileName = fileName;
6745
7027
  this.dataSource = dataSource;
6746
7028
  this.skipCache = skipCache;
@@ -6754,7 +7036,7 @@ var CachedDataSource = class {
6754
7036
  await this.save(freshData);
6755
7037
  return freshData.notices;
6756
7038
  } else {
6757
- debug2(`Reading cached notices from ${this.fileName}`);
7039
+ this.ioMessages.debug(`Reading cached notices from ${this.fileName}`);
6758
7040
  return data;
6759
7041
  }
6760
7042
  }
@@ -6765,7 +7047,7 @@ var CachedDataSource = class {
6765
7047
  notices: await this.dataSource.fetch()
6766
7048
  };
6767
7049
  } catch (e) {
6768
- debug2(`Could not refresh notices: ${e}`);
7050
+ this.ioMessages.debug(`Could not refresh notices: ${e}`);
6769
7051
  return {
6770
7052
  expiration: Date.now() + TIME_TO_LIVE_ERROR,
6771
7053
  notices: []
@@ -6780,7 +7062,7 @@ var CachedDataSource = class {
6780
7062
  try {
6781
7063
  return fs11.existsSync(this.fileName) ? await fs11.readJSON(this.fileName) : defaultValue;
6782
7064
  } catch (e) {
6783
- debug2(`Failed to load notices from cache: ${e}`);
7065
+ this.ioMessages.debug(`Failed to load notices from cache: ${e}`);
6784
7066
  return defaultValue;
6785
7067
  }
6786
7068
  }
@@ -6788,7 +7070,7 @@ var CachedDataSource = class {
6788
7070
  try {
6789
7071
  await fs11.writeJSON(this.fileName, cached2);
6790
7072
  } catch (e) {
6791
- debug2(`Failed to store notices in the cache: ${e}`);
7073
+ this.ioMessages.debug(`Failed to store notices in the cache: ${e}`);
6792
7074
  }
6793
7075
  }
6794
7076
  };
@@ -7970,7 +8252,7 @@ var ResourceMigrator = class {
7970
8252
  };
7971
8253
 
7972
8254
  // ../../aws-cdk/lib/api/logs/logs-monitor.ts
7973
- var util7 = __toESM(require("util"));
8255
+ var util8 = __toESM(require("util"));
7974
8256
  var chalk15 = __toESM(require("chalk"));
7975
8257
  var uuid4 = __toESM(require("uuid"));
7976
8258
  var CloudWatchLogEventMonitor = class {
@@ -8089,7 +8371,7 @@ var CloudWatchLogEventMonitor = class {
8089
8371
  */
8090
8372
  async print(event) {
8091
8373
  await this.ioHelper.notify(IO.CDK_TOOLKIT_I5033.msg(
8092
- util7.format(
8374
+ util8.format(
8093
8375
  "[%s] %s %s",
8094
8376
  chalk15.blue(event.logGroupName),
8095
8377
  chalk15.yellow(event.timestamp.toLocaleTimeString()),
@@ -8157,8 +8439,7 @@ async function findCloudWatchLogGroups(sdkProvider, ioHelper, stackArtifact) {
8157
8439
  }
8158
8440
  const listStackResources = new LazyListStackResources(sdk, stackArtifact.stackName);
8159
8441
  const evaluateCfnTemplate = new EvaluateCloudFormationTemplate({
8160
- stackName: stackArtifact.stackName,
8161
- template: stackArtifact.template,
8442
+ stackArtifact,
8162
8443
  parameters: {},
8163
8444
  account: resolvedEnv.account,
8164
8445
  region: resolvedEnv.region,