@aws-cdk/toolkit-lib 0.1.7 → 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 (64) 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 -2
  5. package/lib/actions/bootstrap/index.js +13 -6
  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 +20 -16
  15. package/lib/actions/diff/index.js +4 -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/index.d.ts +1 -0
  19. package/lib/actions/index.js +2 -1
  20. package/lib/actions/watch/index.d.ts +0 -14
  21. package/lib/actions/watch/index.js +1 -1
  22. package/lib/api/cloud-assembly/index.d.ts +1 -1
  23. package/lib/api/cloud-assembly/index.js +4 -2
  24. package/lib/api/cloud-assembly/private/context-aware-source.d.ts +1 -1
  25. package/lib/api/cloud-assembly/private/context-aware-source.js +5 -4
  26. package/lib/api/cloud-assembly/private/exec.js +5 -4
  27. package/lib/api/cloud-assembly/private/prepare-source.d.ts +50 -40
  28. package/lib/api/cloud-assembly/private/prepare-source.js +117 -97
  29. package/lib/api/cloud-assembly/private/source-builder.d.ts +0 -6
  30. package/lib/api/cloud-assembly/private/source-builder.js +14 -13
  31. package/lib/api/cloud-assembly/private/stack-assembly.d.ts +3 -3
  32. package/lib/api/cloud-assembly/private/stack-assembly.js +12 -12
  33. package/lib/api/shared-private.d.ts +4 -0
  34. package/lib/api/shared-private.js +11306 -52
  35. package/lib/api/shared-private.js.map +4 -4
  36. package/lib/api/shared-public.d.ts +259 -1104
  37. package/lib/api/shared-public.js +38 -61
  38. package/lib/api/shared-public.js.map +4 -4
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +3 -1
  41. package/lib/index_bg.wasm +0 -0
  42. package/lib/private/dispose-polyfill.d.ts +1 -0
  43. package/lib/private/dispose-polyfill.js +20 -0
  44. package/lib/private/util.js +35 -14
  45. package/lib/private/util.js.map +4 -4
  46. package/lib/toolkit/index.d.ts +2 -1
  47. package/lib/toolkit/index.js +3 -2
  48. package/lib/toolkit/non-interactive-io-host.d.ts +80 -0
  49. package/lib/toolkit/non-interactive-io-host.js +129 -0
  50. package/lib/toolkit/private/index.d.ts +2 -3
  51. package/lib/toolkit/private/index.js +4 -4
  52. package/lib/toolkit/toolkit.d.ts +44 -24
  53. package/lib/toolkit/toolkit.js +191 -93
  54. package/lib/toolkit/types.d.ts +163 -0
  55. package/lib/toolkit/types.js +3 -0
  56. package/lib/util/promises.d.ts +12 -0
  57. package/lib/util/promises.js +17 -0
  58. package/lib/util/shell-env.d.ts +10 -0
  59. package/lib/util/shell-env.js +19 -0
  60. package/package.json +24 -21
  61. package/tsconfig.dts.json +9 -0
  62. package/lib/api/aws-cdk.d.ts +0 -20
  63. package/lib/api/aws-cdk.js +0 -10917
  64. package/lib/api/aws-cdk.js.map +0 -7
@@ -2,180 +2,6 @@ import * as cxapi from '@aws-cdk/cx-api';
2
2
  import { CloudFormationStackArtifact } from '@aws-cdk/cx-api';
3
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
- /**
87
- * The current action being performed by the CLI. 'none' represents the absence of an action.
88
- */
89
- export type ToolkitAction = "assembly" | "bootstrap" | "synth" | "list" | "diff" | "deploy" | "rollback" | "watch" | "destroy" | "doctor" | "gc" | "import" | "metadata" | "init" | "migrate";
90
- /**
91
- * The reporting level of the message.
92
- * All messages are always reported, it's up to the IoHost to decide what to log.
93
- */
94
- export type IoMessageLevel = "error" | "result" | "warn" | "info" | "debug" | "trace";
95
- /**
96
- * A valid message code.
97
- */
98
- export type IoMessageCode = `CDK_${string}_${"E" | "W" | "I"}${number}${number}${number}${number}`;
99
- /**
100
- * An IO message emitted.
101
- */
102
- export interface IoMessage<T> {
103
- /**
104
- * The time the message was emitted.
105
- */
106
- readonly time: Date;
107
- /**
108
- * The recommended log level of the message.
109
- *
110
- * This is an indicative level and should not be used to explicitly match messages, instead match the `code`.
111
- * The level of a message may change without notice.
112
- */
113
- readonly level: IoMessageLevel;
114
- /**
115
- * The action that triggered the message.
116
- */
117
- readonly action: ToolkitAction;
118
- /**
119
- * A short message code uniquely identifying a message type using the format CDK_[CATEGORY]_[E/W/I][0000-9999].
120
- *
121
- * The level indicator follows these rules:
122
- * - 'E' for error level messages
123
- * - 'W' for warning level messages
124
- * - 'I' for info/debug/trace level messages
125
- *
126
- * Codes ending in 000 0 are generic messages, while codes ending in 0001-9999 are specific to a particular message.
127
- * The following are examples of valid and invalid message codes:
128
- * ```ts
129
- * 'CDK_ASSETS_I0000' // valid: generic assets info message
130
- * 'CDK_TOOLKIT_E0002' // valid: specific toolkit error message
131
- * 'CDK_SDK_W0023' // valid: specific sdk warning message
132
- * ```
133
- *
134
- * @see https://github.com/aws/aws-cdk-cli/blob/main/packages/%40aws-cdk/toolkit-lib/CODE_REGISTRY.md
135
- */
136
- readonly code: IoMessageCode;
137
- /**
138
- * The message text.
139
- * This is safe to print to an end-user.
140
- */
141
- readonly message: string;
142
- /**
143
- * Identifies the message span, this message belongs to.
144
- *
145
- * A message span, groups multiple messages together that semantically related to the same operation.
146
- * This is an otherwise meaningless identifier.
147
- *
148
- * A message without a `spanId`, does not belong to a span.
149
- */
150
- readonly span?: string;
151
- /**
152
- * The data attached to the message.
153
- */
154
- readonly data: T;
155
- }
156
- /**
157
- * An IO request emitted.
158
- */
159
- export interface IoRequest<T, U> extends IoMessage<T> {
160
- /**
161
- * The default response that will be used if no data is returned.
162
- */
163
- readonly defaultResponse: U;
164
- }
165
- export interface IIoHost {
166
- /**
167
- * Notifies the host of a message.
168
- * The caller waits until the notification completes.
169
- */
170
- notify(msg: IoMessage<unknown>): Promise<void>;
171
- /**
172
- * Notifies the host of a message that requires a response.
173
- *
174
- * If the host does not return a response the suggested
175
- * default response from the input message will be used.
176
- */
177
- requestResponse<T, U>(msg: IoRequest<T, U>): Promise<U>;
178
- }
179
5
  interface BootstrapRole {
180
6
  /**
181
7
  * The ARN of the IAM role created as part of bootrapping
@@ -558,32 +384,6 @@ type LogicalIdMetadataEntry = string;
558
384
  type StackTagsMetadataEntry = Tag[];
559
385
  type PrimitiveType = boolean | number | string;
560
386
  type MetadataEntryData = AssetMetadataEntry | LogMessageMetadataEntry | LogicalIdMetadataEntry | StackTagsMetadataEntry | PrimitiveType;
561
- declare enum ArtifactMetadataEntryType {
562
- /**
563
- * Asset in metadata.
564
- */
565
- ASSET = "aws:cdk:asset",
566
- /**
567
- * Metadata key used to print INFO-level messages by the toolkit when an app is syntheized.
568
- */
569
- INFO = "aws:cdk:info",
570
- /**
571
- * Metadata key used to print WARNING-level messages by the toolkit when an app is syntheized.
572
- */
573
- WARN = "aws:cdk:warning",
574
- /**
575
- * Metadata key used to print ERROR-level messages by the toolkit when an app is syntheized.
576
- */
577
- ERROR = "aws:cdk:error",
578
- /**
579
- * Represents the CloudFormation logical ID of a resource at a certain path.
580
- */
581
- LOGICAL_ID = "aws:cdk:logicalId",
582
- /**
583
- * Represents tags of a stack.
584
- */
585
- STACK_TAGS = "aws:cdk:stack-tags"
586
- }
587
387
  interface MetadataEntry {
588
388
  /**
589
389
  * The type of the metadata entry.
@@ -871,15 +671,15 @@ interface KeyContextQuery extends ContextLookupRoleOptions {
871
671
  }
872
672
  interface CcApiContextQuery extends ContextLookupRoleOptions {
873
673
  /**
874
- * The Cloudformation resource type.
674
+ * The CloudFormation resource type.
875
675
  * See https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html
876
676
  */
877
677
  readonly typeName: string;
878
678
  /**
879
679
  * Identifier of the resource to look up using `GetResource`.
880
680
  *
881
- * Specifying exactIdentifier will return exactly one result, or throw an error.
882
- *
681
+ * Specifying exactIdentifier will return exactly one result, or throw an error
682
+ * unless `ignoreErrorOnMissingContext` is set.
883
683
  *
884
684
  * @default - Either exactIdentifier or propertyMatch should be specified.
885
685
  */
@@ -887,7 +687,10 @@ interface CcApiContextQuery extends ContextLookupRoleOptions {
887
687
  /**
888
688
  * Returns any resources matching these properties, using `ListResources`.
889
689
  *
890
- * Specifying propertyMatch will return 0 or more results.
690
+ * By default, specifying propertyMatch will successfully return 0 or more
691
+ * results. To throw an error if the number of results is unexpected (and
692
+ * prevent the query results from being committed to context), specify
693
+ * `expectedMatchCount`.
891
694
  *
892
695
  * ## Notes on property completeness
893
696
  *
@@ -921,6 +724,22 @@ interface CcApiContextQuery extends ContextLookupRoleOptions {
921
724
  * `GetResource` call for resources matched by `propertyMatch`.
922
725
  */
923
726
  readonly propertiesToReturn: string[];
727
+ /**
728
+ * Expected count of results if `propertyMatch` is specified.
729
+ *
730
+ * If the expected result count does not match the actual count,
731
+ * by default an error is produced and the result is not committed to cached
732
+ * context, and the user can correct the situation and try again without
733
+ * having to manually clear out the context key using `cdk context --remove`
734
+ *
735
+ * If the value of * `ignoreErrorOnMissingContext` is `true`, the value of
736
+ * `expectedMatchCount` is `at-least-one | exactly-one` and the number
737
+ * of found resources is 0, `dummyValue` is returned and committed to context
738
+ * instead.
739
+ *
740
+ * @default 'any'
741
+ */
742
+ readonly expectedMatchCount?: "any" | "at-least-one" | "at-most-one" | "exactly-one";
924
743
  /**
925
744
  * The value to return if the resource was not found and `ignoreErrorOnMissingContext` is true.
926
745
  *
@@ -939,8 +758,8 @@ interface CcApiContextQuery extends ContextLookupRoleOptions {
939
758
  *
940
759
  * - In case of an `exactIdentifier` lookup, return the `dummyValue` if the resource with
941
760
  * that identifier was not found.
942
- * - In case of a `propertyMatch` lookup, this setting currently does not have any effect,
943
- * as `propertyMatch` queries can legally return 0 resources.
761
+ * - In case of a `propertyMatch` lookup, return the `dummyValue` if `expectedMatchCount`
762
+ * is `at-least-one | exactly-one` and the number of resources found was 0.
944
763
  *
945
764
  * if `ignoreErrorOnMissingContext` is set, `dummyValue` should be set and be an array.
946
765
  *
@@ -1039,7 +858,12 @@ interface ArtifactManifest {
1039
858
  */
1040
859
  readonly properties?: ArtifactProperties;
1041
860
  /**
1042
- * 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.
1043
867
  *
1044
868
  * @default - no display name
1045
869
  */
@@ -1092,870 +916,291 @@ interface ICloudAssembly {
1092
916
  */
1093
917
  readonly directory: string;
1094
918
  }
1095
- interface AwsDestination {
919
+ interface LoadManifestOptions {
1096
920
  /**
1097
- * The region where this asset will need to be published
921
+ * Skip the version check
1098
922
  *
1099
- * @default - Current region
1100
- */
1101
- readonly region?: string;
1102
- /**
1103
- * 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.
1104
926
  *
1105
- * @default - No role will be assumed
927
+ * @default false
1106
928
  */
1107
- readonly assumeRoleArn?: string;
929
+ readonly skipVersionCheck?: boolean;
1108
930
  /**
1109
- * The ExternalId that needs to be supplied while assuming this role
931
+ * Skip enum checks
1110
932
  *
1111
- * @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
1112
937
  */
1113
- readonly assumeRoleExternalId?: string;
938
+ readonly skipEnumCheck?: boolean;
1114
939
  /**
1115
- * Additional options to pass to STS when assuming the role.
940
+ * Topologically sort all artifacts
1116
941
  *
1117
- * - `RoleArn` should not be used. Use the dedicated `assumeRoleArn` property instead.
1118
- * - `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.
1119
944
  *
1120
- * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property
1121
- * @default - No additional options.
945
+ * @default true
1122
946
  */
1123
- readonly assumeRoleAdditionalOptions?: {
1124
- [key: string]: any;
1125
- };
947
+ readonly topoSort?: boolean;
1126
948
  }
1127
- interface DockerImageAsset {
949
+ /**
950
+ * Represents a general toolkit error in the AWS CDK Toolkit.
951
+ */
952
+ export declare class ToolkitError extends Error {
1128
953
  /**
1129
- * A display name for this asset
1130
- *
1131
- * @default - The identifier will be used as the display name
954
+ * Determines if a given error is an instance of ToolkitError.
1132
955
  */
1133
- readonly displayName?: string;
956
+ static isToolkitError(x: any): x is ToolkitError;
1134
957
  /**
1135
- * Source description for container assets
958
+ * Determines if a given error is an instance of AuthenticationError.
1136
959
  */
1137
- readonly source: DockerImageSource;
960
+ static isAuthenticationError(x: any): x is AuthenticationError;
1138
961
  /**
1139
- * Destinations for this container asset
962
+ * Determines if a given error is an instance of AssemblyError.
1140
963
  */
1141
- readonly destinations: {
1142
- [id: string]: DockerImageDestination;
1143
- };
1144
- }
1145
- interface DockerImageSource {
964
+ static isAssemblyError(x: any): x is AssemblyError;
1146
965
  /**
1147
- * The directory containing the Docker image build instructions.
1148
- *
1149
- * This path is relative to the asset manifest location.
1150
- *
1151
- * @default - Exactly one of `directory` and `executable` is required
966
+ * Determines if a given error is an instance of AssemblyError.
1152
967
  */
1153
- readonly directory?: string;
968
+ static isContextProviderError(x: any): x is ContextProviderError;
1154
969
  /**
1155
- * A command-line executable that returns the name of a local
1156
- * Docker image on stdout after being run.
1157
- *
1158
- * @default - Exactly one of `directory` and `executable` is required
970
+ * An AssemblyError with an original error as cause
1159
971
  */
1160
- readonly executable?: string[];
972
+ static withCause(message: string, error: unknown): ToolkitError;
1161
973
  /**
1162
- * The name of the file with build instructions
1163
- *
1164
- * Only allowed when `directory` is set.
1165
- *
1166
- * @default "Dockerfile"
974
+ * The type of the error, defaults to "toolkit".
1167
975
  */
1168
- readonly dockerFile?: string;
976
+ readonly type: string;
1169
977
  /**
1170
- * Target build stage in a Dockerfile with multiple build stages
1171
- *
1172
- * Only allowed when `directory` is set.
1173
- *
1174
- * @default - The last stage in the Dockerfile
978
+ * Denotes the source of the error as the toolkit.
1175
979
  */
1176
- readonly dockerBuildTarget?: string;
980
+ readonly source: "toolkit" | "user";
1177
981
  /**
1178
- * Additional build arguments
1179
- *
1180
- * Only allowed when `directory` is set.
1181
- *
1182
- * @default - No additional build arguments
1183
- */
1184
- readonly dockerBuildArgs?: {
1185
- [name: string]: string;
1186
- };
1187
- /**
1188
- * SSH agent socket or keys
1189
- *
1190
- * Requires building with docker buildkit.
1191
- *
1192
- * @default - No ssh flag is set
1193
- */
1194
- readonly dockerBuildSsh?: string;
1195
- /**
1196
- * Additional build secrets
1197
- *
1198
- * Only allowed when `directory` is set.
1199
- *
1200
- * @default - No additional build secrets
1201
- */
1202
- readonly dockerBuildSecrets?: {
1203
- [name: string]: string;
1204
- };
1205
- /**
1206
- * Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.
1207
- *
1208
- * Specify this property to build images on a specific networking mode.
1209
- *
1210
- * @default - no networking mode specified
1211
- */
1212
- readonly networkMode?: string;
1213
- /**
1214
- * Platform to build for. _Requires Docker Buildx_.
1215
- *
1216
- * Specify this property to build images on a specific platform/architecture.
1217
- *
1218
- * @default - current machine platform
1219
- */
1220
- readonly platform?: string;
1221
- /**
1222
- * Outputs
1223
- *
1224
- * @default - no outputs are passed to the build command (default outputs are used)
1225
- * @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
1226
- */
1227
- readonly dockerOutputs?: string[];
1228
- /**
1229
- * Cache from options to pass to the `docker build` command.
1230
- *
1231
- * @default - no cache from options are passed to the build command
1232
- * @see https://docs.docker.com/build/cache/backends/
1233
- */
1234
- readonly cacheFrom?: DockerCacheOption[];
1235
- /**
1236
- * Cache to options to pass to the `docker build` command.
1237
- *
1238
- * @default - no cache to options are passed to the build command
1239
- * @see https://docs.docker.com/build/cache/backends/
1240
- */
1241
- readonly cacheTo?: DockerCacheOption;
1242
- /**
1243
- * Disable the cache and pass `--no-cache` to the `docker build` command.
1244
- *
1245
- * @default - cache is used
1246
- */
1247
- readonly cacheDisabled?: boolean;
1248
- }
1249
- interface DockerImageDestination extends AwsDestination {
1250
- /**
1251
- * Name of the ECR repository to publish to
1252
- */
1253
- readonly repositoryName: string;
1254
- /**
1255
- * Tag of the image to publish
1256
- */
1257
- readonly imageTag: string;
1258
- }
1259
- interface DockerCacheOption {
1260
- /**
1261
- * The type of cache to use.
1262
- * Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.
1263
- * @default - unspecified
1264
- *
1265
- * @example 'registry'
1266
- */
1267
- readonly type: string;
1268
- /**
1269
- * Any parameters to pass into the docker cache backend configuration.
1270
- * Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.
1271
- * @default {} No options provided
1272
- *
1273
- * @example
1274
- * declare const branch: string;
1275
- *
1276
- * const params = {
1277
- * ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
1278
- * mode: "max",
1279
- * };
1280
- */
1281
- readonly params?: {
1282
- [key: string]: string;
1283
- };
1284
- }
1285
- interface FileAsset {
1286
- /**
1287
- * A display name for this asset
1288
- *
1289
- * @default - The identifier will be used as the display name
1290
- */
1291
- readonly displayName?: string;
1292
- /**
1293
- * Source description for file assets
1294
- */
1295
- readonly source: FileSource;
1296
- /**
1297
- * Destinations for this file asset
1298
- */
1299
- readonly destinations: {
1300
- [id: string]: FileDestination;
1301
- };
1302
- }
1303
- declare enum FileAssetPackaging {
1304
- /**
1305
- * Upload the given path as a file
1306
- */
1307
- FILE = "file",
1308
- /**
1309
- * The given path is a directory, zip it and upload
1310
- */
1311
- ZIP_DIRECTORY = "zip"
1312
- }
1313
- interface FileSource {
1314
- /**
1315
- * External command which will produce the file asset to upload.
1316
- *
1317
- * @default - Exactly one of `executable` and `path` is required.
1318
- */
1319
- readonly executable?: string[];
1320
- /**
1321
- * The filesystem object to upload
1322
- *
1323
- * This path is relative to the asset manifest location.
1324
- *
1325
- * @default - Exactly one of `executable` and `path` is required.
1326
- */
1327
- readonly path?: string;
1328
- /**
1329
- * Packaging method
1330
- *
1331
- * Only allowed when `path` is specified.
1332
- *
1333
- * @default FILE
1334
- */
1335
- readonly packaging?: FileAssetPackaging;
1336
- }
1337
- interface FileDestination extends AwsDestination {
1338
- /**
1339
- * The name of the bucket
1340
- */
1341
- readonly bucketName: string;
1342
- /**
1343
- * The destination object key
1344
- */
1345
- readonly objectKey: string;
1346
- }
1347
- interface AssetManifest {
1348
- /**
1349
- * Version of the manifest
1350
- */
1351
- readonly version: string;
1352
- /**
1353
- * The file assets in this manifest
1354
- *
1355
- * @default - No files
1356
- */
1357
- readonly files?: {
1358
- [id: string]: FileAsset;
1359
- };
1360
- /**
1361
- * The Docker image assets in this manifest
1362
- *
1363
- * @default - No Docker images
1364
- */
1365
- readonly dockerImages?: {
1366
- [id: string]: DockerImageAsset;
1367
- };
1368
- }
1369
- declare enum RequireApproval {
1370
- /**
1371
- * Never ask for approval
1372
- */
1373
- NEVER = "never",
1374
- /**
1375
- * Prompt for approval for any type of change to the stack
1376
- */
1377
- ANYCHANGE = "any-change",
1378
- /**
1379
- * Only prompt for approval if there are security related changes
1380
- */
1381
- BROADENING = "broadening"
1382
- }
1383
- interface DefaultCdkOptions {
1384
- /**
1385
- * List of stacks to deploy
1386
- *
1387
- * Requried if `all` is not set
1388
- *
1389
- * @default - []
1390
- */
1391
- readonly stacks?: string[];
1392
- /**
1393
- * Deploy all stacks
1394
- *
1395
- * Requried if `stacks` is not set
1396
- *
1397
- * @default - false
1398
- */
1399
- readonly all?: boolean;
1400
- /**
1401
- * command-line for executing your app or a cloud assembly directory
1402
- * e.g. "node bin/my-app.js"
1403
- * or
1404
- * "cdk.out"
1405
- *
1406
- * @default - read from cdk.json
1407
- */
1408
- readonly app?: string;
1409
- /**
1410
- * Role to pass to CloudFormation for deployment
1411
- *
1412
- * @default - use the bootstrap cfn-exec role
1413
- */
1414
- readonly roleArn?: string;
1415
- /**
1416
- * Additional context
1417
- *
1418
- * @default - no additional context
1419
- */
1420
- readonly context?: {
1421
- [name: string]: string;
1422
- };
1423
- /**
1424
- * Print trace for stack warnings
1425
- *
1426
- * @default false
1427
- */
1428
- readonly trace?: boolean;
1429
- /**
1430
- * Do not construct stacks with warnings
1431
- *
1432
- * @default false
1433
- */
1434
- readonly strict?: boolean;
1435
- /**
1436
- * Perform context lookups.
1437
- *
1438
- * Synthesis fails if this is disabled and context lookups need
1439
- * to be performed
1440
- *
1441
- * @default true
1442
- */
1443
- readonly lookups?: boolean;
1444
- /**
1445
- * Ignores synthesis errors, which will likely produce an invalid output
1446
- *
1447
- * @default false
1448
- */
1449
- readonly ignoreErrors?: boolean;
1450
- /**
1451
- * Use JSON output instead of YAML when templates are printed
1452
- * to STDOUT
1453
- *
1454
- * @default false
1455
- */
1456
- readonly json?: boolean;
1457
- /**
1458
- * show debug logs
1459
- *
1460
- * @default false
1461
- */
1462
- readonly verbose?: boolean;
1463
- /**
1464
- * enable emission of additional debugging information, such as creation stack
1465
- * traces of tokens
1466
- *
1467
- * @default false
1468
- */
1469
- readonly debug?: boolean;
1470
- /**
1471
- * Use the indicated AWS profile as the default environment
1472
- *
1473
- * @default - no profile is used
1474
- */
1475
- readonly profile?: string;
1476
- /**
1477
- * Use the indicated proxy. Will read from
1478
- * HTTPS_PROXY environment if specified
1479
- *
1480
- * @default - no proxy
1481
- */
1482
- readonly proxy?: string;
1483
- /**
1484
- * Path to CA certificate to use when validating HTTPS
1485
- * requests.
1486
- *
1487
- * @default - read from AWS_CA_BUNDLE environment variable
1488
- */
1489
- readonly caBundlePath?: string;
1490
- /**
1491
- * Force trying to fetch EC2 instance credentials
1492
- *
1493
- * @default - guess EC2 instance status
1494
- */
1495
- readonly ec2Creds?: boolean;
1496
- /**
1497
- * Include "AWS::CDK::Metadata" resource in synthesized templates
1498
- *
1499
- * @default true
1500
- */
1501
- readonly versionReporting?: boolean;
1502
- /**
1503
- * Include "aws:cdk:path" CloudFormation metadata for each resource
1504
- *
1505
- * @default true
1506
- */
1507
- readonly pathMetadata?: boolean;
1508
- /**
1509
- * Include "aws:asset:*" CloudFormation metadata for resources that use assets
1510
- *
1511
- * @default true
1512
- */
1513
- readonly assetMetadata?: boolean;
1514
- /**
1515
- * Copy assets to the output directory
1516
- *
1517
- * Needed for local debugging the source files with SAM CLI
1518
- *
1519
- * @default false
1520
- */
1521
- readonly staging?: boolean;
1522
- /**
1523
- * Emits the synthesized cloud assembly into a directory
1524
- *
1525
- * @default cdk.out
1526
- */
1527
- readonly output?: string;
1528
- /**
1529
- * Show relevant notices
1530
- *
1531
- * @default true
1532
- */
1533
- readonly notices?: boolean;
1534
- /**
1535
- * Show colors and other style from console output
1536
- *
1537
- * @default true
1538
- */
1539
- readonly color?: boolean;
1540
- }
1541
- interface DeployOptions extends DefaultCdkOptions {
1542
- /**
1543
- * Only perform action on the given stack
1544
- *
1545
- * @default false
1546
- */
1547
- readonly exclusively?: boolean;
1548
- /**
1549
- * Name of the toolkit stack to use/deploy
1550
- *
1551
- * @default CDKToolkit
1552
- */
1553
- readonly toolkitStackName?: string;
1554
- /**
1555
- * Reuse the assets with the given asset IDs
1556
- *
1557
- * @default - do not reuse assets
1558
- */
1559
- readonly reuseAssets?: string[];
1560
- /**
1561
- * Optional name to use for the CloudFormation change set.
1562
- * If not provided, a name will be generated automatically.
1563
- *
1564
- * @default - auto generate a name
1565
- */
1566
- readonly changeSetName?: string;
1567
- /**
1568
- * Always deploy, even if templates are identical.
1569
- * @default false
1570
- */
1571
- readonly force?: boolean;
1572
- /**
1573
- * Rollback failed deployments
1574
- *
1575
- * @default true
1576
- */
1577
- readonly rollback?: boolean;
1578
- /**
1579
- * ARNs of SNS topics that CloudFormation will notify with stack related events
1580
- *
1581
- * @default - no notifications
1582
- */
1583
- readonly notificationArns?: string[];
1584
- /**
1585
- * What kind of security changes require approval
1586
- *
1587
- * @default RequireApproval.NEVER
1588
- */
1589
- readonly requireApproval?: RequireApproval;
1590
- /**
1591
- * Whether to execute the ChangeSet
1592
- * Not providing `execute` parameter will result in execution of ChangeSet
1593
- * @default true
1594
- */
1595
- readonly execute?: boolean;
1596
- /**
1597
- * Additional parameters for CloudFormation at deploy time
1598
- * @default {}
1599
- */
1600
- readonly parameters?: {
1601
- [name: string]: string;
1602
- };
1603
- /**
1604
- * Use previous values for unspecified parameters
1605
- *
1606
- * If not set, all parameters must be specified for every deployment.
1607
- *
1608
- * @default true
1609
- */
1610
- readonly usePreviousParameters?: boolean;
1611
- /**
1612
- * Path to file where stack outputs will be written after a successful deploy as JSON
1613
- * @default - Outputs are not written to any file
1614
- */
1615
- readonly outputsFile?: string;
1616
- /**
1617
- * Whether we are on a CI system
1618
- *
1619
- * @default false
1620
- */
1621
- readonly ci?: boolean;
1622
- /**
1623
- * Deploy multiple stacks in parallel
1624
- *
1625
- * @default 1
982
+ * The specific original cause of the error, if available
1626
983
  */
1627
- readonly concurrency?: number;
984
+ readonly cause?: unknown;
985
+ constructor(message: string, type?: string, cause?: unknown);
1628
986
  }
1629
- interface DestroyOptions extends DefaultCdkOptions {
1630
- /**
1631
- * Do not ask for permission before destroying stacks
1632
- *
1633
- * @default false
1634
- */
1635
- readonly force?: boolean;
987
+ /**
988
+ * Represents an authentication-specific error in the AWS CDK Toolkit.
989
+ */
990
+ export declare class AuthenticationError extends ToolkitError {
1636
991
  /**
1637
- * Only destroy the given stack
1638
- *
1639
- * @default false
992
+ * Denotes the source of the error as user.
1640
993
  */
1641
- readonly exclusively?: boolean;
994
+ readonly source = "user";
995
+ constructor(message: string);
1642
996
  }
1643
- interface TestOptions {
1644
- /**
1645
- * Run update workflow on this test case
1646
- * This should only be set to false to test scenarios
1647
- * that are not possible to test as part of the update workflow
1648
- *
1649
- * @default true
1650
- */
1651
- readonly stackUpdateWorkflow?: boolean;
1652
- /**
1653
- * Additional options to use for each CDK command
1654
- *
1655
- * @default - runner default options
1656
- */
1657
- readonly cdkCommandOptions?: CdkCommands;
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 {
1658
1003
  /**
1659
- * Additional commands to run at predefined points in the test workflow
1660
- *
1661
- * e.g. { postDeploy: ['yarn', 'test'] }
1662
- *
1663
- * @default - no hooks
1004
+ * An AssemblyError with an original error as cause
1664
1005
  */
1665
- readonly hooks?: Hooks;
1006
+ static withCause(message: string, error: unknown): AssemblyError;
1666
1007
  /**
1667
- * Whether or not to include asset hashes in the diff
1668
- * Asset hashes can introduces a lot of unneccessary noise into tests,
1669
- * but there are some cases where asset hashes _should_ be included. For example
1670
- * any tests involving custom resources or bundling
1671
- *
1672
- * @default false
1008
+ * An AssemblyError with a list of stacks as cause
1673
1009
  */
1674
- readonly diffAssets?: boolean;
1010
+ static withStacks(message: string, stacks?: cxapi.CloudFormationStackArtifact[]): AssemblyError;
1675
1011
  /**
1676
- * List of CloudFormation resource types in this stack that can
1677
- * be destroyed as part of an update without failing the test.
1678
- *
1679
- * This list should only include resources that for this specific
1680
- * integration test we are sure will not cause errors or an outage if
1681
- * destroyed. For example, maybe we know that a new resource will be created
1682
- * first before the old resource is destroyed which prevents any outage.
1683
- *
1684
- * e.g. ['AWS::IAM::Role']
1685
- *
1686
- * @default - do not allow destruction of any resources on update
1012
+ * Denotes the source of the error as user.
1687
1013
  */
1688
- readonly allowDestroy?: string[];
1014
+ readonly source = "user";
1689
1015
  /**
1690
- * Limit deployment to these regions
1016
+ * The stacks that caused the error, if available
1691
1017
  *
1692
- * @default - can run in any region
1018
+ * The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
1019
+ * Absence indicates synthesis didn't fully complete.
1693
1020
  */
1694
- readonly regions?: string[];
1021
+ readonly stacks?: cxapi.CloudFormationStackArtifact[];
1022
+ private constructor();
1695
1023
  }
1696
- interface TestCase extends TestOptions {
1697
- /**
1698
- * Stacks that should be tested as part of this test case
1699
- * The stackNames will be passed as args to the cdk commands
1700
- * so dependent stacks will be automatically deployed unless
1701
- * `exclusively` is passed
1702
- */
1703
- readonly stacks: string[];
1024
+ declare class ContextProviderError extends ToolkitError {
1704
1025
  /**
1705
- * The node id of the stack that contains assertions.
1706
- * This is the value that can be used to deploy the stack with the CDK CLI
1707
- *
1708
- * @default - no assertion stack
1709
- */
1710
- readonly assertionStack?: string;
1711
- /**
1712
- * The name of the stack that contains assertions
1713
- *
1714
- * @default - no assertion stack
1026
+ * Denotes the source of the error as user.
1715
1027
  */
1716
- readonly assertionStackName?: string;
1028
+ readonly source = "user";
1029
+ constructor(message: string);
1717
1030
  }
1718
- interface Hooks {
1719
- /**
1720
- * Commands to run prior to deploying the cdk stacks
1721
- * in the integration test
1722
- *
1723
- * @default - no commands
1724
- */
1725
- readonly preDeploy?: string[];
1726
- /**
1727
- * Commands to run prior after deploying the cdk stacks
1728
- * in the integration test
1729
- *
1730
- * @default - no commands
1731
- */
1732
- readonly postDeploy?: string[];
1031
+ /**
1032
+ * Which stacks should be selected from a cloud assembly
1033
+ */
1034
+ export declare enum StackSelectionStrategy {
1733
1035
  /**
1734
- * Commands to run prior to destroying the cdk stacks
1735
- * in the integration test
1736
- *
1737
- * @default - no commands
1036
+ * Returns all stacks in the app regardless of patterns,
1037
+ * including stacks inside nested assemblies.
1738
1038
  */
1739
- readonly preDestroy?: string[];
1039
+ ALL_STACKS = "all-stacks",
1740
1040
  /**
1741
- * Commands to run after destroying the cdk stacks
1742
- * in the integration test
1743
- *
1744
- * @default - no commands
1041
+ * Returns all stacks in the main (top level) assembly only.
1745
1042
  */
1746
- readonly postDestroy?: string[];
1747
- }
1748
- interface CdkCommand {
1043
+ MAIN_ASSEMBLY = "main-assembly",
1749
1044
  /**
1750
- * Whether or not to run this command as part of the workflow
1751
- * This can be used if you only want to test some of the workflow
1752
- * for example enable `synth` and disable `deploy` & `destroy` in order
1753
- * to limit the test to synthesis
1754
- *
1755
- * @default true
1045
+ * If the assembly includes a single stack, returns it.
1046
+ * Otherwise throws an exception.
1756
1047
  */
1757
- readonly enabled?: boolean;
1048
+ ONLY_SINGLE = "only-single",
1758
1049
  /**
1759
- * If the runner should expect this command to fail
1760
- *
1761
- * @default false
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`
1762
1053
  */
1763
- readonly expectError?: boolean;
1054
+ PATTERN_MATCH = "pattern-match",
1764
1055
  /**
1765
- * This can be used in combination with `expectedError`
1766
- * to validate that a specific message is returned.
1767
- *
1768
- * @default - do not validate message
1056
+ * Return stacks matched by patterns.
1057
+ * Throws an exception if the patterns don't match at least one stack in the assembly.
1769
1058
  */
1770
- readonly expectedMessage?: string;
1771
- }
1772
- interface DeployCommand extends CdkCommand {
1059
+ PATTERN_MUST_MATCH = "pattern-must-match",
1773
1060
  /**
1774
- * Additional arguments to pass to the command
1775
- * This can be used to test specific CLI functionality
1776
- *
1777
- * @default - only default args are used
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.
1778
1063
  */
1779
- readonly args?: DeployOptions;
1064
+ PATTERN_MUST_MATCH_SINGLE = "pattern-must-match-single"
1780
1065
  }
1781
- interface DestroyCommand extends CdkCommand {
1066
+ /**
1067
+ * When selecting stacks, what other stacks to include because of dependencies
1068
+ */
1069
+ export declare enum ExpandStackSelection {
1782
1070
  /**
1783
- * Additional arguments to pass to the command
1784
- * This can be used to test specific CLI functionality
1785
- *
1786
- * @default - only default args are used
1071
+ * Don't select any extra stacks
1787
1072
  */
1788
- readonly args?: DestroyOptions;
1789
- }
1790
- interface CdkCommands {
1073
+ NONE = "none",
1791
1074
  /**
1792
- * Options to for the cdk deploy command
1793
- *
1794
- * @default - default deploy options
1075
+ * Include stacks that this stack depends on
1795
1076
  */
1796
- readonly deploy?: DeployCommand;
1077
+ UPSTREAM = "upstream",
1797
1078
  /**
1798
- * Options to for the cdk destroy command
1799
- *
1800
- * @default - default destroy options
1079
+ * Include stacks that depend on this stack
1801
1080
  */
1802
- readonly destroy?: DestroyCommand;
1081
+ DOWNSTREAM = "downstream"
1803
1082
  }
1804
- interface IntegManifest {
1805
- /**
1806
- * Version of the manifest
1807
- */
1808
- readonly version: string;
1809
- /**
1810
- * Enable lookups for this test. If lookups are enabled
1811
- * then `stackUpdateWorkflow` must be set to false.
1812
- * Lookups should only be enabled when you are explicitely testing
1813
- * lookups.
1814
- *
1815
- * @default false
1816
- */
1817
- readonly enableLookups?: boolean;
1818
- /**
1819
- * Additional context to use when performing
1820
- * a synth. Any context provided here will override
1821
- * any default context
1822
- *
1823
- * @default - no additional context
1824
- */
1825
- readonly synthContext?: {
1826
- [name: string]: string;
1827
- };
1083
+ /**
1084
+ * A specification of which stacks should be selected
1085
+ */
1086
+ export interface StackSelector {
1828
1087
  /**
1829
- * test cases
1088
+ * The behavior if if no selectors are provided.
1830
1089
  */
1831
- readonly testCases: {
1832
- [testName: string]: TestCase;
1833
- };
1834
- }
1835
- declare const VERSION_MISMATCH: string;
1836
- interface LoadManifestOptions {
1090
+ strategy: StackSelectionStrategy;
1837
1091
  /**
1838
- * Skip the version check
1839
- *
1840
- * This means you may read a newer cloud assembly than the CX API is designed
1841
- * to support, and your application may not be aware of all features that in use
1842
- * in the Cloud Assembly.
1843
- *
1844
- * @default false
1092
+ * A list of patterns to match the stack hierarchical ids
1093
+ * Only used with `PATTERN_*` selection strategies.
1845
1094
  */
1846
- readonly skipVersionCheck?: boolean;
1095
+ patterns?: string[];
1847
1096
  /**
1848
- * Skip enum checks
1849
- *
1850
- * This means you may read enum values you don't know about yet. Make sure to always
1851
- * check the values of enums you encounter in the manifest.
1852
- *
1853
- * @default false
1097
+ * Expand the selection to upstream/downstream stacks.
1098
+ * @default ExpandStackSelection.None only select the specified/matched stacks
1854
1099
  */
1855
- readonly skipEnumCheck?: boolean;
1100
+ expand?: ExpandStackSelection;
1856
1101
  /**
1857
- * Topologically sort all artifacts
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.
1858
1104
  *
1859
- * This parameter is only respected by the constructor of `CloudAssembly`. The
1860
- * property lives here for backwards compatibility reasons.
1105
+ * Note that actions can still throw if a stack selection result is empty,
1106
+ * but the assembly contains stacks in principle.
1861
1107
  *
1862
1108
  * @default true
1863
1109
  */
1864
- readonly topoSort?: boolean;
1110
+ failOnEmpty?: boolean;
1865
1111
  }
1866
- declare class Manifest {
1112
+ /**
1113
+ * The current action being performed by the CLI. 'none' represents the absence of an action.
1114
+ */
1115
+ export type ToolkitAction = "assembly" | "bootstrap" | "synth" | "list" | "diff" | "deploy" | "rollback" | "watch" | "destroy" | "doctor" | "gc" | "import" | "metadata" | "init" | "migrate";
1116
+ /**
1117
+ * The reporting level of the message.
1118
+ * All messages are always reported, it's up to the IoHost to decide what to log.
1119
+ */
1120
+ export type IoMessageLevel = "error" | "result" | "warn" | "info" | "debug" | "trace";
1121
+ /**
1122
+ * A valid message code.
1123
+ */
1124
+ export type IoMessageCode = `CDK_${string}_${"E" | "W" | "I"}${number}${number}${number}${number}`;
1125
+ /**
1126
+ * An IO message emitted.
1127
+ */
1128
+ export interface IoMessage<T> {
1867
1129
  /**
1868
- * Validates and saves the cloud assembly manifest to file.
1869
- *
1870
- * @param manifest - manifest.
1871
- * @param filePath - output file path.
1130
+ * The time the message was emitted.
1872
1131
  */
1873
- static saveAssemblyManifest(manifest: AssemblyManifest, filePath: string): void;
1132
+ readonly time: Date;
1874
1133
  /**
1875
- * Load and validates the cloud assembly manifest from file.
1134
+ * The recommended log level of the message.
1876
1135
  *
1877
- * @param filePath - path to the manifest file.
1136
+ * This is an indicative level and should not be used to explicitly match messages, instead match the `code`.
1137
+ * The level of a message may change without notice.
1878
1138
  */
1879
- static loadAssemblyManifest(filePath: string, options?: LoadManifestOptions): AssemblyManifest;
1139
+ readonly level: IoMessageLevel;
1880
1140
  /**
1881
- * Validates and saves the asset manifest to file.
1882
- *
1883
- * @param manifest - manifest.
1884
- * @param filePath - output file path.
1141
+ * The action that triggered the message.
1885
1142
  */
1886
- static saveAssetManifest(manifest: AssetManifest, filePath: string): void;
1143
+ readonly action: ToolkitAction;
1887
1144
  /**
1888
- * Load and validates the asset manifest from file.
1145
+ * A short message code uniquely identifying a message type using the format CDK_[CATEGORY]_[E/W/I][0000-9999].
1889
1146
  *
1890
- * @param filePath - path to the manifest file.
1891
- */
1892
- static loadAssetManifest(filePath: string): AssetManifest;
1893
- /**
1894
- * Validates and saves the integ manifest to file.
1147
+ * The level indicator follows these rules:
1148
+ * - 'E' for error level messages
1149
+ * - 'W' for warning level messages
1150
+ * - 'I' for info/debug/trace level messages
1895
1151
  *
1896
- * @param manifest - manifest.
1897
- * @param filePath - output file path.
1898
- */
1899
- static saveIntegManifest(manifest: IntegManifest, filePath: string): void;
1900
- /**
1901
- * Load and validates the integ manifest from file.
1152
+ * Codes ending in 000 0 are generic messages, while codes ending in 0001-9999 are specific to a particular message.
1153
+ * The following are examples of valid and invalid message codes:
1154
+ * ```ts
1155
+ * 'CDK_ASSETS_I0000' // valid: generic assets info message
1156
+ * 'CDK_TOOLKIT_E0002' // valid: specific toolkit error message
1157
+ * 'CDK_SDK_W0023' // valid: specific sdk warning message
1158
+ * ```
1902
1159
  *
1903
- * @param filePath - path to the manifest file.
1904
- */
1905
- static loadIntegManifest(filePath: string): IntegManifest;
1906
- /**
1907
- * Fetch the current schema version number.
1160
+ * @see https://github.com/aws/aws-cdk-cli/blob/main/packages/%40aws-cdk/toolkit-lib/CODE_REGISTRY.md
1908
1161
  */
1909
- static version(): string;
1162
+ readonly code: IoMessageCode;
1910
1163
  /**
1911
- * Return the CLI version that supports this Cloud Assembly Schema version
1164
+ * The message text.
1165
+ * This is safe to print to an end-user.
1912
1166
  */
1913
- static cliVersion(): string | undefined;
1167
+ readonly message: string;
1914
1168
  /**
1915
- * Deprecated
1916
- * @deprecated use `saveAssemblyManifest()`
1169
+ * Identifies the message span, this message belongs to.
1170
+ *
1171
+ * A message span, groups multiple messages together that semantically related to the same operation.
1172
+ * This is an otherwise meaningless identifier.
1173
+ *
1174
+ * A message without a `spanId`, does not belong to a span.
1917
1175
  */
1918
- static save(manifest: AssemblyManifest, filePath: string): void;
1176
+ readonly span?: string;
1919
1177
  /**
1920
- * Deprecated
1921
- * @deprecated use `loadAssemblyManifest()`
1178
+ * The data attached to the message.
1922
1179
  */
1923
- static load(filePath: string): AssemblyManifest;
1924
- private static validate;
1925
- private static saveManifest;
1926
- private static loadManifest;
1180
+ readonly data: T;
1181
+ }
1182
+ /**
1183
+ * An IO request emitted.
1184
+ */
1185
+ export interface IoRequest<T, U> extends IoMessage<T> {
1927
1186
  /**
1928
- * This requires some explaining...
1929
- *
1930
- * We previously used `{ Key, Value }` for the object that represents a stack tag. (Notice the casing)
1931
- * @link https://github.com/aws/aws-cdk/blob/v1.27.0/packages/aws-cdk/lib/api/cxapp/stacks.ts#L427.
1932
- *
1933
- * When that object moved to this package, it had to be JSII compliant, which meant the property
1934
- * names must be `camelCased`, and not `PascalCased`. This meant it no longer matches the structure in the `manifest.json` file.
1935
- * In order to support current manifest files, we have to translate the `PascalCased` representation to the new `camelCased` one.
1936
- *
1937
- * Note that the serialization itself still writes `PascalCased` because it relates to how CloudFormation expects it.
1938
- *
1939
- * Ideally, we would start writing the `camelCased` and translate to how CloudFormation expects it when needed. But this requires nasty
1940
- * backwards-compatibility code and it just doesn't seem to be worth the effort.
1187
+ * The default response that will be used if no data is returned.
1941
1188
  */
1942
- private static patchStackTagsOnRead;
1189
+ readonly defaultResponse: U;
1190
+ }
1191
+ export interface IIoHost {
1943
1192
  /**
1944
- * Validates that `assumeRoleAdditionalOptions` doesn't contain nor `ExternalId` neither `RoleArn`, as they
1945
- * should have dedicated properties preceding this (e.g `assumeRoleArn` and `assumeRoleExternalId`).
1193
+ * Notifies the host of a message.
1194
+ * The caller waits until the notification completes.
1946
1195
  */
1947
- private static validateAssumeRoleAdditionalOptions;
1196
+ notify(msg: IoMessage<unknown>): Promise<void>;
1948
1197
  /**
1949
- * See explanation on `patchStackTagsOnRead`
1198
+ * Notifies the host of a message that requires a response.
1950
1199
  *
1951
- * Translate stack tags metadata if it has the "right" casing.
1952
- */
1953
- private static patchStackTagsOnWrite;
1954
- /**
1955
- * Recursively replace stack tags in the stack metadata
1200
+ * If the host does not return a response the suggested
1201
+ * default response from the input message will be used.
1956
1202
  */
1957
- private static replaceStackTags;
1958
- private constructor();
1203
+ requestResponse<T, U>(msg: IoRequest<T, U>): Promise<U>;
1959
1204
  }
1960
1205
  export interface BootstrapEnvironmentProgress {
1961
1206
  /**
@@ -2022,23 +1267,6 @@ declare class DestinationIdentifier {
2022
1267
  */
2023
1268
  toString(): string;
2024
1269
  }
2025
- /**
2026
- * Different types of permission related changes in a diff
2027
- */
2028
- export declare enum PermissionChangeType {
2029
- /**
2030
- * No permission changes
2031
- */
2032
- NONE = "none",
2033
- /**
2034
- * Permissions are broadening
2035
- */
2036
- BROADENING = "broadening",
2037
- /**
2038
- * Permissions are changed but not broadening
2039
- */
2040
- NON_BROADENING = "non-broadening"
2041
- }
2042
1270
  /**
2043
1271
  * Assembly data returned in the payload of an IO Message.
2044
1272
  */
@@ -2134,31 +1362,35 @@ export interface ContextProviderMessageSource {
2134
1362
  */
2135
1363
  readonly provider: string;
2136
1364
  }
2137
- export interface StackDeployProgress {
1365
+ /**
1366
+ * Different types of permission related changes in a diff
1367
+ */
1368
+ export declare enum PermissionChangeType {
2138
1369
  /**
2139
- * The total number of stacks being deployed
1370
+ * No permission changes
2140
1371
  */
2141
- readonly total: number;
1372
+ NONE = "none",
2142
1373
  /**
2143
- * The count of the stack currently attempted to be deployed
2144
- *
2145
- * This is counting value, not an identifier.
1374
+ * Permissions are broadening
2146
1375
  */
2147
- readonly current: number;
1376
+ BROADENING = "broadening",
2148
1377
  /**
2149
- * The stack that's currently being deployed
1378
+ * Permissions are changed but not broadening
2150
1379
  */
2151
- readonly stack: CloudFormationStackArtifact;
1380
+ NON_BROADENING = "non-broadening"
2152
1381
  }
2153
1382
  /**
2154
- * Payload for a yes/no confirmation in deploy. Includes information on
2155
- * what kind of change is being made.
1383
+ * Output of the diff command
2156
1384
  */
2157
- export interface DeployConfirmationRequest extends ConfirmationRequest {
1385
+ export interface DiffResult extends Duration {
2158
1386
  /**
2159
- * The type of change being made to the IAM permissions.
1387
+ * Stack diff formatted as a string
2160
1388
  */
2161
- readonly permissionChangeType: PermissionChangeType;
1389
+ readonly formattedStackDiff: string;
1390
+ /**
1391
+ * Security diff formatted as a string
1392
+ */
1393
+ readonly formattedSecurityDiff: string;
2162
1394
  }
2163
1395
  export type DeployStackResult = SuccessfulDeployStackResult | NeedRollbackFirstDeployStackResult | ReplacementRequiresRollbackStackResult;
2164
1396
  /** Successfully deployed a stack */
@@ -2206,6 +1438,32 @@ export interface DeployConfirmationRequest extends ConfirmationRequest {
2206
1438
  */
2207
1439
  readonly permissionChangeType: PermissionChangeType;
2208
1440
  }
1441
+ export interface StackDeployProgress {
1442
+ /**
1443
+ * The total number of stacks being deployed
1444
+ */
1445
+ readonly total: number;
1446
+ /**
1447
+ * The count of the stack currently attempted to be deployed
1448
+ *
1449
+ * This is counting value, not an identifier.
1450
+ */
1451
+ readonly current: number;
1452
+ /**
1453
+ * The stack that's currently being deployed
1454
+ */
1455
+ readonly stack: CloudFormationStackArtifact;
1456
+ }
1457
+ /**
1458
+ * Payload for a yes/no confirmation in deploy. Includes information on
1459
+ * what kind of change is being made.
1460
+ */
1461
+ export interface DeployConfirmationRequest extends ConfirmationRequest {
1462
+ /**
1463
+ * The type of change being made to the IAM permissions.
1464
+ */
1465
+ readonly permissionChangeType: PermissionChangeType;
1466
+ }
2209
1467
  export interface BuildAsset {
2210
1468
  /**
2211
1469
  * The asset that is build
@@ -2257,7 +1515,7 @@ export interface StackDetails {
2257
1515
  dependencies: StackDependency[];
2258
1516
  }
2259
1517
  export interface StackDetailsPayload {
2260
- stacks: StackDetails[];
1518
+ readonly stacks: StackDetails[];
2261
1519
  }
2262
1520
  /**
2263
1521
  * An SDK logging trace.
@@ -2710,112 +1968,9 @@ export interface HotswapResult extends Duration, HotswapDeploymentDetails {
2710
1968
  */
2711
1969
  readonly hotswapped: boolean;
2712
1970
  }
2713
- /**
2714
- * Represents a general toolkit error in the AWS CDK Toolkit.
2715
- */
2716
- export declare class ToolkitError extends Error {
2717
- /**
2718
- * Determines if a given error is an instance of ToolkitError.
2719
- */
2720
- static isToolkitError(x: any): x is ToolkitError;
2721
- /**
2722
- * Determines if a given error is an instance of AuthenticationError.
2723
- */
2724
- static isAuthenticationError(x: any): x is AuthenticationError;
2725
- /**
2726
- * Determines if a given error is an instance of AssemblyError.
2727
- */
2728
- static isAssemblyError(x: any): x is AssemblyError;
2729
- /**
2730
- * Determines if a given error is an instance of AssemblyError.
2731
- */
2732
- static isContextProviderError(x: any): x is ContextProviderError;
2733
- /**
2734
- * An AssemblyError with an original error as cause
2735
- */
2736
- static withCause(message: string, error: unknown): ToolkitError;
2737
- /**
2738
- * The type of the error, defaults to "toolkit".
2739
- */
2740
- readonly type: string;
2741
- /**
2742
- * Denotes the source of the error as the toolkit.
2743
- */
2744
- readonly source: "toolkit" | "user";
2745
- /**
2746
- * The specific original cause of the error, if available
2747
- */
2748
- readonly cause?: unknown;
2749
- constructor(message: string, type?: string, cause?: unknown);
2750
- }
2751
- /**
2752
- * Represents an authentication-specific error in the AWS CDK Toolkit.
2753
- */
2754
- export declare class AuthenticationError extends ToolkitError {
2755
- /**
2756
- * Denotes the source of the error as user.
2757
- */
2758
- readonly source = "user";
2759
- constructor(message: string);
2760
- }
2761
- /**
2762
- * Represents an error causes by cloud assembly synthesis
2763
- *
2764
- * This includes errors thrown during app execution, as well as failing annotations.
2765
- */
2766
- export declare class AssemblyError extends ToolkitError {
2767
- /**
2768
- * An AssemblyError with an original error as cause
2769
- */
2770
- static withCause(message: string, error: unknown): AssemblyError;
2771
- /**
2772
- * An AssemblyError with a list of stacks as cause
2773
- */
2774
- static withStacks(message: string, stacks?: cxapi.CloudFormationStackArtifact[]): AssemblyError;
2775
- /**
2776
- * Denotes the source of the error as user.
2777
- */
2778
- readonly source = "user";
2779
- /**
2780
- * The stacks that caused the error, if available
2781
- *
2782
- * The `messages` property of each `cxapi.CloudFormationStackArtifact` will contain the respective errors.
2783
- * Absence indicates synthesis didn't fully complete.
2784
- */
2785
- readonly stacks?: cxapi.CloudFormationStackArtifact[];
2786
- private constructor();
2787
- }
2788
- /**
2789
- * Represents an error originating from a Context Provider
2790
- */
2791
- export declare class ContextProviderError extends ToolkitError {
2792
- /**
2793
- * Denotes the source of the error as user.
2794
- */
2795
- readonly source = "user";
2796
- constructor(message: string);
2797
- }
2798
- /**
2799
- * @deprecated
2800
- */
2801
- declare enum RequireApproval$1 {
2802
- /**
2803
- * Never require any security approvals
2804
- */
2805
- NEVER = "never",
2806
- /**
2807
- * Any security changes require an approval
2808
- */
2809
- ANY_CHANGE = "any-change",
2810
- /**
2811
- * Require approval only for changes that are access broadening
2812
- */
2813
- BROADENING = "broadening"
2814
- }
2815
1971
 
2816
1972
  export {
2817
1973
  MissingContext$1 as MissingContext,
2818
- RequireApproval$1 as RequireApproval,
2819
1974
  };
2820
1975
 
2821
1976
  export {};