aws-cdk 2.1128.0 → 2.1129.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 +1 -0
- package/THIRD_PARTY_LICENSES +2822 -2593
- package/build-info.json +2 -2
- package/docs/confirmation-prompts.md +79 -0
- package/lib/api-private.d.ts +2 -0
- package/lib/api-private.js +29 -3
- package/lib/cli/cdk-toolkit.d.ts +8 -1
- package/lib/cli/cdk-toolkit.js +164 -125
- package/lib/cli/cli-config.js +40 -4
- package/lib/cli/cli-type-registry.json +16 -1
- package/lib/cli/cli.js +49 -10
- package/lib/cli/convert-to-user-input.js +7 -1
- package/lib/cli/display-version.js +46 -7
- package/lib/cli/io-host/cli-io-host.d.ts +211 -23
- package/lib/cli/io-host/cli-io-host.js +321 -95
- package/lib/cli/parse-command-line-arguments.js +51 -3
- package/lib/cli/platform-warnings.js +36 -3
- package/lib/cli/pretty-print-error.d.ts +4 -1
- package/lib/cli/pretty-print-error.js +15 -7
- package/lib/cli/proxy-agent.js +36 -2
- package/lib/cli/root-dir.js +36 -3
- package/lib/cli/tables.js +35 -2
- package/lib/cli/telemetry/installation-id.js +36 -3
- package/lib/cli/telemetry/library-version.js +36 -3
- package/lib/cli/telemetry/messages.js +35 -2
- package/lib/cli/telemetry/session.js +9 -2
- package/lib/cli/telemetry/sink/endpoint-sink.js +5 -2
- package/lib/cli/telemetry/sink/file-sink.js +37 -2
- package/lib/cli/telemetry/sink/funnel.js +2 -1
- package/lib/cli/telemetry/sink/io-host-sink.js +2 -1
- package/lib/cli/telemetry/telemetry-state.js +36 -3
- package/lib/cli/user-configuration.js +51 -13
- package/lib/cli/user-input.d.ts +19 -1
- package/lib/cli/user-input.js +1 -1
- package/lib/cli/util/fs-util.js +35 -2
- package/lib/cli/version.js +35 -2
- package/lib/commands/context.js +11 -8
- package/lib/commands/docs.js +41 -5
- package/lib/commands/doctor.js +45 -9
- package/lib/commands/flags/flags.js +5 -1
- package/lib/commands/flags/interactive-handler.js +3 -1
- package/lib/commands/flags/operations.js +58 -14
- package/lib/commands/flags/router.js +4 -1
- package/lib/commands/flags/validator.js +2 -1
- package/lib/commands/init/init-hooks.js +35 -2
- package/lib/commands/init/init.js +63 -22
- package/lib/commands/init/os.js +40 -4
- package/lib/commands/migrate.js +44 -6
- package/lib/cxapp/cloud-assembly.js +35 -2
- package/lib/cxapp/cloud-executable.d.ts +7 -0
- package/lib/cxapp/cloud-executable.js +48 -2
- package/lib/cxapp/exec.js +38 -5
- package/lib/index.js +284512 -245081
- package/package.json +9 -9
package/build-info.json
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Confirmation Prompts
|
|
2
|
+
|
|
3
|
+
This document defines how the CLI must behave when a user declines a confirmation
|
|
4
|
+
prompt (answers "no" to a question like "Are you sure you want to delete ...?",
|
|
5
|
+
"Perform import?", or "Do you want to accept these changes?").
|
|
6
|
+
|
|
7
|
+
This is a convention. Apply it to every command that asks for confirmation, so
|
|
8
|
+
that declining behaves the same way everywhere.
|
|
9
|
+
|
|
10
|
+
## The rule
|
|
11
|
+
|
|
12
|
+
**Declining a confirmation exits non-zero and fails soft.**
|
|
13
|
+
|
|
14
|
+
These are two independent decisions:
|
|
15
|
+
|
|
16
|
+
1. **Exit code: non-zero.** The exit code answers a single question: did the
|
|
17
|
+
operation the user asked for happen? When the user declines, it did not, so
|
|
18
|
+
the command exits non-zero, the same as any other "the requested change did
|
|
19
|
+
not occur" outcome.
|
|
20
|
+
2. **Presentation: soft.** A decline is an expected, user-initiated outcome, not
|
|
21
|
+
a defect. It must print a single clear line (no stack trace, no "internal
|
|
22
|
+
error" framing) and must not be counted as a crash or error in telemetry. It
|
|
23
|
+
is tagged as a user abort.
|
|
24
|
+
|
|
25
|
+
In short: the exit code reflects "did the thing happen" (no, so non-zero); soft
|
|
26
|
+
vs hard reflects "is this a bug" (no, so soft).
|
|
27
|
+
|
|
28
|
+
## Why non-zero
|
|
29
|
+
|
|
30
|
+
- **Post-condition.** The user asked to deploy, destroy, import, or apply. It did
|
|
31
|
+
not happen. The exit code should reflect the resulting state, not whose choice
|
|
32
|
+
caused it.
|
|
33
|
+
- **Chaining safety.** Shell chains such as `cdk deploy && ./promote.sh` must not
|
|
34
|
+
continue when the deploy did not happen. This applies in interactive terminals
|
|
35
|
+
too, where developers routinely use `&&`. A non-zero exit short-circuits the
|
|
36
|
+
chain; exit 0 would let the next step run as if the operation succeeded.
|
|
37
|
+
- **Ecosystem convention.** Comparable infrastructure tools do the same. For
|
|
38
|
+
example `terraform apply` answered "no" prints "Apply cancelled" and exits
|
|
39
|
+
non-zero, and `apt` answered "n" prints "Abort." and exits non-zero. Declining
|
|
40
|
+
a prompt is also equivalent to pressing Ctrl-C at the prompt, which is
|
|
41
|
+
non-zero.
|
|
42
|
+
|
|
43
|
+
A confirmation prompt only appears in interactive use. In a non-interactive
|
|
44
|
+
context the CLI cannot ask, so the prompt path is already an error (see below).
|
|
45
|
+
That means the non-zero rule keeps the interactive decline consistent with the
|
|
46
|
+
non-interactive case: in both, the operation did not happen.
|
|
47
|
+
|
|
48
|
+
## How to implement it
|
|
49
|
+
|
|
50
|
+
The `IoHost` does not decide whether to abort. `requestResponse` returns the
|
|
51
|
+
user's answer (including `false` for a declined confirmation) and never throws on
|
|
52
|
+
a decline. Each command owns the decline and reacts to a `false` answer by
|
|
53
|
+
throwing an `AbortError`:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const confirmed = await ioHelper.requestResponse(IO.SOME_CONFIRMATION.req(question));
|
|
57
|
+
if (!confirmed) {
|
|
58
|
+
throw new AbortError('SomethingAborted');
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`AbortError` is a dedicated `ToolkitError` subclass (`AbortError.isAbortError(x)`)
|
|
63
|
+
that marks a user-initiated abort. It still carries a per-action error code (for
|
|
64
|
+
example `DeployAborted`, `RollbackAborted`) so the reason stays clear in output
|
|
65
|
+
and telemetry, while the marker gives the CLI one reliable way to detect a
|
|
66
|
+
decline without matching on messages.
|
|
67
|
+
|
|
68
|
+
The default message is `Operation cancelled`, a safe generic fallback. Prefer a
|
|
69
|
+
specific message in the form `<Operation> cancelled` (sentence case, no trailing
|
|
70
|
+
period), for example `Deployment cancelled` or `Import cancelled`, so the output
|
|
71
|
+
names what was cancelled.
|
|
72
|
+
|
|
73
|
+
The CLI's top-level error handler detects `AbortError` and applies the policy
|
|
74
|
+
above: a non-zero exit, a soft presentation (the message only, no stack trace or
|
|
75
|
+
"error" framing), and a user-abort telemetry tag rather than a crash.
|
|
76
|
+
|
|
77
|
+
Do not let the `IoHost` throw an abort on the command's behalf, do not swallow a
|
|
78
|
+
decline into an exit-0 return, and do not signal a decline with a plain
|
|
79
|
+
`ToolkitError` that the handler cannot distinguish from a real failure.
|
package/lib/api-private.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ export { deployStack } from '../../@aws-cdk/toolkit-lib/lib/api/deployments/depl
|
|
|
2
2
|
export type { DeployStackOptions as DeployStackApiOptions, DestroyStackResult } from '../../@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack';
|
|
3
3
|
export * as cfnApi from '../../@aws-cdk/toolkit-lib/lib/api/deployments/cfn-api';
|
|
4
4
|
export { createIgnoreMatcher } from '../../@aws-cdk/toolkit-lib/lib/util/glob-matcher';
|
|
5
|
+
export { formatExpressStabilizationWarning } from '../../@aws-cdk/toolkit-lib/lib/util/cfn-express';
|
|
5
6
|
export * from '../../@aws-cdk/toolkit-lib/lib/api/io/private';
|
|
6
7
|
export * from '../../@aws-cdk/toolkit-lib/lib/api/tags/private';
|
|
7
8
|
export * from '../../@aws-cdk/toolkit-lib/lib/private/activity-printer';
|
|
8
9
|
export * from '../../@aws-cdk/toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly';
|
|
9
10
|
export * from '../../@aws-cdk/toolkit-lib/lib/toolkit/private/count-assembly-results';
|
|
11
|
+
export { throwIfValidationFailures } from '../../@aws-cdk/toolkit-lib/lib/toolkit/private/validation-report';
|
package/lib/api-private.js
CHANGED
|
@@ -10,20 +10,46 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
13
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
37
|
};
|
|
16
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.createIgnoreMatcher = exports.cfnApi = exports.deployStack = void 0;
|
|
39
|
+
exports.throwIfValidationFailures = exports.formatExpressStabilizationWarning = exports.createIgnoreMatcher = exports.cfnApi = exports.deployStack = void 0;
|
|
18
40
|
/* eslint-disable import/no-relative-packages */
|
|
19
41
|
var deploy_stack_1 = require("../../@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack");
|
|
20
42
|
Object.defineProperty(exports, "deployStack", { enumerable: true, get: function () { return deploy_stack_1.deployStack; } });
|
|
21
|
-
exports.cfnApi = require("../../@aws-cdk/toolkit-lib/lib/api/deployments/cfn-api");
|
|
43
|
+
exports.cfnApi = __importStar(require("../../@aws-cdk/toolkit-lib/lib/api/deployments/cfn-api"));
|
|
22
44
|
var glob_matcher_1 = require("../../@aws-cdk/toolkit-lib/lib/util/glob-matcher");
|
|
23
45
|
Object.defineProperty(exports, "createIgnoreMatcher", { enumerable: true, get: function () { return glob_matcher_1.createIgnoreMatcher; } });
|
|
46
|
+
var cfn_express_1 = require("../../@aws-cdk/toolkit-lib/lib/util/cfn-express");
|
|
47
|
+
Object.defineProperty(exports, "formatExpressStabilizationWarning", { enumerable: true, get: function () { return cfn_express_1.formatExpressStabilizationWarning; } });
|
|
24
48
|
__exportStar(require("../../@aws-cdk/toolkit-lib/lib/api/io/private"), exports);
|
|
25
49
|
__exportStar(require("../../@aws-cdk/toolkit-lib/lib/api/tags/private"), exports);
|
|
26
50
|
__exportStar(require("../../@aws-cdk/toolkit-lib/lib/private/activity-printer"), exports);
|
|
27
51
|
__exportStar(require("../../@aws-cdk/toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly"), exports);
|
|
28
52
|
__exportStar(require("../../@aws-cdk/toolkit-lib/lib/toolkit/private/count-assembly-results"), exports);
|
|
29
|
-
|
|
53
|
+
var validation_report_1 = require("../../@aws-cdk/toolkit-lib/lib/toolkit/private/validation-report");
|
|
54
|
+
Object.defineProperty(exports, "throwIfValidationFailures", { enumerable: true, get: function () { return validation_report_1.throwIfValidationFailures; } });
|
|
55
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLXByaXZhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJhcGktcHJpdmF0ZS50cyJdLCJuYW1lcyI6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tYXRFeHByZXNzU3RhYmlsaXphdGlvbldhcm5pbmcgfSBmcm9tICcuLi8uLi9AYXdzLWNkay90b29sa2l0LWxpYi9saWIvdXRpbC9jZm4tZXhwcmVzcyc7XG5leHBvcnQgKiBmcm9tICcuLi8uLi9AYXdzLWNkay90b29sa2l0LWxpYi9saWIvYXBpL2lvL3ByaXZhdGUnO1xuZXhwb3J0ICogZnJvbSAnLi4vLi4vQGF3cy1jZGsvdG9vbGtpdC1saWIvbGliL2FwaS90YWdzL3ByaXZhdGUnO1xuZXhwb3J0ICogZnJvbSAnLi4vLi4vQGF3cy1jZGsvdG9vbGtpdC1saWIvbGliL3ByaXZhdGUvYWN0aXZpdHktcHJpbnRlcic7XG5leHBvcnQgKiBmcm9tICcuLi8uLi9AYXdzLWNkay90b29sa2l0LWxpYi9saWIvYXBpL2Nsb3VkLWFzc2VtYmx5L3ByaXZhdGUvYm9ycm93ZWQtYXNzZW1ibHknO1xuZXhwb3J0ICogZnJvbSAnLi4vLi4vQGF3cy1jZGsvdG9vbGtpdC1saWIvbGliL3Rvb2xraXQvcHJpdmF0ZS9jb3VudC1hc3NlbWJseS1yZXN1bHRzJztcbmV4cG9ydCB7IHRocm93SWZWYWxpZGF0aW9uRmFpbHVyZXMgfSBmcm9tICcuLi8uLi9AYXdzLWNkay90b29sa2l0LWxpYi9saWIvdG9vbGtpdC9wcml2YXRlL3ZhbGlkYXRpb24tcmVwb3J0JztcbiJdfQ==
|
package/lib/cli/cdk-toolkit.d.ts
CHANGED
|
@@ -166,7 +166,6 @@ export declare class CdkToolkit {
|
|
|
166
166
|
private selectStacksForList;
|
|
167
167
|
private selectStacksForDeploy;
|
|
168
168
|
private selectStacksForDiff;
|
|
169
|
-
private selectStacksForDestroy;
|
|
170
169
|
/**
|
|
171
170
|
* Validate the stacks for errors and warnings according to the CLI's current settings
|
|
172
171
|
*/
|
|
@@ -444,6 +443,10 @@ export interface DeployOptions extends CfnDeployOptions, WatchOptions {
|
|
|
444
443
|
* @default false
|
|
445
444
|
*/
|
|
446
445
|
readonly ignoreNoStacks?: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Whether to use CloudFormation express mode for the current deployment
|
|
448
|
+
*/
|
|
449
|
+
readonly express?: boolean;
|
|
447
450
|
}
|
|
448
451
|
export interface RollbackOptions {
|
|
449
452
|
/**
|
|
@@ -537,6 +540,10 @@ export interface DestroyOptions {
|
|
|
537
540
|
* Maximum number of simultaneous destroys (dependency permitting) to execute.
|
|
538
541
|
*/
|
|
539
542
|
concurrency?: number;
|
|
543
|
+
/**
|
|
544
|
+
* Whether to use CloudFormation express mode to delete the stack(s)
|
|
545
|
+
*/
|
|
546
|
+
express?: boolean;
|
|
540
547
|
}
|
|
541
548
|
/**
|
|
542
549
|
* Options for the garbage collection
|