aws-cdk 2.1138.0 → 2.1140.0
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/README.md +16 -2
- package/THIRD_PARTY_LICENSES +128 -38
- package/build-info.json +2 -2
- package/db.json.gz +0 -0
- package/docs/deploy-architecture.md +3 -3
- package/lib/api/cloud-assembly.d.ts +0 -1
- package/lib/api/cloud-assembly.js +1 -2
- package/lib/cli/cdk-toolkit.d.ts +56 -25
- package/lib/cli/cdk-toolkit.js +186 -149
- package/lib/cli/cli.js +68 -32
- package/lib/cli/io-host/cli-io-host.d.ts +51 -9
- package/lib/cli/io-host/cli-io-host.js +111 -5
- package/lib/cli/pretty-print-error.d.ts +13 -4
- package/lib/cli/pretty-print-error.js +25 -13
- package/lib/cli/telemetry/library-version.js +3 -5
- package/lib/cli/telemetry/session.d.ts +1 -0
- package/lib/cli/telemetry/session.js +25 -13
- package/lib/cli/util/guess-agent.js +46 -20
- package/lib/commands/docs.js +6 -38
- package/lib/commands/init/init.d.ts +1 -1
- package/lib/commands/init/init.js +17 -23
- package/lib/commands/init/os.d.ts +3 -2
- package/lib/commands/init/os.js +18 -110
- package/lib/commands/migrate.js +8 -5
- package/lib/cxapp/cloud-executable.d.ts +2 -2
- package/lib/cxapp/cloud-executable.js +11 -11
- package/lib/cxapp/index.d.ts +0 -1
- package/lib/cxapp/index.js +1 -2
- package/lib/index.js +3077 -2059
- package/lib/index_bg.wasm +0 -0
- package/lib/init-templates/.init-version.json +1 -1
- package/lib/private/tools.d.ts +1 -0
- package/lib/private/tools.js +2 -1
- package/package.json +14 -13
- package/lib/cxapp/cloud-assembly.d.ts +0 -79
- package/lib/cxapp/cloud-assembly.js +0 -142
|
@@ -146,6 +146,24 @@ export type MessageListenerResultOrPromise = void | MessageListenerResult | Prom
|
|
|
146
146
|
* of codes, or on the message level).
|
|
147
147
|
*/
|
|
148
148
|
export type MessageSelector<T> = IoMessageMaker<T> | IoRequestMaker<T, any> | ((msg: IoMessage<any>) => boolean);
|
|
149
|
+
/**
|
|
150
|
+
* Removes a previously registered message listener.
|
|
151
|
+
*
|
|
152
|
+
* Callable directly (`dispose()`), and also a `Disposable`, so it can be bound
|
|
153
|
+
* to the enclosing scope with a `using` declaration — the listener is then
|
|
154
|
+
* removed when the scope exits, even on an early return or a throw:
|
|
155
|
+
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* using _fmt = ioHost.rewrite(IO.CDK_TOOLKIT_I2901, format);
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* `using x = cond ? ioHost.on(...) : undefined` is also valid: disposal is
|
|
161
|
+
* simply skipped for `undefined`, which makes conditional listeners cheap.
|
|
162
|
+
*/
|
|
163
|
+
export interface DisposeListener {
|
|
164
|
+
(): void;
|
|
165
|
+
[Symbol.dispose](): void;
|
|
166
|
+
}
|
|
149
167
|
/**
|
|
150
168
|
* How an IoHost processed a single message or request.
|
|
151
169
|
*
|
|
@@ -301,8 +319,8 @@ export declare class CliIoHost implements IIoHost, ObservableIoHost {
|
|
|
301
319
|
* // Match with a custom predicate instead of a code, e.g. a maker's `.is`:
|
|
302
320
|
* const dispose = ioHost.on(IO.CDK_TOOLKIT_I7010.is, (msg) => ({ respond: true }));
|
|
303
321
|
*/
|
|
304
|
-
on<T>(selector: IoMessageMaker<T> | IoRequestMaker<T, any> | ((msg: IoMessage<any>) => msg is IoMessage<T>), listener: (msg: IoMessage<T>) => MessageListenerResultOrPromise):
|
|
305
|
-
on(predicate: (msg: IoMessage<any>) => boolean, listener: (msg: IoMessage<unknown>) => MessageListenerResultOrPromise):
|
|
322
|
+
on<T>(selector: IoMessageMaker<T> | IoRequestMaker<T, any> | ((msg: IoMessage<any>) => msg is IoMessage<T>), listener: (msg: IoMessage<T>) => MessageListenerResultOrPromise): DisposeListener;
|
|
323
|
+
on(predicate: (msg: IoMessage<any>) => boolean, listener: (msg: IoMessage<unknown>) => MessageListenerResultOrPromise): DisposeListener;
|
|
306
324
|
/**
|
|
307
325
|
* Register an observer that is invoked for every message the host handles —
|
|
308
326
|
* both notifications and requests — with the disposition the host computed
|
|
@@ -317,8 +335,8 @@ export declare class CliIoHost implements IIoHost, ObservableIoHost {
|
|
|
317
335
|
* Like `on`, but the listener is automatically removed after it has been
|
|
318
336
|
* invoked once.
|
|
319
337
|
*/
|
|
320
|
-
once<T>(selector: IoMessageMaker<T> | IoRequestMaker<T, any> | ((msg: IoMessage<any>) => msg is IoMessage<T>), listener: (msg: IoMessage<T>) => MessageListenerResultOrPromise):
|
|
321
|
-
once(predicate: (msg: IoMessage<any>) => boolean, listener: (msg: IoMessage<unknown>) => MessageListenerResultOrPromise):
|
|
338
|
+
once<T>(selector: IoMessageMaker<T> | IoRequestMaker<T, any> | ((msg: IoMessage<any>) => msg is IoMessage<T>), listener: (msg: IoMessage<T>) => MessageListenerResultOrPromise): DisposeListener;
|
|
339
|
+
once(predicate: (msg: IoMessage<any>) => boolean, listener: (msg: IoMessage<unknown>) => MessageListenerResultOrPromise): DisposeListener;
|
|
322
340
|
/**
|
|
323
341
|
* Remove every message listener registered via `on`/`once`/`rewrite`/`respond`.
|
|
324
342
|
*
|
|
@@ -346,11 +364,11 @@ export declare class CliIoHost implements IIoHost, ObservableIoHost {
|
|
|
346
364
|
* // Under --force, auto-confirm the destroy prompt without prompting.
|
|
347
365
|
* const dispose = ioHost.respond(IO.CDK_TOOLKIT_I7010, true);
|
|
348
366
|
*/
|
|
349
|
-
respond<T, U>(code: IoRequestMaker<T, U>, value: U, suppressQuestion?: boolean):
|
|
367
|
+
respond<T, U>(code: IoRequestMaker<T, U>, value: U, suppressQuestion?: boolean): DisposeListener;
|
|
350
368
|
/**
|
|
351
369
|
* Like `respond`, but the answer is given only once and then removed.
|
|
352
370
|
*/
|
|
353
|
-
respondOnce<T, U>(code: IoRequestMaker<T, U>, value: U, suppressQuestion?: boolean):
|
|
371
|
+
respondOnce<T, U>(code: IoRequestMaker<T, U>, value: U, suppressQuestion?: boolean): DisposeListener;
|
|
354
372
|
/**
|
|
355
373
|
* Register a formatter that replaces the printed text of messages with the
|
|
356
374
|
* given code. This lets a caller define _how_ a toolkit message is presented
|
|
@@ -367,14 +385,15 @@ export declare class CliIoHost implements IIoHost, ObservableIoHost {
|
|
|
367
385
|
* const dispose = ioHost.rewrite(IO.CDK_TOOLKIT_I2901, (msg) =>
|
|
368
386
|
* serializeStructure(msg.data.stacks, true));
|
|
369
387
|
*/
|
|
370
|
-
rewrite<T>(code: IoMessageMaker<T> | IoRequestMaker<T, any>, formatter: (msg: IoMessage<T>) => string, level?: IoMessageLevel):
|
|
388
|
+
rewrite<T>(code: IoMessageMaker<T> | IoRequestMaker<T, any>, formatter: (msg: IoMessage<T>) => string, level?: IoMessageLevel): DisposeListener;
|
|
371
389
|
/**
|
|
372
390
|
* Like `rewrite`, but the formatter is automatically removed after it has
|
|
373
391
|
* been applied once.
|
|
374
392
|
*/
|
|
375
|
-
rewriteOnce<T>(code: IoMessageMaker<T> | IoRequestMaker<T, any>, formatter: (msg: IoMessage<T>) => string, level?: IoMessageLevel):
|
|
393
|
+
rewriteOnce<T>(code: IoMessageMaker<T> | IoRequestMaker<T, any>, formatter: (msg: IoMessage<T>) => string, level?: IoMessageLevel): DisposeListener;
|
|
376
394
|
/**
|
|
377
|
-
* Add a listener to the registry and return a
|
|
395
|
+
* Add a listener to the registry and return a remover for it (callable and
|
|
396
|
+
* `using`-compatible, see `DisposeListener`).
|
|
378
397
|
*/
|
|
379
398
|
private addMessageListener;
|
|
380
399
|
/**
|
|
@@ -472,3 +491,26 @@ export declare class CliIoHost implements IIoHost, ObservableIoHost {
|
|
|
472
491
|
* `ioHost.on(matchAny(IO.CDK_TOOLKIT_I5501, IO.CDK_TOOLKIT_I5502), listener)`.
|
|
473
492
|
*/
|
|
474
493
|
export declare function matchAny(...selectors: MessageSelector<any>[]): (msg: IoMessage<unknown>) => boolean;
|
|
494
|
+
/**
|
|
495
|
+
* Method decorator that suppresses the given IoHost messages for the duration
|
|
496
|
+
* of the decorated method.
|
|
497
|
+
*
|
|
498
|
+
* Before the method runs, a single `preventDefault` listener covering all
|
|
499
|
+
* given selectors is registered on the instance's `ioHost`; when the method
|
|
500
|
+
* settles (returns or throws), exactly that listener is removed again. This
|
|
501
|
+
* replaces the manual pattern of registering drop-listeners at the top of a
|
|
502
|
+
* method and cleaning them up in a `finally`, and — unlike a blanket
|
|
503
|
+
* `removeAllListeners()` — it does not disturb listeners registered elsewhere.
|
|
504
|
+
*
|
|
505
|
+
* The decorated method must be async and live on a class whose instances carry
|
|
506
|
+
* the `CliIoHost` on an `ioHost` property (like `CdkToolkit`).
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* class CdkToolkit {
|
|
510
|
+
* \@suppressMessages(IO.CDK_TOOLKIT_I1001, IO.CDK_TOOLKIT_I1000)
|
|
511
|
+
* public async metadata(stackName: string, json: boolean) {
|
|
512
|
+
* // I1001/I1000 are dropped while this runs
|
|
513
|
+
* }
|
|
514
|
+
* }
|
|
515
|
+
*/
|
|
516
|
+
export declare function suppressMessages(...selectors: MessageSelector<any>[]): <A extends any[], R>(_target: object, _propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: A) => Promise<R>>) => void;
|