@aws-cdk/toolkit-lib 0.1.8 → 0.2.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.
Files changed (58) hide show
  1. package/api-extractor.json +36 -0
  2. package/build-info.json +2 -2
  3. package/db.json.gz +0 -0
  4. package/lib/actions/bootstrap/index.d.ts +1 -1
  5. package/lib/actions/bootstrap/index.js +1 -1
  6. package/lib/actions/deploy/index.d.ts +1 -21
  7. package/lib/actions/deploy/index.js +1 -1
  8. package/lib/actions/deploy/private/deploy-options.d.ts +16 -4
  9. package/lib/actions/deploy/private/deploy-options.js +1 -1
  10. package/lib/actions/deploy/private/helpers.d.ts +3 -3
  11. package/lib/actions/deploy/private/helpers.js +5 -5
  12. package/lib/actions/destroy/index.d.ts +0 -6
  13. package/lib/actions/destroy/index.js +1 -1
  14. package/lib/actions/diff/index.d.ts +1 -1
  15. package/lib/actions/diff/index.js +1 -1
  16. package/lib/actions/diff/private/helpers.d.ts +3 -0
  17. package/lib/actions/diff/private/helpers.js +89 -1
  18. package/lib/actions/watch/index.d.ts +0 -14
  19. package/lib/actions/watch/index.js +1 -1
  20. package/lib/api/cloud-assembly/index.d.ts +1 -1
  21. package/lib/api/cloud-assembly/index.js +4 -2
  22. package/lib/api/cloud-assembly/private/context-aware-source.d.ts +1 -1
  23. package/lib/api/cloud-assembly/private/context-aware-source.js +5 -4
  24. package/lib/api/cloud-assembly/private/exec.js +5 -4
  25. package/lib/api/cloud-assembly/private/prepare-source.d.ts +1 -1
  26. package/lib/api/cloud-assembly/private/prepare-source.js +11 -10
  27. package/lib/api/cloud-assembly/private/source-builder.d.ts +0 -6
  28. package/lib/api/cloud-assembly/private/source-builder.js +6 -6
  29. package/lib/api/cloud-assembly/private/stack-assembly.d.ts +2 -2
  30. package/lib/api/cloud-assembly/private/stack-assembly.js +10 -10
  31. package/lib/api/shared-private.d.ts +4 -0
  32. package/lib/api/shared-private.js +11283 -52
  33. package/lib/api/shared-private.js.map +4 -4
  34. package/lib/api/shared-public.d.ts +266 -1386
  35. package/lib/api/shared-public.js +32 -923
  36. package/lib/api/shared-public.js.map +4 -4
  37. package/lib/index_bg.wasm +0 -0
  38. package/lib/private/util.js +35 -14
  39. package/lib/private/util.js.map +4 -4
  40. package/lib/toolkit/index.d.ts +2 -1
  41. package/lib/toolkit/index.js +3 -2
  42. package/lib/toolkit/non-interactive-io-host.d.ts +80 -0
  43. package/lib/toolkit/non-interactive-io-host.js +129 -0
  44. package/lib/toolkit/private/index.d.ts +1 -2
  45. package/lib/toolkit/private/index.js +1 -1
  46. package/lib/toolkit/toolkit.d.ts +39 -24
  47. package/lib/toolkit/toolkit.js +137 -170
  48. package/lib/toolkit/types.d.ts +163 -0
  49. package/lib/toolkit/types.js +3 -0
  50. package/lib/util/promises.d.ts +12 -0
  51. package/lib/util/promises.js +17 -0
  52. package/lib/util/shell-env.d.ts +10 -0
  53. package/lib/util/shell-env.js +19 -0
  54. package/package.json +14 -11
  55. package/tsconfig.dts.json +9 -0
  56. package/lib/api/aws-cdk.d.ts +0 -20
  57. package/lib/api/aws-cdk.js +0 -11041
  58. package/lib/api/aws-cdk.js.map +0 -7
@@ -1,167 +1,7 @@
1
1
  import * as cxapi from '@aws-cdk/cx-api';
2
2
  import { CloudFormationStackArtifact } from '@aws-cdk/cx-api';
3
- import { DescribeChangeSetOutput as DescribeChangeSet, StackEvent } from '@aws-sdk/client-cloudformation';
3
+ import { StackEvent } from '@aws-sdk/client-cloudformation';
4
4
 
5
- /**
6
- * Which stacks should be selected from a cloud assembly
7
- */
8
- export declare enum StackSelectionStrategy {
9
- /**
10
- * Returns all stacks in the app regardless of patterns,
11
- * including stacks inside nested assemblies.
12
- */
13
- ALL_STACKS = "all-stacks",
14
- /**
15
- * Returns all stacks in the main (top level) assembly only.
16
- */
17
- MAIN_ASSEMBLY = "main-assembly",
18
- /**
19
- * If the assembly includes a single stack, returns it.
20
- * Otherwise throws an exception.
21
- */
22
- ONLY_SINGLE = "only-single",
23
- /**
24
- * Return stacks matched by patterns.
25
- * If no stacks are found, execution is halted successfully.
26
- * Most likely you don't want to use this but `StackSelectionStrategy.MUST_MATCH_PATTERN`
27
- */
28
- PATTERN_MATCH = "pattern-match",
29
- /**
30
- * Return stacks matched by patterns.
31
- * Throws an exception if the patterns don't match at least one stack in the assembly.
32
- */
33
- PATTERN_MUST_MATCH = "pattern-must-match",
34
- /**
35
- * Returns if exactly one stack is matched by the pattern(s).
36
- * Throws an exception if no stack, or more than exactly one stack are matched.
37
- */
38
- PATTERN_MUST_MATCH_SINGLE = "pattern-must-match-single"
39
- }
40
- /**
41
- * When selecting stacks, what other stacks to include because of dependencies
42
- */
43
- export declare enum ExpandStackSelection {
44
- /**
45
- * Don't select any extra stacks
46
- */
47
- NONE = "none",
48
- /**
49
- * Include stacks that this stack depends on
50
- */
51
- UPSTREAM = "upstream",
52
- /**
53
- * Include stacks that depend on this stack
54
- */
55
- DOWNSTREAM = "downstream"
56
- }
57
- /**
58
- * A specification of which stacks should be selected
59
- */
60
- export interface StackSelector {
61
- /**
62
- * The behavior if if no selectors are provided.
63
- */
64
- strategy: StackSelectionStrategy;
65
- /**
66
- * A list of patterns to match the stack hierarchical ids
67
- * Only used with `PATTERN_*` selection strategies.
68
- */
69
- patterns?: string[];
70
- /**
71
- * Expand the selection to upstream/downstream stacks.
72
- * @default ExpandStackSelection.None only select the specified/matched stacks
73
- */
74
- expand?: ExpandStackSelection;
75
- /**
76
- * By default, we throw an exception if the assembly contains no stacks.
77
- * Set to `false`, to halt execution for empty assemblies without error.
78
- *
79
- * Note that actions can still throw if a stack selection result is empty,
80
- * but the assembly contains stacks in principle.
81
- *
82
- * @default true
83
- */
84
- failOnEmpty?: boolean;
85
- }
86
- export interface Template {
87
- Parameters?: Record<string, TemplateParameter>;
88
- [section: string]: any;
89
- }
90
- export interface TemplateParameter {
91
- Type: string;
92
- Default?: any;
93
- Description?: string;
94
- [key: string]: any;
95
- }
96
- export interface NestedStackTemplates {
97
- readonly physicalName: string | undefined;
98
- readonly deployedTemplate: Template;
99
- readonly generatedTemplate: Template;
100
- readonly nestedStackTemplates: {
101
- [nestedStackLogicalId: string]: NestedStackTemplates;
102
- };
103
- }
104
- interface IDifference<ValueType> {
105
- readonly oldValue: ValueType | undefined;
106
- readonly newValue: ValueType | undefined;
107
- readonly isDifferent: boolean;
108
- readonly isAddition: boolean;
109
- readonly isRemoval: boolean;
110
- readonly isUpdate: boolean;
111
- }
112
- declare class Difference<ValueType> implements IDifference<ValueType> {
113
- readonly oldValue: ValueType | undefined;
114
- readonly newValue: ValueType | undefined;
115
- /**
116
- * Whether this is an actual different or the values are actually the same
117
- *
118
- * isDifferent => (isUpdate | isRemoved | isUpdate)
119
- */
120
- isDifferent: boolean;
121
- /**
122
- * @param oldValue the old value, cannot be equal (to the sense of +deepEqual+) to +newValue+.
123
- * @param newValue the new value, cannot be equal (to the sense of +deepEqual+) to +oldValue+.
124
- */
125
- constructor(oldValue: ValueType | undefined, newValue: ValueType | undefined);
126
- /** @returns +true+ if the element is new to the template. */
127
- get isAddition(): boolean;
128
- /** @returns +true+ if the element was removed from the template. */
129
- get isRemoval(): boolean;
130
- /** @returns +true+ if the element was already in the template and is updated. */
131
- get isUpdate(): boolean;
132
- }
133
- declare class PropertyDifference<ValueType> extends Difference<ValueType> {
134
- changeImpact?: ResourceImpact;
135
- constructor(oldValue: ValueType | undefined, newValue: ValueType | undefined, args: {
136
- changeImpact?: ResourceImpact;
137
- });
138
- }
139
- declare enum ResourceImpact {
140
- /** The existing physical resource will be updated */
141
- WILL_UPDATE = "WILL_UPDATE",
142
- /** A new physical resource will be created */
143
- WILL_CREATE = "WILL_CREATE",
144
- /** The existing physical resource will be replaced */
145
- WILL_REPLACE = "WILL_REPLACE",
146
- /** The existing physical resource may be replaced */
147
- MAY_REPLACE = "MAY_REPLACE",
148
- /** The existing physical resource will be destroyed */
149
- WILL_DESTROY = "WILL_DESTROY",
150
- /** The existing physical resource will be removed from CloudFormation supervision */
151
- WILL_ORPHAN = "WILL_ORPHAN",
152
- /** The existing physical resource will be added to CloudFormation supervision */
153
- WILL_IMPORT = "WILL_IMPORT",
154
- /** There is no change in this resource */
155
- NO_CHANGE = "NO_CHANGE"
156
- }
157
- interface Resource {
158
- Type: string;
159
- Properties?: {
160
- [name: string]: any;
161
- };
162
- [key: string]: any;
163
- }
164
- type DescribeChangeSetOutput = DescribeChangeSet;
165
5
  interface BootstrapRole {
166
6
  /**
167
7
  * The ARN of the IAM role created as part of bootrapping
@@ -544,32 +384,6 @@ type LogicalIdMetadataEntry = string;
544
384
  type StackTagsMetadataEntry = Tag[];
545
385
  type PrimitiveType = boolean | number | string;
546
386
  type MetadataEntryData = AssetMetadataEntry | LogMessageMetadataEntry | LogicalIdMetadataEntry | StackTagsMetadataEntry | PrimitiveType;
547
- declare enum ArtifactMetadataEntryType {
548
- /**
549
- * Asset in metadata.
550
- */
551
- ASSET = "aws:cdk:asset",
552
- /**
553
- * Metadata key used to print INFO-level messages by the toolkit when an app is syntheized.
554
- */
555
- INFO = "aws:cdk:info",
556
- /**
557
- * Metadata key used to print WARNING-level messages by the toolkit when an app is syntheized.
558
- */
559
- WARN = "aws:cdk:warning",
560
- /**
561
- * Metadata key used to print ERROR-level messages by the toolkit when an app is syntheized.
562
- */
563
- ERROR = "aws:cdk:error",
564
- /**
565
- * Represents the CloudFormation logical ID of a resource at a certain path.
566
- */
567
- LOGICAL_ID = "aws:cdk:logicalId",
568
- /**
569
- * Represents tags of a stack.
570
- */
571
- STACK_TAGS = "aws:cdk:stack-tags"
572
- }
573
387
  interface MetadataEntry {
574
388
  /**
575
389
  * The type of the metadata entry.
@@ -1044,7 +858,12 @@ interface ArtifactManifest {
1044
858
  */
1045
859
  readonly properties?: ArtifactProperties;
1046
860
  /**
1047
- * A string that represents this artifact. Should only be used in user interfaces.
861
+ * A string that can be shown to a user to uniquely identify this artifact inside a cloud assembly tree
862
+ *
863
+ * Is used by the CLI to present a list of stacks to the user in a way that
864
+ * makes sense to them. Even though the property name "display name" doesn't
865
+ * imply it, this field is used to select stacks as well, so all stacks should
866
+ * have a unique display name.
1048
867
  *
1049
868
  * @default - no display name
1050
869
  */
@@ -1097,870 +916,198 @@ interface ICloudAssembly {
1097
916
  */
1098
917
  readonly directory: string;
1099
918
  }
1100
- interface AwsDestination {
919
+ interface LoadManifestOptions {
1101
920
  /**
1102
- * The region where this asset will need to be published
921
+ * Skip the version check
1103
922
  *
1104
- * @default - Current region
1105
- */
1106
- readonly region?: string;
1107
- /**
1108
- * The role that needs to be assumed while publishing this asset
923
+ * This means you may read a newer cloud assembly than the CX API is designed
924
+ * to support, and your application may not be aware of all features that in use
925
+ * in the Cloud Assembly.
1109
926
  *
1110
- * @default - No role will be assumed
927
+ * @default false
1111
928
  */
1112
- readonly assumeRoleArn?: string;
929
+ readonly skipVersionCheck?: boolean;
1113
930
  /**
1114
- * The ExternalId that needs to be supplied while assuming this role
931
+ * Skip enum checks
1115
932
  *
1116
- * @default - No ExternalId will be supplied
933
+ * This means you may read enum values you don't know about yet. Make sure to always
934
+ * check the values of enums you encounter in the manifest.
935
+ *
936
+ * @default false
1117
937
  */
1118
- readonly assumeRoleExternalId?: string;
938
+ readonly skipEnumCheck?: boolean;
1119
939
  /**
1120
- * Additional options to pass to STS when assuming the role.
940
+ * Topologically sort all artifacts
1121
941
  *
1122
- * - `RoleArn` should not be used. Use the dedicated `assumeRoleArn` property instead.
1123
- * - `ExternalId` should not be used. Use the dedicated `assumeRoleExternalId` instead.
942
+ * This parameter is only respected by the constructor of `CloudAssembly`. The
943
+ * property lives here for backwards compatibility reasons.
1124
944
  *
1125
- * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property
1126
- * @default - No additional options.
945
+ * @default true
1127
946
  */
1128
- readonly assumeRoleAdditionalOptions?: {
1129
- [key: string]: any;
1130
- };
947
+ readonly topoSort?: boolean;
1131
948
  }
1132
- interface DockerImageAsset {
949
+ /**
950
+ * Represents a general toolkit error in the AWS CDK Toolkit.
951
+ */
952
+ export declare class ToolkitError extends Error {
1133
953
  /**
1134
- * A display name for this asset
1135
- *
1136
- * @default - The identifier will be used as the display name
954
+ * Determines if a given error is an instance of ToolkitError.
1137
955
  */
1138
- readonly displayName?: string;
956
+ static isToolkitError(x: any): x is ToolkitError;
1139
957
  /**
1140
- * Source description for container assets
958
+ * Determines if a given error is an instance of AuthenticationError.
1141
959
  */
1142
- readonly source: DockerImageSource;
960
+ static isAuthenticationError(x: any): x is AuthenticationError;
1143
961
  /**
1144
- * Destinations for this container asset
962
+ * Determines if a given error is an instance of AssemblyError.
1145
963
  */
1146
- readonly destinations: {
1147
- [id: string]: DockerImageDestination;
1148
- };
1149
- }
1150
- interface DockerImageSource {
964
+ static isAssemblyError(x: any): x is AssemblyError;
1151
965
  /**
1152
- * The directory containing the Docker image build instructions.
1153
- *
1154
- * This path is relative to the asset manifest location.
1155
- *
1156
- * @default - Exactly one of `directory` and `executable` is required
966
+ * Determines if a given error is an instance of AssemblyError.
1157
967
  */
1158
- readonly directory?: string;
968
+ static isContextProviderError(x: any): x is ContextProviderError;
1159
969
  /**
1160
- * A command-line executable that returns the name of a local
1161
- * Docker image on stdout after being run.
1162
- *
1163
- * @default - Exactly one of `directory` and `executable` is required
970
+ * An AssemblyError with an original error as cause
1164
971
  */
1165
- readonly executable?: string[];
972
+ static withCause(message: string, error: unknown): ToolkitError;
1166
973
  /**
1167
- * The name of the file with build instructions
1168
- *
1169
- * Only allowed when `directory` is set.
1170
- *
1171
- * @default "Dockerfile"
974
+ * The type of the error, defaults to "toolkit".
1172
975
  */
1173
- readonly dockerFile?: string;
976
+ readonly type: string;
1174
977
  /**
1175
- * Target build stage in a Dockerfile with multiple build stages
1176
- *
1177
- * Only allowed when `directory` is set.
1178
- *
1179
- * @default - The last stage in the Dockerfile
978
+ * Denotes the source of the error as the toolkit.
1180
979
  */
1181
- readonly dockerBuildTarget?: string;
980
+ readonly source: "toolkit" | "user";
1182
981
  /**
1183
- * Additional build arguments
1184
- *
1185
- * Only allowed when `directory` is set.
1186
- *
1187
- * @default - No additional build arguments
982
+ * The specific original cause of the error, if available
1188
983
  */
1189
- readonly dockerBuildArgs?: {
1190
- [name: string]: string;
1191
- };
984
+ readonly cause?: unknown;
985
+ constructor(message: string, type?: string, cause?: unknown);
986
+ }
987
+ /**
988
+ * Represents an authentication-specific error in the AWS CDK Toolkit.
989
+ */
990
+ export declare class AuthenticationError extends ToolkitError {
1192
991
  /**
1193
- * SSH agent socket or keys
1194
- *
1195
- * Requires building with docker buildkit.
1196
- *
1197
- * @default - No ssh flag is set
992
+ * Denotes the source of the error as user.
1198
993
  */
1199
- readonly dockerBuildSsh?: string;
994
+ readonly source = "user";
995
+ constructor(message: string);
996
+ }
997
+ /**
998
+ * Represents an error causes by cloud assembly synthesis
999
+ *
1000
+ * This includes errors thrown during app execution, as well as failing annotations.
1001
+ */
1002
+ export declare class AssemblyError extends ToolkitError {
1200
1003
  /**
1201
- * Additional build secrets
1202
- *
1203
- * Only allowed when `directory` is set.
1204
- *
1205
- * @default - No additional build secrets
1004
+ * An AssemblyError with an original error as cause
1206
1005
  */
1207
- readonly dockerBuildSecrets?: {
1208
- [name: string]: string;
1209
- };
1006
+ static withCause(message: string, error: unknown): AssemblyError;
1210
1007
  /**
1211
- * Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.
1212
- *
1213
- * Specify this property to build images on a specific networking mode.
1214
- *
1215
- * @default - no networking mode specified
1008
+ * An AssemblyError with a list of stacks as cause
1216
1009
  */
1217
- readonly networkMode?: string;
1218
- /**
1219
- * Platform to build for. _Requires Docker Buildx_.
1220
- *
1221
- * Specify this property to build images on a specific platform/architecture.
1222
- *
1223
- * @default - current machine platform
1224
- */
1225
- readonly platform?: string;
1226
- /**
1227
- * Outputs
1228
- *
1229
- * @default - no outputs are passed to the build command (default outputs are used)
1230
- * @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
1231
- */
1232
- readonly dockerOutputs?: string[];
1233
- /**
1234
- * Cache from options to pass to the `docker build` command.
1235
- *
1236
- * @default - no cache from options are passed to the build command
1237
- * @see https://docs.docker.com/build/cache/backends/
1238
- */
1239
- readonly cacheFrom?: DockerCacheOption[];
1240
- /**
1241
- * Cache to options to pass to the `docker build` command.
1242
- *
1243
- * @default - no cache to options are passed to the build command
1244
- * @see https://docs.docker.com/build/cache/backends/
1245
- */
1246
- readonly cacheTo?: DockerCacheOption;
1247
- /**
1248
- * Disable the cache and pass `--no-cache` to the `docker build` command.
1249
- *
1250
- * @default - cache is used
1251
- */
1252
- readonly cacheDisabled?: boolean;
1253
- }
1254
- interface DockerImageDestination extends AwsDestination {
1255
- /**
1256
- * Name of the ECR repository to publish to
1257
- */
1258
- readonly repositoryName: string;
1259
- /**
1260
- * Tag of the image to publish
1261
- */
1262
- readonly imageTag: string;
1263
- }
1264
- interface DockerCacheOption {
1265
- /**
1266
- * The type of cache to use.
1267
- * Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.
1268
- * @default - unspecified
1269
- *
1270
- * @example 'registry'
1271
- */
1272
- readonly type: string;
1273
- /**
1274
- * Any parameters to pass into the docker cache backend configuration.
1275
- * Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.
1276
- * @default {} No options provided
1277
- *
1278
- * @example
1279
- * declare const branch: string;
1280
- *
1281
- * const params = {
1282
- * ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
1283
- * mode: "max",
1284
- * };
1285
- */
1286
- readonly params?: {
1287
- [key: string]: string;
1288
- };
1289
- }
1290
- interface FileAsset {
1291
- /**
1292
- * A display name for this asset
1293
- *
1294
- * @default - The identifier will be used as the display name
1295
- */
1296
- readonly displayName?: string;
1297
- /**
1298
- * Source description for file assets
1299
- */
1300
- readonly source: FileSource;
1301
- /**
1302
- * Destinations for this file asset
1303
- */
1304
- readonly destinations: {
1305
- [id: string]: FileDestination;
1306
- };
1307
- }
1308
- declare enum FileAssetPackaging {
1309
- /**
1310
- * Upload the given path as a file
1311
- */
1312
- FILE = "file",
1313
- /**
1314
- * The given path is a directory, zip it and upload
1315
- */
1316
- ZIP_DIRECTORY = "zip"
1317
- }
1318
- interface FileSource {
1319
- /**
1320
- * External command which will produce the file asset to upload.
1321
- *
1322
- * @default - Exactly one of `executable` and `path` is required.
1323
- */
1324
- readonly executable?: string[];
1325
- /**
1326
- * The filesystem object to upload
1327
- *
1328
- * This path is relative to the asset manifest location.
1329
- *
1330
- * @default - Exactly one of `executable` and `path` is required.
1331
- */
1332
- readonly path?: string;
1333
- /**
1334
- * Packaging method
1335
- *
1336
- * Only allowed when `path` is specified.
1337
- *
1338
- * @default FILE
1339
- */
1340
- readonly packaging?: FileAssetPackaging;
1341
- }
1342
- interface FileDestination extends AwsDestination {
1343
- /**
1344
- * The name of the bucket
1345
- */
1346
- readonly bucketName: string;
1347
- /**
1348
- * The destination object key
1349
- */
1350
- readonly objectKey: string;
1351
- }
1352
- interface AssetManifest {
1353
- /**
1354
- * Version of the manifest
1355
- */
1356
- readonly version: string;
1357
- /**
1358
- * The file assets in this manifest
1359
- *
1360
- * @default - No files
1361
- */
1362
- readonly files?: {
1363
- [id: string]: FileAsset;
1364
- };
1365
- /**
1366
- * The Docker image assets in this manifest
1367
- *
1368
- * @default - No Docker images
1369
- */
1370
- readonly dockerImages?: {
1371
- [id: string]: DockerImageAsset;
1372
- };
1373
- }
1374
- declare enum RequireApproval {
1375
- /**
1376
- * Never ask for approval
1377
- */
1378
- NEVER = "never",
1379
- /**
1380
- * Prompt for approval for any type of change to the stack
1381
- */
1382
- ANYCHANGE = "any-change",
1383
- /**
1384
- * Only prompt for approval if there are security related changes
1385
- */
1386
- BROADENING = "broadening"
1387
- }
1388
- interface DefaultCdkOptions {
1389
- /**
1390
- * List of stacks to deploy
1391
- *
1392
- * Requried if `all` is not set
1393
- *
1394
- * @default - []
1395
- */
1396
- readonly stacks?: string[];
1397
- /**
1398
- * Deploy all stacks
1399
- *
1400
- * Requried if `stacks` is not set
1401
- *
1402
- * @default - false
1403
- */
1404
- readonly all?: boolean;
1405
- /**
1406
- * command-line for executing your app or a cloud assembly directory
1407
- * e.g. "node bin/my-app.js"
1408
- * or
1409
- * "cdk.out"
1410
- *
1411
- * @default - read from cdk.json
1412
- */
1413
- readonly app?: string;
1414
- /**
1415
- * Role to pass to CloudFormation for deployment
1416
- *
1417
- * @default - use the bootstrap cfn-exec role
1418
- */
1419
- readonly roleArn?: string;
1420
- /**
1421
- * Additional context
1422
- *
1423
- * @default - no additional context
1424
- */
1425
- readonly context?: {
1426
- [name: string]: string;
1427
- };
1428
- /**
1429
- * Print trace for stack warnings
1430
- *
1431
- * @default false
1432
- */
1433
- readonly trace?: boolean;
1434
- /**
1435
- * Do not construct stacks with warnings
1436
- *
1437
- * @default false
1438
- */
1439
- readonly strict?: boolean;
1440
- /**
1441
- * Perform context lookups.
1442
- *
1443
- * Synthesis fails if this is disabled and context lookups need
1444
- * to be performed
1445
- *
1446
- * @default true
1447
- */
1448
- readonly lookups?: boolean;
1449
- /**
1450
- * Ignores synthesis errors, which will likely produce an invalid output
1451
- *
1452
- * @default false
1453
- */
1454
- readonly ignoreErrors?: boolean;
1455
- /**
1456
- * Use JSON output instead of YAML when templates are printed
1457
- * to STDOUT
1458
- *
1459
- * @default false
1460
- */
1461
- readonly json?: boolean;
1462
- /**
1463
- * show debug logs
1464
- *
1465
- * @default false
1466
- */
1467
- readonly verbose?: boolean;
1468
- /**
1469
- * enable emission of additional debugging information, such as creation stack
1470
- * traces of tokens
1471
- *
1472
- * @default false
1473
- */
1474
- readonly debug?: boolean;
1475
- /**
1476
- * Use the indicated AWS profile as the default environment
1477
- *
1478
- * @default - no profile is used
1479
- */
1480
- readonly profile?: string;
1481
- /**
1482
- * Use the indicated proxy. Will read from
1483
- * HTTPS_PROXY environment if specified
1484
- *
1485
- * @default - no proxy
1486
- */
1487
- readonly proxy?: string;
1488
- /**
1489
- * Path to CA certificate to use when validating HTTPS
1490
- * requests.
1491
- *
1492
- * @default - read from AWS_CA_BUNDLE environment variable
1493
- */
1494
- readonly caBundlePath?: string;
1495
- /**
1496
- * Force trying to fetch EC2 instance credentials
1497
- *
1498
- * @default - guess EC2 instance status
1499
- */
1500
- readonly ec2Creds?: boolean;
1501
- /**
1502
- * Include "AWS::CDK::Metadata" resource in synthesized templates
1503
- *
1504
- * @default true
1505
- */
1506
- readonly versionReporting?: boolean;
1507
- /**
1508
- * Include "aws:cdk:path" CloudFormation metadata for each resource
1509
- *
1510
- * @default true
1511
- */
1512
- readonly pathMetadata?: boolean;
1513
- /**
1514
- * Include "aws:asset:*" CloudFormation metadata for resources that use assets
1515
- *
1516
- * @default true
1517
- */
1518
- readonly assetMetadata?: boolean;
1519
- /**
1520
- * Copy assets to the output directory
1521
- *
1522
- * Needed for local debugging the source files with SAM CLI
1523
- *
1524
- * @default false
1525
- */
1526
- readonly staging?: boolean;
1527
- /**
1528
- * Emits the synthesized cloud assembly into a directory
1529
- *
1530
- * @default cdk.out
1531
- */
1532
- readonly output?: string;
1533
- /**
1534
- * Show relevant notices
1535
- *
1536
- * @default true
1537
- */
1538
- readonly notices?: boolean;
1539
- /**
1540
- * Show colors and other style from console output
1541
- *
1542
- * @default true
1543
- */
1544
- readonly color?: boolean;
1545
- }
1546
- interface DeployOptions extends DefaultCdkOptions {
1547
- /**
1548
- * Only perform action on the given stack
1549
- *
1550
- * @default false
1551
- */
1552
- readonly exclusively?: boolean;
1553
- /**
1554
- * Name of the toolkit stack to use/deploy
1555
- *
1556
- * @default CDKToolkit
1557
- */
1558
- readonly toolkitStackName?: string;
1559
- /**
1560
- * Reuse the assets with the given asset IDs
1561
- *
1562
- * @default - do not reuse assets
1563
- */
1564
- readonly reuseAssets?: string[];
1565
- /**
1566
- * Optional name to use for the CloudFormation change set.
1567
- * If not provided, a name will be generated automatically.
1568
- *
1569
- * @default - auto generate a name
1570
- */
1571
- readonly changeSetName?: string;
1572
- /**
1573
- * Always deploy, even if templates are identical.
1574
- * @default false
1575
- */
1576
- readonly force?: boolean;
1577
- /**
1578
- * Rollback failed deployments
1579
- *
1580
- * @default true
1581
- */
1582
- readonly rollback?: boolean;
1583
- /**
1584
- * ARNs of SNS topics that CloudFormation will notify with stack related events
1585
- *
1586
- * @default - no notifications
1587
- */
1588
- readonly notificationArns?: string[];
1589
- /**
1590
- * What kind of security changes require approval
1591
- *
1592
- * @default RequireApproval.NEVER
1593
- */
1594
- readonly requireApproval?: RequireApproval;
1595
- /**
1596
- * Whether to execute the ChangeSet
1597
- * Not providing `execute` parameter will result in execution of ChangeSet
1598
- * @default true
1599
- */
1600
- readonly execute?: boolean;
1601
- /**
1602
- * Additional parameters for CloudFormation at deploy time
1603
- * @default {}
1604
- */
1605
- readonly parameters?: {
1606
- [name: string]: string;
1607
- };
1608
- /**
1609
- * Use previous values for unspecified parameters
1610
- *
1611
- * If not set, all parameters must be specified for every deployment.
1612
- *
1613
- * @default true
1614
- */
1615
- readonly usePreviousParameters?: boolean;
1616
- /**
1617
- * Path to file where stack outputs will be written after a successful deploy as JSON
1618
- * @default - Outputs are not written to any file
1619
- */
1620
- readonly outputsFile?: string;
1621
- /**
1622
- * Whether we are on a CI system
1623
- *
1624
- * @default false
1625
- */
1626
- readonly ci?: boolean;
1627
- /**
1628
- * Deploy multiple stacks in parallel
1629
- *
1630
- * @default 1
1631
- */
1632
- readonly concurrency?: number;
1633
- }
1634
- interface DestroyOptions extends DefaultCdkOptions {
1635
- /**
1636
- * Do not ask for permission before destroying stacks
1637
- *
1638
- * @default false
1639
- */
1640
- readonly force?: boolean;
1641
- /**
1642
- * Only destroy the given stack
1643
- *
1644
- * @default false
1645
- */
1646
- readonly exclusively?: boolean;
1647
- }
1648
- interface TestOptions {
1649
- /**
1650
- * Run update workflow on this test case
1651
- * This should only be set to false to test scenarios
1652
- * that are not possible to test as part of the update workflow
1653
- *
1654
- * @default true
1655
- */
1656
- readonly stackUpdateWorkflow?: boolean;
1657
- /**
1658
- * Additional options to use for each CDK command
1659
- *
1660
- * @default - runner default options
1661
- */
1662
- readonly cdkCommandOptions?: CdkCommands;
1663
- /**
1664
- * Additional commands to run at predefined points in the test workflow
1665
- *
1666
- * e.g. { postDeploy: ['yarn', 'test'] }
1667
- *
1668
- * @default - no hooks
1669
- */
1670
- readonly hooks?: Hooks;
1671
- /**
1672
- * Whether or not to include asset hashes in the diff
1673
- * Asset hashes can introduces a lot of unneccessary noise into tests,
1674
- * but there are some cases where asset hashes _should_ be included. For example
1675
- * any tests involving custom resources or bundling
1676
- *
1677
- * @default false
1678
- */
1679
- readonly diffAssets?: boolean;
1680
- /**
1681
- * List of CloudFormation resource types in this stack that can
1682
- * be destroyed as part of an update without failing the test.
1683
- *
1684
- * This list should only include resources that for this specific
1685
- * integration test we are sure will not cause errors or an outage if
1686
- * destroyed. For example, maybe we know that a new resource will be created
1687
- * first before the old resource is destroyed which prevents any outage.
1688
- *
1689
- * e.g. ['AWS::IAM::Role']
1690
- *
1691
- * @default - do not allow destruction of any resources on update
1692
- */
1693
- readonly allowDestroy?: string[];
1694
- /**
1695
- * Limit deployment to these regions
1696
- *
1697
- * @default - can run in any region
1698
- */
1699
- readonly regions?: string[];
1700
- }
1701
- interface TestCase extends TestOptions {
1702
- /**
1703
- * Stacks that should be tested as part of this test case
1704
- * The stackNames will be passed as args to the cdk commands
1705
- * so dependent stacks will be automatically deployed unless
1706
- * `exclusively` is passed
1707
- */
1708
- readonly stacks: string[];
1709
- /**
1710
- * The node id of the stack that contains assertions.
1711
- * This is the value that can be used to deploy the stack with the CDK CLI
1712
- *
1713
- * @default - no assertion stack
1714
- */
1715
- readonly assertionStack?: string;
1716
- /**
1717
- * The name of the stack that contains assertions
1718
- *
1719
- * @default - no assertion stack
1720
- */
1721
- readonly assertionStackName?: string;
1722
- }
1723
- interface Hooks {
1724
- /**
1725
- * Commands to run prior to deploying the cdk stacks
1726
- * in the integration test
1727
- *
1728
- * @default - no commands
1729
- */
1730
- readonly preDeploy?: string[];
1731
- /**
1732
- * Commands to run prior after deploying the cdk stacks
1733
- * in the integration test
1734
- *
1735
- * @default - no commands
1736
- */
1737
- readonly postDeploy?: string[];
1738
- /**
1739
- * Commands to run prior to destroying the cdk stacks
1740
- * in the integration test
1741
- *
1742
- * @default - no commands
1743
- */
1744
- readonly preDestroy?: string[];
1745
- /**
1746
- * Commands to run after destroying the cdk stacks
1747
- * in the integration test
1748
- *
1749
- * @default - no commands
1750
- */
1751
- readonly postDestroy?: string[];
1752
- }
1753
- interface CdkCommand {
1754
- /**
1755
- * Whether or not to run this command as part of the workflow
1756
- * This can be used if you only want to test some of the workflow
1757
- * for example enable `synth` and disable `deploy` & `destroy` in order
1758
- * to limit the test to synthesis
1759
- *
1760
- * @default true
1761
- */
1762
- readonly enabled?: boolean;
1763
- /**
1764
- * If the runner should expect this command to fail
1765
- *
1766
- * @default false
1767
- */
1768
- readonly expectError?: boolean;
1769
- /**
1770
- * This can be used in combination with `expectedError`
1771
- * to validate that a specific message is returned.
1772
- *
1773
- * @default - do not validate message
1774
- */
1775
- readonly expectedMessage?: string;
1776
- }
1777
- interface DeployCommand extends CdkCommand {
1778
- /**
1779
- * Additional arguments to pass to the command
1780
- * This can be used to test specific CLI functionality
1781
- *
1782
- * @default - only default args are used
1783
- */
1784
- readonly args?: DeployOptions;
1785
- }
1786
- interface DestroyCommand extends CdkCommand {
1787
- /**
1788
- * Additional arguments to pass to the command
1789
- * This can be used to test specific CLI functionality
1790
- *
1791
- * @default - only default args are used
1792
- */
1793
- readonly args?: DestroyOptions;
1794
- }
1795
- interface CdkCommands {
1796
- /**
1797
- * Options to for the cdk deploy command
1798
- *
1799
- * @default - default deploy options
1800
- */
1801
- readonly deploy?: DeployCommand;
1802
- /**
1803
- * Options to for the cdk destroy command
1804
- *
1805
- * @default - default destroy options
1806
- */
1807
- readonly destroy?: DestroyCommand;
1808
- }
1809
- interface IntegManifest {
1810
- /**
1811
- * Version of the manifest
1812
- */
1813
- readonly version: string;
1814
- /**
1815
- * Enable lookups for this test. If lookups are enabled
1816
- * then `stackUpdateWorkflow` must be set to false.
1817
- * Lookups should only be enabled when you are explicitely testing
1818
- * lookups.
1819
- *
1820
- * @default false
1821
- */
1822
- readonly enableLookups?: boolean;
1823
- /**
1824
- * Additional context to use when performing
1825
- * a synth. Any context provided here will override
1826
- * any default context
1827
- *
1828
- * @default - no additional context
1829
- */
1830
- readonly synthContext?: {
1831
- [name: string]: string;
1832
- };
1833
- /**
1834
- * test cases
1835
- */
1836
- readonly testCases: {
1837
- [testName: string]: TestCase;
1838
- };
1839
- }
1840
- declare const VERSION_MISMATCH: string;
1841
- interface LoadManifestOptions {
1010
+ static withStacks(message: string, stacks?: cxapi.CloudFormationStackArtifact[]): AssemblyError;
1842
1011
  /**
1843
- * Skip the version check
1844
- *
1845
- * This means you may read a newer cloud assembly than the CX API is designed
1846
- * to support, and your application may not be aware of all features that in use
1847
- * in the Cloud Assembly.
1848
- *
1849
- * @default false
1012
+ * Denotes the source of the error as user.
1850
1013
  */
1851
- readonly skipVersionCheck?: boolean;
1014
+ readonly source = "user";
1852
1015
  /**
1853
- * Skip enum checks
1854
- *
1855
- * This means you may read enum values you don't know about yet. Make sure to always
1856
- * check the values of enums you encounter in the manifest.
1016
+ * The stacks that caused the error, if available
1857
1017
  *
1858
- * @default false
1018
+ * The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
1019
+ * Absence indicates synthesis didn't fully complete.
1859
1020
  */
1860
- readonly skipEnumCheck?: boolean;
1021
+ readonly stacks?: cxapi.CloudFormationStackArtifact[];
1022
+ private constructor();
1023
+ }
1024
+ declare class ContextProviderError extends ToolkitError {
1861
1025
  /**
1862
- * Topologically sort all artifacts
1863
- *
1864
- * This parameter is only respected by the constructor of `CloudAssembly`. The
1865
- * property lives here for backwards compatibility reasons.
1866
- *
1867
- * @default true
1026
+ * Denotes the source of the error as user.
1868
1027
  */
1869
- readonly topoSort?: boolean;
1028
+ readonly source = "user";
1029
+ constructor(message: string);
1870
1030
  }
1871
- declare class Manifest {
1031
+ /**
1032
+ * Which stacks should be selected from a cloud assembly
1033
+ */
1034
+ export declare enum StackSelectionStrategy {
1872
1035
  /**
1873
- * Validates and saves the cloud assembly manifest to file.
1874
- *
1875
- * @param manifest - manifest.
1876
- * @param filePath - output file path.
1036
+ * Returns all stacks in the app regardless of patterns,
1037
+ * including stacks inside nested assemblies.
1877
1038
  */
1878
- static saveAssemblyManifest(manifest: AssemblyManifest, filePath: string): void;
1039
+ ALL_STACKS = "all-stacks",
1879
1040
  /**
1880
- * Load and validates the cloud assembly manifest from file.
1881
- *
1882
- * @param filePath - path to the manifest file.
1041
+ * Returns all stacks in the main (top level) assembly only.
1883
1042
  */
1884
- static loadAssemblyManifest(filePath: string, options?: LoadManifestOptions): AssemblyManifest;
1043
+ MAIN_ASSEMBLY = "main-assembly",
1885
1044
  /**
1886
- * Validates and saves the asset manifest to file.
1887
- *
1888
- * @param manifest - manifest.
1889
- * @param filePath - output file path.
1045
+ * If the assembly includes a single stack, returns it.
1046
+ * Otherwise throws an exception.
1890
1047
  */
1891
- static saveAssetManifest(manifest: AssetManifest, filePath: string): void;
1048
+ ONLY_SINGLE = "only-single",
1892
1049
  /**
1893
- * Load and validates the asset manifest from file.
1894
- *
1895
- * @param filePath - path to the manifest file.
1050
+ * Return stacks matched by patterns.
1051
+ * If no stacks are found, execution is halted successfully.
1052
+ * Most likely you don't want to use this but `StackSelectionStrategy.MUST_MATCH_PATTERN`
1896
1053
  */
1897
- static loadAssetManifest(filePath: string): AssetManifest;
1054
+ PATTERN_MATCH = "pattern-match",
1898
1055
  /**
1899
- * Validates and saves the integ manifest to file.
1900
- *
1901
- * @param manifest - manifest.
1902
- * @param filePath - output file path.
1056
+ * Return stacks matched by patterns.
1057
+ * Throws an exception if the patterns don't match at least one stack in the assembly.
1903
1058
  */
1904
- static saveIntegManifest(manifest: IntegManifest, filePath: string): void;
1059
+ PATTERN_MUST_MATCH = "pattern-must-match",
1905
1060
  /**
1906
- * Load and validates the integ manifest from file.
1907
- *
1908
- * @param filePath - path to the manifest file.
1061
+ * Returns if exactly one stack is matched by the pattern(s).
1062
+ * Throws an exception if no stack, or more than exactly one stack are matched.
1909
1063
  */
1910
- static loadIntegManifest(filePath: string): IntegManifest;
1064
+ PATTERN_MUST_MATCH_SINGLE = "pattern-must-match-single"
1065
+ }
1066
+ /**
1067
+ * When selecting stacks, what other stacks to include because of dependencies
1068
+ */
1069
+ export declare enum ExpandStackSelection {
1911
1070
  /**
1912
- * Fetch the current schema version number.
1071
+ * Don't select any extra stacks
1913
1072
  */
1914
- static version(): string;
1073
+ NONE = "none",
1915
1074
  /**
1916
- * Return the CLI version that supports this Cloud Assembly Schema version
1075
+ * Include stacks that this stack depends on
1917
1076
  */
1918
- static cliVersion(): string | undefined;
1077
+ UPSTREAM = "upstream",
1919
1078
  /**
1920
- * Deprecated
1921
- * @deprecated use `saveAssemblyManifest()`
1079
+ * Include stacks that depend on this stack
1922
1080
  */
1923
- static save(manifest: AssemblyManifest, filePath: string): void;
1081
+ DOWNSTREAM = "downstream"
1082
+ }
1083
+ /**
1084
+ * A specification of which stacks should be selected
1085
+ */
1086
+ export interface StackSelector {
1924
1087
  /**
1925
- * Deprecated
1926
- * @deprecated use `loadAssemblyManifest()`
1088
+ * The behavior if if no selectors are provided.
1927
1089
  */
1928
- static load(filePath: string): AssemblyManifest;
1929
- private static validate;
1930
- private static saveManifest;
1931
- private static loadManifest;
1090
+ strategy: StackSelectionStrategy;
1932
1091
  /**
1933
- * This requires some explaining...
1934
- *
1935
- * We previously used `{ Key, Value }` for the object that represents a stack tag. (Notice the casing)
1936
- * @link https://github.com/aws/aws-cdk/blob/v1.27.0/packages/aws-cdk/lib/api/cxapp/stacks.ts#L427.
1937
- *
1938
- * When that object moved to this package, it had to be JSII compliant, which meant the property
1939
- * names must be `camelCased`, and not `PascalCased`. This meant it no longer matches the structure in the `manifest.json` file.
1940
- * In order to support current manifest files, we have to translate the `PascalCased` representation to the new `camelCased` one.
1941
- *
1942
- * Note that the serialization itself still writes `PascalCased` because it relates to how CloudFormation expects it.
1943
- *
1944
- * Ideally, we would start writing the `camelCased` and translate to how CloudFormation expects it when needed. But this requires nasty
1945
- * backwards-compatibility code and it just doesn't seem to be worth the effort.
1092
+ * A list of patterns to match the stack hierarchical ids
1093
+ * Only used with `PATTERN_*` selection strategies.
1946
1094
  */
1947
- private static patchStackTagsOnRead;
1095
+ patterns?: string[];
1948
1096
  /**
1949
- * Validates that `assumeRoleAdditionalOptions` doesn't contain nor `ExternalId` neither `RoleArn`, as they
1950
- * should have dedicated properties preceding this (e.g `assumeRoleArn` and `assumeRoleExternalId`).
1097
+ * Expand the selection to upstream/downstream stacks.
1098
+ * @default ExpandStackSelection.None only select the specified/matched stacks
1951
1099
  */
1952
- private static validateAssumeRoleAdditionalOptions;
1100
+ expand?: ExpandStackSelection;
1953
1101
  /**
1954
- * See explanation on `patchStackTagsOnRead`
1102
+ * By default, we throw an exception if the assembly contains no stacks.
1103
+ * Set to `false`, to halt execution for empty assemblies without error.
1955
1104
  *
1956
- * Translate stack tags metadata if it has the "right" casing.
1957
- */
1958
- private static patchStackTagsOnWrite;
1959
- /**
1960
- * Recursively replace stack tags in the stack metadata
1105
+ * Note that actions can still throw if a stack selection result is empty,
1106
+ * but the assembly contains stacks in principle.
1107
+ *
1108
+ * @default true
1961
1109
  */
1962
- private static replaceStackTags;
1963
- private constructor();
1110
+ failOnEmpty?: boolean;
1964
1111
  }
1965
1112
  /**
1966
1113
  * The current action being performed by the CLI. 'none' represents the absence of an action.
@@ -2055,47 +1202,71 @@ export interface IIoHost {
2055
1202
  */
2056
1203
  requestResponse<T, U>(msg: IoRequest<T, U>): Promise<U>;
2057
1204
  }
2058
- interface CodeInfo {
1205
+ export interface BootstrapEnvironmentProgress {
2059
1206
  /**
2060
- * The message code.
1207
+ * The total number of environments being deployed
2061
1208
  */
2062
- readonly code: IoMessageCode;
1209
+ readonly total: number;
2063
1210
  /**
2064
- * A brief description of the meaning of this IO Message.
1211
+ * The count of the environment currently bootstrapped
1212
+ *
1213
+ * This is counting value, not an identifier.
2065
1214
  */
2066
- readonly description: string;
1215
+ readonly current: number;
2067
1216
  /**
2068
- * The name of the payload interface, if applicable.
2069
- * Some Io Messages include a payload, with a specific interface. The name of
2070
- * the interface is specified here so that it can be linked with the message
2071
- * when documentation is generated.
2072
- *
2073
- * The interface _must_ be exposed directly from toolkit-lib, so that it will
2074
- * have a documentation page generated (that can be linked to).
1217
+ * The environment that's currently being bootstrapped
2075
1218
  */
2076
- readonly interface?: string;
1219
+ readonly environment: cxapi.Environment;
2077
1220
  }
2078
- interface MessageInfo extends CodeInfo {
1221
+ interface IManifestEntry {
2079
1222
  /**
2080
- * The message level
1223
+ * The identifier of the asset and its destination
2081
1224
  */
2082
- readonly level: IoMessageLevel;
1225
+ readonly id: DestinationIdentifier;
1226
+ /**
1227
+ * The type of asset
1228
+ */
1229
+ readonly type: string;
1230
+ /**
1231
+ * Type-dependent source data
1232
+ */
1233
+ readonly genericSource: unknown;
1234
+ /**
1235
+ * Type-dependent destination data
1236
+ */
1237
+ readonly genericDestination: unknown;
1238
+ /**
1239
+ * Return a display name for this asset
1240
+ *
1241
+ * The `includeDestination` parameter controls whether or not to include the
1242
+ * destination ID in the display name.
1243
+ *
1244
+ * - Pass `false` if you are displaying notifications about building the
1245
+ * asset, or if you are describing the work of building the asset and publishing
1246
+ * to all destinations at the same time.
1247
+ * - Pass `true` if you are displaying notifications about publishing to a
1248
+ * specific destination.
1249
+ */
1250
+ displayName(includeDestination: boolean): string;
2083
1251
  }
2084
- interface IoMessageMaker<T> extends MessageInfo {
1252
+ declare class DestinationIdentifier {
1253
+ /**
1254
+ * Identifies the asset, by source.
1255
+ *
1256
+ * The assetId will be the same between assets that represent
1257
+ * the same physical file or image.
1258
+ */
1259
+ readonly assetId: string;
2085
1260
  /**
2086
- * Create a message for this code, with or without payload.
1261
+ * Identifies the destination where this asset will be published
2087
1262
  */
2088
- msg: [
2089
- T
2090
- ] extends [
2091
- AbsentData
2092
- ] ? (message: string) => ActionLessMessage<AbsentData> : (message: string, data: T) => ActionLessMessage<T>;
1263
+ readonly destinationId: string;
1264
+ constructor(assetId: string, destinationId: string);
2093
1265
  /**
2094
- * Returns whether the given `IoMessage` instance matches the current message definition
1266
+ * Return a string representation for this asset identifier
2095
1267
  */
2096
- is(x: IoMessage<unknown>): x is IoMessage<T>;
1268
+ toString(): string;
2097
1269
  }
2098
- type AbsentData = void;
2099
1270
  /**
2100
1271
  * Assembly data returned in the payload of an IO Message.
2101
1272
  */
@@ -2182,155 +1353,14 @@ export interface ConfirmationRequest {
2182
1353
  * for input is too complex, as the confirmation might not easily be attributed to a specific request.
2183
1354
  *
2184
1355
  * @default - no concurrency
2185
- */
2186
- readonly concurrency?: number;
2187
- }
2188
- export interface ContextProviderMessageSource {
2189
- /**
2190
- * The name of the context provider sending the message
2191
- */
2192
- readonly provider: string;
2193
- }
2194
- interface SpanEnd {
2195
- readonly duration: number;
2196
- }
2197
- interface SpanDefinition<S extends object, E extends SpanEnd> {
2198
- readonly name: string;
2199
- readonly start: IoMessageMaker<S>;
2200
- readonly end: IoMessageMaker<E>;
2201
- }
2202
- type EmptyObject = {
2203
- [index: string | number | symbol]: never;
2204
- };
2205
- type VoidWhenEmpty<T> = T extends EmptyObject ? void : T;
2206
- type ForceEmpty<T> = T extends EmptyObject ? EmptyObject : T;
2207
- type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
2208
- interface ElapsedTime {
2209
- readonly asMs: number;
2210
- readonly asSec: number;
2211
- }
2212
- interface IMessageSpan<E extends SpanEnd> {
2213
- /**
2214
- * Get the time elapsed since the start
2215
- */
2216
- elapsedTime(): Promise<ElapsedTime>;
2217
- /**
2218
- * Sends a simple, generic message with the current timing
2219
- * For more complex intermediate messages, get the `elapsedTime` and use `notify`
2220
- */
2221
- timing(maker: IoMessageMaker<Duration>, message?: string): Promise<ElapsedTime>;
2222
- /**
2223
- * Sends an arbitrary intermediate message as part of the span
2224
- */
2225
- notify(message: ActionLessMessage<unknown>): Promise<void>;
2226
- /**
2227
- * End the span with a payload
2228
- */
2229
- end(payload: VoidWhenEmpty<Omit<E, keyof SpanEnd>>): Promise<ElapsedTime>;
2230
- /**
2231
- * End the span with a payload, overwriting
2232
- */
2233
- end(payload: VoidWhenEmpty<Optional<E, keyof SpanEnd>>): Promise<ElapsedTime>;
2234
- /**
2235
- * End the span with a message and payload
2236
- */
2237
- end(message: string, payload: ForceEmpty<Optional<E, keyof SpanEnd>>): Promise<ElapsedTime>;
2238
- }
2239
- declare class SpanMaker<S extends object, E extends SpanEnd> {
2240
- private readonly definition;
2241
- private readonly ioHelper;
2242
- constructor(ioHelper: IoHelper, definition: SpanDefinition<S, E>);
2243
- /**
2244
- * Starts the span and initially notifies the IoHost
2245
- * @returns a message span
2246
- */
2247
- begin(payload: VoidWhenEmpty<S>): Promise<IMessageSpan<E>>;
2248
- begin(message: string, payload: S): Promise<IMessageSpan<E>>;
2249
- }
2250
- type ActionLessMessage<T> = Omit<IoMessage<T>, "action">;
2251
- type ActionLessRequest<T, U> = Omit<IoRequest<T, U>, "action">;
2252
- declare class IoHelper implements IIoHost {
2253
- static fromIoHost(ioHost: IIoHost, action: ToolkitAction): IoHelper;
2254
- private readonly ioHost;
2255
- private readonly action;
2256
- private constructor();
2257
- /**
2258
- * Forward a message to the IoHost, while injection the current action
2259
- */
2260
- notify(msg: ActionLessMessage<unknown>): Promise<void>;
2261
- /**
2262
- * Forward a request to the IoHost, while injection the current action
2263
- */
2264
- requestResponse<T, U>(msg: ActionLessRequest<T, U>): Promise<U>;
2265
- /**
2266
- * Create a new marker from a given registry entry
2267
- */
2268
- span<S extends object, E extends SpanEnd>(definition: SpanDefinition<S, E>): SpanMaker<S, E>;
2269
- }
2270
- export interface BootstrapEnvironmentProgress {
2271
- /**
2272
- * The total number of environments being deployed
2273
- */
2274
- readonly total: number;
2275
- /**
2276
- * The count of the environment currently bootstrapped
2277
- *
2278
- * This is counting value, not an identifier.
2279
- */
2280
- readonly current: number;
2281
- /**
2282
- * The environment that's currently being bootstrapped
2283
- */
2284
- readonly environment: cxapi.Environment;
2285
- }
2286
- interface IManifestEntry {
2287
- /**
2288
- * The identifier of the asset and its destination
2289
- */
2290
- readonly id: DestinationIdentifier;
2291
- /**
2292
- * The type of asset
2293
- */
2294
- readonly type: string;
2295
- /**
2296
- * Type-dependent source data
2297
- */
2298
- readonly genericSource: unknown;
2299
- /**
2300
- * Type-dependent destination data
2301
- */
2302
- readonly genericDestination: unknown;
2303
- /**
2304
- * Return a display name for this asset
2305
- *
2306
- * The `includeDestination` parameter controls whether or not to include the
2307
- * destination ID in the display name.
2308
- *
2309
- * - Pass `false` if you are displaying notifications about building the
2310
- * asset, or if you are describing the work of building the asset and publishing
2311
- * to all destinations at the same time.
2312
- * - Pass `true` if you are displaying notifications about publishing to a
2313
- * specific destination.
2314
- */
2315
- displayName(includeDestination: boolean): string;
2316
- }
2317
- declare class DestinationIdentifier {
2318
- /**
2319
- * Identifies the asset, by source.
2320
- *
2321
- * The assetId will be the same between assets that represent
2322
- * the same physical file or image.
2323
- */
2324
- readonly assetId: string;
2325
- /**
2326
- * Identifies the destination where this asset will be published
2327
- */
2328
- readonly destinationId: string;
2329
- constructor(assetId: string, destinationId: string);
1356
+ */
1357
+ readonly concurrency?: number;
1358
+ }
1359
+ export interface ContextProviderMessageSource {
2330
1360
  /**
2331
- * Return a string representation for this asset identifier
1361
+ * The name of the context provider sending the message
2332
1362
  */
2333
- toString(): string;
1363
+ readonly provider: string;
2334
1364
  }
2335
1365
  /**
2336
1366
  * Different types of permission related changes in a diff
@@ -2362,6 +1392,26 @@ export interface DiffResult extends Duration {
2362
1392
  */
2363
1393
  readonly formattedSecurityDiff: string;
2364
1394
  }
1395
+ export type DeployStackResult = SuccessfulDeployStackResult | NeedRollbackFirstDeployStackResult | ReplacementRequiresRollbackStackResult;
1396
+ /** Successfully deployed a stack */
1397
+ export interface SuccessfulDeployStackResult {
1398
+ readonly type: "did-deploy-stack";
1399
+ readonly noOp: boolean;
1400
+ readonly outputs: {
1401
+ [name: string]: string;
1402
+ };
1403
+ readonly stackArn: string;
1404
+ }
1405
+ /** The stack is currently in a failpaused state, and needs to be rolled back before the deployment */
1406
+ export interface NeedRollbackFirstDeployStackResult {
1407
+ readonly type: "failpaused-need-rollback-first";
1408
+ readonly reason: "not-norollback" | "replacement";
1409
+ readonly status: string;
1410
+ }
1411
+ /** The upcoming change has a replacement, which requires deploying with --rollback */
1412
+ export interface ReplacementRequiresRollbackStackResult {
1413
+ readonly type: "replacement-requires-rollback";
1414
+ }
2365
1415
  export interface StackDeployProgress {
2366
1416
  /**
2367
1417
  * The total number of stacks being deployed
@@ -2388,26 +1438,6 @@ export interface DeployConfirmationRequest extends ConfirmationRequest {
2388
1438
  */
2389
1439
  readonly permissionChangeType: PermissionChangeType;
2390
1440
  }
2391
- export type DeployStackResult = SuccessfulDeployStackResult | NeedRollbackFirstDeployStackResult | ReplacementRequiresRollbackStackResult;
2392
- /** Successfully deployed a stack */
2393
- export interface SuccessfulDeployStackResult {
2394
- readonly type: "did-deploy-stack";
2395
- readonly noOp: boolean;
2396
- readonly outputs: {
2397
- [name: string]: string;
2398
- };
2399
- readonly stackArn: string;
2400
- }
2401
- /** The stack is currently in a failpaused state, and needs to be rolled back before the deployment */
2402
- export interface NeedRollbackFirstDeployStackResult {
2403
- readonly type: "failpaused-need-rollback-first";
2404
- readonly reason: "not-norollback" | "replacement";
2405
- readonly status: string;
2406
- }
2407
- /** The upcoming change has a replacement, which requires deploying with --rollback */
2408
- export interface ReplacementRequiresRollbackStackResult {
2409
- readonly type: "replacement-requires-rollback";
2410
- }
2411
1441
  export interface StackDeployProgress {
2412
1442
  /**
2413
1443
  * The total number of stacks being deployed
@@ -2671,6 +1701,66 @@ export interface CloudWatchLogEvent {
2671
1701
  */
2672
1702
  readonly timestamp: Date;
2673
1703
  }
1704
+ interface IDifference<ValueType> {
1705
+ readonly oldValue: ValueType | undefined;
1706
+ readonly newValue: ValueType | undefined;
1707
+ readonly isDifferent: boolean;
1708
+ readonly isAddition: boolean;
1709
+ readonly isRemoval: boolean;
1710
+ readonly isUpdate: boolean;
1711
+ }
1712
+ declare class Difference<ValueType> implements IDifference<ValueType> {
1713
+ readonly oldValue: ValueType | undefined;
1714
+ readonly newValue: ValueType | undefined;
1715
+ /**
1716
+ * Whether this is an actual different or the values are actually the same
1717
+ *
1718
+ * isDifferent => (isUpdate | isRemoved | isUpdate)
1719
+ */
1720
+ isDifferent: boolean;
1721
+ /**
1722
+ * @param oldValue the old value, cannot be equal (to the sense of +deepEqual+) to +newValue+.
1723
+ * @param newValue the new value, cannot be equal (to the sense of +deepEqual+) to +oldValue+.
1724
+ */
1725
+ constructor(oldValue: ValueType | undefined, newValue: ValueType | undefined);
1726
+ /** @returns +true+ if the element is new to the template. */
1727
+ get isAddition(): boolean;
1728
+ /** @returns +true+ if the element was removed from the template. */
1729
+ get isRemoval(): boolean;
1730
+ /** @returns +true+ if the element was already in the template and is updated. */
1731
+ get isUpdate(): boolean;
1732
+ }
1733
+ declare class PropertyDifference<ValueType> extends Difference<ValueType> {
1734
+ changeImpact?: ResourceImpact;
1735
+ constructor(oldValue: ValueType | undefined, newValue: ValueType | undefined, args: {
1736
+ changeImpact?: ResourceImpact;
1737
+ });
1738
+ }
1739
+ declare enum ResourceImpact {
1740
+ /** The existing physical resource will be updated */
1741
+ WILL_UPDATE = "WILL_UPDATE",
1742
+ /** A new physical resource will be created */
1743
+ WILL_CREATE = "WILL_CREATE",
1744
+ /** The existing physical resource will be replaced */
1745
+ WILL_REPLACE = "WILL_REPLACE",
1746
+ /** The existing physical resource may be replaced */
1747
+ MAY_REPLACE = "MAY_REPLACE",
1748
+ /** The existing physical resource will be destroyed */
1749
+ WILL_DESTROY = "WILL_DESTROY",
1750
+ /** The existing physical resource will be removed from CloudFormation supervision */
1751
+ WILL_ORPHAN = "WILL_ORPHAN",
1752
+ /** The existing physical resource will be added to CloudFormation supervision */
1753
+ WILL_IMPORT = "WILL_IMPORT",
1754
+ /** There is no change in this resource */
1755
+ NO_CHANGE = "NO_CHANGE"
1756
+ }
1757
+ interface Resource {
1758
+ Type: string;
1759
+ Properties?: {
1760
+ [name: string]: any;
1761
+ };
1762
+ [key: string]: any;
1763
+ }
2674
1764
  /**
2675
1765
  * A resource affected by a change
2676
1766
  */
@@ -2878,219 +1968,9 @@ export interface HotswapResult extends Duration, HotswapDeploymentDetails {
2878
1968
  */
2879
1969
  readonly hotswapped: boolean;
2880
1970
  }
2881
- /**
2882
- * @deprecated
2883
- */
2884
- declare enum RequireApproval$1 {
2885
- /**
2886
- * Never require any security approvals
2887
- */
2888
- NEVER = "never",
2889
- /**
2890
- * Any security changes require an approval
2891
- */
2892
- ANY_CHANGE = "any-change",
2893
- /**
2894
- * Require approval only for changes that are access broadening
2895
- */
2896
- BROADENING = "broadening"
2897
- }
2898
- interface FormatSecurityDiffOutput {
2899
- /**
2900
- * Complete formatted security diff, if it is prompt-worthy
2901
- */
2902
- readonly formattedDiff?: string;
2903
- }
2904
- interface FormatStackDiffOutput {
2905
- /**
2906
- * Number of stacks with diff changes
2907
- */
2908
- readonly numStacksWithChanges: number;
2909
- /**
2910
- * Complete formatted diff
2911
- */
2912
- readonly formattedDiff: string;
2913
- }
2914
- interface DiffFormatterProps {
2915
- /**
2916
- * Helper for the IoHost class
2917
- */
2918
- readonly ioHelper: IoHelper;
2919
- /**
2920
- * The old/current state of the stack.
2921
- */
2922
- readonly oldTemplate: any;
2923
- /**
2924
- * The new/target state of the stack.
2925
- */
2926
- readonly newTemplate: cxapi.CloudFormationStackArtifact;
2927
- }
2928
- interface FormatSecurityDiffOptions {
2929
- /**
2930
- * The approval level of the security diff
2931
- */
2932
- readonly requireApproval: RequireApproval$1;
2933
- /**
2934
- * The name of the Stack.
2935
- */
2936
- readonly stackName?: string;
2937
- /**
2938
- * The changeSet for the Stack.
2939
- *
2940
- * @default undefined
2941
- */
2942
- readonly changeSet?: DescribeChangeSetOutput;
2943
- }
2944
- interface FormatStackDiffOptions {
2945
- /**
2946
- * do not filter out AWS::CDK::Metadata or Rules
2947
- *
2948
- * @default false
2949
- */
2950
- readonly strict?: boolean;
2951
- /**
2952
- * lines of context to use in arbitrary JSON diff
2953
- *
2954
- * @default 3
2955
- */
2956
- readonly context?: number;
2957
- /**
2958
- * silences \'There were no differences\' messages
2959
- *
2960
- * @default false
2961
- */
2962
- readonly quiet?: boolean;
2963
- /**
2964
- * The name of the stack
2965
- */
2966
- readonly stackName?: string;
2967
- /**
2968
- * @default undefined
2969
- */
2970
- readonly changeSet?: DescribeChangeSetOutput;
2971
- /**
2972
- * @default false
2973
- */
2974
- readonly isImport?: boolean;
2975
- /**
2976
- * @default undefined
2977
- */
2978
- readonly nestedStackTemplates?: {
2979
- [nestedStackLogicalId: string]: NestedStackTemplates;
2980
- };
2981
- }
2982
- /**
2983
- * Class for formatting the diff output
2984
- */
2985
- export declare class DiffFormatter {
2986
- private readonly ioHelper;
2987
- private readonly oldTemplate;
2988
- private readonly newTemplate;
2989
- constructor(props: DiffFormatterProps);
2990
- /**
2991
- * Format the stack diff
2992
- */
2993
- formatStackDiff(options: FormatStackDiffOptions): FormatStackDiffOutput;
2994
- private formatStackDiffHelper;
2995
- /**
2996
- * Format the security diff
2997
- */
2998
- formatSecurityDiff(options: FormatSecurityDiffOptions): FormatSecurityDiffOutput;
2999
- }
3000
- /**
3001
- * Represents a general toolkit error in the AWS CDK Toolkit.
3002
- */
3003
- export declare class ToolkitError extends Error {
3004
- /**
3005
- * Determines if a given error is an instance of ToolkitError.
3006
- */
3007
- static isToolkitError(x: any): x is ToolkitError;
3008
- /**
3009
- * Determines if a given error is an instance of AuthenticationError.
3010
- */
3011
- static isAuthenticationError(x: any): x is AuthenticationError;
3012
- /**
3013
- * Determines if a given error is an instance of AssemblyError.
3014
- */
3015
- static isAssemblyError(x: any): x is AssemblyError;
3016
- /**
3017
- * Determines if a given error is an instance of AssemblyError.
3018
- */
3019
- static isContextProviderError(x: any): x is ContextProviderError;
3020
- /**
3021
- * An AssemblyError with an original error as cause
3022
- */
3023
- static withCause(message: string, error: unknown): ToolkitError;
3024
- /**
3025
- * The type of the error, defaults to "toolkit".
3026
- */
3027
- readonly type: string;
3028
- /**
3029
- * Denotes the source of the error as the toolkit.
3030
- */
3031
- readonly source: "toolkit" | "user";
3032
- /**
3033
- * The specific original cause of the error, if available
3034
- */
3035
- readonly cause?: unknown;
3036
- constructor(message: string, type?: string, cause?: unknown);
3037
- }
3038
- /**
3039
- * Represents an authentication-specific error in the AWS CDK Toolkit.
3040
- */
3041
- export declare class AuthenticationError extends ToolkitError {
3042
- /**
3043
- * Denotes the source of the error as user.
3044
- */
3045
- readonly source = "user";
3046
- constructor(message: string);
3047
- }
3048
- /**
3049
- * Represents an error causes by cloud assembly synthesis
3050
- *
3051
- * This includes errors thrown during app execution, as well as failing annotations.
3052
- */
3053
- export declare class AssemblyError extends ToolkitError {
3054
- /**
3055
- * An AssemblyError with an original error as cause
3056
- */
3057
- static withCause(message: string, error: unknown): AssemblyError;
3058
- /**
3059
- * An AssemblyError with a list of stacks as cause
3060
- */
3061
- static withStacks(message: string, stacks?: cxapi.CloudFormationStackArtifact[]): AssemblyError;
3062
- /**
3063
- * Denotes the source of the error as user.
3064
- */
3065
- readonly source = "user";
3066
- /**
3067
- * The stacks that caused the error, if available
3068
- *
3069
- * The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
3070
- * Absence indicates synthesis didn't fully complete.
3071
- */
3072
- readonly stacks?: cxapi.CloudFormationStackArtifact[];
3073
- private constructor();
3074
- }
3075
- /**
3076
- * Represents an error originating from a Context Provider
3077
- */
3078
- export declare class ContextProviderError extends ToolkitError {
3079
- /**
3080
- * Denotes the source of the error as user.
3081
- */
3082
- readonly source = "user";
3083
- constructor(message: string);
3084
- }
3085
- /**
3086
- * Removes CDKMetadata and Outputs in the template so that only resources for importing are left.
3087
- * @returns template with import resources only
3088
- */
3089
- export declare function removeNonImportResources(stack: CloudFormationStackArtifact): any;
3090
1971
 
3091
1972
  export {
3092
1973
  MissingContext$1 as MissingContext,
3093
- RequireApproval$1 as RequireApproval,
3094
1974
  };
3095
1975
 
3096
1976
  export {};