@aws-cdk/cloud-assembly-api 0.0.1 → 2.0.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 (114) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +15 -41
  3. package/design/NESTED_ASSEMBLIES.md +93 -0
  4. package/lib/artifacts/asset-manifest-artifact.d.ts +46 -0
  5. package/lib/artifacts/asset-manifest-artifact.js +66 -0
  6. package/lib/artifacts/cloudformation-artifact.d.ts +147 -0
  7. package/lib/artifacts/cloudformation-artifact.js +94 -0
  8. package/lib/artifacts/nested-cloud-assembly-artifact-aug.d.ts +1 -0
  9. package/lib/artifacts/nested-cloud-assembly-artifact-aug.js +19 -0
  10. package/lib/artifacts/nested-cloud-assembly-artifact.d.ts +45 -0
  11. package/lib/artifacts/nested-cloud-assembly-artifact.js +56 -0
  12. package/lib/artifacts/tree-cloud-artifact.d.ts +25 -0
  13. package/lib/artifacts/tree-cloud-artifact.js +49 -0
  14. package/lib/assets.d.ts +33 -0
  15. package/lib/assets.js +37 -0
  16. package/lib/bootstrap.d.ts +7 -0
  17. package/lib/bootstrap.js +12 -0
  18. package/lib/cloud-artifact-aug.d.ts +1 -0
  19. package/lib/cloud-artifact-aug.js +29 -0
  20. package/lib/cloud-artifact.d.ts +73 -0
  21. package/lib/cloud-artifact.js +94 -0
  22. package/lib/cloud-assembly.d.ts +266 -0
  23. package/lib/cloud-assembly.js +374 -0
  24. package/lib/context/ami.d.ts +4 -0
  25. package/lib/context/ami.js +3 -0
  26. package/lib/context/availability-zones.d.ts +12 -0
  27. package/lib/context/availability-zones.js +12 -0
  28. package/lib/context/endpoint-service-availability-zones.d.ts +22 -0
  29. package/lib/context/endpoint-service-availability-zones.js +5 -0
  30. package/lib/context/generic.d.ts +4 -0
  31. package/lib/context/generic.js +8 -0
  32. package/lib/context/key.d.ts +9 -0
  33. package/lib/context/key.js +3 -0
  34. package/lib/context/load-balancer.d.ts +63 -0
  35. package/lib/context/load-balancer.js +22 -0
  36. package/lib/context/security-group.d.ts +15 -0
  37. package/lib/context/security-group.js +3 -0
  38. package/lib/context/vpc.d.ts +152 -0
  39. package/lib/context/vpc.js +18 -0
  40. package/lib/environment.d.ts +24 -0
  41. package/lib/environment.js +40 -0
  42. package/lib/index.d.ts +21 -0
  43. package/lib/index.js +38 -0
  44. package/lib/metadata.d.ts +27 -0
  45. package/lib/metadata.js +14 -0
  46. package/lib/placeholders.d.ts +66 -0
  47. package/lib/placeholders.js +90 -0
  48. package/lib/private/error.d.ts +1 -0
  49. package/lib/private/error.js +47 -0
  50. package/lib/private/toposort.d.ts +11 -0
  51. package/lib/private/toposort.js +35 -0
  52. package/node_modules/jsonschema/.editorconfig +10 -0
  53. package/node_modules/jsonschema/LICENSE +21 -0
  54. package/node_modules/jsonschema/README.md +421 -0
  55. package/node_modules/jsonschema/lib/attribute.js +978 -0
  56. package/node_modules/jsonschema/lib/helpers.js +390 -0
  57. package/node_modules/jsonschema/lib/index.d.ts +142 -0
  58. package/node_modules/jsonschema/lib/index.js +15 -0
  59. package/node_modules/jsonschema/lib/scan.js +75 -0
  60. package/node_modules/jsonschema/lib/validator.js +336 -0
  61. package/node_modules/jsonschema/package.json +42 -0
  62. package/node_modules/semver/LICENSE +15 -0
  63. package/node_modules/semver/README.md +664 -0
  64. package/node_modules/semver/bin/semver.js +191 -0
  65. package/node_modules/semver/classes/comparator.js +143 -0
  66. package/node_modules/semver/classes/index.js +7 -0
  67. package/node_modules/semver/classes/range.js +557 -0
  68. package/node_modules/semver/classes/semver.js +333 -0
  69. package/node_modules/semver/functions/clean.js +8 -0
  70. package/node_modules/semver/functions/cmp.js +54 -0
  71. package/node_modules/semver/functions/coerce.js +62 -0
  72. package/node_modules/semver/functions/compare-build.js +9 -0
  73. package/node_modules/semver/functions/compare-loose.js +5 -0
  74. package/node_modules/semver/functions/compare.js +7 -0
  75. package/node_modules/semver/functions/diff.js +60 -0
  76. package/node_modules/semver/functions/eq.js +5 -0
  77. package/node_modules/semver/functions/gt.js +5 -0
  78. package/node_modules/semver/functions/gte.js +5 -0
  79. package/node_modules/semver/functions/inc.js +21 -0
  80. package/node_modules/semver/functions/lt.js +5 -0
  81. package/node_modules/semver/functions/lte.js +5 -0
  82. package/node_modules/semver/functions/major.js +5 -0
  83. package/node_modules/semver/functions/minor.js +5 -0
  84. package/node_modules/semver/functions/neq.js +5 -0
  85. package/node_modules/semver/functions/parse.js +18 -0
  86. package/node_modules/semver/functions/patch.js +5 -0
  87. package/node_modules/semver/functions/prerelease.js +8 -0
  88. package/node_modules/semver/functions/rcompare.js +5 -0
  89. package/node_modules/semver/functions/rsort.js +5 -0
  90. package/node_modules/semver/functions/satisfies.js +12 -0
  91. package/node_modules/semver/functions/sort.js +5 -0
  92. package/node_modules/semver/functions/valid.js +8 -0
  93. package/node_modules/semver/index.js +91 -0
  94. package/node_modules/semver/internal/constants.js +37 -0
  95. package/node_modules/semver/internal/debug.js +11 -0
  96. package/node_modules/semver/internal/identifiers.js +29 -0
  97. package/node_modules/semver/internal/lrucache.js +42 -0
  98. package/node_modules/semver/internal/parse-options.js +17 -0
  99. package/node_modules/semver/internal/re.js +223 -0
  100. package/node_modules/semver/package.json +78 -0
  101. package/node_modules/semver/preload.js +4 -0
  102. package/node_modules/semver/range.bnf +16 -0
  103. package/node_modules/semver/ranges/gtr.js +6 -0
  104. package/node_modules/semver/ranges/intersects.js +9 -0
  105. package/node_modules/semver/ranges/ltr.js +6 -0
  106. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  107. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  108. package/node_modules/semver/ranges/min-version.js +63 -0
  109. package/node_modules/semver/ranges/outside.js +82 -0
  110. package/node_modules/semver/ranges/simplify.js +49 -0
  111. package/node_modules/semver/ranges/subset.js +249 -0
  112. package/node_modules/semver/ranges/to-comparators.js +10 -0
  113. package/node_modules/semver/ranges/valid.js +13 -0
  114. package/package.json +80 -6
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudArtifact = void 0;
4
+ const cxschema = require("@aws-cdk/cloud-assembly-schema");
5
+ const metadata_1 = require("./metadata");
6
+ const error_1 = require("./private/error");
7
+ /**
8
+ * Represents an artifact within a cloud assembly.
9
+ */
10
+ class CloudArtifact {
11
+ /**
12
+ * Returns a subclass of `CloudArtifact` based on the artifact type defined in the artifact manifest.
13
+ *
14
+ * @param assembly - The cloud assembly from which to load the artifact
15
+ * @param id - The artifact ID
16
+ * @param artifact - The artifact manifest
17
+ * @returns the `CloudArtifact` that matches the artifact type or `undefined` if it's an artifact type that is unrecognized by this module.
18
+ */
19
+ static fromManifest(assembly, id, artifact) {
20
+ // Implementation is defined in a separate file to break cyclic dependencies
21
+ void (assembly), void (id), void (artifact);
22
+ throw new error_1.CloudAssemblyError('Implementation not overridden yet');
23
+ }
24
+ constructor(assembly, id, manifest) {
25
+ this.assembly = assembly;
26
+ this.id = id;
27
+ this.manifest = manifest;
28
+ this.messages = this.renderMessages();
29
+ this._dependencyIDs = manifest.dependencies || [];
30
+ }
31
+ /**
32
+ * Returns all the artifacts that this artifact depends on.
33
+ */
34
+ get dependencies() {
35
+ if (this._deps) {
36
+ return this._deps;
37
+ }
38
+ this._deps = this._dependencyIDs.map(id => {
39
+ const dep = this.assembly.tryGetArtifact(id);
40
+ if (!dep) {
41
+ throw new error_1.CloudAssemblyError(`Artifact ${this.id} depends on non-existing artifact ${id}`);
42
+ }
43
+ return dep;
44
+ });
45
+ return this._deps;
46
+ }
47
+ /**
48
+ * @returns all the metadata entries of a specific type in this artifact.
49
+ */
50
+ findMetadataByType(type) {
51
+ const result = new Array();
52
+ for (const path of Object.keys(this.manifest.metadata || {})) {
53
+ for (const entry of (this.manifest.metadata || {})[path]) {
54
+ if (entry.type === type) {
55
+ result.push({ path, ...entry });
56
+ }
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ renderMessages() {
62
+ const messages = new Array();
63
+ for (const [id, metadata] of Object.entries(this.manifest.metadata || {})) {
64
+ for (const entry of metadata) {
65
+ let level;
66
+ switch (entry.type) {
67
+ case cxschema.ArtifactMetadataEntryType.WARN:
68
+ level = metadata_1.SynthesisMessageLevel.WARNING;
69
+ break;
70
+ case cxschema.ArtifactMetadataEntryType.ERROR:
71
+ level = metadata_1.SynthesisMessageLevel.ERROR;
72
+ break;
73
+ case cxschema.ArtifactMetadataEntryType.INFO:
74
+ level = metadata_1.SynthesisMessageLevel.INFO;
75
+ break;
76
+ default:
77
+ continue;
78
+ }
79
+ messages.push({ level, entry, id });
80
+ }
81
+ }
82
+ return messages;
83
+ }
84
+ /**
85
+ * An identifier that shows where this artifact is located in the tree
86
+ * of nested assemblies, based on their manifests. Defaults to the normal
87
+ * id. Should only be used in user interfaces.
88
+ */
89
+ get hierarchicalId() {
90
+ return this.manifest.displayName ?? this.id;
91
+ }
92
+ }
93
+ exports.CloudArtifact = CloudArtifact;
94
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xvdWQtYXJ0aWZhY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJjbG91ZC1hcnRpZmFjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwyREFBMkQ7QUFHM0QseUNBQW1EO0FBQ25ELDJDQUFxRDtBQThCckQ7O0dBRUc7QUFDSCxNQUFhLGFBQWE7SUFDeEI7Ozs7Ozs7T0FPRztJQUNJLE1BQU0sQ0FBQyxZQUFZLENBQUMsUUFBdUIsRUFBRSxFQUFVLEVBQUUsUUFBbUM7UUFDakcsNEVBQTRFO1FBQzVFLEtBQUksQ0FBQyxRQUFRLENBQUMsRUFBRSxLQUFJLENBQUMsRUFBRSxDQUFDLEVBQUUsS0FBSSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQ3pDLE1BQU0sSUFBSSwwQkFBa0IsQ0FBQyxtQ0FBbUMsQ0FBQyxDQUFDO0lB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oZXJlIHRoaXMgYXJ0aWZhY3QgaXMgbG9jYXRlZCBpbiB0aGUgdHJlZVxuICAgKiBvZiBuZXN0ZWQgYXNzZW1ibGllcywgYmFzZWQgb24gdGhlaXIgbWFuaWZlc3RzLiBEZWZhdWx0cyB0byB0aGUgbm9ybWFsXG4gICAqIGlkLiBTaG91bGQgb25seSBiZSB1c2VkIGluIHVzZXIgaW50ZXJmYWNlcy5cbiAgICovXG4gIHB1YmxpYyBnZXQgaGllcmFyY2hpY2FsSWQoKTogc3RyaW5nIHtcbiAgICByZXR1cm4gdGhpcy5tYW5pZmVzdC5kaXNwbGF5TmFtZSA/PyB0aGlzLmlkO1xuICB9XG59XG4iXX0=
@@ -0,0 +1,266 @@
1
+ import type { ICloudAssembly } from '@aws-cdk/cloud-assembly-schema';
2
+ import * as cxschema from '@aws-cdk/cloud-assembly-schema/lib';
3
+ import { CloudFormationStackArtifact } from './artifacts/cloudformation-artifact';
4
+ import { NestedCloudAssemblyArtifact } from './artifacts/nested-cloud-assembly-artifact';
5
+ import { TreeCloudArtifact } from './artifacts/tree-cloud-artifact';
6
+ import { CloudArtifact } from './cloud-artifact';
7
+ /**
8
+ * Represents a deployable cloud application.
9
+ */
10
+ export declare class CloudAssembly implements ICloudAssembly {
11
+ /**
12
+ * Return whether the given object is a CloudAssembly.
13
+ *
14
+ * We do attribute detection since we can't reliably use 'instanceof'.
15
+ */
16
+ static isCloudAssembly(x: any): x is CloudAssembly;
17
+ /**
18
+ * Cleans up any temporary assembly directories that got created in this process
19
+ *
20
+ * If a Cloud Assembly is emitted to a temporary directory, its directory gets
21
+ * added to a list. This function iterates over that list and deletes each
22
+ * directory in it, to free up disk space.
23
+ *
24
+ * This function will normally be called automatically during Node process
25
+ * exit and so you don't need to call this. However, some test environments do
26
+ * not properly trigger Node's `exit` event. Notably: Jest does not trigger
27
+ * the `exit` event (<https://github.com/jestjs/jest/issues/10927>).
28
+ *
29
+ * ## Cleaning up temporary directories in jest
30
+ *
31
+ * For Jest, you have to make sure this function is called at the end of the
32
+ * test suite instead:
33
+ *
34
+ * ```js
35
+ * import { CloudAssembly } from 'aws-cdk-lib/cx-api';
36
+ *
37
+ * afterAll(CloudAssembly.cleanupTemporaryDirectories);
38
+ * ```
39
+ *
40
+ * Alternatively, you can use the `setupFilesAfterEnv` feature and use a
41
+ * provided helper script to automatically inject the above into every
42
+ * test file, so you don't have to do it by hand.
43
+ *
44
+ * ```
45
+ * $ npx jest --setupFilesAfterEnv aws-cdk-lib/testhelpers/jest-autoclean
46
+ * ```
47
+ *
48
+ * Or put the following into `jest.config.js`:
49
+ *
50
+ * ```js
51
+ * module.exports = {
52
+ * // ...
53
+ * setupFilesAfterEnv: ['aws-cdk-lib/testhelpers/jest-cleanup'],
54
+ * };
55
+ * ```
56
+ */
57
+ static cleanupTemporaryDirectories(): void;
58
+ /**
59
+ * The root directory of the cloud assembly.
60
+ */
61
+ readonly directory: string;
62
+ /**
63
+ * The schema version of the assembly manifest.
64
+ */
65
+ readonly version: string;
66
+ /**
67
+ * All artifacts included in this assembly.
68
+ */
69
+ readonly artifacts: CloudArtifact[];
70
+ /**
71
+ * Runtime information such as module versions used to synthesize this assembly.
72
+ */
73
+ readonly runtime: cxschema.RuntimeInfo;
74
+ /**
75
+ * The raw assembly manifest.
76
+ */
77
+ readonly manifest: cxschema.AssemblyManifest;
78
+ /**
79
+ * Reads a cloud assembly from the specified directory.
80
+ * @param directory - The root directory of the assembly.
81
+ */
82
+ constructor(directory: string, loadOptions?: cxschema.LoadManifestOptions);
83
+ /**
84
+ * Attempts to find an artifact with a specific identity.
85
+ * @returns A `CloudArtifact` object or `undefined` if the artifact does not exist in this assembly.
86
+ * @param id - The artifact ID
87
+ */
88
+ tryGetArtifact(id: string): CloudArtifact | undefined;
89
+ /**
90
+ * Returns a CloudFormation stack artifact from this assembly.
91
+ *
92
+ * Will only search the current assembly.
93
+ *
94
+ * @param stackName - the name of the CloudFormation stack.
95
+ * @throws if there is no stack artifact by that name
96
+ * @throws if there is more than one stack with the same stack name. You can
97
+ * use `getStackArtifact(stack.artifactId)` instead.
98
+ * @returns a `CloudFormationStackArtifact` object.
99
+ */
100
+ getStackByName(stackName: string): CloudFormationStackArtifact;
101
+ /**
102
+ * Returns a CloudFormation stack artifact by name from this assembly.
103
+ * @deprecated renamed to `getStackByName` (or `getStackArtifact(id)`)
104
+ */
105
+ getStack(stackName: string): CloudFormationStackArtifact;
106
+ /**
107
+ * Returns a CloudFormation stack artifact from this assembly.
108
+ *
109
+ * @param artifactId - the artifact id of the stack (can be obtained through `stack.artifactId`).
110
+ * @throws if there is no stack artifact with that id
111
+ * @returns a `CloudFormationStackArtifact` object.
112
+ */
113
+ getStackArtifact(artifactId: string): CloudFormationStackArtifact;
114
+ private tryGetArtifactRecursively;
115
+ /**
116
+ * Returns all the stacks, including the ones in nested assemblies
117
+ */
118
+ get stacksRecursively(): CloudFormationStackArtifact[];
119
+ /**
120
+ * Returns a nested assembly artifact.
121
+ *
122
+ * @param artifactId - The artifact ID of the nested assembly
123
+ */
124
+ getNestedAssemblyArtifact(artifactId: string): NestedCloudAssemblyArtifact;
125
+ /**
126
+ * Returns a nested assembly.
127
+ *
128
+ * @param artifactId - The artifact ID of the nested assembly
129
+ */
130
+ getNestedAssembly(artifactId: string): CloudAssembly;
131
+ /**
132
+ * Returns the tree metadata artifact from this assembly.
133
+ * @throws if there is no metadata artifact by that name
134
+ * @returns a `TreeCloudArtifact` object if there is one defined in the manifest, `undefined` otherwise.
135
+ */
136
+ tree(): TreeCloudArtifact | undefined;
137
+ /**
138
+ * @returns all the CloudFormation stack artifacts that are included in this assembly.
139
+ */
140
+ get stacks(): CloudFormationStackArtifact[];
141
+ /**
142
+ * The nested assembly artifacts in this assembly
143
+ */
144
+ get nestedAssemblies(): NestedCloudAssemblyArtifact[];
145
+ private validateDeps;
146
+ private renderArtifacts;
147
+ }
148
+ /**
149
+ * Construction properties for CloudAssemblyBuilder
150
+ */
151
+ export interface CloudAssemblyBuilderProps {
152
+ /**
153
+ * Use the given asset output directory
154
+ *
155
+ * @default - Same as the manifest outdir
156
+ */
157
+ readonly assetOutdir?: string;
158
+ /**
159
+ * If this builder is for a nested assembly, the parent assembly builder
160
+ *
161
+ * @default - This is a root assembly
162
+ */
163
+ readonly parentBuilder?: CloudAssemblyBuilder;
164
+ }
165
+ /**
166
+ * Can be used to build a cloud assembly.
167
+ */
168
+ export declare class CloudAssemblyBuilder {
169
+ /**
170
+ * The root directory of the resulting cloud assembly.
171
+ */
172
+ readonly outdir: string;
173
+ /**
174
+ * The directory where assets of this Cloud Assembly should be stored
175
+ */
176
+ readonly assetOutdir: string;
177
+ private readonly artifacts;
178
+ private readonly missing;
179
+ private readonly parentBuilder?;
180
+ /**
181
+ * Initializes a cloud assembly builder.
182
+ * @param outdir - The output directory, uses temporary directory if undefined
183
+ */
184
+ constructor(outdir?: string, props?: CloudAssemblyBuilderProps);
185
+ /**
186
+ * Adds an artifact into the cloud assembly.
187
+ * @param id - The ID of the artifact.
188
+ * @param manifest - The artifact manifest
189
+ */
190
+ addArtifact(id: string, manifest: cxschema.ArtifactManifest): void;
191
+ /**
192
+ * Reports that some context is missing in order for this cloud assembly to be fully synthesized.
193
+ * @param missing - Missing context information.
194
+ */
195
+ addMissing(missing: cxschema.MissingContext): void;
196
+ /**
197
+ * Finalizes the cloud assembly into the output directory returns a
198
+ * `CloudAssembly` object that can be used to inspect the assembly.
199
+ */
200
+ buildAssembly(options?: AssemblyBuildOptions): CloudAssembly;
201
+ /**
202
+ * Creates a nested cloud assembly
203
+ */
204
+ createNestedAssembly(artifactId: string, displayName: string): CloudAssemblyBuilder;
205
+ /**
206
+ * Delete the cloud assembly directory
207
+ */
208
+ delete(): void;
209
+ }
210
+ /**
211
+ * Backwards compatibility for when `RuntimeInfo`
212
+ * was defined here. This is necessary because its used as an input in the stable
213
+ * @aws-cdk/core library.
214
+ *
215
+ * @deprecated moved to package 'cloud-assembly-schema'
216
+ * @see core.ConstructNode.synth
217
+ */
218
+ export interface RuntimeInfo extends cxschema.RuntimeInfo {
219
+ }
220
+ /**
221
+ * Backwards compatibility for when `MetadataEntry`
222
+ * was defined here. This is necessary because its used as an input in the stable
223
+ * @aws-cdk/core library.
224
+ *
225
+ * @deprecated moved to package 'cloud-assembly-schema'
226
+ * @see core.ConstructNode.metadata
227
+ */
228
+ export interface MetadataEntry extends cxschema.MetadataEntry {
229
+ }
230
+ /**
231
+ * Backwards compatibility for when `MissingContext`
232
+ * was defined here. This is necessary because its used as an input in the stable
233
+ * @aws-cdk/core library.
234
+ *
235
+ * @deprecated moved to package 'cloud-assembly-schema'
236
+ * @see core.Stack.reportMissingContext
237
+ */
238
+ export interface MissingContext {
239
+ /**
240
+ * The missing context key.
241
+ */
242
+ readonly key: string;
243
+ /**
244
+ * The provider from which we expect this context key to be obtained.
245
+ *
246
+ * (This is the old untyped definition, which is necessary for backwards compatibility.
247
+ * See cxschema for a type definition.)
248
+ */
249
+ readonly provider: string;
250
+ /**
251
+ * A set of provider-specific options.
252
+ *
253
+ * (This is the old untyped definition, which is necessary for backwards compatibility.
254
+ * See cxschema for a type definition.)
255
+ */
256
+ readonly props: Record<string, any>;
257
+ }
258
+ export interface AssemblyBuildOptions {
259
+ /**
260
+ * Include the specified runtime information (module versions) in manifest.
261
+ * @default - if this option is not specified, runtime info will not be included
262
+ * @deprecated All template modifications that should result from this should
263
+ * have already been inserted into the template.
264
+ */
265
+ readonly runtimeInfo?: RuntimeInfo;
266
+ }