@aws-cdk/toolkit-lib 0.1.7 → 0.1.8
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.
- package/build-info.json +2 -2
- package/db.json.gz +0 -0
- package/lib/actions/bootstrap/index.d.ts +0 -1
- package/lib/actions/bootstrap/index.js +13 -6
- package/lib/actions/diff/index.d.ts +19 -15
- package/lib/actions/diff/index.js +4 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/actions/index.js +2 -1
- package/lib/api/aws-cdk.d.ts +1 -1
- package/lib/api/aws-cdk.js +340 -216
- package/lib/api/aws-cdk.js.map +4 -4
- package/lib/api/cloud-assembly/private/prepare-source.d.ts +49 -39
- package/lib/api/cloud-assembly/private/prepare-source.js +113 -94
- package/lib/api/cloud-assembly/private/source-builder.js +9 -8
- package/lib/api/cloud-assembly/private/stack-assembly.d.ts +1 -1
- package/lib/api/cloud-assembly/private/stack-assembly.js +3 -3
- package/lib/api/shared-private.js +23 -0
- package/lib/api/shared-private.js.map +2 -2
- package/lib/api/shared-public.d.ts +492 -217
- package/lib/api/shared-public.js +904 -36
- package/lib/api/shared-public.js.map +4 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/private/dispose-polyfill.d.ts +1 -0
- package/lib/private/dispose-polyfill.js +20 -0
- package/lib/toolkit/private/index.d.ts +1 -1
- package/lib/toolkit/private/index.js +4 -4
- package/lib/toolkit/toolkit.d.ts +5 -0
- package/lib/toolkit/toolkit.js +143 -12
- package/package.json +19 -19
package/lib/api/aws-cdk.js
CHANGED
|
@@ -57,6 +57,7 @@ __export(aws_cdk_exports, {
|
|
|
57
57
|
StackCollection: () => StackCollection,
|
|
58
58
|
WorkGraphBuilder: () => WorkGraphBuilder,
|
|
59
59
|
contextproviders: () => context_providers_exports,
|
|
60
|
+
createDiffChangeSet: () => createDiffChangeSet,
|
|
60
61
|
findCloudWatchLogGroups: () => findCloudWatchLogGroups,
|
|
61
62
|
guessExecutable: () => guessExecutable,
|
|
62
63
|
loadTree: () => loadTree,
|
|
@@ -98,14 +99,104 @@ var path2 = __toESM(require("path"));
|
|
|
98
99
|
var fs3 = __toESM(require("fs-extra"));
|
|
99
100
|
|
|
100
101
|
// ../../aws-cdk/lib/logging.ts
|
|
101
|
-
var
|
|
102
|
+
var chalk5 = __toESM(require("chalk"));
|
|
102
103
|
|
|
103
104
|
// ../../aws-cdk/lib/cli/io-host/cli-io-host.ts
|
|
104
105
|
var util5 = __toESM(require("node:util"));
|
|
105
106
|
var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
|
|
106
|
-
var
|
|
107
|
+
var chalk4 = __toESM(require("chalk"));
|
|
107
108
|
var promptly = __toESM(require("promptly"));
|
|
108
109
|
|
|
110
|
+
// ../tmp-toolkit-helpers/src/api/diff/diff-formatter.ts
|
|
111
|
+
var cxschema = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
112
|
+
var import_cloudformation_diff = require("@aws-cdk/cloudformation-diff");
|
|
113
|
+
var chalk = __toESM(require("chalk"));
|
|
114
|
+
|
|
115
|
+
// ../tmp-toolkit-helpers/src/api/io/private/span.ts
|
|
116
|
+
var util = __toESM(require("node:util"));
|
|
117
|
+
var uuid = __toESM(require("uuid"));
|
|
118
|
+
|
|
119
|
+
// ../tmp-toolkit-helpers/src/util/archive.ts
|
|
120
|
+
var glob = __toESM(require("glob"));
|
|
121
|
+
|
|
122
|
+
// ../tmp-toolkit-helpers/src/util/format-error.ts
|
|
123
|
+
function formatErrorMessage(error2) {
|
|
124
|
+
if (error2 && Array.isArray(error2.errors)) {
|
|
125
|
+
const innerMessages = error2.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
|
|
126
|
+
return `AggregateError: ${innerMessages}`;
|
|
127
|
+
}
|
|
128
|
+
return error2?.message || error2?.toString() || "Unknown error";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ../tmp-toolkit-helpers/src/util/archive.ts
|
|
132
|
+
var archiver = require("archiver");
|
|
133
|
+
|
|
134
|
+
// ../tmp-toolkit-helpers/src/util/arrays.ts
|
|
135
|
+
function flatMap(xs, fn) {
|
|
136
|
+
return flatten(xs.map(fn));
|
|
137
|
+
}
|
|
138
|
+
function flatten(xs) {
|
|
139
|
+
return Array.prototype.concat.apply([], xs);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ../tmp-toolkit-helpers/src/util/cloudformation.ts
|
|
143
|
+
function stackEventHasErrorMessage(status) {
|
|
144
|
+
return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
|
|
145
|
+
}
|
|
146
|
+
function maxResourceTypeLength(template, startWidth = "AWS::CloudFormation::Stack".length) {
|
|
147
|
+
const resources = template && template.Resources || {};
|
|
148
|
+
let maxWidth = startWidth;
|
|
149
|
+
for (const id of Object.keys(resources)) {
|
|
150
|
+
const type = resources[id].Type || "";
|
|
151
|
+
if (type.length > maxWidth) {
|
|
152
|
+
maxWidth = type.length;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return maxWidth;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ../tmp-toolkit-helpers/src/util/content-hash.ts
|
|
159
|
+
var crypto = __toESM(require("crypto"));
|
|
160
|
+
function contentHash(data) {
|
|
161
|
+
return crypto.createHash("sha256").update(data).digest("hex");
|
|
162
|
+
}
|
|
163
|
+
function contentHashAny(value) {
|
|
164
|
+
const ret = crypto.createHash("sha256");
|
|
165
|
+
recurse(value);
|
|
166
|
+
return ret.digest("hex");
|
|
167
|
+
function recurse(x) {
|
|
168
|
+
if (typeof x === "string") {
|
|
169
|
+
ret.update(x);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (Array.isArray(x)) {
|
|
173
|
+
ret.update("[");
|
|
174
|
+
for (const e of x) {
|
|
175
|
+
recurse(e);
|
|
176
|
+
ret.update("||");
|
|
177
|
+
}
|
|
178
|
+
ret.update("]");
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (x && typeof x === "object") {
|
|
182
|
+
ret.update("{");
|
|
183
|
+
for (const key of Object.keys(x).sort()) {
|
|
184
|
+
ret.update(key);
|
|
185
|
+
ret.update(":");
|
|
186
|
+
recurse(x[key]);
|
|
187
|
+
}
|
|
188
|
+
ret.update("}");
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
ret.update(`${x}${typeof x}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ../tmp-toolkit-helpers/src/util/directories.ts
|
|
196
|
+
var fs = __toESM(require("fs"));
|
|
197
|
+
var os = __toESM(require("os"));
|
|
198
|
+
var path = __toESM(require("path"));
|
|
199
|
+
|
|
109
200
|
// ../tmp-toolkit-helpers/src/api/toolkit-error.ts
|
|
110
201
|
var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.ToolkitError");
|
|
111
202
|
var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit-lib.AuthenticationError");
|
|
@@ -218,90 +309,7 @@ var ContextProviderError = class _ContextProviderError extends ToolkitError {
|
|
|
218
309
|
}
|
|
219
310
|
};
|
|
220
311
|
|
|
221
|
-
// ../tmp-toolkit-helpers/src/api/io/private/span.ts
|
|
222
|
-
var util = __toESM(require("node:util"));
|
|
223
|
-
var uuid = __toESM(require("uuid"));
|
|
224
|
-
|
|
225
|
-
// ../tmp-toolkit-helpers/src/util/archive.ts
|
|
226
|
-
var glob = __toESM(require("glob"));
|
|
227
|
-
|
|
228
|
-
// ../tmp-toolkit-helpers/src/util/format-error.ts
|
|
229
|
-
function formatErrorMessage(error2) {
|
|
230
|
-
if (error2 && Array.isArray(error2.errors)) {
|
|
231
|
-
const innerMessages = error2.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
|
|
232
|
-
return `AggregateError: ${innerMessages}`;
|
|
233
|
-
}
|
|
234
|
-
return error2?.message || error2?.toString() || "Unknown error";
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// ../tmp-toolkit-helpers/src/util/archive.ts
|
|
238
|
-
var archiver = require("archiver");
|
|
239
|
-
|
|
240
|
-
// ../tmp-toolkit-helpers/src/util/arrays.ts
|
|
241
|
-
function flatMap(xs, fn) {
|
|
242
|
-
return flatten(xs.map(fn));
|
|
243
|
-
}
|
|
244
|
-
function flatten(xs) {
|
|
245
|
-
return Array.prototype.concat.apply([], xs);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// ../tmp-toolkit-helpers/src/util/cloudformation.ts
|
|
249
|
-
function stackEventHasErrorMessage(status) {
|
|
250
|
-
return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
|
|
251
|
-
}
|
|
252
|
-
function maxResourceTypeLength(template, startWidth = "AWS::CloudFormation::Stack".length) {
|
|
253
|
-
const resources = template && template.Resources || {};
|
|
254
|
-
let maxWidth = startWidth;
|
|
255
|
-
for (const id of Object.keys(resources)) {
|
|
256
|
-
const type = resources[id].Type || "";
|
|
257
|
-
if (type.length > maxWidth) {
|
|
258
|
-
maxWidth = type.length;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return maxWidth;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// ../tmp-toolkit-helpers/src/util/content-hash.ts
|
|
265
|
-
var crypto = __toESM(require("crypto"));
|
|
266
|
-
function contentHash(data) {
|
|
267
|
-
return crypto.createHash("sha256").update(data).digest("hex");
|
|
268
|
-
}
|
|
269
|
-
function contentHashAny(value) {
|
|
270
|
-
const ret = crypto.createHash("sha256");
|
|
271
|
-
recurse(value);
|
|
272
|
-
return ret.digest("hex");
|
|
273
|
-
function recurse(x) {
|
|
274
|
-
if (typeof x === "string") {
|
|
275
|
-
ret.update(x);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (Array.isArray(x)) {
|
|
279
|
-
ret.update("[");
|
|
280
|
-
for (const e of x) {
|
|
281
|
-
recurse(e);
|
|
282
|
-
ret.update("||");
|
|
283
|
-
}
|
|
284
|
-
ret.update("]");
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (x && typeof x === "object") {
|
|
288
|
-
ret.update("{");
|
|
289
|
-
for (const key of Object.keys(x).sort()) {
|
|
290
|
-
ret.update(key);
|
|
291
|
-
ret.update(":");
|
|
292
|
-
recurse(x[key]);
|
|
293
|
-
}
|
|
294
|
-
ret.update("}");
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
ret.update(`${x}${typeof x}`);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
312
|
// ../tmp-toolkit-helpers/src/util/directories.ts
|
|
302
|
-
var fs = __toESM(require("fs"));
|
|
303
|
-
var os = __toESM(require("os"));
|
|
304
|
-
var path = __toESM(require("path"));
|
|
305
313
|
function cdkHomeDir() {
|
|
306
314
|
const tmpDir = fs.realpathSync(os.tmpdir());
|
|
307
315
|
let home;
|
|
@@ -848,6 +856,16 @@ var IO = {
|
|
|
848
856
|
interface: "ErrorPayload"
|
|
849
857
|
}),
|
|
850
858
|
// 4: Diff (4xxx)
|
|
859
|
+
CDK_TOOLKIT_I4000: trace({
|
|
860
|
+
code: "CDK_TOOLKIT_I4000",
|
|
861
|
+
description: "Diff stacks is starting",
|
|
862
|
+
interface: "StackSelectionDetails"
|
|
863
|
+
}),
|
|
864
|
+
CDK_TOOLKIT_I4001: info({
|
|
865
|
+
code: "CDK_TOOLKIT_I4001",
|
|
866
|
+
description: "Output of the diff command",
|
|
867
|
+
interface: "DiffResult"
|
|
868
|
+
}),
|
|
851
869
|
// 5: Deploy & Watch (5xxx)
|
|
852
870
|
CDK_TOOLKIT_I5000: info({
|
|
853
871
|
code: "CDK_TOOLKIT_I5000",
|
|
@@ -1134,6 +1152,14 @@ var IO = {
|
|
|
1134
1152
|
code: "CDK_ASSEMBLY_I0000",
|
|
1135
1153
|
description: "Default debug messages emitted from Cloud Assembly operations"
|
|
1136
1154
|
}),
|
|
1155
|
+
DEFAULT_ASSEMBLY_INFO: info({
|
|
1156
|
+
code: "CDK_ASSEMBLY_I0000",
|
|
1157
|
+
description: "Default info messages emitted from Cloud Assembly operations"
|
|
1158
|
+
}),
|
|
1159
|
+
DEFAULT_ASSEMBLY_WARN: warn({
|
|
1160
|
+
code: "CDK_ASSEMBLY_W0000",
|
|
1161
|
+
description: "Default warning messages emitted from Cloud Assembly operations"
|
|
1162
|
+
}),
|
|
1137
1163
|
CDK_ASSEMBLY_I0010: debug({
|
|
1138
1164
|
code: "CDK_ASSEMBLY_I0010",
|
|
1139
1165
|
description: "Generic environment preparation debug messages"
|
|
@@ -1235,6 +1261,11 @@ var SPAN = {
|
|
|
1235
1261
|
start: IO.CDK_TOOLKIT_I6100,
|
|
1236
1262
|
end: IO.CDK_TOOLKIT_I6000
|
|
1237
1263
|
},
|
|
1264
|
+
DIFF_STACK: {
|
|
1265
|
+
name: "Diff",
|
|
1266
|
+
start: IO.CDK_TOOLKIT_I4000,
|
|
1267
|
+
end: IO.CDK_TOOLKIT_I4001
|
|
1268
|
+
},
|
|
1238
1269
|
DESTROY_STACK: {
|
|
1239
1270
|
name: "Destroy",
|
|
1240
1271
|
start: IO.CDK_TOOLKIT_I7100,
|
|
@@ -1313,6 +1344,14 @@ var IoDefaultMessages = class {
|
|
|
1313
1344
|
}
|
|
1314
1345
|
};
|
|
1315
1346
|
|
|
1347
|
+
// ../tmp-toolkit-helpers/src/api/resource-import/importer.ts
|
|
1348
|
+
function removeNonImportResources(stack) {
|
|
1349
|
+
const template = stack.template;
|
|
1350
|
+
delete template.Resources.CDKMetadata;
|
|
1351
|
+
delete template.Outputs;
|
|
1352
|
+
return template;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1316
1355
|
// ../../aws-cdk/lib/cli/activity-printer/base.ts
|
|
1317
1356
|
var ActivityPrinterBase = class {
|
|
1318
1357
|
constructor(props) {
|
|
@@ -1419,7 +1458,7 @@ var ActivityPrinterBase = class {
|
|
|
1419
1458
|
|
|
1420
1459
|
// ../../aws-cdk/lib/cli/activity-printer/history.ts
|
|
1421
1460
|
var util3 = __toESM(require("util"));
|
|
1422
|
-
var
|
|
1461
|
+
var chalk2 = __toESM(require("chalk"));
|
|
1423
1462
|
var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrinterBase {
|
|
1424
1463
|
constructor(props) {
|
|
1425
1464
|
super(props);
|
|
@@ -1462,7 +1501,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
1462
1501
|
printOne(activity, progress) {
|
|
1463
1502
|
const event = activity.event;
|
|
1464
1503
|
const color = colorFromStatusResult(event.ResourceStatus);
|
|
1465
|
-
let reasonColor =
|
|
1504
|
+
let reasonColor = chalk2.cyan;
|
|
1466
1505
|
let stackTrace = "";
|
|
1467
1506
|
const metadata = activity.metadata;
|
|
1468
1507
|
if (event.ResourceStatus && event.ResourceStatus.indexOf("FAILED") !== -1) {
|
|
@@ -1473,7 +1512,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
1473
1512
|
stackTrace = metadata.entry.trace ? `
|
|
1474
1513
|
${metadata.entry.trace.join("\n \\_ ")}` : "";
|
|
1475
1514
|
}
|
|
1476
|
-
reasonColor =
|
|
1515
|
+
reasonColor = chalk2.red;
|
|
1477
1516
|
}
|
|
1478
1517
|
const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
|
|
1479
1518
|
const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
|
|
@@ -1486,9 +1525,9 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
1486
1525
|
color(padRight(_HistoryActivityPrinter.STATUS_WIDTH, (event.ResourceStatus || "").slice(0, _HistoryActivityPrinter.STATUS_WIDTH))),
|
|
1487
1526
|
// pad left and trim
|
|
1488
1527
|
padRight(this.resourceTypeColumnWidth, event.ResourceType || ""),
|
|
1489
|
-
color(
|
|
1528
|
+
color(chalk2.bold(resourceName)),
|
|
1490
1529
|
logicalId,
|
|
1491
|
-
reasonColor(
|
|
1530
|
+
reasonColor(chalk2.bold(event.ResourceStatusReason ? event.ResourceStatusReason : "")),
|
|
1492
1531
|
reasonColor(stackTrace)
|
|
1493
1532
|
)
|
|
1494
1533
|
);
|
|
@@ -1506,7 +1545,7 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
1506
1545
|
util3.format(
|
|
1507
1546
|
"%s Currently in progress: %s\n",
|
|
1508
1547
|
progress,
|
|
1509
|
-
|
|
1548
|
+
chalk2.bold(Object.keys(this.resourcesInProgress).join(", "))
|
|
1510
1549
|
)
|
|
1511
1550
|
);
|
|
1512
1551
|
}
|
|
@@ -1515,23 +1554,23 @@ var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrint
|
|
|
1515
1554
|
};
|
|
1516
1555
|
function colorFromStatusResult(status) {
|
|
1517
1556
|
if (!status) {
|
|
1518
|
-
return
|
|
1557
|
+
return chalk2.reset;
|
|
1519
1558
|
}
|
|
1520
1559
|
if (status.indexOf("FAILED") !== -1) {
|
|
1521
|
-
return
|
|
1560
|
+
return chalk2.red;
|
|
1522
1561
|
}
|
|
1523
1562
|
if (status.indexOf("ROLLBACK") !== -1) {
|
|
1524
|
-
return
|
|
1563
|
+
return chalk2.yellow;
|
|
1525
1564
|
}
|
|
1526
1565
|
if (status.indexOf("COMPLETE") !== -1) {
|
|
1527
|
-
return
|
|
1566
|
+
return chalk2.green;
|
|
1528
1567
|
}
|
|
1529
|
-
return
|
|
1568
|
+
return chalk2.reset;
|
|
1530
1569
|
}
|
|
1531
1570
|
|
|
1532
1571
|
// ../../aws-cdk/lib/cli/activity-printer/current.ts
|
|
1533
1572
|
var util4 = __toESM(require("util"));
|
|
1534
|
-
var
|
|
1573
|
+
var chalk3 = __toESM(require("chalk"));
|
|
1535
1574
|
|
|
1536
1575
|
// ../../aws-cdk/lib/cli/activity-printer/display.ts
|
|
1537
1576
|
var wrapAnsi = require("wrap-ansi");
|
|
@@ -1619,7 +1658,7 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
1619
1658
|
padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(res.event.Timestamp).toLocaleTimeString()),
|
|
1620
1659
|
color(padRight(_CurrentActivityPrinter.STATUS_WIDTH, (res.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH))),
|
|
1621
1660
|
padRight(this.resourceTypeColumnWidth, res.event.ResourceType || ""),
|
|
1622
|
-
color(
|
|
1661
|
+
color(chalk3.bold(shorten(40, resourceName))),
|
|
1623
1662
|
this.failureReasonOnNextLine(res)
|
|
1624
1663
|
);
|
|
1625
1664
|
})
|
|
@@ -1635,7 +1674,7 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
1635
1674
|
}
|
|
1636
1675
|
lines.push(
|
|
1637
1676
|
util4.format(
|
|
1638
|
-
|
|
1677
|
+
chalk3.red("%s | %s | %s | %s%s") + "\n",
|
|
1639
1678
|
padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
|
|
1640
1679
|
padRight(_CurrentActivityPrinter.STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH)),
|
|
1641
1680
|
padRight(this.resourceTypeColumnWidth, failure.event.ResourceType || ""),
|
|
@@ -1643,9 +1682,9 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
1643
1682
|
this.failureReasonOnNextLine(failure)
|
|
1644
1683
|
)
|
|
1645
1684
|
);
|
|
1646
|
-
const
|
|
1647
|
-
if (
|
|
1648
|
-
lines.push(
|
|
1685
|
+
const trace2 = failure.metadata?.entry?.trace;
|
|
1686
|
+
if (trace2) {
|
|
1687
|
+
lines.push(chalk3.red(` ${trace2.join("\n \\_ ")}
|
|
1649
1688
|
`));
|
|
1650
1689
|
}
|
|
1651
1690
|
}
|
|
@@ -1663,12 +1702,12 @@ var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrint
|
|
|
1663
1702
|
const fullChars = FULL_BLOCK.repeat(Math.floor(chars));
|
|
1664
1703
|
const partialChar = PARTIAL_BLOCK[Math.floor(remainder * PARTIAL_BLOCK.length)];
|
|
1665
1704
|
const filler = "\xB7".repeat(innerWidth - Math.floor(chars) - (partialChar ? 1 : 0));
|
|
1666
|
-
const color = this.rollingBack ?
|
|
1705
|
+
const color = this.rollingBack ? chalk3.yellow : chalk3.green;
|
|
1667
1706
|
return "[" + color(fullChars + partialChar) + filler + `] (${this.stackProgress.completed}/${this.stackProgress.total})`;
|
|
1668
1707
|
}
|
|
1669
1708
|
failureReasonOnNextLine(activity) {
|
|
1670
1709
|
return stackEventHasErrorMessage(activity.event.ResourceStatus ?? "") ? `
|
|
1671
|
-
${" ".repeat(_CurrentActivityPrinter.TIMESTAMP_WIDTH + _CurrentActivityPrinter.STATUS_WIDTH + 6)}${
|
|
1710
|
+
${" ".repeat(_CurrentActivityPrinter.TIMESTAMP_WIDTH + _CurrentActivityPrinter.STATUS_WIDTH + 6)}${chalk3.red(this.failureReason(activity) ?? "")}` : "";
|
|
1672
1711
|
}
|
|
1673
1712
|
};
|
|
1674
1713
|
var FULL_BLOCK = "\u2588";
|
|
@@ -1678,21 +1717,21 @@ var MIN_PROGRESSBAR_WIDTH = 10;
|
|
|
1678
1717
|
var PROGRESSBAR_EXTRA_SPACE = 2 + 2 + 4 + 6;
|
|
1679
1718
|
function colorFromStatusActivity(status) {
|
|
1680
1719
|
if (!status) {
|
|
1681
|
-
return
|
|
1720
|
+
return chalk3.reset;
|
|
1682
1721
|
}
|
|
1683
1722
|
if (status.endsWith("_FAILED")) {
|
|
1684
|
-
return
|
|
1723
|
+
return chalk3.red;
|
|
1685
1724
|
}
|
|
1686
1725
|
if (status.startsWith("CREATE_") || status.startsWith("UPDATE_") || status.startsWith("IMPORT_")) {
|
|
1687
|
-
return
|
|
1726
|
+
return chalk3.green;
|
|
1688
1727
|
}
|
|
1689
1728
|
if (status.indexOf("ROLLBACK_") !== -1) {
|
|
1690
|
-
return
|
|
1729
|
+
return chalk3.yellow;
|
|
1691
1730
|
}
|
|
1692
1731
|
if (status.startsWith("DELETE_")) {
|
|
1693
|
-
return
|
|
1732
|
+
return chalk3.yellow;
|
|
1694
1733
|
}
|
|
1695
|
-
return
|
|
1734
|
+
return chalk3.reset;
|
|
1696
1735
|
}
|
|
1697
1736
|
function shorten(maxWidth, p) {
|
|
1698
1737
|
if (p.length <= maxWidth) {
|
|
@@ -1905,14 +1944,14 @@ var CliIoHost = class _CliIoHost {
|
|
|
1905
1944
|
return true;
|
|
1906
1945
|
}
|
|
1907
1946
|
if (isConfirmationPrompt(msg)) {
|
|
1908
|
-
const confirmed = await promptly.confirm(`${
|
|
1947
|
+
const confirmed = await promptly.confirm(`${chalk4.cyan(msg.message)} (y/n)`);
|
|
1909
1948
|
if (!confirmed) {
|
|
1910
1949
|
throw new ToolkitError("Aborted by user");
|
|
1911
1950
|
}
|
|
1912
1951
|
return confirmed;
|
|
1913
1952
|
}
|
|
1914
1953
|
const prompt4 = extractPromptInfo(msg);
|
|
1915
|
-
const answer = await promptly.prompt(`${
|
|
1954
|
+
const answer = await promptly.prompt(`${chalk4.cyan(msg.message)} (${prompt4.default})`, {
|
|
1916
1955
|
default: prompt4.default
|
|
1917
1956
|
});
|
|
1918
1957
|
return prompt4.convertAnswer(answer);
|
|
@@ -1962,12 +2001,12 @@ function extractPromptInfo(msg) {
|
|
|
1962
2001
|
};
|
|
1963
2002
|
}
|
|
1964
2003
|
var styleMap = {
|
|
1965
|
-
error:
|
|
1966
|
-
warn:
|
|
1967
|
-
result:
|
|
1968
|
-
info:
|
|
1969
|
-
debug:
|
|
1970
|
-
trace:
|
|
2004
|
+
error: chalk4.red,
|
|
2005
|
+
warn: chalk4.yellow,
|
|
2006
|
+
result: chalk4.white,
|
|
2007
|
+
info: chalk4.white,
|
|
2008
|
+
debug: chalk4.gray,
|
|
2009
|
+
trace: chalk4.gray
|
|
1971
2010
|
};
|
|
1972
2011
|
function isCI() {
|
|
1973
2012
|
return process.env.CI !== void 0 && process.env.CI !== "false" && process.env.CI !== "0";
|
|
@@ -2005,9 +2044,6 @@ function formatMessageAndLog(level, input, ...args) {
|
|
|
2005
2044
|
var warning = (input, ...args) => {
|
|
2006
2045
|
return formatMessageAndLog("warn", input, ...args);
|
|
2007
2046
|
};
|
|
2008
|
-
var info2 = (input, ...args) => {
|
|
2009
|
-
return formatMessageAndLog("info", input, ...args);
|
|
2010
|
-
};
|
|
2011
2047
|
var debug2 = (input, ...args) => {
|
|
2012
2048
|
return formatMessageAndLog("debug", input, ...args);
|
|
2013
2049
|
};
|
|
@@ -3299,15 +3335,15 @@ var Context = class {
|
|
|
3299
3335
|
// ../../aws-cdk/lib/api/deployments/deployments.ts
|
|
3300
3336
|
var import_crypto = require("crypto");
|
|
3301
3337
|
var cdk_assets = __toESM(require("cdk-assets"));
|
|
3302
|
-
var
|
|
3338
|
+
var chalk12 = __toESM(require("chalk"));
|
|
3303
3339
|
|
|
3304
3340
|
// ../../aws-cdk/lib/api/deployments/asset-manifest-builder.ts
|
|
3305
|
-
var
|
|
3341
|
+
var cxschema2 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
3306
3342
|
var import_cdk_assets = require("cdk-assets");
|
|
3307
3343
|
var AssetManifestBuilder = class {
|
|
3308
3344
|
constructor() {
|
|
3309
3345
|
this.manifest = {
|
|
3310
|
-
version:
|
|
3346
|
+
version: cxschema2.Manifest.version(),
|
|
3311
3347
|
files: {},
|
|
3312
3348
|
dockerImages: {}
|
|
3313
3349
|
};
|
|
@@ -3889,7 +3925,7 @@ var util6 = __toESM(require("node:util"));
|
|
|
3889
3925
|
var import_cx_api3 = require("@aws-cdk/cx-api");
|
|
3890
3926
|
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
3891
3927
|
var import_middleware_endpoint2 = require("@smithy/middleware-endpoint");
|
|
3892
|
-
var
|
|
3928
|
+
var chalk6 = __toESM(require("chalk"));
|
|
3893
3929
|
var LARGE_TEMPLATE_SIZE_KB = 50;
|
|
3894
3930
|
async function makeBodyParameter(ioHelper, stack, resolvedEnvironment, assetManifest, resources, overrideTemplate) {
|
|
3895
3931
|
if (stack.stackTemplateAssetObjectUrl && !overrideTemplate) {
|
|
@@ -3909,7 +3945,7 @@ async function makeBodyParameter(ioHelper, stack, resolvedEnvironment, assetMani
|
|
|
3909
3945
|
Run the following command in order to setup an S3 bucket in this environment, and then re-deploy:
|
|
3910
3946
|
|
|
3911
3947
|
`,
|
|
3912
|
-
|
|
3948
|
+
chalk6.blue(` $ cdk bootstrap ${resolvedEnvironment.name}
|
|
3913
3949
|
`)
|
|
3914
3950
|
))
|
|
3915
3951
|
);
|
|
@@ -4637,6 +4673,15 @@ async function waitForChangeSet(cfn, ioHelper, stackName, changeSetName, { fetch
|
|
|
4637
4673
|
}
|
|
4638
4674
|
return ret;
|
|
4639
4675
|
}
|
|
4676
|
+
async function createDiffChangeSet(ioHelper, options) {
|
|
4677
|
+
for (const resource of Object.values(options.stack.template.Resources ?? {})) {
|
|
4678
|
+
if (resource.Type === "AWS::CloudFormation::Stack") {
|
|
4679
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg("This stack contains one or more nested stacks, falling back to template-only diff..."));
|
|
4680
|
+
return void 0;
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
return uploadBodyParameterAndCreateChangeSet(ioHelper, options);
|
|
4684
|
+
}
|
|
4640
4685
|
function templatesFromAssetManifestArtifact(artifact) {
|
|
4641
4686
|
const assets = [];
|
|
4642
4687
|
const fileName = artifact.file;
|
|
@@ -4651,6 +4696,43 @@ function templatesFromAssetManifestArtifact(artifact) {
|
|
|
4651
4696
|
});
|
|
4652
4697
|
return [assetManifest, assets];
|
|
4653
4698
|
}
|
|
4699
|
+
async function uploadBodyParameterAndCreateChangeSet(ioHelper, options) {
|
|
4700
|
+
try {
|
|
4701
|
+
await uploadStackTemplateAssets(options.stack, options.deployments);
|
|
4702
|
+
const env = await options.deployments.envs.accessStackForMutableStackOperations(options.stack);
|
|
4703
|
+
const bodyParameter = await makeBodyParameter(
|
|
4704
|
+
ioHelper,
|
|
4705
|
+
options.stack,
|
|
4706
|
+
env.resolvedEnvironment,
|
|
4707
|
+
new AssetManifestBuilder(),
|
|
4708
|
+
env.resources
|
|
4709
|
+
);
|
|
4710
|
+
const cfn = env.sdk.cloudFormation();
|
|
4711
|
+
const exists = (await CloudFormationStack.lookup(cfn, options.stack.stackName, false)).exists;
|
|
4712
|
+
const executionRoleArn = await env.replacePlaceholders(options.stack.cloudFormationExecutionRoleArn);
|
|
4713
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(
|
|
4714
|
+
"Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)\n"
|
|
4715
|
+
));
|
|
4716
|
+
return await createChangeSet(ioHelper, {
|
|
4717
|
+
cfn,
|
|
4718
|
+
changeSetName: "cdk-diff-change-set",
|
|
4719
|
+
stack: options.stack,
|
|
4720
|
+
exists,
|
|
4721
|
+
uuid: options.uuid,
|
|
4722
|
+
willExecute: options.willExecute,
|
|
4723
|
+
bodyParameter,
|
|
4724
|
+
parameters: options.parameters,
|
|
4725
|
+
resourcesToImport: options.resourcesToImport,
|
|
4726
|
+
role: executionRoleArn
|
|
4727
|
+
});
|
|
4728
|
+
} catch (e) {
|
|
4729
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(String(e)));
|
|
4730
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(
|
|
4731
|
+
"Could not create a change set, will base the diff on template differences (run again with -v to see the reason)\n"
|
|
4732
|
+
));
|
|
4733
|
+
return void 0;
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4654
4736
|
async function uploadStackTemplateAssets(stack, deployments) {
|
|
4655
4737
|
for (const artifact of stack.dependencies) {
|
|
4656
4738
|
if (!cxapi.AssetManifestArtifact.isAssetManifestArtifact(artifact)) {
|
|
@@ -4667,6 +4749,45 @@ async function uploadStackTemplateAssets(stack, deployments) {
|
|
|
4667
4749
|
}
|
|
4668
4750
|
}
|
|
4669
4751
|
}
|
|
4752
|
+
async function createChangeSet(ioHelper, options) {
|
|
4753
|
+
await cleanupOldChangeset(options.cfn, ioHelper, options.changeSetName, options.stack.stackName);
|
|
4754
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Attempting to create ChangeSet with name ${options.changeSetName} for stack ${options.stack.stackName}`));
|
|
4755
|
+
const templateParams = TemplateParameters.fromTemplate(options.stack.template);
|
|
4756
|
+
const stackParams = templateParams.supplyAll(options.parameters);
|
|
4757
|
+
const changeSet = await options.cfn.createChangeSet({
|
|
4758
|
+
StackName: options.stack.stackName,
|
|
4759
|
+
ChangeSetName: options.changeSetName,
|
|
4760
|
+
ChangeSetType: options.resourcesToImport ? "IMPORT" : options.exists ? "UPDATE" : "CREATE",
|
|
4761
|
+
Description: `CDK Changeset for diff ${options.uuid}`,
|
|
4762
|
+
ClientToken: `diff${options.uuid}`,
|
|
4763
|
+
TemplateURL: options.bodyParameter.TemplateURL,
|
|
4764
|
+
TemplateBody: options.bodyParameter.TemplateBody,
|
|
4765
|
+
Parameters: stackParams.apiParameters,
|
|
4766
|
+
ResourcesToImport: options.resourcesToImport,
|
|
4767
|
+
RoleARN: options.role,
|
|
4768
|
+
Tags: toCfnTags(options.stack.tags),
|
|
4769
|
+
Capabilities: ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
|
|
4770
|
+
});
|
|
4771
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg((0, import_util21.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
|
|
4772
|
+
const createdChangeSet = await waitForChangeSet(options.cfn, ioHelper, options.stack.stackName, options.changeSetName, {
|
|
4773
|
+
fetchAll: options.willExecute
|
|
4774
|
+
});
|
|
4775
|
+
await cleanupOldChangeset(options.cfn, ioHelper, options.changeSetName, options.stack.stackName);
|
|
4776
|
+
return createdChangeSet;
|
|
4777
|
+
}
|
|
4778
|
+
function toCfnTags(tags) {
|
|
4779
|
+
return Object.entries(tags).map(([k, v]) => ({
|
|
4780
|
+
Key: k,
|
|
4781
|
+
Value: v
|
|
4782
|
+
}));
|
|
4783
|
+
}
|
|
4784
|
+
async function cleanupOldChangeset(cfn, ioHelper, changeSetName, stackName) {
|
|
4785
|
+
await ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Removing existing change set with name ${changeSetName} if it exists`));
|
|
4786
|
+
await cfn.deleteChangeSet({
|
|
4787
|
+
StackName: stackName,
|
|
4788
|
+
ChangeSetName: changeSetName
|
|
4789
|
+
});
|
|
4790
|
+
}
|
|
4670
4791
|
function changeSetHasNoChanges(description) {
|
|
4671
4792
|
const noChangeErrorPrefixes = [
|
|
4672
4793
|
// Error message for a regular template
|
|
@@ -4855,14 +4976,14 @@ async function getBootstrapStackInfo(sdk, stackName) {
|
|
|
4855
4976
|
|
|
4856
4977
|
// ../../aws-cdk/lib/api/deployments/deploy-stack.ts
|
|
4857
4978
|
var import_util28 = require("util");
|
|
4858
|
-
var
|
|
4979
|
+
var chalk9 = __toESM(require("chalk"));
|
|
4859
4980
|
var uuid3 = __toESM(require("uuid"));
|
|
4860
4981
|
|
|
4861
4982
|
// ../../aws-cdk/lib/api/deployments/assets.ts
|
|
4862
4983
|
var path6 = __toESM(require("path"));
|
|
4863
|
-
var
|
|
4984
|
+
var cxschema3 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
4864
4985
|
var cxapi2 = __toESM(require("@aws-cdk/cx-api"));
|
|
4865
|
-
var
|
|
4986
|
+
var chalk7 = __toESM(require("chalk"));
|
|
4866
4987
|
async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envResources, reuse) {
|
|
4867
4988
|
reuse = reuse || [];
|
|
4868
4989
|
const assets = stack.assets;
|
|
@@ -4871,7 +4992,7 @@ async function addMetadataAssetsToManifest(ioHelper, stack, assetManifest, envRe
|
|
|
4871
4992
|
}
|
|
4872
4993
|
const toolkitInfo = await envResources.lookupToolkit();
|
|
4873
4994
|
if (!toolkitInfo.found) {
|
|
4874
|
-
throw new ToolkitError(`This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${
|
|
4995
|
+
throw new ToolkitError(`This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${chalk7.blue("cdk bootstrap " + stack.environment.name)}")`);
|
|
4875
4996
|
}
|
|
4876
4997
|
const params = {};
|
|
4877
4998
|
for (const asset of assets) {
|
|
@@ -4897,7 +5018,7 @@ async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolki
|
|
|
4897
5018
|
asset,
|
|
4898
5019
|
assetManifest,
|
|
4899
5020
|
toolkitInfo,
|
|
4900
|
-
asset.packaging === "zip" ?
|
|
5021
|
+
asset.packaging === "zip" ? cxschema3.FileAssetPackaging.ZIP_DIRECTORY : cxschema3.FileAssetPackaging.FILE
|
|
4901
5022
|
);
|
|
4902
5023
|
case "container-image":
|
|
4903
5024
|
return prepareDockerImageAsset(asset, assetManifest, envResources);
|
|
@@ -4906,7 +5027,7 @@ async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolki
|
|
|
4906
5027
|
}
|
|
4907
5028
|
}
|
|
4908
5029
|
async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
|
|
4909
|
-
const extension = packaging ===
|
|
5030
|
+
const extension = packaging === cxschema3.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path6.extname(asset.path);
|
|
4910
5031
|
const baseName = `${asset.sourceHash}${extension}`;
|
|
4911
5032
|
const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
|
|
4912
5033
|
const key = `${s3Prefix}${baseName}`;
|
|
@@ -4954,7 +5075,7 @@ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
|
|
|
4954
5075
|
// ../../aws-cdk/lib/api/deployments/hotswap-deployments.ts
|
|
4955
5076
|
var import_util26 = require("util");
|
|
4956
5077
|
var cfn_diff = __toESM(require("@aws-cdk/cloudformation-diff"));
|
|
4957
|
-
var
|
|
5078
|
+
var chalk8 = __toESM(require("chalk"));
|
|
4958
5079
|
|
|
4959
5080
|
// ../../aws-cdk/lib/api/hotswap/common.ts
|
|
4960
5081
|
var ICON = "\u2728";
|
|
@@ -6118,7 +6239,7 @@ async function applyHotswapOperation(sdk, ioSpan, hotswapOperation) {
|
|
|
6118
6239
|
sdk.appendCustomUserAgent(customUserAgent);
|
|
6119
6240
|
const resourceText = (r) => r.description ?? `${r.resourceType} '${r.physicalName ?? r.logicalId}'`;
|
|
6120
6241
|
await ioSpan.notify(IO.CDK_TOOLKIT_I5402.msg(
|
|
6121
|
-
hotswapOperation.change.resources.map((r) => (0, import_util26.format)(` ${ICON} %s`,
|
|
6242
|
+
hotswapOperation.change.resources.map((r) => (0, import_util26.format)(` ${ICON} %s`, chalk8.bold(resourceText(r)))).join("\n"),
|
|
6122
6243
|
hotswapOperation.change
|
|
6123
6244
|
));
|
|
6124
6245
|
try {
|
|
@@ -6133,7 +6254,7 @@ async function applyHotswapOperation(sdk, ioSpan, hotswapOperation) {
|
|
|
6133
6254
|
throw e;
|
|
6134
6255
|
}
|
|
6135
6256
|
await ioSpan.notify(IO.CDK_TOOLKIT_I5403.msg(
|
|
6136
|
-
hotswapOperation.change.resources.map((r) => (0, import_util26.format)(` ${ICON} %s %s`,
|
|
6257
|
+
hotswapOperation.change.resources.map((r) => (0, import_util26.format)(` ${ICON} %s %s`, chalk8.bold(resourceText(r)), chalk8.green("hotswapped!"))).join("\n"),
|
|
6137
6258
|
hotswapOperation.change
|
|
6138
6259
|
));
|
|
6139
6260
|
sdk.removeCustomUserAgent(customUserAgent);
|
|
@@ -6162,9 +6283,9 @@ async function logRejectedChanges(ioSpan, rejectedChanges, hotswapMode) {
|
|
|
6162
6283
|
}
|
|
6163
6284
|
const messages = [""];
|
|
6164
6285
|
if (hotswapMode === "hotswap-only") {
|
|
6165
|
-
messages.push((0, import_util26.format)("%s %s",
|
|
6286
|
+
messages.push((0, import_util26.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
|
|
6166
6287
|
} else {
|
|
6167
|
-
messages.push((0, import_util26.format)("%s %s",
|
|
6288
|
+
messages.push((0, import_util26.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
|
|
6168
6289
|
}
|
|
6169
6290
|
for (const { change } of rejectedChanges) {
|
|
6170
6291
|
messages.push(" " + nonHotswappableChangeMessage(change));
|
|
@@ -6179,8 +6300,8 @@ function nonHotswappableChangeMessage(change) {
|
|
|
6179
6300
|
case "Output":
|
|
6180
6301
|
return (0, import_util26.format)(
|
|
6181
6302
|
"output: %s, reason: %s",
|
|
6182
|
-
|
|
6183
|
-
|
|
6303
|
+
chalk8.bold(subject.logicalId),
|
|
6304
|
+
chalk8.red(reason)
|
|
6184
6305
|
);
|
|
6185
6306
|
case "Resource":
|
|
6186
6307
|
return nonHotswappableResourceMessage(subject, reason);
|
|
@@ -6190,17 +6311,17 @@ function nonHotswappableResourceMessage(subject, reason) {
|
|
|
6190
6311
|
if (subject.rejectedProperties?.length) {
|
|
6191
6312
|
return (0, import_util26.format)(
|
|
6192
6313
|
"resource: %s, type: %s, rejected changes: %s, reason: %s",
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6314
|
+
chalk8.bold(subject.logicalId),
|
|
6315
|
+
chalk8.bold(subject.resourceType),
|
|
6316
|
+
chalk8.bold(subject.rejectedProperties),
|
|
6317
|
+
chalk8.red(reason)
|
|
6197
6318
|
);
|
|
6198
6319
|
}
|
|
6199
6320
|
return (0, import_util26.format)(
|
|
6200
6321
|
"resource: %s, type: %s, reason: %s",
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6322
|
+
chalk8.bold(subject.logicalId),
|
|
6323
|
+
chalk8.bold(subject.resourceType),
|
|
6324
|
+
chalk8.red(reason)
|
|
6204
6325
|
);
|
|
6205
6326
|
}
|
|
6206
6327
|
|
|
@@ -6246,7 +6367,7 @@ async function deployStack(options, ioHelper) {
|
|
|
6246
6367
|
`
|
|
6247
6368
|
${ICON} %s
|
|
6248
6369
|
`,
|
|
6249
|
-
|
|
6370
|
+
chalk9.bold("hotswap deployment skipped - no changes were detected (use --force to override)")
|
|
6250
6371
|
)
|
|
6251
6372
|
));
|
|
6252
6373
|
}
|
|
@@ -6416,7 +6537,7 @@ var FullCloudFormationDeployment = class {
|
|
|
6416
6537
|
async createChangeSet(changeSetName, willExecute, importExistingResources) {
|
|
6417
6538
|
await this.cleanupOldChangeset(changeSetName);
|
|
6418
6539
|
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_DEBUG.msg(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
|
|
6419
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util28.format)("%s: creating CloudFormation changeset...",
|
|
6540
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util28.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
|
|
6420
6541
|
const changeSet = await this.cfn.createChangeSet({
|
|
6421
6542
|
StackName: this.stackName,
|
|
6422
6543
|
ChangeSetName: changeSetName,
|
|
@@ -6478,7 +6599,7 @@ var FullCloudFormationDeployment = class {
|
|
|
6478
6599
|
}
|
|
6479
6600
|
}
|
|
6480
6601
|
async directDeployment() {
|
|
6481
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util28.format)("%s: %s stack...",
|
|
6602
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util28.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
|
|
6482
6603
|
const startTime = /* @__PURE__ */ new Date();
|
|
6483
6604
|
if (this.update) {
|
|
6484
6605
|
await this.updateTerminationProtection();
|
|
@@ -6685,28 +6806,28 @@ function some(node, predicate) {
|
|
|
6685
6806
|
return Object.values(node?.children ?? {}).some((child) => some(child, predicate));
|
|
6686
6807
|
}
|
|
6687
6808
|
}
|
|
6688
|
-
function loadTree(assembly,
|
|
6809
|
+
async function loadTree(assembly, trace2) {
|
|
6689
6810
|
try {
|
|
6690
6811
|
const outdir = assembly.directory;
|
|
6691
6812
|
const fileName = assembly.tree()?.file;
|
|
6692
6813
|
return fileName ? fs8.readJSONSync(path7.join(outdir, fileName)).tree : {};
|
|
6693
6814
|
} catch (e) {
|
|
6694
|
-
|
|
6815
|
+
await trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
6695
6816
|
return void 0;
|
|
6696
6817
|
}
|
|
6697
6818
|
}
|
|
6698
|
-
function loadTreeFromDir(outdir,
|
|
6819
|
+
function loadTreeFromDir(outdir, trace2) {
|
|
6699
6820
|
try {
|
|
6700
6821
|
return fs8.readJSONSync(path7.join(outdir, "tree.json")).tree;
|
|
6701
6822
|
} catch (e) {
|
|
6702
|
-
|
|
6823
|
+
trace2(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
6703
6824
|
return void 0;
|
|
6704
6825
|
}
|
|
6705
6826
|
}
|
|
6706
6827
|
|
|
6707
6828
|
// ../../aws-cdk/lib/cli/version.ts
|
|
6708
6829
|
var path9 = __toESM(require("path"));
|
|
6709
|
-
var
|
|
6830
|
+
var chalk10 = __toESM(require("chalk"));
|
|
6710
6831
|
var fs10 = __toESM(require("fs-extra"));
|
|
6711
6832
|
var semver3 = __toESM(require("semver"));
|
|
6712
6833
|
|
|
@@ -7129,7 +7250,7 @@ var CachedDataSource = class {
|
|
|
7129
7250
|
|
|
7130
7251
|
// ../../aws-cdk/lib/api/toolkit-info.ts
|
|
7131
7252
|
var import_util33 = require("util");
|
|
7132
|
-
var
|
|
7253
|
+
var chalk11 = __toESM(require("chalk"));
|
|
7133
7254
|
|
|
7134
7255
|
// ../../aws-cdk/lib/api/bootstrap/bootstrap-props.ts
|
|
7135
7256
|
var BUCKET_NAME_OUTPUT = "BucketName";
|
|
@@ -7157,7 +7278,7 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
7157
7278
|
"The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
|
|
7158
7279
|
environment.name,
|
|
7159
7280
|
stackName,
|
|
7160
|
-
|
|
7281
|
+
chalk11.blue(`cdk bootstrap "${environment.name}"`)
|
|
7161
7282
|
)
|
|
7162
7283
|
));
|
|
7163
7284
|
return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
|
|
@@ -7168,7 +7289,7 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
7168
7289
|
"The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
|
|
7169
7290
|
environment.name,
|
|
7170
7291
|
stackName,
|
|
7171
|
-
|
|
7292
|
+
chalk11.blue(`cdk bootstrap "${environment.name}"`)
|
|
7172
7293
|
)
|
|
7173
7294
|
));
|
|
7174
7295
|
return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
|
|
@@ -7921,7 +8042,7 @@ var Deployments = class {
|
|
|
7921
8042
|
if (existing) {
|
|
7922
8043
|
return existing;
|
|
7923
8044
|
}
|
|
7924
|
-
const prefix = stackName ? `${
|
|
8045
|
+
const prefix = stackName ? `${chalk12.bold(stackName)}: ` : "";
|
|
7925
8046
|
const publisher = new cdk_assets.AssetPublishing(assetManifest, {
|
|
7926
8047
|
// The AssetPublishing class takes care of role assuming etc, so it's okay to
|
|
7927
8048
|
// give it a direct `SdkProvider`.
|
|
@@ -7960,7 +8081,7 @@ function tagsForStack(stack) {
|
|
|
7960
8081
|
// ../../aws-cdk/lib/api/resource-import/importer.ts
|
|
7961
8082
|
var import_util37 = require("util");
|
|
7962
8083
|
var cfnDiff = __toESM(require("@aws-cdk/cloudformation-diff"));
|
|
7963
|
-
var
|
|
8084
|
+
var chalk13 = __toESM(require("chalk"));
|
|
7964
8085
|
var fs12 = __toESM(require("fs-extra"));
|
|
7965
8086
|
var promptly3 = __toESM(require("promptly"));
|
|
7966
8087
|
var ResourceImporter = class {
|
|
@@ -7995,12 +8116,12 @@ var ResourceImporter = class {
|
|
|
7995
8116
|
const descr = this.describeResource(resource.logicalId);
|
|
7996
8117
|
const idProps = contents[resource.logicalId];
|
|
7997
8118
|
if (idProps) {
|
|
7998
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util37.format)("%s: importing using %s",
|
|
8119
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util37.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
|
|
7999
8120
|
ret.importResources.push(resource);
|
|
8000
8121
|
ret.resourceMap[resource.logicalId] = idProps;
|
|
8001
8122
|
delete contents[resource.logicalId];
|
|
8002
8123
|
} else {
|
|
8003
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util37.format)("%s: skipping",
|
|
8124
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg((0, import_util37.format)("%s: skipping", chalk13.blue(descr))));
|
|
8004
8125
|
}
|
|
8005
8126
|
}
|
|
8006
8127
|
const unknown = Object.keys(contents);
|
|
@@ -8044,9 +8165,9 @@ var ResourceImporter = class {
|
|
|
8044
8165
|
});
|
|
8045
8166
|
assertIsSuccessfulDeployStackResult(result2);
|
|
8046
8167
|
const message2 = result2.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
|
|
8047
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg("\n" +
|
|
8168
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg("\n" + chalk13.green((0, import_util37.format)(message2, this.stack.displayName))));
|
|
8048
8169
|
} catch (e) {
|
|
8049
|
-
await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util37.format)("\n \u274C %s failed: %s",
|
|
8170
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util37.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), { error: e }));
|
|
8050
8171
|
throw e;
|
|
8051
8172
|
}
|
|
8052
8173
|
}
|
|
@@ -8148,21 +8269,21 @@ var ResourceImporter = class {
|
|
|
8148
8269
|
const candidateProps = Object.fromEntries(satisfiedPropSet.map((p) => [p, resourceProps[p]]));
|
|
8149
8270
|
const displayCandidateProps = fmtdict(candidateProps);
|
|
8150
8271
|
if (await promptly3.confirm(
|
|
8151
|
-
`${
|
|
8272
|
+
`${chalk13.blue(resourceName)} (${resourceType}): import with ${chalk13.yellow(displayCandidateProps)} (yes/no) [default: yes]? `,
|
|
8152
8273
|
{ default: "yes" }
|
|
8153
8274
|
)) {
|
|
8154
8275
|
return candidateProps;
|
|
8155
8276
|
}
|
|
8156
8277
|
}
|
|
8157
8278
|
if (satisfiedPropSets.length > 0) {
|
|
8158
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(
|
|
8279
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
8159
8280
|
return void 0;
|
|
8160
8281
|
}
|
|
8161
|
-
const prefix = `${
|
|
8282
|
+
const prefix = `${chalk13.blue(resourceName)} (${resourceType})`;
|
|
8162
8283
|
let preamble;
|
|
8163
8284
|
let promptPattern;
|
|
8164
8285
|
if (idPropSets.length > 1) {
|
|
8165
|
-
preamble = `${prefix}: enter one of ${idPropSets.map((x) =>
|
|
8286
|
+
preamble = `${prefix}: enter one of ${idPropSets.map((x) => chalk13.blue(x.join("+"))).join(", ")} to import (all empty to skip)`;
|
|
8166
8287
|
promptPattern = `${prefix}: enter %`;
|
|
8167
8288
|
} else {
|
|
8168
8289
|
promptPattern = `${prefix}: enter %`;
|
|
@@ -8175,7 +8296,7 @@ var ResourceImporter = class {
|
|
|
8175
8296
|
for (const idProp of idProps) {
|
|
8176
8297
|
const defaultValue = resourceProps[idProp] ?? "";
|
|
8177
8298
|
const prompt4 = [
|
|
8178
|
-
promptPattern.replace(/%/g,
|
|
8299
|
+
promptPattern.replace(/%/g, chalk13.blue(idProp)),
|
|
8179
8300
|
defaultValue ? `[${defaultValue}]` : "(empty to skip)"
|
|
8180
8301
|
].join(" ") + ":";
|
|
8181
8302
|
const response = await promptly3.prompt(
|
|
@@ -8192,7 +8313,7 @@ var ResourceImporter = class {
|
|
|
8192
8313
|
return input;
|
|
8193
8314
|
}
|
|
8194
8315
|
}
|
|
8195
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(
|
|
8316
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
8196
8317
|
return void 0;
|
|
8197
8318
|
}
|
|
8198
8319
|
/**
|
|
@@ -8222,12 +8343,6 @@ var ResourceImporter = class {
|
|
|
8222
8343
|
return removeNonImportResources(this.stack);
|
|
8223
8344
|
}
|
|
8224
8345
|
};
|
|
8225
|
-
function removeNonImportResources(stack) {
|
|
8226
|
-
const template = stack.template;
|
|
8227
|
-
delete template.Resources.CDKMetadata;
|
|
8228
|
-
delete template.Outputs;
|
|
8229
|
-
return template;
|
|
8230
|
-
}
|
|
8231
8346
|
function fmtdict(xs) {
|
|
8232
8347
|
return Object.entries(xs).map(([k, v]) => `${k}=${v}`).join(", ");
|
|
8233
8348
|
}
|
|
@@ -8242,7 +8357,7 @@ function addDefaultDeletionPolicy(resource) {
|
|
|
8242
8357
|
}
|
|
8243
8358
|
|
|
8244
8359
|
// ../../aws-cdk/lib/api/resource-import/migrator.ts
|
|
8245
|
-
var
|
|
8360
|
+
var chalk14 = __toESM(require("chalk"));
|
|
8246
8361
|
var fs13 = __toESM(require("fs-extra"));
|
|
8247
8362
|
var ResourceMigrator = class {
|
|
8248
8363
|
constructor(props) {
|
|
@@ -8263,11 +8378,11 @@ var ResourceMigrator = class {
|
|
|
8263
8378
|
});
|
|
8264
8379
|
const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
|
|
8265
8380
|
if (resourcesToImport) {
|
|
8266
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`${
|
|
8267
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`${
|
|
8381
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
|
|
8382
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`${chalk14.bold(stack.displayName)}: importing resources into stack...`));
|
|
8268
8383
|
await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
|
|
8269
8384
|
fs13.rmSync("migrate.json");
|
|
8270
|
-
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`${
|
|
8385
|
+
await this.ioHelper.notify(IO.DEFAULT_TOOLKIT_INFO.msg(`${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
|
|
8271
8386
|
}
|
|
8272
8387
|
}
|
|
8273
8388
|
/**
|
|
@@ -8306,7 +8421,7 @@ var ResourceMigrator = class {
|
|
|
8306
8421
|
|
|
8307
8422
|
// ../../aws-cdk/lib/api/logs/logs-monitor.ts
|
|
8308
8423
|
var util9 = __toESM(require("util"));
|
|
8309
|
-
var
|
|
8424
|
+
var chalk15 = __toESM(require("chalk"));
|
|
8310
8425
|
var uuid4 = __toESM(require("uuid"));
|
|
8311
8426
|
var CloudWatchLogEventMonitor = class {
|
|
8312
8427
|
constructor(props) {
|
|
@@ -8426,8 +8541,8 @@ var CloudWatchLogEventMonitor = class {
|
|
|
8426
8541
|
await this.ioHelper.notify(IO.CDK_TOOLKIT_I5033.msg(
|
|
8427
8542
|
util9.format(
|
|
8428
8543
|
"[%s] %s %s",
|
|
8429
|
-
|
|
8430
|
-
|
|
8544
|
+
chalk15.blue(event.logGroupName),
|
|
8545
|
+
chalk15.yellow(event.timestamp.toLocaleTimeString()),
|
|
8431
8546
|
event.message.trim()
|
|
8432
8547
|
),
|
|
8433
8548
|
event
|
|
@@ -9502,7 +9617,7 @@ __export(context_providers_exports, {
|
|
|
9502
9617
|
registerContextProviderFactory: () => registerContextProviderFactory,
|
|
9503
9618
|
registerPluginContextProvider: () => registerPluginContextProvider
|
|
9504
9619
|
});
|
|
9505
|
-
var
|
|
9620
|
+
var cxschema4 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
9506
9621
|
var cxapi4 = __toESM(require("@aws-cdk/cx-api"));
|
|
9507
9622
|
|
|
9508
9623
|
// ../../aws-cdk/lib/context-providers/ami.ts
|
|
@@ -9589,7 +9704,7 @@ var CcApiContextProviderPlugin = class {
|
|
|
9589
9704
|
if (args.exactIdentifier) {
|
|
9590
9705
|
resources = await this.getResource(cloudControl, args.typeName, args.exactIdentifier);
|
|
9591
9706
|
} else if (args.propertyMatch) {
|
|
9592
|
-
resources = await this.listResources(cloudControl, args.typeName, args.propertyMatch);
|
|
9707
|
+
resources = await this.listResources(cloudControl, args.typeName, args.propertyMatch, args.expectedMatchCount);
|
|
9593
9708
|
} else {
|
|
9594
9709
|
throw new ContextProviderError(`Provider protocol error: neither exactIdentifier nor propertyMatch is specified in ${JSON.stringify(args)}.`);
|
|
9595
9710
|
}
|
|
@@ -9635,7 +9750,7 @@ var CcApiContextProviderPlugin = class {
|
|
|
9635
9750
|
*
|
|
9636
9751
|
* Does not currently paginate through more than one result page.
|
|
9637
9752
|
*/
|
|
9638
|
-
async listResources(cc, typeName, propertyMatch) {
|
|
9753
|
+
async listResources(cc, typeName, propertyMatch, expectedMatchCount) {
|
|
9639
9754
|
try {
|
|
9640
9755
|
const result2 = await cc.listResources({
|
|
9641
9756
|
TypeName: typeName
|
|
@@ -9646,6 +9761,12 @@ var CcApiContextProviderPlugin = class {
|
|
|
9646
9761
|
return propertyMatchesFilter(actual, expected);
|
|
9647
9762
|
});
|
|
9648
9763
|
});
|
|
9764
|
+
if ((expectedMatchCount === "at-least-one" || expectedMatchCount === "exactly-one") && found.length === 0) {
|
|
9765
|
+
throw new ZeroResourcesFoundError(`Could not find any resources matching ${JSON.stringify(propertyMatch)}`);
|
|
9766
|
+
}
|
|
9767
|
+
if ((expectedMatchCount === "at-most-one" || expectedMatchCount === "exactly-one") && found.length > 1) {
|
|
9768
|
+
throw new ContextProviderError(`Found ${found.length} resources matching ${JSON.stringify(propertyMatch)}; please narrow the search criteria`);
|
|
9769
|
+
}
|
|
9649
9770
|
return found;
|
|
9650
9771
|
} catch (err) {
|
|
9651
9772
|
if (!(err instanceof ContextProviderError) && !(err instanceof ZeroResourcesFoundError)) {
|
|
@@ -10359,7 +10480,7 @@ var ContextProviderMessages = class {
|
|
|
10359
10480
|
async function provideContextValues(missingValues, context, sdk, ioHelper) {
|
|
10360
10481
|
for (const missingContext of missingValues) {
|
|
10361
10482
|
const key = missingContext.key;
|
|
10362
|
-
const providerName = missingContext.provider ===
|
|
10483
|
+
const providerName = missingContext.provider === cxschema4.ContextProvider.PLUGIN ? `${PLUGIN_PROVIDER_PREFIX}:${missingContext.props.pluginName}` : missingContext.provider;
|
|
10363
10484
|
let factory;
|
|
10364
10485
|
if (providerName.startsWith(`${PLUGIN_PROVIDER_PREFIX}:`)) {
|
|
10365
10486
|
const plugin = PluginHost.instance.contextProviderPlugins[providerName.substring(PLUGIN_PROVIDER_PREFIX.length + 1)];
|
|
@@ -10400,17 +10521,17 @@ function registerContextProviderFactory(name, provider) {
|
|
|
10400
10521
|
availableContextProviders[name] = provider;
|
|
10401
10522
|
}
|
|
10402
10523
|
var availableContextProviders = {
|
|
10403
|
-
[
|
|
10404
|
-
[
|
|
10405
|
-
[
|
|
10406
|
-
[
|
|
10407
|
-
[
|
|
10408
|
-
[
|
|
10409
|
-
[
|
|
10410
|
-
[
|
|
10411
|
-
[
|
|
10412
|
-
[
|
|
10413
|
-
[
|
|
10524
|
+
[cxschema4.ContextProvider.AVAILABILITY_ZONE_PROVIDER]: (s, io) => new AZContextProviderPlugin(s, io),
|
|
10525
|
+
[cxschema4.ContextProvider.SSM_PARAMETER_PROVIDER]: (s, io) => new SSMContextProviderPlugin(s, io),
|
|
10526
|
+
[cxschema4.ContextProvider.HOSTED_ZONE_PROVIDER]: (s, io) => new HostedZoneContextProviderPlugin(s, io),
|
|
10527
|
+
[cxschema4.ContextProvider.VPC_PROVIDER]: (s, io) => new VpcNetworkContextProviderPlugin(s, io),
|
|
10528
|
+
[cxschema4.ContextProvider.AMI_PROVIDER]: (s, io) => new AmiContextProviderPlugin(s, io),
|
|
10529
|
+
[cxschema4.ContextProvider.ENDPOINT_SERVICE_AVAILABILITY_ZONE_PROVIDER]: (s, io) => new EndpointServiceAZContextProviderPlugin(s, io),
|
|
10530
|
+
[cxschema4.ContextProvider.SECURITY_GROUP_PROVIDER]: (s) => new SecurityGroupContextProviderPlugin(s),
|
|
10531
|
+
[cxschema4.ContextProvider.LOAD_BALANCER_PROVIDER]: (s) => new LoadBalancerContextProviderPlugin(s),
|
|
10532
|
+
[cxschema4.ContextProvider.LOAD_BALANCER_LISTENER_PROVIDER]: (s) => new LoadBalancerListenerContextProviderPlugin(s),
|
|
10533
|
+
[cxschema4.ContextProvider.KEY_PROVIDER]: (s, io) => new KeyContextProviderPlugin(s, io),
|
|
10534
|
+
[cxschema4.ContextProvider.CC_API_PROVIDER]: (s) => new CcApiContextProviderPlugin(s)
|
|
10414
10535
|
};
|
|
10415
10536
|
|
|
10416
10537
|
// ../../aws-cdk/lib/api/util/rwlock.ts
|
|
@@ -10565,7 +10686,7 @@ function processExists(pid) {
|
|
|
10565
10686
|
|
|
10566
10687
|
// ../../aws-cdk/lib/api/cxapp/cloud-assembly.ts
|
|
10567
10688
|
var import_cx_api9 = require("@aws-cdk/cx-api");
|
|
10568
|
-
var
|
|
10689
|
+
var chalk16 = __toESM(require("chalk"));
|
|
10569
10690
|
var import_minimatch = require("minimatch");
|
|
10570
10691
|
var semver5 = __toESM(require("semver"));
|
|
10571
10692
|
var ExtendedStackSelection = /* @__PURE__ */ ((ExtendedStackSelection2) => {
|
|
@@ -10575,9 +10696,10 @@ var ExtendedStackSelection = /* @__PURE__ */ ((ExtendedStackSelection2) => {
|
|
|
10575
10696
|
return ExtendedStackSelection2;
|
|
10576
10697
|
})(ExtendedStackSelection || {});
|
|
10577
10698
|
var CloudAssembly2 = class {
|
|
10578
|
-
constructor(assembly) {
|
|
10699
|
+
constructor(assembly, ioHelper) {
|
|
10579
10700
|
this.assembly = assembly;
|
|
10580
10701
|
this.directory = assembly.directory;
|
|
10702
|
+
this.ioHelper = ioHelper;
|
|
10581
10703
|
}
|
|
10582
10704
|
async selectStacks(selector, options) {
|
|
10583
10705
|
const asm = this.assembly;
|
|
@@ -10599,14 +10721,14 @@ var CloudAssembly2 = class {
|
|
|
10599
10721
|
return this.selectDefaultStacks(stacks, topLevelStacks, options.defaultBehavior);
|
|
10600
10722
|
}
|
|
10601
10723
|
}
|
|
10602
|
-
selectTopLevelStacks(stacks, topLevelStacks, extend = 0 /* None */) {
|
|
10724
|
+
async selectTopLevelStacks(stacks, topLevelStacks, extend = 0 /* None */) {
|
|
10603
10725
|
if (topLevelStacks.length > 0) {
|
|
10604
10726
|
return this.extendStacks(topLevelStacks, stacks, extend);
|
|
10605
10727
|
} else {
|
|
10606
10728
|
throw new ToolkitError('No stack found in the main cloud assembly. Use "list" to print manifest');
|
|
10607
10729
|
}
|
|
10608
10730
|
}
|
|
10609
|
-
selectMatchingStacks(stacks, patterns, extend = 0 /* None */) {
|
|
10731
|
+
async selectMatchingStacks(stacks, patterns, extend = 0 /* None */) {
|
|
10610
10732
|
const matchingPattern = (pattern) => (stack) => (0, import_minimatch.minimatch)(stack.hierarchicalId, pattern);
|
|
10611
10733
|
const matchedStacks = flatten(patterns.map((pattern) => stacks.filter(matchingPattern(pattern))));
|
|
10612
10734
|
return this.extendStacks(matchedStacks, stacks, extend);
|
|
@@ -10630,7 +10752,7 @@ Stacks: ${stacks.map((x) => x.hierarchicalId).join(" \xB7 ")}`);
|
|
|
10630
10752
|
throw new ToolkitError(`invalid default behavior: ${defaultSelection}`);
|
|
10631
10753
|
}
|
|
10632
10754
|
}
|
|
10633
|
-
extendStacks(matched, all, extend = 0 /* None */) {
|
|
10755
|
+
async extendStacks(matched, all, extend = 0 /* None */) {
|
|
10634
10756
|
const allStacks = /* @__PURE__ */ new Map();
|
|
10635
10757
|
for (const stack of all) {
|
|
10636
10758
|
allStacks.set(stack.hierarchicalId, stack);
|
|
@@ -10638,10 +10760,10 @@ Stacks: ${stacks.map((x) => x.hierarchicalId).join(" \xB7 ")}`);
|
|
|
10638
10760
|
const index = indexByHierarchicalId(matched);
|
|
10639
10761
|
switch (extend) {
|
|
10640
10762
|
case 2 /* Downstream */:
|
|
10641
|
-
includeDownstreamStacks(index, allStacks);
|
|
10763
|
+
await includeDownstreamStacks(this.ioHelper, index, allStacks);
|
|
10642
10764
|
break;
|
|
10643
10765
|
case 1 /* Upstream */:
|
|
10644
|
-
includeUpstreamStacks(index, allStacks);
|
|
10766
|
+
await includeUpstreamStacks(this.ioHelper, index, allStacks);
|
|
10645
10767
|
break;
|
|
10646
10768
|
}
|
|
10647
10769
|
const selectedList = all.filter((s) => index.has(s.hierarchicalId));
|
|
@@ -10756,7 +10878,7 @@ function indexByHierarchicalId(stacks) {
|
|
|
10756
10878
|
}
|
|
10757
10879
|
return result2;
|
|
10758
10880
|
}
|
|
10759
|
-
function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
10881
|
+
async function includeDownstreamStacks(ioHelper, selectedStacks, allStacks) {
|
|
10760
10882
|
const added = new Array();
|
|
10761
10883
|
let madeProgress;
|
|
10762
10884
|
do {
|
|
@@ -10770,10 +10892,10 @@ function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
|
10770
10892
|
}
|
|
10771
10893
|
} while (madeProgress);
|
|
10772
10894
|
if (added.length > 0) {
|
|
10773
|
-
|
|
10895
|
+
await ioHelper.notify(IO.DEFAULT_ASSEMBLY_INFO.msg(`Including depending stacks: ${chalk16.bold(added.join(", "))}`));
|
|
10774
10896
|
}
|
|
10775
10897
|
}
|
|
10776
|
-
function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
10898
|
+
async function includeUpstreamStacks(ioHelper, selectedStacks, allStacks) {
|
|
10777
10899
|
const added = new Array();
|
|
10778
10900
|
let madeProgress = true;
|
|
10779
10901
|
while (madeProgress) {
|
|
@@ -10789,7 +10911,7 @@ function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
|
10789
10911
|
}
|
|
10790
10912
|
}
|
|
10791
10913
|
if (added.length > 0) {
|
|
10792
|
-
|
|
10914
|
+
await ioHelper.notify(IO.DEFAULT_ASSEMBLY_INFO.msg(`Including dependency stacks: ${chalk16.bold(added.join(", "))}`));
|
|
10793
10915
|
}
|
|
10794
10916
|
}
|
|
10795
10917
|
function sanitizePatterns(patterns) {
|
|
@@ -10800,7 +10922,8 @@ function sanitizePatterns(patterns) {
|
|
|
10800
10922
|
|
|
10801
10923
|
// ../../aws-cdk/lib/api/cxapp/exec.ts
|
|
10802
10924
|
var path14 = __toESM(require("path"));
|
|
10803
|
-
var
|
|
10925
|
+
var import_util47 = require("util");
|
|
10926
|
+
var cxschema5 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
10804
10927
|
var cxapi5 = __toESM(require("@aws-cdk/cx-api"));
|
|
10805
10928
|
var fs17 = __toESM(require("fs-extra"));
|
|
10806
10929
|
var semver6 = __toESM(require("semver"));
|
|
@@ -10809,18 +10932,18 @@ var semver6 = __toESM(require("semver"));
|
|
|
10809
10932
|
var fs16 = __toESM(require("fs-extra"));
|
|
10810
10933
|
|
|
10811
10934
|
// ../../aws-cdk/lib/api/cxapp/exec.ts
|
|
10812
|
-
async function prepareDefaultEnvironment(aws,
|
|
10935
|
+
async function prepareDefaultEnvironment(aws, debugFn) {
|
|
10813
10936
|
const env = {};
|
|
10814
10937
|
env[cxapi5.DEFAULT_REGION_ENV] = aws.defaultRegion;
|
|
10815
|
-
await
|
|
10938
|
+
await debugFn(`Setting "${cxapi5.DEFAULT_REGION_ENV}" environment variable to ${env[cxapi5.DEFAULT_REGION_ENV]}`);
|
|
10816
10939
|
const accountId = (await aws.defaultAccount())?.accountId;
|
|
10817
10940
|
if (accountId) {
|
|
10818
10941
|
env[cxapi5.DEFAULT_ACCOUNT_ENV] = accountId;
|
|
10819
|
-
await
|
|
10942
|
+
await debugFn(`Setting "${cxapi5.DEFAULT_ACCOUNT_ENV}" environment variable to ${env[cxapi5.DEFAULT_ACCOUNT_ENV]}`);
|
|
10820
10943
|
}
|
|
10821
10944
|
return env;
|
|
10822
10945
|
}
|
|
10823
|
-
async function prepareContext(settings, context, env) {
|
|
10946
|
+
async function prepareContext(settings, context, env, debugFn) {
|
|
10824
10947
|
const debugMode = settings.get(["debug"]) ?? true;
|
|
10825
10948
|
if (debugMode) {
|
|
10826
10949
|
env.CDK_DEBUG = "true";
|
|
@@ -10846,7 +10969,7 @@ async function prepareContext(settings, context, env) {
|
|
|
10846
10969
|
}
|
|
10847
10970
|
const bundlingStacks = settings.get(["bundlingStacks"]) ?? ["**"];
|
|
10848
10971
|
context[cxapi5.BUNDLING_STACKS] = bundlingStacks;
|
|
10849
|
-
|
|
10972
|
+
await debugFn((0, import_util47.format)("context:", context));
|
|
10850
10973
|
return context;
|
|
10851
10974
|
}
|
|
10852
10975
|
function appToArray(app) {
|
|
@@ -10858,14 +10981,14 @@ function executeNode(scriptFile) {
|
|
|
10858
10981
|
var EXTENSION_MAP = /* @__PURE__ */ new Map([
|
|
10859
10982
|
[".js", executeNode]
|
|
10860
10983
|
]);
|
|
10861
|
-
async function guessExecutable(app) {
|
|
10984
|
+
async function guessExecutable(app, debugFn) {
|
|
10862
10985
|
const commandLine = appToArray(app);
|
|
10863
10986
|
if (commandLine.length === 1) {
|
|
10864
10987
|
let fstat;
|
|
10865
10988
|
try {
|
|
10866
10989
|
fstat = await fs17.stat(commandLine[0]);
|
|
10867
10990
|
} catch {
|
|
10868
|
-
|
|
10991
|
+
await debugFn(`Not a file: '${commandLine[0]}'. Using '${commandLine}' as command-line`);
|
|
10869
10992
|
return commandLine;
|
|
10870
10993
|
}
|
|
10871
10994
|
const isExecutable = (fstat.mode & fs17.constants.X_OK) !== 0;
|
|
@@ -10903,6 +11026,7 @@ function spaceAvailableForContext(env, limit) {
|
|
|
10903
11026
|
StackCollection,
|
|
10904
11027
|
WorkGraphBuilder,
|
|
10905
11028
|
contextproviders,
|
|
11029
|
+
createDiffChangeSet,
|
|
10906
11030
|
findCloudWatchLogGroups,
|
|
10907
11031
|
guessExecutable,
|
|
10908
11032
|
loadTree,
|