@aws-cdk/toolkit-lib 0.1.1 → 0.1.3
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/CODE_REGISTRY.md +35 -0
- package/README.md +18 -18
- package/build-info.json +2 -2
- package/lib/actions/deploy/index.d.ts +4 -4
- package/lib/actions/deploy/index.js +1 -1
- package/lib/actions/diff/private/helpers.js +3 -3
- package/lib/api/aws-cdk.d.ts +0 -1
- package/lib/api/aws-cdk.js +1676 -1318
- package/lib/api/aws-cdk.js.map +4 -4
- package/lib/api/cloud-assembly/private/context-aware-source.js +5 -5
- package/lib/api/cloud-assembly/private/exec.js +3 -3
- package/lib/api/cloud-assembly/private/prepare-source.js +4 -4
- package/lib/api/cloud-assembly/private/source-builder.d.ts +2 -2
- package/lib/api/cloud-assembly/private/source-builder.js +5 -5
- package/lib/api/cloud-assembly/private/stack-assembly.js +7 -7
- package/lib/api/io/io-message.d.ts +1 -1
- package/lib/api/io/io-message.js +1 -1
- package/lib/api/io/private/codes.d.ts +59 -29
- package/lib/api/io/private/codes.js +167 -28
- package/lib/api/io/private/messages.d.ts +14 -20
- package/lib/api/io/private/messages.js +19 -15
- package/lib/api/io/private/timer.js +6 -5
- package/lib/api/shared-public.d.ts +1 -0
- package/lib/api/shared-public.js +100 -0
- package/lib/api/shared-public.js.map +7 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/toolkit/index.d.ts +1 -0
- package/lib/toolkit/index.js +2 -1
- package/lib/toolkit/toolkit.js +29 -35
- package/lib/toolkit/types.d.ts +76 -0
- package/lib/toolkit/types.js +3 -0
- package/package.json +26 -24
- package/lib/api/errors.d.ts +0 -44
- package/lib/api/errors.js +0 -82
package/lib/api/aws-cdk.js
CHANGED
|
@@ -53,7 +53,6 @@ __export(aws_cdk_exports, {
|
|
|
53
53
|
ResourceMigrator: () => ResourceMigrator,
|
|
54
54
|
SdkProvider: () => SdkProvider,
|
|
55
55
|
Settings: () => Settings,
|
|
56
|
-
StackActivityProgress: () => StackActivityProgress,
|
|
57
56
|
StackCollection: () => StackCollection,
|
|
58
57
|
WorkGraphBuilder: () => WorkGraphBuilder,
|
|
59
58
|
contextproviders: () => context_providers_exports,
|
|
@@ -79,6 +78,7 @@ module.exports = __toCommonJS(aws_cdk_exports);
|
|
|
79
78
|
|
|
80
79
|
// ../../aws-cdk/lib/api/aws-auth/sdk.ts
|
|
81
80
|
var import_client_appsync = require("@aws-sdk/client-appsync");
|
|
81
|
+
var import_client_cloudcontrol = require("@aws-sdk/client-cloudcontrol");
|
|
82
82
|
var import_client_cloudformation = require("@aws-sdk/client-cloudformation");
|
|
83
83
|
var import_client_cloudwatch_logs = require("@aws-sdk/client-cloudwatch-logs");
|
|
84
84
|
var import_client_codebuild = require("@aws-sdk/client-codebuild");
|
|
@@ -101,18 +101,18 @@ var import_util_retry = require("@smithy/util-retry");
|
|
|
101
101
|
|
|
102
102
|
// ../../aws-cdk/lib/api/aws-auth/account-cache.ts
|
|
103
103
|
var path2 = __toESM(require("path"));
|
|
104
|
-
var
|
|
104
|
+
var fs3 = __toESM(require("fs-extra"));
|
|
105
105
|
|
|
106
106
|
// ../../aws-cdk/lib/logging.ts
|
|
107
|
-
var
|
|
108
|
-
var
|
|
107
|
+
var util4 = __toESM(require("util"));
|
|
108
|
+
var chalk4 = __toESM(require("chalk"));
|
|
109
109
|
|
|
110
110
|
// ../../aws-cdk/lib/toolkit/cli-io-host.ts
|
|
111
|
-
var
|
|
112
|
-
var
|
|
111
|
+
var util3 = __toESM(require("node:util"));
|
|
112
|
+
var chalk3 = __toESM(require("chalk"));
|
|
113
113
|
var promptly = __toESM(require("promptly"));
|
|
114
114
|
|
|
115
|
-
//
|
|
115
|
+
// ../tmp-toolkit-helpers/src/api/toolkit-error.ts
|
|
116
116
|
var TOOLKIT_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.ToolkitError");
|
|
117
117
|
var AUTHENTICATION_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AuthenticationError");
|
|
118
118
|
var ASSEMBLY_ERROR_SYMBOL = Symbol.for("@aws-cdk/toolkit.AssemblyError");
|
|
@@ -142,6 +142,10 @@ var ToolkitError = class _ToolkitError extends Error {
|
|
|
142
142
|
static isContextProviderError(x) {
|
|
143
143
|
return this.isToolkitError(x) && CONTEXT_PROVIDER_ERROR_SYMBOL in x;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* The type of the error, defaults to "toolkit".
|
|
147
|
+
*/
|
|
148
|
+
type;
|
|
145
149
|
constructor(message, type = "toolkit") {
|
|
146
150
|
super(message);
|
|
147
151
|
Object.setPrototypeOf(this, _ToolkitError.prototype);
|
|
@@ -172,136 +176,933 @@ var ContextProviderError = class _ContextProviderError extends ToolkitError {
|
|
|
172
176
|
}
|
|
173
177
|
};
|
|
174
178
|
|
|
175
|
-
// ../../aws-cdk/lib/
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
};
|
|
184
|
-
var CliIoHost = class _CliIoHost {
|
|
185
|
-
constructor(props = {}) {
|
|
186
|
-
// Corked Logging
|
|
187
|
-
this.corkedCounter = 0;
|
|
188
|
-
this.corkedLoggingBuffer = [];
|
|
189
|
-
this._currentAction = props.currentAction ?? "none";
|
|
190
|
-
this._isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
|
|
191
|
-
this._logLevel = props.logLevel ?? "info";
|
|
192
|
-
this._isCI = props.isCI ?? isCI();
|
|
179
|
+
// ../../aws-cdk/lib/util/archive.ts
|
|
180
|
+
var glob = __toESM(require("glob"));
|
|
181
|
+
|
|
182
|
+
// ../../aws-cdk/lib/util/format-error.ts
|
|
183
|
+
function formatErrorMessage(error3) {
|
|
184
|
+
if (error3 && Array.isArray(error3.errors)) {
|
|
185
|
+
const innerMessages = error3.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
|
|
186
|
+
return `AggregateError: ${innerMessages}`;
|
|
193
187
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
188
|
+
return error3?.message || error3?.toString() || "Unknown error";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ../../aws-cdk/lib/util/archive.ts
|
|
192
|
+
var archiver = require("archiver");
|
|
193
|
+
|
|
194
|
+
// ../../aws-cdk/lib/util/arrays.ts
|
|
195
|
+
function flatMap(xs, fn) {
|
|
196
|
+
return flatten(xs.map(fn));
|
|
197
|
+
}
|
|
198
|
+
function flatten(xs) {
|
|
199
|
+
return Array.prototype.concat.apply([], xs);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ../../aws-cdk/lib/util/bytes.ts
|
|
203
|
+
function formatBytes(bytes, decimals = 2) {
|
|
204
|
+
decimals = decimals < 0 ? 0 : decimals;
|
|
205
|
+
if (bytes === 0) {
|
|
206
|
+
return "0 Bytes";
|
|
202
207
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
const k = 1024;
|
|
209
|
+
const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
210
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
211
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// ../../aws-cdk/lib/util/cloudformation.ts
|
|
215
|
+
function validateSnsTopicArn(arn) {
|
|
216
|
+
return /^arn:aws:sns:[a-z0-9\-]+:[0-9]+:[a-z0-9\-\_]+$/i.test(arn);
|
|
217
|
+
}
|
|
218
|
+
function stackEventHasErrorMessage(status) {
|
|
219
|
+
return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
|
|
220
|
+
}
|
|
221
|
+
function maxResourceTypeLength(template, startWidth = "AWS::CloudFormation::Stack".length) {
|
|
222
|
+
const resources = template && template.Resources || {};
|
|
223
|
+
let maxWidth = startWidth;
|
|
224
|
+
for (const id of Object.keys(resources)) {
|
|
225
|
+
const type = resources[id].Type || "";
|
|
226
|
+
if (type.length > maxWidth) {
|
|
227
|
+
maxWidth = type.length;
|
|
209
228
|
}
|
|
210
229
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
230
|
+
return maxWidth;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ../../aws-cdk/lib/util/content-hash.ts
|
|
234
|
+
var crypto = __toESM(require("crypto"));
|
|
235
|
+
function contentHash(data) {
|
|
236
|
+
return crypto.createHash("sha256").update(data).digest("hex");
|
|
237
|
+
}
|
|
238
|
+
function contentHashAny(value) {
|
|
239
|
+
const ret = crypto.createHash("sha256");
|
|
240
|
+
recurse(value);
|
|
241
|
+
return ret.digest("hex");
|
|
242
|
+
function recurse(x) {
|
|
243
|
+
if (typeof x === "string") {
|
|
244
|
+
ret.update(x);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (Array.isArray(x)) {
|
|
248
|
+
ret.update("[");
|
|
249
|
+
for (const e of x) {
|
|
250
|
+
recurse(e);
|
|
251
|
+
ret.update("||");
|
|
252
|
+
}
|
|
253
|
+
ret.update("]");
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (x && typeof x === "object") {
|
|
257
|
+
ret.update("{");
|
|
258
|
+
for (const key of Object.keys(x).sort()) {
|
|
259
|
+
ret.update(key);
|
|
260
|
+
ret.update(":");
|
|
261
|
+
recurse(x[key]);
|
|
262
|
+
}
|
|
263
|
+
ret.update("}");
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
ret.update(`${x}${typeof x}`);
|
|
224
267
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// ../../aws-cdk/lib/util/types.ts
|
|
271
|
+
function isObject(x) {
|
|
272
|
+
return x !== null && typeof x === "object" && !isArray(x);
|
|
273
|
+
}
|
|
274
|
+
var isArray = Array.isArray;
|
|
275
|
+
|
|
276
|
+
// ../../aws-cdk/lib/util/objects.ts
|
|
277
|
+
function deepClone(x) {
|
|
278
|
+
if (typeof x === "undefined") {
|
|
279
|
+
return void 0;
|
|
230
280
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
*
|
|
234
|
-
* @param value set TTY mode
|
|
235
|
-
*/
|
|
236
|
-
set isTTY(value) {
|
|
237
|
-
this._isTTY = value;
|
|
281
|
+
if (x === null) {
|
|
282
|
+
return null;
|
|
238
283
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
*/
|
|
242
|
-
get isCI() {
|
|
243
|
-
return this._isCI;
|
|
284
|
+
if (isArray(x)) {
|
|
285
|
+
return x.map(deepClone);
|
|
244
286
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
* @param value set the CI mode
|
|
248
|
-
*/
|
|
249
|
-
set isCI(value) {
|
|
250
|
-
this._isCI = value;
|
|
287
|
+
if (isObject(x)) {
|
|
288
|
+
return makeObject(mapObject(x, (k, v) => [k, deepClone(v)]));
|
|
251
289
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
290
|
+
return x;
|
|
291
|
+
}
|
|
292
|
+
function mapObject(x, fn) {
|
|
293
|
+
const ret = [];
|
|
294
|
+
Object.keys(x).forEach((key) => {
|
|
295
|
+
ret.push(fn(key, x[key]));
|
|
296
|
+
});
|
|
297
|
+
return ret;
|
|
298
|
+
}
|
|
299
|
+
function makeObject(pairs) {
|
|
300
|
+
const ret = {};
|
|
301
|
+
for (const pair of pairs) {
|
|
302
|
+
ret[pair[0]] = pair[1];
|
|
257
303
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
304
|
+
return ret;
|
|
305
|
+
}
|
|
306
|
+
function deepGet(x, path12) {
|
|
307
|
+
path12 = path12.slice();
|
|
308
|
+
while (path12.length > 0 && isObject(x)) {
|
|
309
|
+
const key = path12.shift();
|
|
310
|
+
x = x[key];
|
|
264
311
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
* @returns Promise that resolves with the block's return value
|
|
272
|
-
*/
|
|
273
|
-
async withCorkedLogging(block) {
|
|
274
|
-
this.corkedCounter++;
|
|
275
|
-
try {
|
|
276
|
-
return await block();
|
|
277
|
-
} finally {
|
|
278
|
-
this.corkedCounter--;
|
|
279
|
-
if (this.corkedCounter === 0) {
|
|
280
|
-
for (const ioMessage of this.corkedLoggingBuffer) {
|
|
281
|
-
await this.notify(ioMessage);
|
|
282
|
-
}
|
|
283
|
-
this.corkedLoggingBuffer.splice(0);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
312
|
+
return path12.length === 0 ? x : void 0;
|
|
313
|
+
}
|
|
314
|
+
function deepSet(x, path12, value) {
|
|
315
|
+
path12 = path12.slice();
|
|
316
|
+
if (path12.length === 0) {
|
|
317
|
+
throw new ToolkitError("Path may not be empty");
|
|
286
318
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
async notify(msg) {
|
|
292
|
-
if (this._internalIoHost) {
|
|
293
|
-
return this._internalIoHost.notify(msg);
|
|
294
|
-
}
|
|
295
|
-
if (levelPriority[msg.level] > levelPriority[this.logLevel]) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (this.corkedCounter > 0) {
|
|
299
|
-
this.corkedLoggingBuffer.push(msg);
|
|
300
|
-
return;
|
|
319
|
+
while (path12.length > 1 && isObject(x)) {
|
|
320
|
+
const key = path12.shift();
|
|
321
|
+
if (!(key in x)) {
|
|
322
|
+
x[key] = {};
|
|
301
323
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
324
|
+
x = x[key];
|
|
325
|
+
}
|
|
326
|
+
if (!isObject(x)) {
|
|
327
|
+
throw new ToolkitError(`Expected an object, got '${x}'`);
|
|
328
|
+
}
|
|
329
|
+
if (value !== void 0) {
|
|
330
|
+
x[path12[0]] = value;
|
|
331
|
+
} else {
|
|
332
|
+
delete x[path12[0]];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function deepMerge(...objects) {
|
|
336
|
+
function mergeOne(target, source) {
|
|
337
|
+
for (const key of Object.keys(source)) {
|
|
338
|
+
if (key === "__proto__" || key === "constructor") {
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
const value = source[key];
|
|
342
|
+
if (isObject(value)) {
|
|
343
|
+
if (!isObject(target[key])) {
|
|
344
|
+
target[key] = {};
|
|
345
|
+
}
|
|
346
|
+
mergeOne(target[key], value);
|
|
347
|
+
} else if (typeof value !== "undefined") {
|
|
348
|
+
target[key] = value;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const others = objects.filter((x) => x != null);
|
|
353
|
+
if (others.length === 0) {
|
|
354
|
+
return {};
|
|
355
|
+
}
|
|
356
|
+
const into = others.splice(0, 1)[0];
|
|
357
|
+
others.forEach((other) => mergeOne(into, other));
|
|
358
|
+
return into;
|
|
359
|
+
}
|
|
360
|
+
function splitBySize(data, maxSizeBytes) {
|
|
361
|
+
if (maxSizeBytes < 2) {
|
|
362
|
+
return [void 0, data];
|
|
363
|
+
}
|
|
364
|
+
const entries = Object.entries(data);
|
|
365
|
+
return recurse(0, 0);
|
|
366
|
+
function recurse(index, runningTotalSize) {
|
|
367
|
+
if (index >= entries.length) {
|
|
368
|
+
return [data, void 0];
|
|
369
|
+
}
|
|
370
|
+
const size = runningTotalSize + entrySize(entries[index]);
|
|
371
|
+
return size > maxSizeBytes ? cutAt(index) : recurse(index + 1, size);
|
|
372
|
+
}
|
|
373
|
+
function entrySize(entry) {
|
|
374
|
+
return Buffer.byteLength(JSON.stringify(Object.fromEntries([entry])));
|
|
375
|
+
}
|
|
376
|
+
function cutAt(index) {
|
|
377
|
+
return [
|
|
378
|
+
Object.fromEntries(entries.slice(0, index)),
|
|
379
|
+
Object.fromEntries(entries.slice(index))
|
|
380
|
+
];
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ../../aws-cdk/lib/util/parallel.ts
|
|
385
|
+
async function parallelPromises(n, promises) {
|
|
386
|
+
const ret = new Array();
|
|
387
|
+
let count = 0;
|
|
388
|
+
let error3;
|
|
389
|
+
const queue = [...promises];
|
|
390
|
+
return new Promise((ok, ko) => {
|
|
391
|
+
tick();
|
|
392
|
+
function tick() {
|
|
393
|
+
if (count === 0 && error3) {
|
|
394
|
+
ko(error3);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (count === 0 && queue.length === 0) {
|
|
398
|
+
ok(ret);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
while (count < n && queue.length > 0 && !error3) {
|
|
402
|
+
const next = queue.shift();
|
|
403
|
+
if (next !== void 0) {
|
|
404
|
+
start(next);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function start(fn) {
|
|
409
|
+
count += 1;
|
|
410
|
+
fn().then((result) => {
|
|
411
|
+
ret.push(result);
|
|
412
|
+
}).catch((e) => {
|
|
413
|
+
error3 = e;
|
|
414
|
+
}).finally(() => {
|
|
415
|
+
count -= 1;
|
|
416
|
+
tick();
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// ../../aws-cdk/lib/util/serialize.ts
|
|
423
|
+
var fs = __toESM(require("fs-extra"));
|
|
424
|
+
|
|
425
|
+
// ../../aws-cdk/lib/util/yaml-cfn.ts
|
|
426
|
+
var yaml = __toESM(require("yaml"));
|
|
427
|
+
var yaml_types = __toESM(require("yaml/types"));
|
|
428
|
+
function serialize(obj) {
|
|
429
|
+
const oldFold = yaml_types.strOptions.fold.lineWidth;
|
|
430
|
+
try {
|
|
431
|
+
yaml_types.strOptions.fold.lineWidth = 0;
|
|
432
|
+
return yaml.stringify(obj, { schema: "yaml-1.1" });
|
|
433
|
+
} finally {
|
|
434
|
+
yaml_types.strOptions.fold.lineWidth = oldFold;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function deserialize(str) {
|
|
438
|
+
return parseYamlStrWithCfnTags(str);
|
|
439
|
+
}
|
|
440
|
+
function makeTagForCfnIntrinsic(intrinsicName, addFnPrefix) {
|
|
441
|
+
return {
|
|
442
|
+
identify(value) {
|
|
443
|
+
return typeof value === "string";
|
|
444
|
+
},
|
|
445
|
+
tag: `!${intrinsicName}`,
|
|
446
|
+
resolve: (_doc, cstNode) => {
|
|
447
|
+
const ret = {};
|
|
448
|
+
ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = // the +1 is to account for the ! the short form begins with
|
|
449
|
+
parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1));
|
|
450
|
+
return ret;
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
var shortForms = [
|
|
455
|
+
"Base64",
|
|
456
|
+
"Cidr",
|
|
457
|
+
"FindInMap",
|
|
458
|
+
"GetAZs",
|
|
459
|
+
"ImportValue",
|
|
460
|
+
"Join",
|
|
461
|
+
"Sub",
|
|
462
|
+
"Select",
|
|
463
|
+
"Split",
|
|
464
|
+
"Transform",
|
|
465
|
+
"And",
|
|
466
|
+
"Equals",
|
|
467
|
+
"If",
|
|
468
|
+
"Not",
|
|
469
|
+
"Or",
|
|
470
|
+
"GetAtt"
|
|
471
|
+
].map((name) => makeTagForCfnIntrinsic(name, true)).concat(
|
|
472
|
+
makeTagForCfnIntrinsic("Ref", false),
|
|
473
|
+
makeTagForCfnIntrinsic("Condition", false)
|
|
474
|
+
);
|
|
475
|
+
function parseYamlStrWithCfnTags(text) {
|
|
476
|
+
return yaml.parse(text, {
|
|
477
|
+
customTags: shortForms,
|
|
478
|
+
schema: "core"
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// ../../aws-cdk/lib/util/serialize.ts
|
|
483
|
+
function toYAML(obj) {
|
|
484
|
+
return serialize(obj);
|
|
485
|
+
}
|
|
486
|
+
function deserializeStructure(str) {
|
|
487
|
+
return deserialize(str);
|
|
488
|
+
}
|
|
489
|
+
function serializeStructure(object, json) {
|
|
490
|
+
if (json) {
|
|
491
|
+
return JSON.stringify(object, void 0, 2);
|
|
492
|
+
} else {
|
|
493
|
+
return toYAML(object);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
function obscureTemplate(template = {}) {
|
|
497
|
+
if (template.Rules) {
|
|
498
|
+
if (template.Rules.CheckBootstrapVersion) {
|
|
499
|
+
if (Object.keys(template.Rules).length > 1) {
|
|
500
|
+
delete template.Rules.CheckBootstrapVersion;
|
|
501
|
+
} else {
|
|
502
|
+
delete template.Rules;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return template;
|
|
507
|
+
}
|
|
508
|
+
function isJsonBuffer(value) {
|
|
509
|
+
return typeof value === "object" && "type" in value && value.type === "Buffer" && "data" in value && Array.isArray(value.data);
|
|
510
|
+
}
|
|
511
|
+
function replacerBufferWithInfo(_key, value) {
|
|
512
|
+
if (isJsonBuffer(value)) {
|
|
513
|
+
return `<Buffer: ${formatBytes(value.data.length)}>`;
|
|
514
|
+
}
|
|
515
|
+
return value;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// ../../aws-cdk/lib/util/string-manipulation.ts
|
|
519
|
+
function padLeft(n, x, char = " ") {
|
|
520
|
+
return char.repeat(Math.max(0, n - x.length)) + x;
|
|
521
|
+
}
|
|
522
|
+
function padRight(n, x, char = " ") {
|
|
523
|
+
return x + char.repeat(Math.max(0, n - x.length));
|
|
524
|
+
}
|
|
525
|
+
function formatTime(num) {
|
|
526
|
+
return roundPercentage(millisecondsToSeconds(num));
|
|
527
|
+
}
|
|
528
|
+
function roundPercentage(num) {
|
|
529
|
+
return Math.round(100 * num) / 100;
|
|
530
|
+
}
|
|
531
|
+
function millisecondsToSeconds(num) {
|
|
532
|
+
return num / 1e3;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// ../../aws-cdk/lib/util/version-range.ts
|
|
536
|
+
var semver = __toESM(require("semver"));
|
|
537
|
+
|
|
538
|
+
// ../../aws-cdk/lib/cli/activity-printer/base.ts
|
|
539
|
+
var ActivityPrinterBase = class {
|
|
540
|
+
constructor(props) {
|
|
541
|
+
this.props = props;
|
|
542
|
+
/**
|
|
543
|
+
* The with of the "resource type" column.
|
|
544
|
+
*/
|
|
545
|
+
this.resourceTypeColumnWidth = maxResourceTypeLength({});
|
|
546
|
+
/**
|
|
547
|
+
* A list of resource IDs which are currently being processed
|
|
548
|
+
*/
|
|
549
|
+
this.resourcesInProgress = {};
|
|
550
|
+
this.rollingBack = false;
|
|
551
|
+
this.failures = new Array();
|
|
552
|
+
this.hookFailureMap = /* @__PURE__ */ new Map();
|
|
553
|
+
this.stream = props.stream;
|
|
554
|
+
}
|
|
555
|
+
static {
|
|
556
|
+
this.TIMESTAMP_WIDTH = 12;
|
|
557
|
+
}
|
|
558
|
+
static {
|
|
559
|
+
this.STATUS_WIDTH = 20;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Receive a stack activity message
|
|
563
|
+
*/
|
|
564
|
+
notify(msg) {
|
|
565
|
+
switch (msg.code) {
|
|
566
|
+
case "CDK_TOOLKIT_I5501":
|
|
567
|
+
this.start(msg.data);
|
|
568
|
+
break;
|
|
569
|
+
case "CDK_TOOLKIT_I5502":
|
|
570
|
+
this.activity(msg.data);
|
|
571
|
+
break;
|
|
572
|
+
case "CDK_TOOLKIT_I5503":
|
|
573
|
+
this.stop();
|
|
574
|
+
break;
|
|
575
|
+
default:
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
start({ stack }) {
|
|
580
|
+
this.resourceTypeColumnWidth = maxResourceTypeLength(stack.template);
|
|
581
|
+
}
|
|
582
|
+
activity(activity) {
|
|
583
|
+
this.addActivity(activity);
|
|
584
|
+
this.print();
|
|
585
|
+
}
|
|
586
|
+
stop() {
|
|
587
|
+
this.print();
|
|
588
|
+
}
|
|
589
|
+
addActivity(activity) {
|
|
590
|
+
const status = activity.event.ResourceStatus;
|
|
591
|
+
const hookStatus = activity.event.HookStatus;
|
|
592
|
+
const hookType = activity.event.HookType;
|
|
593
|
+
if (!status || !activity.event.LogicalResourceId) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
this.stackProgress = activity.progress;
|
|
597
|
+
if (status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS") {
|
|
598
|
+
this.rollingBack = true;
|
|
599
|
+
}
|
|
600
|
+
if (status.endsWith("_IN_PROGRESS")) {
|
|
601
|
+
this.resourcesInProgress[activity.event.LogicalResourceId] = activity;
|
|
602
|
+
}
|
|
603
|
+
if (stackEventHasErrorMessage(status)) {
|
|
604
|
+
const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
|
|
605
|
+
if (!isCancelled) {
|
|
606
|
+
this.failures.push(activity);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (status.endsWith("_COMPLETE") || status.endsWith("_FAILED")) {
|
|
610
|
+
delete this.resourcesInProgress[activity.event.LogicalResourceId];
|
|
611
|
+
}
|
|
612
|
+
if (hookStatus !== void 0 && hookStatus.endsWith("_COMPLETE_FAILED") && activity.event.LogicalResourceId !== void 0 && hookType !== void 0) {
|
|
613
|
+
if (this.hookFailureMap.has(activity.event.LogicalResourceId)) {
|
|
614
|
+
this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
|
|
615
|
+
} else {
|
|
616
|
+
this.hookFailureMap.set(activity.event.LogicalResourceId, /* @__PURE__ */ new Map());
|
|
617
|
+
this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
failureReason(activity) {
|
|
622
|
+
const resourceStatusReason = activity.event.ResourceStatusReason ?? "";
|
|
623
|
+
const logicalResourceId = activity.event.LogicalResourceId ?? "";
|
|
624
|
+
const hookFailureReasonMap = this.hookFailureMap.get(logicalResourceId);
|
|
625
|
+
if (hookFailureReasonMap !== void 0) {
|
|
626
|
+
for (const hookType of hookFailureReasonMap.keys()) {
|
|
627
|
+
if (resourceStatusReason.includes(hookType)) {
|
|
628
|
+
return resourceStatusReason + " : " + hookFailureReasonMap.get(hookType);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return resourceStatusReason;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Is the activity a meta activity for the stack itself.
|
|
636
|
+
*/
|
|
637
|
+
isActivityForTheStack(activity) {
|
|
638
|
+
return activity.event.PhysicalResourceId === activity.event.StackId;
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// ../../aws-cdk/lib/cli/activity-printer/history.ts
|
|
643
|
+
var util = __toESM(require("util"));
|
|
644
|
+
var chalk = __toESM(require("chalk"));
|
|
645
|
+
var HistoryActivityPrinter = class _HistoryActivityPrinter extends ActivityPrinterBase {
|
|
646
|
+
constructor(props) {
|
|
647
|
+
super(props);
|
|
648
|
+
/**
|
|
649
|
+
* Last time we printed something to the console.
|
|
650
|
+
*
|
|
651
|
+
* Used to measure timeout for progress reporting.
|
|
652
|
+
*/
|
|
653
|
+
this.lastPrintTime = Date.now();
|
|
654
|
+
/**
|
|
655
|
+
* Number of ms of change absence before we tell the user about the resources that are currently in progress.
|
|
656
|
+
*/
|
|
657
|
+
this.inProgressDelay = 3e4;
|
|
658
|
+
this.printable = new Array();
|
|
659
|
+
}
|
|
660
|
+
activity(activity) {
|
|
661
|
+
this.printable.push(activity);
|
|
662
|
+
super.activity(activity);
|
|
663
|
+
}
|
|
664
|
+
stop() {
|
|
665
|
+
super.stop();
|
|
666
|
+
if (this.failures.length > 0) {
|
|
667
|
+
this.stream.write("\nFailed resources:\n");
|
|
668
|
+
for (const failure of this.failures) {
|
|
669
|
+
if (this.isActivityForTheStack(failure)) {
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
this.printOne(failure, false);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
print() {
|
|
677
|
+
for (const activity of this.printable) {
|
|
678
|
+
this.printOne(activity);
|
|
679
|
+
this.lastPrinted = activity;
|
|
680
|
+
}
|
|
681
|
+
this.printable.splice(0, this.printable.length);
|
|
682
|
+
this.printInProgress(this.lastPrinted?.progress.formatted);
|
|
683
|
+
}
|
|
684
|
+
printOne(activity, progress) {
|
|
685
|
+
const event = activity.event;
|
|
686
|
+
const color = colorFromStatusResult(event.ResourceStatus);
|
|
687
|
+
let reasonColor = chalk.cyan;
|
|
688
|
+
let stackTrace = "";
|
|
689
|
+
const metadata = activity.metadata;
|
|
690
|
+
if (event.ResourceStatus && event.ResourceStatus.indexOf("FAILED") !== -1) {
|
|
691
|
+
if (progress == void 0 || progress) {
|
|
692
|
+
event.ResourceStatusReason = event.ResourceStatusReason ? this.failureReason(activity) : "";
|
|
693
|
+
}
|
|
694
|
+
if (metadata) {
|
|
695
|
+
stackTrace = metadata.entry.trace ? `
|
|
696
|
+
${metadata.entry.trace.join("\n \\_ ")}` : "";
|
|
697
|
+
}
|
|
698
|
+
reasonColor = chalk.red;
|
|
699
|
+
}
|
|
700
|
+
const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
|
|
701
|
+
const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
|
|
702
|
+
this.stream.write(
|
|
703
|
+
util.format(
|
|
704
|
+
"%s | %s%s | %s | %s | %s %s%s%s\n",
|
|
705
|
+
event.StackName,
|
|
706
|
+
progress !== false ? `${activity.progress.formatted} | ` : "",
|
|
707
|
+
new Date(event.Timestamp).toLocaleTimeString(),
|
|
708
|
+
color(padRight(_HistoryActivityPrinter.STATUS_WIDTH, (event.ResourceStatus || "").slice(0, _HistoryActivityPrinter.STATUS_WIDTH))),
|
|
709
|
+
// pad left and trim
|
|
710
|
+
padRight(this.resourceTypeColumnWidth, event.ResourceType || ""),
|
|
711
|
+
color(chalk.bold(resourceName)),
|
|
712
|
+
logicalId,
|
|
713
|
+
reasonColor(chalk.bold(event.ResourceStatusReason ? event.ResourceStatusReason : "")),
|
|
714
|
+
reasonColor(stackTrace)
|
|
715
|
+
)
|
|
716
|
+
);
|
|
717
|
+
this.lastPrintTime = Date.now();
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* If some resources are taking a while to create, notify the user about what's currently in progress
|
|
721
|
+
*/
|
|
722
|
+
printInProgress(progress) {
|
|
723
|
+
if (!progress || Date.now() < this.lastPrintTime + this.inProgressDelay) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (Object.keys(this.resourcesInProgress).length > 0) {
|
|
727
|
+
this.stream.write(
|
|
728
|
+
util.format(
|
|
729
|
+
"%s Currently in progress: %s\n",
|
|
730
|
+
progress,
|
|
731
|
+
chalk.bold(Object.keys(this.resourcesInProgress).join(", "))
|
|
732
|
+
)
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
this.lastPrintTime = Infinity;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
function colorFromStatusResult(status) {
|
|
739
|
+
if (!status) {
|
|
740
|
+
return chalk.reset;
|
|
741
|
+
}
|
|
742
|
+
if (status.indexOf("FAILED") !== -1) {
|
|
743
|
+
return chalk.red;
|
|
744
|
+
}
|
|
745
|
+
if (status.indexOf("ROLLBACK") !== -1) {
|
|
746
|
+
return chalk.yellow;
|
|
747
|
+
}
|
|
748
|
+
if (status.indexOf("COMPLETE") !== -1) {
|
|
749
|
+
return chalk.green;
|
|
750
|
+
}
|
|
751
|
+
return chalk.reset;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// ../../aws-cdk/lib/cli/activity-printer/current.ts
|
|
755
|
+
var util2 = __toESM(require("util"));
|
|
756
|
+
var chalk2 = __toESM(require("chalk"));
|
|
757
|
+
|
|
758
|
+
// ../../aws-cdk/lib/cli/activity-printer/display.ts
|
|
759
|
+
var wrapAnsi = require("wrap-ansi");
|
|
760
|
+
var RewritableBlock = class {
|
|
761
|
+
constructor(stream) {
|
|
762
|
+
this.stream = stream;
|
|
763
|
+
this.lastHeight = 0;
|
|
764
|
+
this.trailingEmptyLines = 0;
|
|
765
|
+
}
|
|
766
|
+
get width() {
|
|
767
|
+
return this.stream.columns;
|
|
768
|
+
}
|
|
769
|
+
get height() {
|
|
770
|
+
return this.stream.rows;
|
|
771
|
+
}
|
|
772
|
+
displayLines(lines) {
|
|
773
|
+
lines = terminalWrap(this.width, expandNewlines(lines));
|
|
774
|
+
lines = lines.slice(0, getMaxBlockHeight(this.height, this.lastHeight, lines));
|
|
775
|
+
this.stream.write(cursorUp(this.lastHeight));
|
|
776
|
+
for (const line of lines) {
|
|
777
|
+
this.stream.write(cll() + line + "\n");
|
|
778
|
+
}
|
|
779
|
+
this.trailingEmptyLines = Math.max(0, this.lastHeight - lines.length);
|
|
780
|
+
for (let i = 0; i < this.trailingEmptyLines; i++) {
|
|
781
|
+
this.stream.write(cll() + "\n");
|
|
782
|
+
}
|
|
783
|
+
this.lastHeight = Math.max(this.lastHeight, lines.length);
|
|
784
|
+
}
|
|
785
|
+
removeEmptyLines() {
|
|
786
|
+
this.stream.write(cursorUp(this.trailingEmptyLines));
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
var ESC = "\x1B";
|
|
790
|
+
function cursorUp(n) {
|
|
791
|
+
n = typeof n === "number" ? n : 1;
|
|
792
|
+
return n > 0 ? ESC + "[" + n + "A" : "";
|
|
793
|
+
}
|
|
794
|
+
function cll() {
|
|
795
|
+
return ESC + "[K";
|
|
796
|
+
}
|
|
797
|
+
function terminalWrap(width, lines) {
|
|
798
|
+
if (width === void 0) {
|
|
799
|
+
return lines;
|
|
800
|
+
}
|
|
801
|
+
return lines.flatMap((line) => wrapAnsi(line, width - 1, {
|
|
802
|
+
hard: true,
|
|
803
|
+
trim: true,
|
|
804
|
+
wordWrap: false
|
|
805
|
+
}).split("\n"));
|
|
806
|
+
}
|
|
807
|
+
function expandNewlines(lines) {
|
|
808
|
+
return lines.flatMap((line) => line.split("\n"));
|
|
809
|
+
}
|
|
810
|
+
function getMaxBlockHeight(windowHeight, lastHeight, lines) {
|
|
811
|
+
if (windowHeight === void 0) {
|
|
812
|
+
return Math.max(lines.length, lastHeight);
|
|
813
|
+
}
|
|
814
|
+
return lines.length < windowHeight ? lines.length : windowHeight - 1;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// ../../aws-cdk/lib/cli/activity-printer/current.ts
|
|
818
|
+
var CurrentActivityPrinter = class _CurrentActivityPrinter extends ActivityPrinterBase {
|
|
819
|
+
constructor(props) {
|
|
820
|
+
super(props);
|
|
821
|
+
this.block = new RewritableBlock(this.stream);
|
|
822
|
+
}
|
|
823
|
+
print() {
|
|
824
|
+
const lines = [];
|
|
825
|
+
const progressWidth = Math.max(
|
|
826
|
+
Math.min((this.block.width ?? 80) - PROGRESSBAR_EXTRA_SPACE - 1, MAX_PROGRESSBAR_WIDTH),
|
|
827
|
+
MIN_PROGRESSBAR_WIDTH
|
|
828
|
+
);
|
|
829
|
+
const prog = this.progressBar(progressWidth);
|
|
830
|
+
if (prog) {
|
|
831
|
+
lines.push(" " + prog, "");
|
|
832
|
+
}
|
|
833
|
+
const toPrint = [...this.failures, ...Object.values(this.resourcesInProgress)];
|
|
834
|
+
toPrint.sort((a, b) => a.event.Timestamp.getTime() - b.event.Timestamp.getTime());
|
|
835
|
+
lines.push(
|
|
836
|
+
...toPrint.map((res) => {
|
|
837
|
+
const color = colorFromStatusActivity(res.event.ResourceStatus);
|
|
838
|
+
const resourceName = res.metadata?.constructPath ?? res.event.LogicalResourceId ?? "";
|
|
839
|
+
return util2.format(
|
|
840
|
+
"%s | %s | %s | %s%s",
|
|
841
|
+
padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(res.event.Timestamp).toLocaleTimeString()),
|
|
842
|
+
color(padRight(_CurrentActivityPrinter.STATUS_WIDTH, (res.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH))),
|
|
843
|
+
padRight(this.resourceTypeColumnWidth, res.event.ResourceType || ""),
|
|
844
|
+
color(chalk2.bold(shorten(40, resourceName))),
|
|
845
|
+
this.failureReasonOnNextLine(res)
|
|
846
|
+
);
|
|
847
|
+
})
|
|
848
|
+
);
|
|
849
|
+
this.block.displayLines(lines);
|
|
850
|
+
}
|
|
851
|
+
stop() {
|
|
852
|
+
super.stop();
|
|
853
|
+
const lines = new Array();
|
|
854
|
+
for (const failure of this.failures) {
|
|
855
|
+
if (this.isActivityForTheStack(failure)) {
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
lines.push(
|
|
859
|
+
util2.format(
|
|
860
|
+
chalk2.red("%s | %s | %s | %s%s") + "\n",
|
|
861
|
+
padLeft(_CurrentActivityPrinter.TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
|
|
862
|
+
padRight(_CurrentActivityPrinter.STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, _CurrentActivityPrinter.STATUS_WIDTH)),
|
|
863
|
+
padRight(this.resourceTypeColumnWidth, failure.event.ResourceType || ""),
|
|
864
|
+
shorten(40, failure.event.LogicalResourceId ?? ""),
|
|
865
|
+
this.failureReasonOnNextLine(failure)
|
|
866
|
+
)
|
|
867
|
+
);
|
|
868
|
+
const trace3 = failure.metadata?.entry?.trace;
|
|
869
|
+
if (trace3) {
|
|
870
|
+
lines.push(chalk2.red(` ${trace3.join("\n \\_ ")}
|
|
871
|
+
`));
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
this.block.displayLines(lines);
|
|
875
|
+
this.block.removeEmptyLines();
|
|
876
|
+
}
|
|
877
|
+
progressBar(width) {
|
|
878
|
+
if (!this.stackProgress || !this.stackProgress.total) {
|
|
879
|
+
return "";
|
|
880
|
+
}
|
|
881
|
+
const fraction = Math.min(this.stackProgress.completed / this.stackProgress.total, 1);
|
|
882
|
+
const innerWidth = Math.max(1, width - 2);
|
|
883
|
+
const chars = innerWidth * fraction;
|
|
884
|
+
const remainder = chars - Math.floor(chars);
|
|
885
|
+
const fullChars = FULL_BLOCK.repeat(Math.floor(chars));
|
|
886
|
+
const partialChar = PARTIAL_BLOCK[Math.floor(remainder * PARTIAL_BLOCK.length)];
|
|
887
|
+
const filler = "\xB7".repeat(innerWidth - Math.floor(chars) - (partialChar ? 1 : 0));
|
|
888
|
+
const color = this.rollingBack ? chalk2.yellow : chalk2.green;
|
|
889
|
+
return "[" + color(fullChars + partialChar) + filler + `] (${this.stackProgress.completed}/${this.stackProgress.total})`;
|
|
890
|
+
}
|
|
891
|
+
failureReasonOnNextLine(activity) {
|
|
892
|
+
return stackEventHasErrorMessage(activity.event.ResourceStatus ?? "") ? `
|
|
893
|
+
${" ".repeat(_CurrentActivityPrinter.TIMESTAMP_WIDTH + _CurrentActivityPrinter.STATUS_WIDTH + 6)}${chalk2.red(this.failureReason(activity) ?? "")}` : "";
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
var FULL_BLOCK = "\u2588";
|
|
897
|
+
var PARTIAL_BLOCK = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
|
|
898
|
+
var MAX_PROGRESSBAR_WIDTH = 60;
|
|
899
|
+
var MIN_PROGRESSBAR_WIDTH = 10;
|
|
900
|
+
var PROGRESSBAR_EXTRA_SPACE = 2 + 2 + 4 + 6;
|
|
901
|
+
function colorFromStatusActivity(status) {
|
|
902
|
+
if (!status) {
|
|
903
|
+
return chalk2.reset;
|
|
904
|
+
}
|
|
905
|
+
if (status.endsWith("_FAILED")) {
|
|
906
|
+
return chalk2.red;
|
|
907
|
+
}
|
|
908
|
+
if (status.startsWith("CREATE_") || status.startsWith("UPDATE_") || status.startsWith("IMPORT_")) {
|
|
909
|
+
return chalk2.green;
|
|
910
|
+
}
|
|
911
|
+
if (status.indexOf("ROLLBACK_") !== -1) {
|
|
912
|
+
return chalk2.yellow;
|
|
913
|
+
}
|
|
914
|
+
if (status.startsWith("DELETE_")) {
|
|
915
|
+
return chalk2.yellow;
|
|
916
|
+
}
|
|
917
|
+
return chalk2.reset;
|
|
918
|
+
}
|
|
919
|
+
function shorten(maxWidth, p) {
|
|
920
|
+
if (p.length <= maxWidth) {
|
|
921
|
+
return p;
|
|
922
|
+
}
|
|
923
|
+
const half = Math.floor((maxWidth - 3) / 2);
|
|
924
|
+
return p.slice(0, half) + "..." + p.slice(-half);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// ../../aws-cdk/lib/toolkit/cli-io-host.ts
|
|
928
|
+
var levelPriority = {
|
|
929
|
+
error: 0,
|
|
930
|
+
result: 1,
|
|
931
|
+
warn: 2,
|
|
932
|
+
info: 3,
|
|
933
|
+
debug: 4,
|
|
934
|
+
trace: 5
|
|
935
|
+
};
|
|
936
|
+
var CliIoHost = class _CliIoHost {
|
|
937
|
+
constructor(props = {}) {
|
|
938
|
+
this._progress = "bar" /* BAR */;
|
|
939
|
+
// Corked Logging
|
|
940
|
+
this.corkedCounter = 0;
|
|
941
|
+
this.corkedLoggingBuffer = [];
|
|
942
|
+
this._currentAction = props.currentAction ?? "none";
|
|
943
|
+
this._isTTY = props.isTTY ?? process.stdout.isTTY ?? false;
|
|
944
|
+
this._logLevel = props.logLevel ?? "info";
|
|
945
|
+
this._isCI = props.isCI ?? isCI();
|
|
946
|
+
this.stackProgress = props.stackProgress ?? "bar" /* BAR */;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Returns the singleton instance
|
|
950
|
+
*/
|
|
951
|
+
static instance(props = {}, forceNew = false) {
|
|
952
|
+
if (forceNew || !_CliIoHost._instance) {
|
|
953
|
+
_CliIoHost._instance = new _CliIoHost(props);
|
|
954
|
+
}
|
|
955
|
+
return _CliIoHost._instance;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Returns the singleton instance
|
|
959
|
+
*/
|
|
960
|
+
registerIoHost(ioHost) {
|
|
961
|
+
if (ioHost !== this) {
|
|
962
|
+
this._internalIoHost = ioHost;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Update the stackProgress preference.
|
|
967
|
+
*/
|
|
968
|
+
set stackProgress(type) {
|
|
969
|
+
this._progress = type;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Gets the stackProgress value.
|
|
973
|
+
*
|
|
974
|
+
* This takes into account other state of the ioHost,
|
|
975
|
+
* like if isTTY and isCI.
|
|
976
|
+
*/
|
|
977
|
+
get stackProgress() {
|
|
978
|
+
if (this._progress === "events" /* EVENTS */) {
|
|
979
|
+
return this._progress;
|
|
980
|
+
}
|
|
981
|
+
const verboseLogging = levelPriority[this.logLevel] > levelPriority.info;
|
|
982
|
+
if (verboseLogging) {
|
|
983
|
+
return "events" /* EVENTS */;
|
|
984
|
+
}
|
|
985
|
+
const isWindows = process.platform === "win32";
|
|
986
|
+
if (isWindows) {
|
|
987
|
+
return "events" /* EVENTS */;
|
|
988
|
+
}
|
|
989
|
+
const fancyOutputAvailable = this.isTTY && !this.isCI;
|
|
990
|
+
if (!fancyOutputAvailable) {
|
|
991
|
+
return "events" /* EVENTS */;
|
|
992
|
+
}
|
|
993
|
+
return this._progress;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* The current action being performed by the CLI.
|
|
997
|
+
*/
|
|
998
|
+
get currentAction() {
|
|
999
|
+
return this._currentAction;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Sets the current action being performed by the CLI.
|
|
1003
|
+
*
|
|
1004
|
+
* @param action The action being performed by the CLI.
|
|
1005
|
+
*/
|
|
1006
|
+
set currentAction(action) {
|
|
1007
|
+
this._currentAction = action;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Whether the host can use interactions and message styling.
|
|
1011
|
+
*/
|
|
1012
|
+
get isTTY() {
|
|
1013
|
+
return this._isTTY;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Set TTY mode, i.e can the host use interactions and message styling.
|
|
1017
|
+
*
|
|
1018
|
+
* @param value set TTY mode
|
|
1019
|
+
*/
|
|
1020
|
+
set isTTY(value) {
|
|
1021
|
+
this._isTTY = value;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Whether the CliIoHost is running in CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
|
|
1025
|
+
*/
|
|
1026
|
+
get isCI() {
|
|
1027
|
+
return this._isCI;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Set the CI mode. In CI mode, all non-error output goes to stdout instead of stderr.
|
|
1031
|
+
* @param value set the CI mode
|
|
1032
|
+
*/
|
|
1033
|
+
set isCI(value) {
|
|
1034
|
+
this._isCI = value;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* The current threshold. Messages with a lower priority level will be ignored.
|
|
1038
|
+
*/
|
|
1039
|
+
get logLevel() {
|
|
1040
|
+
return this._logLevel;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Sets the current threshold. Messages with a lower priority level will be ignored.
|
|
1044
|
+
* @param level The new log level threshold
|
|
1045
|
+
*/
|
|
1046
|
+
set logLevel(level) {
|
|
1047
|
+
this._logLevel = level;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Executes a block of code with corked logging. All log messages during execution
|
|
1051
|
+
* are buffered and only written when all nested cork blocks complete (when CORK_COUNTER reaches 0).
|
|
1052
|
+
* The corking is bound to the specific instance of the CliIoHost.
|
|
1053
|
+
*
|
|
1054
|
+
* @param block - Async function to execute with corked logging
|
|
1055
|
+
* @returns Promise that resolves with the block's return value
|
|
1056
|
+
*/
|
|
1057
|
+
async withCorkedLogging(block) {
|
|
1058
|
+
this.corkedCounter++;
|
|
1059
|
+
try {
|
|
1060
|
+
return await block();
|
|
1061
|
+
} finally {
|
|
1062
|
+
this.corkedCounter--;
|
|
1063
|
+
if (this.corkedCounter === 0) {
|
|
1064
|
+
for (const ioMessage of this.corkedLoggingBuffer) {
|
|
1065
|
+
await this.notify(ioMessage);
|
|
1066
|
+
}
|
|
1067
|
+
this.corkedLoggingBuffer.splice(0);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Notifies the host of a message.
|
|
1073
|
+
* The caller waits until the notification completes.
|
|
1074
|
+
*/
|
|
1075
|
+
async notify(msg) {
|
|
1076
|
+
if (this._internalIoHost) {
|
|
1077
|
+
return this._internalIoHost.notify(msg);
|
|
1078
|
+
}
|
|
1079
|
+
if (this.isStackActivity(msg)) {
|
|
1080
|
+
if (!this.activityPrinter) {
|
|
1081
|
+
this.activityPrinter = this.makeActivityPrinter();
|
|
1082
|
+
}
|
|
1083
|
+
await this.activityPrinter.notify(msg);
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
if (levelPriority[msg.level] > levelPriority[this.logLevel]) {
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
if (this.corkedCounter > 0) {
|
|
1090
|
+
this.corkedLoggingBuffer.push(msg);
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
const output = this.formatMessage(msg);
|
|
1094
|
+
const stream = this.selectStream(msg.level);
|
|
1095
|
+
stream.write(output);
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Detect stack activity messages so they can be send to the printer.
|
|
1099
|
+
*/
|
|
1100
|
+
isStackActivity(msg) {
|
|
1101
|
+
return [
|
|
1102
|
+
"CDK_TOOLKIT_I5501",
|
|
1103
|
+
"CDK_TOOLKIT_I5502",
|
|
1104
|
+
"CDK_TOOLKIT_I5503"
|
|
1105
|
+
].includes(msg.code);
|
|
305
1106
|
}
|
|
306
1107
|
/**
|
|
307
1108
|
* Determines the output stream, based on message level and configuration.
|
|
@@ -341,14 +1142,14 @@ var CliIoHost = class _CliIoHost {
|
|
|
341
1142
|
throw new ToolkitError(`${motivation}, but concurrency is greater than 1 so we are unable to get a confirmation from the user`);
|
|
342
1143
|
}
|
|
343
1144
|
if (isConfirmationPrompt(msg)) {
|
|
344
|
-
const confirmed = await promptly.confirm(`${
|
|
1145
|
+
const confirmed = await promptly.confirm(`${chalk3.cyan(msg.message)} (y/n)`);
|
|
345
1146
|
if (!confirmed) {
|
|
346
1147
|
throw new ToolkitError("Aborted by user");
|
|
347
1148
|
}
|
|
348
1149
|
return confirmed;
|
|
349
1150
|
}
|
|
350
1151
|
const prompt4 = extractPromptInfo(msg);
|
|
351
|
-
const answer = await promptly.prompt(`${
|
|
1152
|
+
const answer = await promptly.prompt(`${chalk3.cyan(msg.message)} (${prompt4.default})`, {
|
|
352
1153
|
default: prompt4.default
|
|
353
1154
|
});
|
|
354
1155
|
return prompt4.convertAnswer(answer);
|
|
@@ -369,6 +1170,20 @@ var CliIoHost = class _CliIoHost {
|
|
|
369
1170
|
const pad = (n) => n.toString().padStart(2, "0");
|
|
370
1171
|
return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
371
1172
|
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Get an instance of the ActivityPrinter
|
|
1175
|
+
*/
|
|
1176
|
+
makeActivityPrinter() {
|
|
1177
|
+
const props = {
|
|
1178
|
+
stream: this.selectStream("info")
|
|
1179
|
+
};
|
|
1180
|
+
switch (this.stackProgress) {
|
|
1181
|
+
case "events" /* EVENTS */:
|
|
1182
|
+
return new HistoryActivityPrinter(props);
|
|
1183
|
+
case "bar" /* BAR */:
|
|
1184
|
+
return new CurrentActivityPrinter(props);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
372
1187
|
};
|
|
373
1188
|
function isPromptableRequest(msg) {
|
|
374
1189
|
return isConfirmationPrompt(msg) || typeof msg.defaultResponse === "string" || typeof msg.defaultResponse === "number";
|
|
@@ -379,17 +1194,17 @@ function isConfirmationPrompt(msg) {
|
|
|
379
1194
|
function extractPromptInfo(msg) {
|
|
380
1195
|
const isNumber = typeof msg.defaultResponse === "number";
|
|
381
1196
|
return {
|
|
382
|
-
default:
|
|
1197
|
+
default: util3.format(msg.defaultResponse),
|
|
383
1198
|
convertAnswer: isNumber ? (v) => Number(v) : (v) => String(v)
|
|
384
1199
|
};
|
|
385
1200
|
}
|
|
386
1201
|
var styleMap = {
|
|
387
|
-
error:
|
|
388
|
-
warn:
|
|
389
|
-
result:
|
|
390
|
-
info:
|
|
391
|
-
debug:
|
|
392
|
-
trace:
|
|
1202
|
+
error: chalk3.red,
|
|
1203
|
+
warn: chalk3.yellow,
|
|
1204
|
+
result: chalk3.white,
|
|
1205
|
+
info: chalk3.white,
|
|
1206
|
+
debug: chalk3.gray,
|
|
1207
|
+
trace: chalk3.gray
|
|
393
1208
|
};
|
|
394
1209
|
function isCI() {
|
|
395
1210
|
return process.env.CI !== void 0 && process.env.CI !== "false" && process.env.CI !== "0";
|
|
@@ -398,7 +1213,7 @@ function isCI() {
|
|
|
398
1213
|
// ../../aws-cdk/lib/logging.ts
|
|
399
1214
|
function formatMessageAndLog(level, input, style, ...args) {
|
|
400
1215
|
const { message, code = getDefaultCode(level) } = typeof input === "object" ? input : { message: input };
|
|
401
|
-
const formattedMessage = args.length > 0 ?
|
|
1216
|
+
const formattedMessage = args.length > 0 ? util4.format(message, ...args) : message;
|
|
402
1217
|
const finalMessage = style ? style(formattedMessage) : formattedMessage;
|
|
403
1218
|
const ioHost = CliIoHost.instance();
|
|
404
1219
|
const ioMessage = {
|
|
@@ -431,11 +1246,11 @@ var trace = (input, ...args) => {
|
|
|
431
1246
|
};
|
|
432
1247
|
|
|
433
1248
|
// ../../aws-cdk/lib/util/directories.ts
|
|
434
|
-
var
|
|
1249
|
+
var fs2 = __toESM(require("fs"));
|
|
435
1250
|
var os = __toESM(require("os"));
|
|
436
1251
|
var path = __toESM(require("path"));
|
|
437
1252
|
function cdkHomeDir() {
|
|
438
|
-
const tmpDir =
|
|
1253
|
+
const tmpDir = fs2.realpathSync(os.tmpdir());
|
|
439
1254
|
let home;
|
|
440
1255
|
try {
|
|
441
1256
|
let userInfoHome = os.userInfo().homedir;
|
|
@@ -445,7 +1260,7 @@ function cdkHomeDir() {
|
|
|
445
1260
|
home = path.join((userInfoHome ?? os.homedir()).trim(), ".cdk");
|
|
446
1261
|
} catch {
|
|
447
1262
|
}
|
|
448
|
-
return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home ||
|
|
1263
|
+
return process.env.CDK_HOME ? path.resolve(process.env.CDK_HOME) : home || fs2.mkdtempSync(path.join(tmpDir, ".cdk")).trim();
|
|
449
1264
|
}
|
|
450
1265
|
function cdkCacheDir() {
|
|
451
1266
|
return path.join(cdkHomeDir(), "cache");
|
|
@@ -453,7 +1268,7 @@ function cdkCacheDir() {
|
|
|
453
1268
|
function rootDir(fail) {
|
|
454
1269
|
function _rootDir(dirname5) {
|
|
455
1270
|
const manifestPath = path.join(dirname5, "package.json");
|
|
456
|
-
if (
|
|
1271
|
+
if (fs2.existsSync(manifestPath)) {
|
|
457
1272
|
return dirname5;
|
|
458
1273
|
}
|
|
459
1274
|
if (path.dirname(dirname5) === dirname5) {
|
|
@@ -520,7 +1335,7 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
|
|
|
520
1335
|
}
|
|
521
1336
|
async loadMap() {
|
|
522
1337
|
try {
|
|
523
|
-
return await
|
|
1338
|
+
return await fs3.readJson(this.cacheFile);
|
|
524
1339
|
} catch (e) {
|
|
525
1340
|
if (e.code === "ENOENT" || e.code === "EACCES") {
|
|
526
1341
|
return {};
|
|
@@ -533,8 +1348,8 @@ var AccountAccessKeyCache = class _AccountAccessKeyCache {
|
|
|
533
1348
|
}
|
|
534
1349
|
async saveMap(map) {
|
|
535
1350
|
try {
|
|
536
|
-
await
|
|
537
|
-
await
|
|
1351
|
+
await fs3.ensureFile(this.cacheFile);
|
|
1352
|
+
await fs3.writeJson(this.cacheFile, map, { spaces: 2 });
|
|
538
1353
|
} catch (e) {
|
|
539
1354
|
if (e.code === "ENOENT" || e.code === "EACCES" || e.code === "EROFS") {
|
|
540
1355
|
return;
|
|
@@ -603,13 +1418,13 @@ function traceMemberMethods(constructor) {
|
|
|
603
1418
|
var path3 = __toESM(require("path"));
|
|
604
1419
|
|
|
605
1420
|
// ../../aws-cdk/lib/api/aws-auth/util.ts
|
|
606
|
-
var
|
|
1421
|
+
var fs4 = __toESM(require("fs-extra"));
|
|
607
1422
|
function readIfPossible(filename) {
|
|
608
1423
|
try {
|
|
609
|
-
if (!
|
|
1424
|
+
if (!fs4.pathExistsSync(filename)) {
|
|
610
1425
|
return void 0;
|
|
611
1426
|
}
|
|
612
|
-
return
|
|
1427
|
+
return fs4.readFileSync(filename, { encoding: "utf-8" });
|
|
613
1428
|
} catch (e) {
|
|
614
1429
|
debug(e);
|
|
615
1430
|
return void 0;
|
|
@@ -625,15 +1440,6 @@ function defaultCliUserAgent() {
|
|
|
625
1440
|
return `${name}/${version}`;
|
|
626
1441
|
}
|
|
627
1442
|
|
|
628
|
-
// ../../aws-cdk/lib/util/format-error.ts
|
|
629
|
-
function formatErrorMessage(error3) {
|
|
630
|
-
if (error3 && Array.isArray(error3.errors)) {
|
|
631
|
-
const innerMessages = error3.errors.map((innerError) => innerError?.message || innerError?.toString()).join("\n");
|
|
632
|
-
return `AggregateError: ${innerMessages}`;
|
|
633
|
-
}
|
|
634
|
-
return error3?.message || error3?.toString() || "Unknown error";
|
|
635
|
-
}
|
|
636
|
-
|
|
637
1443
|
// ../../aws-cdk/lib/api/aws-auth/sdk.ts
|
|
638
1444
|
var SDK = class {
|
|
639
1445
|
constructor(credProvider, region, requestHandler, logger) {
|
|
@@ -690,6 +1496,13 @@ var SDK = class {
|
|
|
690
1496
|
}
|
|
691
1497
|
};
|
|
692
1498
|
}
|
|
1499
|
+
cloudControl() {
|
|
1500
|
+
const client = new import_client_cloudcontrol.CloudControlClient(this.config);
|
|
1501
|
+
return {
|
|
1502
|
+
listResources: (input) => client.send(new import_client_cloudcontrol.ListResourcesCommand(input)),
|
|
1503
|
+
getResource: (input) => client.send(new import_client_cloudcontrol.GetResourceCommand(input))
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
693
1506
|
cloudFormation() {
|
|
694
1507
|
const client = new import_client_cloudformation.CloudFormationClient({
|
|
695
1508
|
...this.config,
|
|
@@ -1142,11 +1955,11 @@ async function tokenCodeFn(serialArn) {
|
|
|
1142
1955
|
}
|
|
1143
1956
|
|
|
1144
1957
|
// ../../aws-cdk/lib/api/aws-auth/credential-plugins.ts
|
|
1145
|
-
var
|
|
1958
|
+
var import_util7 = require("util");
|
|
1146
1959
|
|
|
1147
1960
|
// ../../aws-cdk/lib/api/plugin/plugin.ts
|
|
1148
|
-
var
|
|
1149
|
-
var
|
|
1961
|
+
var import_util6 = require("util");
|
|
1962
|
+
var chalk5 = __toESM(require("chalk"));
|
|
1150
1963
|
|
|
1151
1964
|
// ../../aws-cdk/lib/api/plugin/context-provider-plugin.ts
|
|
1152
1965
|
function isContextProviderPlugin(x) {
|
|
@@ -1179,14 +1992,14 @@ var PluginHost = class _PluginHost {
|
|
|
1179
1992
|
try {
|
|
1180
1993
|
const plugin = require(moduleSpec);
|
|
1181
1994
|
if (!isPlugin(plugin)) {
|
|
1182
|
-
error(`Module ${
|
|
1995
|
+
error(`Module ${chalk5.green(moduleSpec)} is not a valid plug-in, or has an unsupported version.`);
|
|
1183
1996
|
throw new ToolkitError(`Module ${moduleSpec} does not define a valid plug-in.`);
|
|
1184
1997
|
}
|
|
1185
1998
|
if (plugin.init) {
|
|
1186
1999
|
plugin.init(this);
|
|
1187
2000
|
}
|
|
1188
2001
|
} catch (e) {
|
|
1189
|
-
error(`Unable to load ${
|
|
2002
|
+
error(`Unable to load ${chalk5.green(moduleSpec)}: ${e.stack}`);
|
|
1190
2003
|
throw new ToolkitError(`Unable to load plug-in: ${moduleSpec}: ${e}`);
|
|
1191
2004
|
}
|
|
1192
2005
|
function isPlugin(x) {
|
|
@@ -1235,7 +2048,7 @@ var PluginHost = class _PluginHost {
|
|
|
1235
2048
|
*/
|
|
1236
2049
|
registerContextProviderAlpha(pluginProviderName, provider) {
|
|
1237
2050
|
if (!isContextProviderPlugin(provider)) {
|
|
1238
|
-
throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0,
|
|
2051
|
+
throw new ToolkitError(`Object you gave me does not look like a ContextProviderPlugin: ${(0, import_util6.inspect)(provider)}`);
|
|
1239
2052
|
}
|
|
1240
2053
|
this.contextProviderPlugins[pluginProviderName] = provider;
|
|
1241
2054
|
}
|
|
@@ -1304,7 +2117,7 @@ async function v3ProviderFromPlugin(producer) {
|
|
|
1304
2117
|
} else if (isV2Credentials(initial)) {
|
|
1305
2118
|
return v3ProviderFromV2Credentials(initial);
|
|
1306
2119
|
} else {
|
|
1307
|
-
throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0,
|
|
2120
|
+
throw new AuthenticationError(`Plugin returned a value that doesn't resemble AWS credentials: ${(0, import_util7.inspect)(initial)}`);
|
|
1308
2121
|
}
|
|
1309
2122
|
}
|
|
1310
2123
|
function v3ProviderFromV2Credentials(x) {
|
|
@@ -1323,7 +2136,7 @@ function refreshFromPluginProvider(current, producer) {
|
|
|
1323
2136
|
if (credentialsAboutToExpire(current)) {
|
|
1324
2137
|
const newCreds = await producer();
|
|
1325
2138
|
if (!isV3Credentials(newCreds)) {
|
|
1326
|
-
throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0,
|
|
2139
|
+
throw new AuthenticationError(`Plugin initially returned static V3 credentials but now returned something else: ${(0, import_util7.inspect)(newCreds)}`);
|
|
1327
2140
|
}
|
|
1328
2141
|
current = newCreds;
|
|
1329
2142
|
}
|
|
@@ -1612,117 +2425,7 @@ async function initContextProviderSdk(aws, options) {
|
|
|
1612
2425
|
}
|
|
1613
2426
|
|
|
1614
2427
|
// ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
|
|
1615
|
-
var
|
|
1616
|
-
|
|
1617
|
-
// ../../aws-cdk/lib/util/serialize.ts
|
|
1618
|
-
var fs4 = __toESM(require("fs-extra"));
|
|
1619
|
-
|
|
1620
|
-
// ../../aws-cdk/lib/util/bytes.ts
|
|
1621
|
-
function formatBytes(bytes, decimals = 2) {
|
|
1622
|
-
decimals = decimals < 0 ? 0 : decimals;
|
|
1623
|
-
if (bytes === 0) {
|
|
1624
|
-
return "0 Bytes";
|
|
1625
|
-
}
|
|
1626
|
-
const k = 1024;
|
|
1627
|
-
const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
1628
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1629
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(decimals))} ${sizes[i]}`;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
// ../../aws-cdk/lib/util/yaml-cfn.ts
|
|
1633
|
-
var yaml = __toESM(require("yaml"));
|
|
1634
|
-
var yaml_types = __toESM(require("yaml/types"));
|
|
1635
|
-
function serialize(obj) {
|
|
1636
|
-
const oldFold = yaml_types.strOptions.fold.lineWidth;
|
|
1637
|
-
try {
|
|
1638
|
-
yaml_types.strOptions.fold.lineWidth = 0;
|
|
1639
|
-
return yaml.stringify(obj, { schema: "yaml-1.1" });
|
|
1640
|
-
} finally {
|
|
1641
|
-
yaml_types.strOptions.fold.lineWidth = oldFold;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
function deserialize(str) {
|
|
1645
|
-
return parseYamlStrWithCfnTags(str);
|
|
1646
|
-
}
|
|
1647
|
-
function makeTagForCfnIntrinsic(intrinsicName, addFnPrefix) {
|
|
1648
|
-
return {
|
|
1649
|
-
identify(value) {
|
|
1650
|
-
return typeof value === "string";
|
|
1651
|
-
},
|
|
1652
|
-
tag: `!${intrinsicName}`,
|
|
1653
|
-
resolve: (_doc, cstNode) => {
|
|
1654
|
-
const ret = {};
|
|
1655
|
-
ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = // the +1 is to account for the ! the short form begins with
|
|
1656
|
-
parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1));
|
|
1657
|
-
return ret;
|
|
1658
|
-
}
|
|
1659
|
-
};
|
|
1660
|
-
}
|
|
1661
|
-
var shortForms = [
|
|
1662
|
-
"Base64",
|
|
1663
|
-
"Cidr",
|
|
1664
|
-
"FindInMap",
|
|
1665
|
-
"GetAZs",
|
|
1666
|
-
"ImportValue",
|
|
1667
|
-
"Join",
|
|
1668
|
-
"Sub",
|
|
1669
|
-
"Select",
|
|
1670
|
-
"Split",
|
|
1671
|
-
"Transform",
|
|
1672
|
-
"And",
|
|
1673
|
-
"Equals",
|
|
1674
|
-
"If",
|
|
1675
|
-
"Not",
|
|
1676
|
-
"Or",
|
|
1677
|
-
"GetAtt"
|
|
1678
|
-
].map((name) => makeTagForCfnIntrinsic(name, true)).concat(
|
|
1679
|
-
makeTagForCfnIntrinsic("Ref", false),
|
|
1680
|
-
makeTagForCfnIntrinsic("Condition", false)
|
|
1681
|
-
);
|
|
1682
|
-
function parseYamlStrWithCfnTags(text) {
|
|
1683
|
-
return yaml.parse(text, {
|
|
1684
|
-
customTags: shortForms,
|
|
1685
|
-
schema: "core"
|
|
1686
|
-
});
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
// ../../aws-cdk/lib/util/serialize.ts
|
|
1690
|
-
function toYAML(obj) {
|
|
1691
|
-
return serialize(obj);
|
|
1692
|
-
}
|
|
1693
|
-
function deserializeStructure(str) {
|
|
1694
|
-
return deserialize(str);
|
|
1695
|
-
}
|
|
1696
|
-
function serializeStructure(object, json) {
|
|
1697
|
-
if (json) {
|
|
1698
|
-
return JSON.stringify(object, void 0, 2);
|
|
1699
|
-
} else {
|
|
1700
|
-
return toYAML(object);
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
function obscureTemplate(template = {}) {
|
|
1704
|
-
if (template.Rules) {
|
|
1705
|
-
if (template.Rules.CheckBootstrapVersion) {
|
|
1706
|
-
if (Object.keys(template.Rules).length > 1) {
|
|
1707
|
-
delete template.Rules.CheckBootstrapVersion;
|
|
1708
|
-
} else {
|
|
1709
|
-
delete template.Rules;
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
return template;
|
|
1714
|
-
}
|
|
1715
|
-
function isJsonBuffer(value) {
|
|
1716
|
-
return typeof value === "object" && "type" in value && value.type === "Buffer" && "data" in value && Array.isArray(value.data);
|
|
1717
|
-
}
|
|
1718
|
-
function replacerBufferWithInfo(_key, value) {
|
|
1719
|
-
if (isJsonBuffer(value)) {
|
|
1720
|
-
return `<Buffer: ${formatBytes(value.data.length)}>`;
|
|
1721
|
-
}
|
|
1722
|
-
return value;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
// ../../aws-cdk/lib/api/aws-auth/sdk-logger.ts
|
|
2428
|
+
var import_util8 = require("util");
|
|
1726
2429
|
function formatSdkLoggerContent(content) {
|
|
1727
2430
|
if (content.length === 1) {
|
|
1728
2431
|
const apiFmt = formatApiCall(content[0]);
|
|
@@ -1730,7 +2433,7 @@ function formatSdkLoggerContent(content) {
|
|
|
1730
2433
|
return apiFmt;
|
|
1731
2434
|
}
|
|
1732
2435
|
}
|
|
1733
|
-
return content.map((x) => typeof x === "string" ? x : (0,
|
|
2436
|
+
return content.map((x) => typeof x === "string" ? x : (0, import_util8.inspect)(x)).join("");
|
|
1734
2437
|
}
|
|
1735
2438
|
function formatApiCall(content) {
|
|
1736
2439
|
if (!isSdkApiCallSuccess(content) && !isSdkApiCallError(content)) {
|
|
@@ -1742,141 +2445,25 @@ function formatApiCall(content) {
|
|
|
1742
2445
|
if ((content.metadata?.attempts ?? 0) > 1) {
|
|
1743
2446
|
parts.push(`[${content.metadata?.attempts} attempts, ${content.metadata?.totalRetryDelay}ms retry]`);
|
|
1744
2447
|
}
|
|
1745
|
-
parts.push(`${service}.${api}(${JSON.stringify(content.input, replacerBufferWithInfo)})`);
|
|
1746
|
-
if (isSdkApiCallSuccess(content)) {
|
|
1747
|
-
parts.push("-> OK");
|
|
1748
|
-
} else {
|
|
1749
|
-
parts.push(`-> ${content.error}`);
|
|
1750
|
-
}
|
|
1751
|
-
return parts.join(" ");
|
|
1752
|
-
}
|
|
1753
|
-
function isSdkApiCallSuccess(x) {
|
|
1754
|
-
return x && typeof x === "object" && x.commandName && x.output;
|
|
1755
|
-
}
|
|
1756
|
-
function isSdkApiCallError(x) {
|
|
1757
|
-
return x && typeof x === "object" && x.commandName && x.error;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
// ../../aws-cdk/lib/api/settings.ts
|
|
1761
|
-
var os3 = __toESM(require("os"));
|
|
1762
|
-
var fs_path = __toESM(require("path"));
|
|
1763
|
-
var fs5 = __toESM(require("fs-extra"));
|
|
1764
|
-
|
|
1765
|
-
// ../../aws-cdk/lib/util/types.ts
|
|
1766
|
-
function isObject(x) {
|
|
1767
|
-
return x !== null && typeof x === "object" && !isArray(x);
|
|
1768
|
-
}
|
|
1769
|
-
var isArray = Array.isArray;
|
|
1770
|
-
|
|
1771
|
-
// ../../aws-cdk/lib/util/objects.ts
|
|
1772
|
-
function deepClone(x) {
|
|
1773
|
-
if (typeof x === "undefined") {
|
|
1774
|
-
return void 0;
|
|
1775
|
-
}
|
|
1776
|
-
if (x === null) {
|
|
1777
|
-
return null;
|
|
1778
|
-
}
|
|
1779
|
-
if (isArray(x)) {
|
|
1780
|
-
return x.map(deepClone);
|
|
1781
|
-
}
|
|
1782
|
-
if (isObject(x)) {
|
|
1783
|
-
return makeObject(mapObject(x, (k, v) => [k, deepClone(v)]));
|
|
1784
|
-
}
|
|
1785
|
-
return x;
|
|
1786
|
-
}
|
|
1787
|
-
function mapObject(x, fn) {
|
|
1788
|
-
const ret = [];
|
|
1789
|
-
Object.keys(x).forEach((key) => {
|
|
1790
|
-
ret.push(fn(key, x[key]));
|
|
1791
|
-
});
|
|
1792
|
-
return ret;
|
|
1793
|
-
}
|
|
1794
|
-
function makeObject(pairs) {
|
|
1795
|
-
const ret = {};
|
|
1796
|
-
for (const pair of pairs) {
|
|
1797
|
-
ret[pair[0]] = pair[1];
|
|
1798
|
-
}
|
|
1799
|
-
return ret;
|
|
1800
|
-
}
|
|
1801
|
-
function deepGet(x, path12) {
|
|
1802
|
-
path12 = path12.slice();
|
|
1803
|
-
while (path12.length > 0 && isObject(x)) {
|
|
1804
|
-
const key = path12.shift();
|
|
1805
|
-
x = x[key];
|
|
1806
|
-
}
|
|
1807
|
-
return path12.length === 0 ? x : void 0;
|
|
1808
|
-
}
|
|
1809
|
-
function deepSet(x, path12, value) {
|
|
1810
|
-
path12 = path12.slice();
|
|
1811
|
-
if (path12.length === 0) {
|
|
1812
|
-
throw new ToolkitError("Path may not be empty");
|
|
1813
|
-
}
|
|
1814
|
-
while (path12.length > 1 && isObject(x)) {
|
|
1815
|
-
const key = path12.shift();
|
|
1816
|
-
if (!(key in x)) {
|
|
1817
|
-
x[key] = {};
|
|
1818
|
-
}
|
|
1819
|
-
x = x[key];
|
|
1820
|
-
}
|
|
1821
|
-
if (!isObject(x)) {
|
|
1822
|
-
throw new ToolkitError(`Expected an object, got '${x}'`);
|
|
1823
|
-
}
|
|
1824
|
-
if (value !== void 0) {
|
|
1825
|
-
x[path12[0]] = value;
|
|
1826
|
-
} else {
|
|
1827
|
-
delete x[path12[0]];
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
function deepMerge(...objects) {
|
|
1831
|
-
function mergeOne(target, source) {
|
|
1832
|
-
for (const key of Object.keys(source)) {
|
|
1833
|
-
if (key === "__proto__" || key === "constructor") {
|
|
1834
|
-
continue;
|
|
1835
|
-
}
|
|
1836
|
-
const value = source[key];
|
|
1837
|
-
if (isObject(value)) {
|
|
1838
|
-
if (!isObject(target[key])) {
|
|
1839
|
-
target[key] = {};
|
|
1840
|
-
}
|
|
1841
|
-
mergeOne(target[key], value);
|
|
1842
|
-
} else if (typeof value !== "undefined") {
|
|
1843
|
-
target[key] = value;
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
const others = objects.filter((x) => x != null);
|
|
1848
|
-
if (others.length === 0) {
|
|
1849
|
-
return {};
|
|
1850
|
-
}
|
|
1851
|
-
const into = others.splice(0, 1)[0];
|
|
1852
|
-
others.forEach((other) => mergeOne(into, other));
|
|
1853
|
-
return into;
|
|
1854
|
-
}
|
|
1855
|
-
function splitBySize(data, maxSizeBytes) {
|
|
1856
|
-
if (maxSizeBytes < 2) {
|
|
1857
|
-
return [void 0, data];
|
|
1858
|
-
}
|
|
1859
|
-
const entries = Object.entries(data);
|
|
1860
|
-
return recurse(0, 0);
|
|
1861
|
-
function recurse(index, runningTotalSize) {
|
|
1862
|
-
if (index >= entries.length) {
|
|
1863
|
-
return [data, void 0];
|
|
1864
|
-
}
|
|
1865
|
-
const size = runningTotalSize + entrySize(entries[index]);
|
|
1866
|
-
return size > maxSizeBytes ? cutAt(index) : recurse(index + 1, size);
|
|
1867
|
-
}
|
|
1868
|
-
function entrySize(entry) {
|
|
1869
|
-
return Buffer.byteLength(JSON.stringify(Object.fromEntries([entry])));
|
|
1870
|
-
}
|
|
1871
|
-
function cutAt(index) {
|
|
1872
|
-
return [
|
|
1873
|
-
Object.fromEntries(entries.slice(0, index)),
|
|
1874
|
-
Object.fromEntries(entries.slice(index))
|
|
1875
|
-
];
|
|
2448
|
+
parts.push(`${service}.${api}(${JSON.stringify(content.input, replacerBufferWithInfo)})`);
|
|
2449
|
+
if (isSdkApiCallSuccess(content)) {
|
|
2450
|
+
parts.push("-> OK");
|
|
2451
|
+
} else {
|
|
2452
|
+
parts.push(`-> ${content.error}`);
|
|
1876
2453
|
}
|
|
2454
|
+
return parts.join(" ");
|
|
2455
|
+
}
|
|
2456
|
+
function isSdkApiCallSuccess(x) {
|
|
2457
|
+
return x && typeof x === "object" && x.commandName && x.output;
|
|
2458
|
+
}
|
|
2459
|
+
function isSdkApiCallError(x) {
|
|
2460
|
+
return x && typeof x === "object" && x.commandName && x.error;
|
|
1877
2461
|
}
|
|
1878
2462
|
|
|
1879
2463
|
// ../../aws-cdk/lib/api/settings.ts
|
|
2464
|
+
var os3 = __toESM(require("os"));
|
|
2465
|
+
var fs_path = __toESM(require("path"));
|
|
2466
|
+
var fs5 = __toESM(require("fs-extra"));
|
|
1880
2467
|
var TRANSIENT_CONTEXT_KEY = "$dontSaveContext";
|
|
1881
2468
|
var Settings = class _Settings {
|
|
1882
2469
|
constructor(settings = {}, readOnly = false) {
|
|
@@ -2061,7 +2648,7 @@ var Context = class {
|
|
|
2061
2648
|
};
|
|
2062
2649
|
|
|
2063
2650
|
// ../../aws-cdk/lib/api/deployments/cloudformation.ts
|
|
2064
|
-
var
|
|
2651
|
+
var import_util10 = require("util");
|
|
2065
2652
|
var cxapi = __toESM(require("@aws-cdk/cx-api"));
|
|
2066
2653
|
var import_cx_api3 = require("@aws-cdk/cx-api");
|
|
2067
2654
|
var import_client_cloudformation3 = require("@aws-sdk/client-cloudformation");
|
|
@@ -2156,347 +2743,129 @@ var trace2 = (action, message, code, payload) => {
|
|
|
2156
2743
|
action,
|
|
2157
2744
|
code,
|
|
2158
2745
|
message,
|
|
2159
|
-
data: payload
|
|
2160
|
-
});
|
|
2161
|
-
};
|
|
2162
|
-
|
|
2163
|
-
// ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
|
|
2164
|
-
var
|
|
2165
|
-
var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
|
|
2166
|
-
var
|
|
2167
|
-
|
|
2168
|
-
// ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
|
|
2169
|
-
var StackEventPoller = class _StackEventPoller {
|
|
2170
|
-
constructor(cfn, props) {
|
|
2171
|
-
this.cfn = cfn;
|
|
2172
|
-
this.props = props;
|
|
2173
|
-
this.events = [];
|
|
2174
|
-
this.complete = false;
|
|
2175
|
-
this.eventIds = /* @__PURE__ */ new Set();
|
|
2176
|
-
this.nestedStackPollers = {};
|
|
2177
|
-
}
|
|
2178
|
-
/**
|
|
2179
|
-
* From all accumulated events, return only the errors
|
|
2180
|
-
*/
|
|
2181
|
-
get resourceErrors() {
|
|
2182
|
-
return this.events.filter((e) => e.event.ResourceStatus?.endsWith("_FAILED") && !e.isStackEvent);
|
|
2183
|
-
}
|
|
2184
|
-
/**
|
|
2185
|
-
* Poll for new stack events
|
|
2186
|
-
*
|
|
2187
|
-
* Will not return events older than events indicated by the constructor filters.
|
|
2188
|
-
*
|
|
2189
|
-
* Recurses into nested stacks, and returns events old-to-new.
|
|
2190
|
-
*/
|
|
2191
|
-
async poll() {
|
|
2192
|
-
const events = await this.doPoll();
|
|
2193
|
-
for (const [logicalId, poller] of Object.entries(this.nestedStackPollers)) {
|
|
2194
|
-
events.push(...await poller.poll());
|
|
2195
|
-
if (poller.complete) {
|
|
2196
|
-
delete this.nestedStackPollers[logicalId];
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
events.sort((a, b) => a.event.Timestamp.valueOf() - b.event.Timestamp.valueOf());
|
|
2200
|
-
this.events.push(...events);
|
|
2201
|
-
return events;
|
|
2202
|
-
}
|
|
2203
|
-
async doPoll() {
|
|
2204
|
-
const events = [];
|
|
2205
|
-
try {
|
|
2206
|
-
let nextToken;
|
|
2207
|
-
let finished = false;
|
|
2208
|
-
while (!finished) {
|
|
2209
|
-
const page = await this.cfn.describeStackEvents({ StackName: this.props.stackName, NextToken: nextToken });
|
|
2210
|
-
for (const event of page?.StackEvents ?? []) {
|
|
2211
|
-
if (this.props.startTime !== void 0 && event.Timestamp.valueOf() < this.props.startTime) {
|
|
2212
|
-
return events;
|
|
2213
|
-
}
|
|
2214
|
-
if (this.eventIds.has(event.EventId)) {
|
|
2215
|
-
return events;
|
|
2216
|
-
}
|
|
2217
|
-
this.eventIds.add(event.EventId);
|
|
2218
|
-
const isParentStackEvent = event.PhysicalResourceId === event.StackId;
|
|
2219
|
-
if (isParentStackEvent && this.props.stackStatuses?.includes(event.ResourceStatus ?? "")) {
|
|
2220
|
-
return events;
|
|
2221
|
-
}
|
|
2222
|
-
const resEvent = {
|
|
2223
|
-
event,
|
|
2224
|
-
parentStackLogicalIds: this.props.parentStackLogicalIds ?? [],
|
|
2225
|
-
isStackEvent: isParentStackEvent
|
|
2226
|
-
};
|
|
2227
|
-
events.push(resEvent);
|
|
2228
|
-
if (!isParentStackEvent && event.ResourceType === "AWS::CloudFormation::Stack" && isStackBeginOperationState(event.ResourceStatus)) {
|
|
2229
|
-
this.trackNestedStack(event, [...this.props.parentStackLogicalIds ?? [], event.LogicalResourceId ?? ""]);
|
|
2230
|
-
}
|
|
2231
|
-
if (isParentStackEvent && isStackTerminalState(event.ResourceStatus)) {
|
|
2232
|
-
this.complete = true;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
nextToken = page?.NextToken;
|
|
2236
|
-
if (nextToken === void 0) {
|
|
2237
|
-
finished = true;
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
} catch (e) {
|
|
2241
|
-
if (!(e.name === "ValidationError" && formatErrorMessage(e) === `Stack [${this.props.stackName}] does not exist`)) {
|
|
2242
|
-
throw e;
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2245
|
-
return events;
|
|
2246
|
-
}
|
|
2247
|
-
/**
|
|
2248
|
-
* On the CREATE_IN_PROGRESS, UPDATE_IN_PROGRESS, DELETE_IN_PROGRESS event of a nested stack, poll the nested stack updates
|
|
2249
|
-
*/
|
|
2250
|
-
trackNestedStack(event, parentStackLogicalIds) {
|
|
2251
|
-
const logicalId = event.LogicalResourceId;
|
|
2252
|
-
const physicalResourceId = event.PhysicalResourceId;
|
|
2253
|
-
if (!logicalId || !physicalResourceId) {
|
|
2254
|
-
return;
|
|
2255
|
-
}
|
|
2256
|
-
if (!this.nestedStackPollers[logicalId]) {
|
|
2257
|
-
this.nestedStackPollers[logicalId] = new _StackEventPoller(this.cfn, {
|
|
2258
|
-
stackName: physicalResourceId,
|
|
2259
|
-
parentStackLogicalIds,
|
|
2260
|
-
startTime: event.Timestamp.valueOf()
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
};
|
|
2265
|
-
function isStackBeginOperationState(state) {
|
|
2266
|
-
return [
|
|
2267
|
-
"CREATE_IN_PROGRESS",
|
|
2268
|
-
"UPDATE_IN_PROGRESS",
|
|
2269
|
-
"DELETE_IN_PROGRESS",
|
|
2270
|
-
"UPDATE_ROLLBACK_IN_PROGRESS",
|
|
2271
|
-
"ROLLBACK_IN_PROGRESS"
|
|
2272
|
-
].includes(state ?? "");
|
|
2273
|
-
}
|
|
2274
|
-
function isStackTerminalState(state) {
|
|
2275
|
-
return !(state ?? "").endsWith("_IN_PROGRESS");
|
|
2276
|
-
}
|
|
2277
|
-
|
|
2278
|
-
// ../../aws-cdk/lib/api/stack-events/display.ts
|
|
2279
|
-
var wrapAnsi = require("wrap-ansi");
|
|
2280
|
-
var RewritableBlock = class {
|
|
2281
|
-
constructor(stream) {
|
|
2282
|
-
this.stream = stream;
|
|
2283
|
-
this.lastHeight = 0;
|
|
2284
|
-
this.trailingEmptyLines = 0;
|
|
2285
|
-
}
|
|
2286
|
-
get width() {
|
|
2287
|
-
return this.stream.columns;
|
|
2288
|
-
}
|
|
2289
|
-
get height() {
|
|
2290
|
-
return this.stream.rows;
|
|
2291
|
-
}
|
|
2292
|
-
displayLines(lines) {
|
|
2293
|
-
lines = terminalWrap(this.width, expandNewlines(lines));
|
|
2294
|
-
lines = lines.slice(0, getMaxBlockHeight(this.height, this.lastHeight, lines));
|
|
2295
|
-
this.stream.write(cursorUp(this.lastHeight));
|
|
2296
|
-
for (const line of lines) {
|
|
2297
|
-
this.stream.write(cll() + line + "\n");
|
|
2298
|
-
}
|
|
2299
|
-
this.trailingEmptyLines = Math.max(0, this.lastHeight - lines.length);
|
|
2300
|
-
for (let i = 0; i < this.trailingEmptyLines; i++) {
|
|
2301
|
-
this.stream.write(cll() + "\n");
|
|
2302
|
-
}
|
|
2303
|
-
this.lastHeight = Math.max(this.lastHeight, lines.length);
|
|
2304
|
-
}
|
|
2305
|
-
removeEmptyLines() {
|
|
2306
|
-
this.stream.write(cursorUp(this.trailingEmptyLines));
|
|
2307
|
-
}
|
|
2308
|
-
};
|
|
2309
|
-
var ESC = "\x1B";
|
|
2310
|
-
function cursorUp(n) {
|
|
2311
|
-
n = typeof n === "number" ? n : 1;
|
|
2312
|
-
return n > 0 ? ESC + "[" + n + "A" : "";
|
|
2313
|
-
}
|
|
2314
|
-
function cll() {
|
|
2315
|
-
return ESC + "[K";
|
|
2316
|
-
}
|
|
2317
|
-
function terminalWrap(width, lines) {
|
|
2318
|
-
if (width === void 0) {
|
|
2319
|
-
return lines;
|
|
2320
|
-
}
|
|
2321
|
-
return lines.flatMap((line) => wrapAnsi(line, width - 1, {
|
|
2322
|
-
hard: true,
|
|
2323
|
-
trim: true,
|
|
2324
|
-
wordWrap: false
|
|
2325
|
-
}).split("\n"));
|
|
2326
|
-
}
|
|
2327
|
-
function expandNewlines(lines) {
|
|
2328
|
-
return lines.flatMap((line) => line.split("\n"));
|
|
2329
|
-
}
|
|
2330
|
-
function getMaxBlockHeight(windowHeight, lastHeight, lines) {
|
|
2331
|
-
if (windowHeight === void 0) {
|
|
2332
|
-
return Math.max(lines.length, lastHeight);
|
|
2333
|
-
}
|
|
2334
|
-
return lines.length < windowHeight ? lines.length : windowHeight - 1;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
// ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
|
|
2338
|
-
var StackActivityProgress = /* @__PURE__ */ ((StackActivityProgress3) => {
|
|
2339
|
-
StackActivityProgress3["BAR"] = "bar";
|
|
2340
|
-
StackActivityProgress3["EVENTS"] = "events";
|
|
2341
|
-
return StackActivityProgress3;
|
|
2342
|
-
})(StackActivityProgress || {});
|
|
2343
|
-
var StackActivityMonitor = class _StackActivityMonitor {
|
|
2344
|
-
constructor(cfn, stackName, printer, stack, changeSetCreationTime) {
|
|
2345
|
-
this.stackName = stackName;
|
|
2346
|
-
this.printer = printer;
|
|
2347
|
-
this.stack = stack;
|
|
2348
|
-
this.errors = [];
|
|
2349
|
-
this.active = false;
|
|
2350
|
-
this.poller = new StackEventPoller(cfn, {
|
|
2351
|
-
stackName,
|
|
2352
|
-
startTime: changeSetCreationTime?.getTime() ?? Date.now()
|
|
2353
|
-
});
|
|
2354
|
-
}
|
|
2355
|
-
/**
|
|
2356
|
-
* Create a Stack Activity Monitor using a default printer, based on context clues
|
|
2357
|
-
*/
|
|
2358
|
-
static withDefaultPrinter(cfn, stackName, stackArtifact, options = {}) {
|
|
2359
|
-
const stream = options.ci ? process.stdout : process.stderr;
|
|
2360
|
-
const props = {
|
|
2361
|
-
resourceTypeColumnWidth: calcMaxResourceTypeLength(stackArtifact.template),
|
|
2362
|
-
resourcesTotal: options.resourcesTotal,
|
|
2363
|
-
stream
|
|
2364
|
-
};
|
|
2365
|
-
const isWindows = process.platform === "win32";
|
|
2366
|
-
const verbose = options.logLevel ?? "info";
|
|
2367
|
-
const fancyOutputAvailable = !isWindows && stream.isTTY && !options.ci;
|
|
2368
|
-
const progress = options.progress ?? "bar" /* BAR */;
|
|
2369
|
-
const printer = fancyOutputAvailable && !verbose && progress === "bar" /* BAR */ ? new CurrentActivityPrinter(props) : new HistoryActivityPrinter(props);
|
|
2370
|
-
return new _StackActivityMonitor(cfn, stackName, printer, stackArtifact, options.changeSetCreationTime);
|
|
2371
|
-
}
|
|
2372
|
-
start() {
|
|
2373
|
-
this.active = true;
|
|
2374
|
-
this.printer.start();
|
|
2375
|
-
this.scheduleNextTick();
|
|
2376
|
-
return this;
|
|
2377
|
-
}
|
|
2378
|
-
async stop() {
|
|
2379
|
-
this.active = false;
|
|
2380
|
-
if (this.tickTimer) {
|
|
2381
|
-
clearTimeout(this.tickTimer);
|
|
2382
|
-
}
|
|
2383
|
-
await this.finalPollToEnd();
|
|
2384
|
-
this.printer.stop();
|
|
2385
|
-
}
|
|
2386
|
-
scheduleNextTick() {
|
|
2387
|
-
if (!this.active) {
|
|
2388
|
-
return;
|
|
2389
|
-
}
|
|
2390
|
-
this.tickTimer = setTimeout(() => void this.tick(), this.printer.updateSleep);
|
|
2391
|
-
}
|
|
2392
|
-
async tick() {
|
|
2393
|
-
if (!this.active) {
|
|
2394
|
-
return;
|
|
2395
|
-
}
|
|
2396
|
-
try {
|
|
2397
|
-
this.readPromise = this.readNewEvents();
|
|
2398
|
-
await this.readPromise;
|
|
2399
|
-
this.readPromise = void 0;
|
|
2400
|
-
if (!this.active) {
|
|
2401
|
-
return;
|
|
2402
|
-
}
|
|
2403
|
-
this.printer.print();
|
|
2404
|
-
} catch (e) {
|
|
2405
|
-
error("Error occurred while monitoring stack: %s", e);
|
|
2406
|
-
}
|
|
2407
|
-
this.scheduleNextTick();
|
|
2408
|
-
}
|
|
2409
|
-
findMetadataFor(logicalId) {
|
|
2410
|
-
const metadata = this.stack?.manifest?.metadata;
|
|
2411
|
-
if (!logicalId || !metadata) {
|
|
2412
|
-
return void 0;
|
|
2413
|
-
}
|
|
2414
|
-
for (const path12 of Object.keys(metadata)) {
|
|
2415
|
-
const entry = metadata[path12].filter((e) => e.type === import_cloud_assembly_schema.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
|
|
2416
|
-
if (entry) {
|
|
2417
|
-
return {
|
|
2418
|
-
entry,
|
|
2419
|
-
constructPath: this.simplifyConstructPath(path12)
|
|
2420
|
-
};
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
return void 0;
|
|
2746
|
+
data: payload
|
|
2747
|
+
});
|
|
2748
|
+
};
|
|
2749
|
+
|
|
2750
|
+
// ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
|
|
2751
|
+
var util6 = __toESM(require("util"));
|
|
2752
|
+
var import_cloud_assembly_schema = require("@aws-cdk/cloud-assembly-schema");
|
|
2753
|
+
var uuid = __toESM(require("uuid"));
|
|
2754
|
+
|
|
2755
|
+
// ../../aws-cdk/lib/api/stack-events/stack-event-poller.ts
|
|
2756
|
+
var StackEventPoller = class _StackEventPoller {
|
|
2757
|
+
constructor(cfn, props) {
|
|
2758
|
+
this.cfn = cfn;
|
|
2759
|
+
this.props = props;
|
|
2760
|
+
this.events = [];
|
|
2761
|
+
this.complete = false;
|
|
2762
|
+
this.eventIds = /* @__PURE__ */ new Set();
|
|
2763
|
+
this.nestedStackPollers = {};
|
|
2424
2764
|
}
|
|
2425
2765
|
/**
|
|
2426
|
-
*
|
|
2427
|
-
*
|
|
2428
|
-
* The events are returned in reverse chronological order; we continue to the next page if we
|
|
2429
|
-
* see a next page and the last event in the page is new to us (and within the time window).
|
|
2430
|
-
* haven't seen the final event
|
|
2766
|
+
* From all accumulated events, return only the errors
|
|
2431
2767
|
*/
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
const activities = pollEvents.map((event) => ({
|
|
2435
|
-
...event,
|
|
2436
|
-
metadata: this.findMetadataFor(event.event.LogicalResourceId)
|
|
2437
|
-
}));
|
|
2438
|
-
for (const activity of activities) {
|
|
2439
|
-
this.checkForErrors(activity);
|
|
2440
|
-
this.printer.addActivity(activity);
|
|
2441
|
-
}
|
|
2768
|
+
get resourceErrors() {
|
|
2769
|
+
return this.events.filter((e) => e.event.ResourceStatus?.endsWith("_FAILED") && !e.isStackEvent);
|
|
2442
2770
|
}
|
|
2443
2771
|
/**
|
|
2444
|
-
*
|
|
2772
|
+
* Poll for new stack events
|
|
2445
2773
|
*
|
|
2446
|
-
*
|
|
2447
|
-
*
|
|
2774
|
+
* Will not return events older than events indicated by the constructor filters.
|
|
2775
|
+
*
|
|
2776
|
+
* Recurses into nested stacks, and returns events old-to-new.
|
|
2448
2777
|
*/
|
|
2449
|
-
async
|
|
2450
|
-
|
|
2451
|
-
|
|
2778
|
+
async poll() {
|
|
2779
|
+
const events = await this.doPoll();
|
|
2780
|
+
for (const [logicalId, poller] of Object.entries(this.nestedStackPollers)) {
|
|
2781
|
+
events.push(...await poller.poll());
|
|
2782
|
+
if (poller.complete) {
|
|
2783
|
+
delete this.nestedStackPollers[logicalId];
|
|
2784
|
+
}
|
|
2452
2785
|
}
|
|
2453
|
-
|
|
2786
|
+
events.sort((a, b) => a.event.Timestamp.valueOf() - b.event.Timestamp.valueOf());
|
|
2787
|
+
this.events.push(...events);
|
|
2788
|
+
return events;
|
|
2454
2789
|
}
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2790
|
+
async doPoll() {
|
|
2791
|
+
const events = [];
|
|
2792
|
+
try {
|
|
2793
|
+
let nextToken;
|
|
2794
|
+
let finished = false;
|
|
2795
|
+
while (!finished) {
|
|
2796
|
+
const page = await this.cfn.describeStackEvents({ StackName: this.props.stackName, NextToken: nextToken });
|
|
2797
|
+
for (const event of page?.StackEvents ?? []) {
|
|
2798
|
+
if (this.props.startTime !== void 0 && event.Timestamp.valueOf() < this.props.startTime) {
|
|
2799
|
+
return events;
|
|
2800
|
+
}
|
|
2801
|
+
if (this.eventIds.has(event.EventId)) {
|
|
2802
|
+
return events;
|
|
2803
|
+
}
|
|
2804
|
+
this.eventIds.add(event.EventId);
|
|
2805
|
+
const isParentStackEvent = event.PhysicalResourceId === event.StackId;
|
|
2806
|
+
if (isParentStackEvent && this.props.stackStatuses?.includes(event.ResourceStatus ?? "")) {
|
|
2807
|
+
return events;
|
|
2808
|
+
}
|
|
2809
|
+
const resEvent = {
|
|
2810
|
+
event,
|
|
2811
|
+
parentStackLogicalIds: this.props.parentStackLogicalIds ?? [],
|
|
2812
|
+
isStackEvent: isParentStackEvent
|
|
2813
|
+
};
|
|
2814
|
+
events.push(resEvent);
|
|
2815
|
+
if (!isParentStackEvent && event.ResourceType === "AWS::CloudFormation::Stack" && isStackBeginOperationState(event.ResourceStatus)) {
|
|
2816
|
+
this.trackNestedStack(event, [...this.props.parentStackLogicalIds ?? [], event.LogicalResourceId ?? ""]);
|
|
2817
|
+
}
|
|
2818
|
+
if (isParentStackEvent && isStackTerminalState(event.ResourceStatus)) {
|
|
2819
|
+
this.complete = true;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
nextToken = page?.NextToken;
|
|
2823
|
+
if (nextToken === void 0) {
|
|
2824
|
+
finished = true;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
} catch (e) {
|
|
2828
|
+
if (!(e.name === "ValidationError" && formatErrorMessage(e) === `Stack [${this.props.stackName}] does not exist`)) {
|
|
2829
|
+
throw e;
|
|
2460
2830
|
}
|
|
2461
2831
|
}
|
|
2832
|
+
return events;
|
|
2462
2833
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2834
|
+
/**
|
|
2835
|
+
* On the CREATE_IN_PROGRESS, UPDATE_IN_PROGRESS, DELETE_IN_PROGRESS event of a nested stack, poll the nested stack updates
|
|
2836
|
+
*/
|
|
2837
|
+
trackNestedStack(event, parentStackLogicalIds) {
|
|
2838
|
+
const logicalId = event.LogicalResourceId;
|
|
2839
|
+
const physicalResourceId = event.PhysicalResourceId;
|
|
2840
|
+
if (!logicalId || !physicalResourceId) {
|
|
2841
|
+
return;
|
|
2842
|
+
}
|
|
2843
|
+
if (!this.nestedStackPollers[logicalId]) {
|
|
2844
|
+
this.nestedStackPollers[logicalId] = new _StackEventPoller(this.cfn, {
|
|
2845
|
+
stackName: physicalResourceId,
|
|
2846
|
+
parentStackLogicalIds,
|
|
2847
|
+
startTime: event.Timestamp.valueOf()
|
|
2848
|
+
});
|
|
2468
2849
|
}
|
|
2469
|
-
return path12;
|
|
2470
2850
|
}
|
|
2471
2851
|
};
|
|
2472
|
-
function
|
|
2473
|
-
return
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2852
|
+
function isStackBeginOperationState(state) {
|
|
2853
|
+
return [
|
|
2854
|
+
"CREATE_IN_PROGRESS",
|
|
2855
|
+
"UPDATE_IN_PROGRESS",
|
|
2856
|
+
"DELETE_IN_PROGRESS",
|
|
2857
|
+
"UPDATE_ROLLBACK_IN_PROGRESS",
|
|
2858
|
+
"ROLLBACK_IN_PROGRESS"
|
|
2859
|
+
].includes(state ?? "");
|
|
2477
2860
|
}
|
|
2478
|
-
function
|
|
2479
|
-
|
|
2480
|
-
let maxWidth = 0;
|
|
2481
|
-
for (const id of Object.keys(resources)) {
|
|
2482
|
-
const type = resources[id].Type || "";
|
|
2483
|
-
if (type.length > maxWidth) {
|
|
2484
|
-
maxWidth = type.length;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
return maxWidth;
|
|
2861
|
+
function isStackTerminalState(state) {
|
|
2862
|
+
return !(state ?? "").endsWith("_IN_PROGRESS");
|
|
2488
2863
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
*/
|
|
2495
|
-
this.updateSleep = 5e3;
|
|
2496
|
-
/**
|
|
2497
|
-
* A list of resource IDs which are currently being processed
|
|
2498
|
-
*/
|
|
2499
|
-
this.resourcesInProgress = {};
|
|
2864
|
+
|
|
2865
|
+
// ../../aws-cdk/lib/api/stack-events/stack-progress-monitor.ts
|
|
2866
|
+
var util5 = __toESM(require("util"));
|
|
2867
|
+
var StackProgressMonitor = class {
|
|
2868
|
+
constructor(resourcesTotal) {
|
|
2500
2869
|
/**
|
|
2501
2870
|
* Previous completion state observed by logical ID
|
|
2502
2871
|
*
|
|
@@ -2513,52 +2882,57 @@ var ActivityPrinterBase = class {
|
|
|
2513
2882
|
* How many digits we need to represent the total count (for lining up the status reporting)
|
|
2514
2883
|
*/
|
|
2515
2884
|
this.resourceDigits = 0;
|
|
2516
|
-
this.
|
|
2517
|
-
this.failures = new Array();
|
|
2518
|
-
this.hookFailureMap = /* @__PURE__ */ new Map();
|
|
2519
|
-
this.resourcesTotal = props.resourcesTotal ? props.resourcesTotal + 1 : void 0;
|
|
2885
|
+
this.resourcesTotal = resourcesTotal ? resourcesTotal + 1 : void 0;
|
|
2520
2886
|
this.resourceDigits = this.resourcesTotal ? Math.ceil(Math.log10(this.resourcesTotal)) : 0;
|
|
2521
2887
|
}
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2888
|
+
/**
|
|
2889
|
+
* Report the stack progress
|
|
2890
|
+
*/
|
|
2891
|
+
get progress() {
|
|
2892
|
+
return {
|
|
2893
|
+
total: this.total,
|
|
2894
|
+
completed: this.completed,
|
|
2895
|
+
formatted: this.formatted
|
|
2896
|
+
};
|
|
2897
|
+
}
|
|
2898
|
+
/**
|
|
2899
|
+
* The total number of progress monitored resources.
|
|
2900
|
+
*/
|
|
2901
|
+
get total() {
|
|
2902
|
+
return this.resourcesTotal;
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* The number of completed resources.
|
|
2906
|
+
*/
|
|
2907
|
+
get completed() {
|
|
2908
|
+
return this.resourcesDone;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Report the current progress as a [34/42] string, or just [34] if the total is unknown
|
|
2912
|
+
*/
|
|
2913
|
+
get formatted() {
|
|
2914
|
+
if (this.resourcesTotal == null) {
|
|
2915
|
+
return padLeft(3, util5.format("%s", this.resourcesDone));
|
|
2532
2916
|
}
|
|
2533
|
-
return
|
|
2917
|
+
return util5.format(
|
|
2918
|
+
"%s/%s",
|
|
2919
|
+
padLeft(this.resourceDigits, this.resourcesDone.toString()),
|
|
2920
|
+
padLeft(this.resourceDigits, this.resourcesTotal.toString())
|
|
2921
|
+
);
|
|
2534
2922
|
}
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2923
|
+
/**
|
|
2924
|
+
* Process as stack event and update the progress state.
|
|
2925
|
+
*/
|
|
2926
|
+
process(event) {
|
|
2927
|
+
const status = event.ResourceStatus;
|
|
2928
|
+
if (!status || !event.LogicalResourceId) {
|
|
2540
2929
|
return;
|
|
2541
2930
|
}
|
|
2542
|
-
if (status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS") {
|
|
2543
|
-
this.rollingBack = true;
|
|
2544
|
-
}
|
|
2545
|
-
if (status.endsWith("_IN_PROGRESS")) {
|
|
2546
|
-
this.resourcesInProgress[activity.event.LogicalResourceId] = activity;
|
|
2547
|
-
}
|
|
2548
|
-
if (hasErrorMessage(status)) {
|
|
2549
|
-
const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
|
|
2550
|
-
if (!isCancelled) {
|
|
2551
|
-
this.failures.push(activity);
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
if (status.endsWith("_COMPLETE") || status.endsWith("_FAILED")) {
|
|
2555
|
-
delete this.resourcesInProgress[activity.event.LogicalResourceId];
|
|
2556
|
-
}
|
|
2557
2931
|
if (status.endsWith("_COMPLETE_CLEANUP_IN_PROGRESS")) {
|
|
2558
2932
|
this.resourcesDone++;
|
|
2559
2933
|
}
|
|
2560
2934
|
if (status.endsWith("_COMPLETE")) {
|
|
2561
|
-
const prevState = this.resourcesPrevCompleteState[
|
|
2935
|
+
const prevState = this.resourcesPrevCompleteState[event.LogicalResourceId];
|
|
2562
2936
|
if (!prevState) {
|
|
2563
2937
|
this.resourcesDone++;
|
|
2564
2938
|
} else {
|
|
@@ -2567,265 +2941,175 @@ var ActivityPrinterBase = class {
|
|
|
2567
2941
|
this.resourcesDone = 0;
|
|
2568
2942
|
}
|
|
2569
2943
|
}
|
|
2570
|
-
this.resourcesPrevCompleteState[
|
|
2571
|
-
}
|
|
2572
|
-
if (hookStatus !== void 0 && hookStatus.endsWith("_COMPLETE_FAILED") && activity.event.LogicalResourceId !== void 0 && hookType !== void 0) {
|
|
2573
|
-
if (this.hookFailureMap.has(activity.event.LogicalResourceId)) {
|
|
2574
|
-
this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
|
|
2575
|
-
} else {
|
|
2576
|
-
this.hookFailureMap.set(activity.event.LogicalResourceId, /* @__PURE__ */ new Map());
|
|
2577
|
-
this.hookFailureMap.get(activity.event.LogicalResourceId)?.set(hookType, activity.event.HookStatusReason ?? "");
|
|
2578
|
-
}
|
|
2944
|
+
this.resourcesPrevCompleteState[event.LogicalResourceId] = status;
|
|
2579
2945
|
}
|
|
2580
2946
|
}
|
|
2581
|
-
start() {
|
|
2582
|
-
}
|
|
2583
|
-
stop() {
|
|
2584
|
-
}
|
|
2585
2947
|
};
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
this.
|
|
2948
|
+
|
|
2949
|
+
// ../../aws-cdk/lib/api/stack-events/stack-activity-monitor.ts
|
|
2950
|
+
var StackActivityMonitor = class {
|
|
2951
|
+
constructor({
|
|
2952
|
+
cfn,
|
|
2953
|
+
ioHost,
|
|
2954
|
+
action,
|
|
2955
|
+
stack,
|
|
2956
|
+
stackName,
|
|
2957
|
+
resourcesTotal,
|
|
2958
|
+
changeSetCreationTime,
|
|
2959
|
+
pollingInterval = 2e3
|
|
2960
|
+
}) {
|
|
2961
|
+
this.errors = [];
|
|
2962
|
+
this.ioHost = ioHost;
|
|
2963
|
+
this.action = action;
|
|
2964
|
+
this.stack = stack;
|
|
2965
|
+
this.stackName = stackName;
|
|
2966
|
+
this.progressMonitor = new StackProgressMonitor(resourcesTotal);
|
|
2967
|
+
this.pollingInterval = pollingInterval;
|
|
2968
|
+
this.poller = new StackEventPoller(cfn, {
|
|
2969
|
+
stackName,
|
|
2970
|
+
startTime: changeSetCreationTime?.getTime() ?? Date.now()
|
|
2971
|
+
});
|
|
2600
2972
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
this.
|
|
2604
|
-
|
|
2973
|
+
async start() {
|
|
2974
|
+
this.monitorId = uuid.v4();
|
|
2975
|
+
await this.ioHost.notify(debug2(this.action, `Deploying ${this.stackName}`, "CDK_TOOLKIT_I5501", {
|
|
2976
|
+
deployment: this.monitorId,
|
|
2977
|
+
stack: this.stack,
|
|
2978
|
+
stackName: this.stackName,
|
|
2979
|
+
resourcesTotal: this.progressMonitor.total
|
|
2980
|
+
}));
|
|
2981
|
+
this.scheduleNextTick();
|
|
2982
|
+
return this;
|
|
2605
2983
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2984
|
+
async stop() {
|
|
2985
|
+
const oldMonitorId = this.monitorId;
|
|
2986
|
+
this.monitorId = void 0;
|
|
2987
|
+
if (this.tickTimer) {
|
|
2988
|
+
clearTimeout(this.tickTimer);
|
|
2609
2989
|
}
|
|
2610
|
-
this.
|
|
2611
|
-
this.
|
|
2990
|
+
await this.finalPollToEnd(oldMonitorId);
|
|
2991
|
+
await this.ioHost.notify(debug2(this.action, `Completed ${this.stackName}`, "CDK_TOOLKIT_I5503", {
|
|
2992
|
+
deployment: oldMonitorId,
|
|
2993
|
+
stack: this.stack,
|
|
2994
|
+
stackName: this.stackName,
|
|
2995
|
+
resourcesTotal: this.progressMonitor.total
|
|
2996
|
+
}));
|
|
2612
2997
|
}
|
|
2613
|
-
|
|
2614
|
-
if (this.
|
|
2615
|
-
|
|
2616
|
-
for (const failure of this.failures) {
|
|
2617
|
-
if (failure.isStackEvent) {
|
|
2618
|
-
continue;
|
|
2619
|
-
}
|
|
2620
|
-
this.printOne(failure, false);
|
|
2621
|
-
}
|
|
2998
|
+
scheduleNextTick() {
|
|
2999
|
+
if (!this.monitorId) {
|
|
3000
|
+
return;
|
|
2622
3001
|
}
|
|
3002
|
+
this.tickTimer = setTimeout(() => void this.tick(), this.pollingInterval);
|
|
2623
3003
|
}
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
3004
|
+
async tick() {
|
|
3005
|
+
if (!this.monitorId) {
|
|
3006
|
+
return;
|
|
3007
|
+
}
|
|
3008
|
+
try {
|
|
3009
|
+
this.readPromise = this.readNewEvents(this.monitorId);
|
|
3010
|
+
await this.readPromise;
|
|
3011
|
+
this.readPromise = void 0;
|
|
3012
|
+
if (!this.monitorId) {
|
|
3013
|
+
return;
|
|
2633
3014
|
}
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
3015
|
+
} catch (e) {
|
|
3016
|
+
await this.ioHost.notify(error2(
|
|
3017
|
+
this.action,
|
|
3018
|
+
util6.format("Error occurred while monitoring stack: %s", e),
|
|
3019
|
+
"CDK_TOOLKIT_E5500",
|
|
3020
|
+
{ error: e }
|
|
3021
|
+
));
|
|
3022
|
+
}
|
|
3023
|
+
this.scheduleNextTick();
|
|
3024
|
+
}
|
|
3025
|
+
findMetadataFor(logicalId) {
|
|
3026
|
+
const metadata = this.stack.manifest?.metadata;
|
|
3027
|
+
if (!logicalId || !metadata) {
|
|
3028
|
+
return void 0;
|
|
3029
|
+
}
|
|
3030
|
+
for (const path12 of Object.keys(metadata)) {
|
|
3031
|
+
const entry = metadata[path12].filter((e) => e.type === import_cloud_assembly_schema.ArtifactMetadataEntryType.LOGICAL_ID).find((e) => e.data === logicalId);
|
|
3032
|
+
if (entry) {
|
|
3033
|
+
return {
|
|
3034
|
+
entry,
|
|
3035
|
+
constructPath: this.simplifyConstructPath(path12)
|
|
3036
|
+
};
|
|
2637
3037
|
}
|
|
2638
|
-
reasonColor = chalk4.red;
|
|
2639
3038
|
}
|
|
2640
|
-
|
|
2641
|
-
const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
|
|
2642
|
-
info(
|
|
2643
|
-
util3.format(
|
|
2644
|
-
"%s | %s%s | %s | %s | %s %s%s%s",
|
|
2645
|
-
event.StackName,
|
|
2646
|
-
progress !== false ? `${this.progress()} | ` : "",
|
|
2647
|
-
new Date(event.Timestamp).toLocaleTimeString(),
|
|
2648
|
-
color(padRight(STATUS_WIDTH, (event.ResourceStatus || "").slice(0, STATUS_WIDTH))),
|
|
2649
|
-
// pad left and trim
|
|
2650
|
-
padRight(this.props.resourceTypeColumnWidth, event.ResourceType || ""),
|
|
2651
|
-
color(chalk4.bold(resourceName)),
|
|
2652
|
-
logicalId,
|
|
2653
|
-
reasonColor(chalk4.bold(event.ResourceStatusReason ? event.ResourceStatusReason : "")),
|
|
2654
|
-
reasonColor(stackTrace)
|
|
2655
|
-
)
|
|
2656
|
-
);
|
|
2657
|
-
this.lastPrintTime = Date.now();
|
|
3039
|
+
return void 0;
|
|
2658
3040
|
}
|
|
2659
3041
|
/**
|
|
2660
|
-
*
|
|
3042
|
+
* Reads all new events from the stack history
|
|
3043
|
+
*
|
|
3044
|
+
* The events are returned in reverse chronological order; we continue to the next page if we
|
|
3045
|
+
* see a next page and the last event in the page is new to us (and within the time window).
|
|
3046
|
+
* haven't seen the final event
|
|
2661
3047
|
*/
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
3048
|
+
async readNewEvents(monitorId) {
|
|
3049
|
+
const pollEvents = await this.poller.poll();
|
|
3050
|
+
for (const resourceEvent of pollEvents) {
|
|
3051
|
+
this.progressMonitor.process(resourceEvent.event);
|
|
3052
|
+
const activity = {
|
|
3053
|
+
deployment: monitorId,
|
|
3054
|
+
event: resourceEvent.event,
|
|
3055
|
+
metadata: this.findMetadataFor(resourceEvent.event.LogicalResourceId),
|
|
3056
|
+
progress: this.progressMonitor.progress
|
|
3057
|
+
};
|
|
3058
|
+
this.checkForErrors(activity);
|
|
3059
|
+
await this.ioHost.notify(info2(this.action, this.formatActivity(activity, true), "CDK_TOOLKIT_I5502", activity));
|
|
2665
3060
|
}
|
|
2666
|
-
return util3.format(
|
|
2667
|
-
"%s/%s",
|
|
2668
|
-
padLeft(this.resourceDigits, this.resourcesDone.toString()),
|
|
2669
|
-
padLeft(this.resourceDigits, this.resourcesTotal != null ? this.resourcesTotal.toString() : "?")
|
|
2670
|
-
);
|
|
2671
3061
|
}
|
|
2672
3062
|
/**
|
|
2673
|
-
*
|
|
3063
|
+
* Perform a final poll to the end and flush out all events to the printer
|
|
3064
|
+
*
|
|
3065
|
+
* Finish any poll currently in progress, then do a final one until we've
|
|
3066
|
+
* reached the last page.
|
|
2674
3067
|
*/
|
|
2675
|
-
|
|
2676
|
-
if (
|
|
2677
|
-
|
|
2678
|
-
}
|
|
2679
|
-
if (Object.keys(this.resourcesInProgress).length > 0) {
|
|
2680
|
-
info(
|
|
2681
|
-
util3.format(
|
|
2682
|
-
"%s Currently in progress: %s",
|
|
2683
|
-
this.progress(),
|
|
2684
|
-
chalk4.bold(Object.keys(this.resourcesInProgress).join(", "))
|
|
2685
|
-
)
|
|
2686
|
-
);
|
|
3068
|
+
async finalPollToEnd(monitorId) {
|
|
3069
|
+
if (this.readPromise) {
|
|
3070
|
+
await this.readPromise;
|
|
2687
3071
|
}
|
|
2688
|
-
this.
|
|
2689
|
-
}
|
|
2690
|
-
};
|
|
2691
|
-
var CurrentActivityPrinter = class extends ActivityPrinterBase {
|
|
2692
|
-
constructor(props) {
|
|
2693
|
-
super(props);
|
|
2694
|
-
/**
|
|
2695
|
-
* This looks very disorienting sleeping for 5 seconds. Update quicker.
|
|
2696
|
-
*/
|
|
2697
|
-
this.updateSleep = 2e3;
|
|
2698
|
-
this.oldLogThreshold = CliIoHost.instance().logLevel;
|
|
2699
|
-
this.stream = props.stream;
|
|
2700
|
-
this.block = new RewritableBlock(this.stream);
|
|
3072
|
+
await this.readNewEvents(monitorId);
|
|
2701
3073
|
}
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
const
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
padRight(this.props.resourceTypeColumnWidth, res.event.ResourceType || ""),
|
|
2723
|
-
color(chalk4.bold(shorten(40, resourceName))),
|
|
2724
|
-
this.failureReasonOnNextLine(res)
|
|
2725
|
-
);
|
|
2726
|
-
})
|
|
3074
|
+
/**
|
|
3075
|
+
* Formats a stack activity into a basic string
|
|
3076
|
+
*/
|
|
3077
|
+
formatActivity(activity, progress) {
|
|
3078
|
+
const event = activity.event;
|
|
3079
|
+
const metadata = activity.metadata;
|
|
3080
|
+
const resourceName = metadata ? metadata.constructPath : event.LogicalResourceId || "";
|
|
3081
|
+
const logicalId = resourceName !== event.LogicalResourceId ? `(${event.LogicalResourceId}) ` : "";
|
|
3082
|
+
return util6.format(
|
|
3083
|
+
"%s | %s%s | %s | %s | %s %s%s%s",
|
|
3084
|
+
event.StackName,
|
|
3085
|
+
progress !== false ? `${activity.progress.formatted} | ` : "",
|
|
3086
|
+
new Date(event.Timestamp).toLocaleTimeString(),
|
|
3087
|
+
event.ResourceStatus || "",
|
|
3088
|
+
event.ResourceType,
|
|
3089
|
+
resourceName,
|
|
3090
|
+
logicalId,
|
|
3091
|
+
event.ResourceStatusReason ? event.ResourceStatusReason : "",
|
|
3092
|
+
metadata?.entry.trace ? `
|
|
3093
|
+
${metadata.entry.trace.join("\n \\_ ")}` : ""
|
|
2727
3094
|
);
|
|
2728
|
-
this.block.displayLines(lines);
|
|
2729
|
-
}
|
|
2730
|
-
start() {
|
|
2731
|
-
this.oldLogThreshold = CliIoHost.instance().logLevel;
|
|
2732
|
-
CliIoHost.instance().logLevel = "info";
|
|
2733
3095
|
}
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
continue;
|
|
2740
|
-
}
|
|
2741
|
-
lines.push(
|
|
2742
|
-
util3.format(
|
|
2743
|
-
chalk4.red("%s | %s | %s | %s%s") + "\n",
|
|
2744
|
-
padLeft(TIMESTAMP_WIDTH, new Date(failure.event.Timestamp).toLocaleTimeString()),
|
|
2745
|
-
padRight(STATUS_WIDTH, (failure.event.ResourceStatus || "").slice(0, STATUS_WIDTH)),
|
|
2746
|
-
padRight(this.props.resourceTypeColumnWidth, failure.event.ResourceType || ""),
|
|
2747
|
-
shorten(40, failure.event.LogicalResourceId ?? ""),
|
|
2748
|
-
this.failureReasonOnNextLine(failure)
|
|
2749
|
-
)
|
|
2750
|
-
);
|
|
2751
|
-
const trace3 = failure.metadata?.entry?.trace;
|
|
2752
|
-
if (trace3) {
|
|
2753
|
-
lines.push(chalk4.red(` ${trace3.join("\n \\_ ")}
|
|
2754
|
-
`));
|
|
3096
|
+
checkForErrors(activity) {
|
|
3097
|
+
if (stackEventHasErrorMessage(activity.event.ResourceStatus ?? "")) {
|
|
3098
|
+
const isCancelled = (activity.event.ResourceStatusReason ?? "").indexOf("cancelled") > -1;
|
|
3099
|
+
if (!isCancelled && activity.event.StackName !== activity.event.LogicalResourceId) {
|
|
3100
|
+
this.errors.push(activity.event.ResourceStatusReason ?? "");
|
|
2755
3101
|
}
|
|
2756
3102
|
}
|
|
2757
|
-
this.block.displayLines(lines);
|
|
2758
|
-
this.block.removeEmptyLines();
|
|
2759
3103
|
}
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
3104
|
+
simplifyConstructPath(path12) {
|
|
3105
|
+
path12 = path12.replace(/\/Resource$/, "");
|
|
3106
|
+
path12 = path12.replace(/^\//, "");
|
|
3107
|
+
if (path12.startsWith(this.stackName + "/")) {
|
|
3108
|
+
path12 = path12.slice(this.stackName.length + 1);
|
|
2763
3109
|
}
|
|
2764
|
-
|
|
2765
|
-
const innerWidth = Math.max(1, width - 2);
|
|
2766
|
-
const chars = innerWidth * fraction;
|
|
2767
|
-
const remainder = chars - Math.floor(chars);
|
|
2768
|
-
const fullChars = FULL_BLOCK.repeat(Math.floor(chars));
|
|
2769
|
-
const partialChar = PARTIAL_BLOCK[Math.floor(remainder * PARTIAL_BLOCK.length)];
|
|
2770
|
-
const filler = "\xB7".repeat(innerWidth - Math.floor(chars) - (partialChar ? 1 : 0));
|
|
2771
|
-
const color = this.rollingBack ? chalk4.yellow : chalk4.green;
|
|
2772
|
-
return "[" + color(fullChars + partialChar) + filler + `] (${this.resourcesDone}/${this.resourcesTotal})`;
|
|
2773
|
-
}
|
|
2774
|
-
failureReasonOnNextLine(activity) {
|
|
2775
|
-
return hasErrorMessage(activity.event.ResourceStatus ?? "") ? `
|
|
2776
|
-
${" ".repeat(TIMESTAMP_WIDTH + STATUS_WIDTH + 6)}${chalk4.red(this.failureReason(activity) ?? "")}` : "";
|
|
3110
|
+
return path12;
|
|
2777
3111
|
}
|
|
2778
3112
|
};
|
|
2779
|
-
var FULL_BLOCK = "\u2588";
|
|
2780
|
-
var PARTIAL_BLOCK = ["", "\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589"];
|
|
2781
|
-
var MAX_PROGRESSBAR_WIDTH = 60;
|
|
2782
|
-
var MIN_PROGRESSBAR_WIDTH = 10;
|
|
2783
|
-
var PROGRESSBAR_EXTRA_SPACE = 2 + 2 + 4 + 6;
|
|
2784
|
-
function hasErrorMessage(status) {
|
|
2785
|
-
return status.endsWith("_FAILED") || status === "ROLLBACK_IN_PROGRESS" || status === "UPDATE_ROLLBACK_IN_PROGRESS";
|
|
2786
|
-
}
|
|
2787
|
-
function colorFromStatusResult(status) {
|
|
2788
|
-
if (!status) {
|
|
2789
|
-
return chalk4.reset;
|
|
2790
|
-
}
|
|
2791
|
-
if (status.indexOf("FAILED") !== -1) {
|
|
2792
|
-
return chalk4.red;
|
|
2793
|
-
}
|
|
2794
|
-
if (status.indexOf("ROLLBACK") !== -1) {
|
|
2795
|
-
return chalk4.yellow;
|
|
2796
|
-
}
|
|
2797
|
-
if (status.indexOf("COMPLETE") !== -1) {
|
|
2798
|
-
return chalk4.green;
|
|
2799
|
-
}
|
|
2800
|
-
return chalk4.reset;
|
|
2801
|
-
}
|
|
2802
|
-
function colorFromStatusActivity(status) {
|
|
2803
|
-
if (!status) {
|
|
2804
|
-
return chalk4.reset;
|
|
2805
|
-
}
|
|
2806
|
-
if (status.endsWith("_FAILED")) {
|
|
2807
|
-
return chalk4.red;
|
|
2808
|
-
}
|
|
2809
|
-
if (status.startsWith("CREATE_") || status.startsWith("UPDATE_") || status.startsWith("IMPORT_")) {
|
|
2810
|
-
return chalk4.green;
|
|
2811
|
-
}
|
|
2812
|
-
if (status.indexOf("ROLLBACK_") !== -1) {
|
|
2813
|
-
return chalk4.yellow;
|
|
2814
|
-
}
|
|
2815
|
-
if (status.startsWith("DELETE_")) {
|
|
2816
|
-
return chalk4.yellow;
|
|
2817
|
-
}
|
|
2818
|
-
return chalk4.reset;
|
|
2819
|
-
}
|
|
2820
|
-
function shorten(maxWidth, p) {
|
|
2821
|
-
if (p.length <= maxWidth) {
|
|
2822
|
-
return p;
|
|
2823
|
-
}
|
|
2824
|
-
const half = Math.floor((maxWidth - 3) / 2);
|
|
2825
|
-
return p.slice(0, half) + "..." + p.slice(-half);
|
|
2826
|
-
}
|
|
2827
|
-
var TIMESTAMP_WIDTH = 12;
|
|
2828
|
-
var STATUS_WIDTH = 20;
|
|
2829
3113
|
|
|
2830
3114
|
// ../../aws-cdk/lib/api/stack-events/stack-status.ts
|
|
2831
3115
|
var import_client_cloudformation2 = require("@aws-sdk/client-cloudformation");
|
|
@@ -2854,85 +3138,46 @@ var StackStatus = class _StackStatus2 {
|
|
|
2854
3138
|
}
|
|
2855
3139
|
get isNotFound() {
|
|
2856
3140
|
return this.name === "NOT_FOUND";
|
|
2857
|
-
}
|
|
2858
|
-
get isDeploySuccess() {
|
|
2859
|
-
return !this.isNotFound && (this.name === import_client_cloudformation2.StackStatus.CREATE_COMPLETE || this.name === import_client_cloudformation2.StackStatus.UPDATE_COMPLETE || this.name === import_client_cloudformation2.StackStatus.IMPORT_COMPLETE);
|
|
2860
|
-
}
|
|
2861
|
-
get isRollbackSuccess() {
|
|
2862
|
-
return this.name === import_client_cloudformation2.StackStatus.ROLLBACK_COMPLETE || this.name === import_client_cloudformation2.StackStatus.UPDATE_ROLLBACK_COMPLETE;
|
|
2863
|
-
}
|
|
2864
|
-
/**
|
|
2865
|
-
* Whether the stack is in a paused state due to `--no-rollback`.
|
|
2866
|
-
*
|
|
2867
|
-
* The possible actions here are retrying a new `--no-rollback` deployment, or initiating a rollback.
|
|
2868
|
-
*/
|
|
2869
|
-
get rollbackChoice() {
|
|
2870
|
-
switch (this.name) {
|
|
2871
|
-
case import_client_cloudformation2.StackStatus.CREATE_FAILED:
|
|
2872
|
-
case import_client_cloudformation2.StackStatus.UPDATE_FAILED:
|
|
2873
|
-
return 0 /* START_ROLLBACK */;
|
|
2874
|
-
case import_client_cloudformation2.StackStatus.UPDATE_ROLLBACK_FAILED:
|
|
2875
|
-
return 1 /* CONTINUE_UPDATE_ROLLBACK */;
|
|
2876
|
-
case import_client_cloudformation2.StackStatus.ROLLBACK_FAILED:
|
|
2877
|
-
return 2 /* ROLLBACK_FAILED */;
|
|
2878
|
-
default:
|
|
2879
|
-
return 3 /* NONE */;
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
get isRollbackable() {
|
|
2883
|
-
return [0 /* START_ROLLBACK */, 1 /* CONTINUE_UPDATE_ROLLBACK */].includes(this.rollbackChoice);
|
|
2884
|
-
}
|
|
2885
|
-
toString() {
|
|
2886
|
-
return this.name + (this.reason ? ` (${this.reason})` : "");
|
|
2887
|
-
}
|
|
2888
|
-
};
|
|
2889
|
-
|
|
2890
|
-
// ../../aws-cdk/lib/api/util/template-body-parameter.ts
|
|
2891
|
-
var path4 = __toESM(require("path"));
|
|
2892
|
-
var import_cx_api2 = require("@aws-cdk/cx-api");
|
|
2893
|
-
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
2894
|
-
var import_middleware_endpoint2 = require("@smithy/middleware-endpoint");
|
|
2895
|
-
var chalk5 = __toESM(require("chalk"));
|
|
2896
|
-
var fs6 = __toESM(require("fs-extra"));
|
|
2897
|
-
|
|
2898
|
-
// ../../aws-cdk/lib/util/content-hash.ts
|
|
2899
|
-
var crypto = __toESM(require("crypto"));
|
|
2900
|
-
function contentHash(data) {
|
|
2901
|
-
return crypto.createHash("sha256").update(data).digest("hex");
|
|
2902
|
-
}
|
|
2903
|
-
function contentHashAny(value) {
|
|
2904
|
-
const ret = crypto.createHash("sha256");
|
|
2905
|
-
recurse(value);
|
|
2906
|
-
return ret.digest("hex");
|
|
2907
|
-
function recurse(x) {
|
|
2908
|
-
if (typeof x === "string") {
|
|
2909
|
-
ret.update(x);
|
|
2910
|
-
return;
|
|
2911
|
-
}
|
|
2912
|
-
if (Array.isArray(x)) {
|
|
2913
|
-
ret.update("[");
|
|
2914
|
-
for (const e of x) {
|
|
2915
|
-
recurse(e);
|
|
2916
|
-
ret.update("||");
|
|
2917
|
-
}
|
|
2918
|
-
ret.update("]");
|
|
2919
|
-
return;
|
|
2920
|
-
}
|
|
2921
|
-
if (x && typeof x === "object") {
|
|
2922
|
-
ret.update("{");
|
|
2923
|
-
for (const key of Object.keys(x).sort()) {
|
|
2924
|
-
ret.update(key);
|
|
2925
|
-
ret.update(":");
|
|
2926
|
-
recurse(x[key]);
|
|
2927
|
-
}
|
|
2928
|
-
ret.update("}");
|
|
2929
|
-
return;
|
|
3141
|
+
}
|
|
3142
|
+
get isDeploySuccess() {
|
|
3143
|
+
return !this.isNotFound && (this.name === import_client_cloudformation2.StackStatus.CREATE_COMPLETE || this.name === import_client_cloudformation2.StackStatus.UPDATE_COMPLETE || this.name === import_client_cloudformation2.StackStatus.IMPORT_COMPLETE);
|
|
3144
|
+
}
|
|
3145
|
+
get isRollbackSuccess() {
|
|
3146
|
+
return this.name === import_client_cloudformation2.StackStatus.ROLLBACK_COMPLETE || this.name === import_client_cloudformation2.StackStatus.UPDATE_ROLLBACK_COMPLETE;
|
|
3147
|
+
}
|
|
3148
|
+
/**
|
|
3149
|
+
* Whether the stack is in a paused state due to `--no-rollback`.
|
|
3150
|
+
*
|
|
3151
|
+
* The possible actions here are retrying a new `--no-rollback` deployment, or initiating a rollback.
|
|
3152
|
+
*/
|
|
3153
|
+
get rollbackChoice() {
|
|
3154
|
+
switch (this.name) {
|
|
3155
|
+
case import_client_cloudformation2.StackStatus.CREATE_FAILED:
|
|
3156
|
+
case import_client_cloudformation2.StackStatus.UPDATE_FAILED:
|
|
3157
|
+
return 0 /* START_ROLLBACK */;
|
|
3158
|
+
case import_client_cloudformation2.StackStatus.UPDATE_ROLLBACK_FAILED:
|
|
3159
|
+
return 1 /* CONTINUE_UPDATE_ROLLBACK */;
|
|
3160
|
+
case import_client_cloudformation2.StackStatus.ROLLBACK_FAILED:
|
|
3161
|
+
return 2 /* ROLLBACK_FAILED */;
|
|
3162
|
+
default:
|
|
3163
|
+
return 3 /* NONE */;
|
|
2930
3164
|
}
|
|
2931
|
-
ret.update(`${x}${typeof x}`);
|
|
2932
3165
|
}
|
|
2933
|
-
|
|
3166
|
+
get isRollbackable() {
|
|
3167
|
+
return [0 /* START_ROLLBACK */, 1 /* CONTINUE_UPDATE_ROLLBACK */].includes(this.rollbackChoice);
|
|
3168
|
+
}
|
|
3169
|
+
toString() {
|
|
3170
|
+
return this.name + (this.reason ? ` (${this.reason})` : "");
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
2934
3173
|
|
|
2935
3174
|
// ../../aws-cdk/lib/api/util/template-body-parameter.ts
|
|
3175
|
+
var path4 = __toESM(require("path"));
|
|
3176
|
+
var import_cx_api2 = require("@aws-cdk/cx-api");
|
|
3177
|
+
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
3178
|
+
var import_middleware_endpoint2 = require("@smithy/middleware-endpoint");
|
|
3179
|
+
var chalk6 = __toESM(require("chalk"));
|
|
3180
|
+
var fs6 = __toESM(require("fs-extra"));
|
|
2936
3181
|
var LARGE_TEMPLATE_SIZE_KB = 50;
|
|
2937
3182
|
async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, resources, overrideTemplate) {
|
|
2938
3183
|
if (stack.stackTemplateAssetObjectUrl && !overrideTemplate) {
|
|
@@ -2951,7 +3196,7 @@ async function makeBodyParameter(stack, resolvedEnvironment, assetManifest, reso
|
|
|
2951
3196
|
Run the following command in order to setup an S3 bucket in this environment, and then re-deploy:
|
|
2952
3197
|
|
|
2953
3198
|
`,
|
|
2954
|
-
|
|
3199
|
+
chalk6.blue(` $ cdk bootstrap ${resolvedEnvironment.name}
|
|
2955
3200
|
`)
|
|
2956
3201
|
);
|
|
2957
3202
|
throw new ToolkitError('Template too large to deploy ("cdk bootstrap" is required)');
|
|
@@ -3177,13 +3422,13 @@ async function waitFor(valueProvider, timeout = 5e3) {
|
|
|
3177
3422
|
}
|
|
3178
3423
|
}
|
|
3179
3424
|
async function waitForChangeSet(cfn, { ioHost, action }, stackName, changeSetName, { fetchAll }) {
|
|
3180
|
-
await ioHost.notify(debug2(action, (0,
|
|
3425
|
+
await ioHost.notify(debug2(action, (0, import_util10.format)("Waiting for changeset %s on stack %s to finish creating...", changeSetName, stackName)));
|
|
3181
3426
|
const ret = await waitFor(async () => {
|
|
3182
3427
|
const description = await describeChangeSet(cfn, stackName, changeSetName, {
|
|
3183
3428
|
fetchAll
|
|
3184
3429
|
});
|
|
3185
3430
|
if (description.Status === "CREATE_PENDING" || description.Status === "CREATE_IN_PROGRESS") {
|
|
3186
|
-
await ioHost.notify(debug2(action, (0,
|
|
3431
|
+
await ioHost.notify(debug2(action, (0, import_util10.format)("Changeset %s on stack %s is still creating", changeSetName, stackName)));
|
|
3187
3432
|
return void 0;
|
|
3188
3433
|
}
|
|
3189
3434
|
if (description.Status === import_client_cloudformation3.ChangeSetStatus.CREATE_COMPLETE || changeSetHasNoChanges(description)) {
|
|
@@ -3268,19 +3513,19 @@ async function waitForStackDeploy(cfn, { ioHost, action }, stackName) {
|
|
|
3268
3513
|
return stack;
|
|
3269
3514
|
}
|
|
3270
3515
|
async function stabilizeStack(cfn, { ioHost, action }, stackName) {
|
|
3271
|
-
await ioHost.notify(debug2(action, (0,
|
|
3516
|
+
await ioHost.notify(debug2(action, (0, import_util10.format)("Waiting for stack %s to finish creating or updating...", stackName)));
|
|
3272
3517
|
return waitFor(async () => {
|
|
3273
3518
|
const stack = await CloudFormationStack.lookup(cfn, stackName);
|
|
3274
3519
|
if (!stack.exists) {
|
|
3275
|
-
await ioHost.notify(debug2(action, (0,
|
|
3520
|
+
await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s does not exist", stackName)));
|
|
3276
3521
|
return null;
|
|
3277
3522
|
}
|
|
3278
3523
|
const status = stack.stackStatus;
|
|
3279
3524
|
if (status.isInProgress) {
|
|
3280
|
-
await ioHost.notify(debug2(action, (0,
|
|
3525
|
+
await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s has an ongoing operation in progress and is not stable (%s)", stackName, status)));
|
|
3281
3526
|
return void 0;
|
|
3282
3527
|
} else if (status.isReviewInProgress) {
|
|
3283
|
-
await ioHost.notify(debug2(action, (0,
|
|
3528
|
+
await ioHost.notify(debug2(action, (0, import_util10.format)("Stack %s is in REVIEW_IN_PROGRESS state. Considering this is a stable status (%s)", stackName, status)));
|
|
3284
3529
|
}
|
|
3285
3530
|
return stack;
|
|
3286
3531
|
});
|
|
@@ -3372,7 +3617,7 @@ var ParameterValues = class {
|
|
|
3372
3617
|
// ../../aws-cdk/lib/api/deployments/deployments.ts
|
|
3373
3618
|
var import_crypto = require("crypto");
|
|
3374
3619
|
var cdk_assets = __toESM(require("cdk-assets"));
|
|
3375
|
-
var
|
|
3620
|
+
var chalk12 = __toESM(require("chalk"));
|
|
3376
3621
|
|
|
3377
3622
|
// ../../aws-cdk/lib/api/deployments/asset-publishing.ts
|
|
3378
3623
|
var import_cx_api4 = require("@aws-cdk/cx-api");
|
|
@@ -3549,15 +3794,15 @@ async function getBootstrapStackInfo(sdk, stackName) {
|
|
|
3549
3794
|
}
|
|
3550
3795
|
|
|
3551
3796
|
// ../../aws-cdk/lib/api/deployments/deploy-stack.ts
|
|
3552
|
-
var
|
|
3553
|
-
var
|
|
3554
|
-
var
|
|
3797
|
+
var import_util13 = require("util");
|
|
3798
|
+
var chalk9 = __toESM(require("chalk"));
|
|
3799
|
+
var uuid2 = __toESM(require("uuid"));
|
|
3555
3800
|
|
|
3556
3801
|
// ../../aws-cdk/lib/api/deployments/assets.ts
|
|
3557
3802
|
var path5 = __toESM(require("path"));
|
|
3558
3803
|
var cxschema2 = __toESM(require("@aws-cdk/cloud-assembly-schema"));
|
|
3559
3804
|
var cxapi2 = __toESM(require("@aws-cdk/cx-api"));
|
|
3560
|
-
var
|
|
3805
|
+
var chalk7 = __toESM(require("chalk"));
|
|
3561
3806
|
async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManifest, envResources, reuse) {
|
|
3562
3807
|
reuse = reuse || [];
|
|
3563
3808
|
const assets = stack.assets;
|
|
@@ -3566,7 +3811,7 @@ async function addMetadataAssetsToManifest({ ioHost, action }, stack, assetManif
|
|
|
3566
3811
|
}
|
|
3567
3812
|
const toolkitInfo = await envResources.lookupToolkit();
|
|
3568
3813
|
if (!toolkitInfo.found) {
|
|
3569
|
-
throw new ToolkitError(`This stack uses assets, so the toolkit stack must be deployed to the environment (Run "${
|
|
3814
|
+
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)}")`);
|
|
3570
3815
|
}
|
|
3571
3816
|
const params = {};
|
|
3572
3817
|
for (const asset of assets) {
|
|
@@ -3647,9 +3892,9 @@ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
|
|
|
3647
3892
|
}
|
|
3648
3893
|
|
|
3649
3894
|
// ../../aws-cdk/lib/api/deployments/hotswap-deployments.ts
|
|
3650
|
-
var
|
|
3895
|
+
var import_util12 = require("util");
|
|
3651
3896
|
var cfn_diff = __toESM(require("@aws-cdk/cloudformation-diff"));
|
|
3652
|
-
var
|
|
3897
|
+
var chalk8 = __toESM(require("chalk"));
|
|
3653
3898
|
|
|
3654
3899
|
// ../../aws-cdk/lib/api/deployments/nested-stack-helpers.ts
|
|
3655
3900
|
var path6 = __toESM(require("path"));
|
|
@@ -4564,77 +4809,6 @@ async function prepareTaskDefinitionChange(evaluateCfnTemplate, logicalId, chang
|
|
|
4564
4809
|
|
|
4565
4810
|
// ../../aws-cdk/lib/api/hotswap/lambda-functions.ts
|
|
4566
4811
|
var import_stream = require("stream");
|
|
4567
|
-
|
|
4568
|
-
// ../../aws-cdk/lib/util/archive.ts
|
|
4569
|
-
var glob = __toESM(require("glob"));
|
|
4570
|
-
var archiver = require("archiver");
|
|
4571
|
-
|
|
4572
|
-
// ../../aws-cdk/lib/util/arrays.ts
|
|
4573
|
-
function flatMap(xs, fn) {
|
|
4574
|
-
return flatten(xs.map(fn));
|
|
4575
|
-
}
|
|
4576
|
-
function flatten(xs) {
|
|
4577
|
-
return Array.prototype.concat.apply([], xs);
|
|
4578
|
-
}
|
|
4579
|
-
|
|
4580
|
-
// ../../aws-cdk/lib/util/cloudformation.ts
|
|
4581
|
-
function validateSnsTopicArn(arn) {
|
|
4582
|
-
return /^arn:aws:sns:[a-z0-9\-]+:[0-9]+:[a-z0-9\-\_]+$/i.test(arn);
|
|
4583
|
-
}
|
|
4584
|
-
|
|
4585
|
-
// ../../aws-cdk/lib/util/parallel.ts
|
|
4586
|
-
async function parallelPromises(n, promises) {
|
|
4587
|
-
const ret = new Array();
|
|
4588
|
-
let count = 0;
|
|
4589
|
-
let error3;
|
|
4590
|
-
const queue = [...promises];
|
|
4591
|
-
return new Promise((ok, ko) => {
|
|
4592
|
-
tick();
|
|
4593
|
-
function tick() {
|
|
4594
|
-
if (count === 0 && error3) {
|
|
4595
|
-
ko(error3);
|
|
4596
|
-
return;
|
|
4597
|
-
}
|
|
4598
|
-
if (count === 0 && queue.length === 0) {
|
|
4599
|
-
ok(ret);
|
|
4600
|
-
return;
|
|
4601
|
-
}
|
|
4602
|
-
while (count < n && queue.length > 0 && !error3) {
|
|
4603
|
-
const next = queue.shift();
|
|
4604
|
-
if (next !== void 0) {
|
|
4605
|
-
start(next);
|
|
4606
|
-
}
|
|
4607
|
-
}
|
|
4608
|
-
}
|
|
4609
|
-
function start(fn) {
|
|
4610
|
-
count += 1;
|
|
4611
|
-
fn().then((result) => {
|
|
4612
|
-
ret.push(result);
|
|
4613
|
-
}).catch((e) => {
|
|
4614
|
-
error3 = e;
|
|
4615
|
-
}).finally(() => {
|
|
4616
|
-
count -= 1;
|
|
4617
|
-
tick();
|
|
4618
|
-
});
|
|
4619
|
-
}
|
|
4620
|
-
});
|
|
4621
|
-
}
|
|
4622
|
-
|
|
4623
|
-
// ../../aws-cdk/lib/util/string-manipulation.ts
|
|
4624
|
-
function formatTime(num) {
|
|
4625
|
-
return roundPercentage(millisecondsToSeconds(num));
|
|
4626
|
-
}
|
|
4627
|
-
function roundPercentage(num) {
|
|
4628
|
-
return Math.round(100 * num) / 100;
|
|
4629
|
-
}
|
|
4630
|
-
function millisecondsToSeconds(num) {
|
|
4631
|
-
return num / 1e3;
|
|
4632
|
-
}
|
|
4633
|
-
|
|
4634
|
-
// ../../aws-cdk/lib/util/version-range.ts
|
|
4635
|
-
var semver = __toESM(require("semver"));
|
|
4636
|
-
|
|
4637
|
-
// ../../aws-cdk/lib/api/hotswap/lambda-functions.ts
|
|
4638
4812
|
var archiver2 = require("archiver");
|
|
4639
4813
|
async function isHotswappableLambdaFunctionChange(logicalId, change, evaluateCfnTemplate) {
|
|
4640
4814
|
if (change.newValue.Type === "AWS::Lambda::Version") {
|
|
@@ -5255,7 +5429,7 @@ async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation
|
|
|
5255
5429
|
const customUserAgent = `cdk-hotswap/success-${hotswapOperation.service}`;
|
|
5256
5430
|
sdk.appendCustomUserAgent(customUserAgent);
|
|
5257
5431
|
for (const name of hotswapOperation.resourceNames) {
|
|
5258
|
-
await ioHost.notify(info2(action, (0,
|
|
5432
|
+
await ioHost.notify(info2(action, (0, import_util12.format)(` ${ICON} %s`, chalk8.bold(name))));
|
|
5259
5433
|
}
|
|
5260
5434
|
try {
|
|
5261
5435
|
await hotswapOperation.apply(sdk);
|
|
@@ -5269,7 +5443,7 @@ async function applyHotswappableChange(sdk, { ioHost, action }, hotswapOperation
|
|
|
5269
5443
|
throw e;
|
|
5270
5444
|
}
|
|
5271
5445
|
for (const name of hotswapOperation.resourceNames) {
|
|
5272
|
-
await ioHost.notify(info2(action, (0,
|
|
5446
|
+
await ioHost.notify(info2(action, (0, import_util12.format)(`${ICON} %s %s`, chalk8.bold(name), chalk8.green("hotswapped!"))));
|
|
5273
5447
|
}
|
|
5274
5448
|
sdk.removeCustomUserAgent(customUserAgent);
|
|
5275
5449
|
}
|
|
@@ -5297,25 +5471,25 @@ async function logNonHotswappableChanges({ ioHost, action }, nonHotswappableChan
|
|
|
5297
5471
|
}
|
|
5298
5472
|
const messages = [""];
|
|
5299
5473
|
if (hotswapMode === "hotswap-only" /* HOTSWAP_ONLY */) {
|
|
5300
|
-
messages.push((0,
|
|
5474
|
+
messages.push((0, import_util12.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
|
|
5301
5475
|
} else {
|
|
5302
|
-
messages.push((0,
|
|
5476
|
+
messages.push((0, import_util12.format)("%s %s", chalk8.red("\u26A0\uFE0F"), chalk8.red("The following non-hotswappable changes were found:")));
|
|
5303
5477
|
}
|
|
5304
5478
|
for (const change of nonHotswappableChanges) {
|
|
5305
5479
|
if (change.rejectedChanges.length > 0) {
|
|
5306
|
-
messages.push((0,
|
|
5480
|
+
messages.push((0, import_util12.format)(
|
|
5307
5481
|
" logicalID: %s, type: %s, rejected changes: %s, reason: %s",
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5482
|
+
chalk8.bold(change.logicalId),
|
|
5483
|
+
chalk8.bold(change.resourceType),
|
|
5484
|
+
chalk8.bold(change.rejectedChanges),
|
|
5485
|
+
chalk8.red(change.reason)
|
|
5312
5486
|
));
|
|
5313
5487
|
} else {
|
|
5314
|
-
messages.push((0,
|
|
5488
|
+
messages.push((0, import_util12.format)(
|
|
5315
5489
|
" logicalID: %s, type: %s, reason: %s",
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5490
|
+
chalk8.bold(change.logicalId),
|
|
5491
|
+
chalk8.bold(change.resourceType),
|
|
5492
|
+
chalk8.red(change.reason)
|
|
5319
5493
|
));
|
|
5320
5494
|
}
|
|
5321
5495
|
}
|
|
@@ -5363,11 +5537,11 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5363
5537
|
if (hotswapMode !== "full-deployment" /* FULL_DEPLOYMENT */) {
|
|
5364
5538
|
await ioHost.notify(info2(
|
|
5365
5539
|
action,
|
|
5366
|
-
(0,
|
|
5540
|
+
(0, import_util13.format)(
|
|
5367
5541
|
`
|
|
5368
5542
|
${ICON} %s
|
|
5369
5543
|
`,
|
|
5370
|
-
|
|
5544
|
+
chalk9.bold("hotswap deployment skipped - no changes were detected (use --force to override)")
|
|
5371
5545
|
)
|
|
5372
5546
|
));
|
|
5373
5547
|
}
|
|
@@ -5411,7 +5585,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5411
5585
|
if (hotswapDeploymentResult) {
|
|
5412
5586
|
return hotswapDeploymentResult;
|
|
5413
5587
|
}
|
|
5414
|
-
await ioHost.notify(info2(action, (0,
|
|
5588
|
+
await ioHost.notify(info2(action, (0, import_util13.format)(
|
|
5415
5589
|
"Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
|
|
5416
5590
|
stackArtifact.displayName
|
|
5417
5591
|
)));
|
|
@@ -5419,7 +5593,7 @@ async function deployStack(options, { ioHost, action }) {
|
|
|
5419
5593
|
if (!(e instanceof CfnEvaluationException)) {
|
|
5420
5594
|
throw e;
|
|
5421
5595
|
}
|
|
5422
|
-
await ioHost.notify(info2(action, (0,
|
|
5596
|
+
await ioHost.notify(info2(action, (0, import_util13.format)(
|
|
5423
5597
|
"Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
|
|
5424
5598
|
formatErrorMessage(e)
|
|
5425
5599
|
)));
|
|
@@ -5460,7 +5634,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5460
5634
|
this.stackName = options.deployName ?? stackArtifact.stackName;
|
|
5461
5635
|
this.update = cloudFormationStack.exists && cloudFormationStack.stackStatus.name !== "REVIEW_IN_PROGRESS";
|
|
5462
5636
|
this.verb = this.update ? "update" : "create";
|
|
5463
|
-
this.uuid =
|
|
5637
|
+
this.uuid = uuid2.v4();
|
|
5464
5638
|
}
|
|
5465
5639
|
async performDeployment() {
|
|
5466
5640
|
const deploymentMethod = this.options.deploymentMethod ?? {
|
|
@@ -5483,9 +5657,9 @@ var FullCloudFormationDeployment = class {
|
|
|
5483
5657
|
const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
|
|
5484
5658
|
await this.updateTerminationProtection();
|
|
5485
5659
|
if (changeSetHasNoChanges(changeSetDescription)) {
|
|
5486
|
-
debug2(this.action, (0,
|
|
5660
|
+
await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("No changes are to be performed on %s.", this.stackName)));
|
|
5487
5661
|
if (execute) {
|
|
5488
|
-
debug2(this.action, (0,
|
|
5662
|
+
await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId)));
|
|
5489
5663
|
await this.cfn.deleteChangeSet({
|
|
5490
5664
|
StackName: this.stackName,
|
|
5491
5665
|
ChangeSetName: changeSetName
|
|
@@ -5511,10 +5685,10 @@ var FullCloudFormationDeployment = class {
|
|
|
5511
5685
|
};
|
|
5512
5686
|
}
|
|
5513
5687
|
if (!execute) {
|
|
5514
|
-
info2(this.action, (0,
|
|
5688
|
+
await this.ioHost.notify(info2(this.action, (0, import_util13.format)(
|
|
5515
5689
|
"Changeset %s created and waiting in review for manual execution (--no-execute)",
|
|
5516
5690
|
changeSetDescription.ChangeSetId
|
|
5517
|
-
));
|
|
5691
|
+
)));
|
|
5518
5692
|
return {
|
|
5519
5693
|
type: "did-deploy-stack",
|
|
5520
5694
|
noOp: false,
|
|
@@ -5539,7 +5713,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5539
5713
|
async createChangeSet(changeSetName, willExecute, importExistingResources) {
|
|
5540
5714
|
await this.cleanupOldChangeset(changeSetName);
|
|
5541
5715
|
await this.ioHost.notify(debug2(this.action, `Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`));
|
|
5542
|
-
await this.ioHost.notify(info2(this.action, (0,
|
|
5716
|
+
await this.ioHost.notify(info2(this.action, (0, import_util13.format)("%s: creating CloudFormation changeset...", chalk9.bold(this.stackName))));
|
|
5543
5717
|
const changeSet = await this.cfn.createChangeSet({
|
|
5544
5718
|
StackName: this.stackName,
|
|
5545
5719
|
ChangeSetName: changeSetName,
|
|
@@ -5550,13 +5724,13 @@ var FullCloudFormationDeployment = class {
|
|
|
5550
5724
|
ImportExistingResources: importExistingResources,
|
|
5551
5725
|
...this.commonPrepareOptions()
|
|
5552
5726
|
});
|
|
5553
|
-
await this.ioHost.notify(debug2(this.action, (0,
|
|
5727
|
+
await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id)));
|
|
5554
5728
|
return waitForChangeSet(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName, changeSetName, {
|
|
5555
5729
|
fetchAll: willExecute
|
|
5556
5730
|
});
|
|
5557
5731
|
}
|
|
5558
5732
|
async executeChangeSet(changeSet) {
|
|
5559
|
-
await this.ioHost.notify(debug2(this.action, (0,
|
|
5733
|
+
await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName)));
|
|
5560
5734
|
await this.cfn.executeChangeSet({
|
|
5561
5735
|
StackName: this.stackName,
|
|
5562
5736
|
ChangeSetName: changeSet.ChangeSetName,
|
|
@@ -5565,7 +5739,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5565
5739
|
});
|
|
5566
5740
|
await this.ioHost.notify(debug2(
|
|
5567
5741
|
this.action,
|
|
5568
|
-
(0,
|
|
5742
|
+
(0, import_util13.format)(
|
|
5569
5743
|
"Execution of changeset %s on stack %s has started; waiting for the update to complete...",
|
|
5570
5744
|
changeSet.ChangeSetId,
|
|
5571
5745
|
this.stackName
|
|
@@ -5588,7 +5762,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5588
5762
|
if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
|
|
5589
5763
|
await this.ioHost.notify(debug2(
|
|
5590
5764
|
this.action,
|
|
5591
|
-
(0,
|
|
5765
|
+
(0, import_util13.format)(
|
|
5592
5766
|
"Updating termination protection from %s to %s for stack %s",
|
|
5593
5767
|
this.cloudFormationStack.terminationProtection,
|
|
5594
5768
|
terminationProtection,
|
|
@@ -5599,11 +5773,11 @@ var FullCloudFormationDeployment = class {
|
|
|
5599
5773
|
StackName: this.stackName,
|
|
5600
5774
|
EnableTerminationProtection: terminationProtection
|
|
5601
5775
|
});
|
|
5602
|
-
await this.ioHost.notify(debug2(this.action, (0,
|
|
5776
|
+
await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName)));
|
|
5603
5777
|
}
|
|
5604
5778
|
}
|
|
5605
5779
|
async directDeployment() {
|
|
5606
|
-
await this.ioHost.notify(info2(this.action, (0,
|
|
5780
|
+
await this.ioHost.notify(info2(this.action, (0, import_util13.format)("%s: %s stack...", chalk9.bold(this.stackName), this.update ? "updating" : "creating")));
|
|
5607
5781
|
const startTime = /* @__PURE__ */ new Date();
|
|
5608
5782
|
if (this.update) {
|
|
5609
5783
|
await this.updateTerminationProtection();
|
|
@@ -5616,7 +5790,7 @@ var FullCloudFormationDeployment = class {
|
|
|
5616
5790
|
});
|
|
5617
5791
|
} catch (err) {
|
|
5618
5792
|
if (err.message === "No updates are to be performed.") {
|
|
5619
|
-
await this.ioHost.notify(debug2(this.action, (0,
|
|
5793
|
+
await this.ioHost.notify(debug2(this.action, (0, import_util13.format)("No updates are to be performed for stack %s", this.stackName)));
|
|
5620
5794
|
return {
|
|
5621
5795
|
type: "did-deploy-stack",
|
|
5622
5796
|
noOp: true,
|
|
@@ -5640,12 +5814,16 @@ var FullCloudFormationDeployment = class {
|
|
|
5640
5814
|
}
|
|
5641
5815
|
}
|
|
5642
5816
|
async monitorDeployment(startTime, expectedChanges) {
|
|
5643
|
-
const monitor =
|
|
5817
|
+
const monitor = new StackActivityMonitor({
|
|
5818
|
+
cfn: this.cfn,
|
|
5819
|
+
stack: this.stackArtifact,
|
|
5820
|
+
stackName: this.stackName,
|
|
5644
5821
|
resourcesTotal: expectedChanges,
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
})
|
|
5822
|
+
ioHost: this.ioHost,
|
|
5823
|
+
action: this.action,
|
|
5824
|
+
changeSetCreationTime: startTime
|
|
5825
|
+
});
|
|
5826
|
+
await monitor.start();
|
|
5649
5827
|
let finalState = this.cloudFormationStack;
|
|
5650
5828
|
try {
|
|
5651
5829
|
const successStack = await waitForStackDeploy(this.cfn, { ioHost: this.ioHost, action: this.action }, this.stackName);
|
|
@@ -5654,11 +5832,11 @@ var FullCloudFormationDeployment = class {
|
|
|
5654
5832
|
}
|
|
5655
5833
|
finalState = successStack;
|
|
5656
5834
|
} catch (e) {
|
|
5657
|
-
throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor
|
|
5835
|
+
throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor.errors));
|
|
5658
5836
|
} finally {
|
|
5659
|
-
await monitor
|
|
5837
|
+
await monitor.stop();
|
|
5660
5838
|
}
|
|
5661
|
-
debug2(this.action, (0,
|
|
5839
|
+
debug2(this.action, (0, import_util13.format)("Stack %s has completed updating", this.stackName));
|
|
5662
5840
|
return {
|
|
5663
5841
|
type: "did-deploy-stack",
|
|
5664
5842
|
noOp: false,
|
|
@@ -5701,9 +5879,14 @@ async function destroyStack(options, { ioHost, action }) {
|
|
|
5701
5879
|
if (!currentStack.exists) {
|
|
5702
5880
|
return;
|
|
5703
5881
|
}
|
|
5704
|
-
const monitor =
|
|
5705
|
-
|
|
5706
|
-
|
|
5882
|
+
const monitor = new StackActivityMonitor({
|
|
5883
|
+
cfn,
|
|
5884
|
+
stack: options.stack,
|
|
5885
|
+
stackName: deployName,
|
|
5886
|
+
ioHost,
|
|
5887
|
+
action
|
|
5888
|
+
});
|
|
5889
|
+
await monitor.start();
|
|
5707
5890
|
try {
|
|
5708
5891
|
await cfn.deleteStack({ StackName: deployName, RoleARN: options.roleArn });
|
|
5709
5892
|
const destroyedStack = await waitForStackDelete(cfn, { ioHost, action }, deployName);
|
|
@@ -5711,7 +5894,7 @@ async function destroyStack(options, { ioHost, action }) {
|
|
|
5711
5894
|
throw new ToolkitError(`Failed to destroy ${deployName}: ${destroyedStack.stackStatus}`);
|
|
5712
5895
|
}
|
|
5713
5896
|
} catch (e) {
|
|
5714
|
-
throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor
|
|
5897
|
+
throw new ToolkitError(suffixWithErrors(formatErrorMessage(e), monitor.errors));
|
|
5715
5898
|
} finally {
|
|
5716
5899
|
if (monitor) {
|
|
5717
5900
|
await monitor.stop();
|
|
@@ -5796,7 +5979,7 @@ var semver4 = __toESM(require("semver"));
|
|
|
5796
5979
|
|
|
5797
5980
|
// ../../aws-cdk/lib/cli/version.ts
|
|
5798
5981
|
var path7 = __toESM(require("path"));
|
|
5799
|
-
var
|
|
5982
|
+
var chalk10 = __toESM(require("chalk"));
|
|
5800
5983
|
var fs8 = __toESM(require("fs-extra"));
|
|
5801
5984
|
var semver3 = __toESM(require("semver"));
|
|
5802
5985
|
|
|
@@ -5805,9 +5988,9 @@ var stripAnsi = require("strip-ansi");
|
|
|
5805
5988
|
|
|
5806
5989
|
// ../../aws-cdk/lib/cli/util/npm.ts
|
|
5807
5990
|
var import_child_process = require("child_process");
|
|
5808
|
-
var
|
|
5991
|
+
var import_util14 = require("util");
|
|
5809
5992
|
var semver2 = __toESM(require("semver"));
|
|
5810
|
-
var exec = (0,
|
|
5993
|
+
var exec = (0, import_util14.promisify)(import_child_process.exec);
|
|
5811
5994
|
|
|
5812
5995
|
// ../../aws-cdk/lib/cli/version.ts
|
|
5813
5996
|
var ONE_DAY_IN_SECONDS = 1 * 24 * 60 * 60;
|
|
@@ -5821,7 +6004,7 @@ var fs9 = __toESM(require("fs-extra"));
|
|
|
5821
6004
|
function some(node, predicate) {
|
|
5822
6005
|
return node != null && (predicate(node) || findInChildren());
|
|
5823
6006
|
function findInChildren() {
|
|
5824
|
-
return Object.values(node
|
|
6007
|
+
return Object.values(node?.children ?? {}).some((child) => some(child, predicate));
|
|
5825
6008
|
}
|
|
5826
6009
|
}
|
|
5827
6010
|
function loadTree(assembly) {
|
|
@@ -5831,7 +6014,7 @@ function loadTree(assembly) {
|
|
|
5831
6014
|
return fileName ? fs9.readJSONSync(path8.join(outdir, fileName)).tree : {};
|
|
5832
6015
|
} catch (e) {
|
|
5833
6016
|
trace(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
5834
|
-
return
|
|
6017
|
+
return void 0;
|
|
5835
6018
|
}
|
|
5836
6019
|
}
|
|
5837
6020
|
function loadTreeFromDir(outdir) {
|
|
@@ -5839,91 +6022,137 @@ function loadTreeFromDir(outdir) {
|
|
|
5839
6022
|
return fs9.readJSONSync(path8.join(outdir, "tree.json")).tree;
|
|
5840
6023
|
} catch (e) {
|
|
5841
6024
|
trace(`Failed to get tree.json file: ${e}. Proceeding with empty tree.`);
|
|
5842
|
-
return
|
|
6025
|
+
return void 0;
|
|
5843
6026
|
}
|
|
5844
6027
|
}
|
|
5845
6028
|
|
|
5846
6029
|
// ../../aws-cdk/lib/notices.ts
|
|
5847
6030
|
var CACHE_FILE_PATH = path9.join(cdkCacheDir(), "notices.json");
|
|
5848
|
-
var NoticesFilter = class {
|
|
6031
|
+
var NoticesFilter = class _NoticesFilter {
|
|
5849
6032
|
static filter(options) {
|
|
5850
|
-
|
|
5851
|
-
...
|
|
5852
|
-
...
|
|
5853
|
-
...this.findForBootstrapVersion(options.data, options.bootstrappedEnvironments)
|
|
6033
|
+
const components = [
|
|
6034
|
+
..._NoticesFilter.constructTreeComponents(options.outDir),
|
|
6035
|
+
..._NoticesFilter.otherComponents(options)
|
|
5854
6036
|
];
|
|
6037
|
+
return _NoticesFilter.findForNamedComponents(options.data, components);
|
|
5855
6038
|
}
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
}
|
|
5866
|
-
|
|
5867
|
-
|
|
6039
|
+
/**
|
|
6040
|
+
* From a set of input options, return the notices components we are searching for
|
|
6041
|
+
*/
|
|
6042
|
+
static otherComponents(options) {
|
|
6043
|
+
return [
|
|
6044
|
+
// CLI
|
|
6045
|
+
{
|
|
6046
|
+
name: "cli",
|
|
6047
|
+
version: options.cliVersion
|
|
6048
|
+
},
|
|
6049
|
+
// Node version
|
|
6050
|
+
{
|
|
6051
|
+
name: "node",
|
|
6052
|
+
version: process.version.replace(/^v/, ""),
|
|
6053
|
+
// remove the 'v' prefix.
|
|
6054
|
+
dynamicName: "node"
|
|
6055
|
+
},
|
|
6056
|
+
// Bootstrap environments
|
|
6057
|
+
...options.bootstrappedEnvironments.flatMap((env) => {
|
|
6058
|
+
const semverBootstrapVersion = semver4.coerce(env.bootstrapStackVersion);
|
|
6059
|
+
if (!semverBootstrapVersion) {
|
|
6060
|
+
warning(`While filtering notices, could not coerce bootstrap version '${env.bootstrapStackVersion}' into semver`);
|
|
6061
|
+
return [];
|
|
6062
|
+
}
|
|
6063
|
+
return [{
|
|
6064
|
+
name: "bootstrap",
|
|
6065
|
+
version: `${semverBootstrapVersion}`,
|
|
6066
|
+
dynamicName: "ENVIRONMENTS",
|
|
6067
|
+
dynamicValue: env.environment.name
|
|
6068
|
+
}];
|
|
6069
|
+
})
|
|
6070
|
+
];
|
|
5868
6071
|
}
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
return false;
|
|
6072
|
+
/**
|
|
6073
|
+
* Based on a set of component names, find all notices that match one of the given components
|
|
6074
|
+
*/
|
|
6075
|
+
static findForNamedComponents(data, actualComponents) {
|
|
6076
|
+
return data.flatMap((notice) => {
|
|
6077
|
+
const ors = this.resolveAliases(normalizeComponents(notice.components));
|
|
6078
|
+
for (const ands of ors) {
|
|
6079
|
+
const matched = ands.map((affected) => actualComponents.filter((actual) => _NoticesFilter.componentNameMatches(affected, actual) && semver4.satisfies(actual.version, affected.version, { includePrerelease: true })));
|
|
6080
|
+
if (matched.every((xs) => xs.length > 0)) {
|
|
6081
|
+
const ret = new FilteredNotice(notice);
|
|
6082
|
+
_NoticesFilter.addDynamicValues(matched.flatMap((x) => x), ret);
|
|
6083
|
+
return [ret];
|
|
5882
6084
|
}
|
|
5883
|
-
return pattern.endsWith(".") ? target.startsWith(pattern) : pattern === target;
|
|
5884
|
-
}
|
|
5885
|
-
function compareVersions(pattern, target) {
|
|
5886
|
-
return semver4.satisfies(target ?? "", pattern);
|
|
5887
6085
|
}
|
|
6086
|
+
return [];
|
|
5888
6087
|
});
|
|
5889
6088
|
}
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
6089
|
+
/**
|
|
6090
|
+
* Whether the given "affected component" name applies to the given actual component name.
|
|
6091
|
+
*
|
|
6092
|
+
* The name matches if the name is exactly the same, or the name in the notice
|
|
6093
|
+
* is a prefix of the node name when the query ends in '.'.
|
|
6094
|
+
*/
|
|
6095
|
+
static componentNameMatches(pattern, actual) {
|
|
6096
|
+
return pattern.name.endsWith(".") ? actual.name.startsWith(pattern.name) : pattern.name === actual.name;
|
|
6097
|
+
}
|
|
6098
|
+
/**
|
|
6099
|
+
* Adds dynamic values from the given ActualComponents
|
|
6100
|
+
*
|
|
6101
|
+
* If there are multiple components with the same dynamic name, they are joined
|
|
6102
|
+
* by a comma.
|
|
6103
|
+
*/
|
|
6104
|
+
static addDynamicValues(comps, notice) {
|
|
6105
|
+
const dynamicValues = {};
|
|
6106
|
+
for (const comp of comps) {
|
|
6107
|
+
if (comp.dynamicName) {
|
|
6108
|
+
dynamicValues[comp.dynamicName] = dynamicValues[comp.dynamicName] ?? [];
|
|
6109
|
+
dynamicValues[comp.dynamicName].push(comp.dynamicValue ?? comp.version);
|
|
5907
6110
|
}
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
6111
|
+
}
|
|
6112
|
+
for (const [key, values] of Object.entries(dynamicValues)) {
|
|
6113
|
+
notice.addDynamicValue(key, values.join(","));
|
|
6114
|
+
}
|
|
6115
|
+
}
|
|
6116
|
+
/**
|
|
6117
|
+
* Treat 'framework' as an alias for either `aws-cdk-lib.` or `@aws-cdk/core.`.
|
|
6118
|
+
*
|
|
6119
|
+
* Because it's EITHER `aws-cdk-lib` or `@aws-cdk/core`, we need to add multiple
|
|
6120
|
+
* arrays at the top level.
|
|
6121
|
+
*/
|
|
6122
|
+
static resolveAliases(ors) {
|
|
6123
|
+
return ors.flatMap((ands) => {
|
|
6124
|
+
const hasFramework = ands.find((c) => c.name === "framework");
|
|
6125
|
+
if (!hasFramework) {
|
|
6126
|
+
return [ands];
|
|
6127
|
+
}
|
|
6128
|
+
return [
|
|
6129
|
+
ands.map((c) => c.name === "framework" ? { ...c, name: "@aws-cdk/core." } : c),
|
|
6130
|
+
ands.map((c) => c.name === "framework" ? { ...c, name: "aws-cdk-lib." } : c)
|
|
6131
|
+
];
|
|
5911
6132
|
});
|
|
5912
6133
|
}
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
6134
|
+
/**
|
|
6135
|
+
* Load the construct tree from the given directory and return its components
|
|
6136
|
+
*/
|
|
6137
|
+
static constructTreeComponents(manifestDir) {
|
|
6138
|
+
const tree = loadTreeFromDir(manifestDir);
|
|
6139
|
+
if (!tree) {
|
|
6140
|
+
return [];
|
|
6141
|
+
}
|
|
6142
|
+
const ret = [];
|
|
6143
|
+
recurse(tree);
|
|
6144
|
+
return ret;
|
|
6145
|
+
function recurse(x) {
|
|
6146
|
+
if (x.constructInfo?.fqn && x.constructInfo?.version) {
|
|
6147
|
+
ret.push({
|
|
6148
|
+
name: x.constructInfo?.fqn,
|
|
6149
|
+
version: x.constructInfo?.version
|
|
6150
|
+
});
|
|
5925
6151
|
}
|
|
5926
|
-
|
|
6152
|
+
for (const child of Object.values(x.children ?? {})) {
|
|
6153
|
+
recurse(child);
|
|
6154
|
+
}
|
|
6155
|
+
}
|
|
5927
6156
|
}
|
|
5928
6157
|
};
|
|
5929
6158
|
var Notices = class _Notices {
|
|
@@ -6023,6 +6252,12 @@ var Notices = class _Notices {
|
|
|
6023
6252
|
}
|
|
6024
6253
|
}
|
|
6025
6254
|
};
|
|
6255
|
+
function normalizeComponents(xs) {
|
|
6256
|
+
return xs.map((x) => Array.isArray(x) ? x : [x]);
|
|
6257
|
+
}
|
|
6258
|
+
function renderConjunction(xs) {
|
|
6259
|
+
return xs.map((c) => `${c.name}: ${c.version}`).join(" AND ");
|
|
6260
|
+
}
|
|
6026
6261
|
var FilteredNotice = class {
|
|
6027
6262
|
constructor(notice) {
|
|
6028
6263
|
this.notice = notice;
|
|
@@ -6032,7 +6267,7 @@ var FilteredNotice = class {
|
|
|
6032
6267
|
this.dynamicValues[`{resolve:${key}}`] = value;
|
|
6033
6268
|
}
|
|
6034
6269
|
format() {
|
|
6035
|
-
const componentsValue = this.notice.components.map(
|
|
6270
|
+
const componentsValue = normalizeComponents(this.notice.components).map(renderConjunction).join(", ");
|
|
6036
6271
|
return this.resolveDynamicValues([
|
|
6037
6272
|
`${this.notice.issueNumber} ${this.notice.title}`,
|
|
6038
6273
|
this.formatOverview(),
|
|
@@ -6165,8 +6400,8 @@ var CachedDataSource = class {
|
|
|
6165
6400
|
};
|
|
6166
6401
|
|
|
6167
6402
|
// ../../aws-cdk/lib/api/toolkit-info.ts
|
|
6168
|
-
var
|
|
6169
|
-
var
|
|
6403
|
+
var import_util15 = require("util");
|
|
6404
|
+
var chalk11 = __toESM(require("chalk"));
|
|
6170
6405
|
|
|
6171
6406
|
// ../../aws-cdk/lib/api/bootstrap/bootstrap-props.ts
|
|
6172
6407
|
var BUCKET_NAME_OUTPUT = "BucketName";
|
|
@@ -6190,11 +6425,11 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
6190
6425
|
if (!stack) {
|
|
6191
6426
|
await ioHost.notify(debug2(
|
|
6192
6427
|
action,
|
|
6193
|
-
(0,
|
|
6428
|
+
(0, import_util15.format)(
|
|
6194
6429
|
"The environment %s doesn't have the CDK toolkit stack (%s) installed. Use %s to setup your environment for use with the toolkit.",
|
|
6195
6430
|
environment.name,
|
|
6196
6431
|
stackName,
|
|
6197
|
-
|
|
6432
|
+
chalk11.blue(`cdk bootstrap "${environment.name}"`)
|
|
6198
6433
|
)
|
|
6199
6434
|
));
|
|
6200
6435
|
return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
|
|
@@ -6202,11 +6437,11 @@ var ToolkitInfo = class _ToolkitInfo {
|
|
|
6202
6437
|
if (stack.stackStatus.isCreationFailure) {
|
|
6203
6438
|
await ioHost.notify(debug2(
|
|
6204
6439
|
action,
|
|
6205
|
-
(0,
|
|
6440
|
+
(0, import_util15.format)(
|
|
6206
6441
|
"The environment %s has a CDK toolkit stack (%s) that failed to create. Use %s to try provisioning it again.",
|
|
6207
6442
|
environment.name,
|
|
6208
6443
|
stackName,
|
|
6209
|
-
|
|
6444
|
+
chalk11.blue(`cdk bootstrap "${environment.name}"`)
|
|
6210
6445
|
)
|
|
6211
6446
|
));
|
|
6212
6447
|
return _ToolkitInfo.bootstrapStackNotFoundInfo(stackName);
|
|
@@ -6740,7 +6975,6 @@ var Deployments = class {
|
|
|
6740
6975
|
resolvedEnvironment: env.resolvedEnvironment,
|
|
6741
6976
|
deployName: options.deployName,
|
|
6742
6977
|
notificationArns: options.notificationArns,
|
|
6743
|
-
quiet: options.quiet,
|
|
6744
6978
|
sdk: env.sdk,
|
|
6745
6979
|
sdkProvider: this.deployStackSdkProvider,
|
|
6746
6980
|
roleArn: executionRoleArn,
|
|
@@ -6751,8 +6985,6 @@ var Deployments = class {
|
|
|
6751
6985
|
force: options.force,
|
|
6752
6986
|
parameters: options.parameters,
|
|
6753
6987
|
usePreviousParameters: options.usePreviousParameters,
|
|
6754
|
-
progress: options.progress,
|
|
6755
|
-
ci: options.ci,
|
|
6756
6988
|
rollback: options.rollback,
|
|
6757
6989
|
hotswap: options.hotswap,
|
|
6758
6990
|
hotswapPropertyOverrides: options.hotswapPropertyOverrides,
|
|
@@ -6823,9 +7055,14 @@ var Deployments = class {
|
|
|
6823
7055
|
default:
|
|
6824
7056
|
throw new ToolkitError(`Unexpected rollback choice: ${cloudFormationStack.stackStatus.rollbackChoice}`);
|
|
6825
7057
|
}
|
|
6826
|
-
const monitor =
|
|
6827
|
-
|
|
6828
|
-
|
|
7058
|
+
const monitor = new StackActivityMonitor({
|
|
7059
|
+
cfn,
|
|
7060
|
+
stack: options.stack,
|
|
7061
|
+
stackName: deployName,
|
|
7062
|
+
ioHost: this.ioHost,
|
|
7063
|
+
action: this.action
|
|
7064
|
+
});
|
|
7065
|
+
await monitor.start();
|
|
6829
7066
|
let stackErrorMessage = void 0;
|
|
6830
7067
|
let finalStackState = cloudFormationStack;
|
|
6831
7068
|
try {
|
|
@@ -6834,14 +7071,14 @@ var Deployments = class {
|
|
|
6834
7071
|
throw new ToolkitError("Stack deploy failed (the stack disappeared while we were rolling it back)");
|
|
6835
7072
|
}
|
|
6836
7073
|
finalStackState = successStack;
|
|
6837
|
-
const errors = monitor
|
|
7074
|
+
const errors = monitor.errors.join(", ");
|
|
6838
7075
|
if (errors) {
|
|
6839
7076
|
stackErrorMessage = errors;
|
|
6840
7077
|
}
|
|
6841
7078
|
} catch (e) {
|
|
6842
|
-
stackErrorMessage = suffixWithErrors2(formatErrorMessage(e), monitor
|
|
7079
|
+
stackErrorMessage = suffixWithErrors2(formatErrorMessage(e), monitor.errors);
|
|
6843
7080
|
} finally {
|
|
6844
|
-
await monitor
|
|
7081
|
+
await monitor.stop();
|
|
6845
7082
|
}
|
|
6846
7083
|
if (finalStackState.stackStatus.isRollbackSuccess || !stackErrorMessage) {
|
|
6847
7084
|
return { success: true };
|
|
@@ -6950,7 +7187,7 @@ var Deployments = class {
|
|
|
6950
7187
|
if (existing) {
|
|
6951
7188
|
return existing;
|
|
6952
7189
|
}
|
|
6953
|
-
const prefix = stackName ? `${
|
|
7190
|
+
const prefix = stackName ? `${chalk12.bold(stackName)}: ` : "";
|
|
6954
7191
|
const publisher = new cdk_assets.AssetPublishing(assetManifest, {
|
|
6955
7192
|
// The AssetPublishing class takes care of role assuming etc, so it's okay to
|
|
6956
7193
|
// give it a direct `SdkProvider`.
|
|
@@ -6987,9 +7224,9 @@ function tagsForStack(stack) {
|
|
|
6987
7224
|
}
|
|
6988
7225
|
|
|
6989
7226
|
// ../../aws-cdk/lib/api/resource-import/importer.ts
|
|
6990
|
-
var
|
|
7227
|
+
var import_util16 = require("util");
|
|
6991
7228
|
var cfnDiff = __toESM(require("@aws-cdk/cloudformation-diff"));
|
|
6992
|
-
var
|
|
7229
|
+
var chalk13 = __toESM(require("chalk"));
|
|
6993
7230
|
var fs11 = __toESM(require("fs-extra"));
|
|
6994
7231
|
var promptly3 = __toESM(require("promptly"));
|
|
6995
7232
|
var ResourceImporter = class {
|
|
@@ -7025,12 +7262,12 @@ var ResourceImporter = class {
|
|
|
7025
7262
|
const descr = this.describeResource(resource.logicalId);
|
|
7026
7263
|
const idProps = contents[resource.logicalId];
|
|
7027
7264
|
if (idProps) {
|
|
7028
|
-
await this.ioHost.notify(info2(this.action, (0,
|
|
7265
|
+
await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: importing using %s", chalk13.blue(descr), chalk13.blue(fmtdict(idProps)))));
|
|
7029
7266
|
ret.importResources.push(resource);
|
|
7030
7267
|
ret.resourceMap[resource.logicalId] = idProps;
|
|
7031
7268
|
delete contents[resource.logicalId];
|
|
7032
7269
|
} else {
|
|
7033
|
-
await this.ioHost.notify(info2(this.action, (0,
|
|
7270
|
+
await this.ioHost.notify(info2(this.action, (0, import_util16.format)("%s: skipping", chalk13.blue(descr))));
|
|
7034
7271
|
}
|
|
7035
7272
|
}
|
|
7036
7273
|
const unknown = Object.keys(contents);
|
|
@@ -7074,9 +7311,9 @@ var ResourceImporter = class {
|
|
|
7074
7311
|
});
|
|
7075
7312
|
assertIsSuccessfulDeployStackResult(result);
|
|
7076
7313
|
const message = result.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
|
|
7077
|
-
await this.ioHost.notify(info2(this.action, "\n" +
|
|
7314
|
+
await this.ioHost.notify(info2(this.action, "\n" + chalk13.green((0, import_util16.format)(message, this.stack.displayName))));
|
|
7078
7315
|
} catch (e) {
|
|
7079
|
-
await this.ioHost.notify(error2(this.action, (0,
|
|
7316
|
+
await this.ioHost.notify(error2(this.action, (0, import_util16.format)("\n \u274C %s failed: %s", chalk13.bold(this.stack.displayName), e), "CDK_TOOLKIT_E3900"));
|
|
7080
7317
|
throw e;
|
|
7081
7318
|
}
|
|
7082
7319
|
}
|
|
@@ -7178,21 +7415,21 @@ var ResourceImporter = class {
|
|
|
7178
7415
|
const candidateProps = Object.fromEntries(satisfiedPropSet.map((p) => [p, resourceProps[p]]));
|
|
7179
7416
|
const displayCandidateProps = fmtdict(candidateProps);
|
|
7180
7417
|
if (await promptly3.confirm(
|
|
7181
|
-
`${
|
|
7418
|
+
`${chalk13.blue(resourceName)} (${resourceType}): import with ${chalk13.yellow(displayCandidateProps)} (yes/no) [default: yes]? `,
|
|
7182
7419
|
{ default: "yes" }
|
|
7183
7420
|
)) {
|
|
7184
7421
|
return candidateProps;
|
|
7185
7422
|
}
|
|
7186
7423
|
}
|
|
7187
7424
|
if (satisfiedPropSets.length > 0) {
|
|
7188
|
-
await this.ioHost.notify(info2(this.action,
|
|
7425
|
+
await this.ioHost.notify(info2(this.action, chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
7189
7426
|
return void 0;
|
|
7190
7427
|
}
|
|
7191
|
-
const prefix = `${
|
|
7428
|
+
const prefix = `${chalk13.blue(resourceName)} (${resourceType})`;
|
|
7192
7429
|
let preamble;
|
|
7193
7430
|
let promptPattern;
|
|
7194
7431
|
if (idPropSets.length > 1) {
|
|
7195
|
-
preamble = `${prefix}: enter one of ${idPropSets.map((x) =>
|
|
7432
|
+
preamble = `${prefix}: enter one of ${idPropSets.map((x) => chalk13.blue(x.join("+"))).join(", ")} to import (all empty to skip)`;
|
|
7196
7433
|
promptPattern = `${prefix}: enter %`;
|
|
7197
7434
|
} else {
|
|
7198
7435
|
promptPattern = `${prefix}: enter %`;
|
|
@@ -7205,7 +7442,7 @@ var ResourceImporter = class {
|
|
|
7205
7442
|
for (const idProp of idProps) {
|
|
7206
7443
|
const defaultValue = resourceProps[idProp] ?? "";
|
|
7207
7444
|
const prompt4 = [
|
|
7208
|
-
promptPattern.replace(/%/g,
|
|
7445
|
+
promptPattern.replace(/%/g, chalk13.blue(idProp)),
|
|
7209
7446
|
defaultValue ? `[${defaultValue}]` : "(empty to skip)"
|
|
7210
7447
|
].join(" ") + ":";
|
|
7211
7448
|
const response = await promptly3.prompt(
|
|
@@ -7222,7 +7459,7 @@ var ResourceImporter = class {
|
|
|
7222
7459
|
return input;
|
|
7223
7460
|
}
|
|
7224
7461
|
}
|
|
7225
|
-
await this.ioHost.notify(info2(this.action,
|
|
7462
|
+
await this.ioHost.notify(info2(this.action, chalk13.grey(`Skipping import of ${resourceName}`)));
|
|
7226
7463
|
return void 0;
|
|
7227
7464
|
}
|
|
7228
7465
|
/**
|
|
@@ -7272,7 +7509,7 @@ function addDefaultDeletionPolicy(resource) {
|
|
|
7272
7509
|
}
|
|
7273
7510
|
|
|
7274
7511
|
// ../../aws-cdk/lib/api/resource-import/migrator.ts
|
|
7275
|
-
var
|
|
7512
|
+
var chalk14 = __toESM(require("chalk"));
|
|
7276
7513
|
var fs12 = __toESM(require("fs-extra"));
|
|
7277
7514
|
var ResourceMigrator = class {
|
|
7278
7515
|
constructor(props) {
|
|
@@ -7295,11 +7532,11 @@ var ResourceMigrator = class {
|
|
|
7295
7532
|
});
|
|
7296
7533
|
const resourcesToImport = await this.tryGetResources(await migrateDeployment.resolveEnvironment());
|
|
7297
7534
|
if (resourcesToImport) {
|
|
7298
|
-
await this.ioHost.notify(info2(this.action, `${
|
|
7299
|
-
await this.ioHost.notify(info2(this.action, `${
|
|
7535
|
+
await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: creating stack for resource migration...`));
|
|
7536
|
+
await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: importing resources into stack...`));
|
|
7300
7537
|
await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
|
|
7301
7538
|
fs12.rmSync("migrate.json");
|
|
7302
|
-
await this.ioHost.notify(info2(this.action, `${
|
|
7539
|
+
await this.ioHost.notify(info2(this.action, `${chalk14.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`));
|
|
7303
7540
|
}
|
|
7304
7541
|
}
|
|
7305
7542
|
/**
|
|
@@ -7312,7 +7549,6 @@ var ResourceMigrator = class {
|
|
|
7312
7549
|
roleArn: options.roleArn,
|
|
7313
7550
|
deploymentMethod: options.deploymentMethod,
|
|
7314
7551
|
usePreviousParameters: true,
|
|
7315
|
-
progress: options.progress,
|
|
7316
7552
|
rollback: options.rollback
|
|
7317
7553
|
});
|
|
7318
7554
|
elapsedDeployTime = (/* @__PURE__ */ new Date()).getTime() - startDeployTime;
|
|
@@ -7338,8 +7574,8 @@ var ResourceMigrator = class {
|
|
|
7338
7574
|
};
|
|
7339
7575
|
|
|
7340
7576
|
// ../../aws-cdk/lib/api/logs/logs-monitor.ts
|
|
7341
|
-
var
|
|
7342
|
-
var
|
|
7577
|
+
var util7 = __toESM(require("util"));
|
|
7578
|
+
var chalk15 = __toESM(require("chalk"));
|
|
7343
7579
|
var SLEEP = 2e3;
|
|
7344
7580
|
var CloudWatchLogEventMonitor = class {
|
|
7345
7581
|
constructor(startTime) {
|
|
@@ -7430,10 +7666,10 @@ var CloudWatchLogEventMonitor = class {
|
|
|
7430
7666
|
*/
|
|
7431
7667
|
print(event) {
|
|
7432
7668
|
info(
|
|
7433
|
-
|
|
7669
|
+
util7.format(
|
|
7434
7670
|
"[%s] %s %s",
|
|
7435
|
-
|
|
7436
|
-
|
|
7671
|
+
chalk15.blue(event.logGroupName),
|
|
7672
|
+
chalk15.yellow(event.timestamp.toLocaleTimeString()),
|
|
7437
7673
|
event.message.trim()
|
|
7438
7674
|
)
|
|
7439
7675
|
);
|
|
@@ -8026,8 +8262,8 @@ var WorkGraphBuilder = class _WorkGraphBuilder {
|
|
|
8026
8262
|
};
|
|
8027
8263
|
function stacksFromAssets(artifacts) {
|
|
8028
8264
|
const ret = /* @__PURE__ */ new Map();
|
|
8029
|
-
for (const stack of artifacts.filter(cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact)) {
|
|
8030
|
-
const assetArtifacts = stack.dependencies.filter(cxapi3.AssetManifestArtifact.isAssetManifestArtifact);
|
|
8265
|
+
for (const stack of artifacts.filter((x) => cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact(x))) {
|
|
8266
|
+
const assetArtifacts = stack.dependencies.filter((x) => cxapi3.AssetManifestArtifact.isAssetManifestArtifact(x));
|
|
8031
8267
|
for (const art of assetArtifacts) {
|
|
8032
8268
|
ret.set(art, stack);
|
|
8033
8269
|
}
|
|
@@ -8035,7 +8271,7 @@ function stacksFromAssets(artifacts) {
|
|
|
8035
8271
|
return ret;
|
|
8036
8272
|
}
|
|
8037
8273
|
function onlyStacks(artifacts) {
|
|
8038
|
-
return artifacts.filter(cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact);
|
|
8274
|
+
return artifacts.filter((x) => cxapi3.CloudFormationStackArtifact.isCloudFormationStackArtifact(x));
|
|
8039
8275
|
}
|
|
8040
8276
|
|
|
8041
8277
|
// ../../aws-cdk/lib/context-providers/index.ts
|
|
@@ -8103,6 +8339,128 @@ var AZContextProviderPlugin = class {
|
|
|
8103
8339
|
}
|
|
8104
8340
|
};
|
|
8105
8341
|
|
|
8342
|
+
// ../../aws-cdk/lib/util/json.ts
|
|
8343
|
+
function getResultObj(jsonObject, identifier, propertiesToReturn) {
|
|
8344
|
+
const propsObj = {};
|
|
8345
|
+
propertiesToReturn.forEach((propName) => {
|
|
8346
|
+
Object.assign(propsObj, { [propName]: findJsonValue(jsonObject, propName) });
|
|
8347
|
+
});
|
|
8348
|
+
Object.assign(propsObj, { ["Identifier"]: identifier });
|
|
8349
|
+
return propsObj;
|
|
8350
|
+
}
|
|
8351
|
+
function findJsonValue(jsonObject, path12) {
|
|
8352
|
+
const paths = path12.split(".");
|
|
8353
|
+
let obj = jsonObject;
|
|
8354
|
+
paths.forEach((p) => {
|
|
8355
|
+
obj = obj[p];
|
|
8356
|
+
if (obj === void 0) {
|
|
8357
|
+
throw new TypeError(`Cannot read field ${path12}. ${p} is not found.`);
|
|
8358
|
+
}
|
|
8359
|
+
});
|
|
8360
|
+
return obj;
|
|
8361
|
+
}
|
|
8362
|
+
|
|
8363
|
+
// ../../aws-cdk/lib/context-providers/cc-api-provider.ts
|
|
8364
|
+
var CcApiContextProviderPlugin = class {
|
|
8365
|
+
constructor(aws) {
|
|
8366
|
+
this.aws = aws;
|
|
8367
|
+
}
|
|
8368
|
+
/**
|
|
8369
|
+
* This returns a data object with the value from CloudControl API result.
|
|
8370
|
+
* args.typeName - see https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html
|
|
8371
|
+
* args.exactIdentifier - use CC API getResource.
|
|
8372
|
+
* args.propertyMatch - use CCP API listResources to get resources and propertyMatch to search through the list.
|
|
8373
|
+
* args.propertiesToReturn - Properties from CC API to return.
|
|
8374
|
+
*/
|
|
8375
|
+
async getValue(args) {
|
|
8376
|
+
const cloudControl = (await initContextProviderSdk(this.aws, args)).cloudControl();
|
|
8377
|
+
const result = await this.findResources(cloudControl, args);
|
|
8378
|
+
return result;
|
|
8379
|
+
}
|
|
8380
|
+
async findResources(cc, args) {
|
|
8381
|
+
if (args.exactIdentifier && args.propertyMatch) {
|
|
8382
|
+
throw new ContextProviderError(`Specify either exactIdentifier or propertyMatch, but not both. Failed to find resources using CC API for type ${args.typeName}.`);
|
|
8383
|
+
}
|
|
8384
|
+
if (!args.exactIdentifier && !args.propertyMatch) {
|
|
8385
|
+
throw new ContextProviderError(`Neither exactIdentifier nor propertyMatch is specified. Failed to find resources using CC API for type ${args.typeName}.`);
|
|
8386
|
+
}
|
|
8387
|
+
if (args.exactIdentifier) {
|
|
8388
|
+
return this.getResource(cc, args.typeName, args.exactIdentifier, args.propertiesToReturn);
|
|
8389
|
+
} else {
|
|
8390
|
+
return this.listResources(cc, args.typeName, args.propertyMatch, args.propertiesToReturn);
|
|
8391
|
+
}
|
|
8392
|
+
}
|
|
8393
|
+
/**
|
|
8394
|
+
* Calls getResource from CC API to get the resource.
|
|
8395
|
+
* See https://docs.aws.amazon.com/cli/latest/reference/cloudcontrol/get-resource.html
|
|
8396
|
+
*
|
|
8397
|
+
* If the exactIdentifier is not found, then an empty map is returned.
|
|
8398
|
+
* If the resource is found, then a map of the identifier to a map of property values is returned.
|
|
8399
|
+
*/
|
|
8400
|
+
async getResource(cc, typeName, exactIdentifier, propertiesToReturn) {
|
|
8401
|
+
const resultObjs = [];
|
|
8402
|
+
try {
|
|
8403
|
+
const result = await cc.getResource({
|
|
8404
|
+
TypeName: typeName,
|
|
8405
|
+
Identifier: exactIdentifier
|
|
8406
|
+
});
|
|
8407
|
+
const id = result.ResourceDescription?.Identifier ?? "";
|
|
8408
|
+
if (id !== "") {
|
|
8409
|
+
const propsObject = JSON.parse(result.ResourceDescription?.Properties ?? "");
|
|
8410
|
+
const propsObj = getResultObj(propsObject, result.ResourceDescription?.Identifier, propertiesToReturn);
|
|
8411
|
+
resultObjs.push(propsObj);
|
|
8412
|
+
} else {
|
|
8413
|
+
throw new ContextProviderError(`Could not get resource ${exactIdentifier}.`);
|
|
8414
|
+
}
|
|
8415
|
+
} catch (err) {
|
|
8416
|
+
throw new ContextProviderError(`Encountered CC API error while getting resource ${exactIdentifier}. Error: ${err}`);
|
|
8417
|
+
}
|
|
8418
|
+
return resultObjs;
|
|
8419
|
+
}
|
|
8420
|
+
/**
|
|
8421
|
+
* Calls listResources from CC API to get the resources and apply args.propertyMatch to find the resources.
|
|
8422
|
+
* See https://docs.aws.amazon.com/cli/latest/reference/cloudcontrol/list-resources.html
|
|
8423
|
+
*
|
|
8424
|
+
* Since exactIdentifier is not specified, propertyMatch must be specified.
|
|
8425
|
+
* This returns an object where the ids are object keys and values are objects with keys of args.propertiesToReturn.
|
|
8426
|
+
*/
|
|
8427
|
+
async listResources(cc, typeName, propertyMatch, propertiesToReturn) {
|
|
8428
|
+
const resultObjs = [];
|
|
8429
|
+
try {
|
|
8430
|
+
const result = await cc.listResources({
|
|
8431
|
+
TypeName: typeName
|
|
8432
|
+
});
|
|
8433
|
+
result.ResourceDescriptions?.forEach((resource) => {
|
|
8434
|
+
const id = resource.Identifier ?? "";
|
|
8435
|
+
if (id !== "") {
|
|
8436
|
+
const propsObject = JSON.parse(resource.Properties ?? "");
|
|
8437
|
+
const filters = Object.entries(propertyMatch);
|
|
8438
|
+
let match = false;
|
|
8439
|
+
if (filters) {
|
|
8440
|
+
let propertyMatchesFilter2 = function(actual, expected) {
|
|
8441
|
+
return expected === actual;
|
|
8442
|
+
};
|
|
8443
|
+
var propertyMatchesFilter = propertyMatchesFilter2;
|
|
8444
|
+
match = filters.every((record, _index, _arr) => {
|
|
8445
|
+
const key = record[0];
|
|
8446
|
+
const expected = record[1];
|
|
8447
|
+
const actual = findJsonValue(propsObject, key);
|
|
8448
|
+
return propertyMatchesFilter2(actual, expected);
|
|
8449
|
+
});
|
|
8450
|
+
}
|
|
8451
|
+
if (match) {
|
|
8452
|
+
const propsObj = getResultObj(propsObject, resource.Identifier, propertiesToReturn);
|
|
8453
|
+
resultObjs.push(propsObj);
|
|
8454
|
+
}
|
|
8455
|
+
}
|
|
8456
|
+
});
|
|
8457
|
+
} catch (err) {
|
|
8458
|
+
throw new ContextProviderError(`Could not get resources ${JSON.stringify(propertyMatch)}. Error: ${err}`);
|
|
8459
|
+
}
|
|
8460
|
+
return resultObjs;
|
|
8461
|
+
}
|
|
8462
|
+
};
|
|
8463
|
+
|
|
8106
8464
|
// ../../aws-cdk/lib/context-providers/endpoint-service-availability-zones.ts
|
|
8107
8465
|
var EndpointServiceAZContextProviderPlugin = class {
|
|
8108
8466
|
constructor(aws) {
|
|
@@ -8820,7 +9178,8 @@ var availableContextProviders = {
|
|
|
8820
9178
|
[cxschema3.ContextProvider.SECURITY_GROUP_PROVIDER]: (s) => new SecurityGroupContextProviderPlugin(s),
|
|
8821
9179
|
[cxschema3.ContextProvider.LOAD_BALANCER_PROVIDER]: (s) => new LoadBalancerContextProviderPlugin(s),
|
|
8822
9180
|
[cxschema3.ContextProvider.LOAD_BALANCER_LISTENER_PROVIDER]: (s) => new LoadBalancerListenerContextProviderPlugin(s),
|
|
8823
|
-
[cxschema3.ContextProvider.KEY_PROVIDER]: (s) => new KeyContextProviderPlugin(s)
|
|
9181
|
+
[cxschema3.ContextProvider.KEY_PROVIDER]: (s) => new KeyContextProviderPlugin(s),
|
|
9182
|
+
[cxschema3.ContextProvider.CC_API_PROVIDER]: (s) => new CcApiContextProviderPlugin(s)
|
|
8824
9183
|
};
|
|
8825
9184
|
|
|
8826
9185
|
// ../../aws-cdk/lib/api/util/rwlock.ts
|
|
@@ -8975,7 +9334,7 @@ function processExists(pid) {
|
|
|
8975
9334
|
|
|
8976
9335
|
// ../../aws-cdk/lib/api/cxapp/cloud-assembly.ts
|
|
8977
9336
|
var import_cx_api8 = require("@aws-cdk/cx-api");
|
|
8978
|
-
var
|
|
9337
|
+
var chalk16 = __toESM(require("chalk"));
|
|
8979
9338
|
var import_minimatch = require("minimatch");
|
|
8980
9339
|
var semver5 = __toESM(require("semver"));
|
|
8981
9340
|
var ExtendedStackSelection = /* @__PURE__ */ ((ExtendedStackSelection2) => {
|
|
@@ -9180,7 +9539,7 @@ function includeDownstreamStacks(selectedStacks, allStacks) {
|
|
|
9180
9539
|
}
|
|
9181
9540
|
} while (madeProgress);
|
|
9182
9541
|
if (added.length > 0) {
|
|
9183
|
-
info("Including depending stacks: %s",
|
|
9542
|
+
info("Including depending stacks: %s", chalk16.bold(added.join(", ")));
|
|
9184
9543
|
}
|
|
9185
9544
|
}
|
|
9186
9545
|
function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
@@ -9199,7 +9558,7 @@ function includeUpstreamStacks(selectedStacks, allStacks) {
|
|
|
9199
9558
|
}
|
|
9200
9559
|
}
|
|
9201
9560
|
if (added.length > 0) {
|
|
9202
|
-
info("Including dependency stacks: %s",
|
|
9561
|
+
info("Including dependency stacks: %s", chalk16.bold(added.join(", ")));
|
|
9203
9562
|
}
|
|
9204
9563
|
}
|
|
9205
9564
|
function sanitizePatterns(patterns) {
|
|
@@ -9304,7 +9663,6 @@ function spaceAvailableForContext(env, limit) {
|
|
|
9304
9663
|
ResourceMigrator,
|
|
9305
9664
|
SdkProvider,
|
|
9306
9665
|
Settings,
|
|
9307
|
-
StackActivityProgress,
|
|
9308
9666
|
StackCollection,
|
|
9309
9667
|
WorkGraphBuilder,
|
|
9310
9668
|
contextproviders,
|