@aws-cdk/toolkit-lib 0.3.0 → 0.3.2

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.
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // lib/api/shared-public.ts
@@ -25,6 +35,7 @@ __export(shared_public_exports, {
25
35
  ExpandStackSelection: () => ExpandStackSelection,
26
36
  NonHotswappableReason: () => NonHotswappableReason,
27
37
  PermissionChangeType: () => PermissionChangeType,
38
+ PluginHost: () => PluginHost,
28
39
  StackSelectionStrategy: () => StackSelectionStrategy,
29
40
  ToolkitError: () => ToolkitError
30
41
  });
@@ -63,8 +74,8 @@ var ToolkitError = class _ToolkitError extends Error {
63
74
  /**
64
75
  * An AssemblyError with an original error as cause
65
76
  */
66
- static withCause(message, error) {
67
- return new _ToolkitError(message, "toolkit", error);
77
+ static withCause(message2, error2) {
78
+ return new _ToolkitError(message2, "toolkit", error2);
68
79
  }
69
80
  /**
70
81
  * The type of the error, defaults to "toolkit".
@@ -78,8 +89,8 @@ var ToolkitError = class _ToolkitError extends Error {
78
89
  * The specific original cause of the error, if available
79
90
  */
80
91
  cause;
81
- constructor(message, type = "toolkit", cause) {
82
- super(message);
92
+ constructor(message2, type = "toolkit", cause) {
93
+ super(message2);
83
94
  Object.setPrototypeOf(this, _ToolkitError.prototype);
84
95
  Object.defineProperty(this, TOOLKIT_ERROR_SYMBOL, { value: true });
85
96
  this.name = new.target.name;
@@ -93,8 +104,8 @@ var AuthenticationError = class _AuthenticationError extends ToolkitError {
93
104
  * Denotes the source of the error as user.
94
105
  */
95
106
  source = "user";
96
- constructor(message) {
97
- super(message, "authentication");
107
+ constructor(message2) {
108
+ super(message2, "authentication");
98
109
  Object.setPrototypeOf(this, _AuthenticationError.prototype);
99
110
  Object.defineProperty(this, AUTHENTICATION_ERROR_SYMBOL, { value: true });
100
111
  }
@@ -103,14 +114,14 @@ var AssemblyError = class _AssemblyError extends ToolkitError {
103
114
  /**
104
115
  * An AssemblyError with an original error as cause
105
116
  */
106
- static withCause(message, error) {
107
- return new _AssemblyError(message, void 0, error);
117
+ static withCause(message2, error2) {
118
+ return new _AssemblyError(message2, void 0, error2);
108
119
  }
109
120
  /**
110
121
  * An AssemblyError with a list of stacks as cause
111
122
  */
112
- static withStacks(message, stacks) {
113
- return new _AssemblyError(message, stacks);
123
+ static withStacks(message2, stacks) {
124
+ return new _AssemblyError(message2, stacks);
114
125
  }
115
126
  /**
116
127
  * Denotes the source of the error as user.
@@ -123,8 +134,8 @@ var AssemblyError = class _AssemblyError extends ToolkitError {
123
134
  * Absence indicates synthesis didn't fully complete.
124
135
  */
125
136
  stacks;
126
- constructor(message, stacks, cause) {
127
- super(message, "assembly", cause);
137
+ constructor(message2, stacks, cause) {
138
+ super(message2, "assembly", cause);
128
139
  Object.setPrototypeOf(this, _AssemblyError.prototype);
129
140
  Object.defineProperty(this, ASSEMBLY_ERROR_SYMBOL, { value: true });
130
141
  this.stacks = stacks;
@@ -148,6 +159,922 @@ var ExpandStackSelection = /* @__PURE__ */ ((ExpandStackSelection2) => {
148
159
  return ExpandStackSelection2;
149
160
  })(ExpandStackSelection || {});
150
161
 
162
+ // ../tmp-toolkit-helpers/src/api/plugin/plugin.ts
163
+ var import_util2 = require("util");
164
+
165
+ // ../tmp-toolkit-helpers/src/api/plugin/context-provider-plugin.ts
166
+ function isContextProviderPlugin(x) {
167
+ return typeof x === "object" && !!x && !!x.getValue;
168
+ }
169
+
170
+ // ../tmp-toolkit-helpers/src/api/io/private/span.ts
171
+ var util = __toESM(require("node:util"));
172
+ var uuid = __toESM(require("uuid"));
173
+
174
+ // ../tmp-toolkit-helpers/src/util/archive.ts
175
+ var glob = __toESM(require("glob"));
176
+ var archiver = require("archiver");
177
+
178
+ // ../tmp-toolkit-helpers/src/util/types.ts
179
+ var isArray = Array.isArray;
180
+
181
+ // ../tmp-toolkit-helpers/src/util/yaml-cfn.ts
182
+ var yaml = __toESM(require("yaml"));
183
+ var yaml_types = __toESM(require("yaml/types"));
184
+ function makeTagForCfnIntrinsic(intrinsicName, addFnPrefix) {
185
+ return {
186
+ identify(value) {
187
+ return typeof value === "string";
188
+ },
189
+ tag: `!${intrinsicName}`,
190
+ resolve: (_doc, cstNode) => {
191
+ const ret = {};
192
+ ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = // the +1 is to account for the ! the short form begins with
193
+ parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1));
194
+ return ret;
195
+ }
196
+ };
197
+ }
198
+ var shortForms = [
199
+ "Base64",
200
+ "Cidr",
201
+ "FindInMap",
202
+ "GetAZs",
203
+ "ImportValue",
204
+ "Join",
205
+ "Sub",
206
+ "Select",
207
+ "Split",
208
+ "Transform",
209
+ "And",
210
+ "Equals",
211
+ "If",
212
+ "Not",
213
+ "Or",
214
+ "GetAtt"
215
+ ].map((name) => makeTagForCfnIntrinsic(name, true)).concat(
216
+ makeTagForCfnIntrinsic("Ref", false),
217
+ makeTagForCfnIntrinsic("Condition", false)
218
+ );
219
+ function parseYamlStrWithCfnTags(text) {
220
+ return yaml.parse(text, {
221
+ customTags: shortForms,
222
+ schema: "core"
223
+ });
224
+ }
225
+
226
+ // ../tmp-toolkit-helpers/src/util/string-manipulation.ts
227
+ function formatTime(num) {
228
+ return roundPercentage(millisecondsToSeconds(num));
229
+ }
230
+ function roundPercentage(num) {
231
+ return Math.round(100 * num) / 100;
232
+ }
233
+ function millisecondsToSeconds(num) {
234
+ return num / 1e3;
235
+ }
236
+
237
+ // ../tmp-toolkit-helpers/src/util/version-range.ts
238
+ var semver = __toESM(require("semver"));
239
+
240
+ // ../tmp-toolkit-helpers/src/api/io/private/span.ts
241
+ var SpanMaker = class {
242
+ definition;
243
+ ioHelper;
244
+ constructor(ioHelper, definition) {
245
+ this.definition = definition;
246
+ this.ioHelper = ioHelper;
247
+ }
248
+ async begin(a, b) {
249
+ const spanId = uuid.v4();
250
+ const startTime = (/* @__PURE__ */ new Date()).getTime();
251
+ const notify = (msg) => {
252
+ return this.ioHelper.notify(withSpanId(spanId, msg));
253
+ };
254
+ const startInput = parseArgs(a, b);
255
+ const startMsg = startInput.message ?? `Starting ${this.definition.name} ...`;
256
+ const startPayload = startInput.payload;
257
+ await notify(this.definition.start.msg(
258
+ startMsg,
259
+ startPayload
260
+ ));
261
+ const timingMsgTemplate = "\n\u2728 %s time: %ds\n";
262
+ const time = () => {
263
+ const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - startTime;
264
+ return {
265
+ asMs: elapsedTime,
266
+ asSec: formatTime(elapsedTime)
267
+ };
268
+ };
269
+ return {
270
+ elapsedTime: async () => {
271
+ return time();
272
+ },
273
+ notify: async (msg) => {
274
+ await notify(msg);
275
+ },
276
+ timing: async (maker, message2) => {
277
+ const duration = time();
278
+ const timingMsg = message2 ? message2 : util.format(timingMsgTemplate, this.definition.name, duration.asSec);
279
+ await notify(maker.msg(timingMsg, {
280
+ duration: duration.asMs
281
+ }));
282
+ return duration;
283
+ },
284
+ end: async (x, y) => {
285
+ const duration = time();
286
+ const endInput = parseArgs(x, y);
287
+ const endMsg = endInput.message ?? util.format(timingMsgTemplate, this.definition.name, duration.asSec);
288
+ const endPayload = endInput.payload;
289
+ await notify(this.definition.end.msg(
290
+ endMsg,
291
+ {
292
+ duration: duration.asMs,
293
+ ...endPayload
294
+ }
295
+ ));
296
+ return duration;
297
+ }
298
+ };
299
+ }
300
+ };
301
+ function parseArgs(first, second) {
302
+ const firstIsMessage = typeof first === "string";
303
+ const message2 = firstIsMessage || second ? first : void 0;
304
+ const payload = firstIsMessage || second ? second : first;
305
+ return {
306
+ message: message2,
307
+ payload
308
+ };
309
+ }
310
+ function withSpanId(span, message2) {
311
+ return {
312
+ ...message2,
313
+ span
314
+ };
315
+ }
316
+
317
+ // ../tmp-toolkit-helpers/src/api/io/private/io-helper.ts
318
+ var IoHelper = class _IoHelper {
319
+ static fromIoHost(ioHost, action) {
320
+ return new _IoHelper(ioHost, action);
321
+ }
322
+ ioHost;
323
+ action;
324
+ constructor(ioHost, action) {
325
+ this.ioHost = ioHost;
326
+ this.action = action;
327
+ }
328
+ /**
329
+ * Forward a message to the IoHost, while injection the current action
330
+ */
331
+ notify(msg) {
332
+ return this.ioHost.notify({
333
+ ...msg,
334
+ action: this.action
335
+ });
336
+ }
337
+ /**
338
+ * Forward a request to the IoHost, while injection the current action
339
+ */
340
+ requestResponse(msg) {
341
+ return this.ioHost.requestResponse({
342
+ ...msg,
343
+ action: this.action
344
+ });
345
+ }
346
+ /**
347
+ * Create a new marker from a given registry entry
348
+ */
349
+ span(definition) {
350
+ return new SpanMaker(this, definition);
351
+ }
352
+ };
353
+
354
+ // ../tmp-toolkit-helpers/src/api/io/private/level-priority.ts
355
+ var levels = [
356
+ "trace",
357
+ "debug",
358
+ "info",
359
+ "warn",
360
+ "result",
361
+ "error"
362
+ ];
363
+ var orderedLevels = Object.fromEntries(Object.entries(levels).map((a) => a.reverse()));
364
+
365
+ // ../tmp-toolkit-helpers/src/api/io/private/message-maker.ts
366
+ function message(level, details) {
367
+ const maker = (text, data) => ({
368
+ time: /* @__PURE__ */ new Date(),
369
+ level,
370
+ code: details.code,
371
+ message: text,
372
+ data
373
+ });
374
+ return {
375
+ ...details,
376
+ level,
377
+ msg: maker,
378
+ is: (m) => m.code === details.code
379
+ };
380
+ }
381
+ var trace = (details) => message("trace", details);
382
+ var debug = (details) => message("debug", details);
383
+ var info = (details) => message("info", details);
384
+ var warn = (details) => message("warn", details);
385
+ var error = (details) => message("error", details);
386
+ var result = (details) => message("result", details);
387
+ function request(level, details) {
388
+ const maker = (text, data) => ({
389
+ time: /* @__PURE__ */ new Date(),
390
+ level,
391
+ code: details.code,
392
+ message: text,
393
+ data,
394
+ defaultResponse: details.defaultResponse
395
+ });
396
+ return {
397
+ ...details,
398
+ level,
399
+ req: maker
400
+ };
401
+ }
402
+ var confirm = (details) => request("info", {
403
+ ...details,
404
+ defaultResponse: true
405
+ });
406
+
407
+ // ../tmp-toolkit-helpers/src/api/io/private/messages.ts
408
+ var IO = {
409
+ // Defaults (0000)
410
+ DEFAULT_TOOLKIT_INFO: info({
411
+ code: "CDK_TOOLKIT_I0000",
412
+ description: "Default info messages emitted from the Toolkit"
413
+ }),
414
+ DEFAULT_TOOLKIT_DEBUG: debug({
415
+ code: "CDK_TOOLKIT_I0000",
416
+ description: "Default debug messages emitted from the Toolkit"
417
+ }),
418
+ DEFAULT_TOOLKIT_WARN: warn({
419
+ code: "CDK_TOOLKIT_W0000",
420
+ description: "Default warning messages emitted from the Toolkit"
421
+ }),
422
+ DEFAULT_TOOLKIT_ERROR: error({
423
+ code: "CDK_TOOLKIT_E0000",
424
+ description: "Default error messages emitted from the Toolkit"
425
+ }),
426
+ DEFAULT_TOOLKIT_TRACE: trace({
427
+ code: "CDK_TOOLKIT_I0000",
428
+ description: "Default trace messages emitted from the Toolkit"
429
+ }),
430
+ // warnings & errors
431
+ CDK_TOOLKIT_W0100: warn({
432
+ code: "CDK_TOOLKIT_W0100",
433
+ description: "Credential plugin warnings"
434
+ }),
435
+ // 1: Synth (1xxx)
436
+ CDK_TOOLKIT_I1000: info({
437
+ code: "CDK_TOOLKIT_I1000",
438
+ description: "Provides synthesis times.",
439
+ interface: "Duration"
440
+ }),
441
+ CDK_TOOLKIT_I1001: trace({
442
+ code: "CDK_TOOLKIT_I1001",
443
+ description: "Cloud Assembly synthesis is starting",
444
+ interface: "StackSelectionDetails"
445
+ }),
446
+ CDK_TOOLKIT_I1901: result({
447
+ code: "CDK_TOOLKIT_I1901",
448
+ description: "Provides stack data",
449
+ interface: "StackAndAssemblyData"
450
+ }),
451
+ CDK_TOOLKIT_I1902: result({
452
+ code: "CDK_TOOLKIT_I1902",
453
+ description: "Successfully deployed stacks",
454
+ interface: "AssemblyData"
455
+ }),
456
+ // 2: List (2xxx)
457
+ CDK_TOOLKIT_I2901: result({
458
+ code: "CDK_TOOLKIT_I2901",
459
+ description: "Provides details on the selected stacks and their dependencies",
460
+ interface: "StackDetailsPayload"
461
+ }),
462
+ // 3: Import & Migrate
463
+ CDK_TOOLKIT_E3900: error({
464
+ code: "CDK_TOOLKIT_E3900",
465
+ description: "Resource import failed",
466
+ interface: "ErrorPayload"
467
+ }),
468
+ // 4: Diff (4xxx)
469
+ CDK_TOOLKIT_I4000: trace({
470
+ code: "CDK_TOOLKIT_I4000",
471
+ description: "Diff stacks is starting",
472
+ interface: "StackSelectionDetails"
473
+ }),
474
+ CDK_TOOLKIT_I4001: info({
475
+ code: "CDK_TOOLKIT_I4001",
476
+ description: "Output of the diff command",
477
+ interface: "DiffResult"
478
+ }),
479
+ // 5: Deploy & Watch (5xxx)
480
+ CDK_TOOLKIT_I5000: info({
481
+ code: "CDK_TOOLKIT_I5000",
482
+ description: "Provides deployment times",
483
+ interface: "Duration"
484
+ }),
485
+ CDK_TOOLKIT_I5001: info({
486
+ code: "CDK_TOOLKIT_I5001",
487
+ description: "Provides total time in deploy action, including synth and rollback",
488
+ interface: "Duration"
489
+ }),
490
+ CDK_TOOLKIT_I5002: info({
491
+ code: "CDK_TOOLKIT_I5002",
492
+ description: "Provides time for resource migration",
493
+ interface: "Duration"
494
+ }),
495
+ CDK_TOOLKIT_W5021: warn({
496
+ code: "CDK_TOOLKIT_W5021",
497
+ description: "Empty non-existent stack, deployment is skipped"
498
+ }),
499
+ CDK_TOOLKIT_W5022: warn({
500
+ code: "CDK_TOOLKIT_W5022",
501
+ description: "Empty existing stack, stack will be destroyed"
502
+ }),
503
+ CDK_TOOLKIT_I5031: info({
504
+ code: "CDK_TOOLKIT_I5031",
505
+ description: "Informs about any log groups that are traced as part of the deployment"
506
+ }),
507
+ CDK_TOOLKIT_I5032: debug({
508
+ code: "CDK_TOOLKIT_I5032",
509
+ description: "Start monitoring log groups",
510
+ interface: "CloudWatchLogMonitorControlEvent"
511
+ }),
512
+ CDK_TOOLKIT_I5033: info({
513
+ code: "CDK_TOOLKIT_I5033",
514
+ description: "A log event received from Cloud Watch",
515
+ interface: "CloudWatchLogEvent"
516
+ }),
517
+ CDK_TOOLKIT_I5034: debug({
518
+ code: "CDK_TOOLKIT_I5034",
519
+ description: "Stop monitoring log groups",
520
+ interface: "CloudWatchLogMonitorControlEvent"
521
+ }),
522
+ CDK_TOOLKIT_E5035: error({
523
+ code: "CDK_TOOLKIT_E5035",
524
+ description: "A log monitoring error",
525
+ interface: "ErrorPayload"
526
+ }),
527
+ CDK_TOOLKIT_I5050: confirm({
528
+ code: "CDK_TOOLKIT_I5050",
529
+ description: "Confirm rollback during deployment",
530
+ interface: "ConfirmationRequest"
531
+ }),
532
+ CDK_TOOLKIT_I5060: confirm({
533
+ code: "CDK_TOOLKIT_I5060",
534
+ description: "Confirm deploy security sensitive changes",
535
+ interface: "DeployConfirmationRequest"
536
+ }),
537
+ CDK_TOOLKIT_I5100: info({
538
+ code: "CDK_TOOLKIT_I5100",
539
+ description: "Stack deploy progress",
540
+ interface: "StackDeployProgress"
541
+ }),
542
+ // Assets (52xx)
543
+ CDK_TOOLKIT_I5210: trace({
544
+ code: "CDK_TOOLKIT_I5210",
545
+ description: "Started building a specific asset",
546
+ interface: "BuildAsset"
547
+ }),
548
+ CDK_TOOLKIT_I5211: trace({
549
+ code: "CDK_TOOLKIT_I5211",
550
+ description: "Building the asset has completed",
551
+ interface: "Duration"
552
+ }),
553
+ CDK_TOOLKIT_I5220: trace({
554
+ code: "CDK_TOOLKIT_I5220",
555
+ description: "Started publishing a specific asset",
556
+ interface: "PublishAsset"
557
+ }),
558
+ CDK_TOOLKIT_I5221: trace({
559
+ code: "CDK_TOOLKIT_I5221",
560
+ description: "Publishing the asset has completed",
561
+ interface: "Duration"
562
+ }),
563
+ // Watch (53xx)
564
+ CDK_TOOLKIT_I5310: debug({
565
+ code: "CDK_TOOLKIT_I5310",
566
+ description: "The computed settings used for file watching",
567
+ interface: "WatchSettings"
568
+ }),
569
+ CDK_TOOLKIT_I5311: info({
570
+ code: "CDK_TOOLKIT_I5311",
571
+ description: "File watching started",
572
+ interface: "FileWatchEvent"
573
+ }),
574
+ CDK_TOOLKIT_I5312: info({
575
+ code: "CDK_TOOLKIT_I5312",
576
+ description: "File event detected, starting deployment",
577
+ interface: "FileWatchEvent"
578
+ }),
579
+ CDK_TOOLKIT_I5313: info({
580
+ code: "CDK_TOOLKIT_I5313",
581
+ description: "File event detected during active deployment, changes are queued",
582
+ interface: "FileWatchEvent"
583
+ }),
584
+ CDK_TOOLKIT_I5314: info({
585
+ code: "CDK_TOOLKIT_I5314",
586
+ description: "Initial watch deployment started"
587
+ }),
588
+ CDK_TOOLKIT_I5315: info({
589
+ code: "CDK_TOOLKIT_I5315",
590
+ description: "Queued watch deployment started"
591
+ }),
592
+ // Hotswap (54xx)
593
+ CDK_TOOLKIT_I5400: trace({
594
+ code: "CDK_TOOLKIT_I5400",
595
+ description: "Attempting a hotswap deployment",
596
+ interface: "HotswapDeploymentAttempt"
597
+ }),
598
+ CDK_TOOLKIT_I5401: trace({
599
+ code: "CDK_TOOLKIT_I5401",
600
+ description: "Computed details for the hotswap deployment",
601
+ interface: "HotswapDeploymentDetails"
602
+ }),
603
+ CDK_TOOLKIT_I5402: info({
604
+ code: "CDK_TOOLKIT_I5402",
605
+ description: "A hotswappable change is processed as part of a hotswap deployment",
606
+ interface: "HotswappableChange"
607
+ }),
608
+ CDK_TOOLKIT_I5403: info({
609
+ code: "CDK_TOOLKIT_I5403",
610
+ description: "The hotswappable change has completed processing",
611
+ interface: "HotswappableChange"
612
+ }),
613
+ CDK_TOOLKIT_I5410: info({
614
+ code: "CDK_TOOLKIT_I5410",
615
+ description: "Hotswap deployment has ended, a full deployment might still follow if needed",
616
+ interface: "HotswapResult"
617
+ }),
618
+ // Stack Monitor (55xx)
619
+ CDK_TOOLKIT_I5501: info({
620
+ code: "CDK_TOOLKIT_I5501",
621
+ description: "Stack Monitoring: Start monitoring of a single stack",
622
+ interface: "StackMonitoringControlEvent"
623
+ }),
624
+ CDK_TOOLKIT_I5502: info({
625
+ code: "CDK_TOOLKIT_I5502",
626
+ description: "Stack Monitoring: Activity event for a single stack",
627
+ interface: "StackActivity"
628
+ }),
629
+ CDK_TOOLKIT_I5503: info({
630
+ code: "CDK_TOOLKIT_I5503",
631
+ description: "Stack Monitoring: Finished monitoring of a single stack",
632
+ interface: "StackMonitoringControlEvent"
633
+ }),
634
+ // Success (59xx)
635
+ CDK_TOOLKIT_I5900: result({
636
+ code: "CDK_TOOLKIT_I5900",
637
+ description: "Deployment results on success",
638
+ interface: "SuccessfulDeployStackResult"
639
+ }),
640
+ CDK_TOOLKIT_I5901: info({
641
+ code: "CDK_TOOLKIT_I5901",
642
+ description: "Generic deployment success messages"
643
+ }),
644
+ CDK_TOOLKIT_W5400: warn({
645
+ code: "CDK_TOOLKIT_W5400",
646
+ description: "Hotswap disclosure message"
647
+ }),
648
+ CDK_TOOLKIT_E5001: error({
649
+ code: "CDK_TOOLKIT_E5001",
650
+ description: "No stacks found"
651
+ }),
652
+ CDK_TOOLKIT_E5500: error({
653
+ code: "CDK_TOOLKIT_E5500",
654
+ description: "Stack Monitoring error",
655
+ interface: "ErrorPayload"
656
+ }),
657
+ // 6: Rollback (6xxx)
658
+ CDK_TOOLKIT_I6000: info({
659
+ code: "CDK_TOOLKIT_I6000",
660
+ description: "Provides rollback times",
661
+ interface: "Duration"
662
+ }),
663
+ CDK_TOOLKIT_I6100: info({
664
+ code: "CDK_TOOLKIT_I6100",
665
+ description: "Stack rollback progress",
666
+ interface: "StackRollbackProgress"
667
+ }),
668
+ CDK_TOOLKIT_E6001: error({
669
+ code: "CDK_TOOLKIT_E6001",
670
+ description: "No stacks found"
671
+ }),
672
+ CDK_TOOLKIT_E6900: error({
673
+ code: "CDK_TOOLKIT_E6900",
674
+ description: "Rollback failed",
675
+ interface: "ErrorPayload"
676
+ }),
677
+ // 7: Destroy (7xxx)
678
+ CDK_TOOLKIT_I7000: info({
679
+ code: "CDK_TOOLKIT_I7000",
680
+ description: "Provides destroy times",
681
+ interface: "Duration"
682
+ }),
683
+ CDK_TOOLKIT_I7001: trace({
684
+ code: "CDK_TOOLKIT_I7001",
685
+ description: "Provides destroy time for a single stack",
686
+ interface: "Duration"
687
+ }),
688
+ CDK_TOOLKIT_I7010: confirm({
689
+ code: "CDK_TOOLKIT_I7010",
690
+ description: "Confirm destroy stacks",
691
+ interface: "ConfirmationRequest"
692
+ }),
693
+ CDK_TOOLKIT_I7100: info({
694
+ code: "CDK_TOOLKIT_I7100",
695
+ description: "Stack destroy progress",
696
+ interface: "StackDestroyProgress"
697
+ }),
698
+ CDK_TOOLKIT_I7101: trace({
699
+ code: "CDK_TOOLKIT_I7101",
700
+ description: "Start stack destroying",
701
+ interface: "StackDestroy"
702
+ }),
703
+ CDK_TOOLKIT_I7900: result({
704
+ code: "CDK_TOOLKIT_I7900",
705
+ description: "Stack deletion succeeded",
706
+ interface: "cxapi.CloudFormationStackArtifact"
707
+ }),
708
+ CDK_TOOLKIT_E7010: error({
709
+ code: "CDK_TOOLKIT_E7010",
710
+ description: "Action was aborted due to negative confirmation of request"
711
+ }),
712
+ CDK_TOOLKIT_E7900: error({
713
+ code: "CDK_TOOLKIT_E7900",
714
+ description: "Stack deletion failed",
715
+ interface: "ErrorPayload"
716
+ }),
717
+ // 8. Refactor (8xxx)
718
+ CDK_TOOLKIT_I8900: result({
719
+ code: "CDK_TOOLKIT_I8900",
720
+ description: "Refactor result",
721
+ interface: "RefactorResult"
722
+ }),
723
+ CDK_TOOLKIT_W8010: warn({
724
+ code: "CDK_TOOLKIT_W8010",
725
+ description: "Refactor execution not yet supported"
726
+ }),
727
+ // 9: Bootstrap (9xxx)
728
+ CDK_TOOLKIT_I9000: info({
729
+ code: "CDK_TOOLKIT_I9000",
730
+ description: "Provides bootstrap times",
731
+ interface: "Duration"
732
+ }),
733
+ CDK_TOOLKIT_I9100: info({
734
+ code: "CDK_TOOLKIT_I9100",
735
+ description: "Bootstrap progress",
736
+ interface: "BootstrapEnvironmentProgress"
737
+ }),
738
+ CDK_TOOLKIT_I9900: result({
739
+ code: "CDK_TOOLKIT_I9900",
740
+ description: "Bootstrap results on success",
741
+ interface: "cxapi.Environment"
742
+ }),
743
+ CDK_TOOLKIT_E9900: error({
744
+ code: "CDK_TOOLKIT_E9900",
745
+ description: "Bootstrap failed",
746
+ interface: "ErrorPayload"
747
+ }),
748
+ // Notices
749
+ CDK_TOOLKIT_I0100: info({
750
+ code: "CDK_TOOLKIT_I0100",
751
+ description: "Notices decoration (the header or footer of a list of notices)"
752
+ }),
753
+ CDK_TOOLKIT_W0101: warn({
754
+ code: "CDK_TOOLKIT_W0101",
755
+ description: "A notice that is marked as a warning"
756
+ }),
757
+ CDK_TOOLKIT_E0101: error({
758
+ code: "CDK_TOOLKIT_E0101",
759
+ description: "A notice that is marked as an error"
760
+ }),
761
+ CDK_TOOLKIT_I0101: info({
762
+ code: "CDK_TOOLKIT_I0101",
763
+ description: "A notice that is marked as informational"
764
+ }),
765
+ // Assembly codes
766
+ DEFAULT_ASSEMBLY_TRACE: trace({
767
+ code: "CDK_ASSEMBLY_I0000",
768
+ description: "Default trace messages emitted from Cloud Assembly operations"
769
+ }),
770
+ DEFAULT_ASSEMBLY_DEBUG: debug({
771
+ code: "CDK_ASSEMBLY_I0000",
772
+ description: "Default debug messages emitted from Cloud Assembly operations"
773
+ }),
774
+ DEFAULT_ASSEMBLY_INFO: info({
775
+ code: "CDK_ASSEMBLY_I0000",
776
+ description: "Default info messages emitted from Cloud Assembly operations"
777
+ }),
778
+ DEFAULT_ASSEMBLY_WARN: warn({
779
+ code: "CDK_ASSEMBLY_W0000",
780
+ description: "Default warning messages emitted from Cloud Assembly operations"
781
+ }),
782
+ CDK_ASSEMBLY_I0010: debug({
783
+ code: "CDK_ASSEMBLY_I0010",
784
+ description: "Generic environment preparation debug messages"
785
+ }),
786
+ CDK_ASSEMBLY_W0010: warn({
787
+ code: "CDK_ASSEMBLY_W0010",
788
+ description: "Emitted if the found framework version does not support context overflow"
789
+ }),
790
+ CDK_ASSEMBLY_I0042: debug({
791
+ code: "CDK_ASSEMBLY_I0042",
792
+ description: "Writing updated context",
793
+ interface: "UpdatedContext"
794
+ }),
795
+ CDK_ASSEMBLY_I0240: debug({
796
+ code: "CDK_ASSEMBLY_I0240",
797
+ description: "Context lookup was stopped as no further progress was made. ",
798
+ interface: "MissingContext"
799
+ }),
800
+ CDK_ASSEMBLY_I0241: debug({
801
+ code: "CDK_ASSEMBLY_I0241",
802
+ description: "Fetching missing context. This is an iterative message that may appear multiple times with different missing keys.",
803
+ interface: "MissingContext"
804
+ }),
805
+ CDK_ASSEMBLY_I1000: debug({
806
+ code: "CDK_ASSEMBLY_I1000",
807
+ description: "Cloud assembly output starts"
808
+ }),
809
+ CDK_ASSEMBLY_I1001: info({
810
+ code: "CDK_ASSEMBLY_I1001",
811
+ description: "Output lines emitted by the cloud assembly to stdout"
812
+ }),
813
+ CDK_ASSEMBLY_E1002: error({
814
+ code: "CDK_ASSEMBLY_E1002",
815
+ description: "Output lines emitted by the cloud assembly to stderr"
816
+ }),
817
+ CDK_ASSEMBLY_I1003: info({
818
+ code: "CDK_ASSEMBLY_I1003",
819
+ description: "Cloud assembly output finished"
820
+ }),
821
+ CDK_ASSEMBLY_E1111: error({
822
+ code: "CDK_ASSEMBLY_E1111",
823
+ description: "Incompatible CDK CLI version. Upgrade needed.",
824
+ interface: "ErrorPayload"
825
+ }),
826
+ CDK_ASSEMBLY_I0150: debug({
827
+ code: "CDK_ASSEMBLY_I0150",
828
+ description: "Indicates the use of a pre-synthesized cloud assembly directory"
829
+ }),
830
+ CDK_ASSEMBLY_I0300: info({
831
+ code: "CDK_ASSEMBLY_I0300",
832
+ description: "An info message emitted by a Context Provider",
833
+ interface: "ContextProviderMessageSource"
834
+ }),
835
+ CDK_ASSEMBLY_I0301: debug({
836
+ code: "CDK_ASSEMBLY_I0301",
837
+ description: "A debug message emitted by a Context Provider",
838
+ interface: "ContextProviderMessageSource"
839
+ }),
840
+ // Assembly Annotations
841
+ CDK_ASSEMBLY_I9999: info({
842
+ code: "CDK_ASSEMBLY_I9999",
843
+ description: "Annotations emitted by the cloud assembly",
844
+ interface: "cxapi.SynthesisMessage"
845
+ }),
846
+ CDK_ASSEMBLY_W9999: warn({
847
+ code: "CDK_ASSEMBLY_W9999",
848
+ description: "Warnings emitted by the cloud assembly",
849
+ interface: "cxapi.SynthesisMessage"
850
+ }),
851
+ CDK_ASSEMBLY_E9999: error({
852
+ code: "CDK_ASSEMBLY_E9999",
853
+ description: "Errors emitted by the cloud assembly",
854
+ interface: "cxapi.SynthesisMessage"
855
+ }),
856
+ // SDK codes
857
+ DEFAULT_SDK_TRACE: trace({
858
+ code: "CDK_SDK_I0000",
859
+ description: "An SDK trace message."
860
+ }),
861
+ DEFAULT_SDK_DEBUG: debug({
862
+ code: "CDK_SDK_I0000",
863
+ description: "An SDK debug message."
864
+ }),
865
+ DEFAULT_SDK_WARN: warn({
866
+ code: "CDK_SDK_W0000",
867
+ description: "An SDK warning message."
868
+ }),
869
+ CDK_SDK_I0100: trace({
870
+ code: "CDK_SDK_I0100",
871
+ description: "An SDK trace. SDK traces are emitted as traces to the IoHost, but contain the original SDK logging level.",
872
+ interface: "SdkTrace"
873
+ })
874
+ };
875
+ var SPAN = {
876
+ SYNTH_ASSEMBLY: {
877
+ name: "Synthesis",
878
+ start: IO.CDK_TOOLKIT_I1001,
879
+ end: IO.CDK_TOOLKIT_I1000
880
+ },
881
+ DEPLOY_STACK: {
882
+ name: "Deployment",
883
+ start: IO.CDK_TOOLKIT_I5100,
884
+ end: IO.CDK_TOOLKIT_I5001
885
+ },
886
+ ROLLBACK_STACK: {
887
+ name: "Rollback",
888
+ start: IO.CDK_TOOLKIT_I6100,
889
+ end: IO.CDK_TOOLKIT_I6000
890
+ },
891
+ DIFF_STACK: {
892
+ name: "Diff",
893
+ start: IO.CDK_TOOLKIT_I4000,
894
+ end: IO.CDK_TOOLKIT_I4001
895
+ },
896
+ DESTROY_STACK: {
897
+ name: "Destroy",
898
+ start: IO.CDK_TOOLKIT_I7100,
899
+ end: IO.CDK_TOOLKIT_I7001
900
+ },
901
+ DESTROY_ACTION: {
902
+ name: "Destroy",
903
+ start: IO.CDK_TOOLKIT_I7101,
904
+ end: IO.CDK_TOOLKIT_I7000
905
+ },
906
+ BOOTSTRAP_SINGLE: {
907
+ name: "Bootstrap",
908
+ start: IO.CDK_TOOLKIT_I9100,
909
+ end: IO.CDK_TOOLKIT_I9000
910
+ },
911
+ BUILD_ASSET: {
912
+ name: "Build Asset",
913
+ start: IO.CDK_TOOLKIT_I5210,
914
+ end: IO.CDK_TOOLKIT_I5211
915
+ },
916
+ PUBLISH_ASSET: {
917
+ name: "Publish Asset",
918
+ start: IO.CDK_TOOLKIT_I5220,
919
+ end: IO.CDK_TOOLKIT_I5221
920
+ },
921
+ HOTSWAP: {
922
+ name: "hotswap-deployment",
923
+ start: IO.CDK_TOOLKIT_I5400,
924
+ end: IO.CDK_TOOLKIT_I5410
925
+ }
926
+ };
927
+
928
+ // ../tmp-toolkit-helpers/src/api/io/private/io-default-messages.ts
929
+ var util2 = __toESM(require("util"));
930
+ var IoDefaultMessages = class {
931
+ constructor(ioHelper) {
932
+ this.ioHelper = ioHelper;
933
+ }
934
+ notify(msg) {
935
+ return this.ioHelper.notify(msg);
936
+ }
937
+ requestResponse(msg) {
938
+ return this.ioHelper.requestResponse(msg);
939
+ }
940
+ error(input, ...args) {
941
+ this.emitMessage(IO.DEFAULT_TOOLKIT_ERROR, input, ...args);
942
+ }
943
+ warn(input, ...args) {
944
+ this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
945
+ }
946
+ warning(input, ...args) {
947
+ this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
948
+ }
949
+ info(input, ...args) {
950
+ this.emitMessage(IO.DEFAULT_TOOLKIT_INFO, input, ...args);
951
+ }
952
+ debug(input, ...args) {
953
+ this.emitMessage(IO.DEFAULT_TOOLKIT_DEBUG, input, ...args);
954
+ }
955
+ trace(input, ...args) {
956
+ this.emitMessage(IO.DEFAULT_TOOLKIT_TRACE, input, ...args);
957
+ }
958
+ result(input, ...args) {
959
+ const message2 = args.length > 0 ? util2.format(input, ...args) : input;
960
+ void this.ioHelper.notify({
961
+ time: /* @__PURE__ */ new Date(),
962
+ code: IO.DEFAULT_TOOLKIT_INFO.code,
963
+ level: "result",
964
+ message: message2,
965
+ data: void 0
966
+ });
967
+ }
968
+ emitMessage(maker, input, ...args) {
969
+ const message2 = args.length > 0 ? util2.format(input, ...args) : input;
970
+ void this.ioHelper.notify(maker.msg(message2));
971
+ }
972
+ };
973
+
974
+ // ../tmp-toolkit-helpers/src/api/plugin/plugin.ts
975
+ var PluginHost = class {
976
+ /**
977
+ * Access the currently registered CredentialProviderSources. New sources can
978
+ * be registered using the +registerCredentialProviderSource+ method.
979
+ */
980
+ credentialProviderSources = new Array();
981
+ contextProviderPlugins = {};
982
+ ioHost;
983
+ alreadyLoaded = /* @__PURE__ */ new Set();
984
+ /**
985
+ * Loads a plug-in into this PluginHost.
986
+ *
987
+ * Will use `require.resolve()` to get the most accurate representation of what
988
+ * code will get loaded in error messages. As such, it will not work in
989
+ * unit tests with Jest virtual modules becauase of <https://github.com/jestjs/jest/issues/9543>.
990
+ *
991
+ * @param moduleSpec the specification (path or name) of the plug-in module to be loaded.
992
+ * @param ioHost the I/O host to use for printing progress information
993
+ */
994
+ load(moduleSpec, ioHost) {
995
+ try {
996
+ const resolved = require.resolve(moduleSpec);
997
+ if (ioHost) {
998
+ new IoDefaultMessages(IoHelper.fromIoHost(ioHost, "init")).debug(`Loading plug-in: ${resolved} from ${moduleSpec}`);
999
+ }
1000
+ return this._doLoad(resolved);
1001
+ } catch (e) {
1002
+ throw new ToolkitError(`Unable to resolve plug-in: Cannot find module '${moduleSpec}': ${e}`);
1003
+ }
1004
+ }
1005
+ /**
1006
+ * Do the loading given an already-resolved module name
1007
+ *
1008
+ * @internal
1009
+ */
1010
+ _doLoad(resolved) {
1011
+ try {
1012
+ if (this.alreadyLoaded.has(resolved)) {
1013
+ return;
1014
+ }
1015
+ const plugin = require(resolved);
1016
+ if (!isPlugin(plugin)) {
1017
+ throw new ToolkitError(`Module ${resolved} is not a valid plug-in, or has an unsupported version.`);
1018
+ }
1019
+ if (plugin.init) {
1020
+ plugin.init(this);
1021
+ }
1022
+ this.alreadyLoaded.add(resolved);
1023
+ } catch (e) {
1024
+ throw ToolkitError.withCause(`Unable to load plug-in '${resolved}'`, e);
1025
+ }
1026
+ function isPlugin(x) {
1027
+ return x != null && x.version === "1";
1028
+ }
1029
+ }
1030
+ /**
1031
+ * Allows plug-ins to register new CredentialProviderSources.
1032
+ *
1033
+ * @param source a new CredentialProviderSource to register.
1034
+ */
1035
+ registerCredentialProviderSource(source) {
1036
+ this.credentialProviderSources.push(source);
1037
+ }
1038
+ /**
1039
+ * (EXPERIMENTAL) Allow plugins to register context providers
1040
+ *
1041
+ * Context providers are objects with the following method:
1042
+ *
1043
+ * ```ts
1044
+ * getValue(args: {[key: string]: any}): Promise<any>;
1045
+ * ```
1046
+ *
1047
+ * Currently, they cannot reuse the CDK's authentication mechanisms, so they
1048
+ * must be prepared to either not make AWS calls or use their own source of
1049
+ * AWS credentials.
1050
+ *
1051
+ * This feature is experimental, and only intended to be used internally at Amazon
1052
+ * as a trial.
1053
+ *
1054
+ * After registering with 'my-plugin-name', the provider must be addressed as follows:
1055
+ *
1056
+ * ```ts
1057
+ * const value = ContextProvider.getValue(this, {
1058
+ * providerName: 'plugin',
1059
+ * props: {
1060
+ * pluginName: 'my-plugin-name',
1061
+ * myParameter1: 'xyz',
1062
+ * },
1063
+ * includeEnvironment: true | false,
1064
+ * dummyValue: 'what-to-return-on-the-first-pass',
1065
+ * })
1066
+ * ```
1067
+ *
1068
+ * @experimental
1069
+ */
1070
+ registerContextProviderAlpha(pluginProviderName, provider) {
1071
+ if (!isContextProviderPlugin(provider)) {
1072
+ throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util2.inspect)(provider)}`);
1073
+ }
1074
+ this.contextProviderPlugins[pluginProviderName] = provider;
1075
+ }
1076
+ };
1077
+
151
1078
  // ../tmp-toolkit-helpers/src/payloads/diff.ts
152
1079
  var PermissionChangeType = /* @__PURE__ */ ((PermissionChangeType2) => {
153
1080
  PermissionChangeType2["NONE"] = "none";
@@ -176,6 +1103,7 @@ var NonHotswappableReason = /* @__PURE__ */ ((NonHotswappableReason2) => {
176
1103
  ExpandStackSelection,
177
1104
  NonHotswappableReason,
178
1105
  PermissionChangeType,
1106
+ PluginHost,
179
1107
  StackSelectionStrategy,
180
1108
  ToolkitError
181
1109
  });