@aws-cdk/toolkit-lib 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/build-info.json +2 -2
  2. package/db.json.gz +0 -0
  3. package/lib/actions/bootstrap/index.d.ts +174 -0
  4. package/lib/actions/bootstrap/index.js +94 -0
  5. package/lib/actions/bootstrap/private/helpers.d.ts +5 -0
  6. package/lib/actions/bootstrap/private/helpers.js +23 -0
  7. package/lib/actions/bootstrap/private/index.d.ts +1 -0
  8. package/lib/actions/bootstrap/private/index.js +18 -0
  9. package/lib/actions/deploy/index.d.ts +4 -2
  10. package/lib/actions/deploy/index.js +4 -1
  11. package/lib/actions/deploy/private/deploy-options.d.ts +1 -1
  12. package/lib/actions/deploy/private/deploy-options.js +1 -1
  13. package/lib/actions/deploy/private/helpers.d.ts +3 -2
  14. package/lib/actions/deploy/private/helpers.js +1 -1
  15. package/lib/actions/destroy/index.d.ts +1 -1
  16. package/lib/actions/destroy/index.js +1 -1
  17. package/lib/actions/diff/private/helpers.d.ts +5 -5
  18. package/lib/actions/diff/private/helpers.js +13 -11
  19. package/lib/actions/index.d.ts +1 -0
  20. package/lib/actions/index.js +2 -1
  21. package/lib/api/aws-cdk.d.ts +5 -9
  22. package/lib/api/aws-cdk.js +1593 -735
  23. package/lib/api/aws-cdk.js.map +4 -4
  24. package/lib/api/bootstrap/bootstrap-template.yaml +707 -0
  25. package/lib/api/cloud-assembly/index.d.ts +1 -1
  26. package/lib/api/cloud-assembly/index.js +2 -2
  27. package/lib/api/cloud-assembly/private/cached-source.d.ts +2 -2
  28. package/lib/api/cloud-assembly/private/cached-source.js +1 -1
  29. package/lib/api/cloud-assembly/private/context-aware-source.d.ts +4 -4
  30. package/lib/api/cloud-assembly/private/context-aware-source.js +11 -12
  31. package/lib/api/cloud-assembly/private/identity-source.d.ts +1 -1
  32. package/lib/api/cloud-assembly/private/identity-source.js +1 -1
  33. package/lib/api/cloud-assembly/private/prepare-source.d.ts +5 -5
  34. package/lib/api/cloud-assembly/private/prepare-source.js +10 -7
  35. package/lib/api/cloud-assembly/private/source-builder.d.ts +4 -4
  36. package/lib/api/cloud-assembly/private/source-builder.js +24 -12
  37. package/lib/api/cloud-assembly/private/stack-assembly.d.ts +3 -3
  38. package/lib/api/cloud-assembly/private/stack-assembly.js +1 -1
  39. package/lib/api/cloud-assembly/private/stack-selectors.d.ts +1 -1
  40. package/lib/api/cloud-assembly/private/stack-selectors.js +1 -1
  41. package/lib/api/cloud-assembly/source-builder.d.ts +36 -0
  42. package/lib/api/cloud-assembly/source-builder.js +1 -1
  43. package/lib/api/cloud-assembly/stack-selector.d.ts +2 -81
  44. package/lib/api/cloud-assembly/stack-selector.js +5 -62
  45. package/lib/api/io/index.d.ts +1 -2
  46. package/lib/api/io/index.js +1 -17
  47. package/lib/api/io/private/index.d.ts +3 -6
  48. package/lib/api/io/private/index.js +7 -7
  49. package/lib/api/io/private/io-host-wrappers.d.ts +17 -0
  50. package/lib/api/io/private/io-host-wrappers.js +74 -0
  51. package/lib/api/io/private/sdk-logger.d.ts +3 -0
  52. package/lib/api/io/private/sdk-logger.js +124 -0
  53. package/lib/api/shared-private.d.ts +1 -0
  54. package/lib/api/shared-private.js +711 -0
  55. package/lib/api/shared-private.js.map +7 -0
  56. package/lib/api/shared-public.d.ts +2464 -1
  57. package/lib/api/shared-public.js +78 -5
  58. package/lib/api/shared-public.js.map +4 -4
  59. package/lib/index.d.ts +3 -0
  60. package/lib/index.js +4 -1
  61. package/lib/private/util.d.ts +1 -0
  62. package/lib/private/util.js +720 -0
  63. package/lib/private/util.js.map +7 -0
  64. package/lib/toolkit/index.d.ts +1 -1
  65. package/lib/toolkit/index.js +2 -2
  66. package/lib/toolkit/private/index.d.ts +12 -3
  67. package/lib/toolkit/private/index.js +18 -1
  68. package/lib/toolkit/toolkit.d.ts +10 -16
  69. package/lib/toolkit/toolkit.js +205 -152
  70. package/lib/util/concurrency.d.ts +5 -0
  71. package/lib/util/concurrency.js +11 -0
  72. package/package.json +12 -11
  73. package/CODE_REGISTRY.md +0 -35
  74. package/lib/api/io/io-host.d.ts +0 -15
  75. package/lib/api/io/io-host.js +0 -3
  76. package/lib/api/io/io-message.d.ts +0 -59
  77. package/lib/api/io/io-message.js +0 -3
  78. package/lib/api/io/private/codes.d.ts +0 -67
  79. package/lib/api/io/private/codes.js +0 -187
  80. package/lib/api/io/private/level-priority.d.ts +0 -11
  81. package/lib/api/io/private/level-priority.js +0 -33
  82. package/lib/api/io/private/logger.d.ts +0 -40
  83. package/lib/api/io/private/logger.js +0 -211
  84. package/lib/api/io/private/messages.d.ts +0 -58
  85. package/lib/api/io/private/messages.js +0 -163
  86. package/lib/api/io/private/timer.d.ts +0 -29
  87. package/lib/api/io/private/timer.js +0 -55
  88. package/lib/api/io/private/types.d.ts +0 -25
  89. package/lib/api/io/private/types.js +0 -3
  90. package/lib/toolkit/types.d.ts +0 -76
  91. package/lib/toolkit/types.js +0 -3
@@ -27,17 +27,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var __decorateClass = (decorators, target, key, kind) => {
30
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
30
+ var result2 = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
31
31
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
32
32
  if (decorator = decorators[i])
33
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
34
- if (kind && result) __defProp(target, key, result);
35
- return result;
33
+ result2 = (kind ? decorator(target, key, result2) : decorator(result2)) || result2;
34
+ if (kind && result2) __defProp(target, key, result2);
35
+ return result2;
36
36
  };
37
37
 
38
38
  // lib/api/aws-cdk.ts
39
39
  var aws_cdk_exports = {};
40
40
  __export(aws_cdk_exports, {
41
+ Bootstrapper: () => Bootstrapper,
41
42
  CliIoHost: () => CliIoHost,
42
43
  CloudAssembly: () => CloudAssembly2,
43
44
  CloudWatchLogEventMonitor: () => CloudWatchLogEventMonitor,
@@ -57,21 +58,14 @@ __export(aws_cdk_exports, {
57
58
  WorkGraphBuilder: () => WorkGraphBuilder,
58
59
  contextproviders: () => context_providers_exports,
59
60
  findCloudWatchLogGroups: () => findCloudWatchLogGroups,
60
- formatErrorMessage: () => formatErrorMessage,
61
- formatSdkLoggerContent: () => formatSdkLoggerContent,
62
- formatTime: () => formatTime,
63
61
  guessExecutable: () => guessExecutable,
64
62
  loadTree: () => loadTree,
65
- obscureTemplate: () => obscureTemplate,
66
63
  prepareContext: () => prepareContext,
67
64
  prepareDefaultEnvironment: () => prepareDefaultEnvironment,
68
65
  sanitizePatterns: () => sanitizePatterns,
69
- serializeStructure: () => serializeStructure,
70
66
  some: () => some,
71
67
  spaceAvailableForContext: () => spaceAvailableForContext,
72
- splitBySize: () => splitBySize,
73
68
  tagsForStack: () => tagsForStack,
74
- validateSnsTopicArn: () => validateSnsTopicArn,
75
69
  versionNumber: () => versionNumber
76
70
  });
77
71
  module.exports = __toCommonJS(aws_cdk_exports);
@@ -109,14 +103,15 @@ var chalk4 = __toESM(require("chalk"));
109
103
 
110
104
  // ../../aws-cdk/lib/toolkit/cli-io-host.ts
111
105
  var util3 = __toESM(require("node:util"));
106
+ var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
112
107
  var chalk3 = __toESM(require("chalk"));
113
108
  var promptly = __toESM(require("promptly"));
114
109
 
115
110
  // ../tmp-toolkit-helpers/src/api/toolkit-error.ts
116
- var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.ToolkitError");
117
- var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AuthenticationError");
118
- var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AssemblyError");
119
- var CONTEXT_PROVIDER_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.ContextProviderError");
111
+ var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ToolkitError");
112
+ var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AuthenticationError");
113
+ var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AssemblyError");
114
+ var CONTEXT_PROVIDER_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ContextProviderError");
120
115
  var ToolkitError = class _ToolkitError extends Error {
121
116
  /**
122
117
  * Determines if a given error is an instance of ToolkitError.
@@ -146,52 +141,97 @@ var ToolkitError = class _ToolkitError extends Error {
146
141
  * The type of the error, defaults to "toolkit".
147
142
  */
148
143
  type;
149
- constructor(message, type = "toolkit") {
150
- super(message);
144
+ /**
145
+ * Denotes the source of the error as the toolkit.
146
+ */
147
+ source;
148
+ constructor(message2, type = "toolkit") {
149
+ super(message2);
151
150
  Object.setPrototypeOf(this, _ToolkitError.prototype);
152
151
  Object.defineProperty(this, TOOLKIT_ERROR_SYMBOL, { value: true });
153
152
  this.name = new.target.name;
154
153
  this.type = type;
154
+ this.source = "toolkit";
155
155
  }
156
156
  };
157
157
  var AuthenticationError = class _AuthenticationError extends ToolkitError {
158
- constructor(message) {
159
- super(message, "authentication");
158
+ /**
159
+ * Denotes the source of the error as user.
160
+ */
161
+ source = "user";
162
+ constructor(message2) {
163
+ super(message2, "authentication");
160
164
  Object.setPrototypeOf(this, _AuthenticationError.prototype);
161
165
  Object.defineProperty(this, AUTHENTICATION_ERROR_SYMBOL, { value: true });
162
166
  }
163
167
  };
164
168
  var AssemblyError = class _AssemblyError extends ToolkitError {
165
- constructor(message) {
166
- super(message, "assembly");
169
+ /**
170
+ * An AssemblyError with an original error as cause
171
+ */
172
+ static withCause(message2, error4) {
173
+ return new _AssemblyError(message2, void 0, error4);
174
+ }
175
+ /**
176
+ * An AssemblyError with a list of stacks as cause
177
+ */
178
+ static withStacks(message2, stacks) {
179
+ return new _AssemblyError(message2, stacks);
180
+ }
181
+ /**
182
+ * Denotes the source of the error as user.
183
+ */
184
+ source = "user";
185
+ /**
186
+ * The stacks that caused the error, if available
187
+ *
188
+ * The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
189
+ * Absence indicates synthesis didn't fully complete.
190
+ */
191
+ stacks;
192
+ /**
193
+ * The specific original cause of the error, if available
194
+ */
195
+ cause;
196
+ constructor(message2, stacks, cause) {
197
+ super(message2, "assembly");
167
198
  Object.setPrototypeOf(this, _AssemblyError.prototype);
168
199
  Object.defineProperty(this, ASSEMBLY_ERROR_SYMBOL, { value: true });
200
+ this.stacks = stacks;
201
+ this.cause = cause;
169
202
  }
170
203
  };
171
204
  var ContextProviderError = class _ContextProviderError extends ToolkitError {
172
- constructor(message) {
173
- super(message, "context-provider");
205
+ /**
206
+ * Denotes the source of the error as user.
207
+ */
208
+ source = "user";
209
+ constructor(message2) {
210
+ super(message2, "context-provider");
174
211
  Object.setPrototypeOf(this, _ContextProviderError.prototype);
175
212
  Object.defineProperty(this, CONTEXT_PROVIDER_ERROR_SYMBOL, { value: true });
176
213
  }
177
214
  };
178
215
 
179
- // ../../aws-cdk/lib/util/archive.ts
216
+ // ../tmp-toolkit-helpers/src/api/io/private/span.ts
217
+ var uuid = __toESM(require("uuid"));
218
+
219
+ // ../tmp-toolkit-helpers/src/util/archive.ts
180
220
  var glob = __toESM(require("glob"));
181
221
 
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");
222
+ // ../tmp-toolkit-helpers/src/util/format-error.ts
223
+ function formatErrorMessage(error4) {
224
+ if (error4 && Array.isArray(error4.errors)) {
225
+ const innerMessages = error4.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
186
226
  return `AggregateError: ${innerMessages}`;
187
227
  }
188
- return error3?.message || error3?.toString() || "Unknown error";
228
+ return error4?.message || error4?.toString() || "Unknown error";
189
229
  }
190
230
 
191
- // ../../aws-cdk/lib/util/archive.ts
231
+ // ../tmp-toolkit-helpers/src/util/archive.ts
192
232
  var archiver = require("archiver");
193
233
 
194
- // ../../aws-cdk/lib/util/arrays.ts
234
+ // ../tmp-toolkit-helpers/src/util/arrays.ts
195
235
  function flatMap(xs, fn) {
196
236
  return flatten(xs.map(fn));
197
237
  }
@@ -199,22 +239,7 @@ function flatten(xs) {
199
239
  return Array.prototype.concat.apply([], xs);
200
240
  }
201
241
 
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";
207
- }
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
- }
242
+ // ../tmp-toolkit-helpers/src/util/cloudformation.ts
218
243
  function stackEventHasErrorMessage(status) {
219
244
  return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
220
245
  }
@@ -230,7 +255,7 @@ function maxResourceTypeLength(template, startWidth = "AWS::CloudFormation::Stac
230
255
  return maxWidth;
231
256
  }
232
257
 
233
- // ../../aws-cdk/lib/util/content-hash.ts
258
+ // ../tmp-toolkit-helpers/src/util/content-hash.ts
234
259
  var crypto = __toESM(require("crypto"));
235
260
  function contentHash(data) {
236
261
  return crypto.createHash("sha256").update(data).digest("hex");
@@ -267,13 +292,71 @@ function contentHashAny(value) {
267
292
  }
268
293
  }
269
294
 
270
- // ../../aws-cdk/lib/util/types.ts
295
+ // ../tmp-toolkit-helpers/src/util/directories.ts
296
+ var fs = __toESM(require("fs"));
297
+ var os = __toESM(require("os"));
298
+ var path = __toESM(require("path"));
299
+ function cdkHomeDir() {
300
+ const tmpDir = fs.realpathSync(os.tmpdir());
301
+ let home;
302
+ try {
303
+ let userInfoHome = os.userInfo().homedir;
304
+ if (userInfoHome == "/var/empty") {
305
+ userInfoHome = void 0;
306
+ }
307
+ home = path.join((userInfoHome ?? os.homedir()).trim(), ".cdk");
308
+ } catch {
309
+ }
310
+ return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home || fs.mkdtempSync(path.join(tmpDir, ".cdk")).trim();
311
+ }
312
+ function cdkCacheDir() {
313
+ return path.join(cdkHomeDir(), "cache");
314
+ }
315
+ function bundledPackageRootDir(start, fail) {
316
+ function _rootDir(dirname6) {
317
+ const manifestPath = path.join(dirname6, "package.json");
318
+ if (fs.existsSync(manifestPath)) {
319
+ return dirname6;
320
+ }
321
+ if (path.dirname(dirname6) === dirname6) {
322
+ if (fail ?? true) {
323
+ throw new ToolkitError("Unable to find package manifest");
324
+ }
325
+ return void 0;
326
+ }
327
+ return _rootDir(path.dirname(dirname6));
328
+ }
329
+ return _rootDir(start);
330
+ }
331
+
332
+ // ../tmp-toolkit-helpers/src/util/json.ts
333
+ function getResultObj(jsonObject, identifier, propertiesToReturn) {
334
+ const propsObj = {};
335
+ propertiesToReturn.forEach((propName) => {
336
+ Object.assign(propsObj, { [propName]: findJsonValue(jsonObject, propName) });
337
+ });
338
+ Object.assign(propsObj, { ["Identifier"]: identifier });
339
+ return propsObj;
340
+ }
341
+ function findJsonValue(jsonObject, path15) {
342
+ const paths = path15.split(".");
343
+ let obj = jsonObject;
344
+ paths.forEach((p) => {
345
+ obj = obj[p];
346
+ if (obj === void 0) {
347
+ throw new TypeError(`Cannot read field ${path15}. ${p} is not found.`);
348
+ }
349
+ });
350
+ return obj;
351
+ }
352
+
353
+ // ../tmp-toolkit-helpers/src/util/types.ts
271
354
  function isObject(x) {
272
355
  return x !== null && typeof x === "object" && !isArray(x);
273
356
  }
274
357
  var isArray = Array.isArray;
275
358
 
276
- // ../../aws-cdk/lib/util/objects.ts
359
+ // ../tmp-toolkit-helpers/src/util/objects.ts
277
360
  function deepClone(x) {
278
361
  if (typeof x === "undefined") {
279
362
  return void 0;
@@ -303,21 +386,21 @@ function makeObject(pairs) {
303
386
  }
304
387
  return ret;
305
388
  }
306
- function deepGet(x, path12) {
307
- path12 = path12.slice();
308
- while (path12.length > 0 && isObject(x)) {
309
- const key = path12.shift();
389
+ function deepGet(x, path15) {
390
+ path15 = path15.slice();
391
+ while (path15.length > 0 && isObject(x)) {
392
+ const key = path15.shift();
310
393
  x = x[key];
311
394
  }
312
- return path12.length === 0 ? x : void 0;
395
+ return path15.length === 0 ? x : void 0;
313
396
  }
314
- function deepSet(x, path12, value) {
315
- path12 = path12.slice();
316
- if (path12.length === 0) {
397
+ function deepSet(x, path15, value) {
398
+ path15 = path15.slice();
399
+ if (path15.length === 0) {
317
400
  throw new ToolkitError("Path may not be empty");
318
401
  }
319
- while (path12.length > 1 && isObject(x)) {
320
- const key = path12.shift();
402
+ while (path15.length > 1 && isObject(x)) {
403
+ const key = path15.shift();
321
404
  if (!(key in x)) {
322
405
  x[key] = {};
323
406
  }
@@ -327,9 +410,9 @@ function deepSet(x, path12, value) {
327
410
  throw new ToolkitError(`Expected an object, got '${x}'`);
328
411
  }
329
412
  if (value !== void 0) {
330
- x[path12[0]] = value;
413
+ x[path15[0]] = value;
331
414
  } else {
332
- delete x[path12[0]];
415
+ delete x[path15[0]];
333
416
  }
334
417
  }
335
418
  function deepMerge(...objects) {
@@ -357,48 +440,25 @@ function deepMerge(...objects) {
357
440
  others.forEach((other) => mergeOne(into, other));
358
441
  return into;
359
442
  }
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
443
 
384
- // ../../aws-cdk/lib/util/parallel.ts
444
+ // ../tmp-toolkit-helpers/src/util/parallel.ts
385
445
  async function parallelPromises(n, promises) {
386
446
  const ret = new Array();
387
447
  let count = 0;
388
- let error3;
448
+ let error4;
389
449
  const queue = [...promises];
390
450
  return new Promise((ok, ko) => {
391
451
  tick();
392
452
  function tick() {
393
- if (count === 0 && error3) {
394
- ko(error3);
453
+ if (count === 0 && error4) {
454
+ ko(error4);
395
455
  return;
396
456
  }
397
457
  if (count === 0 && queue.length === 0) {
398
458
  ok(ret);
399
459
  return;
400
460
  }
401
- while (count < n && queue.length > 0 && !error3) {
461
+ while (count < n && queue.length > 0 && !error4) {
402
462
  const next = queue.shift();
403
463
  if (next !== void 0) {
404
464
  start(next);
@@ -407,10 +467,10 @@ async function parallelPromises(n, promises) {
407
467
  }
408
468
  function start(fn) {
409
469
  count += 1;
410
- fn().then((result) => {
411
- ret.push(result);
470
+ fn().then((result2) => {
471
+ ret.push(result2);
412
472
  }).catch((e) => {
413
- error3 = e;
473
+ error4 = e;
414
474
  }).finally(() => {
415
475
  count -= 1;
416
476
  tick();
@@ -419,10 +479,10 @@ async function parallelPromises(n, promises) {
419
479
  });
420
480
  }
421
481
 
422
- // ../../aws-cdk/lib/util/serialize.ts
423
- var fs = __toESM(require("fs-extra"));
482
+ // ../tmp-toolkit-helpers/src/util/serialize.ts
483
+ var fs2 = __toESM(require("fs/promises"));
424
484
 
425
- // ../../aws-cdk/lib/util/yaml-cfn.ts
485
+ // ../tmp-toolkit-helpers/src/util/yaml-cfn.ts
426
486
  var yaml = __toESM(require("yaml"));
427
487
  var yaml_types = __toESM(require("yaml/types"));
428
488
  function serialize(obj) {
@@ -479,7 +539,7 @@ function parseYamlStrWithCfnTags(text) {
479
539
  });
480
540
  }
481
541
 
482
- // ../../aws-cdk/lib/util/serialize.ts
542
+ // ../tmp-toolkit-helpers/src/util/serialize.ts
483
543
  function toYAML(obj) {
484
544
  return serialize(obj);
485
545
  }
@@ -493,29 +553,12 @@ function serializeStructure(object, json) {
493
553
  return toYAML(object);
494
554
  }
495
555
  }
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;
556
+ async function loadStructuredFile(fileName) {
557
+ const contents = await fs2.readFile(fileName, { encoding: "utf-8" });
558
+ return deserializeStructure(contents);
516
559
  }
517
560
 
518
- // ../../aws-cdk/lib/util/string-manipulation.ts
561
+ // ../tmp-toolkit-helpers/src/util/string-manipulation.ts
519
562
  function padLeft(n, x, char = " ") {
520
563
  return char.repeat(Math.max(0, n - x.length)) + x;
521
564
  }
@@ -532,9 +575,468 @@ function millisecondsToSeconds(num) {
532
575
  return num / 1e3;
533
576
  }
534
577
 
535
- // ../../aws-cdk/lib/util/version-range.ts
578
+ // ../tmp-toolkit-helpers/src/util/version-range.ts
536
579
  var semver = __toESM(require("semver"));
537
580
 
581
+ // ../tmp-toolkit-helpers/src/api/io/private/level-priority.ts
582
+ var levels = [
583
+ "trace",
584
+ "debug",
585
+ "info",
586
+ "warn",
587
+ "result",
588
+ "error"
589
+ ];
590
+ var orderedLevels = Object.fromEntries(Object.entries(levels).map((a) => a.reverse()));
591
+ function compareFn(a, b) {
592
+ return orderedLevels[a] - orderedLevels[b];
593
+ }
594
+ function isMessageRelevantForLevel(msg, level) {
595
+ return compareFn(msg.level, level) >= 0;
596
+ }
597
+
598
+ // ../tmp-toolkit-helpers/src/api/io/private/message-maker.ts
599
+ function message(level, details) {
600
+ const maker = (text, data) => ({
601
+ time: /* @__PURE__ */ new Date(),
602
+ level,
603
+ code: details.code,
604
+ message: text,
605
+ data
606
+ });
607
+ return {
608
+ ...details,
609
+ level,
610
+ msg: maker,
611
+ is: (m) => m.code === details.code
612
+ };
613
+ }
614
+ var trace = (details) => message("trace", details);
615
+ var debug = (details) => message("debug", details);
616
+ var info = (details) => message("info", details);
617
+ var warn = (details) => message("warn", details);
618
+ var error = (details) => message("error", details);
619
+ var result = (details) => message("result", details);
620
+ function request(level, details) {
621
+ const maker = (text, data) => ({
622
+ time: /* @__PURE__ */ new Date(),
623
+ level,
624
+ code: details.code,
625
+ message: text,
626
+ data,
627
+ defaultResponse: details.defaultResponse
628
+ });
629
+ return {
630
+ ...details,
631
+ level,
632
+ req: maker
633
+ };
634
+ }
635
+ var confirm = (details) => request("info", {
636
+ ...details,
637
+ defaultResponse: true
638
+ });
639
+
640
+ // ../tmp-toolkit-helpers/src/api/io/private/messages.ts
641
+ var IO = {
642
+ // Defaults
643
+ DEFAULT_TOOLKIT_INFO: info({
644
+ code: "CDK_TOOLKIT_I0000",
645
+ description: "Default info messages emitted from the Toolkit"
646
+ }),
647
+ DEFAULT_TOOLKIT_DEBUG: debug({
648
+ code: "CDK_TOOLKIT_I0000",
649
+ description: "Default debug messages emitted from the Toolkit"
650
+ }),
651
+ DEFAULT_TOOLKIT_WARN: warn({
652
+ code: "CDK_TOOLKIT_W0000",
653
+ description: "Default warning messages emitted from the Toolkit"
654
+ }),
655
+ // 1: Synth
656
+ CDK_TOOLKIT_I1000: info({
657
+ code: "CDK_TOOLKIT_I1000",
658
+ description: "Provides synthesis times.",
659
+ interface: "Duration"
660
+ }),
661
+ CDK_TOOLKIT_I1001: trace({
662
+ code: "CDK_TOOLKIT_I1001",
663
+ description: "Cloud Assembly synthesis is starting",
664
+ interface: "StackSelectionDetails"
665
+ }),
666
+ CDK_TOOLKIT_I1901: result({
667
+ code: "CDK_TOOLKIT_I1901",
668
+ description: "Provides stack data",
669
+ interface: "StackAndAssemblyData"
670
+ }),
671
+ CDK_TOOLKIT_I1902: result({
672
+ code: "CDK_TOOLKIT_I1902",
673
+ description: "Successfully deployed stacks",
674
+ interface: "AssemblyData"
675
+ }),
676
+ // 2: List
677
+ CDK_TOOLKIT_I2901: result({
678
+ code: "CDK_TOOLKIT_I2901",
679
+ description: "Provides details on the selected stacks and their dependencies",
680
+ interface: "StackDetailsPayload"
681
+ }),
682
+ // 3: Import & Migrate
683
+ CDK_TOOLKIT_E3900: error({
684
+ code: "CDK_TOOLKIT_E3900",
685
+ description: "Resource import failed"
686
+ }),
687
+ // 4: Diff
688
+ // 5: Deploy & Watch
689
+ CDK_TOOLKIT_I5000: info({
690
+ code: "CDK_TOOLKIT_I5000",
691
+ description: "Provides deployment times",
692
+ interface: "Duration"
693
+ }),
694
+ CDK_TOOLKIT_I5001: info({
695
+ code: "CDK_TOOLKIT_I5001",
696
+ description: "Provides total time in deploy action, including synth and rollback",
697
+ interface: "Duration"
698
+ }),
699
+ CDK_TOOLKIT_I5002: info({
700
+ code: "CDK_TOOLKIT_I5002",
701
+ description: "Provides time for resource migration"
702
+ }),
703
+ CDK_TOOLKIT_W5021: warn({
704
+ code: "CDK_TOOLKIT_W5021",
705
+ description: "Empty non-existent stack, deployment is skipped"
706
+ }),
707
+ CDK_TOOLKIT_W5022: warn({
708
+ code: "CDK_TOOLKIT_W5022",
709
+ description: "Empty existing stack, stack will be destroyed"
710
+ }),
711
+ CDK_TOOLKIT_I5031: info({
712
+ code: "CDK_TOOLKIT_I5031",
713
+ description: "Informs about any log groups that are traced as part of the deployment"
714
+ }),
715
+ CDK_TOOLKIT_I5032: debug({
716
+ code: "CDK_TOOLKIT_I5032",
717
+ description: "Start monitoring log groups",
718
+ interface: "CloudWatchLogMonitorControlEvent"
719
+ }),
720
+ CDK_TOOLKIT_I5033: info({
721
+ code: "CDK_TOOLKIT_I5033",
722
+ description: "A log event received from Cloud Watch",
723
+ interface: "CloudWatchLogEvent"
724
+ }),
725
+ CDK_TOOLKIT_I5034: debug({
726
+ code: "CDK_TOOLKIT_I5034",
727
+ description: "Stop monitoring log groups",
728
+ interface: "CloudWatchLogMonitorControlEvent"
729
+ }),
730
+ CDK_TOOLKIT_E5035: error({
731
+ code: "CDK_TOOLKIT_E5035",
732
+ description: "A log monitoring error",
733
+ interface: "ErrorPayload"
734
+ }),
735
+ CDK_TOOLKIT_I5050: confirm({
736
+ code: "CDK_TOOLKIT_I5050",
737
+ description: "Confirm rollback during deployment",
738
+ interface: "ConfirmationRequest"
739
+ }),
740
+ CDK_TOOLKIT_I5060: confirm({
741
+ code: "CDK_TOOLKIT_I5060",
742
+ description: "Confirm deploy security sensitive changes",
743
+ interface: "DeployConfirmationRequest"
744
+ }),
745
+ CDK_TOOLKIT_I5100: info({
746
+ code: "CDK_TOOLKIT_I5100",
747
+ description: "Stack deploy progress",
748
+ interface: "StackDeployProgress"
749
+ }),
750
+ // Assets
751
+ CDK_TOOLKIT_I5210: trace({
752
+ code: "CDK_TOOLKIT_I5210",
753
+ description: "Started building a specific asset",
754
+ interface: "BuildAsset"
755
+ }),
756
+ CDK_TOOLKIT_I5211: trace({
757
+ code: "CDK_TOOLKIT_I5211",
758
+ description: "Building the asset has completed",
759
+ interface: "Duration"
760
+ }),
761
+ CDK_TOOLKIT_I5220: trace({
762
+ code: "CDK_TOOLKIT_I5220",
763
+ description: "Started publishing a specific asset",
764
+ interface: "PublishAsset"
765
+ }),
766
+ CDK_TOOLKIT_I5221: trace({
767
+ code: "CDK_TOOLKIT_I5221",
768
+ description: "Publishing the asset has completed",
769
+ interface: "Duration"
770
+ }),
771
+ // Watch
772
+ CDK_TOOLKIT_I5310: debug({
773
+ code: "CDK_TOOLKIT_I5310",
774
+ description: "The computed settings used for file watching",
775
+ interface: "WatchSettings"
776
+ }),
777
+ CDK_TOOLKIT_I5311: info({
778
+ code: "CDK_TOOLKIT_I5311",
779
+ description: "File watching started",
780
+ interface: "FileWatchEvent"
781
+ }),
782
+ CDK_TOOLKIT_I5312: info({
783
+ code: "CDK_TOOLKIT_I5312",
784
+ description: "File event detected, starting deployment",
785
+ interface: "FileWatchEvent"
786
+ }),
787
+ CDK_TOOLKIT_I5313: info({
788
+ code: "CDK_TOOLKIT_I5313",
789
+ description: "File event detected during active deployment, changes are queued",
790
+ interface: "FileWatchEvent"
791
+ }),
792
+ CDK_TOOLKIT_I5314: info({
793
+ code: "CDK_TOOLKIT_I5314",
794
+ description: "Initial watch deployment started"
795
+ }),
796
+ CDK_TOOLKIT_I5315: info({
797
+ code: "CDK_TOOLKIT_I5315",
798
+ description: "Queued watch deployment started"
799
+ }),
800
+ // Stack Monitor
801
+ CDK_TOOLKIT_I5501: info({
802
+ code: "CDK_TOOLKIT_I5501",
803
+ description: "Stack Monitoring: Start monitoring of a single stack",
804
+ interface: "StackMonitoringControlEvent"
805
+ }),
806
+ CDK_TOOLKIT_I5502: info({
807
+ code: "CDK_TOOLKIT_I5502",
808
+ description: "Stack Monitoring: Activity event for a single stack",
809
+ interface: "StackActivity"
810
+ }),
811
+ CDK_TOOLKIT_I5503: info({
812
+ code: "CDK_TOOLKIT_I5503",
813
+ description: "Stack Monitoring: Finished monitoring of a single stack",
814
+ interface: "StackMonitoringControlEvent"
815
+ }),
816
+ // Success
817
+ CDK_TOOLKIT_I5900: result({
818
+ code: "CDK_TOOLKIT_I5900",
819
+ description: "Deployment results on success",
820
+ interface: "SuccessfulDeployStackResult"
821
+ }),
822
+ CDK_TOOLKIT_I5901: info({
823
+ code: "CDK_TOOLKIT_I5901",
824
+ description: "Generic deployment success messages"
825
+ }),
826
+ CDK_TOOLKIT_W5400: warn({
827
+ code: "CDK_TOOLKIT_W5400",
828
+ description: "Hotswap disclosure message"
829
+ }),
830
+ // errors
831
+ CDK_TOOLKIT_E5001: error({
832
+ code: "CDK_TOOLKIT_E5001",
833
+ description: "No stacks found"
834
+ }),
835
+ CDK_TOOLKIT_E5500: error({
836
+ code: "CDK_TOOLKIT_E5500",
837
+ description: "Stack Monitoring error",
838
+ interface: "ErrorPayload"
839
+ }),
840
+ // 6: Rollback
841
+ CDK_TOOLKIT_I6000: info({
842
+ code: "CDK_TOOLKIT_I6000",
843
+ description: "Provides rollback times",
844
+ interface: "Duration"
845
+ }),
846
+ CDK_TOOLKIT_I6100: info({
847
+ code: "CDK_TOOLKIT_I6100",
848
+ description: "Stack rollback progress",
849
+ interface: "StackRollbackProgress"
850
+ }),
851
+ CDK_TOOLKIT_E6001: error({
852
+ code: "CDK_TOOLKIT_E6001",
853
+ description: "No stacks found"
854
+ }),
855
+ CDK_TOOLKIT_E6900: error({
856
+ code: "CDK_TOOLKIT_E6900",
857
+ description: "Rollback failed",
858
+ interface: "ErrorPayload"
859
+ }),
860
+ // 7: Destroy
861
+ CDK_TOOLKIT_I7000: info({
862
+ code: "CDK_TOOLKIT_I7000",
863
+ description: "Provides destroy times",
864
+ interface: "Duration"
865
+ }),
866
+ CDK_TOOLKIT_I7001: trace({
867
+ code: "CDK_TOOLKIT_I7001",
868
+ description: "Provides destroy time for a single stack",
869
+ interface: "Duration"
870
+ }),
871
+ CDK_TOOLKIT_I7010: confirm({
872
+ code: "CDK_TOOLKIT_I7010",
873
+ description: "Confirm destroy stacks",
874
+ interface: "ConfirmationRequest"
875
+ }),
876
+ CDK_TOOLKIT_I7100: info({
877
+ code: "CDK_TOOLKIT_I7100",
878
+ description: "Stack destroy progress",
879
+ interface: "StackDestroyProgress"
880
+ }),
881
+ CDK_TOOLKIT_I7101: trace({
882
+ code: "CDK_TOOLKIT_I7101",
883
+ description: "Start stack destroying",
884
+ interface: "StackDestroy"
885
+ }),
886
+ CDK_TOOLKIT_I7900: result({
887
+ code: "CDK_TOOLKIT_I7900",
888
+ description: "Stack deletion succeeded",
889
+ interface: "cxapi.CloudFormationStackArtifact"
890
+ }),
891
+ CDK_TOOLKIT_E7010: error({
892
+ code: "CDK_TOOLKIT_E7010",
893
+ description: "Action was aborted due to negative confirmation of request"
894
+ }),
895
+ CDK_TOOLKIT_E7900: error({
896
+ code: "CDK_TOOLKIT_E7900",
897
+ description: "Stack deletion failed",
898
+ interface: "ErrorPayload"
899
+ }),
900
+ // 9: Bootstrap
901
+ CDK_TOOLKIT_I9000: info({
902
+ code: "CDK_TOOLKIT_I9000",
903
+ description: "Provides bootstrap times",
904
+ interface: "Duration"
905
+ }),
906
+ CDK_TOOLKIT_I9100: info({
907
+ code: "CDK_TOOLKIT_I9100",
908
+ description: "Bootstrap progress",
909
+ interface: "BootstrapEnvironmentProgress"
910
+ }),
911
+ CDK_TOOLKIT_I9900: result({
912
+ code: "CDK_TOOLKIT_I9900",
913
+ description: "Bootstrap results on success",
914
+ interface: "cxapi.Environment"
915
+ }),
916
+ CDK_TOOLKIT_E9900: error({
917
+ code: "CDK_TOOLKIT_E9900",
918
+ description: "Bootstrap failed",
919
+ interface: "ErrorPayload"
920
+ }),
921
+ // Assembly codes
922
+ CDK_ASSEMBLY_I0010: debug({
923
+ code: "CDK_ASSEMBLY_I0010",
924
+ description: "Generic environment preparation debug messages"
925
+ }),
926
+ CDK_ASSEMBLY_W0010: warn({
927
+ code: "CDK_ASSEMBLY_W0010",
928
+ description: "Emitted if the found framework version does not support context overflow"
929
+ }),
930
+ CDK_ASSEMBLY_I0042: debug({
931
+ code: "CDK_ASSEMBLY_I0042",
932
+ description: "Writing updated context",
933
+ interface: "UpdatedContext"
934
+ }),
935
+ CDK_ASSEMBLY_I0240: debug({
936
+ code: "CDK_ASSEMBLY_I0240",
937
+ description: "Context lookup was stopped as no further progress was made. ",
938
+ interface: "MissingContext"
939
+ }),
940
+ CDK_ASSEMBLY_I0241: debug({
941
+ code: "CDK_ASSEMBLY_I0241",
942
+ description: "Fetching missing context. This is an iterative message that may appear multiple times with different missing keys.",
943
+ interface: "MissingContext"
944
+ }),
945
+ CDK_ASSEMBLY_I1000: debug({
946
+ code: "CDK_ASSEMBLY_I1000",
947
+ description: "Cloud assembly output starts"
948
+ }),
949
+ CDK_ASSEMBLY_I1001: info({
950
+ code: "CDK_ASSEMBLY_I1001",
951
+ description: "Output lines emitted by the cloud assembly to stdout"
952
+ }),
953
+ CDK_ASSEMBLY_E1002: error({
954
+ code: "CDK_ASSEMBLY_E1002",
955
+ description: "Output lines emitted by the cloud assembly to stderr"
956
+ }),
957
+ CDK_ASSEMBLY_I1003: info({
958
+ code: "CDK_ASSEMBLY_I1003",
959
+ description: "Cloud assembly output finished"
960
+ }),
961
+ CDK_ASSEMBLY_E1111: error({
962
+ code: "CDK_ASSEMBLY_E1111",
963
+ description: "Incompatible CDK CLI version. Upgrade needed.",
964
+ interface: "ErrorPayload"
965
+ }),
966
+ CDK_ASSEMBLY_I0150: debug({
967
+ code: "CDK_ASSEMBLY_I0150",
968
+ description: "Indicates the use of a pre-synthesized cloud assembly directory"
969
+ }),
970
+ // Assembly Annotations
971
+ CDK_ASSEMBLY_I9999: info({
972
+ code: "CDK_ASSEMBLY_I9999",
973
+ description: "Annotations emitted by the cloud assembly",
974
+ interface: "cxapi.SynthesisMessage"
975
+ }),
976
+ CDK_ASSEMBLY_W9999: warn({
977
+ code: "CDK_ASSEMBLY_W9999",
978
+ description: "Warnings emitted by the cloud assembly",
979
+ interface: "cxapi.SynthesisMessage"
980
+ }),
981
+ CDK_ASSEMBLY_E9999: error({
982
+ code: "CDK_ASSEMBLY_E9999",
983
+ description: "Errors emitted by the cloud assembly",
984
+ interface: "cxapi.SynthesisMessage"
985
+ }),
986
+ // SDK codes
987
+ CDK_SDK_I0000: trace({
988
+ code: "CDK_SDK_I0000",
989
+ description: "An SDK message."
990
+ }),
991
+ CDK_SDK_I0100: trace({
992
+ code: "CDK_SDK_I0100",
993
+ description: "An SDK trace. SDK traces are emitted as traces to the IoHost, but contain the original SDK logging level.",
994
+ interface: "SdkTrace"
995
+ })
996
+ };
997
+ var SPAN = {
998
+ SYNTH_ASSEMBLY: {
999
+ name: "Synthesis",
1000
+ start: IO.CDK_TOOLKIT_I1001,
1001
+ end: IO.CDK_TOOLKIT_I1000
1002
+ },
1003
+ DEPLOY_STACK: {
1004
+ name: "Deployment",
1005
+ start: IO.CDK_TOOLKIT_I5100,
1006
+ end: IO.CDK_TOOLKIT_I5001
1007
+ },
1008
+ ROLLBACK_STACK: {
1009
+ name: "Rollback",
1010
+ start: IO.CDK_TOOLKIT_I6100,
1011
+ end: IO.CDK_TOOLKIT_I6000
1012
+ },
1013
+ DESTROY_STACK: {
1014
+ name: "Destroy",
1015
+ start: IO.CDK_TOOLKIT_I7100,
1016
+ end: IO.CDK_TOOLKIT_I7001
1017
+ },
1018
+ DESTROY_ACTION: {
1019
+ name: "Destroy",
1020
+ start: IO.CDK_TOOLKIT_I7101,
1021
+ end: IO.CDK_TOOLKIT_I7000
1022
+ },
1023
+ BOOTSTRAP_SINGLE: {
1024
+ name: "Bootstrap",
1025
+ start: IO.CDK_TOOLKIT_I9100,
1026
+ end: IO.CDK_TOOLKIT_I9000
1027
+ },
1028
+ BUILD_ASSET: {
1029
+ name: "Build Asset",
1030
+ start: IO.CDK_TOOLKIT_I5210,
1031
+ end: IO.CDK_TOOLKIT_I5211
1032
+ },
1033
+ PUBLISH_ASSET: {
1034
+ name: "Publish Asset",
1035
+ start: IO.CDK_TOOLKIT_I5220,
1036
+ end: IO.CDK_TOOLKIT_I5221
1037
+ }
1038
+ };
1039
+
538
1040
  // ../../aws-cdk/lib/cli/activity-printer/base.ts
539
1041
  var ActivityPrinterBase = class {
540
1042
  constructor(props) {
@@ -562,14 +1064,14 @@ var ActivityPrinterBase = class {
562
1064
  * Receive a stack activity message
563
1065
  */
564
1066
  notify(msg) {
565
- switch (msg.code) {
566
- case "CDK_TOOLKIT_I5501":
1067
+ switch (true) {
1068
+ case IO.CDK_TOOLKIT_I5501.is(msg):
567
1069
  this.start(msg.data);
568
1070
  break;
569
- case "CDK_TOOLKIT_I5502":
1071
+ case IO.CDK_TOOLKIT_I5502.is(msg):
570
1072
  this.activity(msg.data);
571
1073
  break;
572
- case "CDK_TOOLKIT_I5503":
1074
+ case IO.CDK_TOOLKIT_I5503.is(msg):
573
1075
  this.stop();
574
1076
  break;
575
1077
  default:
@@ -865,9 +1367,9 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
865
1367
  this.failureReasonOnNextLine(failure)
866
1368
  )
867
1369
  );
868
- const trace3 = failure.metadata?.entry?.trace;
869
- if (trace3) {
870
- lines.push(chalk2.red(` ${trace3.join("\n \\_ ")}
1370
+ const trace4 = failure.metadata?.entry?.trace;
1371
+ if (trace4) {
1372
+ lines.push(chalk2.red(` ${trace4.join("\n \\_ ")}
871
1373
  `));
872
1374
  }
873
1375
  }
@@ -925,24 +1427,17 @@ function shorten(maxWidth, p) {
925
1427
  }
926
1428
 
927
1429
  // ../../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
1430
  var CliIoHost = class _CliIoHost {
937
1431
  constructor(props = {}) {
938
1432
  this._progress = "bar" /* BAR */;
939
1433
  // Corked Logging
940
1434
  this.corkedCounter = 0;
941
1435
  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();
1436
+ this.currentAction = props.currentAction ?? "none";
1437
+ this.isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
1438
+ this.logLevel = props.logLevel ?? "info";
1439
+ this.isCI = props.isCI ?? isCI();
1440
+ this.requireDeployApproval = props.requireDeployApproval ?? import_cloud_assembly_schema.RequireApproval.BROADENING;
946
1441
  this.stackProgress = props.stackProgress ?? "bar" /* BAR */;
947
1442
  }
948
1443
  /**
@@ -978,7 +1473,7 @@ var CliIoHost = class _CliIoHost {
978
1473
  if (this._progress === "events" /* EVENTS */) {
979
1474
  return this._progress;
980
1475
  }
981
- const verboseLogging = levelPriority[this.logLevel] > levelPriority.info;
1476
+ const verboseLogging = isMessageRelevantForLevel({ level: "debug" }, this.logLevel);
982
1477
  if (verboseLogging) {
983
1478
  return "events" /* EVENTS */;
984
1479
  }
@@ -992,60 +1487,6 @@ var CliIoHost = class _CliIoHost {
992
1487
  }
993
1488
  return this._progress;
994
1489
  }
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
1490
  /**
1050
1491
  * Executes a block of code with corked logging. All log messages during execution
1051
1492
  * are buffered and only written when all nested cork blocks complete (when CORK_COUNTER reaches 0).
@@ -1083,7 +1524,7 @@ var CliIoHost = class _CliIoHost {
1083
1524
  await this.activityPrinter.notify(msg);
1084
1525
  return;
1085
1526
  }
1086
- if (levelPriority[msg.level] > levelPriority[this.logLevel]) {
1527
+ if (!isMessageRelevantForLevel(msg, this.logLevel)) {
1087
1528
  return;
1088
1529
  }
1089
1530
  if (this.corkedCounter > 0) {
@@ -1104,6 +1545,27 @@ var CliIoHost = class _CliIoHost {
1104
1545
  "CDK_TOOLKIT_I5503"
1105
1546
  ].includes(msg.code);
1106
1547
  }
1548
+ /**
1549
+ * Detect special messages encode information about whether or not
1550
+ * they require approval
1551
+ */
1552
+ skipApprovalStep(msg) {
1553
+ const approvalToolkitCodes = ["CDK_TOOLKIT_I5060"];
1554
+ if (!approvalToolkitCodes.includes(msg.code)) {
1555
+ false;
1556
+ }
1557
+ switch (this.requireDeployApproval) {
1558
+ // Never require approval
1559
+ case import_cloud_assembly_schema.RequireApproval.NEVER:
1560
+ return true;
1561
+ // Always require approval
1562
+ case import_cloud_assembly_schema.RequireApproval.ANYCHANGE:
1563
+ return false;
1564
+ // Require approval if changes include broadening permissions
1565
+ case import_cloud_assembly_schema.RequireApproval.BROADENING:
1566
+ return ["none", "non-broadening"].includes(msg.data?.permissionChangeType);
1567
+ }
1568
+ }
1107
1569
  /**
1108
1570
  * Determines the output stream, based on message level and configuration.
1109
1571
  */
@@ -1141,6 +1603,9 @@ var CliIoHost = class _CliIoHost {
1141
1603
  if (concurrency > 1) {
1142
1604
  throw new ToolkitError(`${motivation}, but concurrency is greater than 1 so we are unable to get a confirmation from the user`);
1143
1605
  }
1606
+ if (this.skipApprovalStep(msg)) {
1607
+ return true;
1608
+ }
1144
1609
  if (isConfirmationPrompt(msg)) {
1145
1610
  const confirmed = await promptly.confirm(`${chalk3.cyan(msg.message)} (y/n)`);
1146
1611
  if (!confirmed) {
@@ -1160,7 +1625,7 @@ var CliIoHost = class _CliIoHost {
1160
1625
  * Formats a message for console output with optional color support
1161
1626
  */
1162
1627
  formatMessage(msg) {
1163
- let message_text = this._isTTY ? styleMap[msg.level](msg.message) : msg.message;
1628
+ let message_text = this.isTTY ? styleMap[msg.level](msg.message) : msg.message;
1164
1629
  return (msg.level === "debug" || msg.level === "trace" ? `[${this.formatTime(msg.time)}] ${message_text}` : message_text) + "\n";
1165
1630
  }
1166
1631
  /**
@@ -1212,8 +1677,8 @@ function isCI() {
1212
1677
 
1213
1678
  // ../../aws-cdk/lib/logging.ts
1214
1679
  function formatMessageAndLog(level, input, style, ...args) {
1215
- const { message, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
1216
- const formattedMessage = args.length > 0 ? util4.format(message, ...args) : message;
1680
+ const { message: message2, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
1681
+ const formattedMessage = args.length > 0 ? util4.format(message2, ...args) : message2;
1217
1682
  const finalMessage = style ? style(formattedMessage) : formattedMessage;
1218
1683
  const ioHost = CliIoHost.instance();
1219
1684
  const ioMessage = {
@@ -1221,7 +1686,8 @@ function formatMessageAndLog(level, input, style, ...args) {
1221
1686
  action: ioHost.currentAction,
1222
1687
  level,
1223
1688
  message: finalMessage,
1224
- code
1689
+ code,
1690
+ data: void 0
1225
1691
  };
1226
1692
  void ioHost.notify(ioMessage);
1227
1693
  }
@@ -1229,59 +1695,22 @@ function getDefaultCode(level, category = "TOOLKIT") {
1229
1695
  const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
1230
1696
  return `CDK_${category}_${levelIndicator}0000`;
1231
1697
  }
1232
- var error = (input, ...args) => {
1698
+ var error2 = (input, ...args) => {
1233
1699
  return formatMessageAndLog("error", input, void 0, ...args);
1234
1700
  };
1235
1701
  var warning = (input, ...args) => {
1236
1702
  return formatMessageAndLog("warn", input, void 0, ...args);
1237
1703
  };
1238
- var info = (input, ...args) => {
1704
+ var info2 = (input, ...args) => {
1239
1705
  return formatMessageAndLog("info", input, void 0, ...args);
1240
1706
  };
1241
- var debug = (input, ...args) => {
1707
+ var debug2 = (input, ...args) => {
1242
1708
  return formatMessageAndLog("debug", input, void 0, ...args);
1243
1709
  };
1244
- var trace = (input, ...args) => {
1710
+ var trace2 = (input, ...args) => {
1245
1711
  return formatMessageAndLog("trace", input, void 0, ...args);
1246
1712
  };
1247
1713
 
1248
- // ../../aws-cdk/lib/util/directories.ts
1249
- var fs2 = __toESM(require("fs"));
1250
- var os = __toESM(require("os"));
1251
- var path = __toESM(require("path"));
1252
- function cdkHomeDir() {
1253
- const tmpDir = fs2.realpathSync(os.tmpdir());
1254
- let home;
1255
- try {
1256
- let userInfoHome = os.userInfo().homedir;
1257
- if (userInfoHome == "/var/empty") {
1258
- userInfoHome = void 0;
1259
- }
1260
- home = path.join((userInfoHome ?? os.homedir()).trim(), ".cdk");
1261
- } catch {
1262
- }
1263
- return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home || fs2.mkdtempSync(path.join(tmpDir, ".cdk")).trim();
1264
- }
1265
- function cdkCacheDir() {
1266
- return path.join(cdkHomeDir(), "cache");
1267
- }
1268
- function rootDir(fail) {
1269
- function _rootDir(dirname5) {
1270
- const manifestPath = path.join(dirname5, "package.json");
1271
- if (fs2.existsSync(manifestPath)) {
1272
- return dirname5;
1273
- }
1274
- if (path.dirname(dirname5) === dirname5) {
1275
- if (fail ?? true) {
1276
- throw new ToolkitError("Unable to find package manifest");
1277
- }
1278
- return void 0;
1279
- }
1280
- return _rootDir(path.dirname(dirname5));
1281
- }
1282
- return _rootDir(__dirname);
1283
- }
1284
-
1285
1714
  // ../../aws-cdk/lib/api/aws-auth/account-cache.ts
1286
1715
  var AccountAccessKeyCache = class _AccountAccessKeyCache {
1287
1716
  static {
@@ -1310,7 +1739,7 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
1310
1739
  async fetch(accessKeyId, resolver) {
1311
1740
  const cached2 = await this.get(accessKeyId);
1312
1741
  if (cached2) {
1313
- debug(`Retrieved account ID ${cached2.accountId} from disk cache`);
1742
+ debug2(`Retrieved account ID ${cached2.accountId} from disk cache`);
1314
1743
  return cached2;
1315
1744
  }
1316
1745
  const account = await resolver();
@@ -1426,14 +1855,14 @@ function readIfPossible(filename) {
1426
1855
  }
1427
1856
  return fs4.readFileSync(filename, { encoding: "utf-8" });
1428
1857
  } catch (e) {
1429
- debug(e);
1858
+ debug2(e);
1430
1859
  return void 0;
1431
1860
  }
1432
1861
  }
1433
1862
 
1434
1863
  // ../../aws-cdk/lib/api/aws-auth/user-agent.ts
1435
1864
  function defaultCliUserAgent() {
1436
- const root = rootDir(false);
1865
+ const root = bundledPackageRootDir(__dirname, false);
1437
1866
  const pkg = JSON.parse((root ? readIfPossible(path3.join(root, "package.json")) : void 0) ?? "{}");
1438
1867
  const name = pkg.name ?? path3.basename(process.argv[1] ?? "cdk-cli");
1439
1868
  const version = pkg.version ?? "<unknown>";
@@ -1739,19 +2168,19 @@ var SDK = class {
1739
2168
  return cachedAsync(this, CURRENT_ACCOUNT_KEY, async () => {
1740
2169
  const creds = await this.credProvider();
1741
2170
  return SDK.accountCache.fetch(creds.accessKeyId, async () => {
1742
- debug("Looking up default account ID from STS");
2171
+ debug2("Looking up default account ID from STS");
1743
2172
  const client = new import_client_sts.STSClient({
1744
2173
  ...this.config,
1745
2174
  retryStrategy: this.stsRetryStrategy
1746
2175
  });
1747
2176
  const command = new import_client_sts.GetCallerIdentityCommand({});
1748
- const result = await client.send(command);
1749
- const accountId = result.Account;
1750
- const partition = result.Arn.split(":")[1];
2177
+ const result2 = await client.send(command);
2178
+ const accountId = result2.Account;
2179
+ const partition = result2.Arn.split(":")[1];
1751
2180
  if (!accountId) {
1752
2181
  throw new AuthenticationError("STS didn't return an account ID");
1753
2182
  }
1754
- debug("Default account ID:", accountId);
2183
+ debug2("Default account ID:", accountId);
1755
2184
  this._credentialsValidated = true;
1756
2185
  return { accountId, partition };
1757
2186
  });
@@ -1876,7 +2305,7 @@ var AwsCliCompatible = class _AwsCliCompatible {
1876
2305
  const region = process.env.AWS_REGION || process.env.AMAZON_REGION || process.env.AWS_DEFAULT_REGION || process.env.AMAZON_DEFAULT_REGION || await getRegionFromIni(profile) || await regionFromMetadataService();
1877
2306
  if (!region) {
1878
2307
  const usedProfile = !profile ? "" : ` (profile: "${profile}")`;
1879
- debug(
2308
+ debug2(
1880
2309
  `Unable to determine AWS region from environment or AWS configuration${usedProfile}, defaulting to '${defaultRegion}'`
1881
2310
  );
1882
2311
  return defaultRegion;
@@ -1892,10 +2321,10 @@ function getRegionFromIniFile(profile, data) {
1892
2321
  return data?.[profile]?.region;
1893
2322
  }
1894
2323
  function tryGetCACert(bundlePath) {
1895
- const path12 = bundlePath || caBundlePathFromEnvironment();
1896
- if (path12) {
1897
- debug("Using CA bundle path: %s", path12);
1898
- return readIfPossible(path12);
2324
+ const path15 = bundlePath || caBundlePathFromEnvironment();
2325
+ if (path15) {
2326
+ debug2("Using CA bundle path: %s", path15);
2327
+ return readIfPossible(path15);
1899
2328
  }
1900
2329
  return void 0;
1901
2330
  }
@@ -1923,7 +2352,7 @@ function shouldPrioritizeEnv() {
1923
2352
  return false;
1924
2353
  }
1925
2354
  async function regionFromMetadataService() {
1926
- debug("Looking up AWS region in the EC2 Instance Metadata Service (IMDS).");
2355
+ debug2("Looking up AWS region in the EC2 Instance Metadata Service (IMDS).");
1927
2356
  try {
1928
2357
  const metadataService = new import_ec2_metadata_service.MetadataService({
1929
2358
  httpOptions: {
@@ -1934,20 +2363,20 @@ async function regionFromMetadataService() {
1934
2363
  const document = await metadataService.request("/latest/dynamic/instance-identity/document", {});
1935
2364
  return JSON.parse(document).region;
1936
2365
  } catch (e) {
1937
- debug(`Unable to retrieve AWS region from IMDS: ${e}`);
2366
+ debug2(`Unable to retrieve AWS region from IMDS: ${e}`);
1938
2367
  }
1939
2368
  }
1940
2369
  async function tokenCodeFn(serialArn) {
1941
- debug("Require MFA token for serial ARN", serialArn);
2370
+ debug2("Require MFA token for serial ARN", serialArn);
1942
2371
  try {
1943
2372
  const token = await promptly2.prompt(`MFA token for ${serialArn}: `, {
1944
2373
  trim: true,
1945
2374
  default: ""
1946
2375
  });
1947
- debug("Successfully got MFA token from user");
2376
+ debug2("Successfully got MFA token from user");
1948
2377
  return token;
1949
2378
  } catch (err) {
1950
- debug("Failed to get MFA token", err);
2379
+ debug2("Failed to get MFA token", err);
1951
2380
  const e = new AuthenticationError(`Error fetching MFA token: ${err.message ?? err}`);
1952
2381
  e.name = "SharedIniFileCredentialsProviderFailure";
1953
2382
  throw e;
@@ -1955,10 +2384,10 @@ async function tokenCodeFn(serialArn) {
1955
2384
  }
1956
2385
 
1957
2386
  // ../../aws-cdk/lib/api/aws-auth/credential-plugins.ts
1958
- var import_util7 = require("util");
2387
+ var import_util11 = require("util");
1959
2388
 
1960
2389
  // ../../aws-cdk/lib/api/plugin/plugin.ts
1961
- var import_util6 = require("util");
2390
+ var import_util10 = require("util");
1962
2391
  var chalk5 = __toESM(require("chalk"));
1963
2392
 
1964
2393
  // ../../aws-cdk/lib/api/plugin/context-provider-plugin.ts
@@ -1992,14 +2421,14 @@ var PluginHost = class _PluginHost {
1992
2421
  try {
1993
2422
  const plugin = require(moduleSpec);
1994
2423
  if (!isPlugin(plugin)) {
1995
- error(`Module ${chalk5.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
2424
+ error2(`Module ${chalk5.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
1996
2425
  throw new ToolkitError(`Module ${moduleSpec} does not define a valid plug-in.`);
1997
2426
  }
1998
2427
  if (plugin.init) {
1999
2428
  plugin.init(this);
2000
2429
  }
2001
2430
  } catch (e) {
2002
- error(`Unable to load ${chalk5.green(moduleSpec)}: ${e.stack}`);
2431
+ error2(`Unable to load ${chalk5.green(moduleSpec)}: ${e.stack}`);
2003
2432
  throw new ToolkitError(`Unable to load plug-in: ${moduleSpec}: ${e}`);
2004
2433
  }
2005
2434
  function isPlugin(x) {
@@ -2048,7 +2477,7 @@ var PluginHost = class _PluginHost {
2048
2477
  */
2049
2478
  registerContextProviderAlpha(pluginProviderName, provider) {
2050
2479
  if (!isContextProviderPlugin(provider)) {
2051
- throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util6.inspect)(provider)}`);
2480
+ throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util10.inspect)(provider)}`);
2052
2481
  }
2053
2482
  this.contextProviderPlugins[pluginProviderName] = provider;
2054
2483
  }
@@ -2081,7 +2510,7 @@ var CredentialPlugins = class {
2081
2510
  available = false;
2082
2511
  }
2083
2512
  if (!available) {
2084
- debug("Credentials source %s is not available, ignoring it.", source.name);
2513
+ debug2("Credentials source %s is not available, ignoring it.", source.name);
2085
2514
  continue;
2086
2515
  }
2087
2516
  triedSources.push(source);
@@ -2095,7 +2524,7 @@ var CredentialPlugins = class {
2095
2524
  if (!canProvide) {
2096
2525
  continue;
2097
2526
  }
2098
- debug(`Using ${source.name} credentials for account ${awsAccountId}`);
2527
+ debug2(`Using ${source.name} credentials for account ${awsAccountId}`);
2099
2528
  return {
2100
2529
  credentials: await v3ProviderFromPlugin(() => source.getProvider(awsAccountId, mode, {
2101
2530
  supportsV3Providers: true
@@ -2117,7 +2546,7 @@ async function v3ProviderFromPlugin(producer) {
2117
2546
  } else if (isV2Credentials(initial)) {
2118
2547
  return v3ProviderFromV2Credentials(initial);
2119
2548
  } else {
2120
- throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util7.inspect)(initial)}`);
2549
+ throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util11.inspect)(initial)}`);
2121
2550
  }
2122
2551
  }
2123
2552
  function v3ProviderFromV2Credentials(x) {
@@ -2136,7 +2565,7 @@ function refreshFromPluginProvider(current, producer) {
2136
2565
  if (credentialsAboutToExpire(current)) {
2137
2566
  const newCreds = await producer();
2138
2567
  if (!isV3Credentials(newCreds)) {
2139
- throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util7.inspect)(newCreds)}`);
2568
+ throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util11.inspect)(newCreds)}`);
2140
2569
  }
2141
2570
  current = newCreds;
2142
2571
  }
@@ -2213,8 +2642,8 @@ var SdkProvider = class {
2213
2642
  throw err;
2214
2643
  }
2215
2644
  if (baseCreds.source === "correctDefault" || baseCreds.source === "plugin") {
2216
- debug(err.message);
2217
- const logger = quiet ? debug : warning;
2645
+ debug2(err.message);
2646
+ const logger = quiet ? debug2 : warning;
2218
2647
  logger(
2219
2648
  `${fmtObtainedCredentials(baseCreds)} could not be used to assume '${options.assumeRoleArn}', but are for the right account. Proceeding anyway.`
2220
2649
  );
@@ -2287,7 +2716,7 @@ var SdkProvider = class {
2287
2716
  );
2288
2717
  return void 0;
2289
2718
  }
2290
- debug(`Unable to determine the default AWS account (${e.name}): ${formatErrorMessage(e)}`);
2719
+ debug2(`Unable to determine the default AWS account (${e.name}): ${formatErrorMessage(e)}`);
2291
2720
  return void 0;
2292
2721
  }
2293
2722
  });
@@ -2334,7 +2763,7 @@ var SdkProvider = class {
2334
2763
  * otherwise it will be the current credentials.
2335
2764
  */
2336
2765
  async withAssumedRole(mainCredentials, roleArn, externalId, additionalOptions, region) {
2337
- debug(`Assuming role '${roleArn}'.`);
2766
+ debug2(`Assuming role '${roleArn}'.`);
2338
2767
  region = region ?? this.defaultRegion;
2339
2768
  const sourceDescription = fmtObtainedCredentials(mainCredentials);
2340
2769
  try {
@@ -2361,7 +2790,7 @@ var SdkProvider = class {
2361
2790
  if (err.name === "ExpiredToken") {
2362
2791
  throw err;
2363
2792
  }
2364
- debug(`Assuming role failed: ${err.message}`);
2793
+ debug2(`Assuming role failed: ${err.message}`);
2365
2794
  throw new AuthenticationError(
2366
2795
  [
2367
2796
  "Could not assume role in target account",
@@ -2424,42 +2853,6 @@ async function initContextProviderSdk(aws, options) {
2424
2853
  return (await aws.forEnvironment(import_cx_api.EnvironmentUtils.make(account, region), 0 /* ForReading */, creds)).sdk;
2425
2854
  }
2426
2855
 
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;
2434
- }
2435
- }
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;
2441
- }
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}`);
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;
2461
- }
2462
-
2463
2856
  // ../../aws-cdk/lib/api/settings.ts
2464
2857
  var os3 = __toESM(require("os"));
2465
2858
  var fs_path = __toESM(require("path"));
@@ -2521,22 +2914,22 @@ var Settings = class _Settings {
2521
2914
  get empty() {
2522
2915
  return Object.keys(this.settings).length === 0;
2523
2916
  }
2524
- get(path12) {
2525
- return deepClone(deepGet(this.settings, path12));
2917
+ get(path15) {
2918
+ return deepClone(deepGet(this.settings, path15));
2526
2919
  }
2527
- set(path12, value) {
2920
+ set(path15, value) {
2528
2921
  if (this.readOnly) {
2529
- throw new ToolkitError(`Can't set ${path12}: settings object is readonly`);
2922
+ throw new ToolkitError(`Can't set ${path15}: settings object is readonly`);
2530
2923
  }
2531
- if (path12.length === 0) {
2924
+ if (path15.length === 0) {
2532
2925
  this.settings = value;
2533
2926
  } else {
2534
- deepSet(this.settings, path12, value);
2927
+ deepSet(this.settings, path15, value);
2535
2928
  }
2536
2929
  return this;
2537
2930
  }
2538
- unset(path12) {
2539
- this.set(path12, void 0);
2931
+ unset(path15) {
2932
+ this.set(path15, void 0);
2540
2933
  }
2541
2934
  prohibitContextKey(key, fileName) {
2542
2935
  if (!this.settings.context) {
@@ -2648,7 +3041,7 @@ var Context = class {
2648
3041
  };
2649
3042
 
2650
3043
  // ../../aws-cdk/lib/api/deployments/cloudformation.ts
2651
- var import_util10 = require("util");
3044
+ var import_util19 = require("util");
2652
3045
  var cxapi = __toESM(require("@aws-cdk/cx-api"));
2653
3046
  var import_cx_api3 = require("@aws-cdk/cx-api");
2654
3047
  var import_client_cloudformation3 = require("@aws-sdk/client-cloudformation");
@@ -2691,7 +3084,6 @@ function formatMessage(msg, category = "TOOLKIT") {
2691
3084
  return {
2692
3085
  time: /* @__PURE__ */ new Date(),
2693
3086
  level: msg.level,
2694
- action: msg.action,
2695
3087
  code: msg.code ?? defaultMessageCode(msg.level, category),
2696
3088
  message: msg.message,
2697
3089
  data: msg.data
@@ -2701,56 +3093,51 @@ function defaultMessageCode(level, category = "TOOLKIT") {
2701
3093
  const levelIndicator = level === "error" ? "E" : level === "warn" ? "W" : "I";
2702
3094
  return `CDK_${category}_${levelIndicator}0000`;
2703
3095
  }
2704
- var error2 = (action, message, code, payload) => {
3096
+ var error3 = (message2, code, payload) => {
2705
3097
  return formatMessage({
2706
3098
  level: "error",
2707
- action,
2708
3099
  code,
2709
- message,
3100
+ message: message2,
2710
3101
  data: payload
2711
3102
  });
2712
3103
  };
2713
- var warn = (action, message, code, payload) => {
3104
+ var warn2 = (message2, code, payload) => {
2714
3105
  return formatMessage({
2715
3106
  level: "warn",
2716
- action,
2717
3107
  code,
2718
- message,
3108
+ message: message2,
2719
3109
  data: payload
2720
3110
  });
2721
3111
  };
2722
- var info2 = (action, message, code, payload) => {
3112
+ var info3 = (message2, code, payload) => {
2723
3113
  return formatMessage({
2724
3114
  level: "info",
2725
- action,
2726
3115
  code,
2727
- message,
3116
+ message: message2,
2728
3117
  data: payload
2729
3118
  });
2730
3119
  };
2731
- var debug2 = (action, message, code, payload) => {
3120
+ var debug3 = (message2, code, payload) => {
2732
3121
  return formatMessage({
2733
3122
  level: "debug",
2734
- action,
2735
3123
  code,
2736
- message,
3124
+ message: message2,
2737
3125
  data: payload
2738
3126
  });
2739
3127
  };
2740
- var trace2 = (action, message, code, payload) => {
3128
+ var trace3 = (message2, code, payload) => {
2741
3129
  return formatMessage({
2742
3130
  level: "trace",
2743
- action,
2744
3131
  code,
2745
- message,
3132
+ message: message2,
2746
3133
  data: payload
2747
3134
  });
2748
3135
  };
2749
3136
 
2750
3137
  // ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
2751
3138
  var util6 = __toESM(require("util"));
2752
- var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
2753
- var uuid = __toESM(require("uuid"));
3139
+ var import_cloud_assembly_schema2 = require("@aws-cdk/cloud-assembly-schema");
3140
+ var uuid2 = __toESM(require("uuid"));
2754
3141
 
2755
3142
  // ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
2756
3143
  var StackEventPoller = class _StackEventPoller {
@@ -2950,8 +3337,7 @@ var StackProgressMonitor = class {
2950
3337
  var StackActivityMonitor = class {
2951
3338
  constructor({
2952
3339
  cfn,
2953
- ioHost,
2954
- action,
3340
+ ioHelper,
2955
3341
  stack,
2956
3342
  stackName,
2957
3343
  resourcesTotal,
@@ -2959,8 +3345,7 @@ var StackActivityMonitor = class {
2959
3345
  pollingInterval = 2e3
2960
3346
  }) {
2961
3347
  this.errors = [];
2962
- this.ioHost = ioHost;
2963
- this.action = action;
3348
+ this.ioHelper = ioHelper;
2964
3349
  this.stack = stack;
2965
3350
  this.stackName = stackName;
2966
3351
  this.progressMonitor = new StackProgressMonitor(resourcesTotal);
@@ -2971,8 +3356,8 @@ var StackActivityMonitor = class {
2971
3356
  });
2972
3357
  }
2973
3358
  async start() {
2974
- this.monitorId = uuid.v4();
2975
- await this.ioHost.notify(debug2(this.action, `Deploying ${this.stackName}`, "CDK_TOOLKIT_I5501", {
3359
+ this.monitorId = uuid2.v4();
3360
+ await this.ioHelper.notify(debug3(`Deploying ${this.stackName}`, "CDK_TOOLKIT_I5501", {
2976
3361
  deployment: this.monitorId,
2977
3362
  stack: this.stack,
2978
3363
  stackName: this.stackName,
@@ -2988,7 +3373,7 @@ var StackActivityMonitor = class {
2988
3373
  clearTimeout(this.tickTimer);
2989
3374
  }
2990
3375
  await this.finalPollToEnd(oldMonitorId);
2991
- await this.ioHost.notify(debug2(this.action, `Completed ${this.stackName}`, "CDK_TOOLKIT_I5503", {
3376
+ await this.ioHelper.notify(debug3(`Completed ${this.stackName}`, "CDK_TOOLKIT_I5503", {
2992
3377
  deployment: oldMonitorId,
2993
3378
  stack: this.stack,
2994
3379
  stackName: this.stackName,
@@ -3013,8 +3398,7 @@ var StackActivityMonitor = class {
3013
3398
  return;
3014
3399
  }
3015
3400
  } catch (e) {
3016
- await this.ioHost.notify(error2(
3017
- this.action,
3401
+ await this.ioHelper.notify(error3(
3018
3402
  util6.format("Error occurred while monitoring stack: %s", e),
3019
3403
  "CDK_TOOLKIT_E5500",
3020
3404
  { error: e }
@@ -3027,12 +3411,12 @@ var StackActivityMonitor = class {
3027
3411
  if (!logicalId || !metadata) {
3028
3412
  return void 0;
3029
3413
  }
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);
3414
+ for (const path15 of Object.keys(metadata)) {
3415
+ const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema2.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
3032
3416
  if (entry) {
3033
3417
  return {
3034
3418
  entry,
3035
- constructPath: this.simplifyConstructPath(path12)
3419
+ constructPath: this.simplifyConstructPath(path15)
3036
3420
  };
3037
3421
  }
3038
3422
  }
@@ -3056,7 +3440,7 @@ var StackActivityMonitor = class {
3056
3440
  progress: this.progressMonitor.progress
3057
3441
  };
3058
3442
  this.checkForErrors(activity);
3059
- await this.ioHost.notify(info2(this.action, this.formatActivity(activity, true), "CDK_TOOLKIT_I5502", activity));
3443
+ await this.ioHelper.notify(info3(this.formatActivity(activity, true), "CDK_TOOLKIT_I5502", activity));
3060
3444
  }
3061
3445
  }
3062
3446
  /**
@@ -3101,13 +3485,13 @@ var StackActivityMonitor = class {
3101
3485
  }
3102
3486
  }
3103
3487
  }
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);
3488
+ simplifyConstructPath(path15) {
3489
+ path15 = path15.replace(/\/Resource$/, "");
3490
+ path15 = path15.replace(/^\//, "");
3491
+ if (path15.startsWith(this.stackName + "/")) {
3492
+ path15 = path15.slice(this.stackName.length + 1);
3109
3493
  }
3110
- return path12;
3494
+ return path15;
3111
3495
  }
3112
3496
  };
3113
3497
 
@@ -3191,7 +3575,7 @@ async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, reso
3191
3575
  }
3192
3576
  const toolkitInfo = await resources.lookupToolkit();
3193
3577
  if (!toolkitInfo.found) {
3194
- error(
3578
+ error2(
3195
3579
  `The template for stack "${stack.displayName}" is ${Math.round(templateJson.length / 1024)}KiB. Templates larger than ${LARGE_TEMPLATE_SIZE_KB}KiB must be uploaded to S3.
3196
3580
  Run the following command in order to setup an S3 bucket in this environment, and then re-deploy:
3197
3581
 
@@ -3220,7 +3604,7 @@ Run the following command in order to setup an S3 bucket in this environment, an
3220
3604
  }
3221
3605
  );
3222
3606
  const templateURL = `${toolkitInfo.bucketUrl}/${key}`;
3223
- debug("Storing template in S3 at:", templateURL);
3607
+ debug2("Storing template in S3 at:", templateURL);
3224
3608
  return { TemplateURL: templateURL };
3225
3609
  }
3226
3610
  async function restUrlFromManifest(url, environment) {
@@ -3324,11 +3708,11 @@ var CloudFormationStack = class _CloudFormationStack {
3324
3708
  if (!this.exists) {
3325
3709
  return {};
3326
3710
  }
3327
- const result = {};
3711
+ const result2 = {};
3328
3712
  (this.stack.Outputs || []).forEach((output) => {
3329
- result[output.OutputKey] = output.OutputValue;
3713
+ result2[output.OutputKey] = output.OutputValue;
3330
3714
  });
3331
- return result;
3715
+ return result2;
3332
3716
  }
3333
3717
  /**
3334
3718
  * The stack's status
@@ -3412,23 +3796,23 @@ async function describeChangeSet(cfn, stackName, changeSetName, { fetchAll }) {
3412
3796
  }
3413
3797
  async function waitFor(valueProvider, timeout = 5e3) {
3414
3798
  while (true) {
3415
- const result = await valueProvider();
3416
- if (result === null) {
3799
+ const result2 = await valueProvider();
3800
+ if (result2 === null) {
3417
3801
  return void 0;
3418
- } else if (result !== void 0) {
3419
- return result;
3802
+ } else if (result2 !== void 0) {
3803
+ return result2;
3420
3804
  }
3421
3805
  await new Promise((cb) => setTimeout(cb, timeout));
3422
3806
  }
3423
3807
  }
3424
- async function waitForChangeSet(cfn, { ioHost, action }, stackName, changeSetName, { fetchAll }) {
3425
- await ioHost.notify(debug2(action, (0, import_util10.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
3808
+ async function waitForChangeSet(cfn, ioHelper, stackName, changeSetName, { fetchAll }) {
3809
+ await ioHelper.notify(debug3((0, import_util19.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
3426
3810
  const ret = await waitFor(async () => {
3427
3811
  const description = await describeChangeSet(cfn, stackName, changeSetName, {
3428
3812
  fetchAll
3429
3813
  });
3430
3814
  if (description.Status === "CREATE_PENDING" || description.Status === "CREATE_IN_PROGRESS") {
3431
- await ioHost.notify(debug2(action, (0, import_util10.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
3815
+ await ioHelper.notify(debug3((0, import_util19.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
3432
3816
  return void 0;
3433
3817
  }
3434
3818
  if (description.Status === import_client_cloudformation3.ChangeSetStatus.CREATE_COMPLETE || changeSetHasNoChanges(description)) {
@@ -3482,8 +3866,8 @@ function changeSetHasNoChanges(description) {
3482
3866
  ];
3483
3867
  return description.Status === "FAILED" && noChangeErrorPrefixes.some((p) => (description.StatusReason ?? "").startsWith(p));
3484
3868
  }
3485
- async function waitForStackDelete(cfn, { ioHost, action }, stackName) {
3486
- const stack = await stabilizeStack(cfn, { ioHost, action }, stackName);
3869
+ async function waitForStackDelete(cfn, ioHelper, stackName) {
3870
+ const stack = await stabilizeStack(cfn, ioHelper, stackName);
3487
3871
  if (!stack) {
3488
3872
  return void 0;
3489
3873
  }
@@ -3497,8 +3881,8 @@ async function waitForStackDelete(cfn, { ioHost, action }, stackName) {
3497
3881
  }
3498
3882
  return stack;
3499
3883
  }
3500
- async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
3501
- const stack = await stabilizeStack(cfn, { ioHost, action }, stackName);
3884
+ async function waitForStackDeploy(cfn, ioHelper, stackName) {
3885
+ const stack = await stabilizeStack(cfn, ioHelper, stackName);
3502
3886
  if (!stack) {
3503
3887
  return void 0;
3504
3888
  }
@@ -3512,20 +3896,20 @@ async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
3512
3896
  }
3513
3897
  return stack;
3514
3898
  }
3515
- async function stabilizeStack(cfn, { ioHost, action }, stackName) {
3516
- await ioHost.notify(debug2(action, (0, import_util10.format)("Waiting for stack %s to finish creating or updating...", stackName)));
3899
+ async function stabilizeStack(cfn, ioHelper, stackName) {
3900
+ await ioHelper.notify(debug3((0, import_util19.format)("Waiting for stack %s to finish creating or updating...", stackName)));
3517
3901
  return waitFor(async () => {
3518
3902
  const stack = await CloudFormationStack.lookup(cfn, stackName);
3519
3903
  if (!stack.exists) {
3520
- await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s does not exist", stackName)));
3904
+ await ioHelper.notify(debug3((0, import_util19.format)("Stack %s does not exist", stackName)));
3521
3905
  return null;
3522
3906
  }
3523
3907
  const status = stack.stackStatus;
3524
3908
  if (status.isInProgress) {
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)));
3909
+ await ioHelper.notify(debug3((0, import_util19.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
3526
3910
  return void 0;
3527
3911
  } else if (status.isReviewInProgress) {
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)));
3912
+ await ioHelper.notify(debug3((0, import_util19.format)("Stack %s is in REVIEW_IN_PROGRESS state. Considering this is a stable status (%s)", stackName, status)));
3529
3913
  }
3530
3914
  return stack;
3531
3915
  });
@@ -3622,13 +4006,13 @@ var chalk12 = __toESM(require("chalk"));
3622
4006
  // ../../aws-cdk/lib/api/deployments/asset-publishing.ts
3623
4007
  var import_cx_api4 = require("@aws-cdk/cx-api");
3624
4008
  var import_cdk_assets3 = require("cdk-assets");
3625
- async function publishAssets(manifest, sdk, targetEnv, options, { ioHost, action }) {
4009
+ async function publishAssets(manifest, sdk, targetEnv, options, ioHelper) {
3626
4010
  if (targetEnv.account === void 0 || targetEnv.account === import_cx_api4.UNKNOWN_ACCOUNT || targetEnv.region === void 0 || targetEnv.account === import_cx_api4.UNKNOWN_REGION) {
3627
4011
  throw new ToolkitError(`Asset publishing requires resolved account and region, got ${JSON.stringify(targetEnv)}`);
3628
4012
  }
3629
4013
  const publisher = new import_cdk_assets3.AssetPublishing(manifest, {
3630
4014
  aws: new PublishingAws(sdk, targetEnv),
3631
- progressListener: new PublishingProgressListener({ ioHost, action }),
4015
+ progressListener: new PublishingProgressListener(ioHelper),
3632
4016
  throwOnError: false,
3633
4017
  publishInParallel: options.parallel ?? true,
3634
4018
  buildAssets: true,
@@ -3725,18 +4109,17 @@ var EVENT_TO_LEVEL = {
3725
4109
  shell_close: false
3726
4110
  };
3727
4111
  var BasePublishProgressListener = class {
3728
- constructor({ ioHost, action }) {
3729
- this.ioHost = ioHost;
3730
- this.action = action;
4112
+ constructor(ioHelper) {
4113
+ this.ioHelper = ioHelper;
3731
4114
  }
3732
4115
  onPublishEvent(type, event) {
3733
4116
  const level = EVENT_TO_LEVEL[type];
3734
4117
  if (level) {
3735
- void this.ioHost.notify(
4118
+ void this.ioHelper.notify(
3736
4119
  formatMessage({
3737
4120
  level,
3738
- action: this.action,
3739
- message: this.getMessage(type, event)
4121
+ message: this.getMessage(type, event),
4122
+ data: void 0
3740
4123
  })
3741
4124
  );
3742
4125
  }
@@ -3749,7 +4132,7 @@ var PublishingProgressListener = class extends BasePublishProgressListener {
3749
4132
  };
3750
4133
 
3751
4134
  // ../../aws-cdk/lib/api/deployments/checks.ts
3752
- async function determineAllowCrossAccountAssetPublishing(sdk, { ioHost, action }, customStackName) {
4135
+ async function determineAllowCrossAccountAssetPublishing(sdk, ioHelper, customStackName) {
3753
4136
  try {
3754
4137
  const stackName = customStackName || "CDKToolkit";
3755
4138
  const stackInfo = await getBootstrapStackInfo(sdk, stackName);
@@ -3761,8 +4144,8 @@ async function determineAllowCrossAccountAssetPublishing(sdk, { ioHost, action }
3761
4144
  }
3762
4145
  return false;
3763
4146
  } catch (e) {
3764
- await ioHost.notify(debug2(action, `Error determining cross account asset publishing: ${e}`));
3765
- await ioHost.notify(debug2(action, "Defaulting to allowing cross account asset publishing"));
4147
+ await ioHelper.notify(debug3(`Error determining cross account asset publishing: ${e}`));
4148
+ await ioHelper.notify(debug3("Defaulting to allowing cross account asset publishing"));
3766
4149
  return true;
3767
4150
  }
3768
4151
  }
@@ -3794,16 +4177,16 @@ async function getBootstrapStackInfo(sdk, stackName) {
3794
4177
  }
3795
4178
 
3796
4179
  // ../../aws-cdk/lib/api/deployments/deploy-stack.ts
3797
- var import_util13 = require("util");
4180
+ var import_util25 = require("util");
3798
4181
  var chalk9 = __toESM(require("chalk"));
3799
- var uuid2 = __toESM(require("uuid"));
4182
+ var uuid3 = __toESM(require("uuid"));
3800
4183
 
3801
4184
  // ../../aws-cdk/lib/api/deployments/assets.ts
3802
4185
  var path5 = __toESM(require("path"));
3803
4186
  var cxschema2 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
3804
4187
  var cxapi2 = __toESM(require("@aws-cdk/cx-api"));
3805
4188
  var chalk7 = __toESM(require("chalk"));
3806
- async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManifest, envResources, reuse) {
4189
+ async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envResources, reuse) {
3807
4190
  reuse = reuse || [];
3808
4191
  const assets = stack.assets;
3809
4192
  if (assets.length === 0) {
@@ -3817,23 +4200,23 @@ async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManif
3817
4200
  for (const asset of assets) {
3818
4201
  const reuseAsset = reuse.indexOf(asset.id) > -1;
3819
4202
  if (reuseAsset) {
3820
- await ioHost.notify(debug2(action, `Reusing asset ${asset.id}: ${JSON.stringify(asset)}`));
4203
+ await ioHelper.notify(debug3(`Reusing asset ${asset.id}: ${JSON.stringify(asset)}`));
3821
4204
  continue;
3822
4205
  }
3823
- await ioHost.notify(debug2(action, `Preparing asset ${asset.id}: ${JSON.stringify(asset)}`));
4206
+ await ioHelper.notify(debug3(`Preparing asset ${asset.id}: ${JSON.stringify(asset)}`));
3824
4207
  if (!stack.assembly) {
3825
4208
  throw new ToolkitError("Unexpected: stack assembly is required in order to find assets in assembly directory");
3826
4209
  }
3827
- Object.assign(params, await prepareAsset({ ioHost, action }, asset, assetManifest, envResources, toolkitInfo));
4210
+ Object.assign(params, await prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo));
3828
4211
  }
3829
4212
  return params;
3830
4213
  }
3831
- async function prepareAsset({ ioHost, action }, asset, assetManifest, envResources, toolkitInfo) {
4214
+ async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolkitInfo) {
3832
4215
  switch (asset.packaging) {
3833
4216
  case "zip":
3834
4217
  case "file":
3835
4218
  return prepareFileAsset(
3836
- { ioHost, action },
4219
+ ioHelper,
3837
4220
  asset,
3838
4221
  assetManifest,
3839
4222
  toolkitInfo,
@@ -3845,13 +4228,13 @@ async function prepareAsset({ ioHost, action }, asset, assetManifest, envResourc
3845
4228
  throw new ToolkitError(`Unsupported packaging type: ${asset.packaging}. You might need to upgrade your aws-cdk toolkit to support this asset type.`);
3846
4229
  }
3847
4230
  }
3848
- async function prepareFileAsset({ ioHost, action }, asset, assetManifest, toolkitInfo, packaging) {
4231
+ async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
3849
4232
  const extension = packaging === cxschema2.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path5.extname(asset.path);
3850
4233
  const baseName = `${asset.sourceHash}${extension}`;
3851
4234
  const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
3852
4235
  const key = `${s3Prefix}${baseName}`;
3853
4236
  const s3url = `s3://${toolkitInfo.bucketName}/${key}`;
3854
- await ioHost.notify(debug2(action, `Storing asset ${asset.path} at ${s3url}`));
4237
+ await ioHelper.notify(debug3(`Storing asset ${asset.path} at ${s3url}`));
3855
4238
  assetManifest.addFileAsset(asset.sourceHash, {
3856
4239
  path: asset.path,
3857
4240
  packaging
@@ -3892,7 +4275,7 @@ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
3892
4275
  }
3893
4276
 
3894
4277
  // ../../aws-cdk/lib/api/deployments/hotswap-deployments.ts
3895
- var import_util12 = require("util");
4278
+ var import_util23 = require("util");
3896
4279
  var cfn_diff = __toESM(require("@aws-cdk/cloudformation-diff"));
3897
4280
  var chalk8 = __toESM(require("chalk"));
3898
4281
 
@@ -4610,12 +4993,12 @@ async function fetchFileFromS3(s3Url, sdk) {
4610
4993
  async function exponentialBackOffRetry(fn, numOfRetries, backOff, errorCodeToRetry) {
4611
4994
  try {
4612
4995
  await fn();
4613
- } catch (error3) {
4614
- if (error3 && error3.name === errorCodeToRetry && numOfRetries > 0) {
4996
+ } catch (error4) {
4997
+ if (error4 && error4.name === errorCodeToRetry && numOfRetries > 0) {
4615
4998
  await sleep(backOff);
4616
4999
  await exponentialBackOffRetry(fn, numOfRetries - 1, backOff * 2, errorCodeToRetry);
4617
5000
  } else {
4618
- throw error3;
5001
+ throw error4;
4619
5002
  }
4620
5003
  }
4621
5004
  }
@@ -5196,7 +5579,7 @@ var RESOURCE_DETECTORS = {
5196
5579
  },
5197
5580
  "AWS::CDK::Metadata": async () => []
5198
5581
  };
5199
- async function tryHotswapDeployment(sdkProvider, { ioHost, action }, assetParams, cloudFormationStack, stackArtifact, hotswapMode, hotswapPropertyOverrides) {
5582
+ async function tryHotswapDeployment(sdkProvider, ioHelper, assetParams, cloudFormationStack, stackArtifact, hotswapMode, hotswapPropertyOverrides) {
5200
5583
  const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment);
5201
5584
  const sdk = (await sdkProvider.forEnvironment(resolvedEnv, 1 /* ForWriting */)).sdk;
5202
5585
  const currentTemplate = await loadCurrentTemplateWithNestedStacks(stackArtifact, sdk);
@@ -5218,13 +5601,13 @@ async function tryHotswapDeployment(sdkProvider, { ioHost, action }, assetParams
5218
5601
  currentTemplate.nestedStacks,
5219
5602
  hotswapPropertyOverrides
5220
5603
  );
5221
- await logNonHotswappableChanges({ ioHost, action }, nonHotswappableChanges, hotswapMode);
5604
+ await logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotswapMode);
5222
5605
  if (hotswapMode === "fall-back" /* FALL_BACK */) {
5223
5606
  if (nonHotswappableChanges.length > 0) {
5224
5607
  return void 0;
5225
5608
  }
5226
5609
  }
5227
- await applyAllHotswappableChanges(sdk, { ioHost, action }, hotswappableChanges);
5610
+ await applyAllHotswappableChanges(sdk, ioHelper, hotswappableChanges);
5228
5611
  return {
5229
5612
  type: "did-deploy-stack",
5230
5613
  noOp: hotswappableChanges.length === 0,
@@ -5415,51 +5798,51 @@ function isCandidateForHotswapping(change, logicalId) {
5415
5798
  propertyUpdates: change.propertyUpdates
5416
5799
  };
5417
5800
  }
5418
- async function applyAllHotswappableChanges(sdk, { ioHost, action }, hotswappableChanges) {
5801
+ async function applyAllHotswappableChanges(sdk, ioHelper, hotswappableChanges) {
5419
5802
  if (hotswappableChanges.length > 0) {
5420
- await ioHost.notify(info2(action, `
5803
+ await ioHelper.notify(info3(`
5421
5804
  ${ICON} hotswapping resources:`));
5422
5805
  }
5423
5806
  const limit = pLimit(10);
5424
5807
  return Promise.all(hotswappableChanges.map((hotswapOperation) => limit(() => {
5425
- return applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation);
5808
+ return applyHotswappableChange(sdk, ioHelper, hotswapOperation);
5426
5809
  })));
5427
5810
  }
5428
- async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation) {
5811
+ async function applyHotswappableChange(sdk, ioHelper, hotswapOperation) {
5429
5812
  const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
5430
5813
  sdk.appendCustomUserAgent(customUserAgent);
5431
5814
  for (const name of hotswapOperation.resourceNames) {
5432
- await ioHost.notify(info2(action, (0, import_util12.format)(` ${ICON} %s`, chalk8.bold(name))));
5815
+ await ioHelper.notify(info3((0, import_util23.format)(` ${ICON} %s`, chalk8.bold(name))));
5433
5816
  }
5434
5817
  try {
5435
5818
  await hotswapOperation.apply(sdk);
5436
5819
  } catch (e) {
5437
5820
  if (e.name === "TimeoutError" || e.name === "AbortError") {
5438
- const result = JSON.parse(formatErrorMessage(e));
5439
- const error3 = new ToolkitError(formatWaiterErrorResult(result));
5440
- error3.name = e.name;
5441
- throw error3;
5821
+ const result2 = JSON.parse(formatErrorMessage(e));
5822
+ const error4 = new ToolkitError(formatWaiterErrorResult(result2));
5823
+ error4.name = e.name;
5824
+ throw error4;
5442
5825
  }
5443
5826
  throw e;
5444
5827
  }
5445
5828
  for (const name of hotswapOperation.resourceNames) {
5446
- await ioHost.notify(info2(action, (0, import_util12.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
5829
+ await ioHelper.notify(info3((0, import_util23.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
5447
5830
  }
5448
5831
  sdk.removeCustomUserAgent(customUserAgent);
5449
5832
  }
5450
- function formatWaiterErrorResult(result) {
5833
+ function formatWaiterErrorResult(result2) {
5451
5834
  const main = [
5452
- `Resource is not in the expected state due to waiter status: ${result.state}`,
5453
- result.reason ? `${result.reason}.` : ""
5835
+ `Resource is not in the expected state due to waiter status: ${result2.state}`,
5836
+ result2.reason ? `${result2.reason}.` : ""
5454
5837
  ].join(". ");
5455
- if (result.observedResponses != null) {
5456
- const observedResponses = Object.entries(result.observedResponses).map(([msg, count]) => ` - ${msg} (${count})`).join("\n");
5838
+ if (result2.observedResponses != null) {
5839
+ const observedResponses = Object.entries(result2.observedResponses).map(([msg, count]) => ` - ${msg} (${count})`).join("\n");
5457
5840
  return `${main} Observed responses:
5458
5841
  ${observedResponses}`;
5459
5842
  }
5460
5843
  return main;
5461
5844
  }
5462
- async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChanges, hotswapMode) {
5845
+ async function logNonHotswappableChanges(ioHelper, nonHotswappableChanges, hotswapMode) {
5463
5846
  if (nonHotswappableChanges.length === 0) {
5464
5847
  return;
5465
5848
  }
@@ -5471,13 +5854,13 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
5471
5854
  }
5472
5855
  const messages = [""];
5473
5856
  if (hotswapMode === "hotswap-only" /* HOTSWAP_ONLY */) {
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")));
5857
+ messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
5475
5858
  } else {
5476
- messages.push((0, import_util12.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
5859
+ messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
5477
5860
  }
5478
5861
  for (const change of nonHotswappableChanges) {
5479
5862
  if (change.rejectedChanges.length > 0) {
5480
- messages.push((0, import_util12.format)(
5863
+ messages.push((0, import_util23.format)(
5481
5864
  " logicalID: %s, type: %s, rejected changes: %s, reason: %s",
5482
5865
  chalk8.bold(change.logicalId),
5483
5866
  chalk8.bold(change.resourceType),
@@ -5485,7 +5868,7 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
5485
5868
  chalk8.red(change.reason)
5486
5869
  ));
5487
5870
  } else {
5488
- messages.push((0, import_util12.format)(
5871
+ messages.push((0, import_util23.format)(
5489
5872
  " logicalID: %s, type: %s, reason: %s",
5490
5873
  chalk8.bold(change.logicalId),
5491
5874
  chalk8.bold(change.resourceType),
@@ -5494,11 +5877,11 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
5494
5877
  }
5495
5878
  }
5496
5879
  messages.push("");
5497
- await ioHost.notify(info2(action, messages.join("\n")));
5880
+ await ioHelper.notify(info3(messages.join("\n")));
5498
5881
  }
5499
5882
 
5500
5883
  // ../../aws-cdk/lib/api/deployments/deploy-stack.ts
5501
- async function deployStack(options, { ioHost, action }) {
5884
+ async function deployStack(options, ioHelper) {
5502
5885
  const stackArtifact = options.stack;
5503
5886
  const stackEnv = options.resolvedEnvironment;
5504
5887
  options.sdk.appendCustomUserAgent(options.extraUserAgent);
@@ -5506,12 +5889,11 @@ async function deployStack(options, { ioHost, action }) {
5506
5889
  const deployName = options.deployName || stackArtifact.stackName;
5507
5890
  let cloudFormationStack = await CloudFormationStack.lookup(cfn, deployName);
5508
5891
  if (cloudFormationStack.stackStatus.isCreationFailure) {
5509
- await ioHost.notify(debug2(
5510
- action,
5892
+ await ioHelper.notify(debug3(
5511
5893
  `Found existing stack ${deployName} that had previously failed creation. Deleting it before attempting to re-create it.`
5512
5894
  ));
5513
5895
  await cfn.deleteStack({ StackName: deployName });
5514
- const deletedStack = await waitForStackDelete(cfn, { ioHost, action }, deployName);
5896
+ const deletedStack = await waitForStackDelete(cfn, ioHelper, deployName);
5515
5897
  if (deletedStack && deletedStack.stackStatus.name !== "DELETE_COMPLETE") {
5516
5898
  throw new ToolkitError(
5517
5899
  `Failed deleting stack ${deployName} that had previously failed creation (current state: ${deletedStack.stackStatus})`
@@ -5521,7 +5903,7 @@ async function deployStack(options, { ioHost, action }) {
5521
5903
  }
5522
5904
  const legacyAssets = new AssetManifestBuilder();
5523
5905
  const assetParams = await addMetadataAssetsToManifest(
5524
- { ioHost, action },
5906
+ ioHelper,
5525
5907
  stackArtifact,
5526
5908
  legacyAssets,
5527
5909
  options.envResources,
@@ -5532,12 +5914,11 @@ async function deployStack(options, { ioHost, action }) {
5532
5914
  const stackParams = options.usePreviousParameters ? templateParams.updateExisting(finalParameterValues, cloudFormationStack.parameters) : templateParams.supplyAll(finalParameterValues);
5533
5915
  const hotswapMode = options.hotswap ?? "full-deployment" /* FULL_DEPLOYMENT */;
5534
5916
  const hotswapPropertyOverrides = options.hotswapPropertyOverrides ?? new HotswapPropertyOverrides();
5535
- if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters), { ioHost, action })) {
5536
- await ioHost.notify(debug2(action, `${deployName}: skipping deployment (use --force to override)`));
5917
+ if (await canSkipDeploy(options, cloudFormationStack, stackParams.hasChanges(cloudFormationStack.parameters), ioHelper)) {
5918
+ await ioHelper.notify(debug3(`${deployName}: skipping deployment (use --force to override)`));
5537
5919
  if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
5538
- await ioHost.notify(info2(
5539
- action,
5540
- (0, import_util13.format)(
5920
+ await ioHelper.notify(info3(
5921
+ (0, import_util25.format)(
5541
5922
  `
5542
5923
  ${ICON} %s
5543
5924
  `,
@@ -5552,7 +5933,7 @@ async function deployStack(options, { ioHost, action }) {
5552
5933
  stackArn: cloudFormationStack.stackId
5553
5934
  };
5554
5935
  } else {
5555
- await ioHost.notify(debug2(action, `${deployName}: deploying...`));
5936
+ await ioHelper.notify(debug3(`${deployName}: deploying...`));
5556
5937
  }
5557
5938
  const bodyParameter = await makeBodyParameter(
5558
5939
  stackArtifact,
@@ -5565,17 +5946,17 @@ async function deployStack(options, { ioHost, action }) {
5565
5946
  try {
5566
5947
  bootstrapStackName = (await options.envResources.lookupToolkit()).stackName;
5567
5948
  } catch (e) {
5568
- await ioHost.notify(debug2(action, `Could not determine the bootstrap stack name: ${e}`));
5949
+ await ioHelper.notify(debug3(`Could not determine the bootstrap stack name: ${e}`));
5569
5950
  }
5570
5951
  await publishAssets(legacyAssets.toManifest(stackArtifact.assembly.directory), options.sdkProvider, stackEnv, {
5571
5952
  parallel: options.assetParallelism,
5572
- allowCrossAccount: await determineAllowCrossAccountAssetPublishing(options.sdk, { ioHost, action }, bootstrapStackName)
5573
- }, { ioHost, action });
5953
+ allowCrossAccount: await determineAllowCrossAccountAssetPublishing(options.sdk, ioHelper, bootstrapStackName)
5954
+ }, ioHelper);
5574
5955
  if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
5575
5956
  try {
5576
5957
  const hotswapDeploymentResult = await tryHotswapDeployment(
5577
5958
  options.sdkProvider,
5578
- { ioHost, action },
5959
+ ioHelper,
5579
5960
  stackParams.values,
5580
5961
  cloudFormationStack,
5581
5962
  stackArtifact,
@@ -5585,7 +5966,7 @@ async function deployStack(options, { ioHost, action }) {
5585
5966
  if (hotswapDeploymentResult) {
5586
5967
  return hotswapDeploymentResult;
5587
5968
  }
5588
- await ioHost.notify(info2(action, (0, import_util13.format)(
5969
+ await ioHelper.notify(info3((0, import_util25.format)(
5589
5970
  "Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
5590
5971
  stackArtifact.displayName
5591
5972
  )));
@@ -5593,13 +5974,13 @@ async function deployStack(options, { ioHost, action }) {
5593
5974
  if (!(e instanceof CfnEvaluationException)) {
5594
5975
  throw e;
5595
5976
  }
5596
- await ioHost.notify(info2(action, (0, import_util13.format)(
5977
+ await ioHelper.notify(info3((0, import_util25.format)(
5597
5978
  "Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
5598
5979
  formatErrorMessage(e)
5599
5980
  )));
5600
5981
  }
5601
5982
  if (hotswapMode === "fall-back" /* FALL_BACK */) {
5602
- await ioHost.notify(info2(action, "Falling back to doing a full deployment"));
5983
+ await ioHelper.notify(info3("Falling back to doing a full deployment"));
5603
5984
  options.sdk.appendCustomUserAgent("cdk-hotswap/fallback");
5604
5985
  } else {
5605
5986
  return {
@@ -5616,25 +5997,23 @@ async function deployStack(options, { ioHost, action }) {
5616
5997
  stackArtifact,
5617
5998
  stackParams,
5618
5999
  bodyParameter,
5619
- ioHost,
5620
- action
6000
+ ioHelper
5621
6001
  );
5622
6002
  return fullDeployment.performDeployment();
5623
6003
  }
5624
6004
  var FullCloudFormationDeployment = class {
5625
- constructor(options, cloudFormationStack, stackArtifact, stackParams, bodyParameter, ioHost, action) {
6005
+ constructor(options, cloudFormationStack, stackArtifact, stackParams, bodyParameter, ioHelper) {
5626
6006
  this.options = options;
5627
6007
  this.cloudFormationStack = cloudFormationStack;
5628
6008
  this.stackArtifact = stackArtifact;
5629
6009
  this.stackParams = stackParams;
5630
6010
  this.bodyParameter = bodyParameter;
5631
- this.ioHost = ioHost;
5632
- this.action = action;
6011
+ this.ioHelper = ioHelper;
5633
6012
  this.cfn = options.sdk.cloudFormation();
5634
6013
  this.stackName = options.deployName ?? stackArtifact.stackName;
5635
6014
  this.update = cloudFormationStack.exists && cloudFormationStack.stackStatus.name !== "REVIEW_IN_PROGRESS";
5636
6015
  this.verb = this.update ? "update" : "create";
5637
- this.uuid = uuid2.v4();
6016
+ this.uuid = uuid3.v4();
5638
6017
  }
5639
6018
  async performDeployment() {
5640
6019
  const deploymentMethod = this.options.deploymentMethod ?? {
@@ -5657,17 +6036,16 @@ var FullCloudFormationDeployment = class {
5657
6036
  const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
5658
6037
  await this.updateTerminationProtection();
5659
6038
  if (changeSetHasNoChanges(changeSetDescription)) {
5660
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("No changes are to be performed on %s.", this.stackName)));
6039
+ await this.ioHelper.notify(debug3((0, import_util25.format)("No changes are to be performed on %s.", this.stackName)));
5661
6040
  if (execute) {
5662
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
6041
+ await this.ioHelper.notify(debug3((0, import_util25.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
5663
6042
  await this.cfn.deleteChangeSet({
5664
6043
  StackName: this.stackName,
5665
6044
  ChangeSetName: changeSetName
5666
6045
  });
5667
6046
  }
5668
6047
  if (this.options.force) {
5669
- await this.ioHost.notify(warn(
5670
- this.action,
6048
+ await this.ioHelper.notify(warn2(
5671
6049
  [
5672
6050
  "You used the --force flag, but CloudFormation reported that the deployment would not make any changes.",
5673
6051
  "According to CloudFormation, all resources are already up-to-date with the state in your CDK app.",
@@ -5685,7 +6063,7 @@ var FullCloudFormationDeployment = class {
5685
6063
  };
5686
6064
  }
5687
6065
  if (!execute) {
5688
- await this.ioHost.notify(info2(this.action, (0, import_util13.format)(
6066
+ await this.ioHelper.notify(info3((0, import_util25.format)(
5689
6067
  "Changeset %s created and waiting in review for manual execution (--no-execute)",
5690
6068
  changeSetDescription.ChangeSetId
5691
6069
  )));
@@ -5712,8 +6090,8 @@ var FullCloudFormationDeployment = class {
5712
6090
  }
5713
6091
  async createChangeSet(changeSetName, willExecute, importExistingResources) {
5714
6092
  await this.cleanupOldChangeset(changeSetName);
5715
- await this.ioHost.notify(debug2(this.action, `Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
5716
- await this.ioHost.notify(info2(this.action, (0, import_util13.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
6093
+ await this.ioHelper.notify(debug3(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
6094
+ await this.ioHelper.notify(info3((0, import_util25.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
5717
6095
  const changeSet = await this.cfn.createChangeSet({
5718
6096
  StackName: this.stackName,
5719
6097
  ChangeSetName: changeSetName,
@@ -5724,22 +6102,21 @@ var FullCloudFormationDeployment = class {
5724
6102
  ImportExistingResources: importExistingResources,
5725
6103
  ...this.commonPrepareOptions()
5726
6104
  });
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)));
5728
- return waitForChangeSet(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName, changeSetName, {
6105
+ await this.ioHelper.notify(debug3((0, import_util25.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
6106
+ return waitForChangeSet(this.cfn, this.ioHelper, this.stackName, changeSetName, {
5729
6107
  fetchAll: willExecute
5730
6108
  });
5731
6109
  }
5732
6110
  async executeChangeSet(changeSet) {
5733
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
6111
+ await this.ioHelper.notify(debug3((0, import_util25.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
5734
6112
  await this.cfn.executeChangeSet({
5735
6113
  StackName: this.stackName,
5736
6114
  ChangeSetName: changeSet.ChangeSetName,
5737
6115
  ClientRequestToken: `exec${this.uuid}`,
5738
6116
  ...this.commonExecuteOptions()
5739
6117
  });
5740
- await this.ioHost.notify(debug2(
5741
- this.action,
5742
- (0, import_util13.format)(
6118
+ await this.ioHelper.notify(debug3(
6119
+ (0, import_util25.format)(
5743
6120
  "Execution of changeset %s on stack %s has started; waiting for the update to complete...",
5744
6121
  changeSet.ChangeSetId,
5745
6122
  this.stackName
@@ -5750,7 +6127,7 @@ var FullCloudFormationDeployment = class {
5750
6127
  }
5751
6128
  async cleanupOldChangeset(changeSetName) {
5752
6129
  if (this.cloudFormationStack.exists) {
5753
- await this.ioHost.notify(debug2(this.action, `Removing existing change set with name ${changeSetName} if it exists`));
6130
+ await this.ioHelper.notify(debug3(`Removing existing change set with name ${changeSetName} if it exists`));
5754
6131
  await this.cfn.deleteChangeSet({
5755
6132
  StackName: this.stackName,
5756
6133
  ChangeSetName: changeSetName
@@ -5760,9 +6137,8 @@ var FullCloudFormationDeployment = class {
5760
6137
  async updateTerminationProtection() {
5761
6138
  const terminationProtection = this.stackArtifact.terminationProtection ?? false;
5762
6139
  if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
5763
- await this.ioHost.notify(debug2(
5764
- this.action,
5765
- (0, import_util13.format)(
6140
+ await this.ioHelper.notify(debug3(
6141
+ (0, import_util25.format)(
5766
6142
  "Updating termination protection from %s to %s for stack %s",
5767
6143
  this.cloudFormationStack.terminationProtection,
5768
6144
  terminationProtection,
@@ -5773,11 +6149,11 @@ var FullCloudFormationDeployment = class {
5773
6149
  StackName: this.stackName,
5774
6150
  EnableTerminationProtection: terminationProtection
5775
6151
  });
5776
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
6152
+ await this.ioHelper.notify(debug3((0, import_util25.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
5777
6153
  }
5778
6154
  }
5779
6155
  async directDeployment() {
5780
- await this.ioHost.notify(info2(this.action, (0, import_util13.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
6156
+ await this.ioHelper.notify(info3((0, import_util25.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
5781
6157
  const startTime = /* @__PURE__ */ new Date();
5782
6158
  if (this.update) {
5783
6159
  await this.updateTerminationProtection();
@@ -5790,7 +6166,7 @@ var FullCloudFormationDeployment = class {
5790
6166
  });
5791
6167
  } catch (err) {
5792
6168
  if (err.message === "No updates are to be performed.") {
5793
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("No updates are to be performed for stack %s", this.stackName)));
6169
+ await this.ioHelper.notify(debug3((0, import_util25.format)("No updates are to be performed for stack %s", this.stackName)));
5794
6170
  return {
5795
6171
  type: "did-deploy-stack",
5796
6172
  noOp: true,
@@ -5819,14 +6195,13 @@ var FullCloudFormationDeployment = class {
5819
6195
  stack: this.stackArtifact,
5820
6196
  stackName: this.stackName,
5821
6197
  resourcesTotal: expectedChanges,
5822
- ioHost: this.ioHost,
5823
- action: this.action,
6198
+ ioHelper: this.ioHelper,
5824
6199
  changeSetCreationTime: startTime
5825
6200
  });
5826
6201
  await monitor.start();
5827
6202
  let finalState = this.cloudFormationStack;
5828
6203
  try {
5829
- const successStack = await waitForStackDeploy(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName);
6204
+ const successStack = await waitForStackDeploy(this.cfn, this.ioHelper, this.stackName);
5830
6205
  if (!successStack) {
5831
6206
  throw new ToolkitError("Stack deploy failed (the stack disappeared while we were deploying it)");
5832
6207
  }
@@ -5836,7 +6211,7 @@ var FullCloudFormationDeployment = class {
5836
6211
  } finally {
5837
6212
  await monitor.stop();
5838
6213
  }
5839
- debug2(this.action, (0, import_util13.format)("Stack %s has completed updating", this.stackName));
6214
+ debug3((0, import_util25.format)("Stack %s has completed updating", this.stackName));
5840
6215
  return {
5841
6216
  type: "did-deploy-stack",
5842
6217
  noOp: false,
@@ -5872,7 +6247,7 @@ var FullCloudFormationDeployment = class {
5872
6247
  };
5873
6248
  }
5874
6249
  };
5875
- async function destroyStack(options, { ioHost, action }) {
6250
+ async function destroyStack(options, ioHelper) {
5876
6251
  const deployName = options.deployName || options.stack.stackName;
5877
6252
  const cfn = options.sdk.cloudFormation();
5878
6253
  const currentStack = await CloudFormationStack.lookup(cfn, deployName);
@@ -5883,13 +6258,12 @@ async function destroyStack(options, { ioHost, action }) {
5883
6258
  cfn,
5884
6259
  stack: options.stack,
5885
6260
  stackName: deployName,
5886
- ioHost,
5887
- action
6261
+ ioHelper
5888
6262
  });
5889
6263
  await monitor.start();
5890
6264
  try {
5891
6265
  await cfn.deleteStack({ StackName: deployName, RoleARN: options.roleArn });
5892
- const destroyedStack = await waitForStackDelete(cfn, { ioHost, action }, deployName);
6266
+ const destroyedStack = await waitForStackDelete(cfn, ioHelper, deployName);
5893
6267
  if (destroyedStack && destroyedStack.stackStatus.name !== "DELETE_COMPLETE") {
5894
6268
  throw new ToolkitError(`Failed to destroy ${deployName}: ${destroyedStack.stackStatus}`);
5895
6269
  }
@@ -5901,47 +6275,47 @@ async function destroyStack(options, { ioHost, action }) {
5901
6275
  }
5902
6276
  }
5903
6277
  }
5904
- async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges, { ioHost, action }) {
6278
+ async function canSkipDeploy(deployStackOptions, cloudFormationStack, parameterChanges, ioHelper) {
5905
6279
  const deployName = deployStackOptions.deployName || deployStackOptions.stack.stackName;
5906
- await ioHost.notify(debug2(action, `${deployName}: checking if we can skip deploy`));
6280
+ await ioHelper.notify(debug3(`${deployName}: checking if we can skip deploy`));
5907
6281
  if (deployStackOptions.force) {
5908
- await ioHost.notify(debug2(action, `${deployName}: forced deployment`));
6282
+ await ioHelper.notify(debug3(`${deployName}: forced deployment`));
5909
6283
  return false;
5910
6284
  }
5911
6285
  if (deployStackOptions.deploymentMethod?.method === "change-set" && deployStackOptions.deploymentMethod.execute === false) {
5912
- await ioHost.notify(debug2(action, `${deployName}: --no-execute, always creating change set`));
6286
+ await ioHelper.notify(debug3(`${deployName}: --no-execute, always creating change set`));
5913
6287
  return false;
5914
6288
  }
5915
6289
  if (!cloudFormationStack.exists) {
5916
- await ioHost.notify(debug2(action, `${deployName}: no existing stack`));
6290
+ await ioHelper.notify(debug3(`${deployName}: no existing stack`));
5917
6291
  return false;
5918
6292
  }
5919
6293
  if (JSON.stringify(deployStackOptions.stack.template) !== JSON.stringify(await cloudFormationStack.template())) {
5920
- await ioHost.notify(debug2(action, `${deployName}: template has changed`));
6294
+ await ioHelper.notify(debug3(`${deployName}: template has changed`));
5921
6295
  return false;
5922
6296
  }
5923
6297
  if (!compareTags(cloudFormationStack.tags, deployStackOptions.tags ?? [])) {
5924
- await ioHost.notify(debug2(action, `${deployName}: tags have changed`));
6298
+ await ioHelper.notify(debug3(`${deployName}: tags have changed`));
5925
6299
  return false;
5926
6300
  }
5927
6301
  if (!arrayEquals(cloudFormationStack.notificationArns, deployStackOptions.notificationArns ?? [])) {
5928
- await ioHost.notify(debug2(action, `${deployName}: notification arns have changed`));
6302
+ await ioHelper.notify(debug3(`${deployName}: notification arns have changed`));
5929
6303
  return false;
5930
6304
  }
5931
6305
  if (!!deployStackOptions.stack.terminationProtection !== !!cloudFormationStack.terminationProtection) {
5932
- await ioHost.notify(debug2(action, `${deployName}: termination protection has been updated`));
6306
+ await ioHelper.notify(debug3(`${deployName}: termination protection has been updated`));
5933
6307
  return false;
5934
6308
  }
5935
6309
  if (parameterChanges) {
5936
6310
  if (parameterChanges === "ssm") {
5937
- await ioHost.notify(debug2(action, `${deployName}: some parameters come from SSM so we have to assume they may have changed`));
6311
+ await ioHelper.notify(debug3(`${deployName}: some parameters come from SSM so we have to assume they may have changed`));
5938
6312
  } else {
5939
- await ioHost.notify(debug2(action, `${deployName}: parameters have changed`));
6313
+ await ioHelper.notify(debug3(`${deployName}: parameters have changed`));
5940
6314
  }
5941
6315
  return false;
5942
6316
  }
5943
6317
  if (cloudFormationStack.stackStatus.isFailure) {
5944
- await ioHost.notify(debug2(action, `${deployName}: stack is in a failure state`));
6318
+ await ioHelper.notify(debug3(`${deployName}: stack is in a failure state`));
5945
6319
  return false;
5946
6320
  }
5947
6321
  return true;
@@ -5973,34 +6347,54 @@ function hasReplacement(cs) {
5973
6347
 
5974
6348
  // ../../aws-cdk/lib/notices.ts
5975
6349
  var https = __toESM(require("node:https"));
5976
- var path9 = __toESM(require("path"));
5977
- var fs10 = __toESM(require("fs-extra"));
6350
+ var path10 = __toESM(require("path"));
6351
+ var fs11 = __toESM(require("fs-extra"));
5978
6352
  var semver4 = __toESM(require("semver"));
5979
6353
 
5980
6354
  // ../../aws-cdk/lib/cli/version.ts
5981
- var path7 = __toESM(require("path"));
6355
+ var path8 = __toESM(require("path"));
5982
6356
  var chalk10 = __toESM(require("chalk"));
5983
- var fs8 = __toESM(require("fs-extra"));
6357
+ var fs9 = __toESM(require("fs-extra"));
5984
6358
  var semver3 = __toESM(require("semver"));
5985
6359
 
6360
+ // ../../aws-cdk/lib/cli/root-dir.ts
6361
+ var fs8 = __toESM(require("fs"));
6362
+ var path7 = __toESM(require("path"));
6363
+ function cliRootDir(fail) {
6364
+ function _rootDir(dirname6) {
6365
+ const manifestPath = path7.join(dirname6, "package.json");
6366
+ if (fs8.existsSync(manifestPath)) {
6367
+ return dirname6;
6368
+ }
6369
+ if (path7.dirname(dirname6) === dirname6) {
6370
+ if (fail ?? true) {
6371
+ throw new ToolkitError("Unable to find package manifest");
6372
+ }
6373
+ return void 0;
6374
+ }
6375
+ return _rootDir(path7.dirname(dirname6));
6376
+ }
6377
+ return _rootDir(__dirname);
6378
+ }
6379
+
5986
6380
  // ../../aws-cdk/lib/cli/util/console-formatters.ts
5987
6381
  var stripAnsi = require("strip-ansi");
5988
6382
 
5989
6383
  // ../../aws-cdk/lib/cli/util/npm.ts
5990
6384
  var import_child_process = require("child_process");
5991
- var import_util14 = require("util");
6385
+ var import_util27 = require("util");
5992
6386
  var semver2 = __toESM(require("semver"));
5993
- var exec = (0, import_util14.promisify)(import_child_process.exec);
6387
+ var exec = (0, import_util27.promisify)(import_child_process.exec);
5994
6388
 
5995
6389
  // ../../aws-cdk/lib/cli/version.ts
5996
6390
  var ONE_DAY_IN_SECONDS = 1 * 24 * 60 * 60;
5997
6391
  function versionNumber() {
5998
- return require(path7.join(rootDir(), "package.json")).version.replace(/\+[0-9a-f]+$/, "");
6392
+ return require(path8.join(cliRootDir(), "package.json")).version.replace(/\+[0-9a-f]+$/, "");
5999
6393
  }
6000
6394
 
6001
6395
  // ../../aws-cdk/lib/tree.ts
6002
- var path8 = __toESM(require("path"));
6003
- var fs9 = __toESM(require("fs-extra"));
6396
+ var path9 = __toESM(require("path"));
6397
+ var fs10 = __toESM(require("fs-extra"));
6004
6398
  function some(node, predicate) {
6005
6399
  return node != null && (predicate(node) || findInChildren());
6006
6400
  function findInChildren() {
@@ -6011,23 +6405,23 @@ function loadTree(assembly) {
6011
6405
  try {
6012
6406
  const outdir = assembly.directory;
6013
6407
  const fileName = assembly.tree()?.file;
6014
- return fileName ? fs9.readJSONSync(path8.join(outdir, fileName)).tree : {};
6408
+ return fileName ? fs10.readJSONSync(path9.join(outdir, fileName)).tree : {};
6015
6409
  } catch (e) {
6016
- trace(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
6410
+ trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
6017
6411
  return void 0;
6018
6412
  }
6019
6413
  }
6020
6414
  function loadTreeFromDir(outdir) {
6021
6415
  try {
6022
- return fs9.readJSONSync(path8.join(outdir, "tree.json")).tree;
6416
+ return fs10.readJSONSync(path9.join(outdir, "tree.json")).tree;
6023
6417
  } catch (e) {
6024
- trace(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
6418
+ trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
6025
6419
  return void 0;
6026
6420
  }
6027
6421
  }
6028
6422
 
6029
6423
  // ../../aws-cdk/lib/notices.ts
6030
- var CACHE_FILE_PATH = path9.join(cdkCacheDir(), "notices.json");
6424
+ var CACHE_FILE_PATH = path10.join(cdkCacheDir(), "notices.json");
6031
6425
  var NoticesFilter = class _NoticesFilter {
6032
6426
  static filter(options) {
6033
6427
  const components = [
@@ -6210,7 +6604,7 @@ var Notices = class _Notices {
6210
6604
  const notices = await dataSource.fetch();
6211
6605
  this.data = new Set(this.includeAcknowlegded ? notices : notices.filter((n) => !this.acknowledgedIssueNumbers.has(n.issueNumber)));
6212
6606
  } catch (e) {
6213
- debug(`Could not refresh notices: ${e}`);
6607
+ debug2(`Could not refresh notices: ${e}`);
6214
6608
  }
6215
6609
  }
6216
6610
  /**
@@ -6227,9 +6621,9 @@ var Notices = class _Notices {
6227
6621
  bootstrappedEnvironments: Array.from(this.bootstrappedEnvironments.values())
6228
6622
  });
6229
6623
  if (filteredNotices.length > 0) {
6230
- info("");
6231
- info("NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)");
6232
- info("");
6624
+ info2("");
6625
+ info2("NOTICES (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)");
6626
+ info2("");
6233
6627
  for (const filtered of filteredNotices) {
6234
6628
  const formatted = filtered.format();
6235
6629
  switch (filtered.notice.severity) {
@@ -6237,18 +6631,18 @@ var Notices = class _Notices {
6237
6631
  warning(formatted);
6238
6632
  break;
6239
6633
  case "error":
6240
- error(formatted);
6634
+ error2(formatted);
6241
6635
  break;
6242
6636
  default:
6243
- info(formatted);
6637
+ info2(formatted);
6244
6638
  }
6245
- info("");
6639
+ info2("");
6246
6640
  }
6247
- info(`If you don\u2019t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge ${filteredNotices[0].notice.issueNumber}".`);
6641
+ info2(`If you don\u2019t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge ${filteredNotices[0].notice.issueNumber}".`);
6248
6642
  }
6249
6643
  if (options.showTotal ?? false) {
6250
- info("");
6251
- info(`There are ${filteredNotices.length} unacknowledged notice(s).`);
6644
+ info2("");
6645
+ info2(`There are ${filteredNotices.length} unacknowledged notice(s).`);
6252
6646
  }
6253
6647
  }
6254
6648
  };
@@ -6322,7 +6716,7 @@ var WebsiteNoticeDataSource = class {
6322
6716
  if (!data) {
6323
6717
  throw new ToolkitError("'notices' key is missing");
6324
6718
  }
6325
- debug("Notices refreshed");
6719
+ debug2("Notices refreshed");
6326
6720
  resolve3(data ?? []);
6327
6721
  } catch (e) {
6328
6722
  reject(new ToolkitError(`Failed to parse notices: ${formatErrorMessage(e)}`));
@@ -6360,7 +6754,7 @@ var CachedDataSource = class {
6360
6754
  await this.save(freshData);
6361
6755
  return freshData.notices;
6362
6756
  } else {
6363
- debug(`Reading cached notices from ${this.fileName}`);
6757
+ debug2(`Reading cached notices from ${this.fileName}`);
6364
6758
  return data;
6365
6759
  }
6366
6760
  }
@@ -6371,7 +6765,7 @@ var CachedDataSource = class {
6371
6765
  notices: await this.dataSource.fetch()
6372
6766
  };
6373
6767
  } catch (e) {
6374
- debug(`Could not refresh notices: ${e}`);
6768
+ debug2(`Could not refresh notices: ${e}`);
6375
6769
  return {
6376
6770
  expiration: Date.now() + TIME_TO_LIVE_ERROR,
6377
6771
  notices: []
@@ -6384,23 +6778,23 @@ var CachedDataSource = class {
6384
6778
  notices: []
6385
6779
  };
6386
6780
  try {
6387
- return fs10.existsSync(this.fileName) ? await fs10.readJSON(this.fileName) : defaultValue;
6781
+ return fs11.existsSync(this.fileName) ? await fs11.readJSON(this.fileName) : defaultValue;
6388
6782
  } catch (e) {
6389
- debug(`Failed to load notices from cache: ${e}`);
6783
+ debug2(`Failed to load notices from cache: ${e}`);
6390
6784
  return defaultValue;
6391
6785
  }
6392
6786
  }
6393
6787
  async save(cached2) {
6394
6788
  try {
6395
- await fs10.writeJSON(this.fileName, cached2);
6789
+ await fs11.writeJSON(this.fileName, cached2);
6396
6790
  } catch (e) {
6397
- debug(`Failed to store notices in the cache: ${e}`);
6791
+ debug2(`Failed to store notices in the cache: ${e}`);
6398
6792
  }
6399
6793
  }
6400
6794
  };
6401
6795
 
6402
6796
  // ../../aws-cdk/lib/api/toolkit-info.ts
6403
- var import_util15 = require("util");
6797
+ var import_util30 = require("util");
6404
6798
  var chalk11 = __toESM(require("chalk"));
6405
6799
 
6406
6800
  // ../../aws-cdk/lib/api/bootstrap/bootstrap-props.ts
@@ -6408,6 +6802,7 @@ var BUCKET_NAME_OUTPUT = "BucketName";
6408
6802
  var REPOSITORY_NAME_OUTPUT = "ImageRepositoryName";
6409
6803
  var BUCKET_DOMAIN_NAME_OUTPUT = "BucketDomainName";
6410
6804
  var BOOTSTRAP_VERSION_OUTPUT = "BootstrapVersion";
6805
+ var BOOTSTRAP_VERSION_RESOURCE = "CdkBootstrapVersion";
6411
6806
  var BOOTSTRAP_VARIANT_PARAMETER = "BootstrapVariant";
6412
6807
  var DEFAULT_BOOTSTRAP_VARIANT = "AWS CDK: Default Resources";
6413
6808
 
@@ -6417,15 +6812,14 @@ var ToolkitInfo = class _ToolkitInfo {
6417
6812
  static determineName(overrideName) {
6418
6813
  return overrideName ?? DEFAULT_TOOLKIT_STACK_NAME;
6419
6814
  }
6420
- static async lookup(environment, sdk, { ioHost, action }, stackName) {
6815
+ static async lookup(environment, sdk, ioHelper, stackName) {
6421
6816
  const cfn = sdk.cloudFormation();
6422
6817
  stackName = _ToolkitInfo.determineName(stackName);
6423
6818
  try {
6424
- const stack = await stabilizeStack(cfn, { ioHost, action }, stackName);
6819
+ const stack = await stabilizeStack(cfn, ioHelper, stackName);
6425
6820
  if (!stack) {
6426
- await ioHost.notify(debug2(
6427
- action,
6428
- (0, import_util15.format)(
6821
+ await ioHelper.notify(debug3(
6822
+ (0, import_util30.format)(
6429
6823
  "The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
6430
6824
  environment.name,
6431
6825
  stackName,
@@ -6435,9 +6829,8 @@ var ToolkitInfo = class _ToolkitInfo {
6435
6829
  return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
6436
6830
  }
6437
6831
  if (stack.stackStatus.isCreationFailure) {
6438
- await ioHost.notify(debug2(
6439
- action,
6440
- (0, import_util15.format)(
6832
+ await ioHelper.notify(debug3(
6833
+ (0, import_util30.format)(
6441
6834
  "The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
6442
6835
  environment.name,
6443
6836
  stackName,
@@ -6548,21 +6941,21 @@ var EnvironmentResourcesRegistry = class {
6548
6941
  this.toolkitStackName = toolkitStackName;
6549
6942
  this.cache = /* @__PURE__ */ new Map();
6550
6943
  }
6551
- for(resolvedEnvironment, sdk, msg) {
6944
+ for(resolvedEnvironment, sdk, ioHelper) {
6552
6945
  const key = `${resolvedEnvironment.account}:${resolvedEnvironment.region}`;
6553
6946
  let envCache = this.cache.get(key);
6554
6947
  if (!envCache) {
6555
6948
  envCache = emptyCache();
6556
6949
  this.cache.set(key, envCache);
6557
6950
  }
6558
- return new EnvironmentResources(resolvedEnvironment, sdk, msg, envCache, this.toolkitStackName);
6951
+ return new EnvironmentResources(resolvedEnvironment, sdk, ioHelper, envCache, this.toolkitStackName);
6559
6952
  }
6560
6953
  };
6561
6954
  var EnvironmentResources = class {
6562
- constructor(environment, sdk, msg, cache, toolkitStackName) {
6955
+ constructor(environment, sdk, ioHelper, cache, toolkitStackName) {
6563
6956
  this.environment = environment;
6564
6957
  this.sdk = sdk;
6565
- this.msg = msg;
6958
+ this.ioHelper = ioHelper;
6566
6959
  this.cache = cache;
6567
6960
  this.toolkitStackName = toolkitStackName;
6568
6961
  }
@@ -6571,7 +6964,7 @@ var EnvironmentResources = class {
6571
6964
  */
6572
6965
  async lookupToolkit() {
6573
6966
  if (!this.cache.toolkitInfo) {
6574
- this.cache.toolkitInfo = await ToolkitInfo.lookup(this.environment, this.sdk, this.msg, this.toolkitStackName);
6967
+ this.cache.toolkitInfo = await ToolkitInfo.lookup(this.environment, this.sdk, this.ioHelper, this.toolkitStackName);
6575
6968
  }
6576
6969
  return this.cache.toolkitInfo;
6577
6970
  }
@@ -6599,8 +6992,7 @@ var EnvironmentResources = class {
6599
6992
  }
6600
6993
  const bootstrapStack2 = await this.lookupToolkit();
6601
6994
  if (bootstrapStack2.found && bootstrapStack2.version < BOOTSTRAP_TEMPLATE_VERSION_INTRODUCING_GETPARAMETER) {
6602
- await this.msg.ioHost.notify(warn(
6603
- this.msg.action,
6995
+ await this.ioHelper.notify(warn2(
6604
6996
  `Could not read SSM parameter ${ssmParameterName}: ${formatErrorMessage(e)}, falling back to version from ${bootstrapStack2}`
6605
6997
  ));
6606
6998
  doValidate(bootstrapStack2.version, this.environment);
@@ -6635,10 +7027,10 @@ var EnvironmentResources = class {
6635
7027
  }
6636
7028
  const ssm = this.sdk.ssm();
6637
7029
  try {
6638
- const result = await ssm.getParameter({ Name: parameterName });
6639
- const asNumber = parseInt(`${result.Parameter?.Value}`, 10);
7030
+ const result2 = await ssm.getParameter({ Name: parameterName });
7031
+ const asNumber = parseInt(`${result2.Parameter?.Value}`, 10);
6640
7032
  if (isNaN(asNumber)) {
6641
- throw new ToolkitError(`SSM parameter ${parameterName} not a number: ${result.Parameter?.Value}`);
7033
+ throw new ToolkitError(`SSM parameter ${parameterName} not a number: ${result2.Parameter?.Value}`);
6642
7034
  }
6643
7035
  this.cache.ssmParameters.set(parameterName, asNumber);
6644
7036
  return asNumber;
@@ -6657,7 +7049,7 @@ var EnvironmentResources = class {
6657
7049
  }
6658
7050
  const ecr = this.sdk.ecr();
6659
7051
  try {
6660
- await this.msg.ioHost.notify(debug2(this.msg.action, `${repositoryName}: checking if ECR repository already exists`));
7052
+ await this.ioHelper.notify(debug3(`${repositoryName}: checking if ECR repository already exists`));
6661
7053
  const describeResponse = await ecr.describeRepositories({
6662
7054
  repositoryNames: [repositoryName]
6663
7055
  });
@@ -6670,7 +7062,7 @@ var EnvironmentResources = class {
6670
7062
  throw e;
6671
7063
  }
6672
7064
  }
6673
- await this.msg.ioHost.notify(debug2(this.msg.action, `${repositoryName}: creating ECR repository`));
7065
+ await this.ioHelper.notify(debug3(`${repositoryName}: creating ECR repository`));
6674
7066
  const assetTag = { Key: "awscdk:asset", Value: "true" };
6675
7067
  const response = await ecr.createRepository({
6676
7068
  repositoryName,
@@ -6680,7 +7072,7 @@ var EnvironmentResources = class {
6680
7072
  if (!repositoryUri) {
6681
7073
  throw new ToolkitError(`CreateRepository did not return a repository URI for ${repositoryUri}`);
6682
7074
  }
6683
- await this.msg.ioHost.notify(debug2(this.msg.action, `${repositoryName}: enable image scanning`));
7075
+ await this.ioHelper.notify(debug3(`${repositoryName}: enable image scanning`));
6684
7076
  await ecr.putImageScanningConfiguration({
6685
7077
  repositoryName,
6686
7078
  imageScanningConfiguration: { scanOnPush: true }
@@ -6688,6 +7080,19 @@ var EnvironmentResources = class {
6688
7080
  return { repositoryUri };
6689
7081
  }
6690
7082
  };
7083
+ var NoBootstrapStackEnvironmentResources = class extends EnvironmentResources {
7084
+ constructor(environment, sdk, ioHelper) {
7085
+ super(environment, sdk, ioHelper, emptyCache());
7086
+ }
7087
+ /**
7088
+ * Look up the toolkit for a given environment, using a given SDK
7089
+ */
7090
+ async lookupToolkit() {
7091
+ throw new ToolkitError(
7092
+ "Trying to perform an operation that requires a bootstrap stack; you should not see this error, this is a bug in the CDK CLI."
7093
+ );
7094
+ }
7095
+ };
6691
7096
  function emptyCache() {
6692
7097
  return {
6693
7098
  ssmParameters: /* @__PURE__ */ new Map(),
@@ -6710,12 +7115,11 @@ async function replaceEnvPlaceholders(object, env, sdkProvider) {
6710
7115
 
6711
7116
  // ../../aws-cdk/lib/api/environment/environment-access.ts
6712
7117
  var EnvironmentAccess = class {
6713
- constructor(sdkProvider, toolkitStackName, { ioHost, action }) {
7118
+ constructor(sdkProvider, toolkitStackName, ioHelper) {
6714
7119
  this.sdkProvider = sdkProvider;
6715
7120
  this.sdkCache = /* @__PURE__ */ new Map();
6716
7121
  this.environmentResources = new EnvironmentResourcesRegistry(toolkitStackName);
6717
- this.ioHost = ioHost;
6718
- this.action = action;
7122
+ this.ioHelper = ioHelper;
6719
7123
  }
6720
7124
  /**
6721
7125
  * Resolves the environment for a stack.
@@ -6794,7 +7198,7 @@ var EnvironmentAccess = class {
6794
7198
  }
6795
7199
  if (lookupEnv.isFallbackCredentials) {
6796
7200
  const arn = await lookupEnv.replacePlaceholders(stack.lookupRole?.arn);
6797
- await this.ioHost.notify(warn(this.action, `Lookup role ${arn} was not assumed. Proceeding with default credentials.`));
7201
+ await this.ioHelper.notify(warn2(`Lookup role ${arn} was not assumed. Proceeding with default credentials.`));
6798
7202
  }
6799
7203
  return lookupEnv;
6800
7204
  }
@@ -6816,7 +7220,7 @@ var EnvironmentAccess = class {
6816
7220
  try {
6817
7221
  return await this.accessStackForLookup(stack);
6818
7222
  } catch (e) {
6819
- await this.ioHost.notify(warn(this.action, `${formatErrorMessage(e)}`));
7223
+ await this.ioHelper.notify(warn2(`${formatErrorMessage(e)}`));
6820
7224
  }
6821
7225
  return this.accessStackForStackOperations(stack, 0 /* ForReading */);
6822
7226
  }
@@ -6857,7 +7261,7 @@ var EnvironmentAccess = class {
6857
7261
  return {
6858
7262
  sdk: stackSdk.sdk,
6859
7263
  resolvedEnvironment,
6860
- resources: this.environmentResources.for(resolvedEnvironment, stackSdk.sdk, { ioHost: this.ioHost, action: this.action }),
7264
+ resources: this.environmentResources.for(resolvedEnvironment, stackSdk.sdk, this.ioHelper),
6861
7265
  // If we asked for a role, did not successfully assume it, and yet got here without an exception: that
6862
7266
  // means we must have fallback credentials.
6863
7267
  isFallbackCredentials: !stackSdk.didAssumeRole && !!assumeRoleArn,
@@ -6898,12 +7302,11 @@ var Deployments = class {
6898
7302
  this.publisherCache = /* @__PURE__ */ new Map();
6899
7303
  this.assetSdkProvider = props.sdkProvider;
6900
7304
  this.deployStackSdkProvider = props.sdkProvider;
6901
- this.ioHost = props.ioHost;
6902
- this.action = props.action;
7305
+ this.ioHelper = props.ioHelper;
6903
7306
  this.envs = new EnvironmentAccess(
6904
7307
  props.sdkProvider,
6905
7308
  props.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME,
6906
- { ioHost: this.ioHost, action: this.action }
7309
+ this.ioHelper
6907
7310
  );
6908
7311
  }
6909
7312
  /**
@@ -6917,12 +7320,12 @@ var Deployments = class {
6917
7320
  return loadCurrentTemplateWithNestedStacks(rootStackArtifact, env.sdk, retrieveProcessedTemplate);
6918
7321
  }
6919
7322
  async readCurrentTemplate(stackArtifact) {
6920
- await this.ioHost.notify(debug2(this.action, `Reading existing template for stack ${stackArtifact.displayName}.`));
7323
+ await this.ioHelper.notify(debug3(`Reading existing template for stack ${stackArtifact.displayName}.`));
6921
7324
  const env = await this.envs.accessStackForLookupBestEffort(stackArtifact);
6922
7325
  return loadCurrentTemplate(stackArtifact, env.sdk);
6923
7326
  }
6924
7327
  async resourceIdentifierSummaries(stackArtifact) {
6925
- await this.ioHost.notify(debug2(this.action, `Retrieving template summary for stack ${stackArtifact.displayName}.`));
7328
+ await this.ioHelper.notify(debug3(`Retrieving template summary for stack ${stackArtifact.displayName}.`));
6926
7329
  const env = await this.envs.accessStackForReadOnlyStackOperations(stackArtifact);
6927
7330
  const cfn = env.sdk.cloudFormation();
6928
7331
  await uploadStackTemplateAssets(stackArtifact, this);
@@ -6944,7 +7347,7 @@ var Deployments = class {
6944
7347
  }
6945
7348
  const response = await cfn.getTemplateSummary(cfnParam);
6946
7349
  if (!response.ResourceIdentifierSummaries) {
6947
- await this.ioHost.notify(debug2(this.action, 'GetTemplateSummary API call did not return "ResourceIdentifierSummaries"'));
7350
+ await this.ioHelper.notify(debug3('GetTemplateSummary API call did not return "ResourceIdentifierSummaries"'));
6948
7351
  }
6949
7352
  return response.ResourceIdentifierSummaries ?? [];
6950
7353
  }
@@ -6992,7 +7395,7 @@ var Deployments = class {
6992
7395
  resourcesToImport: options.resourcesToImport,
6993
7396
  overrideTemplate: options.overrideTemplate,
6994
7397
  assetParallelism: options.assetParallelism
6995
- }, { ioHost: this.ioHost, action: this.action });
7398
+ }, this.ioHelper);
6996
7399
  }
6997
7400
  async rollbackStack(options) {
6998
7401
  let resourcesToSkip = options.orphanLogicalIds ?? [];
@@ -7016,10 +7419,10 @@ var Deployments = class {
7016
7419
  const executionRoleArn = await env.replacePlaceholders(options.roleArn ?? options.stack.cloudFormationExecutionRoleArn);
7017
7420
  switch (cloudFormationStack.stackStatus.rollbackChoice) {
7018
7421
  case 3 /* NONE */:
7019
- await this.ioHost.notify(warn(this.action, `Stack ${deployName} does not need a rollback: ${cloudFormationStack.stackStatus}`));
7422
+ await this.ioHelper.notify(warn2(`Stack ${deployName} does not need a rollback: ${cloudFormationStack.stackStatus}`));
7020
7423
  return { notInRollbackableState: true };
7021
7424
  case 0 /* START_ROLLBACK */:
7022
- await this.ioHost.notify(debug2(this.action, `Initiating rollback of stack ${deployName}`));
7425
+ await this.ioHelper.notify(debug3(`Initiating rollback of stack ${deployName}`));
7023
7426
  await cfn.rollbackStack({
7024
7427
  StackName: deployName,
7025
7428
  RoleARN: executionRoleArn,
@@ -7038,7 +7441,7 @@ var Deployments = class {
7038
7441
  resourcesToSkip = poller.resourceErrors.filter((r) => !r.isStackEvent && r.parentStackLogicalIds.length === 0).map((r) => r.event.LogicalResourceId ?? "");
7039
7442
  }
7040
7443
  const skipDescription = resourcesToSkip.length > 0 ? ` (orphaning: ${resourcesToSkip.join(", ")})` : "";
7041
- await this.ioHost.notify(warn(this.action, `Continuing rollback of stack ${deployName}${skipDescription}`));
7444
+ await this.ioHelper.notify(warn2(`Continuing rollback of stack ${deployName}${skipDescription}`));
7042
7445
  await cfn.continueUpdateRollback({
7043
7446
  StackName: deployName,
7044
7447
  ClientRequestToken: (0, import_crypto.randomUUID)(),
@@ -7047,8 +7450,7 @@ var Deployments = class {
7047
7450
  });
7048
7451
  break;
7049
7452
  case 2 /* ROLLBACK_FAILED */:
7050
- await this.ioHost.notify(warn(
7051
- this.action,
7453
+ await this.ioHelper.notify(warn2(
7052
7454
  `Stack ${deployName} failed creation and rollback. This state cannot be rolled back. You can recreate this stack by running 'cdk deploy'.`
7053
7455
  ));
7054
7456
  return { notInRollbackableState: true };
@@ -7059,14 +7461,13 @@ var Deployments = class {
7059
7461
  cfn,
7060
7462
  stack: options.stack,
7061
7463
  stackName: deployName,
7062
- ioHost: this.ioHost,
7063
- action: this.action
7464
+ ioHelper: this.ioHelper
7064
7465
  });
7065
7466
  await monitor.start();
7066
7467
  let stackErrorMessage = void 0;
7067
7468
  let finalStackState = cloudFormationStack;
7068
7469
  try {
7069
- const successStack = await stabilizeStack(cfn, { ioHost: this.ioHost, action: this.action }, deployName);
7470
+ const successStack = await stabilizeStack(cfn, this.ioHelper, deployName);
7070
7471
  if (!successStack) {
7071
7472
  throw new ToolkitError("Stack deploy failed (the stack disappeared while we were rolling it back)");
7072
7473
  }
@@ -7101,10 +7502,8 @@ var Deployments = class {
7101
7502
  sdk: env.sdk,
7102
7503
  roleArn: executionRoleArn,
7103
7504
  stack: options.stack,
7104
- deployName: options.deployName,
7105
- quiet: options.quiet,
7106
- ci: options.ci
7107
- }, { ioHost: this.ioHost, action: this.action });
7505
+ deployName: options.deployName
7506
+ }, this.ioHelper);
7108
7507
  }
7109
7508
  async stackExists(options) {
7110
7509
  let env;
@@ -7138,7 +7537,7 @@ var Deployments = class {
7138
7537
  const publisher = this.cachedPublisher(assetManifest, resolvedEnvironment, options.stackName);
7139
7538
  await publisher.buildEntry(asset);
7140
7539
  if (publisher.hasFailures) {
7141
- throw new ToolkitError(`Failed to build asset ${asset.id}`);
7540
+ throw new ToolkitError(`Failed to build asset ${asset.displayName(false)}`);
7142
7541
  }
7143
7542
  }
7144
7543
  /**
@@ -7147,18 +7546,18 @@ var Deployments = class {
7147
7546
  async publishSingleAsset(assetManifest, asset, options) {
7148
7547
  const stackEnv = await this.envs.resolveStackEnvironment(options.stack);
7149
7548
  const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName);
7150
- await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack) });
7549
+ await publisher.publishEntry(asset, {
7550
+ allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack),
7551
+ force: options.forcePublish
7552
+ });
7151
7553
  if (publisher.hasFailures) {
7152
- throw new ToolkitError(`Failed to publish asset ${asset.id}`);
7554
+ throw new ToolkitError(`Failed to publish asset ${asset.displayName(true)}`);
7153
7555
  }
7154
7556
  }
7155
7557
  async allowCrossAccountAssetPublishingForEnv(stack) {
7156
7558
  if (this._allowCrossAccountAssetPublishing === void 0) {
7157
7559
  const env = await this.envs.accessStackForReadOnlyStackOperations(stack);
7158
- this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(env.sdk, {
7159
- ioHost: this.ioHost,
7160
- action: this.action
7161
- }, this.props.toolkitStackName);
7560
+ this._allowCrossAccountAssetPublishing = await determineAllowCrossAccountAssetPublishing(env.sdk, this.ioHelper, this.props.toolkitStackName);
7162
7561
  }
7163
7562
  return this._allowCrossAccountAssetPublishing;
7164
7563
  }
@@ -7192,15 +7591,15 @@ var Deployments = class {
7192
7591
  // The AssetPublishing class takes care of role assuming etc, so it's okay to
7193
7592
  // give it a direct `SdkProvider`.
7194
7593
  aws: new PublishingAws(this.assetSdkProvider, env),
7195
- progressListener: new ParallelSafeAssetProgress(prefix, { ioHost: this.ioHost, action: this.action })
7594
+ progressListener: new ParallelSafeAssetProgress(prefix, this.ioHelper)
7196
7595
  });
7197
7596
  this.publisherCache.set(assetManifest, publisher);
7198
7597
  return publisher;
7199
7598
  }
7200
7599
  };
7201
7600
  var ParallelSafeAssetProgress = class extends BasePublishProgressListener {
7202
- constructor(prefix, { ioHost, action }) {
7203
- super({ ioHost, action });
7601
+ constructor(prefix, ioHelper) {
7602
+ super(ioHelper);
7204
7603
  this.prefix = prefix;
7205
7604
  }
7206
7605
  getMessage(type, event) {
@@ -7224,17 +7623,16 @@ function tagsForStack(stack) {
7224
7623
  }
7225
7624
 
7226
7625
  // ../../aws-cdk/lib/api/resource-import/importer.ts
7227
- var import_util16 = require("util");
7626
+ var import_util34 = require("util");
7228
7627
  var cfnDiff = __toESM(require("@aws-cdk/cloudformation-diff"));
7229
7628
  var chalk13 = __toESM(require("chalk"));
7230
- var fs11 = __toESM(require("fs-extra"));
7629
+ var fs12 = __toESM(require("fs-extra"));
7231
7630
  var promptly3 = __toESM(require("promptly"));
7232
7631
  var ResourceImporter = class {
7233
7632
  constructor(stack, props) {
7234
7633
  this.stack = stack;
7235
7634
  this.cfn = props.deployments;
7236
- this.ioHost = props.ioHost;
7237
- this.action = props.action;
7635
+ this.ioHelper = props.ioHelper;
7238
7636
  }
7239
7637
  /**
7240
7638
  * Ask the user for resources to import
@@ -7256,23 +7654,23 @@ var ResourceImporter = class {
7256
7654
  * Load the resources to import from a file
7257
7655
  */
7258
7656
  async loadResourceIdentifiers(available, filename) {
7259
- const contents = await fs11.readJson(filename);
7657
+ const contents = await fs12.readJson(filename);
7260
7658
  const ret = { importResources: [], resourceMap: {} };
7261
7659
  for (const resource of available) {
7262
7660
  const descr = this.describeResource(resource.logicalId);
7263
7661
  const idProps = contents[resource.logicalId];
7264
7662
  if (idProps) {
7265
- await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
7663
+ await this.ioHelper.notify(info3((0, import_util34.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
7266
7664
  ret.importResources.push(resource);
7267
7665
  ret.resourceMap[resource.logicalId] = idProps;
7268
7666
  delete contents[resource.logicalId];
7269
7667
  } else {
7270
- await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: skipping", chalk13.blue(descr))));
7668
+ await this.ioHelper.notify(info3((0, import_util34.format)("%s: skipping", chalk13.blue(descr))));
7271
7669
  }
7272
7670
  }
7273
7671
  const unknown = Object.keys(contents);
7274
7672
  if (unknown.length > 0) {
7275
- await this.ioHost.notify(warn(this.action, `Unrecognized resource identifiers in mapping file: ${unknown.join(", ")}`));
7673
+ await this.ioHelper.notify(warn2(`Unrecognized resource identifiers in mapping file: ${unknown.join(", ")}`));
7276
7674
  }
7277
7675
  return ret;
7278
7676
  }
@@ -7302,18 +7700,18 @@ var ResourceImporter = class {
7302
7700
  }
7303
7701
  async importResources(overrideTemplate, resourcesToImport, options) {
7304
7702
  try {
7305
- const result = await this.cfn.deployStack({
7703
+ const result2 = await this.cfn.deployStack({
7306
7704
  stack: this.stack,
7307
7705
  deployName: this.stack.stackName,
7308
7706
  ...options,
7309
7707
  overrideTemplate,
7310
7708
  resourcesToImport
7311
7709
  });
7312
- assertIsSuccessfulDeployStackResult(result);
7313
- const message = result.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
7314
- await this.ioHost.notify(info2(this.action, "\n" + chalk13.green((0, import_util16.format)(message, this.stack.displayName))));
7710
+ assertIsSuccessfulDeployStackResult(result2);
7711
+ const message2 = result2.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
7712
+ await this.ioHelper.notify(info3("\n" + chalk13.green((0, import_util34.format)(message2, this.stack.displayName))));
7315
7713
  } catch (e) {
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"));
7714
+ await this.ioHelper.notify(error3((0, import_util34.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
7317
7715
  throw e;
7318
7716
  }
7319
7717
  }
@@ -7332,7 +7730,7 @@ var ResourceImporter = class {
7332
7730
  if (nonAdditions.length) {
7333
7731
  const offendingResources = nonAdditions.map(([logId, _]) => this.describeResource(logId));
7334
7732
  if (allowNonAdditions) {
7335
- await this.ioHost.notify(warn(this.action, `Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`));
7733
+ await this.ioHelper.notify(warn2(`Ignoring updated/deleted resources (--force): ${offendingResources.join(", ")}`));
7336
7734
  } else {
7337
7735
  throw new ToolkitError(`No resource updates or deletes are allowed on import operation. Make sure to resolve pending changes to existing resources, before attempting an import. Updated/deleted resources: ${offendingResources.join(", ")} (--force to override)`);
7338
7736
  }
@@ -7405,7 +7803,7 @@ var ResourceImporter = class {
7405
7803
  const resourceName = this.describeResource(chg.logicalId);
7406
7804
  const resourceType = chg.resourceDiff.newResourceType;
7407
7805
  if (resourceType === void 0 || !(resourceType in resourceIdentifiers)) {
7408
- await this.ioHost.notify(warn(this.action, `${resourceName}: unsupported resource type ${resourceType}, skipping import.`));
7806
+ await this.ioHelper.notify(warn2(`${resourceName}: unsupported resource type ${resourceType}, skipping import.`));
7409
7807
  return void 0;
7410
7808
  }
7411
7809
  const idPropSets = resourceIdentifiers[resourceType];
@@ -7422,7 +7820,7 @@ var ResourceImporter = class {
7422
7820
  }
7423
7821
  }
7424
7822
  if (satisfiedPropSets.length > 0) {
7425
- await this.ioHost.notify(info2(this.action, chalk13.grey(`Skipping import of ${resourceName}`)));
7823
+ await this.ioHelper.notify(info3(chalk13.grey(`Skipping import of ${resourceName}`)));
7426
7824
  return void 0;
7427
7825
  }
7428
7826
  const prefix = `${chalk13.blue(resourceName)} (${resourceType})`;
@@ -7435,7 +7833,7 @@ var ResourceImporter = class {
7435
7833
  promptPattern = `${prefix}: enter %`;
7436
7834
  }
7437
7835
  if (preamble) {
7438
- await this.ioHost.notify(info2(this.action, preamble));
7836
+ await this.ioHelper.notify(info3(preamble));
7439
7837
  }
7440
7838
  for (const idProps of idPropSets) {
7441
7839
  const input = {};
@@ -7459,7 +7857,7 @@ var ResourceImporter = class {
7459
7857
  return input;
7460
7858
  }
7461
7859
  }
7462
- await this.ioHost.notify(info2(this.action, chalk13.grey(`Skipping import of ${resourceName}`)));
7860
+ await this.ioHelper.notify(info3(chalk13.grey(`Skipping import of ${resourceName}`)));
7463
7861
  return void 0;
7464
7862
  }
7465
7863
  /**
@@ -7510,12 +7908,11 @@ function addDefaultDeletionPolicy(resource) {
7510
7908
 
7511
7909
  // ../../aws-cdk/lib/api/resource-import/migrator.ts
7512
7910
  var chalk14 = __toESM(require("chalk"));
7513
- var fs12 = __toESM(require("fs-extra"));
7911
+ var fs13 = __toESM(require("fs-extra"));
7514
7912
  var ResourceMigrator = class {
7515
7913
  constructor(props) {
7516
7914
  this.props = props;
7517
- this.ioHost = props.ioHost;
7518
- this.action = props.action;
7915
+ this.ioHelper = props.ioHelper;
7519
7916
  }
7520
7917
  /**
7521
7918
  * Checks to see if a migrate.json file exists. If it does and the source is either `filepath` or
@@ -7527,16 +7924,15 @@ var ResourceMigrator = class {
7527
7924
  const stack = stacks.stackArtifacts[0];
7528
7925
  const migrateDeployment = new ResourceImporter(stack, {
7529
7926
  deployments: this.props.deployments,
7530
- ioHost: this.ioHost,
7531
- action: this.action
7927
+ ioHelper: this.ioHelper
7532
7928
  });
7533
7929
  const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
7534
7930
  if (resourcesToImport) {
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...`));
7931
+ await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
7932
+ await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: importing resources into stack...`));
7537
7933
  await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
7538
- fs12.rmSync("migrate.json");
7539
- await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
7934
+ fs13.rmSync("migrate.json");
7935
+ await this.ioHelper.notify(info3(`${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
7540
7936
  }
7541
7937
  }
7542
7938
  /**
@@ -7552,7 +7948,7 @@ var ResourceMigrator = class {
7552
7948
  rollback: options.rollback
7553
7949
  });
7554
7950
  elapsedDeployTime = (/* @__PURE__ */ new Date()).getTime() - startDeployTime;
7555
- await this.ioHost.notify(info2(this.action, `'
7951
+ await this.ioHelper.notify(info3(`'
7556
7952
  \u2728 Resource migration time: ${formatTime(elapsedDeployTime)}s
7557
7953
  '`, "CDK_TOOLKIT_I5002", {
7558
7954
  duration: elapsedDeployTime
@@ -7560,7 +7956,7 @@ var ResourceMigrator = class {
7560
7956
  }
7561
7957
  async tryGetResources(environment) {
7562
7958
  try {
7563
- const migrateFile = fs12.readJsonSync("migrate.json", {
7959
+ const migrateFile = fs13.readJsonSync("migrate.json", {
7564
7960
  encoding: "utf-8"
7565
7961
  });
7566
7962
  const sourceEnv = migrateFile.Source.split(":");
@@ -7576,22 +7972,35 @@ var ResourceMigrator = class {
7576
7972
  // ../../aws-cdk/lib/api/logs/logs-monitor.ts
7577
7973
  var util7 = __toESM(require("util"));
7578
7974
  var chalk15 = __toESM(require("chalk"));
7579
- var SLEEP = 2e3;
7975
+ var uuid4 = __toESM(require("uuid"));
7580
7976
  var CloudWatchLogEventMonitor = class {
7581
- constructor(startTime) {
7977
+ constructor(props) {
7582
7978
  /**
7583
7979
  * Map of environment (account:region) to LogGroupsAccessSettings
7584
7980
  */
7585
7981
  this.envsLogGroupsAccessSettings = /* @__PURE__ */ new Map();
7586
- this.active = false;
7587
- this.startTime = startTime?.getTime() ?? Date.now();
7982
+ /**
7983
+ * After reading events from all CloudWatch log groups
7984
+ * how long should we wait to read more events.
7985
+ *
7986
+ * If there is some error with reading events (i.e. Throttle)
7987
+ * then this is also how long we wait until we try again
7988
+ */
7989
+ this.pollingInterval = 2e3;
7990
+ this.startTime = props.startTime?.getTime() ?? Date.now();
7991
+ this.ioHelper = props.ioHelper;
7588
7992
  }
7589
7993
  /**
7590
7994
  * resume reading/printing events
7591
7995
  */
7592
- activate() {
7593
- this.active = true;
7594
- this.scheduleNextTick(0);
7996
+ async activate() {
7997
+ this.monitorId = uuid4.v4();
7998
+ await this.ioHelper.notify(IO.CDK_TOOLKIT_I5032.msg("Start monitoring log groups", {
7999
+ monitor: this.monitorId,
8000
+ logGroupNames: this.logGroupNames()
8001
+ }));
8002
+ await this.tick();
8003
+ this.scheduleNextTick();
7595
8004
  }
7596
8005
  /**
7597
8006
  * deactivates the monitor so no new events are read
@@ -7602,9 +8011,14 @@ var CloudWatchLogEventMonitor = class {
7602
8011
  * Also resets the start time to be when the new deployment was triggered
7603
8012
  * and clears the list of tracked log groups
7604
8013
  */
7605
- deactivate() {
7606
- this.active = false;
8014
+ async deactivate() {
8015
+ const oldMonitorId = this.monitorId;
8016
+ this.monitorId = void 0;
7607
8017
  this.startTime = Date.now();
8018
+ await this.ioHelper.notify(IO.CDK_TOOLKIT_I5034.msg("Stopped monitoring log groups", {
8019
+ monitor: oldMonitorId,
8020
+ logGroupNames: this.logGroupNames()
8021
+ }));
7608
8022
  this.envsLogGroupsAccessSettings.clear();
7609
8023
  }
7610
8024
  /**
@@ -7631,22 +8045,31 @@ var CloudWatchLogEventMonitor = class {
7631
8045
  }
7632
8046
  });
7633
8047
  }
7634
- scheduleNextTick(sleep2) {
7635
- setTimeout(() => void this.tick(), sleep2);
8048
+ logGroupNames() {
8049
+ return Array.from(this.envsLogGroupsAccessSettings.values()).flatMap((settings) => Object.keys(settings.logGroupsStartTimes));
8050
+ }
8051
+ scheduleNextTick() {
8052
+ if (!this.monitorId) {
8053
+ return;
8054
+ }
8055
+ setTimeout(() => void this.tick(), this.pollingInterval);
7636
8056
  }
7637
8057
  async tick() {
7638
- if (!this.active) {
8058
+ if (!this.monitorId) {
7639
8059
  return;
7640
8060
  }
7641
8061
  try {
7642
8062
  const events = flatten(await this.readNewEvents());
7643
- events.forEach((event) => {
7644
- this.print(event);
7645
- });
8063
+ for (const event of events) {
8064
+ await this.print(event);
8065
+ }
8066
+ if (!this.monitorId) {
8067
+ return;
8068
+ }
7646
8069
  } catch (e) {
7647
- error("Error occurred while monitoring logs: %s", e);
8070
+ await this.ioHelper.notify(IO.CDK_TOOLKIT_E5035.msg("Error occurred while monitoring logs: %s", { error: e }));
7648
8071
  }
7649
- this.scheduleNextTick(SLEEP);
8072
+ this.scheduleNextTick();
7650
8073
  }
7651
8074
  /**
7652
8075
  * Reads all new log events from a set of CloudWatch Log Groups
@@ -7664,15 +8087,16 @@ var CloudWatchLogEventMonitor = class {
7664
8087
  /**
7665
8088
  * Print out a cloudwatch event
7666
8089
  */
7667
- print(event) {
7668
- info(
8090
+ async print(event) {
8091
+ await this.ioHelper.notify(IO.CDK_TOOLKIT_I5033.msg(
7669
8092
  util7.format(
7670
8093
  "[%s] %s %s",
7671
8094
  chalk15.blue(event.logGroupName),
7672
8095
  chalk15.yellow(event.timestamp.toLocaleTimeString()),
7673
8096
  event.message.trim()
7674
- )
7675
- );
8097
+ ),
8098
+ event
8099
+ ));
7676
8100
  }
7677
8101
  /**
7678
8102
  * Reads all new log events from a CloudWatch Log Group
@@ -7722,13 +8146,13 @@ var CloudWatchLogEventMonitor = class {
7722
8146
 
7723
8147
  // ../../aws-cdk/lib/api/logs/find-cloudwatch-logs.ts
7724
8148
  var IGNORE_LOGS_RESOURCE_TYPES = ["AWS::EC2::FlowLog", "AWS::CloudTrail::Trail", "AWS::CodeBuild::Project"];
7725
- async function findCloudWatchLogGroups(sdkProvider, msg, stackArtifact) {
8149
+ async function findCloudWatchLogGroups(sdkProvider, ioHelper, stackArtifact) {
7726
8150
  let sdk;
7727
8151
  const resolvedEnv = await sdkProvider.resolveEnvironment(stackArtifact.environment);
7728
8152
  try {
7729
- sdk = (await new EnvironmentAccess(sdkProvider, DEFAULT_TOOLKIT_STACK_NAME, msg).accessStackForLookup(stackArtifact)).sdk;
8153
+ sdk = (await new EnvironmentAccess(sdkProvider, DEFAULT_TOOLKIT_STACK_NAME, ioHelper).accessStackForLookup(stackArtifact)).sdk;
7730
8154
  } catch (e) {
7731
- debug(`Failed to access SDK environment: ${formatErrorMessage(e)}`);
8155
+ await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Failed to access SDK environment: ${formatErrorMessage(e)}`));
7732
8156
  sdk = (await sdkProvider.forEnvironment(resolvedEnv, 0 /* ForReading */)).sdk;
7733
8157
  }
7734
8158
  const listStackResources = new LazyListStackResources(sdk, stackArtifact.stackName);
@@ -7796,12 +8220,11 @@ function findAllLogGroupNames(stackResources, evaluateCfnTemplate) {
7796
8220
 
7797
8221
  // ../../aws-cdk/lib/api/work-graph/work-graph.ts
7798
8222
  var WorkGraph = class {
7799
- constructor(nodes, props) {
8223
+ constructor(nodes, ioHelper) {
7800
8224
  this.readyPool = [];
7801
8225
  this.lazyDependencies = /* @__PURE__ */ new Map();
7802
8226
  this.nodes = { ...nodes };
7803
- this.ioHost = props.ioHost;
7804
- this.action = props.action;
8227
+ this.ioHelper = ioHelper;
7805
8228
  }
7806
8229
  addNodes(...nodes) {
7807
8230
  for (const node of nodes) {
@@ -7958,8 +8381,8 @@ var WorkGraph = class {
7958
8381
  deployed(node) {
7959
8382
  node.deploymentState = "completed" /* COMPLETED */;
7960
8383
  }
7961
- failed(node, error3) {
7962
- this.error = error3;
8384
+ failed(node, error4) {
8385
+ this.error = error4;
7963
8386
  node.deploymentState = "failed" /* FAILED */;
7964
8387
  this.skipRest();
7965
8388
  this.readyPool.splice(0);
@@ -8004,7 +8427,7 @@ var WorkGraph = class {
8004
8427
  * Do this in parallel, because there may be a lot of assets in an application (seen in practice: >100 assets)
8005
8428
  */
8006
8429
  async removeUnnecessaryAssets(isUnnecessary) {
8007
- await this.ioHost.notify(debug2(this.action, "Checking for previously published assets"));
8430
+ await this.ioHelper.notify(debug3("Checking for previously published assets"));
8008
8431
  const publishes = this.nodesOfType("asset-publish");
8009
8432
  const classifiedNodes = await parallelPromises(
8010
8433
  8,
@@ -8014,7 +8437,7 @@ var WorkGraph = class {
8014
8437
  for (const assetNode of alreadyPublished) {
8015
8438
  this.removeNode(assetNode);
8016
8439
  }
8017
- await this.ioHost.notify(debug2(this.action, `${publishes.length} total assets, ${publishes.length - alreadyPublished.length} still need to be published`));
8440
+ await this.ioHelper.notify(debug3(`${publishes.length} total assets, ${publishes.length - alreadyPublished.length} still need to be published`));
8018
8441
  const unusedBuilds = this.nodesOfType("asset-build").filter((build) => this.dependees(build).length === 0);
8019
8442
  for (const unusedBuild of unusedBuilds) {
8020
8443
  this.removeNode(unusedBuild);
@@ -8032,7 +8455,7 @@ var WorkGraph = class {
8032
8455
  this.readyPool.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
8033
8456
  if (this.readyPool.length === 0 && activeCount === 0 && pendingCount > 0) {
8034
8457
  const cycle = this.findCycle() ?? ["No cycle found!"];
8035
- await this.ioHost.notify(trace2(this.action, `Cycle ${cycle.join(" -> ")} in graph ${this}`));
8458
+ await this.ioHelper.notify(trace3(`Cycle ${cycle.join(" -> ")} in graph ${this}`));
8036
8459
  throw new ToolkitError(`Unable to make progress anymore, dependency cycle between remaining artifacts: ${cycle.join(" -> ")} (run with -vv for full graph)`);
8037
8460
  }
8038
8461
  }
@@ -8058,17 +8481,17 @@ var WorkGraph = class {
8058
8481
  }
8059
8482
  }
8060
8483
  return void 0;
8061
- function recurse(nodeId, path12) {
8484
+ function recurse(nodeId, path15) {
8062
8485
  if (seen.has(nodeId)) {
8063
8486
  return void 0;
8064
8487
  }
8065
8488
  try {
8066
8489
  for (const dep of self.nodes[nodeId].dependencies ?? []) {
8067
- const index = path12.indexOf(dep);
8490
+ const index = path15.indexOf(dep);
8068
8491
  if (index > -1) {
8069
- return [...path12.slice(index), dep];
8492
+ return [...path15.slice(index), dep];
8070
8493
  }
8071
- const cycle = recurse(dep, [...path12, dep]);
8494
+ const cycle = recurse(dep, [...path15, dep]);
8072
8495
  if (cycle) {
8073
8496
  return cycle;
8074
8497
  }
@@ -8125,12 +8548,11 @@ function simplifyId(id) {
8125
8548
  var cxapi3 = __toESM(require("@aws-cdk/cx-api"));
8126
8549
  var import_cdk_assets4 = require("cdk-assets");
8127
8550
  var WorkGraphBuilder = class _WorkGraphBuilder {
8128
- constructor({ ioHost, action }, prebuildAssets, idPrefix = "") {
8551
+ constructor(ioHelper, prebuildAssets, idPrefix = "") {
8129
8552
  this.prebuildAssets = prebuildAssets;
8130
8553
  this.idPrefix = idPrefix;
8131
- this.graph = new WorkGraph({}, { ioHost, action });
8132
- this.ioHost = ioHost;
8133
- this.action = action;
8554
+ this.graph = new WorkGraph({}, ioHelper);
8555
+ this.ioHelper = ioHelper;
8134
8556
  }
8135
8557
  static {
8136
8558
  /**
@@ -8170,7 +8592,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
8170
8592
  const node = {
8171
8593
  type: "asset-build",
8172
8594
  id: buildId,
8173
- note: assetId,
8595
+ note: asset.displayName(false),
8174
8596
  dependencies: /* @__PURE__ */ new Set([
8175
8597
  ...this.stackArtifactIds(assetManifestArtifact.dependencies),
8176
8598
  // If we disable prebuild, then assets inherit (stack) dependencies from their parent stack
@@ -8190,7 +8612,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
8190
8612
  this.graph.addNodes({
8191
8613
  type: "asset-publish",
8192
8614
  id: publishId,
8193
- note: `${asset.id}`,
8615
+ note: asset.displayName(true),
8194
8616
  dependencies: /* @__PURE__ */ new Set([
8195
8617
  buildId
8196
8618
  ]),
@@ -8224,7 +8646,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
8224
8646
  } else if (cxapi3.NestedCloudAssemblyArtifact.isNestedCloudAssemblyArtifact(artifact)) {
8225
8647
  const assembly = new cxapi3.CloudAssembly(artifact.fullPath, { topoSort: false });
8226
8648
  const nestedGraph = new _WorkGraphBuilder(
8227
- { ioHost: this.ioHost, action: this.action },
8649
+ this.ioHelper,
8228
8650
  this.prebuildAssets,
8229
8651
  `${this.idPrefix}${artifact.id}.`
8230
8652
  ).build(assembly.artifacts);
@@ -8274,6 +8696,469 @@ function onlyStacks(artifacts) {
8274
8696
  return artifacts.filter((x) => cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact(x));
8275
8697
  }
8276
8698
 
8699
+ // ../../aws-cdk/lib/api/bootstrap/bootstrap-environment.ts
8700
+ var import_console = require("console");
8701
+ var path12 = __toESM(require("path"));
8702
+
8703
+ // ../../aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts
8704
+ var os4 = __toESM(require("os"));
8705
+ var path11 = __toESM(require("path"));
8706
+ var import_cloud_assembly_schema3 = require("@aws-cdk/cloud-assembly-schema");
8707
+ var import_cx_api6 = require("@aws-cdk/cx-api");
8708
+ var fs14 = __toESM(require("fs-extra"));
8709
+ var BootstrapStack = class _BootstrapStack {
8710
+ constructor(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, ioHelper) {
8711
+ this.sdkProvider = sdkProvider;
8712
+ this.sdk = sdk;
8713
+ this.resolvedEnvironment = resolvedEnvironment;
8714
+ this.toolkitStackName = toolkitStackName;
8715
+ this.currentToolkitInfo = currentToolkitInfo;
8716
+ this.ioHelper = ioHelper;
8717
+ }
8718
+ static async lookup(sdkProvider, environment, toolkitStackName, ioHelper) {
8719
+ toolkitStackName = toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
8720
+ const resolvedEnvironment = await sdkProvider.resolveEnvironment(environment);
8721
+ const sdk = (await sdkProvider.forEnvironment(resolvedEnvironment, 1 /* ForWriting */)).sdk;
8722
+ const currentToolkitInfo = await ToolkitInfo.lookup(resolvedEnvironment, sdk, ioHelper, toolkitStackName);
8723
+ return new _BootstrapStack(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, ioHelper);
8724
+ }
8725
+ get parameters() {
8726
+ return this.currentToolkitInfo.found ? this.currentToolkitInfo.bootstrapStack.parameters : {};
8727
+ }
8728
+ get terminationProtection() {
8729
+ return this.currentToolkitInfo.found ? this.currentToolkitInfo.bootstrapStack.terminationProtection : void 0;
8730
+ }
8731
+ async partition() {
8732
+ return (await this.sdk.currentAccount()).partition;
8733
+ }
8734
+ /**
8735
+ * Perform the actual deployment of a bootstrap stack, given a template and some parameters
8736
+ */
8737
+ async update(template, parameters, options) {
8738
+ if (this.currentToolkitInfo.found && !options.force) {
8739
+ const abortResponse = {
8740
+ type: "did-deploy-stack",
8741
+ noOp: true,
8742
+ outputs: {},
8743
+ stackArn: this.currentToolkitInfo.bootstrapStack.stackId
8744
+ };
8745
+ const currentVariant = this.currentToolkitInfo.variant;
8746
+ const newVariant = bootstrapVariantFromTemplate(template);
8747
+ if (currentVariant !== newVariant) {
8748
+ await this.ioHelper.notify(warn2(
8749
+ `Bootstrap stack already exists, containing '${currentVariant}'. Not overwriting it with a template containing '${newVariant}' (use --force if you intend to overwrite)`
8750
+ ));
8751
+ return abortResponse;
8752
+ }
8753
+ const newVersion = bootstrapVersionFromTemplate(template);
8754
+ const currentVersion = this.currentToolkitInfo.version;
8755
+ if (newVersion < currentVersion) {
8756
+ await this.ioHelper.notify(warn2(
8757
+ `Bootstrap stack already at version ${currentVersion}. Not downgrading it to version ${newVersion} (use --force if you intend to downgrade)`
8758
+ ));
8759
+ if (newVersion === 0) {
8760
+ await this.ioHelper.notify(warn2(
8761
+ "(Did you set the '@aws-cdk/core:newStyleStackSynthesis' feature flag in cdk.json?)"
8762
+ ));
8763
+ }
8764
+ return abortResponse;
8765
+ }
8766
+ }
8767
+ const outdir = await fs14.mkdtemp(path11.join(os4.tmpdir(), "cdk-bootstrap"));
8768
+ const builder = new import_cx_api6.CloudAssemblyBuilder(outdir);
8769
+ const templateFile = `${this.toolkitStackName}.template.json`;
8770
+ await fs14.writeJson(path11.join(builder.outdir, templateFile), template, {
8771
+ spaces: 2
8772
+ });
8773
+ builder.addArtifact(this.toolkitStackName, {
8774
+ type: import_cloud_assembly_schema3.ArtifactType.AWS_CLOUDFORMATION_STACK,
8775
+ environment: import_cx_api6.EnvironmentUtils.format(this.resolvedEnvironment.account, this.resolvedEnvironment.region),
8776
+ properties: {
8777
+ templateFile,
8778
+ terminationProtection: options.terminationProtection ?? false
8779
+ }
8780
+ });
8781
+ const assembly = builder.buildAssembly();
8782
+ const ret = await deployStack({
8783
+ stack: assembly.getStackByName(this.toolkitStackName),
8784
+ resolvedEnvironment: this.resolvedEnvironment,
8785
+ sdk: this.sdk,
8786
+ sdkProvider: this.sdkProvider,
8787
+ force: options.force,
8788
+ roleArn: options.roleArn,
8789
+ tags: options.tags,
8790
+ deploymentMethod: { method: "change-set", execute: options.execute },
8791
+ parameters,
8792
+ usePreviousParameters: options.usePreviousParameters ?? true,
8793
+ // Obviously we can't need a bootstrap stack to deploy a bootstrap stack
8794
+ envResources: new NoBootstrapStackEnvironmentResources(this.resolvedEnvironment, this.sdk, this.ioHelper)
8795
+ }, this.ioHelper);
8796
+ assertIsSuccessfulDeployStackResult(ret);
8797
+ return ret;
8798
+ }
8799
+ };
8800
+ function bootstrapVersionFromTemplate(template) {
8801
+ const versionSources = [
8802
+ template.Outputs?.[BOOTSTRAP_VERSION_OUTPUT]?.Value,
8803
+ template.Resources?.[BOOTSTRAP_VERSION_RESOURCE]?.Properties?.Value
8804
+ ];
8805
+ for (const vs of versionSources) {
8806
+ if (typeof vs === "number") {
8807
+ return vs;
8808
+ }
8809
+ if (typeof vs === "string" && !isNaN(parseInt(vs, 10))) {
8810
+ return parseInt(vs, 10);
8811
+ }
8812
+ }
8813
+ return 0;
8814
+ }
8815
+ function bootstrapVariantFromTemplate(template) {
8816
+ return template.Parameters?.[BOOTSTRAP_VARIANT_PARAMETER]?.Default ?? DEFAULT_BOOTSTRAP_VARIANT;
8817
+ }
8818
+
8819
+ // ../../aws-cdk/lib/api/bootstrap/legacy-template.ts
8820
+ function legacyBootstrapTemplate(params) {
8821
+ return {
8822
+ Description: "The CDK Toolkit Stack. It was created by `cdk bootstrap` and manages resources necessary for managing your Cloud Applications with AWS CDK.",
8823
+ Conditions: {
8824
+ UsePublicAccessBlockConfiguration: {
8825
+ "Fn::Equals": [
8826
+ params.publicAccessBlockConfiguration || params.publicAccessBlockConfiguration === void 0 ? "true" : "false",
8827
+ "true"
8828
+ ]
8829
+ }
8830
+ },
8831
+ Resources: {
8832
+ StagingBucket: {
8833
+ Type: "AWS::S3::Bucket",
8834
+ Properties: {
8835
+ BucketName: params.bucketName,
8836
+ AccessControl: "Private",
8837
+ BucketEncryption: {
8838
+ ServerSideEncryptionConfiguration: [{
8839
+ ServerSideEncryptionByDefault: {
8840
+ SSEAlgorithm: "aws:kms",
8841
+ KMSMasterKeyID: params.kmsKeyId
8842
+ }
8843
+ }]
8844
+ },
8845
+ PublicAccessBlockConfiguration: {
8846
+ "Fn::If": [
8847
+ "UsePublicAccessBlockConfiguration",
8848
+ {
8849
+ BlockPublicAcls: true,
8850
+ BlockPublicPolicy: true,
8851
+ IgnorePublicAcls: true,
8852
+ RestrictPublicBuckets: true
8853
+ },
8854
+ { Ref: "AWS::NoValue" }
8855
+ ]
8856
+ }
8857
+ }
8858
+ },
8859
+ StagingBucketPolicy: {
8860
+ Type: "AWS::S3::BucketPolicy",
8861
+ Properties: {
8862
+ Bucket: { Ref: "StagingBucket" },
8863
+ PolicyDocument: {
8864
+ Id: "AccessControl",
8865
+ Version: "2012-10-17",
8866
+ Statement: [
8867
+ {
8868
+ Sid: "AllowSSLRequestsOnly",
8869
+ Action: "s3:*",
8870
+ Effect: "Deny",
8871
+ Resource: [
8872
+ { "Fn::Sub": "${StagingBucket.Arn}" },
8873
+ { "Fn::Sub": "${StagingBucket.Arn}/*" }
8874
+ ],
8875
+ Condition: {
8876
+ Bool: { "aws:SecureTransport": "false" }
8877
+ },
8878
+ Principal: "*"
8879
+ }
8880
+ ]
8881
+ }
8882
+ }
8883
+ }
8884
+ },
8885
+ Outputs: {
8886
+ [BUCKET_NAME_OUTPUT]: {
8887
+ Description: "The name of the S3 bucket owned by the CDK toolkit stack",
8888
+ Value: { Ref: "StagingBucket" }
8889
+ },
8890
+ [BUCKET_DOMAIN_NAME_OUTPUT]: {
8891
+ Description: "The domain name of the S3 bucket owned by the CDK toolkit stack",
8892
+ Value: { "Fn::GetAtt": ["StagingBucket", "RegionalDomainName"] }
8893
+ }
8894
+ }
8895
+ };
8896
+ }
8897
+
8898
+ // ../../aws-cdk/lib/api/bootstrap/bootstrap-environment.ts
8899
+ var Bootstrapper = class {
8900
+ constructor(source = { source: "default" }, ioHelper) {
8901
+ this.source = source;
8902
+ this.ioHelper = ioHelper;
8903
+ }
8904
+ bootstrapEnvironment(environment, sdkProvider, options = {}) {
8905
+ switch (this.source.source) {
8906
+ case "legacy":
8907
+ return this.legacyBootstrap(environment, sdkProvider, options);
8908
+ case "default":
8909
+ return this.modernBootstrap(environment, sdkProvider, options);
8910
+ case "custom":
8911
+ return this.customBootstrap(environment, sdkProvider, options);
8912
+ }
8913
+ }
8914
+ async showTemplate(json) {
8915
+ const template = await this.loadTemplate();
8916
+ process.stdout.write(`${serializeStructure(template, json)}
8917
+ `);
8918
+ }
8919
+ /**
8920
+ * Deploy legacy bootstrap stack
8921
+ *
8922
+ */
8923
+ async legacyBootstrap(environment, sdkProvider, options = {}) {
8924
+ const params = options.parameters ?? {};
8925
+ if (params.trustedAccounts?.length) {
8926
+ throw new ToolkitError("--trust can only be passed for the modern bootstrap experience.");
8927
+ }
8928
+ if (params.cloudFormationExecutionPolicies?.length) {
8929
+ throw new ToolkitError("--cloudformation-execution-policies can only be passed for the modern bootstrap experience.");
8930
+ }
8931
+ if (params.createCustomerMasterKey !== void 0) {
8932
+ throw new ToolkitError("--bootstrap-customer-key can only be passed for the modern bootstrap experience.");
8933
+ }
8934
+ if (params.qualifier) {
8935
+ throw new ToolkitError("--qualifier can only be passed for the modern bootstrap experience.");
8936
+ }
8937
+ const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
8938
+ const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.ioHelper);
8939
+ return current.update(
8940
+ await this.loadTemplate(params),
8941
+ {},
8942
+ {
8943
+ ...options,
8944
+ terminationProtection: options.terminationProtection ?? current.terminationProtection
8945
+ }
8946
+ );
8947
+ }
8948
+ /**
8949
+ * Deploy CI/CD-ready bootstrap stack from template
8950
+ *
8951
+ */
8952
+ async modernBootstrap(environment, sdkProvider, options = {}) {
8953
+ const params = options.parameters ?? {};
8954
+ const bootstrapTemplate = await this.loadTemplate();
8955
+ const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
8956
+ const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.ioHelper);
8957
+ const partition = await current.partition();
8958
+ if (params.createCustomerMasterKey !== void 0 && params.kmsKeyId) {
8959
+ throw new ToolkitError(
8960
+ "You cannot pass '--bootstrap-kms-key-id' and '--bootstrap-customer-key' together. Specify one or the other"
8961
+ );
8962
+ }
8963
+ const allTrusted = /* @__PURE__ */ new Set([
8964
+ ...params.trustedAccounts ?? [],
8965
+ ...params.trustedAccountsForLookup ?? []
8966
+ ]);
8967
+ const invalid = intersection(allTrusted, new Set(params.untrustedAccounts));
8968
+ if (invalid.size > 0) {
8969
+ throw new ToolkitError(`Accounts cannot be both trusted and untrusted. Found: ${[...invalid].join(",")}`);
8970
+ }
8971
+ const removeUntrusted = (accounts) => accounts.filter((acc) => !params.untrustedAccounts?.map(String).includes(String(acc)));
8972
+ const trustedAccounts = removeUntrusted(params.trustedAccounts ?? splitCfnArray(current.parameters.TrustedAccounts));
8973
+ (0, import_console.info)(`Trusted accounts for deployment: ${trustedAccounts.length > 0 ? trustedAccounts.join(", ") : "(none)"}`);
8974
+ const trustedAccountsForLookup = removeUntrusted(
8975
+ params.trustedAccountsForLookup ?? splitCfnArray(current.parameters.TrustedAccountsForLookup)
8976
+ );
8977
+ (0, import_console.info)(
8978
+ `Trusted accounts for lookup: ${trustedAccountsForLookup.length > 0 ? trustedAccountsForLookup.join(", ") : "(none)"}`
8979
+ );
8980
+ const cloudFormationExecutionPolicies = params.cloudFormationExecutionPolicies ?? splitCfnArray(current.parameters.CloudFormationExecutionPolicies);
8981
+ if (trustedAccounts.length === 0 && cloudFormationExecutionPolicies.length === 0) {
8982
+ const implicitPolicy = `arn:${partition}:iam::aws:policy/AdministratorAccess`;
8983
+ await this.ioHelper.notify(warn2(
8984
+ `Using default execution policy of '${implicitPolicy}'. Pass '--cloudformation-execution-policies' to customize.`
8985
+ ));
8986
+ } else if (cloudFormationExecutionPolicies.length === 0) {
8987
+ throw new ToolkitError(
8988
+ `Please pass '--cloudformation-execution-policies' when using '--trust' to specify deployment permissions. Try a managed policy of the form 'arn:${partition}:iam::aws:policy/<PolicyName>'.`
8989
+ );
8990
+ } else {
8991
+ (0, import_console.info)(`Execution policies: ${cloudFormationExecutionPolicies.join(", ")}`);
8992
+ }
8993
+ const currentKmsKeyId = current.parameters.FileAssetsBucketKmsKeyId;
8994
+ const kmsKeyId = params.kmsKeyId ?? (params.createCustomerMasterKey === true ? CREATE_NEW_KEY : params.createCustomerMasterKey === false || currentKmsKeyId === void 0 ? USE_AWS_MANAGED_KEY : void 0);
8995
+ const currentPermissionsBoundary = current.parameters.InputPermissionsBoundary || void 0;
8996
+ const inputPolicyName = params.examplePermissionsBoundary ? CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY : params.customPermissionsBoundary;
8997
+ let policyName;
8998
+ if (inputPolicyName) {
8999
+ const sdk = (await sdkProvider.forEnvironment(environment, 1 /* ForWriting */)).sdk;
9000
+ policyName = await this.getPolicyName(environment, sdk, inputPolicyName, partition, params);
9001
+ }
9002
+ if (currentPermissionsBoundary !== policyName) {
9003
+ if (!currentPermissionsBoundary) {
9004
+ await this.ioHelper.notify(warn2(
9005
+ `Adding new permissions boundary ${policyName}`
9006
+ ));
9007
+ } else if (!policyName) {
9008
+ await this.ioHelper.notify(warn2(
9009
+ `Removing existing permissions boundary ${currentPermissionsBoundary}`
9010
+ ));
9011
+ } else {
9012
+ await this.ioHelper.notify(warn2(
9013
+ `Changing permissions boundary from ${currentPermissionsBoundary} to ${policyName}`
9014
+ ));
9015
+ }
9016
+ }
9017
+ return current.update(
9018
+ bootstrapTemplate,
9019
+ {
9020
+ FileAssetsBucketName: params.bucketName,
9021
+ FileAssetsBucketKmsKeyId: kmsKeyId,
9022
+ // Empty array becomes empty string
9023
+ TrustedAccounts: trustedAccounts.join(","),
9024
+ TrustedAccountsForLookup: trustedAccountsForLookup.join(","),
9025
+ CloudFormationExecutionPolicies: cloudFormationExecutionPolicies.join(","),
9026
+ Qualifier: params.qualifier,
9027
+ PublicAccessBlockConfiguration: params.publicAccessBlockConfiguration || params.publicAccessBlockConfiguration === void 0 ? "true" : "false",
9028
+ InputPermissionsBoundary: policyName
9029
+ },
9030
+ {
9031
+ ...options,
9032
+ terminationProtection: options.terminationProtection ?? current.terminationProtection
9033
+ }
9034
+ );
9035
+ }
9036
+ async getPolicyName(environment, sdk, permissionsBoundary, partition, params) {
9037
+ if (permissionsBoundary !== CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY) {
9038
+ this.validatePolicyName(permissionsBoundary);
9039
+ return Promise.resolve(permissionsBoundary);
9040
+ }
9041
+ const arn = await this.getExamplePermissionsBoundary(
9042
+ params.qualifier ?? "hnb659fds",
9043
+ partition,
9044
+ environment.account,
9045
+ sdk
9046
+ );
9047
+ const policyName = arn.split("/").pop();
9048
+ if (!policyName) {
9049
+ throw new ToolkitError("Could not retrieve the example permission boundary!");
9050
+ }
9051
+ return Promise.resolve(policyName);
9052
+ }
9053
+ async getExamplePermissionsBoundary(qualifier, partition, account, sdk) {
9054
+ const iam = sdk.iam();
9055
+ let policyName = `cdk-${qualifier}-permissions-boundary`;
9056
+ const arn = `arn:${partition}:iam::${account}:policy/${policyName}`;
9057
+ try {
9058
+ let getPolicyResp = await iam.getPolicy({ PolicyArn: arn });
9059
+ if (getPolicyResp.Policy) {
9060
+ return arn;
9061
+ }
9062
+ } catch (e) {
9063
+ if (e.name === "NoSuchEntity") {
9064
+ } else {
9065
+ throw e;
9066
+ }
9067
+ }
9068
+ const policyDoc = {
9069
+ Version: "2012-10-17",
9070
+ Statement: [
9071
+ {
9072
+ Action: ["*"],
9073
+ Resource: "*",
9074
+ Effect: "Allow",
9075
+ Sid: "ExplicitAllowAll"
9076
+ },
9077
+ {
9078
+ Condition: {
9079
+ StringEquals: {
9080
+ "iam:PermissionsBoundary": `arn:${partition}:iam::${account}:policy/cdk-${qualifier}-permissions-boundary`
9081
+ }
9082
+ },
9083
+ Action: [
9084
+ "iam:CreateUser",
9085
+ "iam:CreateRole",
9086
+ "iam:PutRolePermissionsBoundary",
9087
+ "iam:PutUserPermissionsBoundary"
9088
+ ],
9089
+ Resource: "*",
9090
+ Effect: "Allow",
9091
+ Sid: "DenyAccessIfRequiredPermBoundaryIsNotBeingApplied"
9092
+ },
9093
+ {
9094
+ Action: [
9095
+ "iam:CreatePolicyVersion",
9096
+ "iam:DeletePolicy",
9097
+ "iam:DeletePolicyVersion",
9098
+ "iam:SetDefaultPolicyVersion"
9099
+ ],
9100
+ Resource: `arn:${partition}:iam::${account}:policy/cdk-${qualifier}-permissions-boundary`,
9101
+ Effect: "Deny",
9102
+ Sid: "DenyPermBoundaryIAMPolicyAlteration"
9103
+ },
9104
+ {
9105
+ Action: ["iam:DeleteUserPermissionsBoundary", "iam:DeleteRolePermissionsBoundary"],
9106
+ Resource: "*",
9107
+ Effect: "Deny",
9108
+ Sid: "DenyRemovalOfPermBoundaryFromAnyUserOrRole"
9109
+ }
9110
+ ]
9111
+ };
9112
+ const request2 = {
9113
+ PolicyName: policyName,
9114
+ PolicyDocument: JSON.stringify(policyDoc)
9115
+ };
9116
+ const createPolicyResponse = await iam.createPolicy(request2);
9117
+ if (createPolicyResponse.Policy?.Arn) {
9118
+ return createPolicyResponse.Policy.Arn;
9119
+ } else {
9120
+ throw new ToolkitError(`Could not retrieve the example permission boundary ${arn}!`);
9121
+ }
9122
+ }
9123
+ validatePolicyName(permissionsBoundary) {
9124
+ const regexp = /[\w+\/=,.@-]+/;
9125
+ const matches = regexp.exec(permissionsBoundary);
9126
+ if (!(matches && matches.length === 1 && matches[0] === permissionsBoundary)) {
9127
+ throw new ToolkitError(`The permissions boundary name ${permissionsBoundary} does not match the IAM conventions.`);
9128
+ }
9129
+ }
9130
+ async customBootstrap(environment, sdkProvider, options = {}) {
9131
+ const version = bootstrapVersionFromTemplate(await this.loadTemplate());
9132
+ if (version === 0) {
9133
+ return this.legacyBootstrap(environment, sdkProvider, options);
9134
+ } else {
9135
+ return this.modernBootstrap(environment, sdkProvider, options);
9136
+ }
9137
+ }
9138
+ async loadTemplate(params = {}) {
9139
+ switch (this.source.source) {
9140
+ case "custom":
9141
+ return loadStructuredFile(this.source.templateFile);
9142
+ case "default":
9143
+ return loadStructuredFile(path12.join(bundledPackageRootDir(__dirname), "lib", "api", "bootstrap", "bootstrap-template.yaml"));
9144
+ case "legacy":
9145
+ return legacyBootstrapTemplate(params);
9146
+ }
9147
+ }
9148
+ };
9149
+ var USE_AWS_MANAGED_KEY = "AWS_MANAGED_KEY";
9150
+ var CREATE_NEW_KEY = "";
9151
+ var CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY = "CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY";
9152
+ function splitCfnArray(xs) {
9153
+ if (xs === "" || xs === void 0) {
9154
+ return [];
9155
+ }
9156
+ return xs.split(",");
9157
+ }
9158
+ function intersection(xs, ys) {
9159
+ return new Set(Array.from(xs).filter((x) => ys.has(x)));
9160
+ }
9161
+
8277
9162
  // ../../aws-cdk/lib/context-providers/index.ts
8278
9163
  var context_providers_exports = {};
8279
9164
  __export(context_providers_exports, {
@@ -8293,8 +9178,8 @@ var AmiContextProviderPlugin = class {
8293
9178
  async getValue(args) {
8294
9179
  const region = args.region;
8295
9180
  const account = args.account;
8296
- info(`Searching for AMI in ${account}:${region}`);
8297
- debug(`AMI search parameters: ${JSON.stringify(args)}`);
9181
+ info2(`Searching for AMI in ${account}:${region}`);
9182
+ debug2(`AMI search parameters: ${JSON.stringify(args)}`);
8298
9183
  const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
8299
9184
  const response = await ec2.describeImages({
8300
9185
  Owners: args.owners,
@@ -8308,7 +9193,7 @@ var AmiContextProviderPlugin = class {
8308
9193
  throw new ContextProviderError("No AMI found that matched the search criteria");
8309
9194
  }
8310
9195
  images.sort(descending((i) => Date.parse(i.CreationDate || "1970")));
8311
- debug(`Selected image '${images[0].ImageId}' created at '${images[0].CreationDate}'`);
9196
+ debug2(`Selected image '${images[0].ImageId}' created at '${images[0].CreationDate}'`);
8312
9197
  return images[0].ImageId;
8313
9198
  }
8314
9199
  };
@@ -8326,7 +9211,7 @@ var AZContextProviderPlugin = class {
8326
9211
  async getValue(args) {
8327
9212
  const region = args.region;
8328
9213
  const account = args.account;
8329
- debug(`Reading AZs for ${account}:${region}`);
9214
+ debug2(`Reading AZs for ${account}:${region}`);
8330
9215
  const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
8331
9216
  const response = await ec2.describeAvailabilityZones({});
8332
9217
  if (!response.AvailabilityZones) {
@@ -8339,27 +9224,6 @@ var AZContextProviderPlugin = class {
8339
9224
  }
8340
9225
  };
8341
9226
 
8342
- // ../../aws-cdk/lib/util/json.ts
8343
- function getResultObj(jsonObject, identifier, propertiesToReturn) {
8344
- const propsObj = {};
8345
- propertiesToReturn.forEach((propName) => {
8346
- Object.assign(propsObj, { [propName]: findJsonValue(jsonObject, propName) });
8347
- });
8348
- Object.assign(propsObj, { ["Identifier"]: identifier });
8349
- return propsObj;
8350
- }
8351
- function findJsonValue(jsonObject, path12) {
8352
- const paths = path12.split(".");
8353
- let obj = jsonObject;
8354
- paths.forEach((p) => {
8355
- obj = obj[p];
8356
- if (obj === void 0) {
8357
- throw new TypeError(`Cannot read field ${path12}. ${p} is not found.`);
8358
- }
8359
- });
8360
- return obj;
8361
- }
8362
-
8363
9227
  // ../../aws-cdk/lib/context-providers/cc-api-provider.ts
8364
9228
  var CcApiContextProviderPlugin = class {
8365
9229
  constructor(aws) {
@@ -8374,8 +9238,8 @@ var CcApiContextProviderPlugin = class {
8374
9238
  */
8375
9239
  async getValue(args) {
8376
9240
  const cloudControl = (await initContextProviderSdk(this.aws, args)).cloudControl();
8377
- const result = await this.findResources(cloudControl, args);
8378
- return result;
9241
+ const result2 = await this.findResources(cloudControl, args);
9242
+ return result2;
8379
9243
  }
8380
9244
  async findResources(cc, args) {
8381
9245
  if (args.exactIdentifier && args.propertyMatch) {
@@ -8400,14 +9264,14 @@ var CcApiContextProviderPlugin = class {
8400
9264
  async getResource(cc, typeName, exactIdentifier, propertiesToReturn) {
8401
9265
  const resultObjs = [];
8402
9266
  try {
8403
- const result = await cc.getResource({
9267
+ const result2 = await cc.getResource({
8404
9268
  TypeName: typeName,
8405
9269
  Identifier: exactIdentifier
8406
9270
  });
8407
- const id = result.ResourceDescription?.Identifier ?? "";
9271
+ const id = result2.ResourceDescription?.Identifier ?? "";
8408
9272
  if (id !== "") {
8409
- const propsObject = JSON.parse(result.ResourceDescription?.Properties ?? "");
8410
- const propsObj = getResultObj(propsObject, result.ResourceDescription?.Identifier, propertiesToReturn);
9273
+ const propsObject = JSON.parse(result2.ResourceDescription?.Properties ?? "");
9274
+ const propsObj = getResultObj(propsObject, result2.ResourceDescription?.Identifier, propertiesToReturn);
8411
9275
  resultObjs.push(propsObj);
8412
9276
  } else {
8413
9277
  throw new ContextProviderError(`Could not get resource ${exactIdentifier}.`);
@@ -8427,10 +9291,10 @@ var CcApiContextProviderPlugin = class {
8427
9291
  async listResources(cc, typeName, propertyMatch, propertiesToReturn) {
8428
9292
  const resultObjs = [];
8429
9293
  try {
8430
- const result = await cc.listResources({
9294
+ const result2 = await cc.listResources({
8431
9295
  TypeName: typeName
8432
9296
  });
8433
- result.ResourceDescriptions?.forEach((resource) => {
9297
+ result2.ResourceDescriptions?.forEach((resource) => {
8434
9298
  const id = resource.Identifier ?? "";
8435
9299
  if (id !== "") {
8436
9300
  const propsObject = JSON.parse(resource.Properties ?? "");
@@ -8470,17 +9334,17 @@ var EndpointServiceAZContextProviderPlugin = class {
8470
9334
  const region = args.region;
8471
9335
  const account = args.account;
8472
9336
  const serviceName = args.serviceName;
8473
- debug(`Reading AZs for ${account}:${region}:${serviceName}`);
9337
+ debug2(`Reading AZs for ${account}:${region}:${serviceName}`);
8474
9338
  const ec2 = (await initContextProviderSdk(this.aws, args)).ec2();
8475
9339
  const response = await ec2.describeVpcEndpointServices({
8476
9340
  ServiceNames: [serviceName]
8477
9341
  });
8478
9342
  if (!response.ServiceDetails || response.ServiceDetails.length === 0) {
8479
- debug(`Could not retrieve service details for ${account}:${region}:${serviceName}`);
9343
+ debug2(`Could not retrieve service details for ${account}:${region}:${serviceName}`);
8480
9344
  return [];
8481
9345
  }
8482
9346
  const azs = response.ServiceDetails[0].AvailabilityZones;
8483
- debug(`Endpoint service ${account}:${region}:${serviceName} is available in availability zones ${azs}`);
9347
+ debug2(`Endpoint service ${account}:${region}:${serviceName} is available in availability zones ${azs}`);
8484
9348
  return azs;
8485
9349
  }
8486
9350
  };
@@ -8497,7 +9361,7 @@ var HostedZoneContextProviderPlugin = class {
8497
9361
  throw new ContextProviderError(`HostedZoneProvider requires domainName property to be set in ${args}`);
8498
9362
  }
8499
9363
  const domainName = args.domainName;
8500
- debug(`Reading hosted zone ${account}:${region}:${domainName}`);
9364
+ debug2(`Reading hosted zone ${account}:${region}:${domainName}`);
8501
9365
  const r53 = (await initContextProviderSdk(this.aws, args)).route53();
8502
9366
  const response = await r53.listHostedZonesByName({ DNSName: domainName });
8503
9367
  if (!response.HostedZones) {
@@ -8516,9 +9380,9 @@ var HostedZoneContextProviderPlugin = class {
8516
9380
  async filterZones(r53, zones, props) {
8517
9381
  let candidates = [];
8518
9382
  const domainName = props.domainName.endsWith(".") ? props.domainName : `${props.domainName}.`;
8519
- debug(`Found the following zones ${JSON.stringify(zones)}`);
9383
+ debug2(`Found the following zones ${JSON.stringify(zones)}`);
8520
9384
  candidates = zones.filter((zone) => zone.Name === domainName);
8521
- debug(`Found the following matched name zones ${JSON.stringify(candidates)}`);
9385
+ debug2(`Found the following matched name zones ${JSON.stringify(candidates)}`);
8522
9386
  if (props.privateZone) {
8523
9387
  candidates = candidates.filter((zone) => zone.Config && zone.Config.PrivateZone);
8524
9388
  } else {
@@ -8529,7 +9393,7 @@ var HostedZoneContextProviderPlugin = class {
8529
9393
  for (const zone of candidates) {
8530
9394
  const data = await r53.getHostedZone({ Id: zone.Id });
8531
9395
  if (!data.VPCs) {
8532
- debug(`Expected VPC for private zone but no VPC found ${zone.Id}`);
9396
+ debug2(`Expected VPC for private zone but no VPC found ${zone.Id}`);
8533
9397
  continue;
8534
9398
  }
8535
9399
  if (data.VPCs.map((vpc) => vpc.VPCId).includes(props.vpcId)) {
@@ -8557,7 +9421,7 @@ var KeyContextProviderPlugin = class {
8557
9421
  }
8558
9422
  // TODO: use paginator function
8559
9423
  async findKey(kms, args) {
8560
- debug(`Listing keys in ${args.account}:${args.region}`);
9424
+ debug2(`Listing keys in ${args.account}:${args.region}`);
8561
9425
  let response;
8562
9426
  let nextMarker;
8563
9427
  do {
@@ -8584,7 +9448,7 @@ var KeyContextProviderPlugin = class {
8584
9448
  if (!alias.TargetKeyId) {
8585
9449
  throw new ContextProviderError(`Could not find any key with alias named ${args.aliasName}`);
8586
9450
  }
8587
- debug(`Key found ${alias.TargetKeyId}`);
9451
+ debug2(`Key found ${alias.TargetKeyId}`);
8588
9452
  return {
8589
9453
  keyId: alias.TargetKeyId
8590
9454
  };
@@ -8592,7 +9456,7 @@ var KeyContextProviderPlugin = class {
8592
9456
  };
8593
9457
 
8594
9458
  // ../../aws-cdk/lib/context-providers/load-balancers.ts
8595
- var import_cx_api6 = require("@aws-cdk/cx-api");
9459
+ var import_cx_api7 = require("@aws-cdk/cx-api");
8596
9460
  var LoadBalancerContextProviderPlugin = class {
8597
9461
  constructor(aws) {
8598
9462
  this.aws = aws;
@@ -8602,7 +9466,7 @@ var LoadBalancerContextProviderPlugin = class {
8602
9466
  throw new ContextProviderError("The load balancer lookup query must specify either `loadBalancerArn` or `loadBalancerTags`");
8603
9467
  }
8604
9468
  const loadBalancer = await (await LoadBalancerProvider.getClient(this.aws, query)).getLoadBalancer();
8605
- const ipAddressType = loadBalancer.IpAddressType === "ipv4" ? import_cx_api6.LoadBalancerIpAddressType.IPV4 : import_cx_api6.LoadBalancerIpAddressType.DUAL_STACK;
9469
+ const ipAddressType = loadBalancer.IpAddressType === "ipv4" ? import_cx_api7.LoadBalancerIpAddressType.IPV4 : import_cx_api7.LoadBalancerIpAddressType.DUAL_STACK;
8606
9470
  return {
8607
9471
  loadBalancerArn: loadBalancer.LoadBalancerArn,
8608
9472
  loadBalancerCanonicalHostedZoneId: loadBalancer.CanonicalHostedZoneId,
@@ -8812,7 +9676,7 @@ var SSMContextProviderPlugin = class {
8812
9676
  throw new ContextProviderError("parameterName must be provided in props for SSMContextProviderPlugin");
8813
9677
  }
8814
9678
  const parameterName = args.parameterName;
8815
- debug(`Reading SSM parameter ${account}:${region}:${parameterName}`);
9679
+ debug2(`Reading SSM parameter ${account}:${region}:${parameterName}`);
8816
9680
  const response = await this.getSsmParameterValue(args);
8817
9681
  const parameterNotFound = !response.Parameter || response.Parameter.Value === void 0;
8818
9682
  const suppressError = "ignoreErrorOnMissingContext" in args && args.ignoreErrorOnMissingContext;
@@ -8849,7 +9713,7 @@ var SSMContextProviderPlugin = class {
8849
9713
  };
8850
9714
 
8851
9715
  // ../../aws-cdk/lib/context-providers/vpcs.ts
8852
- var import_cx_api7 = require("@aws-cdk/cx-api");
9716
+ var import_cx_api8 = require("@aws-cdk/cx-api");
8853
9717
  var VpcNetworkContextProviderPlugin = class {
8854
9718
  constructor(aws) {
8855
9719
  this.aws = aws;
@@ -8861,7 +9725,7 @@ var VpcNetworkContextProviderPlugin = class {
8861
9725
  }
8862
9726
  async findVpc(ec2, args) {
8863
9727
  const filters = Object.entries(args.filter).map(([tag, value]) => ({ Name: tag, Values: [value] }));
8864
- debug(`Listing VPCs in ${args.account}:${args.region}`);
9728
+ debug2(`Listing VPCs in ${args.account}:${args.region}`);
8865
9729
  const response = await ec2.describeVpcs({ Filters: filters });
8866
9730
  const vpcs = response.Vpcs || [];
8867
9731
  if (vpcs.length === 0) {
@@ -8874,7 +9738,7 @@ var VpcNetworkContextProviderPlugin = class {
8874
9738
  }
8875
9739
  async readVpcProps(ec2, vpc, args) {
8876
9740
  const vpcId = vpc.VpcId;
8877
- debug(`Describing VPC ${vpcId}`);
9741
+ debug2(`Describing VPC ${vpcId}`);
8878
9742
  const filters = { Filters: [{ Name: "vpc-id", Values: [vpcId] }] };
8879
9743
  const subnetsResponse = await ec2.describeSubnets(filters);
8880
9744
  const listedSubnets = subnetsResponse.Subnets || [];
@@ -9086,11 +9950,11 @@ function groupAsymmetricSubnets(subnets) {
9086
9950
  function subnetTypeToVpcSubnetType(type) {
9087
9951
  switch (type) {
9088
9952
  case "Isolated" /* Isolated */:
9089
- return import_cx_api7.VpcSubnetGroupType.ISOLATED;
9953
+ return import_cx_api8.VpcSubnetGroupType.ISOLATED;
9090
9954
  case "Private" /* Private */:
9091
- return import_cx_api7.VpcSubnetGroupType.PRIVATE;
9955
+ return import_cx_api8.VpcSubnetGroupType.PRIVATE;
9092
9956
  case "Public" /* Public */:
9093
- return import_cx_api7.VpcSubnetGroupType.PUBLIC;
9957
+ return import_cx_api8.VpcSubnetGroupType.PUBLIC;
9094
9958
  }
9095
9959
  }
9096
9960
  function isValidSubnetType(val) {
@@ -9156,7 +10020,7 @@ async function provideContextValues(missingValues, context, sdk) {
9156
10020
  value = { [cxapi4.PROVIDER_ERROR_KEY]: formatErrorMessage(e), [TRANSIENT_CONTEXT_KEY]: true };
9157
10021
  }
9158
10022
  context.set(key, value);
9159
- debug(`Setting "${key}" context to ${JSON.stringify(value)}`);
10023
+ debug2(`Setting "${key}" context to ${JSON.stringify(value)}`);
9160
10024
  }
9161
10025
  }
9162
10026
  function registerContextProvider(name, provider) {
@@ -9184,13 +10048,13 @@ var availableContextProviders = {
9184
10048
 
9185
10049
  // ../../aws-cdk/lib/api/util/rwlock.ts
9186
10050
  var import_fs = require("fs");
9187
- var path10 = __toESM(require("path"));
10051
+ var path13 = __toESM(require("path"));
9188
10052
  var RWLock = class {
9189
10053
  constructor(directory) {
9190
10054
  this.directory = directory;
9191
10055
  this.readCounter = 0;
9192
10056
  this.pidString = `${process.pid}`;
9193
- this.writerFile = path10.join(this.directory, "synth.lock");
10057
+ this.writerFile = path13.join(this.directory, "synth.lock");
9194
10058
  }
9195
10059
  /**
9196
10060
  * Acquire a writer lock.
@@ -9232,7 +10096,7 @@ var RWLock = class {
9232
10096
  * is incremented "atomically" from the point of view of this PID.).
9233
10097
  */
9234
10098
  readerFile() {
9235
- return path10.join(this.directory, `read.${this.pidString}.${++this.readCounter}.lock`);
10099
+ return path13.join(this.directory, `read.${this.pidString}.${++this.readCounter}.lock`);
9236
10100
  }
9237
10101
  /**
9238
10102
  * Do the actual acquiring of a read lock.
@@ -9289,7 +10153,7 @@ var RWLock = class {
9289
10153
  if (processExists(pid)) {
9290
10154
  ret.push(pid);
9291
10155
  } else {
9292
- await deleteFile(path10.join(this.directory, fname));
10156
+ await deleteFile(path13.join(this.directory, fname));
9293
10157
  }
9294
10158
  }
9295
10159
  }
@@ -9308,7 +10172,7 @@ async function readFileIfExists(filename) {
9308
10172
  }
9309
10173
  var tmpCounter = 0;
9310
10174
  async function writeFileAtomic(filename, contents) {
9311
- await import_fs.promises.mkdir(path10.dirname(filename), { recursive: true });
10175
+ await import_fs.promises.mkdir(path13.dirname(filename), { recursive: true });
9312
10176
  const tmpFile = `${filename}.${process.pid}_${++tmpCounter}`;
9313
10177
  await import_fs.promises.writeFile(tmpFile, contents, { encoding: "utf-8" });
9314
10178
  await import_fs.promises.rename(tmpFile, filename);
@@ -9333,7 +10197,7 @@ function processExists(pid) {
9333
10197
  }
9334
10198
 
9335
10199
  // ../../aws-cdk/lib/api/cxapp/cloud-assembly.ts
9336
- var import_cx_api8 = require("@aws-cdk/cx-api");
10200
+ var import_cx_api9 = require("@aws-cdk/cx-api");
9337
10201
  var chalk16 = __toESM(require("chalk"));
9338
10202
  var import_minimatch = require("minimatch");
9339
10203
  var semver5 = __toESM(require("semver"));
@@ -9494,36 +10358,36 @@ var StackCollection = class _StackCollection {
9494
10358
  let warnings = false;
9495
10359
  let errors = false;
9496
10360
  for (const stack of this.stackArtifacts) {
9497
- for (const message of stack.messages) {
9498
- switch (message.level) {
9499
- case import_cx_api8.SynthesisMessageLevel.WARNING:
10361
+ for (const message2 of stack.messages) {
10362
+ switch (message2.level) {
10363
+ case import_cx_api9.SynthesisMessageLevel.WARNING:
9500
10364
  warnings = true;
9501
- await logger("warn", message);
10365
+ await logger("warn", message2);
9502
10366
  break;
9503
- case import_cx_api8.SynthesisMessageLevel.ERROR:
10367
+ case import_cx_api9.SynthesisMessageLevel.ERROR:
9504
10368
  errors = true;
9505
- await logger("error", message);
10369
+ await logger("error", message2);
9506
10370
  break;
9507
- case import_cx_api8.SynthesisMessageLevel.INFO:
9508
- await logger("info", message);
10371
+ case import_cx_api9.SynthesisMessageLevel.INFO:
10372
+ await logger("info", message2);
9509
10373
  break;
9510
10374
  }
9511
10375
  }
9512
10376
  }
9513
10377
  if (errors && failAt != "none") {
9514
- throw new AssemblyError("Found errors");
10378
+ throw AssemblyError.withStacks("Found errors", this.stackArtifacts);
9515
10379
  }
9516
10380
  if (warnings && failAt === "warn") {
9517
- throw new AssemblyError("Found warnings (--strict mode)");
10381
+ throw AssemblyError.withStacks("Found warnings (--strict mode)", this.stackArtifacts);
9518
10382
  }
9519
10383
  }
9520
10384
  };
9521
10385
  function indexByHierarchicalId(stacks) {
9522
- const result = /* @__PURE__ */ new Map();
10386
+ const result2 = /* @__PURE__ */ new Map();
9523
10387
  for (const stack of stacks) {
9524
- result.set(stack.hierarchicalId, stack);
10388
+ result2.set(stack.hierarchicalId, stack);
9525
10389
  }
9526
- return result;
10390
+ return result2;
9527
10391
  }
9528
10392
  function includeDownstreamStacks(selectedStacks, allStacks) {
9529
10393
  const added = new Array();
@@ -9539,7 +10403,7 @@ function includeDownstreamStacks(selectedStacks, allStacks) {
9539
10403
  }
9540
10404
  } while (madeProgress);
9541
10405
  if (added.length > 0) {
9542
- info("Including depending stacks: %s", chalk16.bold(added.join(", ")));
10406
+ info2("Including depending stacks: %s", chalk16.bold(added.join(", ")));
9543
10407
  }
9544
10408
  }
9545
10409
  function includeUpstreamStacks(selectedStacks, allStacks) {
@@ -9558,7 +10422,7 @@ function includeUpstreamStacks(selectedStacks, allStacks) {
9558
10422
  }
9559
10423
  }
9560
10424
  if (added.length > 0) {
9561
- info("Including dependency stacks: %s", chalk16.bold(added.join(", ")));
10425
+ info2("Including dependency stacks: %s", chalk16.bold(added.join(", ")));
9562
10426
  }
9563
10427
  }
9564
10428
  function sanitizePatterns(patterns) {
@@ -9568,12 +10432,12 @@ function sanitizePatterns(patterns) {
9568
10432
  }
9569
10433
 
9570
10434
  // ../../aws-cdk/lib/api/cxapp/exec.ts
9571
- var path11 = __toESM(require("path"));
10435
+ var path14 = __toESM(require("path"));
9572
10436
  var cxschema4 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
9573
10437
  var cxapi5 = __toESM(require("@aws-cdk/cx-api"));
9574
- var fs14 = __toESM(require("fs-extra"));
10438
+ var fs16 = __toESM(require("fs-extra"));
9575
10439
  var semver6 = __toESM(require("semver"));
9576
- async function prepareDefaultEnvironment(aws, logFn = debug) {
10440
+ async function prepareDefaultEnvironment(aws, logFn = debug2) {
9577
10441
  const env = {};
9578
10442
  env[cxapi5.DEFAULT_REGION_ENV] = aws.defaultRegion;
9579
10443
  await logFn(`Setting "${cxapi5.DEFAULT_REGION_ENV}" environment variable to`, env[cxapi5.DEFAULT_REGION_ENV]);
@@ -9610,7 +10474,7 @@ async function prepareContext(settings, context, env) {
9610
10474
  }
9611
10475
  const bundlingStacks = settings.get(["bundlingStacks"]) ?? ["**"];
9612
10476
  context[cxapi5.BUNDLING_STACKS] = bundlingStacks;
9613
- debug("context:", context);
10477
+ debug2("context:", context);
9614
10478
  return context;
9615
10479
  }
9616
10480
  function appToArray(app) {
@@ -9627,14 +10491,14 @@ async function guessExecutable(app) {
9627
10491
  if (commandLine.length === 1) {
9628
10492
  let fstat;
9629
10493
  try {
9630
- fstat = await fs14.stat(commandLine[0]);
10494
+ fstat = await fs16.stat(commandLine[0]);
9631
10495
  } catch {
9632
- debug(`Not a file: '${commandLine[0]}'. Using '${commandLine}' as command-line`);
10496
+ debug2(`Not a file: '${commandLine[0]}'. Using '${commandLine}' as command-line`);
9633
10497
  return commandLine;
9634
10498
  }
9635
- const isExecutable = (fstat.mode & fs14.constants.X_OK) !== 0;
10499
+ const isExecutable = (fstat.mode & fs16.constants.X_OK) !== 0;
9636
10500
  const isWindows = process.platform === "win32";
9637
- const handler = EXTENSION_MAP.get(path11.extname(commandLine[0]));
10501
+ const handler = EXTENSION_MAP.get(path14.extname(commandLine[0]));
9638
10502
  if (handler && (!isExecutable || isWindows)) {
9639
10503
  return handler(commandLine[0]);
9640
10504
  }
@@ -9648,6 +10512,7 @@ function spaceAvailableForContext(env, limit) {
9648
10512
  }
9649
10513
  // Annotate the CommonJS export names for ESM import in node:
9650
10514
  0 && (module.exports = {
10515
+ Bootstrapper,
9651
10516
  CliIoHost,
9652
10517
  CloudAssembly,
9653
10518
  CloudWatchLogEventMonitor,
@@ -9667,21 +10532,14 @@ function spaceAvailableForContext(env, limit) {
9667
10532
  WorkGraphBuilder,
9668
10533
  contextproviders,
9669
10534
  findCloudWatchLogGroups,
9670
- formatErrorMessage,
9671
- formatSdkLoggerContent,
9672
- formatTime,
9673
10535
  guessExecutable,
9674
10536
  loadTree,
9675
- obscureTemplate,
9676
10537
  prepareContext,
9677
10538
  prepareDefaultEnvironment,
9678
10539
  sanitizePatterns,
9679
- serializeStructure,
9680
10540
  some,
9681
10541
  spaceAvailableForContext,
9682
- splitBySize,
9683
10542
  tagsForStack,
9684
- validateSnsTopicArn,
9685
10543
  versionNumber
9686
10544
  });
9687
10545
  //# sourceMappingURL=aws-cdk.js.map