@aws-cdk/toolkit-lib 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/build-info.json +2 -2
  2. package/lib/actions/bootstrap/index.d.ts +1 -1
  3. package/lib/actions/bootstrap/index.js +1 -1
  4. package/lib/actions/bootstrap/private/helpers.d.ts +1 -1
  5. package/lib/actions/bootstrap/private/helpers.js +1 -1
  6. package/lib/actions/deploy/index.d.ts +2 -16
  7. package/lib/actions/deploy/index.js +2 -17
  8. package/lib/actions/deploy/private/deploy-options.d.ts +1 -1
  9. package/lib/actions/deploy/private/deploy-options.js +1 -1
  10. package/lib/actions/deploy/private/helpers.d.ts +3 -2
  11. package/lib/actions/deploy/private/helpers.js +1 -1
  12. package/lib/actions/diff/private/helpers.d.ts +5 -5
  13. package/lib/actions/diff/private/helpers.js +13 -11
  14. package/lib/actions/list/index.d.ts +0 -4
  15. package/lib/actions/list/index.js +1 -1
  16. package/lib/api/aws-cdk.d.ts +3 -4
  17. package/lib/api/aws-cdk.js +1419 -738
  18. package/lib/api/aws-cdk.js.map +4 -4
  19. package/lib/api/cloud-assembly/index.d.ts +1 -1
  20. package/lib/api/cloud-assembly/index.js +2 -2
  21. package/lib/api/cloud-assembly/private/cached-source.d.ts +2 -2
  22. package/lib/api/cloud-assembly/private/cached-source.js +1 -1
  23. package/lib/api/cloud-assembly/private/context-aware-source.d.ts +4 -4
  24. package/lib/api/cloud-assembly/private/context-aware-source.js +11 -12
  25. package/lib/api/cloud-assembly/private/identity-source.d.ts +1 -1
  26. package/lib/api/cloud-assembly/private/identity-source.js +1 -1
  27. package/lib/api/cloud-assembly/private/prepare-source.d.ts +5 -5
  28. package/lib/api/cloud-assembly/private/prepare-source.js +8 -6
  29. package/lib/api/cloud-assembly/private/source-builder.d.ts +4 -4
  30. package/lib/api/cloud-assembly/private/source-builder.js +24 -12
  31. package/lib/api/cloud-assembly/private/stack-assembly.d.ts +3 -3
  32. package/lib/api/cloud-assembly/private/stack-assembly.js +1 -1
  33. package/lib/api/cloud-assembly/private/stack-selectors.d.ts +1 -1
  34. package/lib/api/cloud-assembly/private/stack-selectors.js +1 -1
  35. package/lib/api/cloud-assembly/source-builder.d.ts +36 -0
  36. package/lib/api/cloud-assembly/source-builder.js +1 -1
  37. package/lib/api/cloud-assembly/stack-selector.d.ts +2 -81
  38. package/lib/api/cloud-assembly/stack-selector.js +5 -62
  39. package/lib/api/io/private/index.d.ts +3 -5
  40. package/lib/api/io/private/index.js +7 -6
  41. package/lib/api/io/private/io-host-wrappers.d.ts +17 -0
  42. package/lib/api/io/private/io-host-wrappers.js +74 -0
  43. package/lib/api/io/private/sdk-logger.d.ts +3 -0
  44. package/lib/api/io/private/sdk-logger.js +124 -0
  45. package/lib/api/shared-private.js +814 -26
  46. package/lib/api/shared-private.js.map +4 -4
  47. package/lib/api/shared-public.d.ts +2519 -31
  48. package/lib/api/shared-public.js +88 -5
  49. package/lib/api/shared-public.js.map +4 -4
  50. package/lib/index.d.ts +3 -0
  51. package/lib/index.js +4 -1
  52. package/lib/private/util.js +22 -7
  53. package/lib/private/util.js.map +2 -2
  54. package/lib/toolkit/index.d.ts +1 -1
  55. package/lib/toolkit/index.js +2 -2
  56. package/lib/toolkit/private/index.d.ts +4 -4
  57. package/lib/toolkit/private/index.js +1 -1
  58. package/lib/toolkit/toolkit.d.ts +6 -8
  59. package/lib/toolkit/toolkit.js +149 -123
  60. package/lib/util/concurrency.d.ts +1 -1
  61. package/lib/util/concurrency.js +2 -2
  62. package/package.json +5 -5
  63. package/CODE_REGISTRY.md +0 -38
  64. package/lib/api/cloud-assembly/context.d.ts +0 -9
  65. package/lib/api/cloud-assembly/context.js +0 -3
  66. package/lib/api/io/private/codes.d.ts +0 -47
  67. package/lib/api/io/private/codes.js +0 -175
  68. package/lib/api/io/private/level-priority.d.ts +0 -11
  69. package/lib/api/io/private/level-priority.js +0 -33
  70. package/lib/api/io/private/logger.d.ts +0 -31
  71. package/lib/api/io/private/logger.js +0 -190
  72. package/lib/api/io/private/messages.d.ts +0 -62
  73. package/lib/api/io/private/messages.js +0 -162
  74. package/lib/api/io/private/timer.d.ts +0 -29
  75. package/lib/api/io/private/timer.js +0 -55
  76. package/lib/toolkit/types.d.ts +0 -76
  77. package/lib/toolkit/types.js +0 -3
@@ -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,68 +17,854 @@ 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-private.ts
21
31
  var shared_private_exports = {};
22
32
  __export(shared_private_exports, {
33
+ FakeIoHost: () => FakeIoHost,
34
+ IO: () => IO,
35
+ IoDefaultMessages: () => IoDefaultMessages,
36
+ IoHelper: () => IoHelper,
37
+ SPAN: () => SPAN,
38
+ SpanMaker: () => SpanMaker,
39
+ TestIoHost: () => TestIoHost,
40
+ asIoHelper: () => asIoHelper,
41
+ confirm: () => confirm,
23
42
  debug: () => debug,
24
43
  error: () => error,
25
44
  info: () => info,
45
+ isMessageRelevantForLevel: () => isMessageRelevantForLevel,
26
46
  result: () => result,
27
47
  trace: () => trace,
28
- warn: () => warn,
29
- withAction: () => withAction
48
+ warn: () => warn
30
49
  });
31
50
  module.exports = __toCommonJS(shared_private_exports);
32
51
 
33
- // ../tmp-toolkit-helpers/src/api/io/private/action-aware.ts
34
- function withAction(ioHost, action) {
52
+ // ../tmp-toolkit-helpers/src/api/io/private/span.ts
53
+ var util = __toESM(require("node:util"));
54
+ var uuid = __toESM(require("uuid"));
55
+
56
+ // ../tmp-toolkit-helpers/src/util/archive.ts
57
+ var glob = __toESM(require("glob"));
58
+ var archiver = require("archiver");
59
+
60
+ // ../tmp-toolkit-helpers/src/api/toolkit-error.ts
61
+ var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ToolkitError");
62
+ var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AuthenticationError");
63
+ var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AssemblyError");
64
+ var CONTEXT_PROVIDER_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ContextProviderError");
65
+
66
+ // ../tmp-toolkit-helpers/src/util/types.ts
67
+ var isArray = Array.isArray;
68
+
69
+ // ../tmp-toolkit-helpers/src/util/yaml-cfn.ts
70
+ var yaml = __toESM(require("yaml"));
71
+ var yaml_types = __toESM(require("yaml/types"));
72
+ function makeTagForCfnIntrinsic(intrinsicName, addFnPrefix) {
35
73
  return {
36
- notify: async (msg) => {
37
- await ioHost.notify({
38
- ...msg,
39
- action
40
- });
74
+ identify(value) {
75
+ return typeof value === "string";
41
76
  },
42
- requestResponse: async (msg) => {
43
- return ioHost.requestResponse({
44
- ...msg,
45
- action
46
- });
77
+ tag: `!${intrinsicName}`,
78
+ resolve: (_doc, cstNode) => {
79
+ const ret = {};
80
+ ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = // the +1 is to account for the ! the short form begins with
81
+ parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1));
82
+ return ret;
47
83
  }
48
84
  };
49
85
  }
86
+ var shortForms = [
87
+ "Base64",
88
+ "Cidr",
89
+ "FindInMap",
90
+ "GetAZs",
91
+ "ImportValue",
92
+ "Join",
93
+ "Sub",
94
+ "Select",
95
+ "Split",
96
+ "Transform",
97
+ "And",
98
+ "Equals",
99
+ "If",
100
+ "Not",
101
+ "Or",
102
+ "GetAtt"
103
+ ].map((name) => makeTagForCfnIntrinsic(name, true)).concat(
104
+ makeTagForCfnIntrinsic("Ref", false),
105
+ makeTagForCfnIntrinsic("Condition", false)
106
+ );
107
+ function parseYamlStrWithCfnTags(text) {
108
+ return yaml.parse(text, {
109
+ customTags: shortForms,
110
+ schema: "core"
111
+ });
112
+ }
113
+
114
+ // ../tmp-toolkit-helpers/src/util/string-manipulation.ts
115
+ function formatTime(num) {
116
+ return roundPercentage(millisecondsToSeconds(num));
117
+ }
118
+ function roundPercentage(num) {
119
+ return Math.round(100 * num) / 100;
120
+ }
121
+ function millisecondsToSeconds(num) {
122
+ return num / 1e3;
123
+ }
124
+
125
+ // ../tmp-toolkit-helpers/src/util/version-range.ts
126
+ var semver = __toESM(require("semver"));
127
+
128
+ // ../tmp-toolkit-helpers/src/api/io/private/span.ts
129
+ var SpanMaker = class {
130
+ definition;
131
+ ioHelper;
132
+ constructor(ioHelper, definition) {
133
+ this.definition = definition;
134
+ this.ioHelper = ioHelper;
135
+ }
136
+ async begin(a, b) {
137
+ const spanId = uuid.v4();
138
+ const startTime = (/* @__PURE__ */ new Date()).getTime();
139
+ const notify = (msg) => {
140
+ return this.ioHelper.notify(withSpanId(spanId, msg));
141
+ };
142
+ const startInput = parseArgs(a, b);
143
+ const startMsg = startInput.message ?? `Starting ${this.definition.name} ...`;
144
+ const startPayload = startInput.payload;
145
+ await notify(this.definition.start.msg(
146
+ startMsg,
147
+ startPayload
148
+ ));
149
+ const timingMsgTemplate = "\n\u2728 %s time: %ds\n";
150
+ const time = () => {
151
+ const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - startTime;
152
+ return {
153
+ asMs: elapsedTime,
154
+ asSec: formatTime(elapsedTime)
155
+ };
156
+ };
157
+ return {
158
+ elapsedTime: async () => {
159
+ return time();
160
+ },
161
+ notify: async (msg) => {
162
+ await notify(msg);
163
+ },
164
+ timing: async (maker, message2) => {
165
+ const duration = time();
166
+ const timingMsg = message2 ? message2 : util.format(timingMsgTemplate, this.definition.name, duration.asSec);
167
+ await notify(maker.msg(timingMsg, {
168
+ duration: duration.asMs
169
+ }));
170
+ return duration;
171
+ },
172
+ end: async (x, y) => {
173
+ const duration = time();
174
+ const endInput = parseArgs(x, y);
175
+ const endMsg = endInput.message ?? util.format(timingMsgTemplate, this.definition.name, duration.asSec);
176
+ const endPayload = endInput.payload;
177
+ await notify(this.definition.end.msg(
178
+ endMsg,
179
+ {
180
+ duration: duration.asMs,
181
+ ...endPayload
182
+ }
183
+ ));
184
+ return duration;
185
+ }
186
+ };
187
+ }
188
+ };
189
+ function parseArgs(first, second) {
190
+ const firstIsMessage = typeof first === "string";
191
+ const message2 = firstIsMessage || second ? first : void 0;
192
+ const payload = firstIsMessage || second ? second : first;
193
+ return {
194
+ message: message2,
195
+ payload
196
+ };
197
+ }
198
+ function withSpanId(span, message2) {
199
+ return {
200
+ ...message2,
201
+ span
202
+ };
203
+ }
204
+
205
+ // ../tmp-toolkit-helpers/src/api/io/private/io-helper.ts
206
+ var IoHelper = class _IoHelper {
207
+ static fromIoHost(ioHost, action) {
208
+ return new _IoHelper(ioHost, action);
209
+ }
210
+ ioHost;
211
+ action;
212
+ constructor(ioHost, action) {
213
+ this.ioHost = ioHost;
214
+ this.action = action;
215
+ }
216
+ /**
217
+ * Forward a message to the IoHost, while injection the current action
218
+ */
219
+ notify(msg) {
220
+ return this.ioHost.notify({
221
+ ...msg,
222
+ action: this.action
223
+ });
224
+ }
225
+ /**
226
+ * Forward a request to the IoHost, while injection the current action
227
+ */
228
+ requestResponse(msg) {
229
+ return this.ioHost.requestResponse({
230
+ ...msg,
231
+ action: this.action
232
+ });
233
+ }
234
+ /**
235
+ * Create a new marker from a given registry entry
236
+ */
237
+ span(definition) {
238
+ return new SpanMaker(this, definition);
239
+ }
240
+ };
241
+ function asIoHelper(ioHost, action) {
242
+ return IoHelper.fromIoHost(ioHost, action);
243
+ }
244
+
245
+ // ../tmp-toolkit-helpers/src/api/io/private/level-priority.ts
246
+ var levels = [
247
+ "trace",
248
+ "debug",
249
+ "info",
250
+ "warn",
251
+ "result",
252
+ "error"
253
+ ];
254
+ var orderedLevels = Object.fromEntries(Object.entries(levels).map((a) => a.reverse()));
255
+ function compareFn(a, b) {
256
+ return orderedLevels[a] - orderedLevels[b];
257
+ }
258
+ function isMessageRelevantForLevel(msg, level) {
259
+ return compareFn(msg.level, level) >= 0;
260
+ }
50
261
 
51
262
  // ../tmp-toolkit-helpers/src/api/io/private/message-maker.ts
52
- function generic(level, details) {
53
- const msg = (message, data) => ({
263
+ function message(level, details) {
264
+ const maker = (text, data) => ({
54
265
  time: /* @__PURE__ */ new Date(),
55
266
  level,
56
267
  code: details.code,
57
- message,
268
+ message: text,
58
269
  data
59
270
  });
60
271
  return {
61
272
  ...details,
62
273
  level,
63
- msg
274
+ msg: maker,
275
+ is: (m) => m.code === details.code
64
276
  };
65
277
  }
66
- var trace = (details) => generic("trace", details);
67
- var debug = (details) => generic("debug", details);
68
- var info = (details) => generic("info", details);
69
- var warn = (details) => generic("warn", details);
70
- var error = (details) => generic("error", details);
71
- var result = (details) => generic("result", details);
278
+ var trace = (details) => message("trace", details);
279
+ var debug = (details) => message("debug", details);
280
+ var info = (details) => message("info", details);
281
+ var warn = (details) => message("warn", details);
282
+ var error = (details) => message("error", details);
283
+ var result = (details) => message("result", details);
284
+ function request(level, details) {
285
+ const maker = (text, data) => ({
286
+ time: /* @__PURE__ */ new Date(),
287
+ level,
288
+ code: details.code,
289
+ message: text,
290
+ data,
291
+ defaultResponse: details.defaultResponse
292
+ });
293
+ return {
294
+ ...details,
295
+ level,
296
+ req: maker
297
+ };
298
+ }
299
+ var confirm = (details) => request("info", {
300
+ ...details,
301
+ defaultResponse: true
302
+ });
303
+
304
+ // ../tmp-toolkit-helpers/src/api/io/private/messages.ts
305
+ var IO = {
306
+ // Defaults (0000)
307
+ DEFAULT_TOOLKIT_INFO: info({
308
+ code: "CDK_TOOLKIT_I0000",
309
+ description: "Default info messages emitted from the Toolkit"
310
+ }),
311
+ DEFAULT_TOOLKIT_DEBUG: debug({
312
+ code: "CDK_TOOLKIT_I0000",
313
+ description: "Default debug messages emitted from the Toolkit"
314
+ }),
315
+ DEFAULT_TOOLKIT_WARN: warn({
316
+ code: "CDK_TOOLKIT_W0000",
317
+ description: "Default warning messages emitted from the Toolkit"
318
+ }),
319
+ DEFAULT_TOOLKIT_ERROR: error({
320
+ code: "CDK_TOOLKIT_E0000",
321
+ description: "Default error messages emitted from the Toolkit"
322
+ }),
323
+ DEFAULT_TOOLKIT_TRACE: trace({
324
+ code: "CDK_TOOLKIT_I0000",
325
+ description: "Default trace messages emitted from the Toolkit"
326
+ }),
327
+ // 1: Synth (1xxx)
328
+ CDK_TOOLKIT_I1000: info({
329
+ code: "CDK_TOOLKIT_I1000",
330
+ description: "Provides synthesis times.",
331
+ interface: "Duration"
332
+ }),
333
+ CDK_TOOLKIT_I1001: trace({
334
+ code: "CDK_TOOLKIT_I1001",
335
+ description: "Cloud Assembly synthesis is starting",
336
+ interface: "StackSelectionDetails"
337
+ }),
338
+ CDK_TOOLKIT_I1901: result({
339
+ code: "CDK_TOOLKIT_I1901",
340
+ description: "Provides stack data",
341
+ interface: "StackAndAssemblyData"
342
+ }),
343
+ CDK_TOOLKIT_I1902: result({
344
+ code: "CDK_TOOLKIT_I1902",
345
+ description: "Successfully deployed stacks",
346
+ interface: "AssemblyData"
347
+ }),
348
+ // 2: List (2xxx)
349
+ CDK_TOOLKIT_I2901: result({
350
+ code: "CDK_TOOLKIT_I2901",
351
+ description: "Provides details on the selected stacks and their dependencies",
352
+ interface: "StackDetailsPayload"
353
+ }),
354
+ // 3: Import & Migrate
355
+ CDK_TOOLKIT_E3900: error({
356
+ code: "CDK_TOOLKIT_E3900",
357
+ description: "Resource import failed"
358
+ }),
359
+ // 4: Diff (4xxx)
360
+ // 5: Deploy & Watch (5xxx)
361
+ CDK_TOOLKIT_I5000: info({
362
+ code: "CDK_TOOLKIT_I5000",
363
+ description: "Provides deployment times",
364
+ interface: "Duration"
365
+ }),
366
+ CDK_TOOLKIT_I5001: info({
367
+ code: "CDK_TOOLKIT_I5001",
368
+ description: "Provides total time in deploy action, including synth and rollback",
369
+ interface: "Duration"
370
+ }),
371
+ CDK_TOOLKIT_I5002: info({
372
+ code: "CDK_TOOLKIT_I5002",
373
+ description: "Provides time for resource migration"
374
+ }),
375
+ CDK_TOOLKIT_W5021: warn({
376
+ code: "CDK_TOOLKIT_W5021",
377
+ description: "Empty non-existent stack, deployment is skipped"
378
+ }),
379
+ CDK_TOOLKIT_W5022: warn({
380
+ code: "CDK_TOOLKIT_W5022",
381
+ description: "Empty existing stack, stack will be destroyed"
382
+ }),
383
+ CDK_TOOLKIT_I5031: info({
384
+ code: "CDK_TOOLKIT_I5031",
385
+ description: "Informs about any log groups that are traced as part of the deployment"
386
+ }),
387
+ CDK_TOOLKIT_I5032: debug({
388
+ code: "CDK_TOOLKIT_I5032",
389
+ description: "Start monitoring log groups",
390
+ interface: "CloudWatchLogMonitorControlEvent"
391
+ }),
392
+ CDK_TOOLKIT_I5033: info({
393
+ code: "CDK_TOOLKIT_I5033",
394
+ description: "A log event received from Cloud Watch",
395
+ interface: "CloudWatchLogEvent"
396
+ }),
397
+ CDK_TOOLKIT_I5034: debug({
398
+ code: "CDK_TOOLKIT_I5034",
399
+ description: "Stop monitoring log groups",
400
+ interface: "CloudWatchLogMonitorControlEvent"
401
+ }),
402
+ CDK_TOOLKIT_E5035: error({
403
+ code: "CDK_TOOLKIT_E5035",
404
+ description: "A log monitoring error",
405
+ interface: "ErrorPayload"
406
+ }),
407
+ CDK_TOOLKIT_I5050: confirm({
408
+ code: "CDK_TOOLKIT_I5050",
409
+ description: "Confirm rollback during deployment",
410
+ interface: "ConfirmationRequest"
411
+ }),
412
+ CDK_TOOLKIT_I5060: confirm({
413
+ code: "CDK_TOOLKIT_I5060",
414
+ description: "Confirm deploy security sensitive changes",
415
+ interface: "DeployConfirmationRequest"
416
+ }),
417
+ CDK_TOOLKIT_I5100: info({
418
+ code: "CDK_TOOLKIT_I5100",
419
+ description: "Stack deploy progress",
420
+ interface: "StackDeployProgress"
421
+ }),
422
+ // Assets (52xx)
423
+ CDK_TOOLKIT_I5210: trace({
424
+ code: "CDK_TOOLKIT_I5210",
425
+ description: "Started building a specific asset",
426
+ interface: "BuildAsset"
427
+ }),
428
+ CDK_TOOLKIT_I5211: trace({
429
+ code: "CDK_TOOLKIT_I5211",
430
+ description: "Building the asset has completed",
431
+ interface: "Duration"
432
+ }),
433
+ CDK_TOOLKIT_I5220: trace({
434
+ code: "CDK_TOOLKIT_I5220",
435
+ description: "Started publishing a specific asset",
436
+ interface: "PublishAsset"
437
+ }),
438
+ CDK_TOOLKIT_I5221: trace({
439
+ code: "CDK_TOOLKIT_I5221",
440
+ description: "Publishing the asset has completed",
441
+ interface: "Duration"
442
+ }),
443
+ // Watch (53xx)
444
+ CDK_TOOLKIT_I5310: debug({
445
+ code: "CDK_TOOLKIT_I5310",
446
+ description: "The computed settings used for file watching",
447
+ interface: "WatchSettings"
448
+ }),
449
+ CDK_TOOLKIT_I5311: info({
450
+ code: "CDK_TOOLKIT_I5311",
451
+ description: "File watching started",
452
+ interface: "FileWatchEvent"
453
+ }),
454
+ CDK_TOOLKIT_I5312: info({
455
+ code: "CDK_TOOLKIT_I5312",
456
+ description: "File event detected, starting deployment",
457
+ interface: "FileWatchEvent"
458
+ }),
459
+ CDK_TOOLKIT_I5313: info({
460
+ code: "CDK_TOOLKIT_I5313",
461
+ description: "File event detected during active deployment, changes are queued",
462
+ interface: "FileWatchEvent"
463
+ }),
464
+ CDK_TOOLKIT_I5314: info({
465
+ code: "CDK_TOOLKIT_I5314",
466
+ description: "Initial watch deployment started"
467
+ }),
468
+ CDK_TOOLKIT_I5315: info({
469
+ code: "CDK_TOOLKIT_I5315",
470
+ description: "Queued watch deployment started"
471
+ }),
472
+ // Hotswap (54xx)
473
+ CDK_TOOLKIT_I5400: trace({
474
+ code: "CDK_TOOLKIT_I5400",
475
+ description: "Starting a hotswap deployment",
476
+ interface: "HotswapDeployment"
477
+ }),
478
+ CDK_TOOLKIT_I5410: info({
479
+ code: "CDK_TOOLKIT_I5410",
480
+ description: "Hotswap deployment has ended, a full deployment might still follow if needed",
481
+ interface: "Duration"
482
+ }),
483
+ // Stack Monitor (55xx)
484
+ CDK_TOOLKIT_I5501: info({
485
+ code: "CDK_TOOLKIT_I5501",
486
+ description: "Stack Monitoring: Start monitoring of a single stack",
487
+ interface: "StackMonitoringControlEvent"
488
+ }),
489
+ CDK_TOOLKIT_I5502: info({
490
+ code: "CDK_TOOLKIT_I5502",
491
+ description: "Stack Monitoring: Activity event for a single stack",
492
+ interface: "StackActivity"
493
+ }),
494
+ CDK_TOOLKIT_I5503: info({
495
+ code: "CDK_TOOLKIT_I5503",
496
+ description: "Stack Monitoring: Finished monitoring of a single stack",
497
+ interface: "StackMonitoringControlEvent"
498
+ }),
499
+ // Success (59xx)
500
+ CDK_TOOLKIT_I5900: result({
501
+ code: "CDK_TOOLKIT_I5900",
502
+ description: "Deployment results on success",
503
+ interface: "SuccessfulDeployStackResult"
504
+ }),
505
+ CDK_TOOLKIT_I5901: info({
506
+ code: "CDK_TOOLKIT_I5901",
507
+ description: "Generic deployment success messages"
508
+ }),
509
+ CDK_TOOLKIT_W5400: warn({
510
+ code: "CDK_TOOLKIT_W5400",
511
+ description: "Hotswap disclosure message"
512
+ }),
513
+ // errors
514
+ CDK_TOOLKIT_E5001: error({
515
+ code: "CDK_TOOLKIT_E5001",
516
+ description: "No stacks found"
517
+ }),
518
+ CDK_TOOLKIT_E5500: error({
519
+ code: "CDK_TOOLKIT_E5500",
520
+ description: "Stack Monitoring error",
521
+ interface: "ErrorPayload"
522
+ }),
523
+ // 6: Rollback (6xxx)
524
+ CDK_TOOLKIT_I6000: info({
525
+ code: "CDK_TOOLKIT_I6000",
526
+ description: "Provides rollback times",
527
+ interface: "Duration"
528
+ }),
529
+ CDK_TOOLKIT_I6100: info({
530
+ code: "CDK_TOOLKIT_I6100",
531
+ description: "Stack rollback progress",
532
+ interface: "StackRollbackProgress"
533
+ }),
534
+ CDK_TOOLKIT_E6001: error({
535
+ code: "CDK_TOOLKIT_E6001",
536
+ description: "No stacks found"
537
+ }),
538
+ CDK_TOOLKIT_E6900: error({
539
+ code: "CDK_TOOLKIT_E6900",
540
+ description: "Rollback failed",
541
+ interface: "ErrorPayload"
542
+ }),
543
+ // 7: Destroy (7xxx)
544
+ CDK_TOOLKIT_I7000: info({
545
+ code: "CDK_TOOLKIT_I7000",
546
+ description: "Provides destroy times",
547
+ interface: "Duration"
548
+ }),
549
+ CDK_TOOLKIT_I7001: trace({
550
+ code: "CDK_TOOLKIT_I7001",
551
+ description: "Provides destroy time for a single stack",
552
+ interface: "Duration"
553
+ }),
554
+ CDK_TOOLKIT_I7010: confirm({
555
+ code: "CDK_TOOLKIT_I7010",
556
+ description: "Confirm destroy stacks",
557
+ interface: "ConfirmationRequest"
558
+ }),
559
+ CDK_TOOLKIT_I7100: info({
560
+ code: "CDK_TOOLKIT_I7100",
561
+ description: "Stack destroy progress",
562
+ interface: "StackDestroyProgress"
563
+ }),
564
+ CDK_TOOLKIT_I7101: trace({
565
+ code: "CDK_TOOLKIT_I7101",
566
+ description: "Start stack destroying",
567
+ interface: "StackDestroy"
568
+ }),
569
+ CDK_TOOLKIT_I7900: result({
570
+ code: "CDK_TOOLKIT_I7900",
571
+ description: "Stack deletion succeeded",
572
+ interface: "cxapi.CloudFormationStackArtifact"
573
+ }),
574
+ CDK_TOOLKIT_E7010: error({
575
+ code: "CDK_TOOLKIT_E7010",
576
+ description: "Action was aborted due to negative confirmation of request"
577
+ }),
578
+ CDK_TOOLKIT_E7900: error({
579
+ code: "CDK_TOOLKIT_E7900",
580
+ description: "Stack deletion failed",
581
+ interface: "ErrorPayload"
582
+ }),
583
+ // 9: Bootstrap (9xxx)
584
+ CDK_TOOLKIT_I9000: info({
585
+ code: "CDK_TOOLKIT_I9000",
586
+ description: "Provides bootstrap times",
587
+ interface: "Duration"
588
+ }),
589
+ CDK_TOOLKIT_I9100: info({
590
+ code: "CDK_TOOLKIT_I9100",
591
+ description: "Bootstrap progress",
592
+ interface: "BootstrapEnvironmentProgress"
593
+ }),
594
+ CDK_TOOLKIT_I9900: result({
595
+ code: "CDK_TOOLKIT_I9900",
596
+ description: "Bootstrap results on success",
597
+ interface: "cxapi.Environment"
598
+ }),
599
+ CDK_TOOLKIT_E9900: error({
600
+ code: "CDK_TOOLKIT_E9900",
601
+ description: "Bootstrap failed",
602
+ interface: "ErrorPayload"
603
+ }),
604
+ // Notices
605
+ CDK_TOOLKIT_I0100: info({
606
+ code: "CDK_TOOLKIT_I0100",
607
+ description: "Notices decoration (the header or footer of a list of notices)"
608
+ }),
609
+ CDK_TOOLKIT_W0101: warn({
610
+ code: "CDK_TOOLKIT_W0101",
611
+ description: "A notice that is marked as a warning"
612
+ }),
613
+ CDK_TOOLKIT_E0101: error({
614
+ code: "CDK_TOOLKIT_E0101",
615
+ description: "A notice that is marked as an error"
616
+ }),
617
+ CDK_TOOLKIT_I0101: info({
618
+ code: "CDK_TOOLKIT_I0101",
619
+ description: "A notice that is marked as informational"
620
+ }),
621
+ // Assembly codes
622
+ CDK_ASSEMBLY_I0010: debug({
623
+ code: "CDK_ASSEMBLY_I0010",
624
+ description: "Generic environment preparation debug messages"
625
+ }),
626
+ CDK_ASSEMBLY_W0010: warn({
627
+ code: "CDK_ASSEMBLY_W0010",
628
+ description: "Emitted if the found framework version does not support context overflow"
629
+ }),
630
+ CDK_ASSEMBLY_I0042: debug({
631
+ code: "CDK_ASSEMBLY_I0042",
632
+ description: "Writing updated context",
633
+ interface: "UpdatedContext"
634
+ }),
635
+ CDK_ASSEMBLY_I0240: debug({
636
+ code: "CDK_ASSEMBLY_I0240",
637
+ description: "Context lookup was stopped as no further progress was made. ",
638
+ interface: "MissingContext"
639
+ }),
640
+ CDK_ASSEMBLY_I0241: debug({
641
+ code: "CDK_ASSEMBLY_I0241",
642
+ description: "Fetching missing context. This is an iterative message that may appear multiple times with different missing keys.",
643
+ interface: "MissingContext"
644
+ }),
645
+ CDK_ASSEMBLY_I1000: debug({
646
+ code: "CDK_ASSEMBLY_I1000",
647
+ description: "Cloud assembly output starts"
648
+ }),
649
+ CDK_ASSEMBLY_I1001: info({
650
+ code: "CDK_ASSEMBLY_I1001",
651
+ description: "Output lines emitted by the cloud assembly to stdout"
652
+ }),
653
+ CDK_ASSEMBLY_E1002: error({
654
+ code: "CDK_ASSEMBLY_E1002",
655
+ description: "Output lines emitted by the cloud assembly to stderr"
656
+ }),
657
+ CDK_ASSEMBLY_I1003: info({
658
+ code: "CDK_ASSEMBLY_I1003",
659
+ description: "Cloud assembly output finished"
660
+ }),
661
+ CDK_ASSEMBLY_E1111: error({
662
+ code: "CDK_ASSEMBLY_E1111",
663
+ description: "Incompatible CDK CLI version. Upgrade needed.",
664
+ interface: "ErrorPayload"
665
+ }),
666
+ CDK_ASSEMBLY_I0150: debug({
667
+ code: "CDK_ASSEMBLY_I0150",
668
+ description: "Indicates the use of a pre-synthesized cloud assembly directory"
669
+ }),
670
+ // Assembly Annotations
671
+ CDK_ASSEMBLY_I9999: info({
672
+ code: "CDK_ASSEMBLY_I9999",
673
+ description: "Annotations emitted by the cloud assembly",
674
+ interface: "cxapi.SynthesisMessage"
675
+ }),
676
+ CDK_ASSEMBLY_W9999: warn({
677
+ code: "CDK_ASSEMBLY_W9999",
678
+ description: "Warnings emitted by the cloud assembly",
679
+ interface: "cxapi.SynthesisMessage"
680
+ }),
681
+ CDK_ASSEMBLY_E9999: error({
682
+ code: "CDK_ASSEMBLY_E9999",
683
+ description: "Errors emitted by the cloud assembly",
684
+ interface: "cxapi.SynthesisMessage"
685
+ }),
686
+ // SDK codes
687
+ CDK_SDK_I0000: trace({
688
+ code: "CDK_SDK_I0000",
689
+ description: "An SDK message."
690
+ }),
691
+ CDK_SDK_I0100: trace({
692
+ code: "CDK_SDK_I0100",
693
+ description: "An SDK trace. SDK traces are emitted as traces to the IoHost, but contain the original SDK logging level.",
694
+ interface: "SdkTrace"
695
+ })
696
+ };
697
+ var SPAN = {
698
+ SYNTH_ASSEMBLY: {
699
+ name: "Synthesis",
700
+ start: IO.CDK_TOOLKIT_I1001,
701
+ end: IO.CDK_TOOLKIT_I1000
702
+ },
703
+ DEPLOY_STACK: {
704
+ name: "Deployment",
705
+ start: IO.CDK_TOOLKIT_I5100,
706
+ end: IO.CDK_TOOLKIT_I5001
707
+ },
708
+ ROLLBACK_STACK: {
709
+ name: "Rollback",
710
+ start: IO.CDK_TOOLKIT_I6100,
711
+ end: IO.CDK_TOOLKIT_I6000
712
+ },
713
+ DESTROY_STACK: {
714
+ name: "Destroy",
715
+ start: IO.CDK_TOOLKIT_I7100,
716
+ end: IO.CDK_TOOLKIT_I7001
717
+ },
718
+ DESTROY_ACTION: {
719
+ name: "Destroy",
720
+ start: IO.CDK_TOOLKIT_I7101,
721
+ end: IO.CDK_TOOLKIT_I7000
722
+ },
723
+ BOOTSTRAP_SINGLE: {
724
+ name: "Bootstrap",
725
+ start: IO.CDK_TOOLKIT_I9100,
726
+ end: IO.CDK_TOOLKIT_I9000
727
+ },
728
+ BUILD_ASSET: {
729
+ name: "Build Asset",
730
+ start: IO.CDK_TOOLKIT_I5210,
731
+ end: IO.CDK_TOOLKIT_I5211
732
+ },
733
+ PUBLISH_ASSET: {
734
+ name: "Publish Asset",
735
+ start: IO.CDK_TOOLKIT_I5220,
736
+ end: IO.CDK_TOOLKIT_I5221
737
+ },
738
+ HOTSWAP: {
739
+ name: "hotswap-deployment",
740
+ start: IO.CDK_TOOLKIT_I5400,
741
+ end: IO.CDK_TOOLKIT_I5410
742
+ }
743
+ };
744
+
745
+ // ../tmp-toolkit-helpers/src/api/io/private/io-default-messages.ts
746
+ var util2 = __toESM(require("util"));
747
+ var IoDefaultMessages = class {
748
+ constructor(ioHelper) {
749
+ this.ioHelper = ioHelper;
750
+ }
751
+ notify(msg) {
752
+ return this.ioHelper.notify(msg);
753
+ }
754
+ requestResponse(msg) {
755
+ return this.ioHelper.requestResponse(msg);
756
+ }
757
+ error(input, ...args) {
758
+ this.emitMessage(IO.DEFAULT_TOOLKIT_ERROR, input, ...args);
759
+ }
760
+ warn(input, ...args) {
761
+ this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
762
+ }
763
+ warning(input, ...args) {
764
+ this.emitMessage(IO.DEFAULT_TOOLKIT_WARN, input, ...args);
765
+ }
766
+ info(input, ...args) {
767
+ this.emitMessage(IO.DEFAULT_TOOLKIT_INFO, input, ...args);
768
+ }
769
+ debug(input, ...args) {
770
+ this.emitMessage(IO.DEFAULT_TOOLKIT_DEBUG, input, ...args);
771
+ }
772
+ trace(input, ...args) {
773
+ this.emitMessage(IO.DEFAULT_TOOLKIT_TRACE, input, ...args);
774
+ }
775
+ result(input, ...args) {
776
+ const message2 = args.length > 0 ? util2.format(input, ...args) : input;
777
+ void this.ioHelper.notify({
778
+ time: /* @__PURE__ */ new Date(),
779
+ code: IO.DEFAULT_TOOLKIT_INFO.code,
780
+ level: "result",
781
+ message: message2,
782
+ data: void 0
783
+ });
784
+ }
785
+ emitMessage(maker, input, ...args) {
786
+ const message2 = args.length > 0 ? util2.format(input, ...args) : input;
787
+ void this.ioHelper.notify(maker.msg(message2));
788
+ }
789
+ };
790
+
791
+ // ../tmp-toolkit-helpers/src/api/io/private/testing/test-io-host.ts
792
+ var TestIoHost = class {
793
+ constructor(level = "info") {
794
+ this.level = level;
795
+ this.notifySpy = jest.fn();
796
+ this.requestSpy = jest.fn();
797
+ }
798
+ notifySpy;
799
+ requestSpy;
800
+ requireDeployApproval = "never" /* NEVER */;
801
+ async notify(msg) {
802
+ if (isMessageRelevantForLevel(msg, this.level)) {
803
+ this.notifySpy(msg);
804
+ }
805
+ }
806
+ async requestResponse(msg) {
807
+ if (isMessageRelevantForLevel(msg, this.level) && this.needsApproval(msg)) {
808
+ this.requestSpy(msg);
809
+ }
810
+ return msg.defaultResponse;
811
+ }
812
+ needsApproval(msg) {
813
+ if (!["CDK_TOOLKIT_I5060"].includes(msg.code)) {
814
+ return true;
815
+ }
816
+ switch (this.requireDeployApproval) {
817
+ case "never" /* NEVER */:
818
+ return false;
819
+ case "any-change" /* ANY_CHANGE */:
820
+ return true;
821
+ case "broadening" /* BROADENING */:
822
+ return msg.data?.permissionChangeType === "broadening";
823
+ default:
824
+ return true;
825
+ }
826
+ }
827
+ };
828
+
829
+ // ../tmp-toolkit-helpers/src/api/io/private/testing/fake-io-host.ts
830
+ var FakeIoHost = class {
831
+ messages = [];
832
+ requestResponse;
833
+ constructor() {
834
+ this.clear();
835
+ }
836
+ clear() {
837
+ this.messages.splice(0, this.messages.length);
838
+ this.requestResponse = jest.fn().mockRejectedValue(new Error("requestResponse not mocked"));
839
+ }
840
+ async notify(msg) {
841
+ this.messages.push(msg);
842
+ }
843
+ expectMessage(m) {
844
+ expect(this.messages).toContainEqual(expect.objectContaining({
845
+ ...m.level ? { level: m.level } : void 0,
846
+ // Can be a partial string as well
847
+ message: expect.stringContaining(m.containing)
848
+ }));
849
+ }
850
+ };
72
851
  // Annotate the CommonJS export names for ESM import in node:
73
852
  0 && (module.exports = {
853
+ FakeIoHost,
854
+ IO,
855
+ IoDefaultMessages,
856
+ IoHelper,
857
+ SPAN,
858
+ SpanMaker,
859
+ TestIoHost,
860
+ asIoHelper,
861
+ confirm,
74
862
  debug,
75
863
  error,
76
864
  info,
865
+ isMessageRelevantForLevel,
77
866
  result,
78
867
  trace,
79
- warn,
80
- withAction
868
+ warn
81
869
  });
82
870
  //# sourceMappingURL=shared-private.js.map