@aws-cdk/toolkit-lib 1.28.0 → 1.29.1

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 (36) hide show
  1. package/build-info.json +2 -2
  2. package/db.json.gz +0 -0
  3. package/lib/actions/validate/index.d.ts +10 -0
  4. package/lib/actions/validate/index.js +1 -1
  5. package/lib/api/cloud-assembly/environment.js +16 -4
  6. package/lib/api/deployments/cfn-api.d.ts +24 -6
  7. package/lib/api/deployments/cfn-api.js +81 -33
  8. package/lib/api/hotswap/hotswap-deployments.js +3 -1
  9. package/lib/api/hotswap/lambda-functions.js +3 -33
  10. package/lib/api/io/private/index.d.ts +1 -0
  11. package/lib/api/io/private/index.js +2 -1
  12. package/lib/api/io/private/messages.d.ts +1 -0
  13. package/lib/api/io/private/messages.js +8 -4
  14. package/lib/api/io/private/span.d.ts +6 -0
  15. package/lib/api/io/private/span.js +10 -3
  16. package/lib/api/validate/validate-formatting.d.ts +5 -0
  17. package/lib/api/validate/validate-formatting.js +127 -0
  18. package/lib/api/work-graph/work-graph-builder.d.ts +3 -0
  19. package/lib/api/work-graph/work-graph-builder.js +38 -3
  20. package/lib/api/work-graph/work-graph-types.d.ts +19 -7
  21. package/lib/api/work-graph/work-graph-types.js +1 -1
  22. package/lib/api/work-graph/work-graph.d.ts +2 -1
  23. package/lib/api/work-graph/work-graph.js +8 -1
  24. package/lib/index_bg.wasm +0 -0
  25. package/lib/payloads/hotswap.d.ts +8 -1
  26. package/lib/payloads/hotswap.js +1 -1
  27. package/lib/private/tools.d.ts +2 -0
  28. package/lib/private/tools.js +120 -0
  29. package/lib/private/tools.js.plain +21 -0
  30. package/lib/toolkit/toolkit.d.ts +2 -1
  31. package/lib/toolkit/toolkit.js +103 -19
  32. package/lib/util/index.d.ts +0 -1
  33. package/lib/util/index.js +1 -2
  34. package/package.json +13 -11
  35. package/lib/util/archive.d.ts +0 -2
  36. package/lib/util/archive.js +0 -86
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __commonJS = (cb, mod) => function __require() {
4
+ try {
5
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
+ } catch (e) {
7
+ throw mod = 0, e;
8
+ }
9
+ };
10
+
11
+ // ../private-tools/lib/zip/index.js
12
+ var require_zip = __commonJS({
13
+ "../private-tools/lib/zip/index.js"(exports2) {
14
+ "use strict";
15
+ Object.defineProperty(exports2, "__esModule", { value: true });
16
+ exports2.zipDirectory = zipDirectory;
17
+ exports2.zipString = zipString;
18
+ var fs_1 = require("fs");
19
+ var path = require("path");
20
+ var stream_1 = require("stream");
21
+ var fast_glob_1 = require("fast-glob");
22
+ var archiver = require("archiver");
23
+ async function zipDirectory(directory, outputFile, eventEmitter = () => {
24
+ }) {
25
+ const temporaryOutputFile = `${outputFile}.${randomString()}._tmp`;
26
+ await writeZipFile(directory, temporaryOutputFile);
27
+ await moveIntoPlace(temporaryOutputFile, outputFile, eventEmitter);
28
+ }
29
+ function zipString(fileName, rawString) {
30
+ return new Promise((resolve, reject) => {
31
+ const buffers = [];
32
+ const converter = new stream_1.Writable();
33
+ converter._write = (chunk, _, callback) => {
34
+ buffers.push(chunk);
35
+ process.nextTick(callback);
36
+ };
37
+ converter.on("finish", () => resolve(Buffer.concat(buffers)));
38
+ const archive = archiver("zip");
39
+ archive.on("error", reject);
40
+ archive.pipe(converter);
41
+ archive.append(rawString, {
42
+ name: fileName,
43
+ date: /* @__PURE__ */ new Date("1980-01-01T00:00:00.000Z")
44
+ });
45
+ void archive.finalize();
46
+ });
47
+ }
48
+ function writeZipFile(directory, outputFile) {
49
+ return new Promise(async (ok, fail) => {
50
+ const globOptions = {
51
+ dot: true,
52
+ onlyFiles: true,
53
+ followSymbolicLinks: true,
54
+ cwd: directory
55
+ };
56
+ const files = (0, fast_glob_1.globSync)("**", globOptions);
57
+ const output = (0, fs_1.createWriteStream)(outputFile);
58
+ const archive = archiver("zip");
59
+ archive.on("warning", fail);
60
+ archive.on("error", fail);
61
+ output.once("close", ok);
62
+ archive.pipe(output);
63
+ for (const file of files) {
64
+ const fullPath = path.resolve(directory, file);
65
+ const [data, stat] = await Promise.all([fs_1.promises.readFile(fullPath), fs_1.promises.stat(fullPath)]);
66
+ archive.append(data, {
67
+ name: file,
68
+ date: /* @__PURE__ */ new Date("1980-01-01T00:00:00.000Z"),
69
+ // reset dates to get the same hash for the same content
70
+ mode: stat.mode
71
+ });
72
+ }
73
+ await archive.finalize();
74
+ });
75
+ }
76
+ async function moveIntoPlace(source, target, eventEmitter) {
77
+ let delay = 100;
78
+ let attempts = 5;
79
+ while (true) {
80
+ try {
81
+ await fs_1.promises.rename(source, target);
82
+ return;
83
+ } catch (e) {
84
+ if (e.code !== "EPERM" || attempts-- <= 0) {
85
+ throw e;
86
+ }
87
+ eventEmitter(e.message);
88
+ await sleep(Math.floor(Math.random() * delay));
89
+ delay *= 2;
90
+ }
91
+ }
92
+ }
93
+ function sleep(ms) {
94
+ return new Promise((ok) => setTimeout(ok, ms));
95
+ }
96
+ function randomString() {
97
+ return Math.random().toString(36).replace(/[^a-z0-9]+/g, "");
98
+ }
99
+ }
100
+ });
101
+
102
+ // lib/private/tools.js
103
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
104
+ if (k2 === void 0) k2 = k;
105
+ var desc = Object.getOwnPropertyDescriptor(m, k);
106
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
107
+ desc = { enumerable: true, get: function() {
108
+ return m[k];
109
+ } };
110
+ }
111
+ Object.defineProperty(o, k2, desc);
112
+ }) : (function(o, m, k, k2) {
113
+ if (k2 === void 0) k2 = k;
114
+ o[k2] = m[k];
115
+ }));
116
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
117
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
118
+ };
119
+ Object.defineProperty(exports, "__esModule", { value: true });
120
+ __exportStar(require_zip(), exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // ~~ Generated by projen. To modify, edit .projenrc.js and run "yarn projen".
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ /* eslint-disable import/no-extraneous-dependencies -- re-exports the build-time-only @aws-cdk/private-tools package */
19
+ /* eslint-disable no-restricted-imports -- this shim is the single sanctioned entry point to @aws-cdk/private-tools */
20
+ __exportStar(require("@aws-cdk/private-tools/lib/zip"), exports);
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsOEVBQThFOzs7Ozs7Ozs7Ozs7Ozs7O0FBRTlFLHVIQUF1SDtBQUN2SCxzSEFBc0g7QUFDdEgsaUVBQStDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gfn4gR2VuZXJhdGVkIGJ5IHByb2plbi4gVG8gbW9kaWZ5LCBlZGl0IC5wcm9qZW5yYy5qcyBhbmQgcnVuIFwieWFybiBwcm9qZW5cIi5cblxuLyogZXNsaW50LWRpc2FibGUgaW1wb3J0L25vLWV4dHJhbmVvdXMtZGVwZW5kZW5jaWVzIC0tIHJlLWV4cG9ydHMgdGhlIGJ1aWxkLXRpbWUtb25seSBAYXdzLWNkay9wcml2YXRlLXRvb2xzIHBhY2thZ2UgKi9cbi8qIGVzbGludC1kaXNhYmxlIG5vLXJlc3RyaWN0ZWQtaW1wb3J0cyAtLSB0aGlzIHNoaW0gaXMgdGhlIHNpbmdsZSBzYW5jdGlvbmVkIGVudHJ5IHBvaW50IHRvIEBhd3MtY2RrL3ByaXZhdGUtdG9vbHMgKi9cbmV4cG9ydCAqIGZyb20gJ0Bhd3MtY2RrL3ByaXZhdGUtdG9vbHMvbGliL3ppcCc7XG4iXX0=
@@ -79,7 +79,7 @@ export interface ToolkitOptions {
79
79
  * Names of toolkit features that are still under development, and may change in
80
80
  * the future.
81
81
  */
82
- export type UnstableFeature = 'refactor' | 'orphan' | 'flags' | 'publish-assets' | 'diagnose';
82
+ export type UnstableFeature = 'refactor' | 'orphan' | 'flags' | 'publish-assets' | 'diagnose' | 'validate';
83
83
  /**
84
84
  * The AWS CDK Programmatic Toolkit
85
85
  */
@@ -156,6 +156,7 @@ export declare class Toolkit extends CloudAssemblySourceBuilder {
156
156
  * from the cloud assembly output directory.
157
157
  */
158
158
  validate(cx: ICloudAssemblySource, options?: ValidateOptions): Promise<ValidateResult>;
159
+ private validateOnline;
159
160
  /**
160
161
  * Deploy Action
161
162
  *