@aws-cdk/toolkit-lib 0.1.2 → 0.1.3

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.
@@ -53,7 +53,6 @@ __export(aws_cdk_exports, {
53
53
  ResourceMigrator: () => ResourceMigrator,
54
54
  SdkProvider: () => SdkProvider,
55
55
  Settings: () => Settings,
56
- StackActivityProgress: () => StackActivityProgress,
57
56
  StackCollection: () => StackCollection,
58
57
  WorkGraphBuilder: () => WorkGraphBuilder,
59
58
  contextproviders: () => context_providers_exports,
@@ -102,18 +101,18 @@ var import_util_retry = require("@smithy/util-retry");
102
101
 
103
102
  // ../../aws-cdk/lib/api/aws-auth/account-cache.ts
104
103
  var path2 = __toESM(require("path"));
105
- var fs2 = __toESM(require("fs-extra"));
104
+ var fs3 = __toESM(require("fs-extra"));
106
105
 
107
106
  // ../../aws-cdk/lib/logging.ts
108
- var util2 = __toESM(require("util"));
109
- var chalk2 = __toESM(require("chalk"));
107
+ var util4 = __toESM(require("util"));
108
+ var chalk4 = __toESM(require("chalk"));
110
109
 
111
110
  // ../../aws-cdk/lib/toolkit/cli-io-host.ts
112
- var util = __toESM(require("node:util"));
113
- var chalk = __toESM(require("chalk"));
111
+ var util3 = __toESM(require("node:util"));
112
+ var chalk3 = __toESM(require("chalk"));
114
113
  var promptly = __toESM(require("promptly"));
115
114
 
116
- // ../../aws-cdk/lib/toolkit/error.ts
115
+ // ../tmp-toolkit-helpers/src/api/toolkit-error.ts
117
116
  var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.ToolkitError");
118
117
  var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AuthenticationError");
119
118
  var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AssemblyError");
@@ -143,6 +142,10 @@ var ToolkitError = class _ToolkitError extends Error {
143
142
  static isContextProviderError(x) {
144
143
  return this.isToolkitError(x) && CONTEXT_PROVIDER_ERROR_SYMBOL in x;
145
144
  }
145
+ /**
146
+ * The type of the error, defaults to "toolkit".
147
+ */
148
+ type;
146
149
  constructor(message, type = "toolkit") {
147
150
  super(message);
148
151
  Object.setPrototypeOf(this, _ToolkitError.prototype);
@@ -173,136 +176,933 @@ var ContextProviderError = class _ContextProviderError extends ToolkitError {
173
176
  }
174
177
  };
175
178
 
176
- // ../../aws-cdk/lib/toolkit/cli-io-host.ts
177
- var levelPriority = {
178
- error: 0,
179
- result: 1,
180
- warn: 2,
181
- info: 3,
182
- debug: 4,
183
- trace: 5
184
- };
185
- var CliIoHost = class _CliIoHost {
186
- constructor(props = {}) {
187
- // Corked Logging
188
- this.corkedCounter = 0;
189
- this.corkedLoggingBuffer = [];
190
- this._currentAction = props.currentAction ?? "none";
191
- this._isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
192
- this._logLevel = props.logLevel ?? "info";
193
- this._isCI = props.isCI ?? isCI();
179
+ // ../../aws-cdk/lib/util/archive.ts
180
+ var glob = __toESM(require("glob"));
181
+
182
+ // ../../aws-cdk/lib/util/format-error.ts
183
+ function formatErrorMessage(error3) {
184
+ if (error3 && Array.isArray(error3.errors)) {
185
+ const innerMessages = error3.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
186
+ return `AggregateError: ${innerMessages}`;
194
187
  }
195
- /**
196
- * Returns the singleton instance
197
- */
198
- static instance(props = {}, forceNew = false) {
199
- if (forceNew || !_CliIoHost._instance) {
200
- _CliIoHost._instance = new _CliIoHost(props);
201
- }
202
- return _CliIoHost._instance;
188
+ return error3?.message || error3?.toString() || "Unknown error";
189
+ }
190
+
191
+ // ../../aws-cdk/lib/util/archive.ts
192
+ var archiver = require("archiver");
193
+
194
+ // ../../aws-cdk/lib/util/arrays.ts
195
+ function flatMap(xs, fn) {
196
+ return flatten(xs.map(fn));
197
+ }
198
+ function flatten(xs) {
199
+ return Array.prototype.concat.apply([], xs);
200
+ }
201
+
202
+ // ../../aws-cdk/lib/util/bytes.ts
203
+ function formatBytes(bytes, decimals = 2) {
204
+ decimals = decimals < 0 ? 0 : decimals;
205
+ if (bytes === 0) {
206
+ return "0 Bytes";
203
207
  }
204
- /**
205
- * Returns the singleton instance
206
- */
207
- registerIoHost(ioHost) {
208
- if (ioHost !== this) {
209
- this._internalIoHost = ioHost;
208
+ const k = 1024;
209
+ const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
210
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
211
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
212
+ }
213
+
214
+ // ../../aws-cdk/lib/util/cloudformation.ts
215
+ function validateSnsTopicArn(arn) {
216
+ return /^arn:aws:sns:[a-z0-9\-]+:[0-9]+:[a-z0-9\-\_]+$/i.test(arn);
217
+ }
218
+ function stackEventHasErrorMessage(status) {
219
+ return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
220
+ }
221
+ function maxResourceTypeLength(template, startWidth = "AWS::CloudFormation::Stack".length) {
222
+ const resources = template && template.Resources || {};
223
+ let maxWidth = startWidth;
224
+ for (const id of Object.keys(resources)) {
225
+ const type = resources[id].Type || "";
226
+ if (type.length > maxWidth) {
227
+ maxWidth = type.length;
210
228
  }
211
229
  }
212
- /**
213
- * The current action being performed by the CLI.
214
- */
215
- get currentAction() {
216
- return this._currentAction;
217
- }
218
- /**
219
- * Sets the current action being performed by the CLI.
220
- *
221
- * @param action The action being performed by the CLI.
222
- */
223
- set currentAction(action) {
224
- this._currentAction = action;
230
+ return maxWidth;
231
+ }
232
+
233
+ // ../../aws-cdk/lib/util/content-hash.ts
234
+ var crypto = __toESM(require("crypto"));
235
+ function contentHash(data) {
236
+ return crypto.createHash("sha256").update(data).digest("hex");
237
+ }
238
+ function contentHashAny(value) {
239
+ const ret = crypto.createHash("sha256");
240
+ recurse(value);
241
+ return ret.digest("hex");
242
+ function recurse(x) {
243
+ if (typeof x === "string") {
244
+ ret.update(x);
245
+ return;
246
+ }
247
+ if (Array.isArray(x)) {
248
+ ret.update("[");
249
+ for (const e of x) {
250
+ recurse(e);
251
+ ret.update("||");
252
+ }
253
+ ret.update("]");
254
+ return;
255
+ }
256
+ if (x && typeof x === "object") {
257
+ ret.update("{");
258
+ for (const key of Object.keys(x).sort()) {
259
+ ret.update(key);
260
+ ret.update(":");
261
+ recurse(x[key]);
262
+ }
263
+ ret.update("}");
264
+ return;
265
+ }
266
+ ret.update(`${x}${typeof x}`);
225
267
  }
226
- /**
227
- * Whether the host can use interactions and message styling.
228
- */
229
- get isTTY() {
230
- return this._isTTY;
268
+ }
269
+
270
+ // ../../aws-cdk/lib/util/types.ts
271
+ function isObject(x) {
272
+ return x !== null && typeof x === "object" && !isArray(x);
273
+ }
274
+ var isArray = Array.isArray;
275
+
276
+ // ../../aws-cdk/lib/util/objects.ts
277
+ function deepClone(x) {
278
+ if (typeof x === "undefined") {
279
+ return void 0;
231
280
  }
232
- /**
233
- * Set TTY mode, i.e can the host use interactions and message styling.
234
- *
235
- * @param value set TTY mode
236
- */
237
- set isTTY(value) {
238
- this._isTTY = value;
281
+ if (x === null) {
282
+ return null;
239
283
  }
240
- /**
241
- * Whether the CliIoHost is running in CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
242
- */
243
- get isCI() {
244
- return this._isCI;
284
+ if (isArray(x)) {
285
+ return x.map(deepClone);
245
286
  }
246
- /**
247
- * Set the CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
248
- * @param value set the CI mode
249
- */
250
- set isCI(value) {
251
- this._isCI = value;
287
+ if (isObject(x)) {
288
+ return makeObject(mapObject(x, (k, v) => [k, deepClone(v)]));
252
289
  }
253
- /**
254
- * The current threshold. Messages with a lower priority level will be ignored.
255
- */
256
- get logLevel() {
257
- return this._logLevel;
290
+ return x;
291
+ }
292
+ function mapObject(x, fn) {
293
+ const ret = [];
294
+ Object.keys(x).forEach((key) => {
295
+ ret.push(fn(key, x[key]));
296
+ });
297
+ return ret;
298
+ }
299
+ function makeObject(pairs) {
300
+ const ret = {};
301
+ for (const pair of pairs) {
302
+ ret[pair[0]] = pair[1];
258
303
  }
259
- /**
260
- * Sets the current threshold. Messages with a lower priority level will be ignored.
261
- * @param level The new log level threshold
262
- */
263
- set logLevel(level) {
264
- this._logLevel = level;
304
+ return ret;
305
+ }
306
+ function deepGet(x, path12) {
307
+ path12 = path12.slice();
308
+ while (path12.length > 0 && isObject(x)) {
309
+ const key = path12.shift();
310
+ x = x[key];
265
311
  }
266
- /**
267
- * Executes a block of code with corked logging. All log messages during execution
268
- * are buffered and only written when all nested cork blocks complete (when CORK_COUNTER reaches 0).
269
- * The corking is bound to the specific instance of the CliIoHost.
270
- *
271
- * @param block - Async function to execute with corked logging
272
- * @returns Promise that resolves with the block's return value
273
- */
274
- async withCorkedLogging(block) {
275
- this.corkedCounter++;
276
- try {
277
- return await block();
278
- } finally {
279
- this.corkedCounter--;
280
- if (this.corkedCounter === 0) {
281
- for (const ioMessage of this.corkedLoggingBuffer) {
282
- await this.notify(ioMessage);
283
- }
284
- this.corkedLoggingBuffer.splice(0);
285
- }
286
- }
312
+ return path12.length === 0 ? x : void 0;
313
+ }
314
+ function deepSet(x, path12, value) {
315
+ path12 = path12.slice();
316
+ if (path12.length === 0) {
317
+ throw new ToolkitError("Path may not be empty");
287
318
  }
288
- /**
289
- * Notifies the host of a message.
290
- * The caller waits until the notification completes.
291
- */
292
- async notify(msg) {
293
- if (this._internalIoHost) {
294
- return this._internalIoHost.notify(msg);
295
- }
296
- if (levelPriority[msg.level] > levelPriority[this.logLevel]) {
297
- return;
298
- }
299
- if (this.corkedCounter > 0) {
300
- this.corkedLoggingBuffer.push(msg);
301
- return;
319
+ while (path12.length > 1 && isObject(x)) {
320
+ const key = path12.shift();
321
+ if (!(key in x)) {
322
+ x[key] = {};
302
323
  }
303
- const output = this.formatMessage(msg);
304
- const stream = this.selectStream(msg.level);
305
- stream.write(output);
324
+ x = x[key];
325
+ }
326
+ if (!isObject(x)) {
327
+ throw new ToolkitError(`Expected an object, got '${x}'`);
328
+ }
329
+ if (value !== void 0) {
330
+ x[path12[0]] = value;
331
+ } else {
332
+ delete x[path12[0]];
333
+ }
334
+ }
335
+ function deepMerge(...objects) {
336
+ function mergeOne(target, source) {
337
+ for (const key of Object.keys(source)) {
338
+ if (key === "__proto__" || key === "constructor") {
339
+ continue;
340
+ }
341
+ const value = source[key];
342
+ if (isObject(value)) {
343
+ if (!isObject(target[key])) {
344
+ target[key] = {};
345
+ }
346
+ mergeOne(target[key], value);
347
+ } else if (typeof value !== "undefined") {
348
+ target[key] = value;
349
+ }
350
+ }
351
+ }
352
+ const others = objects.filter((x) => x != null);
353
+ if (others.length === 0) {
354
+ return {};
355
+ }
356
+ const into = others.splice(0, 1)[0];
357
+ others.forEach((other) => mergeOne(into, other));
358
+ return into;
359
+ }
360
+ function splitBySize(data, maxSizeBytes) {
361
+ if (maxSizeBytes < 2) {
362
+ return [void 0, data];
363
+ }
364
+ const entries = Object.entries(data);
365
+ return recurse(0, 0);
366
+ function recurse(index, runningTotalSize) {
367
+ if (index >= entries.length) {
368
+ return [data, void 0];
369
+ }
370
+ const size = runningTotalSize + entrySize(entries[index]);
371
+ return size > maxSizeBytes ? cutAt(index) : recurse(index + 1, size);
372
+ }
373
+ function entrySize(entry) {
374
+ return Buffer.byteLength(JSON.stringify(Object.fromEntries([entry])));
375
+ }
376
+ function cutAt(index) {
377
+ return [
378
+ Object.fromEntries(entries.slice(0, index)),
379
+ Object.fromEntries(entries.slice(index))
380
+ ];
381
+ }
382
+ }
383
+
384
+ // ../../aws-cdk/lib/util/parallel.ts
385
+ async function parallelPromises(n, promises) {
386
+ const ret = new Array();
387
+ let count = 0;
388
+ let error3;
389
+ const queue = [...promises];
390
+ return new Promise((ok, ko) => {
391
+ tick();
392
+ function tick() {
393
+ if (count === 0 && error3) {
394
+ ko(error3);
395
+ return;
396
+ }
397
+ if (count === 0 && queue.length === 0) {
398
+ ok(ret);
399
+ return;
400
+ }
401
+ while (count < n && queue.length > 0 && !error3) {
402
+ const next = queue.shift();
403
+ if (next !== void 0) {
404
+ start(next);
405
+ }
406
+ }
407
+ }
408
+ function start(fn) {
409
+ count += 1;
410
+ fn().then((result) => {
411
+ ret.push(result);
412
+ }).catch((e) => {
413
+ error3 = e;
414
+ }).finally(() => {
415
+ count -= 1;
416
+ tick();
417
+ });
418
+ }
419
+ });
420
+ }
421
+
422
+ // ../../aws-cdk/lib/util/serialize.ts
423
+ var fs = __toESM(require("fs-extra"));
424
+
425
+ // ../../aws-cdk/lib/util/yaml-cfn.ts
426
+ var yaml = __toESM(require("yaml"));
427
+ var yaml_types = __toESM(require("yaml/types"));
428
+ function serialize(obj) {
429
+ const oldFold = yaml_types.strOptions.fold.lineWidth;
430
+ try {
431
+ yaml_types.strOptions.fold.lineWidth = 0;
432
+ return yaml.stringify(obj, { schema: "yaml-1.1" });
433
+ } finally {
434
+ yaml_types.strOptions.fold.lineWidth = oldFold;
435
+ }
436
+ }
437
+ function deserialize(str) {
438
+ return parseYamlStrWithCfnTags(str);
439
+ }
440
+ function makeTagForCfnIntrinsic(intrinsicName, addFnPrefix) {
441
+ return {
442
+ identify(value) {
443
+ return typeof value === "string";
444
+ },
445
+ tag: `!${intrinsicName}`,
446
+ resolve: (_doc, cstNode) => {
447
+ const ret = {};
448
+ ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = // the +1 is to account for the ! the short form begins with
449
+ parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1));
450
+ return ret;
451
+ }
452
+ };
453
+ }
454
+ var shortForms = [
455
+ "Base64",
456
+ "Cidr",
457
+ "FindInMap",
458
+ "GetAZs",
459
+ "ImportValue",
460
+ "Join",
461
+ "Sub",
462
+ "Select",
463
+ "Split",
464
+ "Transform",
465
+ "And",
466
+ "Equals",
467
+ "If",
468
+ "Not",
469
+ "Or",
470
+ "GetAtt"
471
+ ].map((name) => makeTagForCfnIntrinsic(name, true)).concat(
472
+ makeTagForCfnIntrinsic("Ref", false),
473
+ makeTagForCfnIntrinsic("Condition", false)
474
+ );
475
+ function parseYamlStrWithCfnTags(text) {
476
+ return yaml.parse(text, {
477
+ customTags: shortForms,
478
+ schema: "core"
479
+ });
480
+ }
481
+
482
+ // ../../aws-cdk/lib/util/serialize.ts
483
+ function toYAML(obj) {
484
+ return serialize(obj);
485
+ }
486
+ function deserializeStructure(str) {
487
+ return deserialize(str);
488
+ }
489
+ function serializeStructure(object, json) {
490
+ if (json) {
491
+ return JSON.stringify(object, void 0, 2);
492
+ } else {
493
+ return toYAML(object);
494
+ }
495
+ }
496
+ function obscureTemplate(template = {}) {
497
+ if (template.Rules) {
498
+ if (template.Rules.CheckBootstrapVersion) {
499
+ if (Object.keys(template.Rules).length > 1) {
500
+ delete template.Rules.CheckBootstrapVersion;
501
+ } else {
502
+ delete template.Rules;
503
+ }
504
+ }
505
+ }
506
+ return template;
507
+ }
508
+ function isJsonBuffer(value) {
509
+ return typeof value === "object" && "type" in value && value.type === "Buffer" && "data" in value && Array.isArray(value.data);
510
+ }
511
+ function replacerBufferWithInfo(_key, value) {
512
+ if (isJsonBuffer(value)) {
513
+ return `<Buffer: ${formatBytes(value.data.length)}>`;
514
+ }
515
+ return value;
516
+ }
517
+
518
+ // ../../aws-cdk/lib/util/string-manipulation.ts
519
+ function padLeft(n, x, char = " ") {
520
+ return char.repeat(Math.max(0, n - x.length)) + x;
521
+ }
522
+ function padRight(n, x, char = " ") {
523
+ return x + char.repeat(Math.max(0, n - x.length));
524
+ }
525
+ function formatTime(num) {
526
+ return roundPercentage(millisecondsToSeconds(num));
527
+ }
528
+ function roundPercentage(num) {
529
+ return Math.round(100 * num) / 100;
530
+ }
531
+ function millisecondsToSeconds(num) {
532
+ return num / 1e3;
533
+ }
534
+
535
+ // ../../aws-cdk/lib/util/version-range.ts
536
+ var semver = __toESM(require("semver"));
537
+
538
+ // ../../aws-cdk/lib/cli/activity-printer/base.ts
539
+ var ActivityPrinterBase = class {
540
+ constructor(props) {
541
+ this.props = props;
542
+ /**
543
+ * The with of the "resource type" column.
544
+ */
545
+ this.resourceTypeColumnWidth = maxResourceTypeLength({});
546
+ /**
547
+ * A list of resource IDs which are currently being processed
548
+ */
549
+ this.resourcesInProgress = {};
550
+ this.rollingBack = false;
551
+ this.failures = new Array();
552
+ this.hookFailureMap = /* @__PURE__ */ new Map();
553
+ this.stream = props.stream;
554
+ }
555
+ static {
556
+ this.TIMESTAMP_WIDTH = 12;
557
+ }
558
+ static {
559
+ this.STATUS_WIDTH = 20;
560
+ }
561
+ /**
562
+ * Receive a stack activity message
563
+ */
564
+ notify(msg) {
565
+ switch (msg.code) {
566
+ case "CDK_TOOLKIT_I5501":
567
+ this.start(msg.data);
568
+ break;
569
+ case "CDK_TOOLKIT_I5502":
570
+ this.activity(msg.data);
571
+ break;
572
+ case "CDK_TOOLKIT_I5503":
573
+ this.stop();
574
+ break;
575
+ default:
576
+ break;
577
+ }
578
+ }
579
+ start({ stack }) {
580
+ this.resourceTypeColumnWidth = maxResourceTypeLength(stack.template);
581
+ }
582
+ activity(activity) {
583
+ this.addActivity(activity);
584
+ this.print();
585
+ }
586
+ stop() {
587
+ this.print();
588
+ }
589
+ addActivity(activity) {
590
+ const status = activity.event.ResourceStatus;
591
+ const hookStatus = activity.event.HookStatus;
592
+ const hookType = activity.event.HookType;
593
+ if (!status || !activity.event.LogicalResourceId) {
594
+ return;
595
+ }
596
+ this.stackProgress = activity.progress;
597
+ if (status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS") {
598
+ this.rollingBack = true;
599
+ }
600
+ if (status.endsWith("_IN_PROGRESS")) {
601
+ this.resourcesInProgress[activity.event.LogicalResourceId] = activity;
602
+ }
603
+ if (stackEventHasErrorMessage(status)) {
604
+ const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
605
+ if (!isCancelled) {
606
+ this.failures.push(activity);
607
+ }
608
+ }
609
+ if (status.endsWith("_COMPLETE") || status.endsWith("_FAILED")) {
610
+ delete this.resourcesInProgress[activity.event.LogicalResourceId];
611
+ }
612
+ if (hookStatus !== void 0 && hookStatus.endsWith("_COMPLETE_FAILED") && activity.event.LogicalResourceId !== void 0 && hookType !== void 0) {
613
+ if (this.hookFailureMap.has(activity.event.LogicalResourceId)) {
614
+ this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
615
+ } else {
616
+ this.hookFailureMap.set(activity.event.LogicalResourceId, /* @__PURE__ */ new Map());
617
+ this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
618
+ }
619
+ }
620
+ }
621
+ failureReason(activity) {
622
+ const resourceStatusReason = activity.event.ResourceStatusReason ?? "";
623
+ const logicalResourceId = activity.event.LogicalResourceId ?? "";
624
+ const hookFailureReasonMap = this.hookFailureMap.get(logicalResourceId);
625
+ if (hookFailureReasonMap !== void 0) {
626
+ for (const hookType of hookFailureReasonMap.keys()) {
627
+ if (resourceStatusReason.includes(hookType)) {
628
+ return resourceStatusReason + " : " + hookFailureReasonMap.get(hookType);
629
+ }
630
+ }
631
+ }
632
+ return resourceStatusReason;
633
+ }
634
+ /**
635
+ * Is the activity a meta activity for the stack itself.
636
+ */
637
+ isActivityForTheStack(activity) {
638
+ return activity.event.PhysicalResourceId === activity.event.StackId;
639
+ }
640
+ };
641
+
642
+ // ../../aws-cdk/lib/cli/activity-printer/history.ts
643
+ var util = __toESM(require("util"));
644
+ var chalk = __toESM(require("chalk"));
645
+ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrinterBase {
646
+ constructor(props) {
647
+ super(props);
648
+ /**
649
+ * Last time we printed something to the console.
650
+ *
651
+ * Used to measure timeout for progress reporting.
652
+ */
653
+ this.lastPrintTime = Date.now();
654
+ /**
655
+ * Number of ms of change absence before we tell the user about the resources that are currently in progress.
656
+ */
657
+ this.inProgressDelay = 3e4;
658
+ this.printable = new Array();
659
+ }
660
+ activity(activity) {
661
+ this.printable.push(activity);
662
+ super.activity(activity);
663
+ }
664
+ stop() {
665
+ super.stop();
666
+ if (this.failures.length > 0) {
667
+ this.stream.write("\nFailed resources:\n");
668
+ for (const failure of this.failures) {
669
+ if (this.isActivityForTheStack(failure)) {
670
+ continue;
671
+ }
672
+ this.printOne(failure, false);
673
+ }
674
+ }
675
+ }
676
+ print() {
677
+ for (const activity of this.printable) {
678
+ this.printOne(activity);
679
+ this.lastPrinted = activity;
680
+ }
681
+ this.printable.splice(0, this.printable.length);
682
+ this.printInProgress(this.lastPrinted?.progress.formatted);
683
+ }
684
+ printOne(activity, progress) {
685
+ const event = activity.event;
686
+ const color = colorFromStatusResult(event.ResourceStatus);
687
+ let reasonColor = chalk.cyan;
688
+ let stackTrace = "";
689
+ const metadata = activity.metadata;
690
+ if (event.ResourceStatus && event.ResourceStatus.indexOf("FAILED") !== -1) {
691
+ if (progress == void 0 || progress) {
692
+ event.ResourceStatusReason = event.ResourceStatusReason ? this.failureReason(activity) : "";
693
+ }
694
+ if (metadata) {
695
+ stackTrace = metadata.entry.trace ? `
696
+ ${metadata.entry.trace.join("\n \\_ ")}` : "";
697
+ }
698
+ reasonColor = chalk.red;
699
+ }
700
+ const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
701
+ const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
702
+ this.stream.write(
703
+ util.format(
704
+ "%s | %s%s | %s | %s | %s %s%s%s\n",
705
+ event.StackName,
706
+ progress !== false ? `${activity.progress.formatted} | ` : "",
707
+ new Date(event.Timestamp).toLocaleTimeString(),
708
+ color(padRight(_HistoryActivityPrinter.STATUS_WIDTH, (event.ResourceStatus || "").slice(0, _HistoryActivityPrinter.STATUS_WIDTH))),
709
+ // pad left and trim
710
+ padRight(this.resourceTypeColumnWidth, event.ResourceType || ""),
711
+ color(chalk.bold(resourceName)),
712
+ logicalId,
713
+ reasonColor(chalk.bold(event.ResourceStatusReason ? event.ResourceStatusReason : "")),
714
+ reasonColor(stackTrace)
715
+ )
716
+ );
717
+ this.lastPrintTime = Date.now();
718
+ }
719
+ /**
720
+ * If some resources are taking a while to create, notify the user about what's currently in progress
721
+ */
722
+ printInProgress(progress) {
723
+ if (!progress || Date.now() < this.lastPrintTime + this.inProgressDelay) {
724
+ return;
725
+ }
726
+ if (Object.keys(this.resourcesInProgress).length > 0) {
727
+ this.stream.write(
728
+ util.format(
729
+ "%s Currently in progress: %s\n",
730
+ progress,
731
+ chalk.bold(Object.keys(this.resourcesInProgress).join(", "))
732
+ )
733
+ );
734
+ }
735
+ this.lastPrintTime = Infinity;
736
+ }
737
+ };
738
+ function colorFromStatusResult(status) {
739
+ if (!status) {
740
+ return chalk.reset;
741
+ }
742
+ if (status.indexOf("FAILED") !== -1) {
743
+ return chalk.red;
744
+ }
745
+ if (status.indexOf("ROLLBACK") !== -1) {
746
+ return chalk.yellow;
747
+ }
748
+ if (status.indexOf("COMPLETE") !== -1) {
749
+ return chalk.green;
750
+ }
751
+ return chalk.reset;
752
+ }
753
+
754
+ // ../../aws-cdk/lib/cli/activity-printer/current.ts
755
+ var util2 = __toESM(require("util"));
756
+ var chalk2 = __toESM(require("chalk"));
757
+
758
+ // ../../aws-cdk/lib/cli/activity-printer/display.ts
759
+ var wrapAnsi = require("wrap-ansi");
760
+ var RewritableBlock = class {
761
+ constructor(stream) {
762
+ this.stream = stream;
763
+ this.lastHeight = 0;
764
+ this.trailingEmptyLines = 0;
765
+ }
766
+ get width() {
767
+ return this.stream.columns;
768
+ }
769
+ get height() {
770
+ return this.stream.rows;
771
+ }
772
+ displayLines(lines) {
773
+ lines = terminalWrap(this.width, expandNewlines(lines));
774
+ lines = lines.slice(0, getMaxBlockHeight(this.height, this.lastHeight, lines));
775
+ this.stream.write(cursorUp(this.lastHeight));
776
+ for (const line of lines) {
777
+ this.stream.write(cll() + line + "\n");
778
+ }
779
+ this.trailingEmptyLines = Math.max(0, this.lastHeight - lines.length);
780
+ for (let i = 0; i < this.trailingEmptyLines; i++) {
781
+ this.stream.write(cll() + "\n");
782
+ }
783
+ this.lastHeight = Math.max(this.lastHeight, lines.length);
784
+ }
785
+ removeEmptyLines() {
786
+ this.stream.write(cursorUp(this.trailingEmptyLines));
787
+ }
788
+ };
789
+ var ESC = "\x1B";
790
+ function cursorUp(n) {
791
+ n = typeof n === "number" ? n : 1;
792
+ return n > 0 ? ESC + "[" + n + "A" : "";
793
+ }
794
+ function cll() {
795
+ return ESC + "[K";
796
+ }
797
+ function terminalWrap(width, lines) {
798
+ if (width === void 0) {
799
+ return lines;
800
+ }
801
+ return lines.flatMap((line) => wrapAnsi(line, width - 1, {
802
+ hard: true,
803
+ trim: true,
804
+ wordWrap: false
805
+ }).split("\n"));
806
+ }
807
+ function expandNewlines(lines) {
808
+ return lines.flatMap((line) => line.split("\n"));
809
+ }
810
+ function getMaxBlockHeight(windowHeight, lastHeight, lines) {
811
+ if (windowHeight === void 0) {
812
+ return Math.max(lines.length, lastHeight);
813
+ }
814
+ return lines.length < windowHeight ? lines.length : windowHeight - 1;
815
+ }
816
+
817
+ // ../../aws-cdk/lib/cli/activity-printer/current.ts
818
+ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrinterBase {
819
+ constructor(props) {
820
+ super(props);
821
+ this.block = new RewritableBlock(this.stream);
822
+ }
823
+ print() {
824
+ const lines = [];
825
+ const progressWidth = Math.max(
826
+ Math.min((this.block.width ?? 80) - PROGRESSBAR_EXTRA_SPACE - 1, MAX_PROGRESSBAR_WIDTH),
827
+ MIN_PROGRESSBAR_WIDTH
828
+ );
829
+ const prog = this.progressBar(progressWidth);
830
+ if (prog) {
831
+ lines.push(" " + prog, "");
832
+ }
833
+ const toPrint = [...this.failures, ...Object.values(this.resourcesInProgress)];
834
+ toPrint.sort((a, b) => a.event.Timestamp.getTime() - b.event.Timestamp.getTime());
835
+ lines.push(
836
+ ...toPrint.map((res) => {
837
+ const color = colorFromStatusActivity(res.event.ResourceStatus);
838
+ const resourceName = res.metadata?.constructPath ?? res.event.LogicalResourceId ?? "";
839
+ return util2.format(
840
+ "%s | %s | %s | %s%s",
841
+ padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(res.event.Timestamp).toLocaleTimeString()),
842
+ color(padRight(_CurrentActivityPrinter.STATUS_WIDTH, (res.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH))),
843
+ padRight(this.resourceTypeColumnWidth, res.event.ResourceType || ""),
844
+ color(chalk2.bold(shorten(40, resourceName))),
845
+ this.failureReasonOnNextLine(res)
846
+ );
847
+ })
848
+ );
849
+ this.block.displayLines(lines);
850
+ }
851
+ stop() {
852
+ super.stop();
853
+ const lines = new Array();
854
+ for (const failure of this.failures) {
855
+ if (this.isActivityForTheStack(failure)) {
856
+ continue;
857
+ }
858
+ lines.push(
859
+ util2.format(
860
+ chalk2.red("%s | %s | %s | %s%s") + "\n",
861
+ padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
862
+ padRight(_CurrentActivityPrinter.STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH)),
863
+ padRight(this.resourceTypeColumnWidth, failure.event.ResourceType || ""),
864
+ shorten(40, failure.event.LogicalResourceId ?? ""),
865
+ this.failureReasonOnNextLine(failure)
866
+ )
867
+ );
868
+ const trace3 = failure.metadata?.entry?.trace;
869
+ if (trace3) {
870
+ lines.push(chalk2.red(` ${trace3.join("\n \\_ ")}
871
+ `));
872
+ }
873
+ }
874
+ this.block.displayLines(lines);
875
+ this.block.removeEmptyLines();
876
+ }
877
+ progressBar(width) {
878
+ if (!this.stackProgress || !this.stackProgress.total) {
879
+ return "";
880
+ }
881
+ const fraction = Math.min(this.stackProgress.completed / this.stackProgress.total, 1);
882
+ const innerWidth = Math.max(1, width - 2);
883
+ const chars = innerWidth * fraction;
884
+ const remainder = chars - Math.floor(chars);
885
+ const fullChars = FULL_BLOCK.repeat(Math.floor(chars));
886
+ const partialChar = PARTIAL_BLOCK[Math.floor(remainder * PARTIAL_BLOCK.length)];
887
+ const filler = "\xB7".repeat(innerWidth - Math.floor(chars) - (partialChar ? 1 : 0));
888
+ const color = this.rollingBack ? chalk2.yellow : chalk2.green;
889
+ return "[" + color(fullChars + partialChar) + filler + `] (${this.stackProgress.completed}/${this.stackProgress.total})`;
890
+ }
891
+ failureReasonOnNextLine(activity) {
892
+ return stackEventHasErrorMessage(activity.event.ResourceStatus ?? "") ? `
893
+ ${" ".repeat(_CurrentActivityPrinter.TIMESTAMP_WIDTH + _CurrentActivityPrinter.STATUS_WIDTH + 6)}${chalk2.red(this.failureReason(activity) ?? "")}` : "";
894
+ }
895
+ };
896
+ var FULL_BLOCK = "\u2588";
897
+ var PARTIAL_BLOCK = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
898
+ var MAX_PROGRESSBAR_WIDTH = 60;
899
+ var MIN_PROGRESSBAR_WIDTH = 10;
900
+ var PROGRESSBAR_EXTRA_SPACE = 2 + 2 + 4 + 6;
901
+ function colorFromStatusActivity(status) {
902
+ if (!status) {
903
+ return chalk2.reset;
904
+ }
905
+ if (status.endsWith("_FAILED")) {
906
+ return chalk2.red;
907
+ }
908
+ if (status.startsWith("CREATE_") || status.startsWith("UPDATE_") || status.startsWith("IMPORT_")) {
909
+ return chalk2.green;
910
+ }
911
+ if (status.indexOf("ROLLBACK_") !== -1) {
912
+ return chalk2.yellow;
913
+ }
914
+ if (status.startsWith("DELETE_")) {
915
+ return chalk2.yellow;
916
+ }
917
+ return chalk2.reset;
918
+ }
919
+ function shorten(maxWidth, p) {
920
+ if (p.length <= maxWidth) {
921
+ return p;
922
+ }
923
+ const half = Math.floor((maxWidth - 3) / 2);
924
+ return p.slice(0, half) + "..." + p.slice(-half);
925
+ }
926
+
927
+ // ../../aws-cdk/lib/toolkit/cli-io-host.ts
928
+ var levelPriority = {
929
+ error: 0,
930
+ result: 1,
931
+ warn: 2,
932
+ info: 3,
933
+ debug: 4,
934
+ trace: 5
935
+ };
936
+ var CliIoHost = class _CliIoHost {
937
+ constructor(props = {}) {
938
+ this._progress = "bar" /* BAR */;
939
+ // Corked Logging
940
+ this.corkedCounter = 0;
941
+ this.corkedLoggingBuffer = [];
942
+ this._currentAction = props.currentAction ?? "none";
943
+ this._isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
944
+ this._logLevel = props.logLevel ?? "info";
945
+ this._isCI = props.isCI ?? isCI();
946
+ this.stackProgress = props.stackProgress ?? "bar" /* BAR */;
947
+ }
948
+ /**
949
+ * Returns the singleton instance
950
+ */
951
+ static instance(props = {}, forceNew = false) {
952
+ if (forceNew || !_CliIoHost._instance) {
953
+ _CliIoHost._instance = new _CliIoHost(props);
954
+ }
955
+ return _CliIoHost._instance;
956
+ }
957
+ /**
958
+ * Returns the singleton instance
959
+ */
960
+ registerIoHost(ioHost) {
961
+ if (ioHost !== this) {
962
+ this._internalIoHost = ioHost;
963
+ }
964
+ }
965
+ /**
966
+ * Update the stackProgress preference.
967
+ */
968
+ set stackProgress(type) {
969
+ this._progress = type;
970
+ }
971
+ /**
972
+ * Gets the stackProgress value.
973
+ *
974
+ * This takes into account other state of the ioHost,
975
+ * like if isTTY and isCI.
976
+ */
977
+ get stackProgress() {
978
+ if (this._progress === "events" /* EVENTS */) {
979
+ return this._progress;
980
+ }
981
+ const verboseLogging = levelPriority[this.logLevel] > levelPriority.info;
982
+ if (verboseLogging) {
983
+ return "events" /* EVENTS */;
984
+ }
985
+ const isWindows = process.platform === "win32";
986
+ if (isWindows) {
987
+ return "events" /* EVENTS */;
988
+ }
989
+ const fancyOutputAvailable = this.isTTY && !this.isCI;
990
+ if (!fancyOutputAvailable) {
991
+ return "events" /* EVENTS */;
992
+ }
993
+ return this._progress;
994
+ }
995
+ /**
996
+ * The current action being performed by the CLI.
997
+ */
998
+ get currentAction() {
999
+ return this._currentAction;
1000
+ }
1001
+ /**
1002
+ * Sets the current action being performed by the CLI.
1003
+ *
1004
+ * @param action The action being performed by the CLI.
1005
+ */
1006
+ set currentAction(action) {
1007
+ this._currentAction = action;
1008
+ }
1009
+ /**
1010
+ * Whether the host can use interactions and message styling.
1011
+ */
1012
+ get isTTY() {
1013
+ return this._isTTY;
1014
+ }
1015
+ /**
1016
+ * Set TTY mode, i.e can the host use interactions and message styling.
1017
+ *
1018
+ * @param value set TTY mode
1019
+ */
1020
+ set isTTY(value) {
1021
+ this._isTTY = value;
1022
+ }
1023
+ /**
1024
+ * Whether the CliIoHost is running in CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
1025
+ */
1026
+ get isCI() {
1027
+ return this._isCI;
1028
+ }
1029
+ /**
1030
+ * Set the CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
1031
+ * @param value set the CI mode
1032
+ */
1033
+ set isCI(value) {
1034
+ this._isCI = value;
1035
+ }
1036
+ /**
1037
+ * The current threshold. Messages with a lower priority level will be ignored.
1038
+ */
1039
+ get logLevel() {
1040
+ return this._logLevel;
1041
+ }
1042
+ /**
1043
+ * Sets the current threshold. Messages with a lower priority level will be ignored.
1044
+ * @param level The new log level threshold
1045
+ */
1046
+ set logLevel(level) {
1047
+ this._logLevel = level;
1048
+ }
1049
+ /**
1050
+ * Executes a block of code with corked logging. All log messages during execution
1051
+ * are buffered and only written when all nested cork blocks complete (when CORK_COUNTER reaches 0).
1052
+ * The corking is bound to the specific instance of the CliIoHost.
1053
+ *
1054
+ * @param block - Async function to execute with corked logging
1055
+ * @returns Promise that resolves with the block's return value
1056
+ */
1057
+ async withCorkedLogging(block) {
1058
+ this.corkedCounter++;
1059
+ try {
1060
+ return await block();
1061
+ } finally {
1062
+ this.corkedCounter--;
1063
+ if (this.corkedCounter === 0) {
1064
+ for (const ioMessage of this.corkedLoggingBuffer) {
1065
+ await this.notify(ioMessage);
1066
+ }
1067
+ this.corkedLoggingBuffer.splice(0);
1068
+ }
1069
+ }
1070
+ }
1071
+ /**
1072
+ * Notifies the host of a message.
1073
+ * The caller waits until the notification completes.
1074
+ */
1075
+ async notify(msg) {
1076
+ if (this._internalIoHost) {
1077
+ return this._internalIoHost.notify(msg);
1078
+ }
1079
+ if (this.isStackActivity(msg)) {
1080
+ if (!this.activityPrinter) {
1081
+ this.activityPrinter = this.makeActivityPrinter();
1082
+ }
1083
+ await this.activityPrinter.notify(msg);
1084
+ return;
1085
+ }
1086
+ if (levelPriority[msg.level] > levelPriority[this.logLevel]) {
1087
+ return;
1088
+ }
1089
+ if (this.corkedCounter > 0) {
1090
+ this.corkedLoggingBuffer.push(msg);
1091
+ return;
1092
+ }
1093
+ const output = this.formatMessage(msg);
1094
+ const stream = this.selectStream(msg.level);
1095
+ stream.write(output);
1096
+ }
1097
+ /**
1098
+ * Detect stack activity messages so they can be send to the printer.
1099
+ */
1100
+ isStackActivity(msg) {
1101
+ return [
1102
+ "CDK_TOOLKIT_I5501",
1103
+ "CDK_TOOLKIT_I5502",
1104
+ "CDK_TOOLKIT_I5503"
1105
+ ].includes(msg.code);
306
1106
  }
307
1107
  /**
308
1108
  * Determines the output stream, based on message level and configuration.
@@ -342,14 +1142,14 @@ var CliIoHost = class _CliIoHost {
342
1142
  throw new ToolkitError(`${motivation}, but concurrency is greater than 1 so we are unable to get a confirmation from the user`);
343
1143
  }
344
1144
  if (isConfirmationPrompt(msg)) {
345
- const confirmed = await promptly.confirm(`${chalk.cyan(msg.message)} (y/n)`);
1145
+ const confirmed = await promptly.confirm(`${chalk3.cyan(msg.message)} (y/n)`);
346
1146
  if (!confirmed) {
347
1147
  throw new ToolkitError("Aborted by user");
348
1148
  }
349
1149
  return confirmed;
350
1150
  }
351
1151
  const prompt4 = extractPromptInfo(msg);
352
- const answer = await promptly.prompt(`${chalk.cyan(msg.message)} (${prompt4.default})`, {
1152
+ const answer = await promptly.prompt(`${chalk3.cyan(msg.message)} (${prompt4.default})`, {
353
1153
  default: prompt4.default
354
1154
  });
355
1155
  return prompt4.convertAnswer(answer);
@@ -370,6 +1170,20 @@ var CliIoHost = class _CliIoHost {
370
1170
  const pad = (n) => n.toString().padStart(2, "0");
371
1171
  return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
372
1172
  }
1173
+ /**
1174
+ * Get an instance of the ActivityPrinter
1175
+ */
1176
+ makeActivityPrinter() {
1177
+ const props = {
1178
+ stream: this.selectStream("info")
1179
+ };
1180
+ switch (this.stackProgress) {
1181
+ case "events" /* EVENTS */:
1182
+ return new HistoryActivityPrinter(props);
1183
+ case "bar" /* BAR */:
1184
+ return new CurrentActivityPrinter(props);
1185
+ }
1186
+ }
373
1187
  };
374
1188
  function isPromptableRequest(msg) {
375
1189
  return isConfirmationPrompt(msg) || typeof msg.defaultResponse === "string" || typeof msg.defaultResponse === "number";
@@ -380,17 +1194,17 @@ function isConfirmationPrompt(msg) {
380
1194
  function extractPromptInfo(msg) {
381
1195
  const isNumber = typeof msg.defaultResponse === "number";
382
1196
  return {
383
- default: util.format(msg.defaultResponse),
1197
+ default: util3.format(msg.defaultResponse),
384
1198
  convertAnswer: isNumber ? (v) => Number(v) : (v) => String(v)
385
1199
  };
386
1200
  }
387
1201
  var styleMap = {
388
- error: chalk.red,
389
- warn: chalk.yellow,
390
- result: chalk.white,
391
- info: chalk.white,
392
- debug: chalk.gray,
393
- trace: chalk.gray
1202
+ error: chalk3.red,
1203
+ warn: chalk3.yellow,
1204
+ result: chalk3.white,
1205
+ info: chalk3.white,
1206
+ debug: chalk3.gray,
1207
+ trace: chalk3.gray
394
1208
  };
395
1209
  function isCI() {
396
1210
  return process.env.CI !== void 0 && process.env.CI !== "false" && process.env.CI !== "0";
@@ -399,7 +1213,7 @@ function isCI() {
399
1213
  // ../../aws-cdk/lib/logging.ts
400
1214
  function formatMessageAndLog(level, input, style, ...args) {
401
1215
  const { message, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
402
- const formattedMessage = args.length > 0 ? util2.format(message, ...args) : message;
1216
+ const formattedMessage = args.length > 0 ? util4.format(message, ...args) : message;
403
1217
  const finalMessage = style ? style(formattedMessage) : formattedMessage;
404
1218
  const ioHost = CliIoHost.instance();
405
1219
  const ioMessage = {
@@ -432,11 +1246,11 @@ var trace = (input, ...args) => {
432
1246
  };
433
1247
 
434
1248
  // ../../aws-cdk/lib/util/directories.ts
435
- var fs = __toESM(require("fs"));
1249
+ var fs2 = __toESM(require("fs"));
436
1250
  var os = __toESM(require("os"));
437
1251
  var path = __toESM(require("path"));
438
1252
  function cdkHomeDir() {
439
- const tmpDir = fs.realpathSync(os.tmpdir());
1253
+ const tmpDir = fs2.realpathSync(os.tmpdir());
440
1254
  let home;
441
1255
  try {
442
1256
  let userInfoHome = os.userInfo().homedir;
@@ -446,7 +1260,7 @@ function cdkHomeDir() {
446
1260
  home = path.join((userInfoHome ?? os.homedir()).trim(), ".cdk");
447
1261
  } catch {
448
1262
  }
449
- return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home || fs.mkdtempSync(path.join(tmpDir, ".cdk")).trim();
1263
+ return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home || fs2.mkdtempSync(path.join(tmpDir, ".cdk")).trim();
450
1264
  }
451
1265
  function cdkCacheDir() {
452
1266
  return path.join(cdkHomeDir(), "cache");
@@ -454,7 +1268,7 @@ function cdkCacheDir() {
454
1268
  function rootDir(fail) {
455
1269
  function _rootDir(dirname5) {
456
1270
  const manifestPath = path.join(dirname5, "package.json");
457
- if (fs.existsSync(manifestPath)) {
1271
+ if (fs2.existsSync(manifestPath)) {
458
1272
  return dirname5;
459
1273
  }
460
1274
  if (path.dirname(dirname5) === dirname5) {
@@ -521,7 +1335,7 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
521
1335
  }
522
1336
  async loadMap() {
523
1337
  try {
524
- return await fs2.readJson(this.cacheFile);
1338
+ return await fs3.readJson(this.cacheFile);
525
1339
  } catch (e) {
526
1340
  if (e.code === "ENOENT" || e.code === "EACCES") {
527
1341
  return {};
@@ -534,8 +1348,8 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
534
1348
  }
535
1349
  async saveMap(map) {
536
1350
  try {
537
- await fs2.ensureFile(this.cacheFile);
538
- await fs2.writeJson(this.cacheFile, map, { spaces: 2 });
1351
+ await fs3.ensureFile(this.cacheFile);
1352
+ await fs3.writeJson(this.cacheFile, map, { spaces: 2 });
539
1353
  } catch (e) {
540
1354
  if (e.code === "ENOENT" || e.code === "EACCES" || e.code === "EROFS") {
541
1355
  return;
@@ -604,13 +1418,13 @@ function traceMemberMethods(constructor) {
604
1418
  var path3 = __toESM(require("path"));
605
1419
 
606
1420
  // ../../aws-cdk/lib/api/aws-auth/util.ts
607
- var fs3 = __toESM(require("fs-extra"));
1421
+ var fs4 = __toESM(require("fs-extra"));
608
1422
  function readIfPossible(filename) {
609
1423
  try {
610
- if (!fs3.pathExistsSync(filename)) {
1424
+ if (!fs4.pathExistsSync(filename)) {
611
1425
  return void 0;
612
1426
  }
613
- return fs3.readFileSync(filename, { encoding: "utf-8" });
1427
+ return fs4.readFileSync(filename, { encoding: "utf-8" });
614
1428
  } catch (e) {
615
1429
  debug(e);
616
1430
  return void 0;
@@ -618,21 +1432,12 @@ function readIfPossible(filename) {
618
1432
  }
619
1433
 
620
1434
  // ../../aws-cdk/lib/api/aws-auth/user-agent.ts
621
- function defaultCliUserAgent() {
622
- const root = rootDir(false);
623
- const pkg = JSON.parse((root ? readIfPossible(path3.join(root, "package.json")) : void 0) ?? "{}");
624
- const name = pkg.name ?? path3.basename(process.argv[1] ?? "cdk-cli");
625
- const version = pkg.version ?? "<unknown>";
626
- return `${name}/${version}`;
627
- }
628
-
629
- // ../../aws-cdk/lib/util/format-error.ts
630
- function formatErrorMessage(error3) {
631
- if (error3 && Array.isArray(error3.errors)) {
632
- const innerMessages = error3.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
633
- return `AggregateError: ${innerMessages}`;
634
- }
635
- return error3?.message || error3?.toString() || "Unknown error";
1435
+ function defaultCliUserAgent() {
1436
+ const root = rootDir(false);
1437
+ const pkg = JSON.parse((root ? readIfPossible(path3.join(root, "package.json")) : void 0) ?? "{}");
1438
+ const name = pkg.name ?? path3.basename(process.argv[1] ?? "cdk-cli");
1439
+ const version = pkg.version ?? "<unknown>";
1440
+ return `${name}/${version}`;
636
1441
  }
637
1442
 
638
1443
  // ../../aws-cdk/lib/api/aws-auth/sdk.ts
@@ -1150,11 +1955,11 @@ async function tokenCodeFn(serialArn) {
1150
1955
  }
1151
1956
 
1152
1957
  // ../../aws-cdk/lib/api/aws-auth/credential-plugins.ts
1153
- var import_util4 = require("util");
1958
+ var import_util7 = require("util");
1154
1959
 
1155
1960
  // ../../aws-cdk/lib/api/plugin/plugin.ts
1156
- var import_util3 = require("util");
1157
- var chalk3 = __toESM(require("chalk"));
1961
+ var import_util6 = require("util");
1962
+ var chalk5 = __toESM(require("chalk"));
1158
1963
 
1159
1964
  // ../../aws-cdk/lib/api/plugin/context-provider-plugin.ts
1160
1965
  function isContextProviderPlugin(x) {
@@ -1187,14 +1992,14 @@ var PluginHost = class _PluginHost {
1187
1992
  try {
1188
1993
  const plugin = require(moduleSpec);
1189
1994
  if (!isPlugin(plugin)) {
1190
- error(`Module ${chalk3.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
1995
+ error(`Module ${chalk5.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
1191
1996
  throw new ToolkitError(`Module ${moduleSpec} does not define a valid plug-in.`);
1192
1997
  }
1193
1998
  if (plugin.init) {
1194
1999
  plugin.init(this);
1195
2000
  }
1196
2001
  } catch (e) {
1197
- error(`Unable to load ${chalk3.green(moduleSpec)}: ${e.stack}`);
2002
+ error(`Unable to load ${chalk5.green(moduleSpec)}: ${e.stack}`);
1198
2003
  throw new ToolkitError(`Unable to load plug-in: ${moduleSpec}: ${e}`);
1199
2004
  }
1200
2005
  function isPlugin(x) {
@@ -1243,7 +2048,7 @@ var PluginHost = class _PluginHost {
1243
2048
  */
1244
2049
  registerContextProviderAlpha(pluginProviderName, provider) {
1245
2050
  if (!isContextProviderPlugin(provider)) {
1246
- throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util3.inspect)(provider)}`);
2051
+ throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util6.inspect)(provider)}`);
1247
2052
  }
1248
2053
  this.contextProviderPlugins[pluginProviderName] = provider;
1249
2054
  }
@@ -1312,7 +2117,7 @@ async function v3ProviderFromPlugin(producer) {
1312
2117
  } else if (isV2Credentials(initial)) {
1313
2118
  return v3ProviderFromV2Credentials(initial);
1314
2119
  } else {
1315
- throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util4.inspect)(initial)}`);
2120
+ throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util7.inspect)(initial)}`);
1316
2121
  }
1317
2122
  }
1318
2123
  function v3ProviderFromV2Credentials(x) {
@@ -1331,7 +2136,7 @@ function refreshFromPluginProvider(current, producer) {
1331
2136
  if (credentialsAboutToExpire(current)) {
1332
2137
  const newCreds = await producer();
1333
2138
  if (!isV3Credentials(newCreds)) {
1334
- throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util4.inspect)(newCreds)}`);
2139
+ throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util7.inspect)(newCreds)}`);
1335
2140
  }
1336
2141
  current = newCreds;
1337
2142
  }
@@ -1600,291 +2405,65 @@ function fmtObtainedCredentials(obtainResult) {
1600
2405
  return `credentials returned by plugin '${obtainResult.pluginName}'`;
1601
2406
  case "incorrectDefault":
1602
2407
  const msg = [];
1603
- msg.push(`current credentials (which are for account ${obtainResult.accountId}`);
1604
- if (obtainResult.unusedPlugins.length > 0) {
1605
- msg.push(`, and none of the following plugins provided credentials: ${obtainResult.unusedPlugins.join(", ")}`);
1606
- }
1607
- msg.push(")");
1608
- return msg.join("");
1609
- }
1610
- }
1611
- async function initContextProviderSdk(aws, options) {
1612
- const account = options.account;
1613
- const region = options.region;
1614
- const creds = {
1615
- assumeRoleArn: options.lookupRoleArn,
1616
- assumeRoleExternalId: options.lookupRoleExternalId,
1617
- assumeRoleAdditionalOptions: options.assumeRoleAdditionalOptions
1618
- };
1619
- return (await aws.forEnvironment(import_cx_api.EnvironmentUtils.make(account, region), 0 /* ForReading */, creds)).sdk;
1620
- }
1621
-
1622
- // ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
1623
- var import_util5 = require("util");
1624
-
1625
- // ../../aws-cdk/lib/util/serialize.ts
1626
- var fs4 = __toESM(require("fs-extra"));
1627
-
1628
- // ../../aws-cdk/lib/util/bytes.ts
1629
- function formatBytes(bytes, decimals = 2) {
1630
- decimals = decimals < 0 ? 0 : decimals;
1631
- if (bytes === 0) {
1632
- return "0 Bytes";
1633
- }
1634
- const k = 1024;
1635
- const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
1636
- const i = Math.floor(Math.log(bytes) / Math.log(k));
1637
- return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
1638
- }
1639
-
1640
- // ../../aws-cdk/lib/util/yaml-cfn.ts
1641
- var yaml = __toESM(require("yaml"));
1642
- var yaml_types = __toESM(require("yaml/types"));
1643
- function serialize(obj) {
1644
- const oldFold = yaml_types.strOptions.fold.lineWidth;
1645
- try {
1646
- yaml_types.strOptions.fold.lineWidth = 0;
1647
- return yaml.stringify(obj, { schema: "yaml-1.1" });
1648
- } finally {
1649
- yaml_types.strOptions.fold.lineWidth = oldFold;
1650
- }
1651
- }
1652
- function deserialize(str) {
1653
- return parseYamlStrWithCfnTags(str);
1654
- }
1655
- function makeTagForCfnIntrinsic(intrinsicName, addFnPrefix) {
1656
- return {
1657
- identify(value) {
1658
- return typeof value === "string";
1659
- },
1660
- tag: `!${intrinsicName}`,
1661
- resolve: (_doc, cstNode) => {
1662
- const ret = {};
1663
- ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = // the +1 is to account for the ! the short form begins with
1664
- parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1));
1665
- return ret;
1666
- }
1667
- };
1668
- }
1669
- var shortForms = [
1670
- "Base64",
1671
- "Cidr",
1672
- "FindInMap",
1673
- "GetAZs",
1674
- "ImportValue",
1675
- "Join",
1676
- "Sub",
1677
- "Select",
1678
- "Split",
1679
- "Transform",
1680
- "And",
1681
- "Equals",
1682
- "If",
1683
- "Not",
1684
- "Or",
1685
- "GetAtt"
1686
- ].map((name) => makeTagForCfnIntrinsic(name, true)).concat(
1687
- makeTagForCfnIntrinsic("Ref", false),
1688
- makeTagForCfnIntrinsic("Condition", false)
1689
- );
1690
- function parseYamlStrWithCfnTags(text) {
1691
- return yaml.parse(text, {
1692
- customTags: shortForms,
1693
- schema: "core"
1694
- });
1695
- }
1696
-
1697
- // ../../aws-cdk/lib/util/serialize.ts
1698
- function toYAML(obj) {
1699
- return serialize(obj);
1700
- }
1701
- function deserializeStructure(str) {
1702
- return deserialize(str);
1703
- }
1704
- function serializeStructure(object, json) {
1705
- if (json) {
1706
- return JSON.stringify(object, void 0, 2);
1707
- } else {
1708
- return toYAML(object);
1709
- }
1710
- }
1711
- function obscureTemplate(template = {}) {
1712
- if (template.Rules) {
1713
- if (template.Rules.CheckBootstrapVersion) {
1714
- if (Object.keys(template.Rules).length > 1) {
1715
- delete template.Rules.CheckBootstrapVersion;
1716
- } else {
1717
- delete template.Rules;
1718
- }
1719
- }
1720
- }
1721
- return template;
1722
- }
1723
- function isJsonBuffer(value) {
1724
- return typeof value === "object" && "type" in value && value.type === "Buffer" && "data" in value && Array.isArray(value.data);
1725
- }
1726
- function replacerBufferWithInfo(_key, value) {
1727
- if (isJsonBuffer(value)) {
1728
- return `<Buffer: ${formatBytes(value.data.length)}>`;
1729
- }
1730
- return value;
1731
- }
1732
-
1733
- // ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
1734
- function formatSdkLoggerContent(content) {
1735
- if (content.length === 1) {
1736
- const apiFmt = formatApiCall(content[0]);
1737
- if (apiFmt) {
1738
- return apiFmt;
1739
- }
1740
- }
1741
- return content.map((x) => typeof x === "string" ? x : (0, import_util5.inspect)(x)).join("");
1742
- }
1743
- function formatApiCall(content) {
1744
- if (!isSdkApiCallSuccess(content) && !isSdkApiCallError(content)) {
1745
- return void 0;
1746
- }
1747
- const service = content.clientName.replace(/Client$/, "");
1748
- const api = content.commandName.replace(/Command$/, "");
1749
- const parts = [];
1750
- if ((content.metadata?.attempts ?? 0) > 1) {
1751
- parts.push(`[${content.metadata?.attempts} attempts, ${content.metadata?.totalRetryDelay}ms retry]`);
1752
- }
1753
- parts.push(`${service}.${api}(${JSON.stringify(content.input, replacerBufferWithInfo)})`);
1754
- if (isSdkApiCallSuccess(content)) {
1755
- parts.push("-> OK");
1756
- } else {
1757
- parts.push(`-> ${content.error}`);
1758
- }
1759
- return parts.join(" ");
1760
- }
1761
- function isSdkApiCallSuccess(x) {
1762
- return x && typeof x === "object" && x.commandName && x.output;
1763
- }
1764
- function isSdkApiCallError(x) {
1765
- return x && typeof x === "object" && x.commandName && x.error;
1766
- }
1767
-
1768
- // ../../aws-cdk/lib/api/settings.ts
1769
- var os3 = __toESM(require("os"));
1770
- var fs_path = __toESM(require("path"));
1771
- var fs5 = __toESM(require("fs-extra"));
1772
-
1773
- // ../../aws-cdk/lib/util/types.ts
1774
- function isObject(x) {
1775
- return x !== null && typeof x === "object" && !isArray(x);
1776
- }
1777
- var isArray = Array.isArray;
1778
-
1779
- // ../../aws-cdk/lib/util/objects.ts
1780
- function deepClone(x) {
1781
- if (typeof x === "undefined") {
1782
- return void 0;
1783
- }
1784
- if (x === null) {
1785
- return null;
1786
- }
1787
- if (isArray(x)) {
1788
- return x.map(deepClone);
1789
- }
1790
- if (isObject(x)) {
1791
- return makeObject(mapObject(x, (k, v) => [k, deepClone(v)]));
1792
- }
1793
- return x;
1794
- }
1795
- function mapObject(x, fn) {
1796
- const ret = [];
1797
- Object.keys(x).forEach((key) => {
1798
- ret.push(fn(key, x[key]));
1799
- });
1800
- return ret;
1801
- }
1802
- function makeObject(pairs) {
1803
- const ret = {};
1804
- for (const pair of pairs) {
1805
- ret[pair[0]] = pair[1];
1806
- }
1807
- return ret;
1808
- }
1809
- function deepGet(x, path12) {
1810
- path12 = path12.slice();
1811
- while (path12.length > 0 && isObject(x)) {
1812
- const key = path12.shift();
1813
- x = x[key];
1814
- }
1815
- return path12.length === 0 ? x : void 0;
1816
- }
1817
- function deepSet(x, path12, value) {
1818
- path12 = path12.slice();
1819
- if (path12.length === 0) {
1820
- throw new ToolkitError("Path may not be empty");
1821
- }
1822
- while (path12.length > 1 && isObject(x)) {
1823
- const key = path12.shift();
1824
- if (!(key in x)) {
1825
- x[key] = {};
1826
- }
1827
- x = x[key];
1828
- }
1829
- if (!isObject(x)) {
1830
- throw new ToolkitError(`Expected an object, got '${x}'`);
1831
- }
1832
- if (value !== void 0) {
1833
- x[path12[0]] = value;
1834
- } else {
1835
- delete x[path12[0]];
1836
- }
1837
- }
1838
- function deepMerge(...objects) {
1839
- function mergeOne(target, source) {
1840
- for (const key of Object.keys(source)) {
1841
- if (key === "__proto__" || key === "constructor") {
1842
- continue;
1843
- }
1844
- const value = source[key];
1845
- if (isObject(value)) {
1846
- if (!isObject(target[key])) {
1847
- target[key] = {};
1848
- }
1849
- mergeOne(target[key], value);
1850
- } else if (typeof value !== "undefined") {
1851
- target[key] = value;
2408
+ msg.push(`current credentials (which are for account ${obtainResult.accountId}`);
2409
+ if (obtainResult.unusedPlugins.length > 0) {
2410
+ msg.push(`, and none of the following plugins provided credentials: ${obtainResult.unusedPlugins.join(", ")}`);
1852
2411
  }
1853
- }
1854
- }
1855
- const others = objects.filter((x) => x != null);
1856
- if (others.length === 0) {
1857
- return {};
2412
+ msg.push(")");
2413
+ return msg.join("");
1858
2414
  }
1859
- const into = others.splice(0, 1)[0];
1860
- others.forEach((other) => mergeOne(into, other));
1861
- return into;
1862
2415
  }
1863
- function splitBySize(data, maxSizeBytes) {
1864
- if (maxSizeBytes < 2) {
1865
- return [void 0, data];
1866
- }
1867
- const entries = Object.entries(data);
1868
- return recurse(0, 0);
1869
- function recurse(index, runningTotalSize) {
1870
- if (index >= entries.length) {
1871
- return [data, void 0];
2416
+ async function initContextProviderSdk(aws, options) {
2417
+ const account = options.account;
2418
+ const region = options.region;
2419
+ const creds = {
2420
+ assumeRoleArn: options.lookupRoleArn,
2421
+ assumeRoleExternalId: options.lookupRoleExternalId,
2422
+ assumeRoleAdditionalOptions: options.assumeRoleAdditionalOptions
2423
+ };
2424
+ return (await aws.forEnvironment(import_cx_api.EnvironmentUtils.make(account, region), 0 /* ForReading */, creds)).sdk;
2425
+ }
2426
+
2427
+ // ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
2428
+ var import_util8 = require("util");
2429
+ function formatSdkLoggerContent(content) {
2430
+ if (content.length === 1) {
2431
+ const apiFmt = formatApiCall(content[0]);
2432
+ if (apiFmt) {
2433
+ return apiFmt;
1872
2434
  }
1873
- const size = runningTotalSize + entrySize(entries[index]);
1874
- return size > maxSizeBytes ? cutAt(index) : recurse(index + 1, size);
1875
2435
  }
1876
- function entrySize(entry) {
1877
- return Buffer.byteLength(JSON.stringify(Object.fromEntries([entry])));
2436
+ return content.map((x) => typeof x === "string" ? x : (0, import_util8.inspect)(x)).join("");
2437
+ }
2438
+ function formatApiCall(content) {
2439
+ if (!isSdkApiCallSuccess(content) && !isSdkApiCallError(content)) {
2440
+ return void 0;
1878
2441
  }
1879
- function cutAt(index) {
1880
- return [
1881
- Object.fromEntries(entries.slice(0, index)),
1882
- Object.fromEntries(entries.slice(index))
1883
- ];
2442
+ const service = content.clientName.replace(/Client$/, "");
2443
+ const api = content.commandName.replace(/Command$/, "");
2444
+ const parts = [];
2445
+ if ((content.metadata?.attempts ?? 0) > 1) {
2446
+ parts.push(`[${content.metadata?.attempts} attempts, ${content.metadata?.totalRetryDelay}ms retry]`);
2447
+ }
2448
+ parts.push(`${service}.${api}(${JSON.stringify(content.input, replacerBufferWithInfo)})`);
2449
+ if (isSdkApiCallSuccess(content)) {
2450
+ parts.push("-> OK");
2451
+ } else {
2452
+ parts.push(`-> ${content.error}`);
1884
2453
  }
2454
+ return parts.join(" ");
2455
+ }
2456
+ function isSdkApiCallSuccess(x) {
2457
+ return x && typeof x === "object" && x.commandName && x.output;
2458
+ }
2459
+ function isSdkApiCallError(x) {
2460
+ return x && typeof x === "object" && x.commandName && x.error;
1885
2461
  }
1886
2462
 
1887
2463
  // ../../aws-cdk/lib/api/settings.ts
2464
+ var os3 = __toESM(require("os"));
2465
+ var fs_path = __toESM(require("path"));
2466
+ var fs5 = __toESM(require("fs-extra"));
1888
2467
  var TRANSIENT_CONTEXT_KEY = "$dontSaveContext";
1889
2468
  var Settings = class _Settings {
1890
2469
  constructor(settings = {}, readOnly = false) {
@@ -2069,7 +2648,7 @@ var Context = class {
2069
2648
  };
2070
2649
 
2071
2650
  // ../../aws-cdk/lib/api/deployments/cloudformation.ts
2072
- var import_util6 = require("util");
2651
+ var import_util10 = require("util");
2073
2652
  var cxapi = __toESM(require("@aws-cdk/cx-api"));
2074
2653
  var import_cx_api3 = require("@aws-cdk/cx-api");
2075
2654
  var import_client_cloudformation3 = require("@aws-sdk/client-cloudformation");
@@ -2169,9 +2748,9 @@ var trace2 = (action, message, code, payload) => {
2169
2748
  };
2170
2749
 
2171
2750
  // ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
2172
- var util3 = __toESM(require("util"));
2751
+ var util6 = __toESM(require("util"));
2173
2752
  var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
2174
- var chalk4 = __toESM(require("chalk"));
2753
+ var uuid = __toESM(require("uuid"));
2175
2754
 
2176
2755
  // ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
2177
2756
  var StackEventPoller = class _StackEventPoller {
@@ -2257,254 +2836,36 @@ var StackEventPoller = class _StackEventPoller {
2257
2836
  */
2258
2837
  trackNestedStack(event, parentStackLogicalIds) {
2259
2838
  const logicalId = event.LogicalResourceId;
2260
- const physicalResourceId = event.PhysicalResourceId;
2261
- if (!logicalId || !physicalResourceId) {
2262
- return;
2263
- }
2264
- if (!this.nestedStackPollers[logicalId]) {
2265
- this.nestedStackPollers[logicalId] = new _StackEventPoller(this.cfn, {
2266
- stackName: physicalResourceId,
2267
- parentStackLogicalIds,
2268
- startTime: event.Timestamp.valueOf()
2269
- });
2270
- }
2271
- }
2272
- };
2273
- function isStackBeginOperationState(state) {
2274
- return [
2275
- "CREATE_IN_PROGRESS",
2276
- "UPDATE_IN_PROGRESS",
2277
- "DELETE_IN_PROGRESS",
2278
- "UPDATE_ROLLBACK_IN_PROGRESS",
2279
- "ROLLBACK_IN_PROGRESS"
2280
- ].includes(state ?? "");
2281
- }
2282
- function isStackTerminalState(state) {
2283
- return !(state ?? "").endsWith("_IN_PROGRESS");
2284
- }
2285
-
2286
- // ../../aws-cdk/lib/api/stack-events/display.ts
2287
- var wrapAnsi = require("wrap-ansi");
2288
- var RewritableBlock = class {
2289
- constructor(stream) {
2290
- this.stream = stream;
2291
- this.lastHeight = 0;
2292
- this.trailingEmptyLines = 0;
2293
- }
2294
- get width() {
2295
- return this.stream.columns;
2296
- }
2297
- get height() {
2298
- return this.stream.rows;
2299
- }
2300
- displayLines(lines) {
2301
- lines = terminalWrap(this.width, expandNewlines(lines));
2302
- lines = lines.slice(0, getMaxBlockHeight(this.height, this.lastHeight, lines));
2303
- this.stream.write(cursorUp(this.lastHeight));
2304
- for (const line of lines) {
2305
- this.stream.write(cll() + line + "\n");
2306
- }
2307
- this.trailingEmptyLines = Math.max(0, this.lastHeight - lines.length);
2308
- for (let i = 0; i < this.trailingEmptyLines; i++) {
2309
- this.stream.write(cll() + "\n");
2310
- }
2311
- this.lastHeight = Math.max(this.lastHeight, lines.length);
2312
- }
2313
- removeEmptyLines() {
2314
- this.stream.write(cursorUp(this.trailingEmptyLines));
2315
- }
2316
- };
2317
- var ESC = "\x1B";
2318
- function cursorUp(n) {
2319
- n = typeof n === "number" ? n : 1;
2320
- return n > 0 ? ESC + "[" + n + "A" : "";
2321
- }
2322
- function cll() {
2323
- return ESC + "[K";
2324
- }
2325
- function terminalWrap(width, lines) {
2326
- if (width === void 0) {
2327
- return lines;
2328
- }
2329
- return lines.flatMap((line) => wrapAnsi(line, width - 1, {
2330
- hard: true,
2331
- trim: true,
2332
- wordWrap: false
2333
- }).split("\n"));
2334
- }
2335
- function expandNewlines(lines) {
2336
- return lines.flatMap((line) => line.split("\n"));
2337
- }
2338
- function getMaxBlockHeight(windowHeight, lastHeight, lines) {
2339
- if (windowHeight === void 0) {
2340
- return Math.max(lines.length, lastHeight);
2341
- }
2342
- return lines.length < windowHeight ? lines.length : windowHeight - 1;
2343
- }
2344
-
2345
- // ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
2346
- var StackActivityProgress = /* @__PURE__ */ ((StackActivityProgress3) => {
2347
- StackActivityProgress3["BAR"] = "bar";
2348
- StackActivityProgress3["EVENTS"] = "events";
2349
- return StackActivityProgress3;
2350
- })(StackActivityProgress || {});
2351
- var StackActivityMonitor = class _StackActivityMonitor {
2352
- constructor(cfn, stackName, printer, stack, changeSetCreationTime) {
2353
- this.stackName = stackName;
2354
- this.printer = printer;
2355
- this.stack = stack;
2356
- this.errors = [];
2357
- this.active = false;
2358
- this.poller = new StackEventPoller(cfn, {
2359
- stackName,
2360
- startTime: changeSetCreationTime?.getTime() ?? Date.now()
2361
- });
2362
- }
2363
- /**
2364
- * Create a Stack Activity Monitor using a default printer, based on context clues
2365
- */
2366
- static withDefaultPrinter(cfn, stackName, stackArtifact, options = {}) {
2367
- const stream = options.ci ? process.stdout : process.stderr;
2368
- const props = {
2369
- resourceTypeColumnWidth: calcMaxResourceTypeLength(stackArtifact.template),
2370
- resourcesTotal: options.resourcesTotal,
2371
- stream
2372
- };
2373
- const isWindows = process.platform === "win32";
2374
- const verbose = options.logLevel ?? "info";
2375
- const fancyOutputAvailable = !isWindows && stream.isTTY && !options.ci;
2376
- const progress = options.progress ?? "bar" /* BAR */;
2377
- const printer = fancyOutputAvailable && !verbose && progress === "bar" /* BAR */ ? new CurrentActivityPrinter(props) : new HistoryActivityPrinter(props);
2378
- return new _StackActivityMonitor(cfn, stackName, printer, stackArtifact, options.changeSetCreationTime);
2379
- }
2380
- start() {
2381
- this.active = true;
2382
- this.printer.start();
2383
- this.scheduleNextTick();
2384
- return this;
2385
- }
2386
- async stop() {
2387
- this.active = false;
2388
- if (this.tickTimer) {
2389
- clearTimeout(this.tickTimer);
2390
- }
2391
- await this.finalPollToEnd();
2392
- this.printer.stop();
2393
- }
2394
- scheduleNextTick() {
2395
- if (!this.active) {
2396
- return;
2397
- }
2398
- this.tickTimer = setTimeout(() => void this.tick(), this.printer.updateSleep);
2399
- }
2400
- async tick() {
2401
- if (!this.active) {
2402
- return;
2403
- }
2404
- try {
2405
- this.readPromise = this.readNewEvents();
2406
- await this.readPromise;
2407
- this.readPromise = void 0;
2408
- if (!this.active) {
2409
- return;
2410
- }
2411
- this.printer.print();
2412
- } catch (e) {
2413
- error("Error occurred while monitoring stack: %s", e);
2414
- }
2415
- this.scheduleNextTick();
2416
- }
2417
- findMetadataFor(logicalId) {
2418
- const metadata = this.stack?.manifest?.metadata;
2419
- if (!logicalId || !metadata) {
2420
- return void 0;
2421
- }
2422
- for (const path12 of Object.keys(metadata)) {
2423
- const entry = metadata[path12].filter((e) => e.type === import_cloud_assembly_schema.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
2424
- if (entry) {
2425
- return {
2426
- entry,
2427
- constructPath: this.simplifyConstructPath(path12)
2428
- };
2429
- }
2430
- }
2431
- return void 0;
2432
- }
2433
- /**
2434
- * Reads all new events from the stack history
2435
- *
2436
- * The events are returned in reverse chronological order; we continue to the next page if we
2437
- * see a next page and the last event in the page is new to us (and within the time window).
2438
- * haven't seen the final event
2439
- */
2440
- async readNewEvents() {
2441
- const pollEvents = await this.poller.poll();
2442
- const activities = pollEvents.map((event) => ({
2443
- ...event,
2444
- metadata: this.findMetadataFor(event.event.LogicalResourceId)
2445
- }));
2446
- for (const activity of activities) {
2447
- this.checkForErrors(activity);
2448
- this.printer.addActivity(activity);
2449
- }
2450
- }
2451
- /**
2452
- * Perform a final poll to the end and flush out all events to the printer
2453
- *
2454
- * Finish any poll currently in progress, then do a final one until we've
2455
- * reached the last page.
2456
- */
2457
- async finalPollToEnd() {
2458
- if (this.readPromise) {
2459
- await this.readPromise;
2460
- }
2461
- await this.readNewEvents();
2462
- }
2463
- checkForErrors(activity) {
2464
- if (hasErrorMessage(activity.event.ResourceStatus ?? "")) {
2465
- const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
2466
- if (!isCancelled && activity.event.StackName !== activity.event.LogicalResourceId) {
2467
- this.errors.push(activity.event.ResourceStatusReason ?? "");
2468
- }
2469
- }
2470
- }
2471
- simplifyConstructPath(path12) {
2472
- path12 = path12.replace(/\/Resource$/, "");
2473
- path12 = path12.replace(/^\//, "");
2474
- if (path12.startsWith(this.stackName + "/")) {
2475
- path12 = path12.slice(this.stackName.length + 1);
2839
+ const physicalResourceId = event.PhysicalResourceId;
2840
+ if (!logicalId || !physicalResourceId) {
2841
+ return;
2842
+ }
2843
+ if (!this.nestedStackPollers[logicalId]) {
2844
+ this.nestedStackPollers[logicalId] = new _StackEventPoller(this.cfn, {
2845
+ stackName: physicalResourceId,
2846
+ parentStackLogicalIds,
2847
+ startTime: event.Timestamp.valueOf()
2848
+ });
2476
2849
  }
2477
- return path12;
2478
2850
  }
2479
2851
  };
2480
- function padRight(n, x) {
2481
- return x + " ".repeat(Math.max(0, n - x.length));
2482
- }
2483
- function padLeft(n, x) {
2484
- return " ".repeat(Math.max(0, n - x.length)) + x;
2852
+ function isStackBeginOperationState(state) {
2853
+ return [
2854
+ "CREATE_IN_PROGRESS",
2855
+ "UPDATE_IN_PROGRESS",
2856
+ "DELETE_IN_PROGRESS",
2857
+ "UPDATE_ROLLBACK_IN_PROGRESS",
2858
+ "ROLLBACK_IN_PROGRESS"
2859
+ ].includes(state ?? "");
2485
2860
  }
2486
- function calcMaxResourceTypeLength(template) {
2487
- const resources = template && template.Resources || {};
2488
- let maxWidth = 0;
2489
- for (const id of Object.keys(resources)) {
2490
- const type = resources[id].Type || "";
2491
- if (type.length > maxWidth) {
2492
- maxWidth = type.length;
2493
- }
2494
- }
2495
- return maxWidth;
2861
+ function isStackTerminalState(state) {
2862
+ return !(state ?? "").endsWith("_IN_PROGRESS");
2496
2863
  }
2497
- var ActivityPrinterBase = class {
2498
- constructor(props) {
2499
- this.props = props;
2500
- /**
2501
- * Fetch new activity every 5 seconds
2502
- */
2503
- this.updateSleep = 5e3;
2504
- /**
2505
- * A list of resource IDs which are currently being processed
2506
- */
2507
- this.resourcesInProgress = {};
2864
+
2865
+ // ../../aws-cdk/lib/api/stack-events/stack-progress-monitor.ts
2866
+ var util5 = __toESM(require("util"));
2867
+ var StackProgressMonitor = class {
2868
+ constructor(resourcesTotal) {
2508
2869
  /**
2509
2870
  * Previous completion state observed by logical ID
2510
2871
  *
@@ -2521,319 +2882,234 @@ var ActivityPrinterBase = class {
2521
2882
  * How many digits we need to represent the total count (for lining up the status reporting)
2522
2883
  */
2523
2884
  this.resourceDigits = 0;
2524
- this.rollingBack = false;
2525
- this.failures = new Array();
2526
- this.hookFailureMap = /* @__PURE__ */ new Map();
2527
- this.resourcesTotal = props.resourcesTotal ? props.resourcesTotal + 1 : void 0;
2885
+ this.resourcesTotal = resourcesTotal ? resourcesTotal + 1 : void 0;
2528
2886
  this.resourceDigits = this.resourcesTotal ? Math.ceil(Math.log10(this.resourcesTotal)) : 0;
2529
2887
  }
2530
- failureReason(activity) {
2531
- const resourceStatusReason = activity.event.ResourceStatusReason ?? "";
2532
- const logicalResourceId = activity.event.LogicalResourceId ?? "";
2533
- const hookFailureReasonMap = this.hookFailureMap.get(logicalResourceId);
2534
- if (hookFailureReasonMap !== void 0) {
2535
- for (const hookType of hookFailureReasonMap.keys()) {
2536
- if (resourceStatusReason.includes(hookType)) {
2537
- return resourceStatusReason + " : " + hookFailureReasonMap.get(hookType);
2538
- }
2539
- }
2540
- }
2541
- return resourceStatusReason;
2542
- }
2543
- addActivity(activity) {
2544
- const status = activity.event.ResourceStatus;
2545
- const hookStatus = activity.event.HookStatus;
2546
- const hookType = activity.event.HookType;
2547
- if (!status || !activity.event.LogicalResourceId) {
2548
- return;
2549
- }
2550
- if (status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS") {
2551
- this.rollingBack = true;
2552
- }
2553
- if (status.endsWith("_IN_PROGRESS")) {
2554
- this.resourcesInProgress[activity.event.LogicalResourceId] = activity;
2555
- }
2556
- if (hasErrorMessage(status)) {
2557
- const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
2558
- if (!isCancelled) {
2559
- this.failures.push(activity);
2560
- }
2561
- }
2562
- if (status.endsWith("_COMPLETE") || status.endsWith("_FAILED")) {
2563
- delete this.resourcesInProgress[activity.event.LogicalResourceId];
2564
- }
2565
- if (status.endsWith("_COMPLETE_CLEANUP_IN_PROGRESS")) {
2566
- this.resourcesDone++;
2567
- }
2568
- if (status.endsWith("_COMPLETE")) {
2569
- const prevState = this.resourcesPrevCompleteState[activity.event.LogicalResourceId];
2570
- if (!prevState) {
2571
- this.resourcesDone++;
2572
- } else {
2573
- this.resourcesDone--;
2574
- if (this.resourcesDone < 0) {
2575
- this.resourcesDone = 0;
2576
- }
2577
- }
2578
- this.resourcesPrevCompleteState[activity.event.LogicalResourceId] = status;
2579
- }
2580
- if (hookStatus !== void 0 && hookStatus.endsWith("_COMPLETE_FAILED") && activity.event.LogicalResourceId !== void 0 && hookType !== void 0) {
2581
- if (this.hookFailureMap.has(activity.event.LogicalResourceId)) {
2582
- this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
2583
- } else {
2584
- this.hookFailureMap.set(activity.event.LogicalResourceId, /* @__PURE__ */ new Map());
2585
- this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
2586
- }
2587
- }
2588
- }
2589
- start() {
2590
- }
2591
- stop() {
2592
- }
2593
- };
2594
- var HistoryActivityPrinter = class extends ActivityPrinterBase {
2595
- constructor(props) {
2596
- super(props);
2597
- /**
2598
- * Last time we printed something to the console.
2599
- *
2600
- * Used to measure timeout for progress reporting.
2601
- */
2602
- this.lastPrintTime = Date.now();
2603
- /**
2604
- * Number of ms of change absence before we tell the user about the resources that are currently in progress.
2605
- */
2606
- this.inProgressDelay = 3e4;
2607
- this.printable = new Array();
2608
- }
2609
- addActivity(activity) {
2610
- super.addActivity(activity);
2611
- this.printable.push(activity);
2612
- this.print();
2613
- }
2614
- print() {
2615
- for (const activity of this.printable) {
2616
- this.printOne(activity);
2617
- }
2618
- this.printable.splice(0, this.printable.length);
2619
- this.printInProgress();
2888
+ /**
2889
+ * Report the stack progress
2890
+ */
2891
+ get progress() {
2892
+ return {
2893
+ total: this.total,
2894
+ completed: this.completed,
2895
+ formatted: this.formatted
2896
+ };
2620
2897
  }
2621
- stop() {
2622
- if (this.failures.length > 0) {
2623
- info("\nFailed resources:");
2624
- for (const failure of this.failures) {
2625
- if (failure.isStackEvent) {
2626
- continue;
2627
- }
2628
- this.printOne(failure, false);
2629
- }
2630
- }
2898
+ /**
2899
+ * The total number of progress monitored resources.
2900
+ */
2901
+ get total() {
2902
+ return this.resourcesTotal;
2631
2903
  }
2632
- printOne(activity, progress) {
2633
- const event = activity.event;
2634
- const color = colorFromStatusResult(event.ResourceStatus);
2635
- let reasonColor = chalk4.cyan;
2636
- let stackTrace = "";
2637
- const metadata = activity.metadata;
2638
- if (event.ResourceStatus && event.ResourceStatus.indexOf("FAILED") !== -1) {
2639
- if (progress == void 0 || progress) {
2640
- event.ResourceStatusReason = event.ResourceStatusReason ? this.failureReason(activity) : "";
2641
- }
2642
- if (metadata) {
2643
- stackTrace = metadata.entry.trace ? `
2644
- ${metadata.entry.trace.join("\n \\_ ")}` : "";
2645
- }
2646
- reasonColor = chalk4.red;
2647
- }
2648
- const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
2649
- const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
2650
- info(
2651
- util3.format(
2652
- "%s | %s%s | %s | %s | %s %s%s%s",
2653
- event.StackName,
2654
- progress !== false ? `${this.progress()} | ` : "",
2655
- new Date(event.Timestamp).toLocaleTimeString(),
2656
- color(padRight(STATUS_WIDTH, (event.ResourceStatus || "").slice(0, STATUS_WIDTH))),
2657
- // pad left and trim
2658
- padRight(this.props.resourceTypeColumnWidth, event.ResourceType || ""),
2659
- color(chalk4.bold(resourceName)),
2660
- logicalId,
2661
- reasonColor(chalk4.bold(event.ResourceStatusReason ? event.ResourceStatusReason : "")),
2662
- reasonColor(stackTrace)
2663
- )
2664
- );
2665
- this.lastPrintTime = Date.now();
2904
+ /**
2905
+ * The number of completed resources.
2906
+ */
2907
+ get completed() {
2908
+ return this.resourcesDone;
2666
2909
  }
2667
2910
  /**
2668
2911
  * Report the current progress as a [34/42] string, or just [34] if the total is unknown
2669
2912
  */
2670
- progress() {
2913
+ get formatted() {
2671
2914
  if (this.resourcesTotal == null) {
2672
- return padLeft(3, util3.format("%s", this.resourcesDone));
2915
+ return padLeft(3, util5.format("%s", this.resourcesDone));
2673
2916
  }
2674
- return util3.format(
2917
+ return util5.format(
2675
2918
  "%s/%s",
2676
2919
  padLeft(this.resourceDigits, this.resourcesDone.toString()),
2677
- padLeft(this.resourceDigits, this.resourcesTotal != null ? this.resourcesTotal.toString() : "?")
2920
+ padLeft(this.resourceDigits, this.resourcesTotal.toString())
2678
2921
  );
2679
2922
  }
2680
2923
  /**
2681
- * If some resources are taking a while to create, notify the user about what's currently in progress
2924
+ * Process as stack event and update the progress state.
2682
2925
  */
2683
- printInProgress() {
2684
- if (Date.now() < this.lastPrintTime + this.inProgressDelay) {
2926
+ process(event) {
2927
+ const status = event.ResourceStatus;
2928
+ if (!status || !event.LogicalResourceId) {
2685
2929
  return;
2686
2930
  }
2687
- if (Object.keys(this.resourcesInProgress).length > 0) {
2688
- info(
2689
- util3.format(
2690
- "%s Currently in progress: %s",
2691
- this.progress(),
2692
- chalk4.bold(Object.keys(this.resourcesInProgress).join(", "))
2693
- )
2694
- );
2695
- }
2696
- this.lastPrintTime = Infinity;
2697
- }
2698
- };
2699
- var CurrentActivityPrinter = class extends ActivityPrinterBase {
2700
- constructor(props) {
2701
- super(props);
2702
- /**
2703
- * This looks very disorienting sleeping for 5 seconds. Update quicker.
2704
- */
2705
- this.updateSleep = 2e3;
2706
- this.oldLogThreshold = CliIoHost.instance().logLevel;
2707
- this.stream = props.stream;
2708
- this.block = new RewritableBlock(this.stream);
2709
- }
2710
- print() {
2711
- const lines = [];
2712
- const progressWidth = Math.max(
2713
- Math.min((this.block.width ?? 80) - PROGRESSBAR_EXTRA_SPACE - 1, MAX_PROGRESSBAR_WIDTH),
2714
- MIN_PROGRESSBAR_WIDTH
2715
- );
2716
- const prog = this.progressBar(progressWidth);
2717
- if (prog) {
2718
- lines.push(" " + prog, "");
2931
+ if (status.endsWith("_COMPLETE_CLEANUP_IN_PROGRESS")) {
2932
+ this.resourcesDone++;
2719
2933
  }
2720
- const toPrint = [...this.failures, ...Object.values(this.resourcesInProgress)];
2721
- toPrint.sort((a, b) => a.event.Timestamp.getTime() - b.event.Timestamp.getTime());
2722
- lines.push(
2723
- ...toPrint.map((res) => {
2724
- const color = colorFromStatusActivity(res.event.ResourceStatus);
2725
- const resourceName = res.metadata?.constructPath ?? res.event.LogicalResourceId ?? "";
2726
- return util3.format(
2727
- "%s | %s | %s | %s%s",
2728
- padLeft(TIMESTAMP_WIDTH, new Date(res.event.Timestamp).toLocaleTimeString()),
2729
- color(padRight(STATUS_WIDTH, (res.event.ResourceStatus || "").slice(0, STATUS_WIDTH))),
2730
- padRight(this.props.resourceTypeColumnWidth, res.event.ResourceType || ""),
2731
- color(chalk4.bold(shorten(40, resourceName))),
2732
- this.failureReasonOnNextLine(res)
2733
- );
2734
- })
2735
- );
2736
- this.block.displayLines(lines);
2737
- }
2738
- start() {
2739
- this.oldLogThreshold = CliIoHost.instance().logLevel;
2740
- CliIoHost.instance().logLevel = "info";
2741
- }
2742
- stop() {
2743
- CliIoHost.instance().logLevel = this.oldLogThreshold;
2744
- const lines = new Array();
2745
- for (const failure of this.failures) {
2746
- if (failure.isStackEvent) {
2747
- continue;
2748
- }
2749
- lines.push(
2750
- util3.format(
2751
- chalk4.red("%s | %s | %s | %s%s") + "\n",
2752
- padLeft(TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
2753
- padRight(STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, STATUS_WIDTH)),
2754
- padRight(this.props.resourceTypeColumnWidth, failure.event.ResourceType || ""),
2755
- shorten(40, failure.event.LogicalResourceId ?? ""),
2756
- this.failureReasonOnNextLine(failure)
2757
- )
2758
- );
2759
- const trace3 = failure.metadata?.entry?.trace;
2760
- if (trace3) {
2761
- lines.push(chalk4.red(` ${trace3.join("\n \\_ ")}
2762
- `));
2934
+ if (status.endsWith("_COMPLETE")) {
2935
+ const prevState = this.resourcesPrevCompleteState[event.LogicalResourceId];
2936
+ if (!prevState) {
2937
+ this.resourcesDone++;
2938
+ } else {
2939
+ this.resourcesDone--;
2940
+ if (this.resourcesDone < 0) {
2941
+ this.resourcesDone = 0;
2942
+ }
2763
2943
  }
2944
+ this.resourcesPrevCompleteState[event.LogicalResourceId] = status;
2764
2945
  }
2765
- this.block.displayLines(lines);
2766
- this.block.removeEmptyLines();
2767
- }
2768
- progressBar(width) {
2769
- if (!this.resourcesTotal) {
2770
- return "";
2771
- }
2772
- const fraction = Math.min(this.resourcesDone / this.resourcesTotal, 1);
2773
- const innerWidth = Math.max(1, width - 2);
2774
- const chars = innerWidth * fraction;
2775
- const remainder = chars - Math.floor(chars);
2776
- const fullChars = FULL_BLOCK.repeat(Math.floor(chars));
2777
- const partialChar = PARTIAL_BLOCK[Math.floor(remainder * PARTIAL_BLOCK.length)];
2778
- const filler = "\xB7".repeat(innerWidth - Math.floor(chars) - (partialChar ? 1 : 0));
2779
- const color = this.rollingBack ? chalk4.yellow : chalk4.green;
2780
- return "[" + color(fullChars + partialChar) + filler + `] (${this.resourcesDone}/${this.resourcesTotal})`;
2781
2946
  }
2782
- failureReasonOnNextLine(activity) {
2783
- return hasErrorMessage(activity.event.ResourceStatus ?? "") ? `
2784
- ${" ".repeat(TIMESTAMP_WIDTH + STATUS_WIDTH + 6)}${chalk4.red(this.failureReason(activity) ?? "")}` : "";
2947
+ };
2948
+
2949
+ // ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
2950
+ var StackActivityMonitor = class {
2951
+ constructor({
2952
+ cfn,
2953
+ ioHost,
2954
+ action,
2955
+ stack,
2956
+ stackName,
2957
+ resourcesTotal,
2958
+ changeSetCreationTime,
2959
+ pollingInterval = 2e3
2960
+ }) {
2961
+ this.errors = [];
2962
+ this.ioHost = ioHost;
2963
+ this.action = action;
2964
+ this.stack = stack;
2965
+ this.stackName = stackName;
2966
+ this.progressMonitor = new StackProgressMonitor(resourcesTotal);
2967
+ this.pollingInterval = pollingInterval;
2968
+ this.poller = new StackEventPoller(cfn, {
2969
+ stackName,
2970
+ startTime: changeSetCreationTime?.getTime() ?? Date.now()
2971
+ });
2785
2972
  }
2786
- };
2787
- var FULL_BLOCK = "\u2588";
2788
- var PARTIAL_BLOCK = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
2789
- var MAX_PROGRESSBAR_WIDTH = 60;
2790
- var MIN_PROGRESSBAR_WIDTH = 10;
2791
- var PROGRESSBAR_EXTRA_SPACE = 2 + 2 + 4 + 6;
2792
- function hasErrorMessage(status) {
2793
- return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
2794
- }
2795
- function colorFromStatusResult(status) {
2796
- if (!status) {
2797
- return chalk4.reset;
2973
+ async start() {
2974
+ this.monitorId = uuid.v4();
2975
+ await this.ioHost.notify(debug2(this.action, `Deploying ${this.stackName}`, "CDK_TOOLKIT_I5501", {
2976
+ deployment: this.monitorId,
2977
+ stack: this.stack,
2978
+ stackName: this.stackName,
2979
+ resourcesTotal: this.progressMonitor.total
2980
+ }));
2981
+ this.scheduleNextTick();
2982
+ return this;
2798
2983
  }
2799
- if (status.indexOf("FAILED") !== -1) {
2800
- return chalk4.red;
2984
+ async stop() {
2985
+ const oldMonitorId = this.monitorId;
2986
+ this.monitorId = void 0;
2987
+ if (this.tickTimer) {
2988
+ clearTimeout(this.tickTimer);
2989
+ }
2990
+ await this.finalPollToEnd(oldMonitorId);
2991
+ await this.ioHost.notify(debug2(this.action, `Completed ${this.stackName}`, "CDK_TOOLKIT_I5503", {
2992
+ deployment: oldMonitorId,
2993
+ stack: this.stack,
2994
+ stackName: this.stackName,
2995
+ resourcesTotal: this.progressMonitor.total
2996
+ }));
2801
2997
  }
2802
- if (status.indexOf("ROLLBACK") !== -1) {
2803
- return chalk4.yellow;
2998
+ scheduleNextTick() {
2999
+ if (!this.monitorId) {
3000
+ return;
3001
+ }
3002
+ this.tickTimer = setTimeout(() => void this.tick(), this.pollingInterval);
2804
3003
  }
2805
- if (status.indexOf("COMPLETE") !== -1) {
2806
- return chalk4.green;
3004
+ async tick() {
3005
+ if (!this.monitorId) {
3006
+ return;
3007
+ }
3008
+ try {
3009
+ this.readPromise = this.readNewEvents(this.monitorId);
3010
+ await this.readPromise;
3011
+ this.readPromise = void 0;
3012
+ if (!this.monitorId) {
3013
+ return;
3014
+ }
3015
+ } catch (e) {
3016
+ await this.ioHost.notify(error2(
3017
+ this.action,
3018
+ util6.format("Error occurred while monitoring stack: %s", e),
3019
+ "CDK_TOOLKIT_E5500",
3020
+ { error: e }
3021
+ ));
3022
+ }
3023
+ this.scheduleNextTick();
2807
3024
  }
2808
- return chalk4.reset;
2809
- }
2810
- function colorFromStatusActivity(status) {
2811
- if (!status) {
2812
- return chalk4.reset;
3025
+ findMetadataFor(logicalId) {
3026
+ const metadata = this.stack.manifest?.metadata;
3027
+ if (!logicalId || !metadata) {
3028
+ return void 0;
3029
+ }
3030
+ for (const path12 of Object.keys(metadata)) {
3031
+ const entry = metadata[path12].filter((e) => e.type === import_cloud_assembly_schema.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
3032
+ if (entry) {
3033
+ return {
3034
+ entry,
3035
+ constructPath: this.simplifyConstructPath(path12)
3036
+ };
3037
+ }
3038
+ }
3039
+ return void 0;
2813
3040
  }
2814
- if (status.endsWith("_FAILED")) {
2815
- return chalk4.red;
3041
+ /**
3042
+ * Reads all new events from the stack history
3043
+ *
3044
+ * The events are returned in reverse chronological order; we continue to the next page if we
3045
+ * see a next page and the last event in the page is new to us (and within the time window).
3046
+ * haven't seen the final event
3047
+ */
3048
+ async readNewEvents(monitorId) {
3049
+ const pollEvents = await this.poller.poll();
3050
+ for (const resourceEvent of pollEvents) {
3051
+ this.progressMonitor.process(resourceEvent.event);
3052
+ const activity = {
3053
+ deployment: monitorId,
3054
+ event: resourceEvent.event,
3055
+ metadata: this.findMetadataFor(resourceEvent.event.LogicalResourceId),
3056
+ progress: this.progressMonitor.progress
3057
+ };
3058
+ this.checkForErrors(activity);
3059
+ await this.ioHost.notify(info2(this.action, this.formatActivity(activity, true), "CDK_TOOLKIT_I5502", activity));
3060
+ }
2816
3061
  }
2817
- if (status.startsWith("CREATE_") || status.startsWith("UPDATE_") || status.startsWith("IMPORT_")) {
2818
- return chalk4.green;
3062
+ /**
3063
+ * Perform a final poll to the end and flush out all events to the printer
3064
+ *
3065
+ * Finish any poll currently in progress, then do a final one until we've
3066
+ * reached the last page.
3067
+ */
3068
+ async finalPollToEnd(monitorId) {
3069
+ if (this.readPromise) {
3070
+ await this.readPromise;
3071
+ }
3072
+ await this.readNewEvents(monitorId);
2819
3073
  }
2820
- if (status.indexOf("ROLLBACK_") !== -1) {
2821
- return chalk4.yellow;
3074
+ /**
3075
+ * Formats a stack activity into a basic string
3076
+ */
3077
+ formatActivity(activity, progress) {
3078
+ const event = activity.event;
3079
+ const metadata = activity.metadata;
3080
+ const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
3081
+ const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
3082
+ return util6.format(
3083
+ "%s | %s%s | %s | %s | %s %s%s%s",
3084
+ event.StackName,
3085
+ progress !== false ? `${activity.progress.formatted} | ` : "",
3086
+ new Date(event.Timestamp).toLocaleTimeString(),
3087
+ event.ResourceStatus || "",
3088
+ event.ResourceType,
3089
+ resourceName,
3090
+ logicalId,
3091
+ event.ResourceStatusReason ? event.ResourceStatusReason : "",
3092
+ metadata?.entry.trace ? `
3093
+ ${metadata.entry.trace.join("\n \\_ ")}` : ""
3094
+ );
2822
3095
  }
2823
- if (status.startsWith("DELETE_")) {
2824
- return chalk4.yellow;
3096
+ checkForErrors(activity) {
3097
+ if (stackEventHasErrorMessage(activity.event.ResourceStatus ?? "")) {
3098
+ const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
3099
+ if (!isCancelled && activity.event.StackName !== activity.event.LogicalResourceId) {
3100
+ this.errors.push(activity.event.ResourceStatusReason ?? "");
3101
+ }
3102
+ }
2825
3103
  }
2826
- return chalk4.reset;
2827
- }
2828
- function shorten(maxWidth, p) {
2829
- if (p.length <= maxWidth) {
2830
- return p;
3104
+ simplifyConstructPath(path12) {
3105
+ path12 = path12.replace(/\/Resource$/, "");
3106
+ path12 = path12.replace(/^\//, "");
3107
+ if (path12.startsWith(this.stackName + "/")) {
3108
+ path12 = path12.slice(this.stackName.length + 1);
3109
+ }
3110
+ return path12;
2831
3111
  }
2832
- const half = Math.floor((maxWidth - 3) / 2);
2833
- return p.slice(0, half) + "..." + p.slice(-half);
2834
- }
2835
- var TIMESTAMP_WIDTH = 12;
2836
- var STATUS_WIDTH = 20;
3112
+ };
2837
3113
 
2838
3114
  // ../../aws-cdk/lib/api/stack-events/stack-status.ts
2839
3115
  var import_client_cloudformation2 = require("@aws-sdk/client-cloudformation");
@@ -2900,47 +3176,8 @@ var path4 = __toESM(require("path"));
2900
3176
  var import_cx_api2 = require("@aws-cdk/cx-api");
2901
3177
  var import_client_s32 = require("@aws-sdk/client-s3");
2902
3178
  var import_middleware_endpoint2 = require("@smithy/middleware-endpoint");
2903
- var chalk5 = __toESM(require("chalk"));
3179
+ var chalk6 = __toESM(require("chalk"));
2904
3180
  var fs6 = __toESM(require("fs-extra"));
2905
-
2906
- // ../../aws-cdk/lib/util/content-hash.ts
2907
- var crypto = __toESM(require("crypto"));
2908
- function contentHash(data) {
2909
- return crypto.createHash("sha256").update(data).digest("hex");
2910
- }
2911
- function contentHashAny(value) {
2912
- const ret = crypto.createHash("sha256");
2913
- recurse(value);
2914
- return ret.digest("hex");
2915
- function recurse(x) {
2916
- if (typeof x === "string") {
2917
- ret.update(x);
2918
- return;
2919
- }
2920
- if (Array.isArray(x)) {
2921
- ret.update("[");
2922
- for (const e of x) {
2923
- recurse(e);
2924
- ret.update("||");
2925
- }
2926
- ret.update("]");
2927
- return;
2928
- }
2929
- if (x && typeof x === "object") {
2930
- ret.update("{");
2931
- for (const key of Object.keys(x).sort()) {
2932
- ret.update(key);
2933
- ret.update(":");
2934
- recurse(x[key]);
2935
- }
2936
- ret.update("}");
2937
- return;
2938
- }
2939
- ret.update(`${x}${typeof x}`);
2940
- }
2941
- }
2942
-
2943
- // ../../aws-cdk/lib/api/util/template-body-parameter.ts
2944
3181
  var LARGE_TEMPLATE_SIZE_KB = 50;
2945
3182
  async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, resources, overrideTemplate) {
2946
3183
  if (stack.stackTemplateAssetObjectUrl && !overrideTemplate) {
@@ -2959,7 +3196,7 @@ async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, reso
2959
3196
  Run the following command in order to setup an S3 bucket in this environment, and then re-deploy:
2960
3197
 
2961
3198
  `,
2962
- chalk5.blue(` $ cdk bootstrap ${resolvedEnvironment.name}
3199
+ chalk6.blue(` $ cdk bootstrap ${resolvedEnvironment.name}
2963
3200
  `)
2964
3201
  );
2965
3202
  throw new ToolkitError('Template too large to deploy ("cdk bootstrap" is required)');
@@ -3185,13 +3422,13 @@ async function waitFor(valueProvider, timeout = 5e3) {
3185
3422
  }
3186
3423
  }
3187
3424
  async function waitForChangeSet(cfn, { ioHost, action }, stackName, changeSetName, { fetchAll }) {
3188
- await ioHost.notify(debug2(action, (0, import_util6.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
3425
+ await ioHost.notify(debug2(action, (0, import_util10.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
3189
3426
  const ret = await waitFor(async () => {
3190
3427
  const description = await describeChangeSet(cfn, stackName, changeSetName, {
3191
3428
  fetchAll
3192
3429
  });
3193
3430
  if (description.Status === "CREATE_PENDING" || description.Status === "CREATE_IN_PROGRESS") {
3194
- await ioHost.notify(debug2(action, (0, import_util6.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
3431
+ await ioHost.notify(debug2(action, (0, import_util10.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
3195
3432
  return void 0;
3196
3433
  }
3197
3434
  if (description.Status === import_client_cloudformation3.ChangeSetStatus.CREATE_COMPLETE || changeSetHasNoChanges(description)) {
@@ -3276,19 +3513,19 @@ async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
3276
3513
  return stack;
3277
3514
  }
3278
3515
  async function stabilizeStack(cfn, { ioHost, action }, stackName) {
3279
- await ioHost.notify(debug2(action, (0, import_util6.format)("Waiting for stack %s to finish creating or updating...", stackName)));
3516
+ await ioHost.notify(debug2(action, (0, import_util10.format)("Waiting for stack %s to finish creating or updating...", stackName)));
3280
3517
  return waitFor(async () => {
3281
3518
  const stack = await CloudFormationStack.lookup(cfn, stackName);
3282
3519
  if (!stack.exists) {
3283
- await ioHost.notify(debug2(action, (0, import_util6.format)("Stack %s does not exist", stackName)));
3520
+ await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s does not exist", stackName)));
3284
3521
  return null;
3285
3522
  }
3286
3523
  const status = stack.stackStatus;
3287
3524
  if (status.isInProgress) {
3288
- await ioHost.notify(debug2(action, (0, import_util6.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
3525
+ await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
3289
3526
  return void 0;
3290
3527
  } else if (status.isReviewInProgress) {
3291
- await ioHost.notify(debug2(action, (0, import_util6.format)("Stack %s is in REVIEW_IN_PROGRESS state. Considering this is a stable status (%s)", stackName, status)));
3528
+ await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s is in REVIEW_IN_PROGRESS state. Considering this is a stable status (%s)", stackName, status)));
3292
3529
  }
3293
3530
  return stack;
3294
3531
  });
@@ -3380,7 +3617,7 @@ var ParameterValues = class {
3380
3617
  // ../../aws-cdk/lib/api/deployments/deployments.ts
3381
3618
  var import_crypto = require("crypto");
3382
3619
  var cdk_assets = __toESM(require("cdk-assets"));
3383
- var chalk11 = __toESM(require("chalk"));
3620
+ var chalk12 = __toESM(require("chalk"));
3384
3621
 
3385
3622
  // ../../aws-cdk/lib/api/deployments/asset-publishing.ts
3386
3623
  var import_cx_api4 = require("@aws-cdk/cx-api");
@@ -3557,15 +3794,15 @@ async function getBootstrapStackInfo(sdk, stackName) {
3557
3794
  }
3558
3795
 
3559
3796
  // ../../aws-cdk/lib/api/deployments/deploy-stack.ts
3560
- var import_util9 = require("util");
3561
- var chalk8 = __toESM(require("chalk"));
3562
- var uuid = __toESM(require("uuid"));
3797
+ var import_util13 = require("util");
3798
+ var chalk9 = __toESM(require("chalk"));
3799
+ var uuid2 = __toESM(require("uuid"));
3563
3800
 
3564
3801
  // ../../aws-cdk/lib/api/deployments/assets.ts
3565
3802
  var path5 = __toESM(require("path"));
3566
3803
  var cxschema2 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
3567
3804
  var cxapi2 = __toESM(require("@aws-cdk/cx-api"));
3568
- var chalk6 = __toESM(require("chalk"));
3805
+ var chalk7 = __toESM(require("chalk"));
3569
3806
  async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManifest, envResources, reuse) {
3570
3807
  reuse = reuse || [];
3571
3808
  const assets = stack.assets;
@@ -3574,7 +3811,7 @@ async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManif
3574
3811
  }
3575
3812
  const toolkitInfo = await envResources.lookupToolkit();
3576
3813
  if (!toolkitInfo.found) {
3577
- throw new ToolkitError(`This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${chalk6.blue("cdk bootstrap " + stack.environment.name)}")`);
3814
+ throw new ToolkitError(`This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${chalk7.blue("cdk bootstrap " + stack.environment.name)}")`);
3578
3815
  }
3579
3816
  const params = {};
3580
3817
  for (const asset of assets) {
@@ -3655,9 +3892,9 @@ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
3655
3892
  }
3656
3893
 
3657
3894
  // ../../aws-cdk/lib/api/deployments/hotswap-deployments.ts
3658
- var import_util8 = require("util");
3895
+ var import_util12 = require("util");
3659
3896
  var cfn_diff = __toESM(require("@aws-cdk/cloudformation-diff"));
3660
- var chalk7 = __toESM(require("chalk"));
3897
+ var chalk8 = __toESM(require("chalk"));
3661
3898
 
3662
3899
  // ../../aws-cdk/lib/api/deployments/nested-stack-helpers.ts
3663
3900
  var path6 = __toESM(require("path"));
@@ -4572,77 +4809,6 @@ async function prepareTaskDefinitionChange(evaluateCfnTemplate, logicalId, chang
4572
4809
 
4573
4810
  // ../../aws-cdk/lib/api/hotswap/lambda-functions.ts
4574
4811
  var import_stream = require("stream");
4575
-
4576
- // ../../aws-cdk/lib/util/archive.ts
4577
- var glob = __toESM(require("glob"));
4578
- var archiver = require("archiver");
4579
-
4580
- // ../../aws-cdk/lib/util/arrays.ts
4581
- function flatMap(xs, fn) {
4582
- return flatten(xs.map(fn));
4583
- }
4584
- function flatten(xs) {
4585
- return Array.prototype.concat.apply([], xs);
4586
- }
4587
-
4588
- // ../../aws-cdk/lib/util/cloudformation.ts
4589
- function validateSnsTopicArn(arn) {
4590
- return /^arn:aws:sns:[a-z0-9\-]+:[0-9]+:[a-z0-9\-\_]+$/i.test(arn);
4591
- }
4592
-
4593
- // ../../aws-cdk/lib/util/parallel.ts
4594
- async function parallelPromises(n, promises) {
4595
- const ret = new Array();
4596
- let count = 0;
4597
- let error3;
4598
- const queue = [...promises];
4599
- return new Promise((ok, ko) => {
4600
- tick();
4601
- function tick() {
4602
- if (count === 0 && error3) {
4603
- ko(error3);
4604
- return;
4605
- }
4606
- if (count === 0 && queue.length === 0) {
4607
- ok(ret);
4608
- return;
4609
- }
4610
- while (count < n && queue.length > 0 && !error3) {
4611
- const next = queue.shift();
4612
- if (next !== void 0) {
4613
- start(next);
4614
- }
4615
- }
4616
- }
4617
- function start(fn) {
4618
- count += 1;
4619
- fn().then((result) => {
4620
- ret.push(result);
4621
- }).catch((e) => {
4622
- error3 = e;
4623
- }).finally(() => {
4624
- count -= 1;
4625
- tick();
4626
- });
4627
- }
4628
- });
4629
- }
4630
-
4631
- // ../../aws-cdk/lib/util/string-manipulation.ts
4632
- function formatTime(num) {
4633
- return roundPercentage(millisecondsToSeconds(num));
4634
- }
4635
- function roundPercentage(num) {
4636
- return Math.round(100 * num) / 100;
4637
- }
4638
- function millisecondsToSeconds(num) {
4639
- return num / 1e3;
4640
- }
4641
-
4642
- // ../../aws-cdk/lib/util/version-range.ts
4643
- var semver = __toESM(require("semver"));
4644
-
4645
- // ../../aws-cdk/lib/api/hotswap/lambda-functions.ts
4646
4812
  var archiver2 = require("archiver");
4647
4813
  async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfnTemplate) {
4648
4814
  if (change.newValue.Type === "AWS::Lambda::Version") {
@@ -5263,7 +5429,7 @@ async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation
5263
5429
  const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
5264
5430
  sdk.appendCustomUserAgent(customUserAgent);
5265
5431
  for (const name of hotswapOperation.resourceNames) {
5266
- await ioHost.notify(info2(action, (0, import_util8.format)(` ${ICON} %s`, chalk7.bold(name))));
5432
+ await ioHost.notify(info2(action, (0, import_util12.format)(` ${ICON} %s`, chalk8.bold(name))));
5267
5433
  }
5268
5434
  try {
5269
5435
  await hotswapOperation.apply(sdk);
@@ -5277,7 +5443,7 @@ async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation
5277
5443
  throw e;
5278
5444
  }
5279
5445
  for (const name of hotswapOperation.resourceNames) {
5280
- await ioHost.notify(info2(action, (0, import_util8.format)(`${ICON} %s %s`, chalk7.bold(name), chalk7.green("hotswapped!"))));
5446
+ await ioHost.notify(info2(action, (0, import_util12.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
5281
5447
  }
5282
5448
  sdk.removeCustomUserAgent(customUserAgent);
5283
5449
  }
@@ -5305,25 +5471,25 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
5305
5471
  }
5306
5472
  const messages = [""];
5307
5473
  if (hotswapMode === "hotswap-only" /* HOTSWAP_ONLY */) {
5308
- messages.push((0, import_util8.format)("%s %s", chalk7.red("\u26A0\uFE0F"), chalk7.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
5474
+ messages.push((0, import_util12.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
5309
5475
  } else {
5310
- messages.push((0, import_util8.format)("%s %s", chalk7.red("\u26A0\uFE0F"), chalk7.red("The following non-hotswappable changes were found:")));
5476
+ messages.push((0, import_util12.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
5311
5477
  }
5312
5478
  for (const change of nonHotswappableChanges) {
5313
5479
  if (change.rejectedChanges.length > 0) {
5314
- messages.push((0, import_util8.format)(
5480
+ messages.push((0, import_util12.format)(
5315
5481
  " logicalID: %s, type: %s, rejected changes: %s, reason: %s",
5316
- chalk7.bold(change.logicalId),
5317
- chalk7.bold(change.resourceType),
5318
- chalk7.bold(change.rejectedChanges),
5319
- chalk7.red(change.reason)
5482
+ chalk8.bold(change.logicalId),
5483
+ chalk8.bold(change.resourceType),
5484
+ chalk8.bold(change.rejectedChanges),
5485
+ chalk8.red(change.reason)
5320
5486
  ));
5321
5487
  } else {
5322
- messages.push((0, import_util8.format)(
5488
+ messages.push((0, import_util12.format)(
5323
5489
  " logicalID: %s, type: %s, reason: %s",
5324
- chalk7.bold(change.logicalId),
5325
- chalk7.bold(change.resourceType),
5326
- chalk7.red(change.reason)
5490
+ chalk8.bold(change.logicalId),
5491
+ chalk8.bold(change.resourceType),
5492
+ chalk8.red(change.reason)
5327
5493
  ));
5328
5494
  }
5329
5495
  }
@@ -5371,11 +5537,11 @@ async function deployStack(options, { ioHost, action }) {
5371
5537
  if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
5372
5538
  await ioHost.notify(info2(
5373
5539
  action,
5374
- (0, import_util9.format)(
5540
+ (0, import_util13.format)(
5375
5541
  `
5376
5542
  ${ICON} %s
5377
5543
  `,
5378
- chalk8.bold("hotswap deployment skipped - no changes were detected (use --force to override)")
5544
+ chalk9.bold("hotswap deployment skipped - no changes were detected (use --force to override)")
5379
5545
  )
5380
5546
  ));
5381
5547
  }
@@ -5419,7 +5585,7 @@ async function deployStack(options, { ioHost, action }) {
5419
5585
  if (hotswapDeploymentResult) {
5420
5586
  return hotswapDeploymentResult;
5421
5587
  }
5422
- await ioHost.notify(info2(action, (0, import_util9.format)(
5588
+ await ioHost.notify(info2(action, (0, import_util13.format)(
5423
5589
  "Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
5424
5590
  stackArtifact.displayName
5425
5591
  )));
@@ -5427,7 +5593,7 @@ async function deployStack(options, { ioHost, action }) {
5427
5593
  if (!(e instanceof CfnEvaluationException)) {
5428
5594
  throw e;
5429
5595
  }
5430
- await ioHost.notify(info2(action, (0, import_util9.format)(
5596
+ await ioHost.notify(info2(action, (0, import_util13.format)(
5431
5597
  "Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
5432
5598
  formatErrorMessage(e)
5433
5599
  )));
@@ -5468,7 +5634,7 @@ var FullCloudFormationDeployment = class {
5468
5634
  this.stackName = options.deployName ?? stackArtifact.stackName;
5469
5635
  this.update = cloudFormationStack.exists && cloudFormationStack.stackStatus.name !== "REVIEW_IN_PROGRESS";
5470
5636
  this.verb = this.update ? "update" : "create";
5471
- this.uuid = uuid.v4();
5637
+ this.uuid = uuid2.v4();
5472
5638
  }
5473
5639
  async performDeployment() {
5474
5640
  const deploymentMethod = this.options.deploymentMethod ?? {
@@ -5491,9 +5657,9 @@ var FullCloudFormationDeployment = class {
5491
5657
  const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
5492
5658
  await this.updateTerminationProtection();
5493
5659
  if (changeSetHasNoChanges(changeSetDescription)) {
5494
- debug2(this.action, (0, import_util9.format)("No changes are to be performed on %s.", this.stackName));
5660
+ await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("No changes are to be performed on %s.", this.stackName)));
5495
5661
  if (execute) {
5496
- debug2(this.action, (0, import_util9.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId));
5662
+ await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
5497
5663
  await this.cfn.deleteChangeSet({
5498
5664
  StackName: this.stackName,
5499
5665
  ChangeSetName: changeSetName
@@ -5519,10 +5685,10 @@ var FullCloudFormationDeployment = class {
5519
5685
  };
5520
5686
  }
5521
5687
  if (!execute) {
5522
- info2(this.action, (0, import_util9.format)(
5688
+ await this.ioHost.notify(info2(this.action, (0, import_util13.format)(
5523
5689
  "Changeset %s created and waiting in review for manual execution (--no-execute)",
5524
5690
  changeSetDescription.ChangeSetId
5525
- ));
5691
+ )));
5526
5692
  return {
5527
5693
  type: "did-deploy-stack",
5528
5694
  noOp: false,
@@ -5547,7 +5713,7 @@ var FullCloudFormationDeployment = class {
5547
5713
  async createChangeSet(changeSetName, willExecute, importExistingResources) {
5548
5714
  await this.cleanupOldChangeset(changeSetName);
5549
5715
  await this.ioHost.notify(debug2(this.action, `Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
5550
- await this.ioHost.notify(info2(this.action, (0, import_util9.format)("%s: creating CloudFormation changeset...", chalk8.bold(this.stackName))));
5716
+ await this.ioHost.notify(info2(this.action, (0, import_util13.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
5551
5717
  const changeSet = await this.cfn.createChangeSet({
5552
5718
  StackName: this.stackName,
5553
5719
  ChangeSetName: changeSetName,
@@ -5558,13 +5724,13 @@ var FullCloudFormationDeployment = class {
5558
5724
  ImportExistingResources: importExistingResources,
5559
5725
  ...this.commonPrepareOptions()
5560
5726
  });
5561
- await this.ioHost.notify(debug2(this.action, (0, import_util9.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
5727
+ await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
5562
5728
  return waitForChangeSet(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName, changeSetName, {
5563
5729
  fetchAll: willExecute
5564
5730
  });
5565
5731
  }
5566
5732
  async executeChangeSet(changeSet) {
5567
- await this.ioHost.notify(debug2(this.action, (0, import_util9.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
5733
+ await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
5568
5734
  await this.cfn.executeChangeSet({
5569
5735
  StackName: this.stackName,
5570
5736
  ChangeSetName: changeSet.ChangeSetName,
@@ -5573,7 +5739,7 @@ var FullCloudFormationDeployment = class {
5573
5739
  });
5574
5740
  await this.ioHost.notify(debug2(
5575
5741
  this.action,
5576
- (0, import_util9.format)(
5742
+ (0, import_util13.format)(
5577
5743
  "Execution of changeset %s on stack %s has started; waiting for the update to complete...",
5578
5744
  changeSet.ChangeSetId,
5579
5745
  this.stackName
@@ -5596,7 +5762,7 @@ var FullCloudFormationDeployment = class {
5596
5762
  if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
5597
5763
  await this.ioHost.notify(debug2(
5598
5764
  this.action,
5599
- (0, import_util9.format)(
5765
+ (0, import_util13.format)(
5600
5766
  "Updating termination protection from %s to %s for stack %s",
5601
5767
  this.cloudFormationStack.terminationProtection,
5602
5768
  terminationProtection,
@@ -5607,11 +5773,11 @@ var FullCloudFormationDeployment = class {
5607
5773
  StackName: this.stackName,
5608
5774
  EnableTerminationProtection: terminationProtection
5609
5775
  });
5610
- await this.ioHost.notify(debug2(this.action, (0, import_util9.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
5776
+ await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
5611
5777
  }
5612
5778
  }
5613
5779
  async directDeployment() {
5614
- await this.ioHost.notify(info2(this.action, (0, import_util9.format)("%s: %s stack...", chalk8.bold(this.stackName), this.update ? "updating" : "creating")));
5780
+ await this.ioHost.notify(info2(this.action, (0, import_util13.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
5615
5781
  const startTime = /* @__PURE__ */ new Date();
5616
5782
  if (this.update) {
5617
5783
  await this.updateTerminationProtection();
@@ -5624,7 +5790,7 @@ var FullCloudFormationDeployment = class {
5624
5790
  });
5625
5791
  } catch (err) {
5626
5792
  if (err.message === "No updates are to be performed.") {
5627
- await this.ioHost.notify(debug2(this.action, (0, import_util9.format)("No updates are to be performed for stack %s", this.stackName)));
5793
+ await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("No updates are to be performed for stack %s", this.stackName)));
5628
5794
  return {
5629
5795
  type: "did-deploy-stack",
5630
5796
  noOp: true,
@@ -5648,12 +5814,16 @@ var FullCloudFormationDeployment = class {
5648
5814
  }
5649
5815
  }
5650
5816
  async monitorDeployment(startTime, expectedChanges) {
5651
- const monitor = this.options.quiet ? void 0 : StackActivityMonitor.withDefaultPrinter(this.cfn, this.stackName, this.stackArtifact, {
5817
+ const monitor = new StackActivityMonitor({
5818
+ cfn: this.cfn,
5819
+ stack: this.stackArtifact,
5820
+ stackName: this.stackName,
5652
5821
  resourcesTotal: expectedChanges,
5653
- progress: this.options.progress,
5654
- changeSetCreationTime: startTime,
5655
- ci: this.options.ci
5656
- }).start();
5822
+ ioHost: this.ioHost,
5823
+ action: this.action,
5824
+ changeSetCreationTime: startTime
5825
+ });
5826
+ await monitor.start();
5657
5827
  let finalState = this.cloudFormationStack;
5658
5828
  try {
5659
5829
  const successStack = await waitForStackDeploy(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName);
@@ -5662,11 +5832,11 @@ var FullCloudFormationDeployment = class {
5662
5832
  }
5663
5833
  finalState = successStack;
5664
5834
  } catch (e) {
5665
- throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor?.errors));
5835
+ throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor.errors));
5666
5836
  } finally {
5667
- await monitor?.stop();
5837
+ await monitor.stop();
5668
5838
  }
5669
- debug2(this.action, (0, import_util9.format)("Stack %s has completed updating", this.stackName));
5839
+ debug2(this.action, (0, import_util13.format)("Stack %s has completed updating", this.stackName));
5670
5840
  return {
5671
5841
  type: "did-deploy-stack",
5672
5842
  noOp: false,
@@ -5709,9 +5879,14 @@ async function destroyStack(options, { ioHost, action }) {
5709
5879
  if (!currentStack.exists) {
5710
5880
  return;
5711
5881
  }
5712
- const monitor = options.quiet ? void 0 : StackActivityMonitor.withDefaultPrinter(cfn, deployName, options.stack, {
5713
- ci: options.ci
5714
- }).start();
5882
+ const monitor = new StackActivityMonitor({
5883
+ cfn,
5884
+ stack: options.stack,
5885
+ stackName: deployName,
5886
+ ioHost,
5887
+ action
5888
+ });
5889
+ await monitor.start();
5715
5890
  try {
5716
5891
  await cfn.deleteStack({ StackName: deployName, RoleARN: options.roleArn });
5717
5892
  const destroyedStack = await waitForStackDelete(cfn, { ioHost, action }, deployName);
@@ -5719,7 +5894,7 @@ async function destroyStack(options, { ioHost, action }) {
5719
5894
  throw new ToolkitError(`Failed to destroy ${deployName}: ${destroyedStack.stackStatus}`);
5720
5895
  }
5721
5896
  } catch (e) {
5722
- throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor?.errors));
5897
+ throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor.errors));
5723
5898
  } finally {
5724
5899
  if (monitor) {
5725
5900
  await monitor.stop();
@@ -5804,7 +5979,7 @@ var semver4 = __toESM(require("semver"));
5804
5979
 
5805
5980
  // ../../aws-cdk/lib/cli/version.ts
5806
5981
  var path7 = __toESM(require("path"));
5807
- var chalk9 = __toESM(require("chalk"));
5982
+ var chalk10 = __toESM(require("chalk"));
5808
5983
  var fs8 = __toESM(require("fs-extra"));
5809
5984
  var semver3 = __toESM(require("semver"));
5810
5985
 
@@ -5813,9 +5988,9 @@ var stripAnsi = require("strip-ansi");
5813
5988
 
5814
5989
  // ../../aws-cdk/lib/cli/util/npm.ts
5815
5990
  var import_child_process = require("child_process");
5816
- var import_util10 = require("util");
5991
+ var import_util14 = require("util");
5817
5992
  var semver2 = __toESM(require("semver"));
5818
- var exec = (0, import_util10.promisify)(import_child_process.exec);
5993
+ var exec = (0, import_util14.promisify)(import_child_process.exec);
5819
5994
 
5820
5995
  // ../../aws-cdk/lib/cli/version.ts
5821
5996
  var ONE_DAY_IN_SECONDS = 1 * 24 * 60 * 60;
@@ -5901,7 +6076,7 @@ var NoticesFilter = class _NoticesFilter {
5901
6076
  return data.flatMap((notice) => {
5902
6077
  const ors = this.resolveAliases(normalizeComponents(notice.components));
5903
6078
  for (const ands of ors) {
5904
- const matched = ands.map((affected) => actualComponents.filter((actual) => _NoticesFilter.componentNameMatches(affected, actual) && semver4.satisfies(actual.version, affected.version)));
6079
+ const matched = ands.map((affected) => actualComponents.filter((actual) => _NoticesFilter.componentNameMatches(affected, actual) && semver4.satisfies(actual.version, affected.version, { includePrerelease: true })));
5905
6080
  if (matched.every((xs) => xs.length > 0)) {
5906
6081
  const ret = new FilteredNotice(notice);
5907
6082
  _NoticesFilter.addDynamicValues(matched.flatMap((x) => x), ret);
@@ -6225,8 +6400,8 @@ var CachedDataSource = class {
6225
6400
  };
6226
6401
 
6227
6402
  // ../../aws-cdk/lib/api/toolkit-info.ts
6228
- var import_util11 = require("util");
6229
- var chalk10 = __toESM(require("chalk"));
6403
+ var import_util15 = require("util");
6404
+ var chalk11 = __toESM(require("chalk"));
6230
6405
 
6231
6406
  // ../../aws-cdk/lib/api/bootstrap/bootstrap-props.ts
6232
6407
  var BUCKET_NAME_OUTPUT = "BucketName";
@@ -6250,11 +6425,11 @@ var ToolkitInfo = class _ToolkitInfo {
6250
6425
  if (!stack) {
6251
6426
  await ioHost.notify(debug2(
6252
6427
  action,
6253
- (0, import_util11.format)(
6428
+ (0, import_util15.format)(
6254
6429
  "The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
6255
6430
  environment.name,
6256
6431
  stackName,
6257
- chalk10.blue(`cdk bootstrap "${environment.name}"`)
6432
+ chalk11.blue(`cdk bootstrap "${environment.name}"`)
6258
6433
  )
6259
6434
  ));
6260
6435
  return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
@@ -6262,11 +6437,11 @@ var ToolkitInfo = class _ToolkitInfo {
6262
6437
  if (stack.stackStatus.isCreationFailure) {
6263
6438
  await ioHost.notify(debug2(
6264
6439
  action,
6265
- (0, import_util11.format)(
6440
+ (0, import_util15.format)(
6266
6441
  "The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
6267
6442
  environment.name,
6268
6443
  stackName,
6269
- chalk10.blue(`cdk bootstrap "${environment.name}"`)
6444
+ chalk11.blue(`cdk bootstrap "${environment.name}"`)
6270
6445
  )
6271
6446
  ));
6272
6447
  return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
@@ -6800,7 +6975,6 @@ var Deployments = class {
6800
6975
  resolvedEnvironment: env.resolvedEnvironment,
6801
6976
  deployName: options.deployName,
6802
6977
  notificationArns: options.notificationArns,
6803
- quiet: options.quiet,
6804
6978
  sdk: env.sdk,
6805
6979
  sdkProvider: this.deployStackSdkProvider,
6806
6980
  roleArn: executionRoleArn,
@@ -6811,8 +6985,6 @@ var Deployments = class {
6811
6985
  force: options.force,
6812
6986
  parameters: options.parameters,
6813
6987
  usePreviousParameters: options.usePreviousParameters,
6814
- progress: options.progress,
6815
- ci: options.ci,
6816
6988
  rollback: options.rollback,
6817
6989
  hotswap: options.hotswap,
6818
6990
  hotswapPropertyOverrides: options.hotswapPropertyOverrides,
@@ -6883,9 +7055,14 @@ var Deployments = class {
6883
7055
  default:
6884
7056
  throw new ToolkitError(`Unexpected rollback choice: ${cloudFormationStack.stackStatus.rollbackChoice}`);
6885
7057
  }
6886
- const monitor = options.quiet ? void 0 : StackActivityMonitor.withDefaultPrinter(cfn, deployName, options.stack, {
6887
- ci: options.ci
6888
- }).start();
7058
+ const monitor = new StackActivityMonitor({
7059
+ cfn,
7060
+ stack: options.stack,
7061
+ stackName: deployName,
7062
+ ioHost: this.ioHost,
7063
+ action: this.action
7064
+ });
7065
+ await monitor.start();
6889
7066
  let stackErrorMessage = void 0;
6890
7067
  let finalStackState = cloudFormationStack;
6891
7068
  try {
@@ -6894,14 +7071,14 @@ var Deployments = class {
6894
7071
  throw new ToolkitError("Stack deploy failed (the stack disappeared while we were rolling it back)");
6895
7072
  }
6896
7073
  finalStackState = successStack;
6897
- const errors = monitor?.errors?.join(", ");
7074
+ const errors = monitor.errors.join(", ");
6898
7075
  if (errors) {
6899
7076
  stackErrorMessage = errors;
6900
7077
  }
6901
7078
  } catch (e) {
6902
- stackErrorMessage = suffixWithErrors2(formatErrorMessage(e), monitor?.errors);
7079
+ stackErrorMessage = suffixWithErrors2(formatErrorMessage(e), monitor.errors);
6903
7080
  } finally {
6904
- await monitor?.stop();
7081
+ await monitor.stop();
6905
7082
  }
6906
7083
  if (finalStackState.stackStatus.isRollbackSuccess || !stackErrorMessage) {
6907
7084
  return { success: true };
@@ -7010,7 +7187,7 @@ var Deployments = class {
7010
7187
  if (existing) {
7011
7188
  return existing;
7012
7189
  }
7013
- const prefix = stackName ? `${chalk11.bold(stackName)}: ` : "";
7190
+ const prefix = stackName ? `${chalk12.bold(stackName)}: ` : "";
7014
7191
  const publisher = new cdk_assets.AssetPublishing(assetManifest, {
7015
7192
  // The AssetPublishing class takes care of role assuming etc, so it's okay to
7016
7193
  // give it a direct `SdkProvider`.
@@ -7047,9 +7224,9 @@ function tagsForStack(stack) {
7047
7224
  }
7048
7225
 
7049
7226
  // ../../aws-cdk/lib/api/resource-import/importer.ts
7050
- var import_util12 = require("util");
7227
+ var import_util16 = require("util");
7051
7228
  var cfnDiff = __toESM(require("@aws-cdk/cloudformation-diff"));
7052
- var chalk12 = __toESM(require("chalk"));
7229
+ var chalk13 = __toESM(require("chalk"));
7053
7230
  var fs11 = __toESM(require("fs-extra"));
7054
7231
  var promptly3 = __toESM(require("promptly"));
7055
7232
  var ResourceImporter = class {
@@ -7085,12 +7262,12 @@ var ResourceImporter = class {
7085
7262
  const descr = this.describeResource(resource.logicalId);
7086
7263
  const idProps = contents[resource.logicalId];
7087
7264
  if (idProps) {
7088
- await this.ioHost.notify(info2(this.action, (0, import_util12.format)("%s: importing using %s", chalk12.blue(descr), chalk12.blue(fmtdict(idProps)))));
7265
+ await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
7089
7266
  ret.importResources.push(resource);
7090
7267
  ret.resourceMap[resource.logicalId] = idProps;
7091
7268
  delete contents[resource.logicalId];
7092
7269
  } else {
7093
- await this.ioHost.notify(info2(this.action, (0, import_util12.format)("%s: skipping", chalk12.blue(descr))));
7270
+ await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: skipping", chalk13.blue(descr))));
7094
7271
  }
7095
7272
  }
7096
7273
  const unknown = Object.keys(contents);
@@ -7134,9 +7311,9 @@ var ResourceImporter = class {
7134
7311
  });
7135
7312
  assertIsSuccessfulDeployStackResult(result);
7136
7313
  const message = result.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
7137
- await this.ioHost.notify(info2(this.action, "\n" + chalk12.green((0, import_util12.format)(message, this.stack.displayName))));
7314
+ await this.ioHost.notify(info2(this.action, "\n" + chalk13.green((0, import_util16.format)(message, this.stack.displayName))));
7138
7315
  } catch (e) {
7139
- await this.ioHost.notify(error2(this.action, (0, import_util12.format)("\n \u274C %s failed: %s", chalk12.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
7316
+ await this.ioHost.notify(error2(this.action, (0, import_util16.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
7140
7317
  throw e;
7141
7318
  }
7142
7319
  }
@@ -7238,21 +7415,21 @@ var ResourceImporter = class {
7238
7415
  const candidateProps = Object.fromEntries(satisfiedPropSet.map((p) => [p, resourceProps[p]]));
7239
7416
  const displayCandidateProps = fmtdict(candidateProps);
7240
7417
  if (await promptly3.confirm(
7241
- `${chalk12.blue(resourceName)} (${resourceType}): import with ${chalk12.yellow(displayCandidateProps)} (yes/no) [default: yes]? `,
7418
+ `${chalk13.blue(resourceName)} (${resourceType}): import with ${chalk13.yellow(displayCandidateProps)} (yes/no) [default: yes]? `,
7242
7419
  { default: "yes" }
7243
7420
  )) {
7244
7421
  return candidateProps;
7245
7422
  }
7246
7423
  }
7247
7424
  if (satisfiedPropSets.length > 0) {
7248
- await this.ioHost.notify(info2(this.action, chalk12.grey(`Skipping import of ${resourceName}`)));
7425
+ await this.ioHost.notify(info2(this.action, chalk13.grey(`Skipping import of ${resourceName}`)));
7249
7426
  return void 0;
7250
7427
  }
7251
- const prefix = `${chalk12.blue(resourceName)} (${resourceType})`;
7428
+ const prefix = `${chalk13.blue(resourceName)} (${resourceType})`;
7252
7429
  let preamble;
7253
7430
  let promptPattern;
7254
7431
  if (idPropSets.length > 1) {
7255
- preamble = `${prefix}: enter one of ${idPropSets.map((x) => chalk12.blue(x.join("+"))).join(", ")} to import (all empty to skip)`;
7432
+ preamble = `${prefix}: enter one of ${idPropSets.map((x) => chalk13.blue(x.join("+"))).join(", ")} to import (all empty to skip)`;
7256
7433
  promptPattern = `${prefix}: enter %`;
7257
7434
  } else {
7258
7435
  promptPattern = `${prefix}: enter %`;
@@ -7265,7 +7442,7 @@ var ResourceImporter = class {
7265
7442
  for (const idProp of idProps) {
7266
7443
  const defaultValue = resourceProps[idProp] ?? "";
7267
7444
  const prompt4 = [
7268
- promptPattern.replace(/%/g, chalk12.blue(idProp)),
7445
+ promptPattern.replace(/%/g, chalk13.blue(idProp)),
7269
7446
  defaultValue ? `[${defaultValue}]` : "(empty to skip)"
7270
7447
  ].join(" ") + ":";
7271
7448
  const response = await promptly3.prompt(
@@ -7282,7 +7459,7 @@ var ResourceImporter = class {
7282
7459
  return input;
7283
7460
  }
7284
7461
  }
7285
- await this.ioHost.notify(info2(this.action, chalk12.grey(`Skipping import of ${resourceName}`)));
7462
+ await this.ioHost.notify(info2(this.action, chalk13.grey(`Skipping import of ${resourceName}`)));
7286
7463
  return void 0;
7287
7464
  }
7288
7465
  /**
@@ -7332,7 +7509,7 @@ function addDefaultDeletionPolicy(resource) {
7332
7509
  }
7333
7510
 
7334
7511
  // ../../aws-cdk/lib/api/resource-import/migrator.ts
7335
- var chalk13 = __toESM(require("chalk"));
7512
+ var chalk14 = __toESM(require("chalk"));
7336
7513
  var fs12 = __toESM(require("fs-extra"));
7337
7514
  var ResourceMigrator = class {
7338
7515
  constructor(props) {
@@ -7355,11 +7532,11 @@ var ResourceMigrator = class {
7355
7532
  });
7356
7533
  const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
7357
7534
  if (resourcesToImport) {
7358
- await this.ioHost.notify(info2(this.action, `${chalk13.bold(stack.displayName)}: creating stack for resource migration...`));
7359
- await this.ioHost.notify(info2(this.action, `${chalk13.bold(stack.displayName)}: importing resources into stack...`));
7535
+ await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
7536
+ await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: importing resources into stack...`));
7360
7537
  await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
7361
7538
  fs12.rmSync("migrate.json");
7362
- await this.ioHost.notify(info2(this.action, `${chalk13.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
7539
+ await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
7363
7540
  }
7364
7541
  }
7365
7542
  /**
@@ -7372,7 +7549,6 @@ var ResourceMigrator = class {
7372
7549
  roleArn: options.roleArn,
7373
7550
  deploymentMethod: options.deploymentMethod,
7374
7551
  usePreviousParameters: true,
7375
- progress: options.progress,
7376
7552
  rollback: options.rollback
7377
7553
  });
7378
7554
  elapsedDeployTime = (/* @__PURE__ */ new Date()).getTime() - startDeployTime;
@@ -7398,8 +7574,8 @@ var ResourceMigrator = class {
7398
7574
  };
7399
7575
 
7400
7576
  // ../../aws-cdk/lib/api/logs/logs-monitor.ts
7401
- var util4 = __toESM(require("util"));
7402
- var chalk14 = __toESM(require("chalk"));
7577
+ var util7 = __toESM(require("util"));
7578
+ var chalk15 = __toESM(require("chalk"));
7403
7579
  var SLEEP = 2e3;
7404
7580
  var CloudWatchLogEventMonitor = class {
7405
7581
  constructor(startTime) {
@@ -7490,10 +7666,10 @@ var CloudWatchLogEventMonitor = class {
7490
7666
  */
7491
7667
  print(event) {
7492
7668
  info(
7493
- util4.format(
7669
+ util7.format(
7494
7670
  "[%s] %s %s",
7495
- chalk14.blue(event.logGroupName),
7496
- chalk14.yellow(event.timestamp.toLocaleTimeString()),
7671
+ chalk15.blue(event.logGroupName),
7672
+ chalk15.yellow(event.timestamp.toLocaleTimeString()),
7497
7673
  event.message.trim()
7498
7674
  )
7499
7675
  );
@@ -8086,8 +8262,8 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
8086
8262
  };
8087
8263
  function stacksFromAssets(artifacts) {
8088
8264
  const ret = /* @__PURE__ */ new Map();
8089
- for (const stack of artifacts.filter(cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact)) {
8090
- const assetArtifacts = stack.dependencies.filter(cxapi3.AssetManifestArtifact.isAssetManifestArtifact);
8265
+ for (const stack of artifacts.filter((x) => cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact(x))) {
8266
+ const assetArtifacts = stack.dependencies.filter((x) => cxapi3.AssetManifestArtifact.isAssetManifestArtifact(x));
8091
8267
  for (const art of assetArtifacts) {
8092
8268
  ret.set(art, stack);
8093
8269
  }
@@ -8095,7 +8271,7 @@ function stacksFromAssets(artifacts) {
8095
8271
  return ret;
8096
8272
  }
8097
8273
  function onlyStacks(artifacts) {
8098
- return artifacts.filter(cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact);
8274
+ return artifacts.filter((x) => cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact(x));
8099
8275
  }
8100
8276
 
8101
8277
  // ../../aws-cdk/lib/context-providers/index.ts
@@ -8279,7 +8455,7 @@ var CcApiContextProviderPlugin = class {
8279
8455
  }
8280
8456
  });
8281
8457
  } catch (err) {
8282
- throw new ContextProviderError(`Could not get resources ${propertyMatch}. Error: ${err}`);
8458
+ throw new ContextProviderError(`Could not get resources ${JSON.stringify(propertyMatch)}. Error: ${err}`);
8283
8459
  }
8284
8460
  return resultObjs;
8285
8461
  }
@@ -9158,7 +9334,7 @@ function processExists(pid) {
9158
9334
 
9159
9335
  // ../../aws-cdk/lib/api/cxapp/cloud-assembly.ts
9160
9336
  var import_cx_api8 = require("@aws-cdk/cx-api");
9161
- var chalk15 = __toESM(require("chalk"));
9337
+ var chalk16 = __toESM(require("chalk"));
9162
9338
  var import_minimatch = require("minimatch");
9163
9339
  var semver5 = __toESM(require("semver"));
9164
9340
  var ExtendedStackSelection = /* @__PURE__ */ ((ExtendedStackSelection2) => {
@@ -9363,7 +9539,7 @@ function includeDownstreamStacks(selectedStacks, allStacks) {
9363
9539
  }
9364
9540
  } while (madeProgress);
9365
9541
  if (added.length > 0) {
9366
- info("Including depending stacks: %s", chalk15.bold(added.join(", ")));
9542
+ info("Including depending stacks: %s", chalk16.bold(added.join(", ")));
9367
9543
  }
9368
9544
  }
9369
9545
  function includeUpstreamStacks(selectedStacks, allStacks) {
@@ -9382,7 +9558,7 @@ function includeUpstreamStacks(selectedStacks, allStacks) {
9382
9558
  }
9383
9559
  }
9384
9560
  if (added.length > 0) {
9385
- info("Including dependency stacks: %s", chalk15.bold(added.join(", ")));
9561
+ info("Including dependency stacks: %s", chalk16.bold(added.join(", ")));
9386
9562
  }
9387
9563
  }
9388
9564
  function sanitizePatterns(patterns) {
@@ -9487,7 +9663,6 @@ function spaceAvailableForContext(env, limit) {
9487
9663
  ResourceMigrator,
9488
9664
  SdkProvider,
9489
9665
  Settings,
9490
- StackActivityProgress,
9491
9666
  StackCollection,
9492
9667
  WorkGraphBuilder,
9493
9668
  contextproviders,