@aws-cdk/toolkit-lib 0.1.3 → 0.1.4

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 (60) hide show
  1. package/CODE_REGISTRY.md +12 -9
  2. package/build-info.json +2 -2
  3. package/db.json.gz +0 -0
  4. package/lib/actions/bootstrap/index.d.ts +174 -0
  5. package/lib/actions/bootstrap/index.js +94 -0
  6. package/lib/actions/bootstrap/private/helpers.d.ts +5 -0
  7. package/lib/actions/bootstrap/private/helpers.js +23 -0
  8. package/lib/actions/bootstrap/private/index.d.ts +1 -0
  9. package/lib/actions/bootstrap/private/index.js +18 -0
  10. package/lib/actions/destroy/index.d.ts +1 -1
  11. package/lib/actions/destroy/index.js +1 -1
  12. package/lib/actions/index.d.ts +1 -0
  13. package/lib/actions/index.js +2 -1
  14. package/lib/actions/list/index.d.ts +4 -0
  15. package/lib/actions/list/index.js +1 -1
  16. package/lib/api/aws-cdk.d.ts +3 -6
  17. package/lib/api/aws-cdk.js +710 -252
  18. package/lib/api/aws-cdk.js.map +4 -4
  19. package/lib/api/bootstrap/bootstrap-template.yaml +707 -0
  20. package/lib/api/cloud-assembly/context.d.ts +9 -0
  21. package/lib/api/cloud-assembly/context.js +3 -0
  22. package/lib/api/cloud-assembly/private/context-aware-source.js +3 -3
  23. package/lib/api/cloud-assembly/private/prepare-source.d.ts +1 -1
  24. package/lib/api/cloud-assembly/private/prepare-source.js +4 -3
  25. package/lib/api/cloud-assembly/private/source-builder.js +3 -3
  26. package/lib/api/io/index.d.ts +1 -2
  27. package/lib/api/io/index.js +1 -17
  28. package/lib/api/io/private/codes.d.ts +39 -59
  29. package/lib/api/io/private/codes.js +55 -67
  30. package/lib/api/io/private/index.d.ts +0 -1
  31. package/lib/api/io/private/index.js +1 -2
  32. package/lib/api/io/private/level-priority.d.ts +1 -1
  33. package/lib/api/io/private/level-priority.js +1 -1
  34. package/lib/api/io/private/logger.d.ts +3 -12
  35. package/lib/api/io/private/logger.js +1 -22
  36. package/lib/api/io/private/messages.d.ts +7 -3
  37. package/lib/api/io/private/messages.js +1 -2
  38. package/lib/api/io/private/timer.d.ts +2 -2
  39. package/lib/api/io/private/timer.js +13 -13
  40. package/lib/api/shared-private.d.ts +1 -0
  41. package/lib/api/shared-private.js +82 -0
  42. package/lib/api/shared-private.js.map +7 -0
  43. package/lib/api/shared-public.d.ts +130 -1
  44. package/lib/api/shared-public.js.map +1 -1
  45. package/lib/private/util.d.ts +1 -0
  46. package/lib/private/util.js +715 -0
  47. package/lib/private/util.js.map +7 -0
  48. package/lib/toolkit/private/index.d.ts +10 -1
  49. package/lib/toolkit/private/index.js +18 -1
  50. package/lib/toolkit/toolkit.d.ts +7 -11
  51. package/lib/toolkit/toolkit.js +126 -99
  52. package/lib/util/concurrency.d.ts +5 -0
  53. package/lib/util/concurrency.js +11 -0
  54. package/package.json +11 -11
  55. package/lib/api/io/io-host.d.ts +0 -15
  56. package/lib/api/io/io-host.js +0 -3
  57. package/lib/api/io/io-message.d.ts +0 -59
  58. package/lib/api/io/io-message.js +0 -3
  59. package/lib/api/io/private/types.d.ts +0 -25
  60. package/lib/api/io/private/types.js +0 -3
@@ -38,6 +38,7 @@ var __decorateClass = (decorators, target, key, kind) => {
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,15 @@ __export(aws_cdk_exports, {
57
58
  WorkGraphBuilder: () => WorkGraphBuilder,
58
59
  contextproviders: () => context_providers_exports,
59
60
  findCloudWatchLogGroups: () => findCloudWatchLogGroups,
60
- formatErrorMessage: () => formatErrorMessage,
61
61
  formatSdkLoggerContent: () => formatSdkLoggerContent,
62
- formatTime: () => formatTime,
63
62
  guessExecutable: () => guessExecutable,
64
63
  loadTree: () => loadTree,
65
- obscureTemplate: () => obscureTemplate,
66
64
  prepareContext: () => prepareContext,
67
65
  prepareDefaultEnvironment: () => prepareDefaultEnvironment,
68
66
  sanitizePatterns: () => sanitizePatterns,
69
- serializeStructure: () => serializeStructure,
70
67
  some: () => some,
71
68
  spaceAvailableForContext: () => spaceAvailableForContext,
72
- splitBySize: () => splitBySize,
73
69
  tagsForStack: () => tagsForStack,
74
- validateSnsTopicArn: () => validateSnsTopicArn,
75
70
  versionNumber: () => versionNumber
76
71
  });
77
72
  module.exports = __toCommonJS(aws_cdk_exports);
@@ -176,10 +171,10 @@ var ContextProviderError = class _ContextProviderError extends ToolkitError {
176
171
  }
177
172
  };
178
173
 
179
- // ../../aws-cdk/lib/util/archive.ts
174
+ // ../tmp-toolkit-helpers/src/util/archive.ts
180
175
  var glob = __toESM(require("glob"));
181
176
 
182
- // ../../aws-cdk/lib/util/format-error.ts
177
+ // ../tmp-toolkit-helpers/src/util/format-error.ts
183
178
  function formatErrorMessage(error3) {
184
179
  if (error3 && Array.isArray(error3.errors)) {
185
180
  const innerMessages = error3.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
@@ -188,10 +183,10 @@ function formatErrorMessage(error3) {
188
183
  return error3?.message || error3?.toString() || "Unknown error";
189
184
  }
190
185
 
191
- // ../../aws-cdk/lib/util/archive.ts
186
+ // ../tmp-toolkit-helpers/src/util/archive.ts
192
187
  var archiver = require("archiver");
193
188
 
194
- // ../../aws-cdk/lib/util/arrays.ts
189
+ // ../tmp-toolkit-helpers/src/util/arrays.ts
195
190
  function flatMap(xs, fn) {
196
191
  return flatten(xs.map(fn));
197
192
  }
@@ -199,7 +194,7 @@ function flatten(xs) {
199
194
  return Array.prototype.concat.apply([], xs);
200
195
  }
201
196
 
202
- // ../../aws-cdk/lib/util/bytes.ts
197
+ // ../tmp-toolkit-helpers/src/util/bytes.ts
203
198
  function formatBytes(bytes, decimals = 2) {
204
199
  decimals = decimals < 0 ? 0 : decimals;
205
200
  if (bytes === 0) {
@@ -211,10 +206,7 @@ function formatBytes(bytes, decimals = 2) {
211
206
  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
212
207
  }
213
208
 
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
- }
209
+ // ../tmp-toolkit-helpers/src/util/cloudformation.ts
218
210
  function stackEventHasErrorMessage(status) {
219
211
  return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
220
212
  }
@@ -230,7 +222,7 @@ function maxResourceTypeLength(template, startWidth = "AWS::CloudFormation::Stac
230
222
  return maxWidth;
231
223
  }
232
224
 
233
- // ../../aws-cdk/lib/util/content-hash.ts
225
+ // ../tmp-toolkit-helpers/src/util/content-hash.ts
234
226
  var crypto = __toESM(require("crypto"));
235
227
  function contentHash(data) {
236
228
  return crypto.createHash("sha256").update(data).digest("hex");
@@ -267,13 +259,71 @@ function contentHashAny(value) {
267
259
  }
268
260
  }
269
261
 
270
- // ../../aws-cdk/lib/util/types.ts
262
+ // ../tmp-toolkit-helpers/src/util/directories.ts
263
+ var fs = __toESM(require("fs"));
264
+ var os = __toESM(require("os"));
265
+ var path = __toESM(require("path"));
266
+ function cdkHomeDir() {
267
+ const tmpDir = fs.realpathSync(os.tmpdir());
268
+ let home;
269
+ try {
270
+ let userInfoHome = os.userInfo().homedir;
271
+ if (userInfoHome == "/var/empty") {
272
+ userInfoHome = void 0;
273
+ }
274
+ home = path.join((userInfoHome ?? os.homedir()).trim(), ".cdk");
275
+ } catch {
276
+ }
277
+ return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home || fs.mkdtempSync(path.join(tmpDir, ".cdk")).trim();
278
+ }
279
+ function cdkCacheDir() {
280
+ return path.join(cdkHomeDir(), "cache");
281
+ }
282
+ function bundledPackageRootDir(start, fail) {
283
+ function _rootDir(dirname6) {
284
+ const manifestPath = path.join(dirname6, "package.json");
285
+ if (fs.existsSync(manifestPath)) {
286
+ return dirname6;
287
+ }
288
+ if (path.dirname(dirname6) === dirname6) {
289
+ if (fail ?? true) {
290
+ throw new ToolkitError("Unable to find package manifest");
291
+ }
292
+ return void 0;
293
+ }
294
+ return _rootDir(path.dirname(dirname6));
295
+ }
296
+ return _rootDir(start);
297
+ }
298
+
299
+ // ../tmp-toolkit-helpers/src/util/json.ts
300
+ function getResultObj(jsonObject, identifier, propertiesToReturn) {
301
+ const propsObj = {};
302
+ propertiesToReturn.forEach((propName) => {
303
+ Object.assign(propsObj, { [propName]: findJsonValue(jsonObject, propName) });
304
+ });
305
+ Object.assign(propsObj, { ["Identifier"]: identifier });
306
+ return propsObj;
307
+ }
308
+ function findJsonValue(jsonObject, path15) {
309
+ const paths = path15.split(".");
310
+ let obj = jsonObject;
311
+ paths.forEach((p) => {
312
+ obj = obj[p];
313
+ if (obj === void 0) {
314
+ throw new TypeError(`Cannot read field ${path15}. ${p} is not found.`);
315
+ }
316
+ });
317
+ return obj;
318
+ }
319
+
320
+ // ../tmp-toolkit-helpers/src/util/types.ts
271
321
  function isObject(x) {
272
322
  return x !== null && typeof x === "object" && !isArray(x);
273
323
  }
274
324
  var isArray = Array.isArray;
275
325
 
276
- // ../../aws-cdk/lib/util/objects.ts
326
+ // ../tmp-toolkit-helpers/src/util/objects.ts
277
327
  function deepClone(x) {
278
328
  if (typeof x === "undefined") {
279
329
  return void 0;
@@ -303,21 +353,21 @@ function makeObject(pairs) {
303
353
  }
304
354
  return ret;
305
355
  }
306
- function deepGet(x, path12) {
307
- path12 = path12.slice();
308
- while (path12.length > 0 && isObject(x)) {
309
- const key = path12.shift();
356
+ function deepGet(x, path15) {
357
+ path15 = path15.slice();
358
+ while (path15.length > 0 && isObject(x)) {
359
+ const key = path15.shift();
310
360
  x = x[key];
311
361
  }
312
- return path12.length === 0 ? x : void 0;
362
+ return path15.length === 0 ? x : void 0;
313
363
  }
314
- function deepSet(x, path12, value) {
315
- path12 = path12.slice();
316
- if (path12.length === 0) {
364
+ function deepSet(x, path15, value) {
365
+ path15 = path15.slice();
366
+ if (path15.length === 0) {
317
367
  throw new ToolkitError("Path may not be empty");
318
368
  }
319
- while (path12.length > 1 && isObject(x)) {
320
- const key = path12.shift();
369
+ while (path15.length > 1 && isObject(x)) {
370
+ const key = path15.shift();
321
371
  if (!(key in x)) {
322
372
  x[key] = {};
323
373
  }
@@ -327,9 +377,9 @@ function deepSet(x, path12, value) {
327
377
  throw new ToolkitError(`Expected an object, got '${x}'`);
328
378
  }
329
379
  if (value !== void 0) {
330
- x[path12[0]] = value;
380
+ x[path15[0]] = value;
331
381
  } else {
332
- delete x[path12[0]];
382
+ delete x[path15[0]];
333
383
  }
334
384
  }
335
385
  function deepMerge(...objects) {
@@ -357,31 +407,8 @@ function deepMerge(...objects) {
357
407
  others.forEach((other) => mergeOne(into, other));
358
408
  return into;
359
409
  }
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
410
 
384
- // ../../aws-cdk/lib/util/parallel.ts
411
+ // ../tmp-toolkit-helpers/src/util/parallel.ts
385
412
  async function parallelPromises(n, promises) {
386
413
  const ret = new Array();
387
414
  let count = 0;
@@ -419,10 +446,10 @@ async function parallelPromises(n, promises) {
419
446
  });
420
447
  }
421
448
 
422
- // ../../aws-cdk/lib/util/serialize.ts
423
- var fs = __toESM(require("fs-extra"));
449
+ // ../tmp-toolkit-helpers/src/util/serialize.ts
450
+ var fs2 = __toESM(require("fs/promises"));
424
451
 
425
- // ../../aws-cdk/lib/util/yaml-cfn.ts
452
+ // ../tmp-toolkit-helpers/src/util/yaml-cfn.ts
426
453
  var yaml = __toESM(require("yaml"));
427
454
  var yaml_types = __toESM(require("yaml/types"));
428
455
  function serialize(obj) {
@@ -479,7 +506,7 @@ function parseYamlStrWithCfnTags(text) {
479
506
  });
480
507
  }
481
508
 
482
- // ../../aws-cdk/lib/util/serialize.ts
509
+ // ../tmp-toolkit-helpers/src/util/serialize.ts
483
510
  function toYAML(obj) {
484
511
  return serialize(obj);
485
512
  }
@@ -493,17 +520,9 @@ function serializeStructure(object, json) {
493
520
  return toYAML(object);
494
521
  }
495
522
  }
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;
523
+ async function loadStructuredFile(fileName) {
524
+ const contents = await fs2.readFile(fileName, { encoding: "utf-8" });
525
+ return deserializeStructure(contents);
507
526
  }
508
527
  function isJsonBuffer(value) {
509
528
  return typeof value === "object" && "type" in value && value.type === "Buffer" && "data" in value && Array.isArray(value.data);
@@ -515,7 +534,7 @@ function replacerBufferWithInfo(_key, value) {
515
534
  return value;
516
535
  }
517
536
 
518
- // ../../aws-cdk/lib/util/string-manipulation.ts
537
+ // ../tmp-toolkit-helpers/src/util/string-manipulation.ts
519
538
  function padLeft(n, x, char = " ") {
520
539
  return char.repeat(Math.max(0, n - x.length)) + x;
521
540
  }
@@ -532,7 +551,7 @@ function millisecondsToSeconds(num) {
532
551
  return num / 1e3;
533
552
  }
534
553
 
535
- // ../../aws-cdk/lib/util/version-range.ts
554
+ // ../tmp-toolkit-helpers/src/util/version-range.ts
536
555
  var semver = __toESM(require("semver"));
537
556
 
538
557
  // ../../aws-cdk/lib/cli/activity-printer/base.ts
@@ -1245,43 +1264,6 @@ var trace = (input, ...args) => {
1245
1264
  return formatMessageAndLog("trace", input, void 0, ...args);
1246
1265
  };
1247
1266
 
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
1267
  // ../../aws-cdk/lib/api/aws-auth/account-cache.ts
1286
1268
  var AccountAccessKeyCache = class _AccountAccessKeyCache {
1287
1269
  static {
@@ -1433,7 +1415,7 @@ function readIfPossible(filename) {
1433
1415
 
1434
1416
  // ../../aws-cdk/lib/api/aws-auth/user-agent.ts
1435
1417
  function defaultCliUserAgent() {
1436
- const root = rootDir(false);
1418
+ const root = bundledPackageRootDir(__dirname, false);
1437
1419
  const pkg = JSON.parse((root ? readIfPossible(path3.join(root, "package.json")) : void 0) ?? "{}");
1438
1420
  const name = pkg.name ?? path3.basename(process.argv[1] ?? "cdk-cli");
1439
1421
  const version = pkg.version ?? "<unknown>";
@@ -1892,10 +1874,10 @@ function getRegionFromIniFile(profile, data) {
1892
1874
  return data?.[profile]?.region;
1893
1875
  }
1894
1876
  function tryGetCACert(bundlePath) {
1895
- const path12 = bundlePath || caBundlePathFromEnvironment();
1896
- if (path12) {
1897
- debug("Using CA bundle path: %s", path12);
1898
- return readIfPossible(path12);
1877
+ const path15 = bundlePath || caBundlePathFromEnvironment();
1878
+ if (path15) {
1879
+ debug("Using CA bundle path: %s", path15);
1880
+ return readIfPossible(path15);
1899
1881
  }
1900
1882
  return void 0;
1901
1883
  }
@@ -1955,10 +1937,10 @@ async function tokenCodeFn(serialArn) {
1955
1937
  }
1956
1938
 
1957
1939
  // ../../aws-cdk/lib/api/aws-auth/credential-plugins.ts
1958
- var import_util7 = require("util");
1940
+ var import_util10 = require("util");
1959
1941
 
1960
1942
  // ../../aws-cdk/lib/api/plugin/plugin.ts
1961
- var import_util6 = require("util");
1943
+ var import_util9 = require("util");
1962
1944
  var chalk5 = __toESM(require("chalk"));
1963
1945
 
1964
1946
  // ../../aws-cdk/lib/api/plugin/context-provider-plugin.ts
@@ -2048,7 +2030,7 @@ var PluginHost = class _PluginHost {
2048
2030
  */
2049
2031
  registerContextProviderAlpha(pluginProviderName, provider) {
2050
2032
  if (!isContextProviderPlugin(provider)) {
2051
- throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util6.inspect)(provider)}`);
2033
+ throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util9.inspect)(provider)}`);
2052
2034
  }
2053
2035
  this.contextProviderPlugins[pluginProviderName] = provider;
2054
2036
  }
@@ -2117,7 +2099,7 @@ async function v3ProviderFromPlugin(producer) {
2117
2099
  } else if (isV2Credentials(initial)) {
2118
2100
  return v3ProviderFromV2Credentials(initial);
2119
2101
  } else {
2120
- throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util7.inspect)(initial)}`);
2102
+ throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util10.inspect)(initial)}`);
2121
2103
  }
2122
2104
  }
2123
2105
  function v3ProviderFromV2Credentials(x) {
@@ -2136,7 +2118,7 @@ function refreshFromPluginProvider(current, producer) {
2136
2118
  if (credentialsAboutToExpire(current)) {
2137
2119
  const newCreds = await producer();
2138
2120
  if (!isV3Credentials(newCreds)) {
2139
- throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util7.inspect)(newCreds)}`);
2121
+ throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util10.inspect)(newCreds)}`);
2140
2122
  }
2141
2123
  current = newCreds;
2142
2124
  }
@@ -2425,7 +2407,7 @@ async function initContextProviderSdk(aws, options) {
2425
2407
  }
2426
2408
 
2427
2409
  // ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
2428
- var import_util8 = require("util");
2410
+ var import_util13 = require("util");
2429
2411
  function formatSdkLoggerContent(content) {
2430
2412
  if (content.length === 1) {
2431
2413
  const apiFmt = formatApiCall(content[0]);
@@ -2433,7 +2415,7 @@ function formatSdkLoggerContent(content) {
2433
2415
  return apiFmt;
2434
2416
  }
2435
2417
  }
2436
- return content.map((x) => typeof x === "string" ? x : (0, import_util8.inspect)(x)).join("");
2418
+ return content.map((x) => typeof x === "string" ? x : (0, import_util13.inspect)(x)).join("");
2437
2419
  }
2438
2420
  function formatApiCall(content) {
2439
2421
  if (!isSdkApiCallSuccess(content) && !isSdkApiCallError(content)) {
@@ -2521,22 +2503,22 @@ var Settings = class _Settings {
2521
2503
  get empty() {
2522
2504
  return Object.keys(this.settings).length === 0;
2523
2505
  }
2524
- get(path12) {
2525
- return deepClone(deepGet(this.settings, path12));
2506
+ get(path15) {
2507
+ return deepClone(deepGet(this.settings, path15));
2526
2508
  }
2527
- set(path12, value) {
2509
+ set(path15, value) {
2528
2510
  if (this.readOnly) {
2529
- throw new ToolkitError(`Can't set ${path12}: settings object is readonly`);
2511
+ throw new ToolkitError(`Can't set ${path15}: settings object is readonly`);
2530
2512
  }
2531
- if (path12.length === 0) {
2513
+ if (path15.length === 0) {
2532
2514
  this.settings = value;
2533
2515
  } else {
2534
- deepSet(this.settings, path12, value);
2516
+ deepSet(this.settings, path15, value);
2535
2517
  }
2536
2518
  return this;
2537
2519
  }
2538
- unset(path12) {
2539
- this.set(path12, void 0);
2520
+ unset(path15) {
2521
+ this.set(path15, void 0);
2540
2522
  }
2541
2523
  prohibitContextKey(key, fileName) {
2542
2524
  if (!this.settings.context) {
@@ -2648,7 +2630,7 @@ var Context = class {
2648
2630
  };
2649
2631
 
2650
2632
  // ../../aws-cdk/lib/api/deployments/cloudformation.ts
2651
- var import_util10 = require("util");
2633
+ var import_util19 = require("util");
2652
2634
  var cxapi = __toESM(require("@aws-cdk/cx-api"));
2653
2635
  var import_cx_api3 = require("@aws-cdk/cx-api");
2654
2636
  var import_client_cloudformation3 = require("@aws-sdk/client-cloudformation");
@@ -3027,12 +3009,12 @@ var StackActivityMonitor = class {
3027
3009
  if (!logicalId || !metadata) {
3028
3010
  return void 0;
3029
3011
  }
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);
3012
+ for (const path15 of Object.keys(metadata)) {
3013
+ const entry = metadata[path15].filter((e) => e.type === import_cloud_assembly_schema.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
3032
3014
  if (entry) {
3033
3015
  return {
3034
3016
  entry,
3035
- constructPath: this.simplifyConstructPath(path12)
3017
+ constructPath: this.simplifyConstructPath(path15)
3036
3018
  };
3037
3019
  }
3038
3020
  }
@@ -3101,13 +3083,13 @@ var StackActivityMonitor = class {
3101
3083
  }
3102
3084
  }
3103
3085
  }
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);
3086
+ simplifyConstructPath(path15) {
3087
+ path15 = path15.replace(/\/Resource$/, "");
3088
+ path15 = path15.replace(/^\//, "");
3089
+ if (path15.startsWith(this.stackName + "/")) {
3090
+ path15 = path15.slice(this.stackName.length + 1);
3109
3091
  }
3110
- return path12;
3092
+ return path15;
3111
3093
  }
3112
3094
  };
3113
3095
 
@@ -3422,13 +3404,13 @@ async function waitFor(valueProvider, timeout = 5e3) {
3422
3404
  }
3423
3405
  }
3424
3406
  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)));
3407
+ await ioHost.notify(debug2(action, (0, import_util19.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
3426
3408
  const ret = await waitFor(async () => {
3427
3409
  const description = await describeChangeSet(cfn, stackName, changeSetName, {
3428
3410
  fetchAll
3429
3411
  });
3430
3412
  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)));
3413
+ await ioHost.notify(debug2(action, (0, import_util19.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
3432
3414
  return void 0;
3433
3415
  }
3434
3416
  if (description.Status === import_client_cloudformation3.ChangeSetStatus.CREATE_COMPLETE || changeSetHasNoChanges(description)) {
@@ -3513,19 +3495,19 @@ async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
3513
3495
  return stack;
3514
3496
  }
3515
3497
  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)));
3498
+ await ioHost.notify(debug2(action, (0, import_util19.format)("Waiting for stack %s to finish creating or updating...", stackName)));
3517
3499
  return waitFor(async () => {
3518
3500
  const stack = await CloudFormationStack.lookup(cfn, stackName);
3519
3501
  if (!stack.exists) {
3520
- await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s does not exist", stackName)));
3502
+ await ioHost.notify(debug2(action, (0, import_util19.format)("Stack %s does not exist", stackName)));
3521
3503
  return null;
3522
3504
  }
3523
3505
  const status = stack.stackStatus;
3524
3506
  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)));
3507
+ await ioHost.notify(debug2(action, (0, import_util19.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
3526
3508
  return void 0;
3527
3509
  } 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)));
3510
+ await ioHost.notify(debug2(action, (0, import_util19.format)("Stack %s is in REVIEW_IN_PROGRESS state. Considering this is a stable status (%s)", stackName, status)));
3529
3511
  }
3530
3512
  return stack;
3531
3513
  });
@@ -3794,7 +3776,7 @@ async function getBootstrapStackInfo(sdk, stackName) {
3794
3776
  }
3795
3777
 
3796
3778
  // ../../aws-cdk/lib/api/deployments/deploy-stack.ts
3797
- var import_util13 = require("util");
3779
+ var import_util25 = require("util");
3798
3780
  var chalk9 = __toESM(require("chalk"));
3799
3781
  var uuid2 = __toESM(require("uuid"));
3800
3782
 
@@ -3892,7 +3874,7 @@ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
3892
3874
  }
3893
3875
 
3894
3876
  // ../../aws-cdk/lib/api/deployments/hotswap-deployments.ts
3895
- var import_util12 = require("util");
3877
+ var import_util23 = require("util");
3896
3878
  var cfn_diff = __toESM(require("@aws-cdk/cloudformation-diff"));
3897
3879
  var chalk8 = __toESM(require("chalk"));
3898
3880
 
@@ -5429,7 +5411,7 @@ async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation
5429
5411
  const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
5430
5412
  sdk.appendCustomUserAgent(customUserAgent);
5431
5413
  for (const name of hotswapOperation.resourceNames) {
5432
- await ioHost.notify(info2(action, (0, import_util12.format)(` ${ICON} %s`, chalk8.bold(name))));
5414
+ await ioHost.notify(info2(action, (0, import_util23.format)(` ${ICON} %s`, chalk8.bold(name))));
5433
5415
  }
5434
5416
  try {
5435
5417
  await hotswapOperation.apply(sdk);
@@ -5443,7 +5425,7 @@ async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation
5443
5425
  throw e;
5444
5426
  }
5445
5427
  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!"))));
5428
+ await ioHost.notify(info2(action, (0, import_util23.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
5447
5429
  }
5448
5430
  sdk.removeCustomUserAgent(customUserAgent);
5449
5431
  }
@@ -5471,13 +5453,13 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
5471
5453
  }
5472
5454
  const messages = [""];
5473
5455
  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")));
5456
+ 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
5457
  } else {
5476
- messages.push((0, import_util12.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
5458
+ messages.push((0, import_util23.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
5477
5459
  }
5478
5460
  for (const change of nonHotswappableChanges) {
5479
5461
  if (change.rejectedChanges.length > 0) {
5480
- messages.push((0, import_util12.format)(
5462
+ messages.push((0, import_util23.format)(
5481
5463
  " logicalID: %s, type: %s, rejected changes: %s, reason: %s",
5482
5464
  chalk8.bold(change.logicalId),
5483
5465
  chalk8.bold(change.resourceType),
@@ -5485,7 +5467,7 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
5485
5467
  chalk8.red(change.reason)
5486
5468
  ));
5487
5469
  } else {
5488
- messages.push((0, import_util12.format)(
5470
+ messages.push((0, import_util23.format)(
5489
5471
  " logicalID: %s, type: %s, reason: %s",
5490
5472
  chalk8.bold(change.logicalId),
5491
5473
  chalk8.bold(change.resourceType),
@@ -5537,7 +5519,7 @@ async function deployStack(options, { ioHost, action }) {
5537
5519
  if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
5538
5520
  await ioHost.notify(info2(
5539
5521
  action,
5540
- (0, import_util13.format)(
5522
+ (0, import_util25.format)(
5541
5523
  `
5542
5524
  ${ICON} %s
5543
5525
  `,
@@ -5585,7 +5567,7 @@ async function deployStack(options, { ioHost, action }) {
5585
5567
  if (hotswapDeploymentResult) {
5586
5568
  return hotswapDeploymentResult;
5587
5569
  }
5588
- await ioHost.notify(info2(action, (0, import_util13.format)(
5570
+ await ioHost.notify(info2(action, (0, import_util25.format)(
5589
5571
  "Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
5590
5572
  stackArtifact.displayName
5591
5573
  )));
@@ -5593,7 +5575,7 @@ async function deployStack(options, { ioHost, action }) {
5593
5575
  if (!(e instanceof CfnEvaluationException)) {
5594
5576
  throw e;
5595
5577
  }
5596
- await ioHost.notify(info2(action, (0, import_util13.format)(
5578
+ await ioHost.notify(info2(action, (0, import_util25.format)(
5597
5579
  "Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
5598
5580
  formatErrorMessage(e)
5599
5581
  )));
@@ -5657,9 +5639,9 @@ var FullCloudFormationDeployment = class {
5657
5639
  const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
5658
5640
  await this.updateTerminationProtection();
5659
5641
  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)));
5642
+ await this.ioHost.notify(debug2(this.action, (0, import_util25.format)("No changes are to be performed on %s.", this.stackName)));
5661
5643
  if (execute) {
5662
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
5644
+ await this.ioHost.notify(debug2(this.action, (0, import_util25.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
5663
5645
  await this.cfn.deleteChangeSet({
5664
5646
  StackName: this.stackName,
5665
5647
  ChangeSetName: changeSetName
@@ -5685,7 +5667,7 @@ var FullCloudFormationDeployment = class {
5685
5667
  };
5686
5668
  }
5687
5669
  if (!execute) {
5688
- await this.ioHost.notify(info2(this.action, (0, import_util13.format)(
5670
+ await this.ioHost.notify(info2(this.action, (0, import_util25.format)(
5689
5671
  "Changeset %s created and waiting in review for manual execution (--no-execute)",
5690
5672
  changeSetDescription.ChangeSetId
5691
5673
  )));
@@ -5713,7 +5695,7 @@ var FullCloudFormationDeployment = class {
5713
5695
  async createChangeSet(changeSetName, willExecute, importExistingResources) {
5714
5696
  await this.cleanupOldChangeset(changeSetName);
5715
5697
  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))));
5698
+ await this.ioHost.notify(info2(this.action, (0, import_util25.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
5717
5699
  const changeSet = await this.cfn.createChangeSet({
5718
5700
  StackName: this.stackName,
5719
5701
  ChangeSetName: changeSetName,
@@ -5724,13 +5706,13 @@ var FullCloudFormationDeployment = class {
5724
5706
  ImportExistingResources: importExistingResources,
5725
5707
  ...this.commonPrepareOptions()
5726
5708
  });
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)));
5709
+ await this.ioHost.notify(debug2(this.action, (0, import_util25.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
5728
5710
  return waitForChangeSet(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName, changeSetName, {
5729
5711
  fetchAll: willExecute
5730
5712
  });
5731
5713
  }
5732
5714
  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)));
5715
+ await this.ioHost.notify(debug2(this.action, (0, import_util25.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
5734
5716
  await this.cfn.executeChangeSet({
5735
5717
  StackName: this.stackName,
5736
5718
  ChangeSetName: changeSet.ChangeSetName,
@@ -5739,7 +5721,7 @@ var FullCloudFormationDeployment = class {
5739
5721
  });
5740
5722
  await this.ioHost.notify(debug2(
5741
5723
  this.action,
5742
- (0, import_util13.format)(
5724
+ (0, import_util25.format)(
5743
5725
  "Execution of changeset %s on stack %s has started; waiting for the update to complete...",
5744
5726
  changeSet.ChangeSetId,
5745
5727
  this.stackName
@@ -5762,7 +5744,7 @@ var FullCloudFormationDeployment = class {
5762
5744
  if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
5763
5745
  await this.ioHost.notify(debug2(
5764
5746
  this.action,
5765
- (0, import_util13.format)(
5747
+ (0, import_util25.format)(
5766
5748
  "Updating termination protection from %s to %s for stack %s",
5767
5749
  this.cloudFormationStack.terminationProtection,
5768
5750
  terminationProtection,
@@ -5773,11 +5755,11 @@ var FullCloudFormationDeployment = class {
5773
5755
  StackName: this.stackName,
5774
5756
  EnableTerminationProtection: terminationProtection
5775
5757
  });
5776
- await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
5758
+ await this.ioHost.notify(debug2(this.action, (0, import_util25.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
5777
5759
  }
5778
5760
  }
5779
5761
  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")));
5762
+ await this.ioHost.notify(info2(this.action, (0, import_util25.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
5781
5763
  const startTime = /* @__PURE__ */ new Date();
5782
5764
  if (this.update) {
5783
5765
  await this.updateTerminationProtection();
@@ -5790,7 +5772,7 @@ var FullCloudFormationDeployment = class {
5790
5772
  });
5791
5773
  } catch (err) {
5792
5774
  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)));
5775
+ await this.ioHost.notify(debug2(this.action, (0, import_util25.format)("No updates are to be performed for stack %s", this.stackName)));
5794
5776
  return {
5795
5777
  type: "did-deploy-stack",
5796
5778
  noOp: true,
@@ -5836,7 +5818,7 @@ var FullCloudFormationDeployment = class {
5836
5818
  } finally {
5837
5819
  await monitor.stop();
5838
5820
  }
5839
- debug2(this.action, (0, import_util13.format)("Stack %s has completed updating", this.stackName));
5821
+ debug2(this.action, (0, import_util25.format)("Stack %s has completed updating", this.stackName));
5840
5822
  return {
5841
5823
  type: "did-deploy-stack",
5842
5824
  noOp: false,
@@ -5973,34 +5955,54 @@ function hasReplacement(cs) {
5973
5955
 
5974
5956
  // ../../aws-cdk/lib/notices.ts
5975
5957
  var https = __toESM(require("node:https"));
5976
- var path9 = __toESM(require("path"));
5977
- var fs10 = __toESM(require("fs-extra"));
5958
+ var path10 = __toESM(require("path"));
5959
+ var fs11 = __toESM(require("fs-extra"));
5978
5960
  var semver4 = __toESM(require("semver"));
5979
5961
 
5980
5962
  // ../../aws-cdk/lib/cli/version.ts
5981
- var path7 = __toESM(require("path"));
5963
+ var path8 = __toESM(require("path"));
5982
5964
  var chalk10 = __toESM(require("chalk"));
5983
- var fs8 = __toESM(require("fs-extra"));
5965
+ var fs9 = __toESM(require("fs-extra"));
5984
5966
  var semver3 = __toESM(require("semver"));
5985
5967
 
5968
+ // ../../aws-cdk/lib/cli/root-dir.ts
5969
+ var fs8 = __toESM(require("fs"));
5970
+ var path7 = __toESM(require("path"));
5971
+ function cliRootDir(fail) {
5972
+ function _rootDir(dirname6) {
5973
+ const manifestPath = path7.join(dirname6, "package.json");
5974
+ if (fs8.existsSync(manifestPath)) {
5975
+ return dirname6;
5976
+ }
5977
+ if (path7.dirname(dirname6) === dirname6) {
5978
+ if (fail ?? true) {
5979
+ throw new ToolkitError("Unable to find package manifest");
5980
+ }
5981
+ return void 0;
5982
+ }
5983
+ return _rootDir(path7.dirname(dirname6));
5984
+ }
5985
+ return _rootDir(__dirname);
5986
+ }
5987
+
5986
5988
  // ../../aws-cdk/lib/cli/util/console-formatters.ts
5987
5989
  var stripAnsi = require("strip-ansi");
5988
5990
 
5989
5991
  // ../../aws-cdk/lib/cli/util/npm.ts
5990
5992
  var import_child_process = require("child_process");
5991
- var import_util14 = require("util");
5993
+ var import_util27 = require("util");
5992
5994
  var semver2 = __toESM(require("semver"));
5993
- var exec = (0, import_util14.promisify)(import_child_process.exec);
5995
+ var exec = (0, import_util27.promisify)(import_child_process.exec);
5994
5996
 
5995
5997
  // ../../aws-cdk/lib/cli/version.ts
5996
5998
  var ONE_DAY_IN_SECONDS = 1 * 24 * 60 * 60;
5997
5999
  function versionNumber() {
5998
- return require(path7.join(rootDir(), "package.json")).version.replace(/\+[0-9a-f]+$/, "");
6000
+ return require(path8.join(cliRootDir(), "package.json")).version.replace(/\+[0-9a-f]+$/, "");
5999
6001
  }
6000
6002
 
6001
6003
  // ../../aws-cdk/lib/tree.ts
6002
- var path8 = __toESM(require("path"));
6003
- var fs9 = __toESM(require("fs-extra"));
6004
+ var path9 = __toESM(require("path"));
6005
+ var fs10 = __toESM(require("fs-extra"));
6004
6006
  function some(node, predicate) {
6005
6007
  return node != null && (predicate(node) || findInChildren());
6006
6008
  function findInChildren() {
@@ -6011,7 +6013,7 @@ function loadTree(assembly) {
6011
6013
  try {
6012
6014
  const outdir = assembly.directory;
6013
6015
  const fileName = assembly.tree()?.file;
6014
- return fileName ? fs9.readJSONSync(path8.join(outdir, fileName)).tree : {};
6016
+ return fileName ? fs10.readJSONSync(path9.join(outdir, fileName)).tree : {};
6015
6017
  } catch (e) {
6016
6018
  trace(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
6017
6019
  return void 0;
@@ -6019,7 +6021,7 @@ function loadTree(assembly) {
6019
6021
  }
6020
6022
  function loadTreeFromDir(outdir) {
6021
6023
  try {
6022
- return fs9.readJSONSync(path8.join(outdir, "tree.json")).tree;
6024
+ return fs10.readJSONSync(path9.join(outdir, "tree.json")).tree;
6023
6025
  } catch (e) {
6024
6026
  trace(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
6025
6027
  return void 0;
@@ -6027,7 +6029,7 @@ function loadTreeFromDir(outdir) {
6027
6029
  }
6028
6030
 
6029
6031
  // ../../aws-cdk/lib/notices.ts
6030
- var CACHE_FILE_PATH = path9.join(cdkCacheDir(), "notices.json");
6032
+ var CACHE_FILE_PATH = path10.join(cdkCacheDir(), "notices.json");
6031
6033
  var NoticesFilter = class _NoticesFilter {
6032
6034
  static filter(options) {
6033
6035
  const components = [
@@ -6384,7 +6386,7 @@ var CachedDataSource = class {
6384
6386
  notices: []
6385
6387
  };
6386
6388
  try {
6387
- return fs10.existsSync(this.fileName) ? await fs10.readJSON(this.fileName) : defaultValue;
6389
+ return fs11.existsSync(this.fileName) ? await fs11.readJSON(this.fileName) : defaultValue;
6388
6390
  } catch (e) {
6389
6391
  debug(`Failed to load notices from cache: ${e}`);
6390
6392
  return defaultValue;
@@ -6392,7 +6394,7 @@ var CachedDataSource = class {
6392
6394
  }
6393
6395
  async save(cached2) {
6394
6396
  try {
6395
- await fs10.writeJSON(this.fileName, cached2);
6397
+ await fs11.writeJSON(this.fileName, cached2);
6396
6398
  } catch (e) {
6397
6399
  debug(`Failed to store notices in the cache: ${e}`);
6398
6400
  }
@@ -6400,7 +6402,7 @@ var CachedDataSource = class {
6400
6402
  };
6401
6403
 
6402
6404
  // ../../aws-cdk/lib/api/toolkit-info.ts
6403
- var import_util15 = require("util");
6405
+ var import_util30 = require("util");
6404
6406
  var chalk11 = __toESM(require("chalk"));
6405
6407
 
6406
6408
  // ../../aws-cdk/lib/api/bootstrap/bootstrap-props.ts
@@ -6408,6 +6410,7 @@ var BUCKET_NAME_OUTPUT = "BucketName";
6408
6410
  var REPOSITORY_NAME_OUTPUT = "ImageRepositoryName";
6409
6411
  var BUCKET_DOMAIN_NAME_OUTPUT = "BucketDomainName";
6410
6412
  var BOOTSTRAP_VERSION_OUTPUT = "BootstrapVersion";
6413
+ var BOOTSTRAP_VERSION_RESOURCE = "CdkBootstrapVersion";
6411
6414
  var BOOTSTRAP_VARIANT_PARAMETER = "BootstrapVariant";
6412
6415
  var DEFAULT_BOOTSTRAP_VARIANT = "AWS CDK: Default Resources";
6413
6416
 
@@ -6425,7 +6428,7 @@ var ToolkitInfo = class _ToolkitInfo {
6425
6428
  if (!stack) {
6426
6429
  await ioHost.notify(debug2(
6427
6430
  action,
6428
- (0, import_util15.format)(
6431
+ (0, import_util30.format)(
6429
6432
  "The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
6430
6433
  environment.name,
6431
6434
  stackName,
@@ -6437,7 +6440,7 @@ var ToolkitInfo = class _ToolkitInfo {
6437
6440
  if (stack.stackStatus.isCreationFailure) {
6438
6441
  await ioHost.notify(debug2(
6439
6442
  action,
6440
- (0, import_util15.format)(
6443
+ (0, import_util30.format)(
6441
6444
  "The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
6442
6445
  environment.name,
6443
6446
  stackName,
@@ -6688,6 +6691,19 @@ var EnvironmentResources = class {
6688
6691
  return { repositoryUri };
6689
6692
  }
6690
6693
  };
6694
+ var NoBootstrapStackEnvironmentResources = class extends EnvironmentResources {
6695
+ constructor(environment, sdk, msg) {
6696
+ super(environment, sdk, msg, emptyCache());
6697
+ }
6698
+ /**
6699
+ * Look up the toolkit for a given environment, using a given SDK
6700
+ */
6701
+ async lookupToolkit() {
6702
+ throw new ToolkitError(
6703
+ "Trying to perform an operation that requires a bootstrap stack; you should not see this error, this is a bug in the CDK CLI."
6704
+ );
6705
+ }
6706
+ };
6691
6707
  function emptyCache() {
6692
6708
  return {
6693
6709
  ssmParameters: /* @__PURE__ */ new Map(),
@@ -7101,9 +7117,7 @@ var Deployments = class {
7101
7117
  sdk: env.sdk,
7102
7118
  roleArn: executionRoleArn,
7103
7119
  stack: options.stack,
7104
- deployName: options.deployName,
7105
- quiet: options.quiet,
7106
- ci: options.ci
7120
+ deployName: options.deployName
7107
7121
  }, { ioHost: this.ioHost, action: this.action });
7108
7122
  }
7109
7123
  async stackExists(options) {
@@ -7138,7 +7152,7 @@ var Deployments = class {
7138
7152
  const publisher = this.cachedPublisher(assetManifest, resolvedEnvironment, options.stackName);
7139
7153
  await publisher.buildEntry(asset);
7140
7154
  if (publisher.hasFailures) {
7141
- throw new ToolkitError(`Failed to build asset ${asset.id}`);
7155
+ throw new ToolkitError(`Failed to build asset ${asset.displayName(false)}`);
7142
7156
  }
7143
7157
  }
7144
7158
  /**
@@ -7149,7 +7163,7 @@ var Deployments = class {
7149
7163
  const publisher = this.cachedPublisher(assetManifest, stackEnv, options.stackName);
7150
7164
  await publisher.publishEntry(asset, { allowCrossAccount: await this.allowCrossAccountAssetPublishingForEnv(options.stack) });
7151
7165
  if (publisher.hasFailures) {
7152
- throw new ToolkitError(`Failed to publish asset ${asset.id}`);
7166
+ throw new ToolkitError(`Failed to publish asset ${asset.displayName(true)}`);
7153
7167
  }
7154
7168
  }
7155
7169
  async allowCrossAccountAssetPublishingForEnv(stack) {
@@ -7224,10 +7238,10 @@ function tagsForStack(stack) {
7224
7238
  }
7225
7239
 
7226
7240
  // ../../aws-cdk/lib/api/resource-import/importer.ts
7227
- var import_util16 = require("util");
7241
+ var import_util34 = require("util");
7228
7242
  var cfnDiff = __toESM(require("@aws-cdk/cloudformation-diff"));
7229
7243
  var chalk13 = __toESM(require("chalk"));
7230
- var fs11 = __toESM(require("fs-extra"));
7244
+ var fs12 = __toESM(require("fs-extra"));
7231
7245
  var promptly3 = __toESM(require("promptly"));
7232
7246
  var ResourceImporter = class {
7233
7247
  constructor(stack, props) {
@@ -7256,18 +7270,18 @@ var ResourceImporter = class {
7256
7270
  * Load the resources to import from a file
7257
7271
  */
7258
7272
  async loadResourceIdentifiers(available, filename) {
7259
- const contents = await fs11.readJson(filename);
7273
+ const contents = await fs12.readJson(filename);
7260
7274
  const ret = { importResources: [], resourceMap: {} };
7261
7275
  for (const resource of available) {
7262
7276
  const descr = this.describeResource(resource.logicalId);
7263
7277
  const idProps = contents[resource.logicalId];
7264
7278
  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)))));
7279
+ await this.ioHost.notify(info2(this.action, (0, import_util34.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
7266
7280
  ret.importResources.push(resource);
7267
7281
  ret.resourceMap[resource.logicalId] = idProps;
7268
7282
  delete contents[resource.logicalId];
7269
7283
  } else {
7270
- await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: skipping", chalk13.blue(descr))));
7284
+ await this.ioHost.notify(info2(this.action, (0, import_util34.format)("%s: skipping", chalk13.blue(descr))));
7271
7285
  }
7272
7286
  }
7273
7287
  const unknown = Object.keys(contents);
@@ -7311,9 +7325,9 @@ var ResourceImporter = class {
7311
7325
  });
7312
7326
  assertIsSuccessfulDeployStackResult(result);
7313
7327
  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))));
7328
+ await this.ioHost.notify(info2(this.action, "\n" + chalk13.green((0, import_util34.format)(message, this.stack.displayName))));
7315
7329
  } 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"));
7330
+ await this.ioHost.notify(error2(this.action, (0, import_util34.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
7317
7331
  throw e;
7318
7332
  }
7319
7333
  }
@@ -7510,7 +7524,7 @@ function addDefaultDeletionPolicy(resource) {
7510
7524
 
7511
7525
  // ../../aws-cdk/lib/api/resource-import/migrator.ts
7512
7526
  var chalk14 = __toESM(require("chalk"));
7513
- var fs12 = __toESM(require("fs-extra"));
7527
+ var fs13 = __toESM(require("fs-extra"));
7514
7528
  var ResourceMigrator = class {
7515
7529
  constructor(props) {
7516
7530
  this.props = props;
@@ -7535,7 +7549,7 @@ var ResourceMigrator = class {
7535
7549
  await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
7536
7550
  await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: importing resources into stack...`));
7537
7551
  await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
7538
- fs12.rmSync("migrate.json");
7552
+ fs13.rmSync("migrate.json");
7539
7553
  await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
7540
7554
  }
7541
7555
  }
@@ -7560,7 +7574,7 @@ var ResourceMigrator = class {
7560
7574
  }
7561
7575
  async tryGetResources(environment) {
7562
7576
  try {
7563
- const migrateFile = fs12.readJsonSync("migrate.json", {
7577
+ const migrateFile = fs13.readJsonSync("migrate.json", {
7564
7578
  encoding: "utf-8"
7565
7579
  });
7566
7580
  const sourceEnv = migrateFile.Source.split(":");
@@ -8058,17 +8072,17 @@ var WorkGraph = class {
8058
8072
  }
8059
8073
  }
8060
8074
  return void 0;
8061
- function recurse(nodeId, path12) {
8075
+ function recurse(nodeId, path15) {
8062
8076
  if (seen.has(nodeId)) {
8063
8077
  return void 0;
8064
8078
  }
8065
8079
  try {
8066
8080
  for (const dep of self.nodes[nodeId].dependencies ?? []) {
8067
- const index = path12.indexOf(dep);
8081
+ const index = path15.indexOf(dep);
8068
8082
  if (index > -1) {
8069
- return [...path12.slice(index), dep];
8083
+ return [...path15.slice(index), dep];
8070
8084
  }
8071
- const cycle = recurse(dep, [...path12, dep]);
8085
+ const cycle = recurse(dep, [...path15, dep]);
8072
8086
  if (cycle) {
8073
8087
  return cycle;
8074
8088
  }
@@ -8170,7 +8184,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
8170
8184
  const node = {
8171
8185
  type: "asset-build",
8172
8186
  id: buildId,
8173
- note: assetId,
8187
+ note: asset.displayName(false),
8174
8188
  dependencies: /* @__PURE__ */ new Set([
8175
8189
  ...this.stackArtifactIds(assetManifestArtifact.dependencies),
8176
8190
  // If we disable prebuild, then assets inherit (stack) dependencies from their parent stack
@@ -8190,7 +8204,7 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
8190
8204
  this.graph.addNodes({
8191
8205
  type: "asset-publish",
8192
8206
  id: publishId,
8193
- note: `${asset.id}`,
8207
+ note: asset.displayName(true),
8194
8208
  dependencies: /* @__PURE__ */ new Set([
8195
8209
  buildId
8196
8210
  ]),
@@ -8274,6 +8288,476 @@ function onlyStacks(artifacts) {
8274
8288
  return artifacts.filter((x) => cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact(x));
8275
8289
  }
8276
8290
 
8291
+ // ../../aws-cdk/lib/api/bootstrap/bootstrap-environment.ts
8292
+ var import_console = require("console");
8293
+ var path12 = __toESM(require("path"));
8294
+
8295
+ // ../../aws-cdk/lib/api/bootstrap/deploy-bootstrap.ts
8296
+ var os4 = __toESM(require("os"));
8297
+ var path11 = __toESM(require("path"));
8298
+ var import_cloud_assembly_schema2 = require("@aws-cdk/cloud-assembly-schema");
8299
+ var import_cx_api6 = require("@aws-cdk/cx-api");
8300
+ var fs14 = __toESM(require("fs-extra"));
8301
+ var BootstrapStack = class _BootstrapStack {
8302
+ constructor(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, msg) {
8303
+ this.sdkProvider = sdkProvider;
8304
+ this.sdk = sdk;
8305
+ this.resolvedEnvironment = resolvedEnvironment;
8306
+ this.toolkitStackName = toolkitStackName;
8307
+ this.currentToolkitInfo = currentToolkitInfo;
8308
+ this.msg = msg;
8309
+ }
8310
+ static async lookup(sdkProvider, environment, toolkitStackName, msg) {
8311
+ toolkitStackName = toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
8312
+ const resolvedEnvironment = await sdkProvider.resolveEnvironment(environment);
8313
+ const sdk = (await sdkProvider.forEnvironment(resolvedEnvironment, 1 /* ForWriting */)).sdk;
8314
+ const currentToolkitInfo = await ToolkitInfo.lookup(resolvedEnvironment, sdk, msg, toolkitStackName);
8315
+ return new _BootstrapStack(sdkProvider, sdk, resolvedEnvironment, toolkitStackName, currentToolkitInfo, msg);
8316
+ }
8317
+ get parameters() {
8318
+ return this.currentToolkitInfo.found ? this.currentToolkitInfo.bootstrapStack.parameters : {};
8319
+ }
8320
+ get terminationProtection() {
8321
+ return this.currentToolkitInfo.found ? this.currentToolkitInfo.bootstrapStack.terminationProtection : void 0;
8322
+ }
8323
+ async partition() {
8324
+ return (await this.sdk.currentAccount()).partition;
8325
+ }
8326
+ /**
8327
+ * Perform the actual deployment of a bootstrap stack, given a template and some parameters
8328
+ */
8329
+ async update(template, parameters, options) {
8330
+ if (this.currentToolkitInfo.found && !options.force) {
8331
+ const abortResponse = {
8332
+ type: "did-deploy-stack",
8333
+ noOp: true,
8334
+ outputs: {},
8335
+ stackArn: this.currentToolkitInfo.bootstrapStack.stackId
8336
+ };
8337
+ const currentVariant = this.currentToolkitInfo.variant;
8338
+ const newVariant = bootstrapVariantFromTemplate(template);
8339
+ if (currentVariant !== newVariant) {
8340
+ await this.msg.ioHost.notify(warn(
8341
+ this.msg.action,
8342
+ `Bootstrap stack already exists, containing '${currentVariant}'. Not overwriting it with a template containing '${newVariant}' (use --force if you intend to overwrite)`
8343
+ ));
8344
+ return abortResponse;
8345
+ }
8346
+ const newVersion = bootstrapVersionFromTemplate(template);
8347
+ const currentVersion = this.currentToolkitInfo.version;
8348
+ if (newVersion < currentVersion) {
8349
+ await this.msg.ioHost.notify(warn(
8350
+ this.msg.action,
8351
+ `Bootstrap stack already at version ${currentVersion}. Not downgrading it to version ${newVersion} (use --force if you intend to downgrade)`
8352
+ ));
8353
+ if (newVersion === 0) {
8354
+ await this.msg.ioHost.notify(warn(
8355
+ this.msg.action,
8356
+ "(Did you set the '@aws-cdk/core:newStyleStackSynthesis' feature flag in cdk.json?)"
8357
+ ));
8358
+ }
8359
+ return abortResponse;
8360
+ }
8361
+ }
8362
+ const outdir = await fs14.mkdtemp(path11.join(os4.tmpdir(), "cdk-bootstrap"));
8363
+ const builder = new import_cx_api6.CloudAssemblyBuilder(outdir);
8364
+ const templateFile = `${this.toolkitStackName}.template.json`;
8365
+ await fs14.writeJson(path11.join(builder.outdir, templateFile), template, {
8366
+ spaces: 2
8367
+ });
8368
+ builder.addArtifact(this.toolkitStackName, {
8369
+ type: import_cloud_assembly_schema2.ArtifactType.AWS_CLOUDFORMATION_STACK,
8370
+ environment: import_cx_api6.EnvironmentUtils.format(this.resolvedEnvironment.account, this.resolvedEnvironment.region),
8371
+ properties: {
8372
+ templateFile,
8373
+ terminationProtection: options.terminationProtection ?? false
8374
+ }
8375
+ });
8376
+ const assembly = builder.buildAssembly();
8377
+ const ret = await deployStack({
8378
+ stack: assembly.getStackByName(this.toolkitStackName),
8379
+ resolvedEnvironment: this.resolvedEnvironment,
8380
+ sdk: this.sdk,
8381
+ sdkProvider: this.sdkProvider,
8382
+ force: options.force,
8383
+ roleArn: options.roleArn,
8384
+ tags: options.tags,
8385
+ deploymentMethod: { method: "change-set", execute: options.execute },
8386
+ parameters,
8387
+ usePreviousParameters: options.usePreviousParameters ?? true,
8388
+ // Obviously we can't need a bootstrap stack to deploy a bootstrap stack
8389
+ envResources: new NoBootstrapStackEnvironmentResources(this.resolvedEnvironment, this.sdk, this.msg)
8390
+ }, this.msg);
8391
+ assertIsSuccessfulDeployStackResult(ret);
8392
+ return ret;
8393
+ }
8394
+ };
8395
+ function bootstrapVersionFromTemplate(template) {
8396
+ const versionSources = [
8397
+ template.Outputs?.[BOOTSTRAP_VERSION_OUTPUT]?.Value,
8398
+ template.Resources?.[BOOTSTRAP_VERSION_RESOURCE]?.Properties?.Value
8399
+ ];
8400
+ for (const vs of versionSources) {
8401
+ if (typeof vs === "number") {
8402
+ return vs;
8403
+ }
8404
+ if (typeof vs === "string" && !isNaN(parseInt(vs, 10))) {
8405
+ return parseInt(vs, 10);
8406
+ }
8407
+ }
8408
+ return 0;
8409
+ }
8410
+ function bootstrapVariantFromTemplate(template) {
8411
+ return template.Parameters?.[BOOTSTRAP_VARIANT_PARAMETER]?.Default ?? DEFAULT_BOOTSTRAP_VARIANT;
8412
+ }
8413
+
8414
+ // ../../aws-cdk/lib/api/bootstrap/legacy-template.ts
8415
+ function legacyBootstrapTemplate(params) {
8416
+ return {
8417
+ Description: "The CDK Toolkit Stack. It was created by `cdk bootstrap` and manages resources necessary for managing your Cloud Applications with AWS CDK.",
8418
+ Conditions: {
8419
+ UsePublicAccessBlockConfiguration: {
8420
+ "Fn::Equals": [
8421
+ params.publicAccessBlockConfiguration || params.publicAccessBlockConfiguration === void 0 ? "true" : "false",
8422
+ "true"
8423
+ ]
8424
+ }
8425
+ },
8426
+ Resources: {
8427
+ StagingBucket: {
8428
+ Type: "AWS::S3::Bucket",
8429
+ Properties: {
8430
+ BucketName: params.bucketName,
8431
+ AccessControl: "Private",
8432
+ BucketEncryption: {
8433
+ ServerSideEncryptionConfiguration: [{
8434
+ ServerSideEncryptionByDefault: {
8435
+ SSEAlgorithm: "aws:kms",
8436
+ KMSMasterKeyID: params.kmsKeyId
8437
+ }
8438
+ }]
8439
+ },
8440
+ PublicAccessBlockConfiguration: {
8441
+ "Fn::If": [
8442
+ "UsePublicAccessBlockConfiguration",
8443
+ {
8444
+ BlockPublicAcls: true,
8445
+ BlockPublicPolicy: true,
8446
+ IgnorePublicAcls: true,
8447
+ RestrictPublicBuckets: true
8448
+ },
8449
+ { Ref: "AWS::NoValue" }
8450
+ ]
8451
+ }
8452
+ }
8453
+ },
8454
+ StagingBucketPolicy: {
8455
+ Type: "AWS::S3::BucketPolicy",
8456
+ Properties: {
8457
+ Bucket: { Ref: "StagingBucket" },
8458
+ PolicyDocument: {
8459
+ Id: "AccessControl",
8460
+ Version: "2012-10-17",
8461
+ Statement: [
8462
+ {
8463
+ Sid: "AllowSSLRequestsOnly",
8464
+ Action: "s3:*",
8465
+ Effect: "Deny",
8466
+ Resource: [
8467
+ { "Fn::Sub": "${StagingBucket.Arn}" },
8468
+ { "Fn::Sub": "${StagingBucket.Arn}/*" }
8469
+ ],
8470
+ Condition: {
8471
+ Bool: { "aws:SecureTransport": "false" }
8472
+ },
8473
+ Principal: "*"
8474
+ }
8475
+ ]
8476
+ }
8477
+ }
8478
+ }
8479
+ },
8480
+ Outputs: {
8481
+ [BUCKET_NAME_OUTPUT]: {
8482
+ Description: "The name of the S3 bucket owned by the CDK toolkit stack",
8483
+ Value: { Ref: "StagingBucket" }
8484
+ },
8485
+ [BUCKET_DOMAIN_NAME_OUTPUT]: {
8486
+ Description: "The domain name of the S3 bucket owned by the CDK toolkit stack",
8487
+ Value: { "Fn::GetAtt": ["StagingBucket", "RegionalDomainName"] }
8488
+ }
8489
+ }
8490
+ };
8491
+ }
8492
+
8493
+ // ../../aws-cdk/lib/api/bootstrap/bootstrap-environment.ts
8494
+ var Bootstrapper = class {
8495
+ constructor(source = { source: "default" }, msg) {
8496
+ this.source = source;
8497
+ this.msg = msg;
8498
+ }
8499
+ bootstrapEnvironment(environment, sdkProvider, options = {}) {
8500
+ switch (this.source.source) {
8501
+ case "legacy":
8502
+ return this.legacyBootstrap(environment, sdkProvider, options);
8503
+ case "default":
8504
+ return this.modernBootstrap(environment, sdkProvider, options);
8505
+ case "custom":
8506
+ return this.customBootstrap(environment, sdkProvider, options);
8507
+ }
8508
+ }
8509
+ async showTemplate(json) {
8510
+ const template = await this.loadTemplate();
8511
+ process.stdout.write(`${serializeStructure(template, json)}
8512
+ `);
8513
+ }
8514
+ /**
8515
+ * Deploy legacy bootstrap stack
8516
+ *
8517
+ */
8518
+ async legacyBootstrap(environment, sdkProvider, options = {}) {
8519
+ const params = options.parameters ?? {};
8520
+ if (params.trustedAccounts?.length) {
8521
+ throw new ToolkitError("--trust can only be passed for the modern bootstrap experience.");
8522
+ }
8523
+ if (params.cloudFormationExecutionPolicies?.length) {
8524
+ throw new ToolkitError("--cloudformation-execution-policies can only be passed for the modern bootstrap experience.");
8525
+ }
8526
+ if (params.createCustomerMasterKey !== void 0) {
8527
+ throw new ToolkitError("--bootstrap-customer-key can only be passed for the modern bootstrap experience.");
8528
+ }
8529
+ if (params.qualifier) {
8530
+ throw new ToolkitError("--qualifier can only be passed for the modern bootstrap experience.");
8531
+ }
8532
+ const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
8533
+ const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.msg);
8534
+ return current.update(
8535
+ await this.loadTemplate(params),
8536
+ {},
8537
+ {
8538
+ ...options,
8539
+ terminationProtection: options.terminationProtection ?? current.terminationProtection
8540
+ }
8541
+ );
8542
+ }
8543
+ /**
8544
+ * Deploy CI/CD-ready bootstrap stack from template
8545
+ *
8546
+ */
8547
+ async modernBootstrap(environment, sdkProvider, options = {}) {
8548
+ const params = options.parameters ?? {};
8549
+ const bootstrapTemplate = await this.loadTemplate();
8550
+ const toolkitStackName = options.toolkitStackName ?? DEFAULT_TOOLKIT_STACK_NAME;
8551
+ const current = await BootstrapStack.lookup(sdkProvider, environment, toolkitStackName, this.msg);
8552
+ const partition = await current.partition();
8553
+ if (params.createCustomerMasterKey !== void 0 && params.kmsKeyId) {
8554
+ throw new ToolkitError(
8555
+ "You cannot pass '--bootstrap-kms-key-id' and '--bootstrap-customer-key' together. Specify one or the other"
8556
+ );
8557
+ }
8558
+ const allTrusted = /* @__PURE__ */ new Set([
8559
+ ...params.trustedAccounts ?? [],
8560
+ ...params.trustedAccountsForLookup ?? []
8561
+ ]);
8562
+ const invalid = intersection(allTrusted, new Set(params.untrustedAccounts));
8563
+ if (invalid.size > 0) {
8564
+ throw new ToolkitError(`Accounts cannot be both trusted and untrusted. Found: ${[...invalid].join(",")}`);
8565
+ }
8566
+ const removeUntrusted = (accounts) => accounts.filter((acc) => !params.untrustedAccounts?.map(String).includes(String(acc)));
8567
+ const trustedAccounts = removeUntrusted(params.trustedAccounts ?? splitCfnArray(current.parameters.TrustedAccounts));
8568
+ (0, import_console.info)(`Trusted accounts for deployment: ${trustedAccounts.length > 0 ? trustedAccounts.join(", ") : "(none)"}`);
8569
+ const trustedAccountsForLookup = removeUntrusted(
8570
+ params.trustedAccountsForLookup ?? splitCfnArray(current.parameters.TrustedAccountsForLookup)
8571
+ );
8572
+ (0, import_console.info)(
8573
+ `Trusted accounts for lookup: ${trustedAccountsForLookup.length > 0 ? trustedAccountsForLookup.join(", ") : "(none)"}`
8574
+ );
8575
+ const cloudFormationExecutionPolicies = params.cloudFormationExecutionPolicies ?? splitCfnArray(current.parameters.CloudFormationExecutionPolicies);
8576
+ if (trustedAccounts.length === 0 && cloudFormationExecutionPolicies.length === 0) {
8577
+ const implicitPolicy = `arn:${partition}:iam::aws:policy/AdministratorAccess`;
8578
+ await this.msg.ioHost.notify(warn(
8579
+ this.msg.action,
8580
+ `Using default execution policy of '${implicitPolicy}'. Pass '--cloudformation-execution-policies' to customize.`
8581
+ ));
8582
+ } else if (cloudFormationExecutionPolicies.length === 0) {
8583
+ throw new ToolkitError(
8584
+ `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>'.`
8585
+ );
8586
+ } else {
8587
+ (0, import_console.info)(`Execution policies: ${cloudFormationExecutionPolicies.join(", ")}`);
8588
+ }
8589
+ const currentKmsKeyId = current.parameters.FileAssetsBucketKmsKeyId;
8590
+ const kmsKeyId = params.kmsKeyId ?? (params.createCustomerMasterKey === true ? CREATE_NEW_KEY : params.createCustomerMasterKey === false || currentKmsKeyId === void 0 ? USE_AWS_MANAGED_KEY : void 0);
8591
+ const currentPermissionsBoundary = current.parameters.InputPermissionsBoundary || void 0;
8592
+ const inputPolicyName = params.examplePermissionsBoundary ? CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY : params.customPermissionsBoundary;
8593
+ let policyName;
8594
+ if (inputPolicyName) {
8595
+ const sdk = (await sdkProvider.forEnvironment(environment, 1 /* ForWriting */)).sdk;
8596
+ policyName = await this.getPolicyName(environment, sdk, inputPolicyName, partition, params);
8597
+ }
8598
+ if (currentPermissionsBoundary !== policyName) {
8599
+ if (!currentPermissionsBoundary) {
8600
+ await this.msg.ioHost.notify(warn(
8601
+ this.msg.action,
8602
+ `Adding new permissions boundary ${policyName}`
8603
+ ));
8604
+ } else if (!policyName) {
8605
+ await this.msg.ioHost.notify(warn(
8606
+ this.msg.action,
8607
+ `Removing existing permissions boundary ${currentPermissionsBoundary}`
8608
+ ));
8609
+ } else {
8610
+ await this.msg.ioHost.notify(warn(
8611
+ this.msg.action,
8612
+ `Changing permissions boundary from ${currentPermissionsBoundary} to ${policyName}`
8613
+ ));
8614
+ }
8615
+ }
8616
+ return current.update(
8617
+ bootstrapTemplate,
8618
+ {
8619
+ FileAssetsBucketName: params.bucketName,
8620
+ FileAssetsBucketKmsKeyId: kmsKeyId,
8621
+ // Empty array becomes empty string
8622
+ TrustedAccounts: trustedAccounts.join(","),
8623
+ TrustedAccountsForLookup: trustedAccountsForLookup.join(","),
8624
+ CloudFormationExecutionPolicies: cloudFormationExecutionPolicies.join(","),
8625
+ Qualifier: params.qualifier,
8626
+ PublicAccessBlockConfiguration: params.publicAccessBlockConfiguration || params.publicAccessBlockConfiguration === void 0 ? "true" : "false",
8627
+ InputPermissionsBoundary: policyName
8628
+ },
8629
+ {
8630
+ ...options,
8631
+ terminationProtection: options.terminationProtection ?? current.terminationProtection
8632
+ }
8633
+ );
8634
+ }
8635
+ async getPolicyName(environment, sdk, permissionsBoundary, partition, params) {
8636
+ if (permissionsBoundary !== CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY) {
8637
+ this.validatePolicyName(permissionsBoundary);
8638
+ return Promise.resolve(permissionsBoundary);
8639
+ }
8640
+ const arn = await this.getExamplePermissionsBoundary(
8641
+ params.qualifier ?? "hnb659fds",
8642
+ partition,
8643
+ environment.account,
8644
+ sdk
8645
+ );
8646
+ const policyName = arn.split("/").pop();
8647
+ if (!policyName) {
8648
+ throw new ToolkitError("Could not retrieve the example permission boundary!");
8649
+ }
8650
+ return Promise.resolve(policyName);
8651
+ }
8652
+ async getExamplePermissionsBoundary(qualifier, partition, account, sdk) {
8653
+ const iam = sdk.iam();
8654
+ let policyName = `cdk-${qualifier}-permissions-boundary`;
8655
+ const arn = `arn:${partition}:iam::${account}:policy/${policyName}`;
8656
+ try {
8657
+ let getPolicyResp = await iam.getPolicy({ PolicyArn: arn });
8658
+ if (getPolicyResp.Policy) {
8659
+ return arn;
8660
+ }
8661
+ } catch (e) {
8662
+ if (e.name === "NoSuchEntity") {
8663
+ } else {
8664
+ throw e;
8665
+ }
8666
+ }
8667
+ const policyDoc = {
8668
+ Version: "2012-10-17",
8669
+ Statement: [
8670
+ {
8671
+ Action: ["*"],
8672
+ Resource: "*",
8673
+ Effect: "Allow",
8674
+ Sid: "ExplicitAllowAll"
8675
+ },
8676
+ {
8677
+ Condition: {
8678
+ StringEquals: {
8679
+ "iam:PermissionsBoundary": `arn:${partition}:iam::${account}:policy/cdk-${qualifier}-permissions-boundary`
8680
+ }
8681
+ },
8682
+ Action: [
8683
+ "iam:CreateUser",
8684
+ "iam:CreateRole",
8685
+ "iam:PutRolePermissionsBoundary",
8686
+ "iam:PutUserPermissionsBoundary"
8687
+ ],
8688
+ Resource: "*",
8689
+ Effect: "Allow",
8690
+ Sid: "DenyAccessIfRequiredPermBoundaryIsNotBeingApplied"
8691
+ },
8692
+ {
8693
+ Action: [
8694
+ "iam:CreatePolicyVersion",
8695
+ "iam:DeletePolicy",
8696
+ "iam:DeletePolicyVersion",
8697
+ "iam:SetDefaultPolicyVersion"
8698
+ ],
8699
+ Resource: `arn:${partition}:iam::${account}:policy/cdk-${qualifier}-permissions-boundary`,
8700
+ Effect: "Deny",
8701
+ Sid: "DenyPermBoundaryIAMPolicyAlteration"
8702
+ },
8703
+ {
8704
+ Action: ["iam:DeleteUserPermissionsBoundary", "iam:DeleteRolePermissionsBoundary"],
8705
+ Resource: "*",
8706
+ Effect: "Deny",
8707
+ Sid: "DenyRemovalOfPermBoundaryFromAnyUserOrRole"
8708
+ }
8709
+ ]
8710
+ };
8711
+ const request = {
8712
+ PolicyName: policyName,
8713
+ PolicyDocument: JSON.stringify(policyDoc)
8714
+ };
8715
+ const createPolicyResponse = await iam.createPolicy(request);
8716
+ if (createPolicyResponse.Policy?.Arn) {
8717
+ return createPolicyResponse.Policy.Arn;
8718
+ } else {
8719
+ throw new ToolkitError(`Could not retrieve the example permission boundary ${arn}!`);
8720
+ }
8721
+ }
8722
+ validatePolicyName(permissionsBoundary) {
8723
+ const regexp = /[\w+\/=,.@-]+/;
8724
+ const matches = regexp.exec(permissionsBoundary);
8725
+ if (!(matches && matches.length === 1 && matches[0] === permissionsBoundary)) {
8726
+ throw new ToolkitError(`The permissions boundary name ${permissionsBoundary} does not match the IAM conventions.`);
8727
+ }
8728
+ }
8729
+ async customBootstrap(environment, sdkProvider, options = {}) {
8730
+ const version = bootstrapVersionFromTemplate(await this.loadTemplate());
8731
+ if (version === 0) {
8732
+ return this.legacyBootstrap(environment, sdkProvider, options);
8733
+ } else {
8734
+ return this.modernBootstrap(environment, sdkProvider, options);
8735
+ }
8736
+ }
8737
+ async loadTemplate(params = {}) {
8738
+ switch (this.source.source) {
8739
+ case "custom":
8740
+ return loadStructuredFile(this.source.templateFile);
8741
+ case "default":
8742
+ return loadStructuredFile(path12.join(bundledPackageRootDir(__dirname), "lib", "api", "bootstrap", "bootstrap-template.yaml"));
8743
+ case "legacy":
8744
+ return legacyBootstrapTemplate(params);
8745
+ }
8746
+ }
8747
+ };
8748
+ var USE_AWS_MANAGED_KEY = "AWS_MANAGED_KEY";
8749
+ var CREATE_NEW_KEY = "";
8750
+ var CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY = "CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY";
8751
+ function splitCfnArray(xs) {
8752
+ if (xs === "" || xs === void 0) {
8753
+ return [];
8754
+ }
8755
+ return xs.split(",");
8756
+ }
8757
+ function intersection(xs, ys) {
8758
+ return new Set(Array.from(xs).filter((x) => ys.has(x)));
8759
+ }
8760
+
8277
8761
  // ../../aws-cdk/lib/context-providers/index.ts
8278
8762
  var context_providers_exports = {};
8279
8763
  __export(context_providers_exports, {
@@ -8339,27 +8823,6 @@ var AZContextProviderPlugin = class {
8339
8823
  }
8340
8824
  };
8341
8825
 
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
8826
  // ../../aws-cdk/lib/context-providers/cc-api-provider.ts
8364
8827
  var CcApiContextProviderPlugin = class {
8365
8828
  constructor(aws) {
@@ -8592,7 +9055,7 @@ var KeyContextProviderPlugin = class {
8592
9055
  };
8593
9056
 
8594
9057
  // ../../aws-cdk/lib/context-providers/load-balancers.ts
8595
- var import_cx_api6 = require("@aws-cdk/cx-api");
9058
+ var import_cx_api7 = require("@aws-cdk/cx-api");
8596
9059
  var LoadBalancerContextProviderPlugin = class {
8597
9060
  constructor(aws) {
8598
9061
  this.aws = aws;
@@ -8602,7 +9065,7 @@ var LoadBalancerContextProviderPlugin = class {
8602
9065
  throw new ContextProviderError("The load balancer lookup query must specify either `loadBalancerArn` or `loadBalancerTags`");
8603
9066
  }
8604
9067
  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;
9068
+ const ipAddressType = loadBalancer.IpAddressType === "ipv4" ? import_cx_api7.LoadBalancerIpAddressType.IPV4 : import_cx_api7.LoadBalancerIpAddressType.DUAL_STACK;
8606
9069
  return {
8607
9070
  loadBalancerArn: loadBalancer.LoadBalancerArn,
8608
9071
  loadBalancerCanonicalHostedZoneId: loadBalancer.CanonicalHostedZoneId,
@@ -8849,7 +9312,7 @@ var SSMContextProviderPlugin = class {
8849
9312
  };
8850
9313
 
8851
9314
  // ../../aws-cdk/lib/context-providers/vpcs.ts
8852
- var import_cx_api7 = require("@aws-cdk/cx-api");
9315
+ var import_cx_api8 = require("@aws-cdk/cx-api");
8853
9316
  var VpcNetworkContextProviderPlugin = class {
8854
9317
  constructor(aws) {
8855
9318
  this.aws = aws;
@@ -9086,11 +9549,11 @@ function groupAsymmetricSubnets(subnets) {
9086
9549
  function subnetTypeToVpcSubnetType(type) {
9087
9550
  switch (type) {
9088
9551
  case "Isolated" /* Isolated */:
9089
- return import_cx_api7.VpcSubnetGroupType.ISOLATED;
9552
+ return import_cx_api8.VpcSubnetGroupType.ISOLATED;
9090
9553
  case "Private" /* Private */:
9091
- return import_cx_api7.VpcSubnetGroupType.PRIVATE;
9554
+ return import_cx_api8.VpcSubnetGroupType.PRIVATE;
9092
9555
  case "Public" /* Public */:
9093
- return import_cx_api7.VpcSubnetGroupType.PUBLIC;
9556
+ return import_cx_api8.VpcSubnetGroupType.PUBLIC;
9094
9557
  }
9095
9558
  }
9096
9559
  function isValidSubnetType(val) {
@@ -9184,13 +9647,13 @@ var availableContextProviders = {
9184
9647
 
9185
9648
  // ../../aws-cdk/lib/api/util/rwlock.ts
9186
9649
  var import_fs = require("fs");
9187
- var path10 = __toESM(require("path"));
9650
+ var path13 = __toESM(require("path"));
9188
9651
  var RWLock = class {
9189
9652
  constructor(directory) {
9190
9653
  this.directory = directory;
9191
9654
  this.readCounter = 0;
9192
9655
  this.pidString = `${process.pid}`;
9193
- this.writerFile = path10.join(this.directory, "synth.lock");
9656
+ this.writerFile = path13.join(this.directory, "synth.lock");
9194
9657
  }
9195
9658
  /**
9196
9659
  * Acquire a writer lock.
@@ -9232,7 +9695,7 @@ var RWLock = class {
9232
9695
  * is incremented "atomically" from the point of view of this PID.).
9233
9696
  */
9234
9697
  readerFile() {
9235
- return path10.join(this.directory, `read.${this.pidString}.${++this.readCounter}.lock`);
9698
+ return path13.join(this.directory, `read.${this.pidString}.${++this.readCounter}.lock`);
9236
9699
  }
9237
9700
  /**
9238
9701
  * Do the actual acquiring of a read lock.
@@ -9289,7 +9752,7 @@ var RWLock = class {
9289
9752
  if (processExists(pid)) {
9290
9753
  ret.push(pid);
9291
9754
  } else {
9292
- await deleteFile(path10.join(this.directory, fname));
9755
+ await deleteFile(path13.join(this.directory, fname));
9293
9756
  }
9294
9757
  }
9295
9758
  }
@@ -9308,7 +9771,7 @@ async function readFileIfExists(filename) {
9308
9771
  }
9309
9772
  var tmpCounter = 0;
9310
9773
  async function writeFileAtomic(filename, contents) {
9311
- await import_fs.promises.mkdir(path10.dirname(filename), { recursive: true });
9774
+ await import_fs.promises.mkdir(path13.dirname(filename), { recursive: true });
9312
9775
  const tmpFile = `${filename}.${process.pid}_${++tmpCounter}`;
9313
9776
  await import_fs.promises.writeFile(tmpFile, contents, { encoding: "utf-8" });
9314
9777
  await import_fs.promises.rename(tmpFile, filename);
@@ -9333,7 +9796,7 @@ function processExists(pid) {
9333
9796
  }
9334
9797
 
9335
9798
  // ../../aws-cdk/lib/api/cxapp/cloud-assembly.ts
9336
- var import_cx_api8 = require("@aws-cdk/cx-api");
9799
+ var import_cx_api9 = require("@aws-cdk/cx-api");
9337
9800
  var chalk16 = __toESM(require("chalk"));
9338
9801
  var import_minimatch = require("minimatch");
9339
9802
  var semver5 = __toESM(require("semver"));
@@ -9496,15 +9959,15 @@ var StackCollection = class _StackCollection {
9496
9959
  for (const stack of this.stackArtifacts) {
9497
9960
  for (const message of stack.messages) {
9498
9961
  switch (message.level) {
9499
- case import_cx_api8.SynthesisMessageLevel.WARNING:
9962
+ case import_cx_api9.SynthesisMessageLevel.WARNING:
9500
9963
  warnings = true;
9501
9964
  await logger("warn", message);
9502
9965
  break;
9503
- case import_cx_api8.SynthesisMessageLevel.ERROR:
9966
+ case import_cx_api9.SynthesisMessageLevel.ERROR:
9504
9967
  errors = true;
9505
9968
  await logger("error", message);
9506
9969
  break;
9507
- case import_cx_api8.SynthesisMessageLevel.INFO:
9970
+ case import_cx_api9.SynthesisMessageLevel.INFO:
9508
9971
  await logger("info", message);
9509
9972
  break;
9510
9973
  }
@@ -9568,10 +10031,10 @@ function sanitizePatterns(patterns) {
9568
10031
  }
9569
10032
 
9570
10033
  // ../../aws-cdk/lib/api/cxapp/exec.ts
9571
- var path11 = __toESM(require("path"));
10034
+ var path14 = __toESM(require("path"));
9572
10035
  var cxschema4 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
9573
10036
  var cxapi5 = __toESM(require("@aws-cdk/cx-api"));
9574
- var fs14 = __toESM(require("fs-extra"));
10037
+ var fs16 = __toESM(require("fs-extra"));
9575
10038
  var semver6 = __toESM(require("semver"));
9576
10039
  async function prepareDefaultEnvironment(aws, logFn = debug) {
9577
10040
  const env = {};
@@ -9627,14 +10090,14 @@ async function guessExecutable(app) {
9627
10090
  if (commandLine.length === 1) {
9628
10091
  let fstat;
9629
10092
  try {
9630
- fstat = await fs14.stat(commandLine[0]);
10093
+ fstat = await fs16.stat(commandLine[0]);
9631
10094
  } catch {
9632
10095
  debug(`Not a file: '${commandLine[0]}'. Using '${commandLine}' as command-line`);
9633
10096
  return commandLine;
9634
10097
  }
9635
- const isExecutable = (fstat.mode & fs14.constants.X_OK) !== 0;
10098
+ const isExecutable = (fstat.mode & fs16.constants.X_OK) !== 0;
9636
10099
  const isWindows = process.platform === "win32";
9637
- const handler = EXTENSION_MAP.get(path11.extname(commandLine[0]));
10100
+ const handler = EXTENSION_MAP.get(path14.extname(commandLine[0]));
9638
10101
  if (handler && (!isExecutable || isWindows)) {
9639
10102
  return handler(commandLine[0]);
9640
10103
  }
@@ -9648,6 +10111,7 @@ function spaceAvailableForContext(env, limit) {
9648
10111
  }
9649
10112
  // Annotate the CommonJS export names for ESM import in node:
9650
10113
  0 && (module.exports = {
10114
+ Bootstrapper,
9651
10115
  CliIoHost,
9652
10116
  CloudAssembly,
9653
10117
  CloudWatchLogEventMonitor,
@@ -9667,21 +10131,15 @@ function spaceAvailableForContext(env, limit) {
9667
10131
  WorkGraphBuilder,
9668
10132
  contextproviders,
9669
10133
  findCloudWatchLogGroups,
9670
- formatErrorMessage,
9671
10134
  formatSdkLoggerContent,
9672
- formatTime,
9673
10135
  guessExecutable,
9674
10136
  loadTree,
9675
- obscureTemplate,
9676
10137
  prepareContext,
9677
10138
  prepareDefaultEnvironment,
9678
10139
  sanitizePatterns,
9679
- serializeStructure,
9680
10140
  some,
9681
10141
  spaceAvailableForContext,
9682
- splitBySize,
9683
10142
  tagsForStack,
9684
- validateSnsTopicArn,
9685
10143
  versionNumber
9686
10144
  });
9687
10145
  //# sourceMappingURL=aws-cdk.js.map