@aws-cdk/integ-runner 2.196.0 → 2.196.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.
- package/lib/cli.d.ts +1 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/engines/cdk-interface.d.ts +34 -99
- package/lib/engines/cdk-interface.d.ts.map +1 -0
- package/lib/engines/cdk-interface.js +1 -34
- package/lib/engines/toolkit-lib.d.ts +4 -12
- package/lib/engines/toolkit-lib.d.ts.map +1 -0
- package/lib/engines/toolkit-lib.js +100 -64
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +52 -0
- package/lib/logger.d.ts +1 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/runner/engine.d.ts +1 -0
- package/lib/runner/engine.d.ts.map +1 -0
- package/lib/runner/index.d.ts +1 -0
- package/lib/runner/index.d.ts.map +1 -0
- package/lib/runner/integ-test-runner.d.ts +1 -0
- package/lib/runner/integ-test-runner.d.ts.map +1 -0
- package/lib/runner/integ-test-runner.js +16 -15
- package/lib/runner/integ-test-suite.d.ts +1 -0
- package/lib/runner/integ-test-suite.d.ts.map +1 -0
- package/lib/runner/integ-test-suite.js +9 -3
- package/lib/runner/integration-tests.d.ts +1 -0
- package/lib/runner/integration-tests.d.ts.map +1 -0
- package/lib/runner/integration-tests.js +52 -1
- package/lib/runner/private/cloud-assembly.d.ts +1 -0
- package/lib/runner/private/cloud-assembly.d.ts.map +1 -0
- package/lib/runner/private/cloud-assembly.js +8 -2
- package/lib/runner/private/integ-manifest.d.ts +1 -0
- package/lib/runner/private/integ-manifest.d.ts.map +1 -0
- package/lib/runner/private/integ-manifest.js +11 -2
- package/lib/runner/runner-base.d.ts +1 -0
- package/lib/runner/runner-base.d.ts.map +1 -0
- package/lib/runner/runner-base.js +63 -13
- package/lib/runner/snapshot-test-runner.d.ts +1 -0
- package/lib/runner/snapshot-test-runner.d.ts.map +1 -0
- package/lib/runner/snapshot-test-runner.js +7 -4
- package/lib/unstable-features.d.ts +1 -0
- package/lib/unstable-features.d.ts.map +1 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +7 -2
- package/lib/workers/common.d.ts +1 -0
- package/lib/workers/common.d.ts.map +1 -0
- package/lib/workers/extract/extract_worker.d.ts +1 -0
- package/lib/workers/extract/extract_worker.d.ts.map +1 -0
- package/lib/workers/extract/extract_worker.js +2 -2
- package/lib/workers/extract/index.d.ts +1 -0
- package/lib/workers/extract/index.d.ts.map +1 -0
- package/lib/workers/extract/index.js +1844 -1742
- package/lib/workers/index.d.ts +1 -0
- package/lib/workers/index.d.ts.map +1 -0
- package/lib/workers/integ-snapshot-worker.d.ts +1 -0
- package/lib/workers/integ-snapshot-worker.d.ts.map +1 -0
- package/lib/workers/integ-test-worker.d.ts +1 -0
- package/lib/workers/integ-test-worker.d.ts.map +1 -0
- package/lib/workers/integ-watch-worker.d.ts +1 -0
- package/lib/workers/integ-watch-worker.d.ts.map +1 -0
- package/package.json +7 -7
|
@@ -4670,7 +4670,7 @@ var require_semver2 = __commonJS({
|
|
|
4670
4670
|
// ../cloud-assembly-schema/cli-version.json
|
|
4671
4671
|
var require_cli_version = __commonJS({
|
|
4672
4672
|
"../cloud-assembly-schema/cli-version.json"(exports2, module2) {
|
|
4673
|
-
module2.exports = { version: "2.1106.
|
|
4673
|
+
module2.exports = { version: "2.1106.1" };
|
|
4674
4674
|
}
|
|
4675
4675
|
});
|
|
4676
4676
|
|
|
@@ -6799,20 +6799,21 @@ var init_manifest = __esm({
|
|
|
6799
6799
|
`${VERSION_MISMATCH}: Maximum schema version supported is ${maxSupported}.x.x, but found ${actual}${cliWarning}`
|
|
6800
6800
|
);
|
|
6801
6801
|
}
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6802
|
+
if (options?.validateSchema ?? process.env.TESTING_CDK === "1") {
|
|
6803
|
+
const validator = new jsonschema.Validator();
|
|
6804
|
+
const result2 = validator.validate(manifest, schema, {
|
|
6805
|
+
nestedErrors: true,
|
|
6806
|
+
allowUnknownAttributes: false,
|
|
6807
|
+
preValidateProperty: _Manifest.validateAssumeRoleAdditionalOptions
|
|
6808
|
+
});
|
|
6809
|
+
let errors = result2.errors;
|
|
6810
|
+
if (options?.skipEnumCheck) {
|
|
6811
|
+
errors = stripEnumErrors(errors);
|
|
6812
|
+
}
|
|
6813
|
+
if (errors.length > 0) {
|
|
6814
|
+
throw new Error(`Invalid assembly manifest:
|
|
6815
6815
|
${errors.map((e16) => e16.stack).join("\n")}`);
|
|
6816
|
+
}
|
|
6816
6817
|
}
|
|
6817
6818
|
}
|
|
6818
6819
|
static saveManifest(manifest, filePath, schema, preprocess) {
|
|
@@ -14160,6 +14161,8 @@ var init_integ_manifest = __esm({
|
|
|
14160
14161
|
static {
|
|
14161
14162
|
__name(this, "NoManifestError");
|
|
14162
14163
|
}
|
|
14164
|
+
manifestPath;
|
|
14165
|
+
cause;
|
|
14163
14166
|
constructor(manifestPath, cause) {
|
|
14164
14167
|
super(`Cannot read integ manifest '${manifestPath}': ${cause.message}`);
|
|
14165
14168
|
this.name = "NoManifestError";
|
|
@@ -14172,6 +14175,8 @@ var init_integ_manifest = __esm({
|
|
|
14172
14175
|
static {
|
|
14173
14176
|
__name(this, "ManifestLoadError");
|
|
14174
14177
|
}
|
|
14178
|
+
manifestPath;
|
|
14179
|
+
cause;
|
|
14175
14180
|
constructor(manifestPath, cause) {
|
|
14176
14181
|
super(`Failed to load integ manifest '${manifestPath}': ${cause.message}`);
|
|
14177
14182
|
this.name = "ManifestLoadingError";
|
|
@@ -14188,9 +14193,7 @@ var init_integ_manifest = __esm({
|
|
|
14188
14193
|
static {
|
|
14189
14194
|
__name(this, "IntegManifestReader");
|
|
14190
14195
|
}
|
|
14191
|
-
static
|
|
14192
|
-
this.DEFAULT_FILENAME = "integ.json";
|
|
14193
|
-
}
|
|
14196
|
+
static DEFAULT_FILENAME = "integ.json";
|
|
14194
14197
|
/**
|
|
14195
14198
|
* Reads an integration test manifest from the specified file
|
|
14196
14199
|
*/
|
|
@@ -14224,6 +14227,10 @@ var init_integ_manifest = __esm({
|
|
|
14224
14227
|
}
|
|
14225
14228
|
return _IntegManifestReader.fromFile(filePath);
|
|
14226
14229
|
}
|
|
14230
|
+
/**
|
|
14231
|
+
* The directory where the manifest was found
|
|
14232
|
+
*/
|
|
14233
|
+
directory;
|
|
14227
14234
|
/**
|
|
14228
14235
|
* List of integration tests in the manifest
|
|
14229
14236
|
*/
|
|
@@ -14258,7 +14265,6 @@ var init_integ_test_suite = __esm({
|
|
|
14258
14265
|
this.enableLookups = enableLookups;
|
|
14259
14266
|
this.testSuite = testSuite;
|
|
14260
14267
|
this.synthContext = synthContext;
|
|
14261
|
-
this.type = "test-suite";
|
|
14262
14268
|
}
|
|
14263
14269
|
static {
|
|
14264
14270
|
__name(this, "IntegTestSuite");
|
|
@@ -14274,6 +14280,7 @@ var init_integ_test_suite = __esm({
|
|
|
14274
14280
|
reader.tests.synthContext
|
|
14275
14281
|
);
|
|
14276
14282
|
}
|
|
14283
|
+
type = "test-suite";
|
|
14277
14284
|
/**
|
|
14278
14285
|
* Returns a list of stacks that have stackUpdateWorkflow disabled
|
|
14279
14286
|
*/
|
|
@@ -14311,7 +14318,6 @@ var init_integ_test_suite = __esm({
|
|
|
14311
14318
|
this.enableLookups = enableLookups;
|
|
14312
14319
|
this.testSuite = testSuite;
|
|
14313
14320
|
this.synthContext = synthContext;
|
|
14314
|
-
this.type = "legacy-test-suite";
|
|
14315
14321
|
}
|
|
14316
14322
|
static {
|
|
14317
14323
|
__name(this, "LegacyIntegTestSuite");
|
|
@@ -14426,6 +14432,7 @@ var init_integ_test_suite = __esm({
|
|
|
14426
14432
|
static pragmas(integSourceFilePath) {
|
|
14427
14433
|
return this.readIntegPragma(integSourceFilePath).filter((p16) => p16.startsWith(PRAGMA_PREFIX));
|
|
14428
14434
|
}
|
|
14435
|
+
type = "legacy-test-suite";
|
|
14429
14436
|
/**
|
|
14430
14437
|
* Save the integ manifest to a directory
|
|
14431
14438
|
*/
|
|
@@ -80543,6 +80550,584 @@ var init_non_interactive_io_host = __esm({
|
|
|
80543
80550
|
}
|
|
80544
80551
|
});
|
|
80545
80552
|
|
|
80553
|
+
// ../toolkit-lib/lib/api/cloud-assembly/stack-selector.ts
|
|
80554
|
+
var StackSelectionStrategy, ExpandStackSelection;
|
|
80555
|
+
var init_stack_selector = __esm({
|
|
80556
|
+
"../toolkit-lib/lib/api/cloud-assembly/stack-selector.ts"() {
|
|
80557
|
+
"use strict";
|
|
80558
|
+
StackSelectionStrategy = /* @__PURE__ */ ((StackSelectionStrategy3) => {
|
|
80559
|
+
StackSelectionStrategy3["ALL_STACKS"] = "all-stacks";
|
|
80560
|
+
StackSelectionStrategy3["MAIN_ASSEMBLY"] = "main-assembly";
|
|
80561
|
+
StackSelectionStrategy3["ONLY_SINGLE"] = "only-single";
|
|
80562
|
+
StackSelectionStrategy3["PATTERN_MATCH"] = "pattern-match";
|
|
80563
|
+
StackSelectionStrategy3["PATTERN_MUST_MATCH"] = "pattern-must-match";
|
|
80564
|
+
StackSelectionStrategy3["PATTERN_MUST_MATCH_SINGLE"] = "pattern-must-match-single";
|
|
80565
|
+
return StackSelectionStrategy3;
|
|
80566
|
+
})(StackSelectionStrategy || {});
|
|
80567
|
+
ExpandStackSelection = /* @__PURE__ */ ((ExpandStackSelection3) => {
|
|
80568
|
+
ExpandStackSelection3["NONE"] = "none";
|
|
80569
|
+
ExpandStackSelection3["UPSTREAM"] = "upstream";
|
|
80570
|
+
ExpandStackSelection3["DOWNSTREAM"] = "downstream";
|
|
80571
|
+
return ExpandStackSelection3;
|
|
80572
|
+
})(ExpandStackSelection || {});
|
|
80573
|
+
}
|
|
80574
|
+
});
|
|
80575
|
+
|
|
80576
|
+
// ../toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly.ts
|
|
80577
|
+
var import_dispose_polyfill, BorrowedAssembly;
|
|
80578
|
+
var init_borrowed_assembly = __esm({
|
|
80579
|
+
"../toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly.ts"() {
|
|
80580
|
+
"use strict";
|
|
80581
|
+
import_dispose_polyfill = __toESM(require_dispose_polyfill());
|
|
80582
|
+
BorrowedAssembly = class {
|
|
80583
|
+
constructor(cloudAssembly) {
|
|
80584
|
+
this.cloudAssembly = cloudAssembly;
|
|
80585
|
+
}
|
|
80586
|
+
static {
|
|
80587
|
+
__name(this, "BorrowedAssembly");
|
|
80588
|
+
}
|
|
80589
|
+
async _unlock() {
|
|
80590
|
+
}
|
|
80591
|
+
async dispose() {
|
|
80592
|
+
}
|
|
80593
|
+
async [Symbol.asyncDispose]() {
|
|
80594
|
+
}
|
|
80595
|
+
};
|
|
80596
|
+
}
|
|
80597
|
+
});
|
|
80598
|
+
|
|
80599
|
+
// ../toolkit-lib/lib/api/cloud-assembly/cached-source.ts
|
|
80600
|
+
var import_dispose_polyfill2, CachedCloudAssembly;
|
|
80601
|
+
var init_cached_source = __esm({
|
|
80602
|
+
"../toolkit-lib/lib/api/cloud-assembly/cached-source.ts"() {
|
|
80603
|
+
"use strict";
|
|
80604
|
+
import_dispose_polyfill2 = __toESM(require_dispose_polyfill());
|
|
80605
|
+
init_borrowed_assembly();
|
|
80606
|
+
CachedCloudAssembly = class {
|
|
80607
|
+
static {
|
|
80608
|
+
__name(this, "CachedCloudAssembly");
|
|
80609
|
+
}
|
|
80610
|
+
asm;
|
|
80611
|
+
constructor(asm) {
|
|
80612
|
+
this.asm = asm;
|
|
80613
|
+
}
|
|
80614
|
+
get cloudAssembly() {
|
|
80615
|
+
return this.asm.cloudAssembly;
|
|
80616
|
+
}
|
|
80617
|
+
async produce() {
|
|
80618
|
+
return new BorrowedAssembly(this.asm.cloudAssembly);
|
|
80619
|
+
}
|
|
80620
|
+
_unlock() {
|
|
80621
|
+
return this.asm._unlock();
|
|
80622
|
+
}
|
|
80623
|
+
dispose() {
|
|
80624
|
+
return this.asm.dispose();
|
|
80625
|
+
}
|
|
80626
|
+
[Symbol.asyncDispose]() {
|
|
80627
|
+
return this.dispose();
|
|
80628
|
+
}
|
|
80629
|
+
};
|
|
80630
|
+
}
|
|
80631
|
+
});
|
|
80632
|
+
|
|
80633
|
+
// ../toolkit-lib/lib/api/settings.ts
|
|
80634
|
+
function expandHomeDir(x16) {
|
|
80635
|
+
if (x16.startsWith("~")) {
|
|
80636
|
+
return fs_path.join(os3.homedir(), x16.slice(1));
|
|
80637
|
+
}
|
|
80638
|
+
return x16;
|
|
80639
|
+
}
|
|
80640
|
+
function stripTransientValues(obj) {
|
|
80641
|
+
const ret = {};
|
|
80642
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
80643
|
+
if (!isTransientValue(value)) {
|
|
80644
|
+
ret[key] = value;
|
|
80645
|
+
}
|
|
80646
|
+
}
|
|
80647
|
+
return ret;
|
|
80648
|
+
}
|
|
80649
|
+
function isTransientValue(value) {
|
|
80650
|
+
return typeof value === "object" && value !== null && value[TRANSIENT_CONTEXT_KEY];
|
|
80651
|
+
}
|
|
80652
|
+
var os3, fs_path, fs10, TRANSIENT_CONTEXT_KEY, Settings;
|
|
80653
|
+
var init_settings = __esm({
|
|
80654
|
+
"../toolkit-lib/lib/api/settings.ts"() {
|
|
80655
|
+
"use strict";
|
|
80656
|
+
os3 = __toESM(require("os"));
|
|
80657
|
+
fs_path = __toESM(require("path"));
|
|
80658
|
+
fs10 = __toESM(require_lib6());
|
|
80659
|
+
init_toolkit_error();
|
|
80660
|
+
init_util();
|
|
80661
|
+
TRANSIENT_CONTEXT_KEY = "$dontSaveContext";
|
|
80662
|
+
Settings = class _Settings {
|
|
80663
|
+
constructor(settings = {}, readOnly = false) {
|
|
80664
|
+
this.settings = settings;
|
|
80665
|
+
this.readOnly = readOnly;
|
|
80666
|
+
}
|
|
80667
|
+
static {
|
|
80668
|
+
__name(this, "Settings");
|
|
80669
|
+
}
|
|
80670
|
+
static mergeAll(...settings) {
|
|
80671
|
+
let ret = new _Settings();
|
|
80672
|
+
for (const setting of settings) {
|
|
80673
|
+
ret = ret.merge(setting);
|
|
80674
|
+
}
|
|
80675
|
+
return ret;
|
|
80676
|
+
}
|
|
80677
|
+
async save(fileName) {
|
|
80678
|
+
const expanded = expandHomeDir(fileName);
|
|
80679
|
+
await fs10.writeJson(expanded, stripTransientValues(this.settings), {
|
|
80680
|
+
spaces: 2
|
|
80681
|
+
});
|
|
80682
|
+
return this;
|
|
80683
|
+
}
|
|
80684
|
+
get all() {
|
|
80685
|
+
return this.get([]);
|
|
80686
|
+
}
|
|
80687
|
+
merge(other) {
|
|
80688
|
+
return new _Settings(deepMerge(this.settings, other.settings));
|
|
80689
|
+
}
|
|
80690
|
+
subSettings(keyPrefix) {
|
|
80691
|
+
return new _Settings(this.get(keyPrefix) || {}, false);
|
|
80692
|
+
}
|
|
80693
|
+
makeReadOnly() {
|
|
80694
|
+
return new _Settings(this.settings, true);
|
|
80695
|
+
}
|
|
80696
|
+
clear() {
|
|
80697
|
+
if (this.readOnly) {
|
|
80698
|
+
throw new ToolkitError("Cannot clear(): settings are readonly");
|
|
80699
|
+
}
|
|
80700
|
+
this.settings = {};
|
|
80701
|
+
}
|
|
80702
|
+
get empty() {
|
|
80703
|
+
return Object.keys(this.settings).length === 0;
|
|
80704
|
+
}
|
|
80705
|
+
get(path40) {
|
|
80706
|
+
return deepClone(deepGet(this.settings, path40));
|
|
80707
|
+
}
|
|
80708
|
+
set(path40, value) {
|
|
80709
|
+
if (this.readOnly) {
|
|
80710
|
+
throw new ToolkitError(`Can't set ${path40}: settings object is readonly`);
|
|
80711
|
+
}
|
|
80712
|
+
if (path40.length === 0) {
|
|
80713
|
+
this.settings = value;
|
|
80714
|
+
} else {
|
|
80715
|
+
deepSet(this.settings, path40, value);
|
|
80716
|
+
}
|
|
80717
|
+
return this;
|
|
80718
|
+
}
|
|
80719
|
+
unset(path40) {
|
|
80720
|
+
this.set(path40, void 0);
|
|
80721
|
+
}
|
|
80722
|
+
};
|
|
80723
|
+
__name(expandHomeDir, "expandHomeDir");
|
|
80724
|
+
__name(stripTransientValues, "stripTransientValues");
|
|
80725
|
+
__name(isTransientValue, "isTransientValue");
|
|
80726
|
+
}
|
|
80727
|
+
});
|
|
80728
|
+
|
|
80729
|
+
// ../toolkit-lib/lib/api/context.ts
|
|
80730
|
+
var Context;
|
|
80731
|
+
var init_context = __esm({
|
|
80732
|
+
"../toolkit-lib/lib/api/context.ts"() {
|
|
80733
|
+
"use strict";
|
|
80734
|
+
init_settings();
|
|
80735
|
+
init_toolkit_error();
|
|
80736
|
+
init_settings();
|
|
80737
|
+
Context = class {
|
|
80738
|
+
static {
|
|
80739
|
+
__name(this, "Context");
|
|
80740
|
+
}
|
|
80741
|
+
bags;
|
|
80742
|
+
fileNames;
|
|
80743
|
+
constructor(...bags) {
|
|
80744
|
+
this.bags = bags.length > 0 ? bags.map((b16) => b16.bag) : [new Settings()];
|
|
80745
|
+
this.fileNames = bags.length > 0 ? bags.map((b16) => b16.fileName) : ["default"];
|
|
80746
|
+
}
|
|
80747
|
+
get keys() {
|
|
80748
|
+
return Object.keys(this.all);
|
|
80749
|
+
}
|
|
80750
|
+
has(key) {
|
|
80751
|
+
return this.keys.indexOf(key) > -1;
|
|
80752
|
+
}
|
|
80753
|
+
get all() {
|
|
80754
|
+
let ret = new Settings();
|
|
80755
|
+
for (const bag of [...this.bags].reverse()) {
|
|
80756
|
+
ret = ret.merge(bag);
|
|
80757
|
+
}
|
|
80758
|
+
return ret.all;
|
|
80759
|
+
}
|
|
80760
|
+
get(key) {
|
|
80761
|
+
for (const bag of this.bags) {
|
|
80762
|
+
const v17 = bag.get([key]);
|
|
80763
|
+
if (v17 !== void 0) {
|
|
80764
|
+
return v17;
|
|
80765
|
+
}
|
|
80766
|
+
}
|
|
80767
|
+
return void 0;
|
|
80768
|
+
}
|
|
80769
|
+
set(key, value) {
|
|
80770
|
+
for (const bag of this.bags) {
|
|
80771
|
+
if (bag.readOnly) {
|
|
80772
|
+
continue;
|
|
80773
|
+
}
|
|
80774
|
+
bag.set([key], value);
|
|
80775
|
+
value = void 0;
|
|
80776
|
+
}
|
|
80777
|
+
}
|
|
80778
|
+
unset(key) {
|
|
80779
|
+
this.set(key, void 0);
|
|
80780
|
+
}
|
|
80781
|
+
clear() {
|
|
80782
|
+
for (const key of this.keys) {
|
|
80783
|
+
this.unset(key);
|
|
80784
|
+
}
|
|
80785
|
+
}
|
|
80786
|
+
/**
|
|
80787
|
+
* Save a specific context file
|
|
80788
|
+
*/
|
|
80789
|
+
async save(fileName) {
|
|
80790
|
+
const index = this.fileNames.indexOf(fileName);
|
|
80791
|
+
if (index === -1) {
|
|
80792
|
+
return this;
|
|
80793
|
+
}
|
|
80794
|
+
const bag = this.bags[index];
|
|
80795
|
+
if (bag.readOnly) {
|
|
80796
|
+
throw new ToolkitError(`Context file ${fileName} is read only!`);
|
|
80797
|
+
}
|
|
80798
|
+
await bag.save(fileName);
|
|
80799
|
+
return this;
|
|
80800
|
+
}
|
|
80801
|
+
};
|
|
80802
|
+
}
|
|
80803
|
+
});
|
|
80804
|
+
|
|
80805
|
+
// ../toolkit-lib/lib/api/cloud-assembly/context-store.ts
|
|
80806
|
+
function persistableContext(context) {
|
|
80807
|
+
return Object.fromEntries(Object.entries(context).filter(([_2, value]) => !isTransientValue2(value)));
|
|
80808
|
+
}
|
|
80809
|
+
function isTransientValue2(x16) {
|
|
80810
|
+
return x16 && typeof x16 === "object" && x16[TRANSIENT_CONTEXT_KEY];
|
|
80811
|
+
}
|
|
80812
|
+
async function settingsFromFile(filename) {
|
|
80813
|
+
try {
|
|
80814
|
+
const data2 = JSON.parse(await import_fs4.promises.readFile(filename, "utf-8"));
|
|
80815
|
+
return new Settings(data2);
|
|
80816
|
+
} catch (e16) {
|
|
80817
|
+
if (e16.code === "ENOENT") {
|
|
80818
|
+
return new Settings();
|
|
80819
|
+
}
|
|
80820
|
+
throw e16;
|
|
80821
|
+
}
|
|
80822
|
+
}
|
|
80823
|
+
var import_fs4, os4, path10, CdkAppMultiContext, FileContext, MemoryContext;
|
|
80824
|
+
var init_context_store = __esm({
|
|
80825
|
+
"../toolkit-lib/lib/api/cloud-assembly/context-store.ts"() {
|
|
80826
|
+
"use strict";
|
|
80827
|
+
import_fs4 = require("fs");
|
|
80828
|
+
os4 = __toESM(require("os"));
|
|
80829
|
+
path10 = __toESM(require("path"));
|
|
80830
|
+
init_toolkit_error();
|
|
80831
|
+
init_context();
|
|
80832
|
+
init_settings();
|
|
80833
|
+
CdkAppMultiContext = class {
|
|
80834
|
+
constructor(appDirectory, commandlineContext) {
|
|
80835
|
+
this.commandlineContext = commandlineContext;
|
|
80836
|
+
this.configContextFile = path10.join(appDirectory, "cdk.json");
|
|
80837
|
+
this.projectContextFile = path10.join(appDirectory, "cdk.context.json");
|
|
80838
|
+
this.userConfigFile = path10.join(os4.homedir() ?? "/tmp", ".cdk.json");
|
|
80839
|
+
}
|
|
80840
|
+
static {
|
|
80841
|
+
__name(this, "CdkAppMultiContext");
|
|
80842
|
+
}
|
|
80843
|
+
_context;
|
|
80844
|
+
configContextFile;
|
|
80845
|
+
projectContextFile;
|
|
80846
|
+
userConfigFile;
|
|
80847
|
+
async read() {
|
|
80848
|
+
const context = await this.asyncInitialize();
|
|
80849
|
+
return context.all;
|
|
80850
|
+
}
|
|
80851
|
+
async update(updates) {
|
|
80852
|
+
const context = await this.asyncInitialize();
|
|
80853
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
80854
|
+
context.set(key, value);
|
|
80855
|
+
}
|
|
80856
|
+
await context.save(this.projectContextFile);
|
|
80857
|
+
}
|
|
80858
|
+
/**
|
|
80859
|
+
* Initialize the `Context` object
|
|
80860
|
+
*
|
|
80861
|
+
* This code all exists to reuse code that's already there, to minimize
|
|
80862
|
+
* the chances of the new code behaving subtly differently than the
|
|
80863
|
+
* old code.
|
|
80864
|
+
*
|
|
80865
|
+
* It might be most of this is unnecessary now...
|
|
80866
|
+
*/
|
|
80867
|
+
async asyncInitialize() {
|
|
80868
|
+
if (this._context) {
|
|
80869
|
+
return this._context;
|
|
80870
|
+
}
|
|
80871
|
+
const contextSources = [
|
|
80872
|
+
{ bag: new Settings(this.commandlineContext, true) },
|
|
80873
|
+
{
|
|
80874
|
+
fileName: this.configContextFile,
|
|
80875
|
+
bag: (await settingsFromFile(this.configContextFile)).subSettings(["context"]).makeReadOnly()
|
|
80876
|
+
},
|
|
80877
|
+
{
|
|
80878
|
+
fileName: this.projectContextFile,
|
|
80879
|
+
bag: await settingsFromFile(this.projectContextFile)
|
|
80880
|
+
},
|
|
80881
|
+
{
|
|
80882
|
+
fileName: this.userConfigFile,
|
|
80883
|
+
bag: (await settingsFromFile(this.userConfigFile)).subSettings(["context"]).makeReadOnly()
|
|
80884
|
+
}
|
|
80885
|
+
];
|
|
80886
|
+
this._context = new Context(...contextSources);
|
|
80887
|
+
return this._context;
|
|
80888
|
+
}
|
|
80889
|
+
};
|
|
80890
|
+
FileContext = class {
|
|
80891
|
+
constructor(fileName) {
|
|
80892
|
+
this.fileName = fileName;
|
|
80893
|
+
}
|
|
80894
|
+
static {
|
|
80895
|
+
__name(this, "FileContext");
|
|
80896
|
+
}
|
|
80897
|
+
_cache;
|
|
80898
|
+
async read() {
|
|
80899
|
+
if (!this._cache) {
|
|
80900
|
+
try {
|
|
80901
|
+
this._cache = JSON.parse(await import_fs4.promises.readFile(this.fileName, "utf-8"));
|
|
80902
|
+
} catch (e16) {
|
|
80903
|
+
if (e16.code === "ENOENT") {
|
|
80904
|
+
this._cache = {};
|
|
80905
|
+
} else {
|
|
80906
|
+
throw e16;
|
|
80907
|
+
}
|
|
80908
|
+
}
|
|
80909
|
+
}
|
|
80910
|
+
if (!this._cache || typeof this._cache !== "object") {
|
|
80911
|
+
throw new ToolkitError(`${this.fileName} must contain an object, got: ${JSON.stringify(this._cache)}`);
|
|
80912
|
+
}
|
|
80913
|
+
return this._cache;
|
|
80914
|
+
}
|
|
80915
|
+
async update(updates) {
|
|
80916
|
+
this._cache = {
|
|
80917
|
+
...await this.read(),
|
|
80918
|
+
...updates
|
|
80919
|
+
};
|
|
80920
|
+
const persistable = persistableContext(this._cache);
|
|
80921
|
+
await import_fs4.promises.writeFile(this.fileName, JSON.stringify(persistable, void 0, 2), "utf-8");
|
|
80922
|
+
}
|
|
80923
|
+
};
|
|
80924
|
+
MemoryContext = class {
|
|
80925
|
+
static {
|
|
80926
|
+
__name(this, "MemoryContext");
|
|
80927
|
+
}
|
|
80928
|
+
context = {};
|
|
80929
|
+
constructor(initialContext) {
|
|
80930
|
+
this.context = { ...initialContext };
|
|
80931
|
+
}
|
|
80932
|
+
read() {
|
|
80933
|
+
return Promise.resolve(this.context);
|
|
80934
|
+
}
|
|
80935
|
+
update(updates) {
|
|
80936
|
+
this.context = {
|
|
80937
|
+
...this.context,
|
|
80938
|
+
...updates
|
|
80939
|
+
};
|
|
80940
|
+
return Promise.resolve();
|
|
80941
|
+
}
|
|
80942
|
+
};
|
|
80943
|
+
__name(persistableContext, "persistableContext");
|
|
80944
|
+
__name(isTransientValue2, "isTransientValue");
|
|
80945
|
+
__name(settingsFromFile, "settingsFromFile");
|
|
80946
|
+
}
|
|
80947
|
+
});
|
|
80948
|
+
|
|
80949
|
+
// ../toolkit-lib/lib/api/rwlock.ts
|
|
80950
|
+
async function readFileIfExists(filename) {
|
|
80951
|
+
try {
|
|
80952
|
+
return await import_fs5.promises.readFile(filename, { encoding: "utf-8" });
|
|
80953
|
+
} catch (e16) {
|
|
80954
|
+
if (e16.code === "ENOENT") {
|
|
80955
|
+
return void 0;
|
|
80956
|
+
}
|
|
80957
|
+
throw e16;
|
|
80958
|
+
}
|
|
80959
|
+
}
|
|
80960
|
+
async function writeFileAtomic(filename, contents) {
|
|
80961
|
+
await import_fs5.promises.mkdir(path11.dirname(filename), { recursive: true });
|
|
80962
|
+
const tmpFile = `${filename}.${process.pid}_${++tmpCounter}`;
|
|
80963
|
+
await import_fs5.promises.writeFile(tmpFile, contents, { encoding: "utf-8" });
|
|
80964
|
+
await import_fs5.promises.rename(tmpFile, filename);
|
|
80965
|
+
}
|
|
80966
|
+
async function deleteFile(filename) {
|
|
80967
|
+
try {
|
|
80968
|
+
await import_fs5.promises.unlink(filename);
|
|
80969
|
+
} catch (e16) {
|
|
80970
|
+
if (e16.code === "ENOENT") {
|
|
80971
|
+
return;
|
|
80972
|
+
}
|
|
80973
|
+
throw e16;
|
|
80974
|
+
}
|
|
80975
|
+
}
|
|
80976
|
+
function processExists(pid) {
|
|
80977
|
+
try {
|
|
80978
|
+
process.kill(pid, 0);
|
|
80979
|
+
return true;
|
|
80980
|
+
} catch (e16) {
|
|
80981
|
+
return false;
|
|
80982
|
+
}
|
|
80983
|
+
}
|
|
80984
|
+
var import_fs5, path11, RWLock, tmpCounter;
|
|
80985
|
+
var init_rwlock = __esm({
|
|
80986
|
+
"../toolkit-lib/lib/api/rwlock.ts"() {
|
|
80987
|
+
"use strict";
|
|
80988
|
+
import_fs5 = require("fs");
|
|
80989
|
+
path11 = __toESM(require("path"));
|
|
80990
|
+
init_toolkit_error();
|
|
80991
|
+
RWLock = class {
|
|
80992
|
+
constructor(directory) {
|
|
80993
|
+
this.directory = directory;
|
|
80994
|
+
this.pidString = `${process.pid}`;
|
|
80995
|
+
this.writerFile = path11.join(this.directory, "synth.lock");
|
|
80996
|
+
}
|
|
80997
|
+
static {
|
|
80998
|
+
__name(this, "RWLock");
|
|
80999
|
+
}
|
|
81000
|
+
pidString;
|
|
81001
|
+
writerFile;
|
|
81002
|
+
readCounter = 0;
|
|
81003
|
+
/**
|
|
81004
|
+
* Acquire a writer lock.
|
|
81005
|
+
*
|
|
81006
|
+
* No other readers or writers must exist for the given directory.
|
|
81007
|
+
*/
|
|
81008
|
+
async acquireWrite() {
|
|
81009
|
+
await this.assertNoOtherWriters();
|
|
81010
|
+
const readers = await this._currentReaders();
|
|
81011
|
+
if (readers.length > 0) {
|
|
81012
|
+
throw new ToolkitError(`Other CLIs (PID=${readers}) are currently reading from ${this.directory}. Invoke the CLI in sequence, or use '--output' to synth into different directories.`);
|
|
81013
|
+
}
|
|
81014
|
+
await writeFileAtomic(this.writerFile, this.pidString);
|
|
81015
|
+
let released = false;
|
|
81016
|
+
return {
|
|
81017
|
+
release: /* @__PURE__ */ __name(async () => {
|
|
81018
|
+
if (!released) {
|
|
81019
|
+
await deleteFile(this.writerFile);
|
|
81020
|
+
released = true;
|
|
81021
|
+
}
|
|
81022
|
+
}, "release"),
|
|
81023
|
+
convertToReaderLock: /* @__PURE__ */ __name(async () => {
|
|
81024
|
+
const ret = await this.doAcquireRead();
|
|
81025
|
+
await deleteFile(this.writerFile);
|
|
81026
|
+
return ret;
|
|
81027
|
+
}, "convertToReaderLock")
|
|
81028
|
+
};
|
|
81029
|
+
}
|
|
81030
|
+
/**
|
|
81031
|
+
* Acquire a read lock
|
|
81032
|
+
*
|
|
81033
|
+
* Will fail if there are any writers.
|
|
81034
|
+
*/
|
|
81035
|
+
async acquireRead() {
|
|
81036
|
+
await this.assertNoOtherWriters();
|
|
81037
|
+
return this.doAcquireRead();
|
|
81038
|
+
}
|
|
81039
|
+
/**
|
|
81040
|
+
* Obtains the name fo a (new) `readerFile` to use. This includes a counter so
|
|
81041
|
+
* that if multiple threads of the same PID attempt to concurrently acquire
|
|
81042
|
+
* the same lock, they're guaranteed to use a different reader file name (only
|
|
81043
|
+
* one thread will ever execute JS code at once, guaranteeing the readCounter
|
|
81044
|
+
* is incremented "atomically" from the point of view of this PID.).
|
|
81045
|
+
*/
|
|
81046
|
+
readerFile() {
|
|
81047
|
+
return path11.join(this.directory, `read.${this.pidString}.${++this.readCounter}.lock`);
|
|
81048
|
+
}
|
|
81049
|
+
/**
|
|
81050
|
+
* Do the actual acquiring of a read lock.
|
|
81051
|
+
*/
|
|
81052
|
+
async doAcquireRead() {
|
|
81053
|
+
const readerFile = this.readerFile();
|
|
81054
|
+
await writeFileAtomic(readerFile, this.pidString);
|
|
81055
|
+
let released = false;
|
|
81056
|
+
return {
|
|
81057
|
+
release: /* @__PURE__ */ __name(async () => {
|
|
81058
|
+
if (!released) {
|
|
81059
|
+
await deleteFile(readerFile);
|
|
81060
|
+
released = true;
|
|
81061
|
+
}
|
|
81062
|
+
}, "release")
|
|
81063
|
+
};
|
|
81064
|
+
}
|
|
81065
|
+
async assertNoOtherWriters() {
|
|
81066
|
+
const writer = await this._currentWriter();
|
|
81067
|
+
if (writer) {
|
|
81068
|
+
throw new ToolkitError(`Another CLI (PID=${writer}) is currently synthing to ${this.directory}. Invoke the CLI in sequence, or use '--output' to synth into different directories.`);
|
|
81069
|
+
}
|
|
81070
|
+
}
|
|
81071
|
+
/**
|
|
81072
|
+
* Check the current writer (if any)
|
|
81073
|
+
*
|
|
81074
|
+
* Publicly accessible for testing purposes. Do not use.
|
|
81075
|
+
*
|
|
81076
|
+
* @internal
|
|
81077
|
+
*/
|
|
81078
|
+
async _currentWriter() {
|
|
81079
|
+
const contents = await readFileIfExists(this.writerFile);
|
|
81080
|
+
if (!contents) {
|
|
81081
|
+
return void 0;
|
|
81082
|
+
}
|
|
81083
|
+
const pid = parseInt(contents, 10);
|
|
81084
|
+
if (!processExists(pid)) {
|
|
81085
|
+
await deleteFile(this.writerFile);
|
|
81086
|
+
return void 0;
|
|
81087
|
+
}
|
|
81088
|
+
return pid;
|
|
81089
|
+
}
|
|
81090
|
+
/**
|
|
81091
|
+
* Check the current readers (if any)
|
|
81092
|
+
*
|
|
81093
|
+
* Publicly accessible for testing purposes. Do not use.
|
|
81094
|
+
*
|
|
81095
|
+
* @internal
|
|
81096
|
+
*/
|
|
81097
|
+
async _currentReaders() {
|
|
81098
|
+
const re = /^read\.([^.]+)\.[^.]+\.lock$/;
|
|
81099
|
+
const ret = new Array();
|
|
81100
|
+
let children;
|
|
81101
|
+
try {
|
|
81102
|
+
children = await import_fs5.promises.readdir(this.directory, { encoding: "utf-8" });
|
|
81103
|
+
} catch (e16) {
|
|
81104
|
+
if (e16.code === "ENOENT") {
|
|
81105
|
+
return [];
|
|
81106
|
+
}
|
|
81107
|
+
throw e16;
|
|
81108
|
+
}
|
|
81109
|
+
for (const fname of children) {
|
|
81110
|
+
const m16 = fname.match(re);
|
|
81111
|
+
if (m16) {
|
|
81112
|
+
const pid = parseInt(m16[1], 10);
|
|
81113
|
+
if (processExists(pid)) {
|
|
81114
|
+
ret.push(pid);
|
|
81115
|
+
} else {
|
|
81116
|
+
await deleteFile(path11.join(this.directory, fname));
|
|
81117
|
+
}
|
|
81118
|
+
}
|
|
81119
|
+
}
|
|
81120
|
+
return ret;
|
|
81121
|
+
}
|
|
81122
|
+
};
|
|
81123
|
+
__name(readFileIfExists, "readFileIfExists");
|
|
81124
|
+
tmpCounter = 0;
|
|
81125
|
+
__name(writeFileAtomic, "writeFileAtomic");
|
|
81126
|
+
__name(deleteFile, "deleteFile");
|
|
81127
|
+
__name(processExists, "processExists");
|
|
81128
|
+
}
|
|
81129
|
+
});
|
|
81130
|
+
|
|
80546
81131
|
// ../../../node_modules/@smithy/types/dist-cjs/index.js
|
|
80547
81132
|
var require_dist_cjs = __commonJS({
|
|
80548
81133
|
"../../../node_modules/@smithy/types/dist-cjs/index.js"(exports2) {
|
|
@@ -316709,12 +317294,12 @@ to input.params.ContentLength in bytes.
|
|
|
316709
317294
|
});
|
|
316710
317295
|
|
|
316711
317296
|
// ../toolkit-lib/lib/api/aws-auth/account-cache.ts
|
|
316712
|
-
var
|
|
317297
|
+
var path12, fs13, AccountAccessKeyCache;
|
|
316713
317298
|
var init_account_cache = __esm({
|
|
316714
317299
|
"../toolkit-lib/lib/api/aws-auth/account-cache.ts"() {
|
|
316715
317300
|
"use strict";
|
|
316716
|
-
|
|
316717
|
-
|
|
317301
|
+
path12 = __toESM(require("path"));
|
|
317302
|
+
fs13 = __toESM(require_lib6());
|
|
316718
317303
|
init_util();
|
|
316719
317304
|
AccountAccessKeyCache = class _AccountAccessKeyCache {
|
|
316720
317305
|
static {
|
|
@@ -316728,7 +317313,7 @@ var init_account_cache = __esm({
|
|
|
316728
317313
|
* The default path used for the accounts access key cache
|
|
316729
317314
|
*/
|
|
316730
317315
|
static get DEFAULT_PATH() {
|
|
316731
|
-
return
|
|
317316
|
+
return path12.join(cdkCacheDir(), "accounts_partitions.json");
|
|
316732
317317
|
}
|
|
316733
317318
|
cacheFile;
|
|
316734
317319
|
debug;
|
|
@@ -316778,7 +317363,7 @@ var init_account_cache = __esm({
|
|
|
316778
317363
|
}
|
|
316779
317364
|
async loadMap() {
|
|
316780
317365
|
try {
|
|
316781
|
-
return await
|
|
317366
|
+
return await fs13.readJson(this.cacheFile);
|
|
316782
317367
|
} catch (e16) {
|
|
316783
317368
|
if (e16.code === "ENOENT" || e16.code === "EACCES") {
|
|
316784
317369
|
return {};
|
|
@@ -316791,8 +317376,8 @@ var init_account_cache = __esm({
|
|
|
316791
317376
|
}
|
|
316792
317377
|
async saveMap(map2) {
|
|
316793
317378
|
try {
|
|
316794
|
-
await
|
|
316795
|
-
await
|
|
317379
|
+
await fs13.ensureFile(this.cacheFile);
|
|
317380
|
+
await fs13.writeJson(this.cacheFile, map2, { spaces: 2 });
|
|
316796
317381
|
} catch (e16) {
|
|
316797
317382
|
if (e16.code === "ENOENT" || e16.code === "EACCES" || e16.code === "EROFS") {
|
|
316798
317383
|
return;
|
|
@@ -316878,19 +317463,19 @@ var init_tracing = __esm({
|
|
|
316878
317463
|
// ../toolkit-lib/lib/api/aws-auth/util.ts
|
|
316879
317464
|
function readIfPossible(filename) {
|
|
316880
317465
|
try {
|
|
316881
|
-
if (!
|
|
317466
|
+
if (!fs14.pathExistsSync(filename)) {
|
|
316882
317467
|
return void 0;
|
|
316883
317468
|
}
|
|
316884
|
-
return
|
|
317469
|
+
return fs14.readFileSync(filename, { encoding: "utf-8" });
|
|
316885
317470
|
} catch (e16) {
|
|
316886
317471
|
return void 0;
|
|
316887
317472
|
}
|
|
316888
317473
|
}
|
|
316889
|
-
var
|
|
317474
|
+
var fs14;
|
|
316890
317475
|
var init_util2 = __esm({
|
|
316891
317476
|
"../toolkit-lib/lib/api/aws-auth/util.ts"() {
|
|
316892
317477
|
"use strict";
|
|
316893
|
-
|
|
317478
|
+
fs14 = __toESM(require_lib6());
|
|
316894
317479
|
__name(readIfPossible, "readIfPossible");
|
|
316895
317480
|
}
|
|
316896
317481
|
});
|
|
@@ -316898,16 +317483,16 @@ var init_util2 = __esm({
|
|
|
316898
317483
|
// ../toolkit-lib/lib/api/aws-auth/user-agent.ts
|
|
316899
317484
|
function defaultCliUserAgent() {
|
|
316900
317485
|
const root = bundledPackageRootDir(__dirname, false);
|
|
316901
|
-
const pkg = JSON.parse((root ? readIfPossible(
|
|
316902
|
-
const name = pkg.name ??
|
|
317486
|
+
const pkg = JSON.parse((root ? readIfPossible(path13.join(root, "package.json")) : void 0) ?? "{}");
|
|
317487
|
+
const name = pkg.name ?? path13.basename(process.argv[1] ?? "cdk-cli");
|
|
316903
317488
|
const version = pkg.version ?? "<unknown>";
|
|
316904
317489
|
return `${name}/${version}`;
|
|
316905
317490
|
}
|
|
316906
|
-
var
|
|
317491
|
+
var path13;
|
|
316907
317492
|
var init_user_agent = __esm({
|
|
316908
317493
|
"../toolkit-lib/lib/api/aws-auth/user-agent.ts"() {
|
|
316909
317494
|
"use strict";
|
|
316910
|
-
|
|
317495
|
+
path13 = __toESM(require("path"));
|
|
316911
317496
|
init_util2();
|
|
316912
317497
|
init_util();
|
|
316913
317498
|
__name(defaultCliUserAgent, "defaultCliUserAgent");
|
|
@@ -320753,7 +321338,7 @@ var init_plugin2 = __esm({
|
|
|
320753
321338
|
// ../toolkit-lib/lib/api/aws-auth/sdk-provider.ts
|
|
320754
321339
|
function safeUsername() {
|
|
320755
321340
|
try {
|
|
320756
|
-
return
|
|
321341
|
+
return os5.userInfo().username.replace(/[^\w+=,.@-]/g, "@");
|
|
320757
321342
|
} catch {
|
|
320758
321343
|
return "noname";
|
|
320759
321344
|
}
|
|
@@ -320798,11 +321383,11 @@ async function initContextProviderSdk(aws, options) {
|
|
|
320798
321383
|
};
|
|
320799
321384
|
return (await aws.forEnvironment(import_cloud_assembly_api.EnvironmentUtils.make(account, region), 0 /* ForReading */, creds)).sdk;
|
|
320800
321385
|
}
|
|
320801
|
-
var
|
|
321386
|
+
var os5, import_cloud_assembly_api, import_credential_providers2, CACHED_ACCOUNT, SdkProvider;
|
|
320802
321387
|
var init_sdk_provider = __esm({
|
|
320803
321388
|
"../toolkit-lib/lib/api/aws-auth/sdk-provider.ts"() {
|
|
320804
321389
|
"use strict";
|
|
320805
|
-
|
|
321390
|
+
os5 = __toESM(require("os"));
|
|
320806
321391
|
import_cloud_assembly_api = __toESM(require_lib3());
|
|
320807
321392
|
import_credential_providers2 = __toESM(require_dist_cjs186());
|
|
320808
321393
|
init_awscli_compatible();
|
|
@@ -322206,184 +322791,12 @@ var init_vpcs = __esm({
|
|
|
322206
322791
|
}
|
|
322207
322792
|
});
|
|
322208
322793
|
|
|
322209
|
-
// ../toolkit-lib/lib/api/settings.ts
|
|
322210
|
-
function expandHomeDir(x16) {
|
|
322211
|
-
if (x16.startsWith("~")) {
|
|
322212
|
-
return fs_path.join(os4.homedir(), x16.slice(1));
|
|
322213
|
-
}
|
|
322214
|
-
return x16;
|
|
322215
|
-
}
|
|
322216
|
-
function stripTransientValues(obj) {
|
|
322217
|
-
const ret = {};
|
|
322218
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
322219
|
-
if (!isTransientValue(value)) {
|
|
322220
|
-
ret[key] = value;
|
|
322221
|
-
}
|
|
322222
|
-
}
|
|
322223
|
-
return ret;
|
|
322224
|
-
}
|
|
322225
|
-
function isTransientValue(value) {
|
|
322226
|
-
return typeof value === "object" && value !== null && value[TRANSIENT_CONTEXT_KEY];
|
|
322227
|
-
}
|
|
322228
|
-
var os4, fs_path, fs12, TRANSIENT_CONTEXT_KEY, Settings;
|
|
322229
|
-
var init_settings = __esm({
|
|
322230
|
-
"../toolkit-lib/lib/api/settings.ts"() {
|
|
322231
|
-
"use strict";
|
|
322232
|
-
os4 = __toESM(require("os"));
|
|
322233
|
-
fs_path = __toESM(require("path"));
|
|
322234
|
-
fs12 = __toESM(require_lib6());
|
|
322235
|
-
init_toolkit_error();
|
|
322236
|
-
init_util();
|
|
322237
|
-
TRANSIENT_CONTEXT_KEY = "$dontSaveContext";
|
|
322238
|
-
Settings = class _Settings {
|
|
322239
|
-
constructor(settings = {}, readOnly = false) {
|
|
322240
|
-
this.settings = settings;
|
|
322241
|
-
this.readOnly = readOnly;
|
|
322242
|
-
}
|
|
322243
|
-
static {
|
|
322244
|
-
__name(this, "Settings");
|
|
322245
|
-
}
|
|
322246
|
-
static mergeAll(...settings) {
|
|
322247
|
-
let ret = new _Settings();
|
|
322248
|
-
for (const setting of settings) {
|
|
322249
|
-
ret = ret.merge(setting);
|
|
322250
|
-
}
|
|
322251
|
-
return ret;
|
|
322252
|
-
}
|
|
322253
|
-
async save(fileName) {
|
|
322254
|
-
const expanded = expandHomeDir(fileName);
|
|
322255
|
-
await fs12.writeJson(expanded, stripTransientValues(this.settings), {
|
|
322256
|
-
spaces: 2
|
|
322257
|
-
});
|
|
322258
|
-
return this;
|
|
322259
|
-
}
|
|
322260
|
-
get all() {
|
|
322261
|
-
return this.get([]);
|
|
322262
|
-
}
|
|
322263
|
-
merge(other) {
|
|
322264
|
-
return new _Settings(deepMerge(this.settings, other.settings));
|
|
322265
|
-
}
|
|
322266
|
-
subSettings(keyPrefix) {
|
|
322267
|
-
return new _Settings(this.get(keyPrefix) || {}, false);
|
|
322268
|
-
}
|
|
322269
|
-
makeReadOnly() {
|
|
322270
|
-
return new _Settings(this.settings, true);
|
|
322271
|
-
}
|
|
322272
|
-
clear() {
|
|
322273
|
-
if (this.readOnly) {
|
|
322274
|
-
throw new ToolkitError("Cannot clear(): settings are readonly");
|
|
322275
|
-
}
|
|
322276
|
-
this.settings = {};
|
|
322277
|
-
}
|
|
322278
|
-
get empty() {
|
|
322279
|
-
return Object.keys(this.settings).length === 0;
|
|
322280
|
-
}
|
|
322281
|
-
get(path40) {
|
|
322282
|
-
return deepClone(deepGet(this.settings, path40));
|
|
322283
|
-
}
|
|
322284
|
-
set(path40, value) {
|
|
322285
|
-
if (this.readOnly) {
|
|
322286
|
-
throw new ToolkitError(`Can't set ${path40}: settings object is readonly`);
|
|
322287
|
-
}
|
|
322288
|
-
if (path40.length === 0) {
|
|
322289
|
-
this.settings = value;
|
|
322290
|
-
} else {
|
|
322291
|
-
deepSet(this.settings, path40, value);
|
|
322292
|
-
}
|
|
322293
|
-
return this;
|
|
322294
|
-
}
|
|
322295
|
-
unset(path40) {
|
|
322296
|
-
this.set(path40, void 0);
|
|
322297
|
-
}
|
|
322298
|
-
};
|
|
322299
|
-
__name(expandHomeDir, "expandHomeDir");
|
|
322300
|
-
__name(stripTransientValues, "stripTransientValues");
|
|
322301
|
-
__name(isTransientValue, "isTransientValue");
|
|
322302
|
-
}
|
|
322303
|
-
});
|
|
322304
|
-
|
|
322305
|
-
// ../toolkit-lib/lib/api/context.ts
|
|
322306
|
-
var Context;
|
|
322307
|
-
var init_context = __esm({
|
|
322308
|
-
"../toolkit-lib/lib/api/context.ts"() {
|
|
322309
|
-
"use strict";
|
|
322310
|
-
init_settings();
|
|
322311
|
-
init_toolkit_error();
|
|
322312
|
-
init_settings();
|
|
322313
|
-
Context = class {
|
|
322314
|
-
static {
|
|
322315
|
-
__name(this, "Context");
|
|
322316
|
-
}
|
|
322317
|
-
bags;
|
|
322318
|
-
fileNames;
|
|
322319
|
-
constructor(...bags) {
|
|
322320
|
-
this.bags = bags.length > 0 ? bags.map((b16) => b16.bag) : [new Settings()];
|
|
322321
|
-
this.fileNames = bags.length > 0 ? bags.map((b16) => b16.fileName) : ["default"];
|
|
322322
|
-
}
|
|
322323
|
-
get keys() {
|
|
322324
|
-
return Object.keys(this.all);
|
|
322325
|
-
}
|
|
322326
|
-
has(key) {
|
|
322327
|
-
return this.keys.indexOf(key) > -1;
|
|
322328
|
-
}
|
|
322329
|
-
get all() {
|
|
322330
|
-
let ret = new Settings();
|
|
322331
|
-
for (const bag of [...this.bags].reverse()) {
|
|
322332
|
-
ret = ret.merge(bag);
|
|
322333
|
-
}
|
|
322334
|
-
return ret.all;
|
|
322335
|
-
}
|
|
322336
|
-
get(key) {
|
|
322337
|
-
for (const bag of this.bags) {
|
|
322338
|
-
const v17 = bag.get([key]);
|
|
322339
|
-
if (v17 !== void 0) {
|
|
322340
|
-
return v17;
|
|
322341
|
-
}
|
|
322342
|
-
}
|
|
322343
|
-
return void 0;
|
|
322344
|
-
}
|
|
322345
|
-
set(key, value) {
|
|
322346
|
-
for (const bag of this.bags) {
|
|
322347
|
-
if (bag.readOnly) {
|
|
322348
|
-
continue;
|
|
322349
|
-
}
|
|
322350
|
-
bag.set([key], value);
|
|
322351
|
-
value = void 0;
|
|
322352
|
-
}
|
|
322353
|
-
}
|
|
322354
|
-
unset(key) {
|
|
322355
|
-
this.set(key, void 0);
|
|
322356
|
-
}
|
|
322357
|
-
clear() {
|
|
322358
|
-
for (const key of this.keys) {
|
|
322359
|
-
this.unset(key);
|
|
322360
|
-
}
|
|
322361
|
-
}
|
|
322362
|
-
/**
|
|
322363
|
-
* Save a specific context file
|
|
322364
|
-
*/
|
|
322365
|
-
async save(fileName) {
|
|
322366
|
-
const index = this.fileNames.indexOf(fileName);
|
|
322367
|
-
if (index === -1) {
|
|
322368
|
-
return this;
|
|
322369
|
-
}
|
|
322370
|
-
const bag = this.bags[index];
|
|
322371
|
-
if (bag.readOnly) {
|
|
322372
|
-
throw new ToolkitError(`Context file ${fileName} is read only!`);
|
|
322373
|
-
}
|
|
322374
|
-
await bag.save(fileName);
|
|
322375
|
-
return this;
|
|
322376
|
-
}
|
|
322377
|
-
};
|
|
322378
|
-
}
|
|
322379
|
-
});
|
|
322380
|
-
|
|
322381
322794
|
// ../toolkit-lib/lib/api/notices/cached-data-source.ts
|
|
322382
|
-
var
|
|
322795
|
+
var fs15, TIME_TO_LIVE_SUCCESS, TIME_TO_LIVE_ERROR, CachedDataSource;
|
|
322383
322796
|
var init_cached_data_source = __esm({
|
|
322384
322797
|
"../toolkit-lib/lib/api/notices/cached-data-source.ts"() {
|
|
322385
322798
|
"use strict";
|
|
322386
|
-
|
|
322799
|
+
fs15 = __toESM(require_lib6());
|
|
322387
322800
|
init_toolkit_error();
|
|
322388
322801
|
TIME_TO_LIVE_SUCCESS = 60 * 60 * 1e3;
|
|
322389
322802
|
TIME_TO_LIVE_ERROR = 1 * 60 * 1e3;
|
|
@@ -322433,7 +322846,7 @@ var init_cached_data_source = __esm({
|
|
|
322433
322846
|
notices: []
|
|
322434
322847
|
};
|
|
322435
322848
|
try {
|
|
322436
|
-
return
|
|
322849
|
+
return fs15.existsSync(this.fileName) ? await fs15.readJSON(this.fileName) : defaultValue;
|
|
322437
322850
|
} catch (e16) {
|
|
322438
322851
|
await this.ioHelper.defaults.debug(`Failed to load notices from cache: ${e16}`);
|
|
322439
322852
|
return defaultValue;
|
|
@@ -322441,8 +322854,8 @@ var init_cached_data_source = __esm({
|
|
|
322441
322854
|
}
|
|
322442
322855
|
async save(cached3) {
|
|
322443
322856
|
try {
|
|
322444
|
-
await
|
|
322445
|
-
await
|
|
322857
|
+
await fs15.ensureFile(this.fileName);
|
|
322858
|
+
await fs15.writeJSON(this.fileName, cached3);
|
|
322446
322859
|
} catch (e16) {
|
|
322447
322860
|
await this.ioHelper.defaults.debug(`Failed to store notices in the cache: ${e16}`);
|
|
322448
322861
|
}
|
|
@@ -322463,7 +322876,7 @@ async function loadTree(assembly, trace3) {
|
|
|
322463
322876
|
try {
|
|
322464
322877
|
const outdir = assembly.directory;
|
|
322465
322878
|
const fileName = assembly.tree()?.file;
|
|
322466
|
-
return fileName ?
|
|
322879
|
+
return fileName ? fs16.readJSONSync(path14.join(outdir, fileName)).tree : {};
|
|
322467
322880
|
} catch (e16) {
|
|
322468
322881
|
await trace3(`Failed to get tree.json file: ${e16}. Proceeding with empty tree.`);
|
|
322469
322882
|
return void 0;
|
|
@@ -322471,18 +322884,18 @@ async function loadTree(assembly, trace3) {
|
|
|
322471
322884
|
}
|
|
322472
322885
|
async function loadTreeFromDir(outdir, trace3) {
|
|
322473
322886
|
try {
|
|
322474
|
-
return
|
|
322887
|
+
return fs16.readJSONSync(path14.join(outdir, "tree.json")).tree;
|
|
322475
322888
|
} catch (e16) {
|
|
322476
322889
|
await trace3(`Failed to get tree.json file: ${e16}. Proceeding with empty tree.`);
|
|
322477
322890
|
return void 0;
|
|
322478
322891
|
}
|
|
322479
322892
|
}
|
|
322480
|
-
var
|
|
322893
|
+
var path14, fs16;
|
|
322481
322894
|
var init_tree = __esm({
|
|
322482
322895
|
"../toolkit-lib/lib/api/tree.ts"() {
|
|
322483
322896
|
"use strict";
|
|
322484
|
-
|
|
322485
|
-
|
|
322897
|
+
path14 = __toESM(require("node:path"));
|
|
322898
|
+
fs16 = __toESM(require_lib6());
|
|
322486
322899
|
__name(some, "some");
|
|
322487
322900
|
__name(loadTree, "loadTree");
|
|
322488
322901
|
__name(loadTreeFromDir, "loadTreeFromDir");
|
|
@@ -322678,16 +323091,16 @@ var init_filter = __esm({
|
|
|
322678
323091
|
});
|
|
322679
323092
|
|
|
322680
323093
|
// ../toolkit-lib/lib/api/network-detector/network-detector.ts
|
|
322681
|
-
var https,
|
|
323094
|
+
var https, path15, fs17, TIME_TO_LIVE_SUCCESS2, CACHE_FILE_PATH, NetworkDetector;
|
|
322682
323095
|
var init_network_detector = __esm({
|
|
322683
323096
|
"../toolkit-lib/lib/api/network-detector/network-detector.ts"() {
|
|
322684
323097
|
"use strict";
|
|
322685
323098
|
https = __toESM(require("node:https"));
|
|
322686
|
-
|
|
322687
|
-
|
|
323099
|
+
path15 = __toESM(require("path"));
|
|
323100
|
+
fs17 = __toESM(require_lib6());
|
|
322688
323101
|
init_util();
|
|
322689
323102
|
TIME_TO_LIVE_SUCCESS2 = 60 * 60 * 1e3;
|
|
322690
|
-
CACHE_FILE_PATH =
|
|
323103
|
+
CACHE_FILE_PATH = path15.join(cdkCacheDir(), "connection.json");
|
|
322691
323104
|
NetworkDetector = class _NetworkDetector {
|
|
322692
323105
|
static {
|
|
322693
323106
|
__name(this, "NetworkDetector");
|
|
@@ -322726,15 +323139,15 @@ var init_network_detector = __esm({
|
|
|
322726
323139
|
hasConnectivity: false
|
|
322727
323140
|
};
|
|
322728
323141
|
try {
|
|
322729
|
-
return
|
|
323142
|
+
return fs17.existsSync(CACHE_FILE_PATH) ? await fs17.readJSON(CACHE_FILE_PATH) : defaultValue;
|
|
322730
323143
|
} catch {
|
|
322731
323144
|
return defaultValue;
|
|
322732
323145
|
}
|
|
322733
323146
|
}
|
|
322734
323147
|
static async save(cached3) {
|
|
322735
323148
|
try {
|
|
322736
|
-
await
|
|
322737
|
-
await
|
|
323149
|
+
await fs17.ensureFile(CACHE_FILE_PATH);
|
|
323150
|
+
await fs17.writeJSON(CACHE_FILE_PATH, cached3);
|
|
322738
323151
|
} catch {
|
|
322739
323152
|
}
|
|
322740
323153
|
}
|
|
@@ -322792,7 +323205,7 @@ var init_web_data_source = __esm({
|
|
|
322792
323205
|
if (!hasConnectivity) {
|
|
322793
323206
|
throw new ToolkitError("No internet connectivity detected");
|
|
322794
323207
|
}
|
|
322795
|
-
const timeout = process.env.TESTING_CDK ? 3e4 : 3e3;
|
|
323208
|
+
const timeout = process.env.CDK_NOTICES_TIMEOUT !== void 0 ? parseInt(process.env.CDK_NOTICES_TIMEOUT, 10) : process.env.TESTING_CDK ? 3e4 : 3e3;
|
|
322796
323209
|
const options = {
|
|
322797
323210
|
agent: this.agent
|
|
322798
323211
|
};
|
|
@@ -322849,17 +323262,17 @@ var init_web_data_source = __esm({
|
|
|
322849
323262
|
});
|
|
322850
323263
|
|
|
322851
323264
|
// ../toolkit-lib/lib/api/notices/notices.ts
|
|
322852
|
-
var
|
|
323265
|
+
var path16, CACHE_FILE_PATH2, Notices;
|
|
322853
323266
|
var init_notices = __esm({
|
|
322854
323267
|
"../toolkit-lib/lib/api/notices/notices.ts"() {
|
|
322855
323268
|
"use strict";
|
|
322856
|
-
|
|
323269
|
+
path16 = __toESM(require("path"));
|
|
322857
323270
|
init_util();
|
|
322858
323271
|
init_cached_data_source();
|
|
322859
323272
|
init_filter();
|
|
322860
323273
|
init_web_data_source();
|
|
322861
323274
|
init_private();
|
|
322862
|
-
CACHE_FILE_PATH2 =
|
|
323275
|
+
CACHE_FILE_PATH2 = path16.join(cdkCacheDir(), "notices.json");
|
|
322863
323276
|
Notices = class _Notices {
|
|
322864
323277
|
static {
|
|
322865
323278
|
__name(this, "Notices");
|
|
@@ -323064,8 +323477,8 @@ var init_progress = __esm({
|
|
|
323064
323477
|
|
|
323065
323478
|
// ../cdk-assets-lib/lib/private/docker-credentials.ts
|
|
323066
323479
|
function cdkCredentialsConfigFile() {
|
|
323067
|
-
return process.env.CDK_DOCKER_CREDS_FILE ??
|
|
323068
|
-
(
|
|
323480
|
+
return process.env.CDK_DOCKER_CREDS_FILE ?? path17.join(
|
|
323481
|
+
(os6.userInfo().homedir ?? os6.homedir()).trim() || "/",
|
|
323069
323482
|
".cdk",
|
|
323070
323483
|
"cdk-docker-creds.json"
|
|
323071
323484
|
);
|
|
@@ -323074,7 +323487,7 @@ function cdkCredentialsConfig() {
|
|
|
323074
323487
|
if (!_cdkCredentials) {
|
|
323075
323488
|
try {
|
|
323076
323489
|
_cdkCredentials = JSON.parse(
|
|
323077
|
-
|
|
323490
|
+
fs18.readFileSync(cdkCredentialsConfigFile(), { encoding: "utf-8" })
|
|
323078
323491
|
);
|
|
323079
323492
|
} catch {
|
|
323080
323493
|
}
|
|
@@ -323100,13 +323513,13 @@ async function obtainEcrCredentials(ecr, eventEmitter) {
|
|
|
323100
323513
|
endpoint: authData[0].proxyEndpoint
|
|
323101
323514
|
};
|
|
323102
323515
|
}
|
|
323103
|
-
var
|
|
323516
|
+
var fs18, os6, path17, _cdkCredentials;
|
|
323104
323517
|
var init_docker_credentials = __esm({
|
|
323105
323518
|
"../cdk-assets-lib/lib/private/docker-credentials.ts"() {
|
|
323106
323519
|
"use strict";
|
|
323107
|
-
|
|
323108
|
-
|
|
323109
|
-
|
|
323520
|
+
fs18 = __toESM(require("fs"));
|
|
323521
|
+
os6 = __toESM(require("os"));
|
|
323522
|
+
path17 = __toESM(require("path"));
|
|
323110
323523
|
init_progress();
|
|
323111
323524
|
__name(cdkCredentialsConfigFile, "cdkCredentialsConfigFile");
|
|
323112
323525
|
__name(cdkCredentialsConfig, "cdkCredentialsConfig");
|
|
@@ -323250,13 +323663,13 @@ function getDockerCmd() {
|
|
|
323250
323663
|
function flatten3(x16) {
|
|
323251
323664
|
return Array.prototype.concat([], ...x16);
|
|
323252
323665
|
}
|
|
323253
|
-
var
|
|
323666
|
+
var fs19, os7, path18, Docker, DockerFactory;
|
|
323254
323667
|
var init_docker = __esm({
|
|
323255
323668
|
"../cdk-assets-lib/lib/private/docker.ts"() {
|
|
323256
323669
|
"use strict";
|
|
323257
|
-
|
|
323258
|
-
|
|
323259
|
-
|
|
323670
|
+
fs19 = __toESM(require("fs"));
|
|
323671
|
+
os7 = __toESM(require("os"));
|
|
323672
|
+
path18 = __toESM(require("path"));
|
|
323260
323673
|
init_docker_credentials();
|
|
323261
323674
|
init_shell();
|
|
323262
323675
|
init_util3();
|
|
@@ -323364,13 +323777,13 @@ var init_docker = __esm({
|
|
|
323364
323777
|
if (!config) {
|
|
323365
323778
|
return false;
|
|
323366
323779
|
}
|
|
323367
|
-
this.configDir =
|
|
323780
|
+
this.configDir = fs19.mkdtempSync(path18.join(os7.tmpdir(), "cdkDockerConfig"));
|
|
323368
323781
|
const domains = Object.keys(config.domainCredentials);
|
|
323369
323782
|
const credHelpers = domains.reduce((map2, domain) => {
|
|
323370
323783
|
map2[domain] = "cdk-assets";
|
|
323371
323784
|
return map2;
|
|
323372
323785
|
}, {});
|
|
323373
|
-
|
|
323786
|
+
fs19.writeFileSync(path18.join(this.configDir, "config.json"), JSON.stringify({ credHelpers }), {
|
|
323374
323787
|
encoding: "utf-8"
|
|
323375
323788
|
});
|
|
323376
323789
|
return true;
|
|
@@ -323386,7 +323799,7 @@ var init_docker = __esm({
|
|
|
323386
323799
|
}
|
|
323387
323800
|
async execute(args, options = {}) {
|
|
323388
323801
|
const configArgs = this.configDir ? ["--config", this.configDir] : [];
|
|
323389
|
-
const pathToCdkAssets =
|
|
323802
|
+
const pathToCdkAssets = path18.resolve(__dirname, "..", "..", "bin");
|
|
323390
323803
|
const shellEventPublisher = shellEventPublisherFromEventEmitter(this.eventEmitter);
|
|
323391
323804
|
try {
|
|
323392
323805
|
await shell([getDockerCmd(), ...configArgs, ...args], {
|
|
@@ -323395,7 +323808,7 @@ var init_docker = __esm({
|
|
|
323395
323808
|
env: {
|
|
323396
323809
|
...process.env,
|
|
323397
323810
|
...options.env,
|
|
323398
|
-
PATH: `${pathToCdkAssets}${
|
|
323811
|
+
PATH: `${pathToCdkAssets}${path18.delimiter}${options.env?.PATH ?? process.env.PATH}`
|
|
323399
323812
|
}
|
|
323400
323813
|
});
|
|
323401
323814
|
} catch (e16) {
|
|
@@ -323535,11 +323948,11 @@ async function repositoryUri(ecr, repositoryName) {
|
|
|
323535
323948
|
return void 0;
|
|
323536
323949
|
}
|
|
323537
323950
|
}
|
|
323538
|
-
var
|
|
323951
|
+
var path19, ContainerImageAssetHandler, ContainerImageBuilder;
|
|
323539
323952
|
var init_container_images = __esm({
|
|
323540
323953
|
"../cdk-assets-lib/lib/private/handlers/container-images.ts"() {
|
|
323541
323954
|
"use strict";
|
|
323542
|
-
|
|
323955
|
+
path19 = __toESM(require("path"));
|
|
323543
323956
|
init_client_options();
|
|
323544
323957
|
init_progress();
|
|
323545
323958
|
init_placeholders2();
|
|
@@ -323710,7 +324123,7 @@ var init_container_images = __esm({
|
|
|
323710
324123
|
`'directory' is expected in the DockerImage asset source, got: ${JSON.stringify(source)}`
|
|
323711
324124
|
);
|
|
323712
324125
|
}
|
|
323713
|
-
const fullPath =
|
|
324126
|
+
const fullPath = path19.resolve(this.workDir, source.directory);
|
|
323714
324127
|
this.host.emitMessage("build" /* BUILD */, `Building Docker image at ${fullPath}`);
|
|
323715
324128
|
await this.docker.build({
|
|
323716
324129
|
directory: fullPath,
|
|
@@ -323834,15 +324247,15 @@ function writeZipFile(directory, outputFile) {
|
|
|
323834
324247
|
cwd: directory
|
|
323835
324248
|
};
|
|
323836
324249
|
const files = sync("**", globOptions);
|
|
323837
|
-
const output = (0,
|
|
324250
|
+
const output = (0, import_fs6.createWriteStream)(outputFile);
|
|
323838
324251
|
const archive = archiver2("zip");
|
|
323839
324252
|
archive.on("warning", fail);
|
|
323840
324253
|
archive.on("error", fail);
|
|
323841
324254
|
output.once("close", ok);
|
|
323842
324255
|
archive.pipe(output);
|
|
323843
324256
|
for (const file of files) {
|
|
323844
|
-
const fullPath =
|
|
323845
|
-
const [data2, stat6] = await Promise.all([
|
|
324257
|
+
const fullPath = path20.resolve(directory, file);
|
|
324258
|
+
const [data2, stat6] = await Promise.all([import_fs6.promises.readFile(fullPath), import_fs6.promises.stat(fullPath)]);
|
|
323846
324259
|
archive.append(data2, {
|
|
323847
324260
|
name: file,
|
|
323848
324261
|
date: /* @__PURE__ */ new Date("1980-01-01T00:00:00.000Z"),
|
|
@@ -323858,7 +324271,7 @@ async function moveIntoPlace(source, target, eventEmitter) {
|
|
|
323858
324271
|
let attempts = 5;
|
|
323859
324272
|
while (true) {
|
|
323860
324273
|
try {
|
|
323861
|
-
await
|
|
324274
|
+
await import_fs6.promises.rename(source, target);
|
|
323862
324275
|
return;
|
|
323863
324276
|
} catch (e16) {
|
|
323864
324277
|
if (e16.code !== "EPERM" || attempts-- <= 0) {
|
|
@@ -323876,12 +324289,12 @@ function sleep(ms) {
|
|
|
323876
324289
|
function randomString() {
|
|
323877
324290
|
return Math.random().toString(36).replace(/[^a-z0-9]+/g, "");
|
|
323878
324291
|
}
|
|
323879
|
-
var
|
|
324292
|
+
var import_fs6, path20, archiver2;
|
|
323880
324293
|
var init_archive2 = __esm({
|
|
323881
324294
|
"../cdk-assets-lib/lib/private/archive.ts"() {
|
|
323882
324295
|
"use strict";
|
|
323883
|
-
|
|
323884
|
-
|
|
324296
|
+
import_fs6 = require("fs");
|
|
324297
|
+
path20 = __toESM(require("path"));
|
|
323885
324298
|
init_esm10();
|
|
323886
324299
|
archiver2 = require_archiver();
|
|
323887
324300
|
__name(zipDirectory, "zipDirectory");
|
|
@@ -323904,12 +324317,12 @@ async function pathExists(pathName) {
|
|
|
323904
324317
|
return false;
|
|
323905
324318
|
}
|
|
323906
324319
|
}
|
|
323907
|
-
var
|
|
324320
|
+
var fs21, pfs;
|
|
323908
324321
|
var init_fs_extra = __esm({
|
|
323909
324322
|
"../cdk-assets-lib/lib/private/fs-extra.ts"() {
|
|
323910
324323
|
"use strict";
|
|
323911
|
-
|
|
323912
|
-
pfs =
|
|
324324
|
+
fs21 = __toESM(require("fs"));
|
|
324325
|
+
pfs = fs21.promises;
|
|
323913
324326
|
__name(pathExists, "pathExists");
|
|
323914
324327
|
}
|
|
323915
324328
|
});
|
|
@@ -323933,12 +324346,12 @@ async function cached2(cache16, key, factory) {
|
|
|
323933
324346
|
cache16.set(key, fresh);
|
|
323934
324347
|
return fresh;
|
|
323935
324348
|
}
|
|
323936
|
-
var
|
|
324349
|
+
var import_fs7, path21, import_cloud_assembly_schema3, mime, EMPTY_ZIP_FILE_SIZE, FileAssetHandler, BucketInformation;
|
|
323937
324350
|
var init_files = __esm({
|
|
323938
324351
|
"../cdk-assets-lib/lib/private/handlers/files.ts"() {
|
|
323939
324352
|
"use strict";
|
|
323940
|
-
|
|
323941
|
-
|
|
324353
|
+
import_fs7 = require("fs");
|
|
324354
|
+
path21 = __toESM(require("path"));
|
|
323942
324355
|
import_cloud_assembly_schema3 = __toESM(require_lib2());
|
|
323943
324356
|
mime = __toESM(require_mime());
|
|
323944
324357
|
init_client_options();
|
|
@@ -323953,7 +324366,7 @@ var init_files = __esm({
|
|
|
323953
324366
|
this.workDir = workDir;
|
|
323954
324367
|
this.asset = asset;
|
|
323955
324368
|
this.host = host;
|
|
323956
|
-
this.fileCacheRoot =
|
|
324369
|
+
this.fileCacheRoot = path21.join(workDir, ".cache");
|
|
323957
324370
|
}
|
|
323958
324371
|
static {
|
|
323959
324372
|
__name(this, "FileAssetHandler");
|
|
@@ -324067,7 +324480,7 @@ var init_files = __esm({
|
|
|
324067
324480
|
{
|
|
324068
324481
|
Bucket: destination.bucketName,
|
|
324069
324482
|
Key: destination.objectKey,
|
|
324070
|
-
Body: (0,
|
|
324483
|
+
Body: (0, import_fs7.createReadStream)(publishFile.packagedPath),
|
|
324071
324484
|
ContentType: publishFile.contentType,
|
|
324072
324485
|
ChecksumAlgorithm: "SHA256"
|
|
324073
324486
|
},
|
|
@@ -324081,11 +324494,11 @@ var init_files = __esm({
|
|
|
324081
324494
|
`'path' is expected in the File asset source, got: ${JSON.stringify(source)}`
|
|
324082
324495
|
);
|
|
324083
324496
|
}
|
|
324084
|
-
const fullPath =
|
|
324497
|
+
const fullPath = path21.resolve(this.workDir, source.path);
|
|
324085
324498
|
if (source.packaging === import_cloud_assembly_schema3.FileAssetPackaging.ZIP_DIRECTORY) {
|
|
324086
324499
|
const contentType = "application/zip";
|
|
324087
|
-
await
|
|
324088
|
-
const packagedPath =
|
|
324500
|
+
await import_fs7.promises.mkdir(this.fileCacheRoot, { recursive: true });
|
|
324501
|
+
const packagedPath = path21.join(this.fileCacheRoot, `${this.asset.id.assetId}.zip`);
|
|
324089
324502
|
if (await pathExists(packagedPath)) {
|
|
324090
324503
|
this.host.emitMessage("cached" /* CACHED */, `From cache ${packagedPath}`);
|
|
324091
324504
|
return { packagedPath, contentType };
|
|
@@ -324226,12 +324639,12 @@ function prefixTreeChars(xs, prefix = "") {
|
|
|
324226
324639
|
}
|
|
324227
324640
|
return ret;
|
|
324228
324641
|
}
|
|
324229
|
-
var
|
|
324642
|
+
var fs23, path22, import_cloud_assembly_schema4, AssetManifest, ASSET_TYPES, FileManifestEntry, DockerImageManifestEntry, DestinationIdentifier, DestinationPattern;
|
|
324230
324643
|
var init_asset_manifest = __esm({
|
|
324231
324644
|
"../cdk-assets-lib/lib/asset-manifest.ts"() {
|
|
324232
324645
|
"use strict";
|
|
324233
|
-
|
|
324234
|
-
|
|
324646
|
+
fs23 = __toESM(require("fs"));
|
|
324647
|
+
path22 = __toESM(require("path"));
|
|
324235
324648
|
import_cloud_assembly_schema4 = __toESM(require_lib2());
|
|
324236
324649
|
AssetManifest = class _AssetManifest {
|
|
324237
324650
|
constructor(directory, manifest) {
|
|
@@ -324253,7 +324666,7 @@ var init_asset_manifest = __esm({
|
|
|
324253
324666
|
static fromFile(fileName) {
|
|
324254
324667
|
try {
|
|
324255
324668
|
const obj = import_cloud_assembly_schema4.Manifest.loadAssetManifest(fileName);
|
|
324256
|
-
return new _AssetManifest(
|
|
324669
|
+
return new _AssetManifest(path22.dirname(fileName), obj);
|
|
324257
324670
|
} catch (e16) {
|
|
324258
324671
|
throw new Error(`Cannot read asset manifest '${fileName}': ${e16.message}`);
|
|
324259
324672
|
}
|
|
@@ -324266,12 +324679,12 @@ var init_asset_manifest = __esm({
|
|
|
324266
324679
|
static fromPath(filePath) {
|
|
324267
324680
|
let st;
|
|
324268
324681
|
try {
|
|
324269
|
-
st =
|
|
324682
|
+
st = fs23.statSync(filePath);
|
|
324270
324683
|
} catch (e16) {
|
|
324271
324684
|
throw new Error(`Cannot read asset manifest at '${filePath}': ${e16.message}`);
|
|
324272
324685
|
}
|
|
324273
324686
|
if (st.isDirectory()) {
|
|
324274
|
-
return _AssetManifest.fromFile(
|
|
324687
|
+
return _AssetManifest.fromFile(path22.join(filePath, _AssetManifest.DEFAULT_FILENAME));
|
|
324275
324688
|
}
|
|
324276
324689
|
return _AssetManifest.fromFile(filePath);
|
|
324277
324690
|
}
|
|
@@ -324732,16 +325145,16 @@ __export(aws_exports, {
|
|
|
324732
325145
|
});
|
|
324733
325146
|
function safeUsername2() {
|
|
324734
325147
|
try {
|
|
324735
|
-
return
|
|
325148
|
+
return os8.userInfo().username.replace(/[^\w+=,.@-]/g, "@");
|
|
324736
325149
|
} catch {
|
|
324737
325150
|
return "noname";
|
|
324738
325151
|
}
|
|
324739
325152
|
}
|
|
324740
|
-
var
|
|
325153
|
+
var os8, import_client_ecr2, import_client_s32, import_client_secrets_manager2, import_client_sts2, import_credential_providers3, import_lib_storage2, import_config_resolver31, import_node_config_provider16, USER_AGENT, DefaultAwsClient;
|
|
324741
325154
|
var init_aws = __esm({
|
|
324742
325155
|
"../cdk-assets-lib/lib/aws.ts"() {
|
|
324743
325156
|
"use strict";
|
|
324744
|
-
|
|
325157
|
+
os8 = __toESM(require("os"));
|
|
324745
325158
|
import_client_ecr2 = __toESM(require_dist_cjs117());
|
|
324746
325159
|
import_client_s32 = __toESM(require_dist_cjs156());
|
|
324747
325160
|
import_client_secrets_manager2 = __toESM(require_dist_cjs157());
|
|
@@ -325430,8 +325843,8 @@ Run the following command in order to setup an S3 bucket in this environment, an
|
|
|
325430
325843
|
let templateFile = stack.templateFile;
|
|
325431
325844
|
if (overrideTemplate) {
|
|
325432
325845
|
templateFile = `${stack.templateFile}-${templateHash}.yaml`;
|
|
325433
|
-
const templateFilePath =
|
|
325434
|
-
await
|
|
325846
|
+
const templateFilePath = path23.join(stack.assembly.directory, templateFile);
|
|
325847
|
+
await fs24.writeFile(templateFilePath, templateJson, { encoding: "utf-8" });
|
|
325435
325848
|
}
|
|
325436
325849
|
assetManifest.addFileAsset(
|
|
325437
325850
|
templateHash,
|
|
@@ -325483,12 +325896,12 @@ function setEnv(name, value) {
|
|
|
325483
325896
|
delete process.env[name];
|
|
325484
325897
|
}
|
|
325485
325898
|
}
|
|
325486
|
-
var
|
|
325899
|
+
var fs24, path23, util4, import_cloud_assembly_api5, import_client_s33, import_middleware_endpoint37, chalk4, LARGE_TEMPLATE_SIZE_KB;
|
|
325487
325900
|
var init_template_body_parameter = __esm({
|
|
325488
325901
|
"../toolkit-lib/lib/api/cloudformation/template-body-parameter.ts"() {
|
|
325489
325902
|
"use strict";
|
|
325490
|
-
|
|
325491
|
-
|
|
325903
|
+
fs24 = __toESM(require("node:fs/promises"));
|
|
325904
|
+
path23 = __toESM(require("node:path"));
|
|
325492
325905
|
util4 = __toESM(require("node:util"));
|
|
325493
325906
|
import_cloud_assembly_api5 = __toESM(require_lib3());
|
|
325494
325907
|
import_client_s33 = __toESM(require_dist_cjs156());
|
|
@@ -326191,11 +326604,11 @@ async function loadNestedStacks(rootStackArtifact, sdk, parentTemplates) {
|
|
|
326191
326604
|
return nestedStacks;
|
|
326192
326605
|
}
|
|
326193
326606
|
async function getNestedStackTemplates(rootStackArtifact, nestedTemplateAssetPath, nestedStackLogicalId, listStackResources, sdk) {
|
|
326194
|
-
const nestedTemplatePath =
|
|
326607
|
+
const nestedTemplatePath = path24.join(rootStackArtifact.assembly.directory, nestedTemplateAssetPath);
|
|
326195
326608
|
const nestedStackArn = await getNestedStackArn(nestedStackLogicalId, listStackResources);
|
|
326196
326609
|
const deployedStackName = nestedStackArn?.slice(nestedStackArn.indexOf("/") + 1, nestedStackArn.lastIndexOf("/"));
|
|
326197
326610
|
return {
|
|
326198
|
-
generatedTemplate: JSON.parse(
|
|
326611
|
+
generatedTemplate: JSON.parse(fs25.readFileSync(nestedTemplatePath, "utf-8")),
|
|
326199
326612
|
deployedTemplate: deployedStackName ? await loadCurrentStackTemplate(deployedStackName, sdk) : {},
|
|
326200
326613
|
deployedStackName
|
|
326201
326614
|
};
|
|
@@ -326214,12 +326627,12 @@ async function getNestedStackArn(nestedStackLogicalId, listStackResources) {
|
|
|
326214
326627
|
function isCdkManagedNestedStack(stackResource) {
|
|
326215
326628
|
return stackResource.Type === "AWS::CloudFormation::Stack" && stackResource.Metadata && stackResource.Metadata["aws:asset:path"];
|
|
326216
326629
|
}
|
|
326217
|
-
var
|
|
326630
|
+
var path24, fs25;
|
|
326218
326631
|
var init_nested_stack_helpers = __esm({
|
|
326219
326632
|
"../toolkit-lib/lib/api/cloudformation/nested-stack-helpers.ts"() {
|
|
326220
326633
|
"use strict";
|
|
326221
|
-
|
|
326222
|
-
|
|
326634
|
+
path24 = __toESM(require("path"));
|
|
326635
|
+
fs25 = __toESM(require_lib6());
|
|
326223
326636
|
init_evaluate_cloudformation_template();
|
|
326224
326637
|
init_stack_helpers();
|
|
326225
326638
|
init_util();
|
|
@@ -327396,6 +327809,864 @@ var init_context_aware_source = __esm({
|
|
|
327396
327809
|
}
|
|
327397
327810
|
});
|
|
327398
327811
|
|
|
327812
|
+
// ../toolkit-lib/node_modules/split2/index.js
|
|
327813
|
+
var require_split2 = __commonJS({
|
|
327814
|
+
"../toolkit-lib/node_modules/split2/index.js"(exports2, module2) {
|
|
327815
|
+
"use strict";
|
|
327816
|
+
var { Transform } = require("stream");
|
|
327817
|
+
var { StringDecoder: StringDecoder3 } = require("string_decoder");
|
|
327818
|
+
var kLast = /* @__PURE__ */ Symbol("last");
|
|
327819
|
+
var kDecoder = /* @__PURE__ */ Symbol("decoder");
|
|
327820
|
+
function transform(chunk, enc, cb) {
|
|
327821
|
+
let list2;
|
|
327822
|
+
if (this.overflow) {
|
|
327823
|
+
const buf = this[kDecoder].write(chunk);
|
|
327824
|
+
list2 = buf.split(this.matcher);
|
|
327825
|
+
if (list2.length === 1) return cb();
|
|
327826
|
+
list2.shift();
|
|
327827
|
+
this.overflow = false;
|
|
327828
|
+
} else {
|
|
327829
|
+
this[kLast] += this[kDecoder].write(chunk);
|
|
327830
|
+
list2 = this[kLast].split(this.matcher);
|
|
327831
|
+
}
|
|
327832
|
+
this[kLast] = list2.pop();
|
|
327833
|
+
for (let i16 = 0; i16 < list2.length; i16++) {
|
|
327834
|
+
try {
|
|
327835
|
+
push(this, this.mapper(list2[i16]));
|
|
327836
|
+
} catch (error4) {
|
|
327837
|
+
return cb(error4);
|
|
327838
|
+
}
|
|
327839
|
+
}
|
|
327840
|
+
this.overflow = this[kLast].length > this.maxLength;
|
|
327841
|
+
if (this.overflow && !this.skipOverflow) {
|
|
327842
|
+
cb(new Error("maximum buffer reached"));
|
|
327843
|
+
return;
|
|
327844
|
+
}
|
|
327845
|
+
cb();
|
|
327846
|
+
}
|
|
327847
|
+
__name(transform, "transform");
|
|
327848
|
+
function flush(cb) {
|
|
327849
|
+
this[kLast] += this[kDecoder].end();
|
|
327850
|
+
if (this[kLast]) {
|
|
327851
|
+
try {
|
|
327852
|
+
push(this, this.mapper(this[kLast]));
|
|
327853
|
+
} catch (error4) {
|
|
327854
|
+
return cb(error4);
|
|
327855
|
+
}
|
|
327856
|
+
}
|
|
327857
|
+
cb();
|
|
327858
|
+
}
|
|
327859
|
+
__name(flush, "flush");
|
|
327860
|
+
function push(self2, val) {
|
|
327861
|
+
if (val !== void 0) {
|
|
327862
|
+
self2.push(val);
|
|
327863
|
+
}
|
|
327864
|
+
}
|
|
327865
|
+
__name(push, "push");
|
|
327866
|
+
function noop(incoming) {
|
|
327867
|
+
return incoming;
|
|
327868
|
+
}
|
|
327869
|
+
__name(noop, "noop");
|
|
327870
|
+
function split2(matcher, mapper, options) {
|
|
327871
|
+
matcher = matcher || /\r?\n/;
|
|
327872
|
+
mapper = mapper || noop;
|
|
327873
|
+
options = options || {};
|
|
327874
|
+
switch (arguments.length) {
|
|
327875
|
+
case 1:
|
|
327876
|
+
if (typeof matcher === "function") {
|
|
327877
|
+
mapper = matcher;
|
|
327878
|
+
matcher = /\r?\n/;
|
|
327879
|
+
} else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
|
|
327880
|
+
options = matcher;
|
|
327881
|
+
matcher = /\r?\n/;
|
|
327882
|
+
}
|
|
327883
|
+
break;
|
|
327884
|
+
case 2:
|
|
327885
|
+
if (typeof matcher === "function") {
|
|
327886
|
+
options = mapper;
|
|
327887
|
+
mapper = matcher;
|
|
327888
|
+
matcher = /\r?\n/;
|
|
327889
|
+
} else if (typeof mapper === "object") {
|
|
327890
|
+
options = mapper;
|
|
327891
|
+
mapper = noop;
|
|
327892
|
+
}
|
|
327893
|
+
}
|
|
327894
|
+
options = Object.assign({}, options);
|
|
327895
|
+
options.autoDestroy = true;
|
|
327896
|
+
options.transform = transform;
|
|
327897
|
+
options.flush = flush;
|
|
327898
|
+
options.readableObjectMode = true;
|
|
327899
|
+
const stream2 = new Transform(options);
|
|
327900
|
+
stream2[kLast] = "";
|
|
327901
|
+
stream2[kDecoder] = new StringDecoder3("utf8");
|
|
327902
|
+
stream2.matcher = matcher;
|
|
327903
|
+
stream2.mapper = mapper;
|
|
327904
|
+
stream2.maxLength = options.maxLength;
|
|
327905
|
+
stream2.skipOverflow = options.skipOverflow || false;
|
|
327906
|
+
stream2.overflow = false;
|
|
327907
|
+
stream2._destroy = function(err, cb) {
|
|
327908
|
+
this._writableState.errorEmitted = false;
|
|
327909
|
+
cb(err);
|
|
327910
|
+
};
|
|
327911
|
+
return stream2;
|
|
327912
|
+
}
|
|
327913
|
+
__name(split2, "split");
|
|
327914
|
+
module2.exports = split2;
|
|
327915
|
+
}
|
|
327916
|
+
});
|
|
327917
|
+
|
|
327918
|
+
// ../toolkit-lib/lib/api/cloud-assembly/private/exec.ts
|
|
327919
|
+
async function execInChildProcess(commandAndArgs, options = {}) {
|
|
327920
|
+
return new Promise((ok, fail) => {
|
|
327921
|
+
const proc2 = child_process2.spawn(commandAndArgs, {
|
|
327922
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
327923
|
+
detached: false,
|
|
327924
|
+
cwd: options.cwd,
|
|
327925
|
+
env: options.env,
|
|
327926
|
+
// We are using 'shell: true' on purprose. Traditionally we have allowed shell features in
|
|
327927
|
+
// this string, so we have to continue to do so into the future. On Windows, this is simply
|
|
327928
|
+
// necessary to run .bat and .cmd files properly.
|
|
327929
|
+
// Code scanning tools will flag this as a risk. The input comes from a trusted source,
|
|
327930
|
+
// so it does not represent a security risk.
|
|
327931
|
+
shell: true
|
|
327932
|
+
});
|
|
327933
|
+
const eventPublisher = options.eventPublisher ?? ((type, line) => {
|
|
327934
|
+
switch (type) {
|
|
327935
|
+
case "data_stdout":
|
|
327936
|
+
process.stdout.write(line);
|
|
327937
|
+
return;
|
|
327938
|
+
case "data_stderr":
|
|
327939
|
+
process.stderr.write(line);
|
|
327940
|
+
return;
|
|
327941
|
+
case "open":
|
|
327942
|
+
case "close":
|
|
327943
|
+
return;
|
|
327944
|
+
}
|
|
327945
|
+
});
|
|
327946
|
+
const stderr2 = new Array();
|
|
327947
|
+
proc2.stdout.pipe(split()).on("data", (line) => eventPublisher("data_stdout", line));
|
|
327948
|
+
proc2.stderr.pipe(split()).on("data", (line) => {
|
|
327949
|
+
stderr2.push(line);
|
|
327950
|
+
return eventPublisher("data_stderr", line);
|
|
327951
|
+
});
|
|
327952
|
+
proc2.on("error", fail);
|
|
327953
|
+
proc2.on("exit", (code) => {
|
|
327954
|
+
if (code === 0) {
|
|
327955
|
+
return ok();
|
|
327956
|
+
} else {
|
|
327957
|
+
let cause;
|
|
327958
|
+
if (stderr2.length) {
|
|
327959
|
+
cause = new Error(stderr2.join("\n"));
|
|
327960
|
+
cause.name = "ExecutionError";
|
|
327961
|
+
}
|
|
327962
|
+
return fail(AssemblyError.withCause(`${commandAndArgs}: Subprocess exited with error ${code}`, cause));
|
|
327963
|
+
}
|
|
327964
|
+
});
|
|
327965
|
+
});
|
|
327966
|
+
}
|
|
327967
|
+
var child_process2, split;
|
|
327968
|
+
var init_exec = __esm({
|
|
327969
|
+
"../toolkit-lib/lib/api/cloud-assembly/private/exec.ts"() {
|
|
327970
|
+
"use strict";
|
|
327971
|
+
child_process2 = __toESM(require("node:child_process"));
|
|
327972
|
+
init_toolkit_error();
|
|
327973
|
+
split = require_split2();
|
|
327974
|
+
__name(execInChildProcess, "execInChildProcess");
|
|
327975
|
+
}
|
|
327976
|
+
});
|
|
327977
|
+
|
|
327978
|
+
// ../toolkit-lib/lib/api/cloud-assembly/environment.ts
|
|
327979
|
+
async function prepareDefaultEnvironment(aws, debugFn) {
|
|
327980
|
+
const env = {};
|
|
327981
|
+
env[cxapi2.DEFAULT_REGION_ENV] = aws.defaultRegion;
|
|
327982
|
+
await debugFn(`Setting "${cxapi2.DEFAULT_REGION_ENV}" environment variable to ${env[cxapi2.DEFAULT_REGION_ENV]}`);
|
|
327983
|
+
const accountId = (await aws.defaultAccount())?.accountId;
|
|
327984
|
+
if (accountId) {
|
|
327985
|
+
env[cxapi2.DEFAULT_ACCOUNT_ENV] = accountId;
|
|
327986
|
+
await debugFn(`Setting "${cxapi2.DEFAULT_ACCOUNT_ENV}" environment variable to ${env[cxapi2.DEFAULT_ACCOUNT_ENV]}`);
|
|
327987
|
+
}
|
|
327988
|
+
return env;
|
|
327989
|
+
}
|
|
327990
|
+
function contextFromSettings(settings) {
|
|
327991
|
+
const context = {};
|
|
327992
|
+
const pathMetadata = settings.get(["pathMetadata"]) ?? true;
|
|
327993
|
+
if (pathMetadata) {
|
|
327994
|
+
context[cxapi2.PATH_METADATA_ENABLE_CONTEXT] = true;
|
|
327995
|
+
}
|
|
327996
|
+
const assetMetadata = settings.get(["assetMetadata"]) ?? true;
|
|
327997
|
+
if (assetMetadata) {
|
|
327998
|
+
context[cxapi2.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT] = true;
|
|
327999
|
+
}
|
|
328000
|
+
const versionReporting = settings.get(["versionReporting"]) ?? true;
|
|
328001
|
+
if (versionReporting) {
|
|
328002
|
+
context[cxapi2.ANALYTICS_REPORTING_ENABLED_CONTEXT] = true;
|
|
328003
|
+
}
|
|
328004
|
+
if (!versionReporting) {
|
|
328005
|
+
context["aws:cdk:disable-version-reporting"] = true;
|
|
328006
|
+
}
|
|
328007
|
+
const stagingEnabled = settings.get(["staging"]) ?? true;
|
|
328008
|
+
if (!stagingEnabled) {
|
|
328009
|
+
context[cxapi2.DISABLE_ASSET_STAGING_CONTEXT] = true;
|
|
328010
|
+
}
|
|
328011
|
+
const bundlingStacks = settings.get(["bundlingStacks"]) ?? ["**"];
|
|
328012
|
+
context[cxapi2.BUNDLING_STACKS] = bundlingStacks;
|
|
328013
|
+
return context;
|
|
328014
|
+
}
|
|
328015
|
+
function synthParametersFromSettings(settings) {
|
|
328016
|
+
return {
|
|
328017
|
+
context: contextFromSettings(settings),
|
|
328018
|
+
env: {
|
|
328019
|
+
// An environment variable instead of a context variable, so it can also
|
|
328020
|
+
// be accessed in framework code where we don't have access to a construct tree.
|
|
328021
|
+
...settings.get(["debug"]) ? { CDK_DEBUG: "true" } : {}
|
|
328022
|
+
}
|
|
328023
|
+
};
|
|
328024
|
+
}
|
|
328025
|
+
function spaceAvailableForContext(env, limit) {
|
|
328026
|
+
const size = /* @__PURE__ */ __name((value) => value != null ? Buffer.byteLength(value) : 0, "size");
|
|
328027
|
+
const usedSpace = Object.entries(env).map(([k16, v17]) => k16 === cxapi2.CONTEXT_ENV ? size(k16) : size(k16) + size(v17)).reduce((a16, b16) => a16 + b16, 0);
|
|
328028
|
+
return Math.max(0, limit - usedSpace);
|
|
328029
|
+
}
|
|
328030
|
+
async function guessExecutable(commandLine, debugFn) {
|
|
328031
|
+
const fullFile = await checkFile(commandLine);
|
|
328032
|
+
if (fullFile) {
|
|
328033
|
+
return guessInterpreter(fullFile);
|
|
328034
|
+
}
|
|
328035
|
+
const [first, rest] = splitFirstShellWord(commandLine);
|
|
328036
|
+
const firstFile = await checkFile(first);
|
|
328037
|
+
if (firstFile) {
|
|
328038
|
+
return `${guessInterpreter(firstFile)} ${rest}`.trim();
|
|
328039
|
+
}
|
|
328040
|
+
await debugFn(`Not a file: '${commandLine}'. Using '${commandLine} as command-line`);
|
|
328041
|
+
return commandLine;
|
|
328042
|
+
}
|
|
328043
|
+
function guessInterpreter(file) {
|
|
328044
|
+
const isWindows2 = process.platform === "win32";
|
|
328045
|
+
const handler = EXTENSION_MAP[path25.extname(file.fileName)];
|
|
328046
|
+
if (handler && (!file.isExecutable || isWindows2)) {
|
|
328047
|
+
return handler(file.fileName);
|
|
328048
|
+
}
|
|
328049
|
+
return quoteSpaces(file.fileName);
|
|
328050
|
+
}
|
|
328051
|
+
function executeNode(scriptFile) {
|
|
328052
|
+
return `${quoteSpaces(process.execPath)} ${quoteSpaces(scriptFile)}`;
|
|
328053
|
+
}
|
|
328054
|
+
function splitFirstShellWord(commandLine) {
|
|
328055
|
+
commandLine = commandLine.trim();
|
|
328056
|
+
if (commandLine[0] === '"') {
|
|
328057
|
+
const endQuote = commandLine.indexOf('"', 1);
|
|
328058
|
+
return endQuote > -1 ? [commandLine.slice(1, endQuote), commandLine.slice(endQuote + 1).trim()] : [commandLine, ""];
|
|
328059
|
+
} else {
|
|
328060
|
+
const space = commandLine.indexOf(" ");
|
|
328061
|
+
return space > -1 ? [commandLine.slice(0, space), commandLine.slice(space + 1)] : [commandLine, ""];
|
|
328062
|
+
}
|
|
328063
|
+
}
|
|
328064
|
+
async function checkFile(fileName) {
|
|
328065
|
+
try {
|
|
328066
|
+
const fstat = await fs26.stat(fileName);
|
|
328067
|
+
return {
|
|
328068
|
+
fileName,
|
|
328069
|
+
// eslint-disable-next-line no-bitwise
|
|
328070
|
+
isExecutable: (fstat.mode & fs26.constants.X_OK) !== 0
|
|
328071
|
+
};
|
|
328072
|
+
} catch {
|
|
328073
|
+
return void 0;
|
|
328074
|
+
}
|
|
328075
|
+
}
|
|
328076
|
+
function quoteSpaces(part) {
|
|
328077
|
+
if (part.includes(" ")) {
|
|
328078
|
+
return `"${part}"`;
|
|
328079
|
+
}
|
|
328080
|
+
return part;
|
|
328081
|
+
}
|
|
328082
|
+
var path25, cxapi2, fs26, EXTENSION_MAP;
|
|
328083
|
+
var init_environment3 = __esm({
|
|
328084
|
+
"../toolkit-lib/lib/api/cloud-assembly/environment.ts"() {
|
|
328085
|
+
"use strict";
|
|
328086
|
+
path25 = __toESM(require("path"));
|
|
328087
|
+
cxapi2 = __toESM(require_lib4());
|
|
328088
|
+
fs26 = __toESM(require_lib6());
|
|
328089
|
+
__name(prepareDefaultEnvironment, "prepareDefaultEnvironment");
|
|
328090
|
+
__name(contextFromSettings, "contextFromSettings");
|
|
328091
|
+
__name(synthParametersFromSettings, "synthParametersFromSettings");
|
|
328092
|
+
__name(spaceAvailableForContext, "spaceAvailableForContext");
|
|
328093
|
+
__name(guessExecutable, "guessExecutable");
|
|
328094
|
+
__name(guessInterpreter, "guessInterpreter");
|
|
328095
|
+
EXTENSION_MAP = {
|
|
328096
|
+
".js": executeNode
|
|
328097
|
+
};
|
|
328098
|
+
__name(executeNode, "executeNode");
|
|
328099
|
+
__name(splitFirstShellWord, "splitFirstShellWord");
|
|
328100
|
+
__name(checkFile, "checkFile");
|
|
328101
|
+
__name(quoteSpaces, "quoteSpaces");
|
|
328102
|
+
}
|
|
328103
|
+
});
|
|
328104
|
+
|
|
328105
|
+
// ../toolkit-lib/lib/api/cloud-assembly/private/prepare-source.ts
|
|
328106
|
+
function writeContextToEnv(env, context, completeness) {
|
|
328107
|
+
let contextOverflowLocation = null;
|
|
328108
|
+
const envVariableSizeLimit = os9.platform() === "win32" ? 32760 : 131072;
|
|
328109
|
+
const completeEnv = { ...completeness === "add-process-env-later" ? process.env : {}, ...env };
|
|
328110
|
+
const [smallContext, overflow] = splitBySize(context, spaceAvailableForContext(completeEnv, envVariableSizeLimit));
|
|
328111
|
+
env[cxapi3.CONTEXT_ENV] = JSON.stringify(smallContext);
|
|
328112
|
+
if (Object.keys(overflow ?? {}).length > 0) {
|
|
328113
|
+
const contextDir = fs27.mkdtempSync(path26.join(os9.tmpdir(), "cdk-context"));
|
|
328114
|
+
contextOverflowLocation = path26.join(contextDir, "context-overflow.json");
|
|
328115
|
+
fs27.writeJSONSync(contextOverflowLocation, overflow);
|
|
328116
|
+
env[cxapi3.CONTEXT_OVERFLOW_LOCATION_ENV] = contextOverflowLocation;
|
|
328117
|
+
}
|
|
328118
|
+
return async () => {
|
|
328119
|
+
if (contextOverflowLocation) {
|
|
328120
|
+
await fs27.promises.rm(path26.dirname(contextOverflowLocation), { recursive: true, force: true });
|
|
328121
|
+
}
|
|
328122
|
+
};
|
|
328123
|
+
}
|
|
328124
|
+
async function checkContextOverflowSupport(assembly, ioHelper) {
|
|
328125
|
+
const traceFn = /* @__PURE__ */ __name((msg) => ioHelper.defaults.trace(msg), "traceFn");
|
|
328126
|
+
const tree = await loadTree(assembly, traceFn);
|
|
328127
|
+
if (!frameworkSupportsContextOverflow(tree)) {
|
|
328128
|
+
await ioHelper.notify(IO.CDK_ASSEMBLY_W0010.msg("Part of the context could not be sent to the application. Please update the AWS CDK library to the latest version."));
|
|
328129
|
+
}
|
|
328130
|
+
}
|
|
328131
|
+
function frameworkSupportsContextOverflow(tree) {
|
|
328132
|
+
return !some(tree, (node) => {
|
|
328133
|
+
const fqn = node.constructInfo?.fqn;
|
|
328134
|
+
const version = node.constructInfo?.version;
|
|
328135
|
+
return fqn === "aws-cdk-lib.App" && version !== "0.0.0" && version != null && (0, import_semver.lte)(version, "2.38.0") || fqn === "@aws-cdk/core.App";
|
|
328136
|
+
});
|
|
328137
|
+
}
|
|
328138
|
+
async function assemblyFromDirectory(assemblyDir, ioHelper, loadOptions = {}) {
|
|
328139
|
+
try {
|
|
328140
|
+
const assembly = new import_cloud_assembly_api9.CloudAssembly(assemblyDir, {
|
|
328141
|
+
skipVersionCheck: !(loadOptions.checkVersion ?? true),
|
|
328142
|
+
skipEnumCheck: !(loadOptions.checkEnums ?? true),
|
|
328143
|
+
// We sort as we deploy
|
|
328144
|
+
topoSort: false
|
|
328145
|
+
});
|
|
328146
|
+
await checkContextOverflowSupport(assembly, ioHelper);
|
|
328147
|
+
return assembly;
|
|
328148
|
+
} catch (err) {
|
|
328149
|
+
if (err.message.includes(cxschema7.VERSION_MISMATCH)) {
|
|
328150
|
+
const message2 = "This AWS CDK Toolkit is not compatible with the AWS CDK library used by your application. Please upgrade to the latest version.";
|
|
328151
|
+
await ioHelper.notify(IO.CDK_ASSEMBLY_E1111.msg(message2, { error: err }));
|
|
328152
|
+
throw new ToolkitError(`${message2}
|
|
328153
|
+
(${err.message}`);
|
|
328154
|
+
}
|
|
328155
|
+
throw err;
|
|
328156
|
+
}
|
|
328157
|
+
}
|
|
328158
|
+
function settingsFromSynthOptions(synthOpts = {}) {
|
|
328159
|
+
return new Settings({
|
|
328160
|
+
debug: false,
|
|
328161
|
+
pathMetadata: true,
|
|
328162
|
+
versionReporting: true,
|
|
328163
|
+
assetMetadata: true,
|
|
328164
|
+
assetStaging: true,
|
|
328165
|
+
...synthOpts
|
|
328166
|
+
}, true);
|
|
328167
|
+
}
|
|
328168
|
+
function parametersFromSynthOptions(synthOptions) {
|
|
328169
|
+
return synthParametersFromSettings(settingsFromSynthOptions(synthOptions ?? {}));
|
|
328170
|
+
}
|
|
328171
|
+
var import_dispose_polyfill3, os9, path26, import_node_util2, import_cloud_assembly_api9, cxschema7, cxapi3, fs27, import_semver, ExecutionEnvironment;
|
|
328172
|
+
var init_prepare_source = __esm({
|
|
328173
|
+
"../toolkit-lib/lib/api/cloud-assembly/private/prepare-source.ts"() {
|
|
328174
|
+
"use strict";
|
|
328175
|
+
import_dispose_polyfill3 = __toESM(require_dispose_polyfill());
|
|
328176
|
+
os9 = __toESM(require("node:os"));
|
|
328177
|
+
path26 = __toESM(require("node:path"));
|
|
328178
|
+
import_node_util2 = require("node:util");
|
|
328179
|
+
import_cloud_assembly_api9 = __toESM(require_lib3());
|
|
328180
|
+
cxschema7 = __toESM(require_lib2());
|
|
328181
|
+
cxapi3 = __toESM(require_lib4());
|
|
328182
|
+
fs27 = __toESM(require_lib6());
|
|
328183
|
+
import_semver = __toESM(require_semver4());
|
|
328184
|
+
init_toolkit_error();
|
|
328185
|
+
init_util();
|
|
328186
|
+
init_private();
|
|
328187
|
+
init_rwlock();
|
|
328188
|
+
init_settings();
|
|
328189
|
+
init_tree();
|
|
328190
|
+
init_environment3();
|
|
328191
|
+
ExecutionEnvironment = class _ExecutionEnvironment {
|
|
328192
|
+
static {
|
|
328193
|
+
__name(this, "ExecutionEnvironment");
|
|
328194
|
+
}
|
|
328195
|
+
/**
|
|
328196
|
+
* Create an ExecutionEnvironment
|
|
328197
|
+
*
|
|
328198
|
+
* An ExecutionEnvironment holds a writer lock on the given directory which will
|
|
328199
|
+
* be cleaned up when the object is disposed.
|
|
328200
|
+
*
|
|
328201
|
+
* A temporary directory will be created if none is supplied, which will be cleaned
|
|
328202
|
+
* up when this object is disposed.
|
|
328203
|
+
*
|
|
328204
|
+
* If `markSuccessful()` is called, the writer lock is converted to a reader lock
|
|
328205
|
+
* and temporary directories will not be cleaned up anymore.
|
|
328206
|
+
*/
|
|
328207
|
+
static async create(services, options) {
|
|
328208
|
+
let outDirIsTemporary = false;
|
|
328209
|
+
let dir = options.outdir;
|
|
328210
|
+
if (!dir) {
|
|
328211
|
+
outDirIsTemporary = true;
|
|
328212
|
+
dir = fs27.mkdtempSync(path26.join(fs27.realpathSync(os9.tmpdir()), "cdk.out"));
|
|
328213
|
+
}
|
|
328214
|
+
const lock = await new RWLock(dir).acquireWrite();
|
|
328215
|
+
const opts = {
|
|
328216
|
+
outdir: dir,
|
|
328217
|
+
resolveDefaultAppEnv: options.resolveDefaultAppEnv
|
|
328218
|
+
};
|
|
328219
|
+
return new _ExecutionEnvironment(services, opts, {
|
|
328220
|
+
lock,
|
|
328221
|
+
outDirIsTemporary
|
|
328222
|
+
});
|
|
328223
|
+
}
|
|
328224
|
+
/**
|
|
328225
|
+
* Should the outdir be disposed of.
|
|
328226
|
+
*/
|
|
328227
|
+
get shouldDisposeOutDir() {
|
|
328228
|
+
return this.shouldClean;
|
|
328229
|
+
}
|
|
328230
|
+
/**
|
|
328231
|
+
* The directory the cloud assembly will be written to.
|
|
328232
|
+
*/
|
|
328233
|
+
outdir;
|
|
328234
|
+
options;
|
|
328235
|
+
ioHelper;
|
|
328236
|
+
sdkProvider;
|
|
328237
|
+
debugFn;
|
|
328238
|
+
lock;
|
|
328239
|
+
shouldClean;
|
|
328240
|
+
constructor(services, options, { lock, outDirIsTemporary }) {
|
|
328241
|
+
this.ioHelper = services.ioHelper;
|
|
328242
|
+
this.sdkProvider = services.sdkProvider;
|
|
328243
|
+
this.debugFn = (msg) => this.ioHelper.defaults.debug(msg);
|
|
328244
|
+
this.lock = lock;
|
|
328245
|
+
this.shouldClean = outDirIsTemporary;
|
|
328246
|
+
this.outdir = options.outdir;
|
|
328247
|
+
this.options = options;
|
|
328248
|
+
}
|
|
328249
|
+
async [Symbol.asyncDispose]() {
|
|
328250
|
+
await this.lock?.release();
|
|
328251
|
+
if (this.shouldDisposeOutDir) {
|
|
328252
|
+
await fs27.rm(this.outdir, { recursive: true, force: true });
|
|
328253
|
+
}
|
|
328254
|
+
}
|
|
328255
|
+
/**
|
|
328256
|
+
* Mark the execution as successful, which stops the writer lock from being released upon disposal
|
|
328257
|
+
*/
|
|
328258
|
+
async markSuccessful() {
|
|
328259
|
+
if (!this.lock) {
|
|
328260
|
+
throw new TypeError("Cannot mark successful more than once");
|
|
328261
|
+
}
|
|
328262
|
+
const readLock = await this.lock.convertToReaderLock();
|
|
328263
|
+
this.lock = void 0;
|
|
328264
|
+
this.shouldClean = false;
|
|
328265
|
+
return { readLock };
|
|
328266
|
+
}
|
|
328267
|
+
/**
|
|
328268
|
+
* Begin an execution in this environment
|
|
328269
|
+
*
|
|
328270
|
+
* This will acquire a write lock on the given environment. The write lock
|
|
328271
|
+
* will be released automatically when the return object is disposed, unless it
|
|
328272
|
+
* is converted to a reader lock.
|
|
328273
|
+
*/
|
|
328274
|
+
async beginExecution() {
|
|
328275
|
+
const lock = await new RWLock(this.outdir).acquireWrite();
|
|
328276
|
+
let converted = false;
|
|
328277
|
+
return {
|
|
328278
|
+
async writeToReadLock() {
|
|
328279
|
+
converted = true;
|
|
328280
|
+
return lock.convertToReaderLock();
|
|
328281
|
+
},
|
|
328282
|
+
[Symbol.asyncDispose]: async () => {
|
|
328283
|
+
if (!converted) {
|
|
328284
|
+
await lock.release();
|
|
328285
|
+
}
|
|
328286
|
+
}
|
|
328287
|
+
};
|
|
328288
|
+
}
|
|
328289
|
+
/**
|
|
328290
|
+
* Guess the executable from the command-line argument
|
|
328291
|
+
*
|
|
328292
|
+
* Only do this if the file is NOT marked as executable. If it is,
|
|
328293
|
+
* we'll defer to the shebang inside the file itself.
|
|
328294
|
+
*
|
|
328295
|
+
* If we're on Windows, we ALWAYS take the handler, since it's hard to
|
|
328296
|
+
* verify if registry associations have or have not been set up for this
|
|
328297
|
+
* file type, so we'll assume the worst and take control.
|
|
328298
|
+
*/
|
|
328299
|
+
guessExecutable(app) {
|
|
328300
|
+
return guessExecutable(app, this.debugFn);
|
|
328301
|
+
}
|
|
328302
|
+
/**
|
|
328303
|
+
* If we don't have region/account defined in context, we fall back to the default SDK behavior
|
|
328304
|
+
* where region is retrieved from ~/.aws/config and account is based on default credentials provider
|
|
328305
|
+
* chain and then STS is queried.
|
|
328306
|
+
*
|
|
328307
|
+
* This is done opportunistically: for example, if we can't access STS for some reason or the region
|
|
328308
|
+
* is not configured, the context value will be 'null' and there could failures down the line. In
|
|
328309
|
+
* some cases, synthesis does not require region/account information at all, so that might be perfectly
|
|
328310
|
+
* fine in certain scenarios.
|
|
328311
|
+
*/
|
|
328312
|
+
async defaultEnvVars() {
|
|
328313
|
+
const debugFn = /* @__PURE__ */ __name((msg) => this.ioHelper.notify(IO.CDK_ASSEMBLY_I0010.msg(msg)), "debugFn");
|
|
328314
|
+
const env = this.options.resolveDefaultAppEnv ? await prepareDefaultEnvironment(this.sdkProvider, debugFn) : {};
|
|
328315
|
+
env[cxapi3.OUTDIR_ENV] = this.outdir;
|
|
328316
|
+
await debugFn((0, import_node_util2.format)("outdir:", this.outdir));
|
|
328317
|
+
env[cxapi3.CLI_ASM_VERSION_ENV] = cxschema7.Manifest.version();
|
|
328318
|
+
env[cxapi3.CLI_VERSION_ENV] = versionNumber();
|
|
328319
|
+
await debugFn((0, import_node_util2.format)("env:", env));
|
|
328320
|
+
return env;
|
|
328321
|
+
}
|
|
328322
|
+
/**
|
|
328323
|
+
* Run code from a different working directory
|
|
328324
|
+
*/
|
|
328325
|
+
async changeDir(block, workingDir) {
|
|
328326
|
+
const originalWorkingDir = process.cwd();
|
|
328327
|
+
try {
|
|
328328
|
+
if (workingDir) {
|
|
328329
|
+
process.chdir(workingDir);
|
|
328330
|
+
}
|
|
328331
|
+
return await block();
|
|
328332
|
+
} finally {
|
|
328333
|
+
if (workingDir) {
|
|
328334
|
+
process.chdir(originalWorkingDir);
|
|
328335
|
+
}
|
|
328336
|
+
}
|
|
328337
|
+
}
|
|
328338
|
+
};
|
|
328339
|
+
__name(writeContextToEnv, "writeContextToEnv");
|
|
328340
|
+
__name(checkContextOverflowSupport, "checkContextOverflowSupport");
|
|
328341
|
+
__name(frameworkSupportsContextOverflow, "frameworkSupportsContextOverflow");
|
|
328342
|
+
__name(assemblyFromDirectory, "assemblyFromDirectory");
|
|
328343
|
+
__name(settingsFromSynthOptions, "settingsFromSynthOptions");
|
|
328344
|
+
__name(parametersFromSynthOptions, "parametersFromSynthOptions");
|
|
328345
|
+
}
|
|
328346
|
+
});
|
|
328347
|
+
|
|
328348
|
+
// ../toolkit-lib/lib/api/cloud-assembly/private/readable-assembly.ts
|
|
328349
|
+
var import_node_fs, ReadableCloudAssembly;
|
|
328350
|
+
var init_readable_assembly = __esm({
|
|
328351
|
+
"../toolkit-lib/lib/api/cloud-assembly/private/readable-assembly.ts"() {
|
|
328352
|
+
"use strict";
|
|
328353
|
+
import_node_fs = require("node:fs");
|
|
328354
|
+
ReadableCloudAssembly = class {
|
|
328355
|
+
constructor(cloudAssembly, lock, options) {
|
|
328356
|
+
this.cloudAssembly = cloudAssembly;
|
|
328357
|
+
this.lock = lock;
|
|
328358
|
+
this.options = options;
|
|
328359
|
+
}
|
|
328360
|
+
static {
|
|
328361
|
+
__name(this, "ReadableCloudAssembly");
|
|
328362
|
+
}
|
|
328363
|
+
async _unlock() {
|
|
328364
|
+
return this.lock.release();
|
|
328365
|
+
}
|
|
328366
|
+
async dispose() {
|
|
328367
|
+
await this.lock.release();
|
|
328368
|
+
if (this.options?.deleteOnDispose) {
|
|
328369
|
+
await import_node_fs.promises.rm(this.cloudAssembly.directory, { recursive: true, force: true });
|
|
328370
|
+
}
|
|
328371
|
+
}
|
|
328372
|
+
[Symbol.asyncDispose]() {
|
|
328373
|
+
return this.dispose();
|
|
328374
|
+
}
|
|
328375
|
+
};
|
|
328376
|
+
}
|
|
328377
|
+
});
|
|
328378
|
+
|
|
328379
|
+
// ../toolkit-lib/lib/api/cloud-assembly/source-builder.ts
|
|
328380
|
+
var path27, import_util32, cxapi4, fs29, CloudAssemblySourceBuilder;
|
|
328381
|
+
var init_source_builder = __esm({
|
|
328382
|
+
"../toolkit-lib/lib/api/cloud-assembly/source-builder.ts"() {
|
|
328383
|
+
"use strict";
|
|
328384
|
+
path27 = __toESM(require("path"));
|
|
328385
|
+
import_util32 = require("util");
|
|
328386
|
+
cxapi4 = __toESM(require_lib3());
|
|
328387
|
+
fs29 = __toESM(require_lib6());
|
|
328388
|
+
init_context_store();
|
|
328389
|
+
init_rwlock();
|
|
328390
|
+
init_cached_source();
|
|
328391
|
+
init_context_aware_source();
|
|
328392
|
+
init_exec();
|
|
328393
|
+
init_prepare_source();
|
|
328394
|
+
init_readable_assembly();
|
|
328395
|
+
init_toolkit_error();
|
|
328396
|
+
init_util();
|
|
328397
|
+
init_private();
|
|
328398
|
+
init_helpers();
|
|
328399
|
+
CloudAssemblySourceBuilder = class {
|
|
328400
|
+
static {
|
|
328401
|
+
__name(this, "CloudAssemblySourceBuilder");
|
|
328402
|
+
}
|
|
328403
|
+
/**
|
|
328404
|
+
* Create a Cloud Assembly from a Cloud Assembly builder function.
|
|
328405
|
+
*
|
|
328406
|
+
* ## Outdir
|
|
328407
|
+
*
|
|
328408
|
+
* If no output directory is given, it will synthesize into a temporary system
|
|
328409
|
+
* directory. The temporary directory will be cleaned up, unless
|
|
328410
|
+
* `disposeOutdir: false`.
|
|
328411
|
+
*
|
|
328412
|
+
* A write lock will be acquired on the output directory for the duration of
|
|
328413
|
+
* the CDK app synthesis (which means that no two apps can synthesize at the
|
|
328414
|
+
* same time), and after synthesis a read lock will be acquired on the
|
|
328415
|
+
* directory. This means that while the CloudAssembly is being used, no CDK
|
|
328416
|
+
* app synthesis can take place into that directory.
|
|
328417
|
+
*
|
|
328418
|
+
* ## Context
|
|
328419
|
+
*
|
|
328420
|
+
* If no `contextStore` is given, a `MemoryContext` will be used. This means
|
|
328421
|
+
* no provider lookups will be persisted anywhere by default. Use a different
|
|
328422
|
+
* type of context store if you want persistence between synth operations.
|
|
328423
|
+
*
|
|
328424
|
+
* @param builder - the builder function
|
|
328425
|
+
* @param props - additional configuration properties
|
|
328426
|
+
* @returns the CloudAssembly source
|
|
328427
|
+
*/
|
|
328428
|
+
async fromAssemblyBuilder(builder, props = {}) {
|
|
328429
|
+
const services = await this.sourceBuilderServices();
|
|
328430
|
+
const contextStore = props.contextStore ?? new MemoryContext();
|
|
328431
|
+
const contextAssemblyProps = {
|
|
328432
|
+
services,
|
|
328433
|
+
contextStore,
|
|
328434
|
+
lookups: props.lookups
|
|
328435
|
+
};
|
|
328436
|
+
const outdir = props.outdir ? path27.resolve(props.outdir) : void 0;
|
|
328437
|
+
return new ContextAwareCloudAssemblySource(
|
|
328438
|
+
{
|
|
328439
|
+
produce: /* @__PURE__ */ __name(async () => {
|
|
328440
|
+
var _stack = [];
|
|
328441
|
+
try {
|
|
328442
|
+
const execution = __using(_stack, await ExecutionEnvironment.create(services, {
|
|
328443
|
+
outdir,
|
|
328444
|
+
resolveDefaultAppEnv: props.resolveDefaultEnvironment ?? true
|
|
328445
|
+
}), true);
|
|
328446
|
+
const synthParams = parametersFromSynthOptions(props.synthOptions);
|
|
328447
|
+
const fullContext = {
|
|
328448
|
+
...await contextStore.read(),
|
|
328449
|
+
...synthParams.context
|
|
328450
|
+
};
|
|
328451
|
+
await services.ioHelper.defaults.debug((0, import_util32.format)("context:", fullContext));
|
|
328452
|
+
const env = noUndefined({
|
|
328453
|
+
// Versioning, outdir, default account and region
|
|
328454
|
+
...await execution.defaultEnvVars(),
|
|
328455
|
+
// Environment variables derived from settings
|
|
328456
|
+
...synthParams.env
|
|
328457
|
+
});
|
|
328458
|
+
const cleanupContextTemp = writeContextToEnv(env, fullContext, "env-is-complete");
|
|
328459
|
+
const _cleanupEnv = __using(_stack, props.clobberEnv ?? true ? temporarilyWriteEnv(env) : void 0);
|
|
328460
|
+
let assembly;
|
|
328461
|
+
try {
|
|
328462
|
+
assembly = await builder({
|
|
328463
|
+
outdir: execution.outdir,
|
|
328464
|
+
context: fullContext,
|
|
328465
|
+
env
|
|
328466
|
+
});
|
|
328467
|
+
} catch (error4) {
|
|
328468
|
+
if (ToolkitError.isToolkitError(error4)) {
|
|
328469
|
+
throw error4;
|
|
328470
|
+
}
|
|
328471
|
+
throw AssemblyError.withCause("Assembly builder failed", error4);
|
|
328472
|
+
} finally {
|
|
328473
|
+
await cleanupContextTemp();
|
|
328474
|
+
}
|
|
328475
|
+
const asm = cxapi4.CloudAssembly.isCloudAssembly(assembly) ? assembly : await assemblyFromDirectory(assembly.directory, services.ioHelper, props.loadAssemblyOptions);
|
|
328476
|
+
const success2 = await execution.markSuccessful();
|
|
328477
|
+
const deleteOnDispose = props.disposeOutdir ?? execution.shouldDisposeOutDir;
|
|
328478
|
+
return new ReadableCloudAssembly(asm, success2.readLock, { deleteOnDispose });
|
|
328479
|
+
} catch (_2) {
|
|
328480
|
+
var _error = _2, _hasError = true;
|
|
328481
|
+
} finally {
|
|
328482
|
+
var _promise = __callDispose(_stack, _error, _hasError);
|
|
328483
|
+
_promise && await _promise;
|
|
328484
|
+
}
|
|
328485
|
+
}, "produce")
|
|
328486
|
+
},
|
|
328487
|
+
contextAssemblyProps
|
|
328488
|
+
);
|
|
328489
|
+
}
|
|
328490
|
+
/**
|
|
328491
|
+
* Creates a Cloud Assembly from an existing assembly directory.
|
|
328492
|
+
*
|
|
328493
|
+
* A read lock will be acquired for the directory. This means that while
|
|
328494
|
+
* the CloudAssembly is being used, no CDK app synthesis can take place into
|
|
328495
|
+
* that directory.
|
|
328496
|
+
*
|
|
328497
|
+
* @param directory - directory the directory of a already produced Cloud Assembly.
|
|
328498
|
+
* @returns the CloudAssembly source
|
|
328499
|
+
*/
|
|
328500
|
+
async fromAssemblyDirectory(directory, props = {}) {
|
|
328501
|
+
const services = await this.sourceBuilderServices();
|
|
328502
|
+
return {
|
|
328503
|
+
async produce() {
|
|
328504
|
+
await services.ioHelper.notify(IO.CDK_ASSEMBLY_I0150.msg("--app points to a cloud assembly, so we bypass synth"));
|
|
328505
|
+
const readLock = await new RWLock(directory).acquireRead();
|
|
328506
|
+
try {
|
|
328507
|
+
const asm = await assemblyFromDirectory(directory, services.ioHelper, props.loadAssemblyOptions);
|
|
328508
|
+
const assembly = new ReadableCloudAssembly(asm, readLock, { deleteOnDispose: false });
|
|
328509
|
+
if (assembly.cloudAssembly.manifest.missing && assembly.cloudAssembly.manifest.missing.length > 0) {
|
|
328510
|
+
if (props.failOnMissingContext ?? true) {
|
|
328511
|
+
const missingKeysSet = missingContextKeys(assembly.cloudAssembly.manifest.missing);
|
|
328512
|
+
const missingKeys = Array.from(missingKeysSet);
|
|
328513
|
+
throw AssemblyError.withCause(
|
|
328514
|
+
`Assembly contains missing context. Make sure all necessary context is already in 'cdk.context.json' by running 'cdk synth' on a machine with sufficient AWS credentials and committing the result. Missing context keys: '${missingKeys.join(", ")}'`,
|
|
328515
|
+
"Error producing assembly"
|
|
328516
|
+
);
|
|
328517
|
+
}
|
|
328518
|
+
}
|
|
328519
|
+
return new CachedCloudAssembly(assembly);
|
|
328520
|
+
} catch (e16) {
|
|
328521
|
+
await readLock.release();
|
|
328522
|
+
throw e16;
|
|
328523
|
+
}
|
|
328524
|
+
}
|
|
328525
|
+
};
|
|
328526
|
+
}
|
|
328527
|
+
/**
|
|
328528
|
+
* Use an AWS CDK app exectuable as source.
|
|
328529
|
+
*
|
|
328530
|
+
* `app` is a command line that will be executed to produce a Cloud Assembly.
|
|
328531
|
+
* The command will be executed in a shell, so it must come from a trusted source.
|
|
328532
|
+
*
|
|
328533
|
+
* The subprocess will execute in `workingDirectory`, which defaults to
|
|
328534
|
+
* the current process' working directory if not given.
|
|
328535
|
+
*
|
|
328536
|
+
* ## Outdir
|
|
328537
|
+
*
|
|
328538
|
+
* If an output directory is supplied, relative paths are evaluated with
|
|
328539
|
+
* respect to the current process' working directory. If an output directory
|
|
328540
|
+
* is not supplied, the default is a `cdk.out` directory underneath
|
|
328541
|
+
* `workingDirectory`. The output directory will not be cleaned up unless
|
|
328542
|
+
* `disposeOutdir: true`.
|
|
328543
|
+
*
|
|
328544
|
+
* A write lock will be acquired on the output directory for the duration of
|
|
328545
|
+
* the CDK app synthesis (which means that no two apps can synthesize at the
|
|
328546
|
+
* same time), and after synthesis a read lock will be acquired on the
|
|
328547
|
+
* directory. This means that while the CloudAssembly is being used, no CDK
|
|
328548
|
+
* app synthesis can take place into that directory.
|
|
328549
|
+
*
|
|
328550
|
+
* ## Context
|
|
328551
|
+
*
|
|
328552
|
+
* If no `contextStore` is given, a `CdkAppMultiContext` will be used, initialized
|
|
328553
|
+
* to the app's `workingDirectory`. This means that context will be loaded from
|
|
328554
|
+
* all the CDK's default context sources, and updates will be written to
|
|
328555
|
+
* `cdk.context.json`.
|
|
328556
|
+
*
|
|
328557
|
+
* @param props - additional configuration properties
|
|
328558
|
+
* @returns the CloudAssembly source
|
|
328559
|
+
*/
|
|
328560
|
+
async fromCdkApp(app, props = {}) {
|
|
328561
|
+
const services = await this.sourceBuilderServices();
|
|
328562
|
+
const workingDirectory = props.workingDirectory ?? process.cwd();
|
|
328563
|
+
const outdir = props.outdir ? path27.resolve(props.outdir) : path27.resolve(workingDirectory, "cdk.out");
|
|
328564
|
+
const contextStore = props.contextStore ?? new CdkAppMultiContext(workingDirectory);
|
|
328565
|
+
const contextAssemblyProps = {
|
|
328566
|
+
services,
|
|
328567
|
+
contextStore,
|
|
328568
|
+
lookups: props.lookups
|
|
328569
|
+
};
|
|
328570
|
+
return new ContextAwareCloudAssemblySource(
|
|
328571
|
+
{
|
|
328572
|
+
produce: /* @__PURE__ */ __name(async () => {
|
|
328573
|
+
var _stack = [];
|
|
328574
|
+
try {
|
|
328575
|
+
try {
|
|
328576
|
+
fs29.mkdirpSync(outdir);
|
|
328577
|
+
} catch (e16) {
|
|
328578
|
+
throw new ToolkitError(`Could not create output directory at '${outdir}' (${e16.message}).`);
|
|
328579
|
+
}
|
|
328580
|
+
const execution = __using(_stack, await ExecutionEnvironment.create(services, {
|
|
328581
|
+
outdir,
|
|
328582
|
+
resolveDefaultAppEnv: props.resolveDefaultEnvironment ?? true
|
|
328583
|
+
}), true);
|
|
328584
|
+
const commandLine = await execution.guessExecutable(app);
|
|
328585
|
+
const synthParams = parametersFromSynthOptions(props.synthOptions);
|
|
328586
|
+
const fullContext = {
|
|
328587
|
+
...await contextStore.read(),
|
|
328588
|
+
...synthParams.context
|
|
328589
|
+
};
|
|
328590
|
+
await services.ioHelper.defaults.debug((0, import_util32.format)("context:", fullContext));
|
|
328591
|
+
const env = noUndefined({
|
|
328592
|
+
// Need to start with full env of `writeContextToEnv` will not be able to do the size
|
|
328593
|
+
// calculation correctly.
|
|
328594
|
+
...process.env,
|
|
328595
|
+
// User gave us something
|
|
328596
|
+
...props.env,
|
|
328597
|
+
// Versioning, outdir, default account and region
|
|
328598
|
+
...await execution.defaultEnvVars(),
|
|
328599
|
+
// Environment variables derived from settings
|
|
328600
|
+
...synthParams.env
|
|
328601
|
+
});
|
|
328602
|
+
const cleanupTemp = writeContextToEnv(env, fullContext, "env-is-complete");
|
|
328603
|
+
try {
|
|
328604
|
+
await execInChildProcess(commandLine, {
|
|
328605
|
+
eventPublisher: /* @__PURE__ */ __name(async (type, line) => {
|
|
328606
|
+
switch (type) {
|
|
328607
|
+
case "data_stdout":
|
|
328608
|
+
await services.ioHelper.notify(IO.CDK_ASSEMBLY_I1001.msg(line));
|
|
328609
|
+
break;
|
|
328610
|
+
case "data_stderr":
|
|
328611
|
+
await services.ioHelper.notify(IO.CDK_ASSEMBLY_E1002.msg(line));
|
|
328612
|
+
break;
|
|
328613
|
+
}
|
|
328614
|
+
}, "eventPublisher"),
|
|
328615
|
+
env,
|
|
328616
|
+
cwd: workingDirectory
|
|
328617
|
+
});
|
|
328618
|
+
} finally {
|
|
328619
|
+
await cleanupTemp();
|
|
328620
|
+
}
|
|
328621
|
+
const asm = await assemblyFromDirectory(outdir, services.ioHelper, props.loadAssemblyOptions);
|
|
328622
|
+
const success2 = await execution.markSuccessful();
|
|
328623
|
+
const deleteOnDispose = props.disposeOutdir ?? execution.shouldDisposeOutDir;
|
|
328624
|
+
return new ReadableCloudAssembly(asm, success2.readLock, { deleteOnDispose });
|
|
328625
|
+
} catch (_2) {
|
|
328626
|
+
var _error = _2, _hasError = true;
|
|
328627
|
+
} finally {
|
|
328628
|
+
var _promise = __callDispose(_stack, _error, _hasError);
|
|
328629
|
+
_promise && await _promise;
|
|
328630
|
+
}
|
|
328631
|
+
}, "produce")
|
|
328632
|
+
},
|
|
328633
|
+
contextAssemblyProps
|
|
328634
|
+
);
|
|
328635
|
+
}
|
|
328636
|
+
};
|
|
328637
|
+
}
|
|
328638
|
+
});
|
|
328639
|
+
|
|
328640
|
+
// ../toolkit-lib/lib/api/cloud-assembly/types.ts
|
|
328641
|
+
var init_types4 = __esm({
|
|
328642
|
+
"../toolkit-lib/lib/api/cloud-assembly/types.ts"() {
|
|
328643
|
+
"use strict";
|
|
328644
|
+
}
|
|
328645
|
+
});
|
|
328646
|
+
|
|
328647
|
+
// ../toolkit-lib/lib/api/cloud-assembly/index.ts
|
|
328648
|
+
var cloud_assembly_exports3 = {};
|
|
328649
|
+
__export(cloud_assembly_exports3, {
|
|
328650
|
+
CachedCloudAssembly: () => CachedCloudAssembly,
|
|
328651
|
+
CdkAppMultiContext: () => CdkAppMultiContext,
|
|
328652
|
+
CloudAssemblySourceBuilder: () => CloudAssemblySourceBuilder,
|
|
328653
|
+
ExpandStackSelection: () => ExpandStackSelection,
|
|
328654
|
+
FileContext: () => FileContext,
|
|
328655
|
+
MemoryContext: () => MemoryContext,
|
|
328656
|
+
StackSelectionStrategy: () => StackSelectionStrategy,
|
|
328657
|
+
persistableContext: () => persistableContext
|
|
328658
|
+
});
|
|
328659
|
+
var init_cloud_assembly3 = __esm({
|
|
328660
|
+
"../toolkit-lib/lib/api/cloud-assembly/index.ts"() {
|
|
328661
|
+
"use strict";
|
|
328662
|
+
init_stack_selector();
|
|
328663
|
+
init_cached_source();
|
|
328664
|
+
init_source_builder();
|
|
328665
|
+
init_types4();
|
|
328666
|
+
init_context_store();
|
|
328667
|
+
}
|
|
328668
|
+
});
|
|
328669
|
+
|
|
327399
328670
|
// ../toolkit-lib/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
327400
328671
|
var MAX_PATTERN_LENGTH2, assertValidPattern2;
|
|
327401
328672
|
var init_assert_valid_pattern2 = __esm({
|
|
@@ -328036,7 +329307,7 @@ var init_escape2 = __esm({
|
|
|
328036
329307
|
});
|
|
328037
329308
|
|
|
328038
329309
|
// ../toolkit-lib/node_modules/minimatch/dist/esm/index.js
|
|
328039
|
-
var import_brace_expansion2, minimatch2, starDotExtRE2, starDotExtTest2, starDotExtTestDot2, starDotExtTestNocase2, starDotExtTestNocaseDot2, starDotStarRE2, starDotStarTest2, starDotStarTestDot2, dotStarRE2, dotStarTest2, starRE2, starTest2, starTestDot2, qmarksRE2, qmarksTestNocase2, qmarksTestNocaseDot2, qmarksTestDot2, qmarksTest2, qmarksTestNoExt2, qmarksTestNoExtDot2, defaultPlatform4,
|
|
329310
|
+
var import_brace_expansion2, minimatch2, starDotExtRE2, starDotExtTest2, starDotExtTestDot2, starDotExtTestNocase2, starDotExtTestNocaseDot2, starDotStarRE2, starDotStarTest2, starDotStarTestDot2, dotStarRE2, dotStarTest2, starRE2, starTest2, starTestDot2, qmarksRE2, qmarksTestNocase2, qmarksTestNocaseDot2, qmarksTestDot2, qmarksTest2, qmarksTestNoExt2, qmarksTestNoExtDot2, defaultPlatform4, path28, sep2, GLOBSTAR2, qmark4, star4, twoStarDot2, twoStarNoDot2, filter2, ext2, defaults2, braceExpand2, makeRe2, match2, globMagic2, regExpEscape4, Minimatch2;
|
|
328040
329311
|
var init_esm11 = __esm({
|
|
328041
329312
|
"../toolkit-lib/node_modules/minimatch/dist/esm/index.js"() {
|
|
328042
329313
|
import_brace_expansion2 = __toESM(require_brace_expansion(), 1);
|
|
@@ -328105,11 +329376,11 @@ var init_esm11 = __esm({
|
|
|
328105
329376
|
return (f16) => f16.length === len && f16 !== "." && f16 !== "..";
|
|
328106
329377
|
}, "qmarksTestNoExtDot");
|
|
328107
329378
|
defaultPlatform4 = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
328108
|
-
|
|
329379
|
+
path28 = {
|
|
328109
329380
|
win32: { sep: "\\" },
|
|
328110
329381
|
posix: { sep: "/" }
|
|
328111
329382
|
};
|
|
328112
|
-
sep2 = defaultPlatform4 === "win32" ?
|
|
329383
|
+
sep2 = defaultPlatform4 === "win32" ? path28.win32.sep : path28.posix.sep;
|
|
328113
329384
|
minimatch2.sep = sep2;
|
|
328114
329385
|
GLOBSTAR2 = /* @__PURE__ */ Symbol("globstar **");
|
|
328115
329386
|
minimatch2.GLOBSTAR = GLOBSTAR2;
|
|
@@ -328776,11 +330047,11 @@ var init_esm11 = __esm({
|
|
|
328776
330047
|
});
|
|
328777
330048
|
|
|
328778
330049
|
// ../toolkit-lib/lib/api/cloud-assembly/stack-collection.ts
|
|
328779
|
-
var
|
|
330050
|
+
var import_cloud_assembly_api10, StackCollection;
|
|
328780
330051
|
var init_stack_collection = __esm({
|
|
328781
330052
|
"../toolkit-lib/lib/api/cloud-assembly/stack-collection.ts"() {
|
|
328782
330053
|
"use strict";
|
|
328783
|
-
|
|
330054
|
+
import_cloud_assembly_api10 = __toESM(require_lib3());
|
|
328784
330055
|
init_toolkit_error();
|
|
328785
330056
|
StackCollection = class _StackCollection {
|
|
328786
330057
|
constructor(assembly, stackArtifacts) {
|
|
@@ -328862,15 +330133,15 @@ var init_stack_collection = __esm({
|
|
|
328862
330133
|
for (const stack of this.stackArtifacts) {
|
|
328863
330134
|
for (const message2 of stack.messages) {
|
|
328864
330135
|
switch (message2.level) {
|
|
328865
|
-
case
|
|
330136
|
+
case import_cloud_assembly_api10.SynthesisMessageLevel.WARNING:
|
|
328866
330137
|
warnings = true;
|
|
328867
330138
|
await logger3("warn", message2);
|
|
328868
330139
|
break;
|
|
328869
|
-
case
|
|
330140
|
+
case import_cloud_assembly_api10.SynthesisMessageLevel.ERROR:
|
|
328870
330141
|
errors = true;
|
|
328871
330142
|
await logger3("error", message2);
|
|
328872
330143
|
break;
|
|
328873
|
-
case
|
|
330144
|
+
case import_cloud_assembly_api10.SynthesisMessageLevel.INFO:
|
|
328874
330145
|
await logger3("info", message2);
|
|
328875
330146
|
break;
|
|
328876
330147
|
}
|
|
@@ -328999,29 +330270,6 @@ var init_stack_assembly = __esm({
|
|
|
328999
330270
|
}
|
|
329000
330271
|
});
|
|
329001
330272
|
|
|
329002
|
-
// ../toolkit-lib/lib/api/cloud-assembly/stack-selector.ts
|
|
329003
|
-
var StackSelectionStrategy, ExpandStackSelection;
|
|
329004
|
-
var init_stack_selector = __esm({
|
|
329005
|
-
"../toolkit-lib/lib/api/cloud-assembly/stack-selector.ts"() {
|
|
329006
|
-
"use strict";
|
|
329007
|
-
StackSelectionStrategy = /* @__PURE__ */ ((StackSelectionStrategy3) => {
|
|
329008
|
-
StackSelectionStrategy3["ALL_STACKS"] = "all-stacks";
|
|
329009
|
-
StackSelectionStrategy3["MAIN_ASSEMBLY"] = "main-assembly";
|
|
329010
|
-
StackSelectionStrategy3["ONLY_SINGLE"] = "only-single";
|
|
329011
|
-
StackSelectionStrategy3["PATTERN_MATCH"] = "pattern-match";
|
|
329012
|
-
StackSelectionStrategy3["PATTERN_MUST_MATCH"] = "pattern-must-match";
|
|
329013
|
-
StackSelectionStrategy3["PATTERN_MUST_MATCH_SINGLE"] = "pattern-must-match-single";
|
|
329014
|
-
return StackSelectionStrategy3;
|
|
329015
|
-
})(StackSelectionStrategy || {});
|
|
329016
|
-
ExpandStackSelection = /* @__PURE__ */ ((ExpandStackSelection3) => {
|
|
329017
|
-
ExpandStackSelection3["NONE"] = "none";
|
|
329018
|
-
ExpandStackSelection3["UPSTREAM"] = "upstream";
|
|
329019
|
-
ExpandStackSelection3["DOWNSTREAM"] = "downstream";
|
|
329020
|
-
return ExpandStackSelection3;
|
|
329021
|
-
})(ExpandStackSelection || {});
|
|
329022
|
-
}
|
|
329023
|
-
});
|
|
329024
|
-
|
|
329025
330273
|
// ../toolkit-lib/lib/api/cloud-assembly/private/stack-assembly.ts
|
|
329026
330274
|
function expandToExtendEnum(extend) {
|
|
329027
330275
|
switch (extend) {
|
|
@@ -329035,12 +330283,12 @@ function expandToExtendEnum(extend) {
|
|
|
329035
330283
|
return void 0;
|
|
329036
330284
|
}
|
|
329037
330285
|
}
|
|
329038
|
-
var
|
|
330286
|
+
var import_dispose_polyfill4, import_semver2, StackAssembly;
|
|
329039
330287
|
var init_stack_assembly2 = __esm({
|
|
329040
330288
|
"../toolkit-lib/lib/api/cloud-assembly/private/stack-assembly.ts"() {
|
|
329041
330289
|
"use strict";
|
|
329042
|
-
|
|
329043
|
-
|
|
330290
|
+
import_dispose_polyfill4 = __toESM(require_dispose_polyfill());
|
|
330291
|
+
import_semver2 = __toESM(require_semver4());
|
|
329044
330292
|
init_toolkit_error();
|
|
329045
330293
|
init_stack_assembly();
|
|
329046
330294
|
init_stack_collection();
|
|
@@ -329073,7 +330321,7 @@ var init_stack_assembly2 = __esm({
|
|
|
329073
330321
|
async selectStacksV2(selector) {
|
|
329074
330322
|
const asm = this.assembly;
|
|
329075
330323
|
const topLevelStacks = asm.stacks;
|
|
329076
|
-
const allStacks = (0,
|
|
330324
|
+
const allStacks = (0, import_semver2.major)(asm.version) < 10 ? asm.stacks : asm.stacksRecursively;
|
|
329077
330325
|
if (allStacks.length === 0 && (selector.failOnEmpty ?? true)) {
|
|
329078
330326
|
throw new ToolkitError("This app contains no stacks");
|
|
329079
330327
|
}
|
|
@@ -329116,7 +330364,7 @@ Stacks: ${allStacks.map((x16) => x16.hierarchicalId).join(" \xB7 ")}`);
|
|
|
329116
330364
|
* @returns a `StackCollection` of all stacks
|
|
329117
330365
|
*/
|
|
329118
330366
|
selectAllStacks() {
|
|
329119
|
-
const allStacks = (0,
|
|
330367
|
+
const allStacks = (0, import_semver2.major)(this.assembly.version) < 10 ? this.assembly.stacks : this.assembly.stacksRecursively;
|
|
329120
330368
|
return new StackCollection(this, allStacks);
|
|
329121
330369
|
}
|
|
329122
330370
|
/**
|
|
@@ -329133,724 +330381,6 @@ Stacks: ${allStacks.map((x16) => x16.hierarchicalId).join(" \xB7 ")}`);
|
|
|
329133
330381
|
}
|
|
329134
330382
|
});
|
|
329135
330383
|
|
|
329136
|
-
// ../toolkit-lib/node_modules/split2/index.js
|
|
329137
|
-
var require_split2 = __commonJS({
|
|
329138
|
-
"../toolkit-lib/node_modules/split2/index.js"(exports2, module2) {
|
|
329139
|
-
"use strict";
|
|
329140
|
-
var { Transform } = require("stream");
|
|
329141
|
-
var { StringDecoder: StringDecoder3 } = require("string_decoder");
|
|
329142
|
-
var kLast = /* @__PURE__ */ Symbol("last");
|
|
329143
|
-
var kDecoder = /* @__PURE__ */ Symbol("decoder");
|
|
329144
|
-
function transform(chunk, enc, cb) {
|
|
329145
|
-
let list2;
|
|
329146
|
-
if (this.overflow) {
|
|
329147
|
-
const buf = this[kDecoder].write(chunk);
|
|
329148
|
-
list2 = buf.split(this.matcher);
|
|
329149
|
-
if (list2.length === 1) return cb();
|
|
329150
|
-
list2.shift();
|
|
329151
|
-
this.overflow = false;
|
|
329152
|
-
} else {
|
|
329153
|
-
this[kLast] += this[kDecoder].write(chunk);
|
|
329154
|
-
list2 = this[kLast].split(this.matcher);
|
|
329155
|
-
}
|
|
329156
|
-
this[kLast] = list2.pop();
|
|
329157
|
-
for (let i16 = 0; i16 < list2.length; i16++) {
|
|
329158
|
-
try {
|
|
329159
|
-
push(this, this.mapper(list2[i16]));
|
|
329160
|
-
} catch (error4) {
|
|
329161
|
-
return cb(error4);
|
|
329162
|
-
}
|
|
329163
|
-
}
|
|
329164
|
-
this.overflow = this[kLast].length > this.maxLength;
|
|
329165
|
-
if (this.overflow && !this.skipOverflow) {
|
|
329166
|
-
cb(new Error("maximum buffer reached"));
|
|
329167
|
-
return;
|
|
329168
|
-
}
|
|
329169
|
-
cb();
|
|
329170
|
-
}
|
|
329171
|
-
__name(transform, "transform");
|
|
329172
|
-
function flush(cb) {
|
|
329173
|
-
this[kLast] += this[kDecoder].end();
|
|
329174
|
-
if (this[kLast]) {
|
|
329175
|
-
try {
|
|
329176
|
-
push(this, this.mapper(this[kLast]));
|
|
329177
|
-
} catch (error4) {
|
|
329178
|
-
return cb(error4);
|
|
329179
|
-
}
|
|
329180
|
-
}
|
|
329181
|
-
cb();
|
|
329182
|
-
}
|
|
329183
|
-
__name(flush, "flush");
|
|
329184
|
-
function push(self2, val) {
|
|
329185
|
-
if (val !== void 0) {
|
|
329186
|
-
self2.push(val);
|
|
329187
|
-
}
|
|
329188
|
-
}
|
|
329189
|
-
__name(push, "push");
|
|
329190
|
-
function noop(incoming) {
|
|
329191
|
-
return incoming;
|
|
329192
|
-
}
|
|
329193
|
-
__name(noop, "noop");
|
|
329194
|
-
function split2(matcher, mapper, options) {
|
|
329195
|
-
matcher = matcher || /\r?\n/;
|
|
329196
|
-
mapper = mapper || noop;
|
|
329197
|
-
options = options || {};
|
|
329198
|
-
switch (arguments.length) {
|
|
329199
|
-
case 1:
|
|
329200
|
-
if (typeof matcher === "function") {
|
|
329201
|
-
mapper = matcher;
|
|
329202
|
-
matcher = /\r?\n/;
|
|
329203
|
-
} else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
|
|
329204
|
-
options = matcher;
|
|
329205
|
-
matcher = /\r?\n/;
|
|
329206
|
-
}
|
|
329207
|
-
break;
|
|
329208
|
-
case 2:
|
|
329209
|
-
if (typeof matcher === "function") {
|
|
329210
|
-
options = mapper;
|
|
329211
|
-
mapper = matcher;
|
|
329212
|
-
matcher = /\r?\n/;
|
|
329213
|
-
} else if (typeof mapper === "object") {
|
|
329214
|
-
options = mapper;
|
|
329215
|
-
mapper = noop;
|
|
329216
|
-
}
|
|
329217
|
-
}
|
|
329218
|
-
options = Object.assign({}, options);
|
|
329219
|
-
options.autoDestroy = true;
|
|
329220
|
-
options.transform = transform;
|
|
329221
|
-
options.flush = flush;
|
|
329222
|
-
options.readableObjectMode = true;
|
|
329223
|
-
const stream2 = new Transform(options);
|
|
329224
|
-
stream2[kLast] = "";
|
|
329225
|
-
stream2[kDecoder] = new StringDecoder3("utf8");
|
|
329226
|
-
stream2.matcher = matcher;
|
|
329227
|
-
stream2.mapper = mapper;
|
|
329228
|
-
stream2.maxLength = options.maxLength;
|
|
329229
|
-
stream2.skipOverflow = options.skipOverflow || false;
|
|
329230
|
-
stream2.overflow = false;
|
|
329231
|
-
stream2._destroy = function(err, cb) {
|
|
329232
|
-
this._writableState.errorEmitted = false;
|
|
329233
|
-
cb(err);
|
|
329234
|
-
};
|
|
329235
|
-
return stream2;
|
|
329236
|
-
}
|
|
329237
|
-
__name(split2, "split");
|
|
329238
|
-
module2.exports = split2;
|
|
329239
|
-
}
|
|
329240
|
-
});
|
|
329241
|
-
|
|
329242
|
-
// ../toolkit-lib/lib/api/cloud-assembly/private/exec.ts
|
|
329243
|
-
async function execInChildProcess(commandAndArgs, options = {}) {
|
|
329244
|
-
return new Promise((ok, fail) => {
|
|
329245
|
-
const proc2 = child_process2.spawn(commandAndArgs, {
|
|
329246
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
329247
|
-
detached: false,
|
|
329248
|
-
cwd: options.cwd,
|
|
329249
|
-
env: options.env,
|
|
329250
|
-
// We are using 'shell: true' on purprose. Traditionally we have allowed shell features in
|
|
329251
|
-
// this string, so we have to continue to do so into the future. On Windows, this is simply
|
|
329252
|
-
// necessary to run .bat and .cmd files properly.
|
|
329253
|
-
// Code scanning tools will flag this as a risk. The input comes from a trusted source,
|
|
329254
|
-
// so it does not represent a security risk.
|
|
329255
|
-
shell: true
|
|
329256
|
-
});
|
|
329257
|
-
const eventPublisher = options.eventPublisher ?? ((type, line) => {
|
|
329258
|
-
switch (type) {
|
|
329259
|
-
case "data_stdout":
|
|
329260
|
-
process.stdout.write(line);
|
|
329261
|
-
return;
|
|
329262
|
-
case "data_stderr":
|
|
329263
|
-
process.stderr.write(line);
|
|
329264
|
-
return;
|
|
329265
|
-
case "open":
|
|
329266
|
-
case "close":
|
|
329267
|
-
return;
|
|
329268
|
-
}
|
|
329269
|
-
});
|
|
329270
|
-
const stderr2 = new Array();
|
|
329271
|
-
proc2.stdout.pipe(split()).on("data", (line) => eventPublisher("data_stdout", line));
|
|
329272
|
-
proc2.stderr.pipe(split()).on("data", (line) => {
|
|
329273
|
-
stderr2.push(line);
|
|
329274
|
-
return eventPublisher("data_stderr", line);
|
|
329275
|
-
});
|
|
329276
|
-
proc2.on("error", fail);
|
|
329277
|
-
proc2.on("exit", (code) => {
|
|
329278
|
-
if (code === 0) {
|
|
329279
|
-
return ok();
|
|
329280
|
-
} else {
|
|
329281
|
-
let cause;
|
|
329282
|
-
if (stderr2.length) {
|
|
329283
|
-
cause = new Error(stderr2.join("\n"));
|
|
329284
|
-
cause.name = "ExecutionError";
|
|
329285
|
-
}
|
|
329286
|
-
return fail(AssemblyError.withCause(`${commandAndArgs}: Subprocess exited with error ${code}`, cause));
|
|
329287
|
-
}
|
|
329288
|
-
});
|
|
329289
|
-
});
|
|
329290
|
-
}
|
|
329291
|
-
var child_process2, split;
|
|
329292
|
-
var init_exec = __esm({
|
|
329293
|
-
"../toolkit-lib/lib/api/cloud-assembly/private/exec.ts"() {
|
|
329294
|
-
"use strict";
|
|
329295
|
-
child_process2 = __toESM(require("node:child_process"));
|
|
329296
|
-
init_toolkit_error();
|
|
329297
|
-
split = require_split2();
|
|
329298
|
-
__name(execInChildProcess, "execInChildProcess");
|
|
329299
|
-
}
|
|
329300
|
-
});
|
|
329301
|
-
|
|
329302
|
-
// ../toolkit-lib/lib/api/rwlock.ts
|
|
329303
|
-
async function readFileIfExists(filename) {
|
|
329304
|
-
try {
|
|
329305
|
-
return await import_fs6.promises.readFile(filename, { encoding: "utf-8" });
|
|
329306
|
-
} catch (e16) {
|
|
329307
|
-
if (e16.code === "ENOENT") {
|
|
329308
|
-
return void 0;
|
|
329309
|
-
}
|
|
329310
|
-
throw e16;
|
|
329311
|
-
}
|
|
329312
|
-
}
|
|
329313
|
-
async function writeFileAtomic(filename, contents) {
|
|
329314
|
-
await import_fs6.promises.mkdir(path24.dirname(filename), { recursive: true });
|
|
329315
|
-
const tmpFile = `${filename}.${process.pid}_${++tmpCounter}`;
|
|
329316
|
-
await import_fs6.promises.writeFile(tmpFile, contents, { encoding: "utf-8" });
|
|
329317
|
-
await import_fs6.promises.rename(tmpFile, filename);
|
|
329318
|
-
}
|
|
329319
|
-
async function deleteFile(filename) {
|
|
329320
|
-
try {
|
|
329321
|
-
await import_fs6.promises.unlink(filename);
|
|
329322
|
-
} catch (e16) {
|
|
329323
|
-
if (e16.code === "ENOENT") {
|
|
329324
|
-
return;
|
|
329325
|
-
}
|
|
329326
|
-
throw e16;
|
|
329327
|
-
}
|
|
329328
|
-
}
|
|
329329
|
-
function processExists(pid) {
|
|
329330
|
-
try {
|
|
329331
|
-
process.kill(pid, 0);
|
|
329332
|
-
return true;
|
|
329333
|
-
} catch (e16) {
|
|
329334
|
-
return false;
|
|
329335
|
-
}
|
|
329336
|
-
}
|
|
329337
|
-
var import_fs6, path24, RWLock, tmpCounter;
|
|
329338
|
-
var init_rwlock = __esm({
|
|
329339
|
-
"../toolkit-lib/lib/api/rwlock.ts"() {
|
|
329340
|
-
"use strict";
|
|
329341
|
-
import_fs6 = require("fs");
|
|
329342
|
-
path24 = __toESM(require("path"));
|
|
329343
|
-
init_toolkit_error();
|
|
329344
|
-
RWLock = class {
|
|
329345
|
-
constructor(directory) {
|
|
329346
|
-
this.directory = directory;
|
|
329347
|
-
this.pidString = `${process.pid}`;
|
|
329348
|
-
this.writerFile = path24.join(this.directory, "synth.lock");
|
|
329349
|
-
}
|
|
329350
|
-
static {
|
|
329351
|
-
__name(this, "RWLock");
|
|
329352
|
-
}
|
|
329353
|
-
pidString;
|
|
329354
|
-
writerFile;
|
|
329355
|
-
readCounter = 0;
|
|
329356
|
-
/**
|
|
329357
|
-
* Acquire a writer lock.
|
|
329358
|
-
*
|
|
329359
|
-
* No other readers or writers must exist for the given directory.
|
|
329360
|
-
*/
|
|
329361
|
-
async acquireWrite() {
|
|
329362
|
-
await this.assertNoOtherWriters();
|
|
329363
|
-
const readers = await this._currentReaders();
|
|
329364
|
-
if (readers.length > 0) {
|
|
329365
|
-
throw new ToolkitError(`Other CLIs (PID=${readers}) are currently reading from ${this.directory}. Invoke the CLI in sequence, or use '--output' to synth into different directories.`);
|
|
329366
|
-
}
|
|
329367
|
-
await writeFileAtomic(this.writerFile, this.pidString);
|
|
329368
|
-
let released = false;
|
|
329369
|
-
return {
|
|
329370
|
-
release: /* @__PURE__ */ __name(async () => {
|
|
329371
|
-
if (!released) {
|
|
329372
|
-
await deleteFile(this.writerFile);
|
|
329373
|
-
released = true;
|
|
329374
|
-
}
|
|
329375
|
-
}, "release"),
|
|
329376
|
-
convertToReaderLock: /* @__PURE__ */ __name(async () => {
|
|
329377
|
-
const ret = await this.doAcquireRead();
|
|
329378
|
-
await deleteFile(this.writerFile);
|
|
329379
|
-
return ret;
|
|
329380
|
-
}, "convertToReaderLock")
|
|
329381
|
-
};
|
|
329382
|
-
}
|
|
329383
|
-
/**
|
|
329384
|
-
* Acquire a read lock
|
|
329385
|
-
*
|
|
329386
|
-
* Will fail if there are any writers.
|
|
329387
|
-
*/
|
|
329388
|
-
async acquireRead() {
|
|
329389
|
-
await this.assertNoOtherWriters();
|
|
329390
|
-
return this.doAcquireRead();
|
|
329391
|
-
}
|
|
329392
|
-
/**
|
|
329393
|
-
* Obtains the name fo a (new) `readerFile` to use. This includes a counter so
|
|
329394
|
-
* that if multiple threads of the same PID attempt to concurrently acquire
|
|
329395
|
-
* the same lock, they're guaranteed to use a different reader file name (only
|
|
329396
|
-
* one thread will ever execute JS code at once, guaranteeing the readCounter
|
|
329397
|
-
* is incremented "atomically" from the point of view of this PID.).
|
|
329398
|
-
*/
|
|
329399
|
-
readerFile() {
|
|
329400
|
-
return path24.join(this.directory, `read.${this.pidString}.${++this.readCounter}.lock`);
|
|
329401
|
-
}
|
|
329402
|
-
/**
|
|
329403
|
-
* Do the actual acquiring of a read lock.
|
|
329404
|
-
*/
|
|
329405
|
-
async doAcquireRead() {
|
|
329406
|
-
const readerFile = this.readerFile();
|
|
329407
|
-
await writeFileAtomic(readerFile, this.pidString);
|
|
329408
|
-
let released = false;
|
|
329409
|
-
return {
|
|
329410
|
-
release: /* @__PURE__ */ __name(async () => {
|
|
329411
|
-
if (!released) {
|
|
329412
|
-
await deleteFile(readerFile);
|
|
329413
|
-
released = true;
|
|
329414
|
-
}
|
|
329415
|
-
}, "release")
|
|
329416
|
-
};
|
|
329417
|
-
}
|
|
329418
|
-
async assertNoOtherWriters() {
|
|
329419
|
-
const writer = await this._currentWriter();
|
|
329420
|
-
if (writer) {
|
|
329421
|
-
throw new ToolkitError(`Another CLI (PID=${writer}) is currently synthing to ${this.directory}. Invoke the CLI in sequence, or use '--output' to synth into different directories.`);
|
|
329422
|
-
}
|
|
329423
|
-
}
|
|
329424
|
-
/**
|
|
329425
|
-
* Check the current writer (if any)
|
|
329426
|
-
*
|
|
329427
|
-
* Publicly accessible for testing purposes. Do not use.
|
|
329428
|
-
*
|
|
329429
|
-
* @internal
|
|
329430
|
-
*/
|
|
329431
|
-
async _currentWriter() {
|
|
329432
|
-
const contents = await readFileIfExists(this.writerFile);
|
|
329433
|
-
if (!contents) {
|
|
329434
|
-
return void 0;
|
|
329435
|
-
}
|
|
329436
|
-
const pid = parseInt(contents, 10);
|
|
329437
|
-
if (!processExists(pid)) {
|
|
329438
|
-
await deleteFile(this.writerFile);
|
|
329439
|
-
return void 0;
|
|
329440
|
-
}
|
|
329441
|
-
return pid;
|
|
329442
|
-
}
|
|
329443
|
-
/**
|
|
329444
|
-
* Check the current readers (if any)
|
|
329445
|
-
*
|
|
329446
|
-
* Publicly accessible for testing purposes. Do not use.
|
|
329447
|
-
*
|
|
329448
|
-
* @internal
|
|
329449
|
-
*/
|
|
329450
|
-
async _currentReaders() {
|
|
329451
|
-
const re = /^read\.([^.]+)\.[^.]+\.lock$/;
|
|
329452
|
-
const ret = new Array();
|
|
329453
|
-
let children;
|
|
329454
|
-
try {
|
|
329455
|
-
children = await import_fs6.promises.readdir(this.directory, { encoding: "utf-8" });
|
|
329456
|
-
} catch (e16) {
|
|
329457
|
-
if (e16.code === "ENOENT") {
|
|
329458
|
-
return [];
|
|
329459
|
-
}
|
|
329460
|
-
throw e16;
|
|
329461
|
-
}
|
|
329462
|
-
for (const fname of children) {
|
|
329463
|
-
const m16 = fname.match(re);
|
|
329464
|
-
if (m16) {
|
|
329465
|
-
const pid = parseInt(m16[1], 10);
|
|
329466
|
-
if (processExists(pid)) {
|
|
329467
|
-
ret.push(pid);
|
|
329468
|
-
} else {
|
|
329469
|
-
await deleteFile(path24.join(this.directory, fname));
|
|
329470
|
-
}
|
|
329471
|
-
}
|
|
329472
|
-
}
|
|
329473
|
-
return ret;
|
|
329474
|
-
}
|
|
329475
|
-
};
|
|
329476
|
-
__name(readFileIfExists, "readFileIfExists");
|
|
329477
|
-
tmpCounter = 0;
|
|
329478
|
-
__name(writeFileAtomic, "writeFileAtomic");
|
|
329479
|
-
__name(deleteFile, "deleteFile");
|
|
329480
|
-
__name(processExists, "processExists");
|
|
329481
|
-
}
|
|
329482
|
-
});
|
|
329483
|
-
|
|
329484
|
-
// ../toolkit-lib/lib/api/cloud-assembly/environment.ts
|
|
329485
|
-
async function prepareDefaultEnvironment(aws, debugFn) {
|
|
329486
|
-
const env = {};
|
|
329487
|
-
env[cxapi2.DEFAULT_REGION_ENV] = aws.defaultRegion;
|
|
329488
|
-
await debugFn(`Setting "${cxapi2.DEFAULT_REGION_ENV}" environment variable to ${env[cxapi2.DEFAULT_REGION_ENV]}`);
|
|
329489
|
-
const accountId = (await aws.defaultAccount())?.accountId;
|
|
329490
|
-
if (accountId) {
|
|
329491
|
-
env[cxapi2.DEFAULT_ACCOUNT_ENV] = accountId;
|
|
329492
|
-
await debugFn(`Setting "${cxapi2.DEFAULT_ACCOUNT_ENV}" environment variable to ${env[cxapi2.DEFAULT_ACCOUNT_ENV]}`);
|
|
329493
|
-
}
|
|
329494
|
-
return env;
|
|
329495
|
-
}
|
|
329496
|
-
function contextFromSettings(settings) {
|
|
329497
|
-
const context = {};
|
|
329498
|
-
const pathMetadata = settings.get(["pathMetadata"]) ?? true;
|
|
329499
|
-
if (pathMetadata) {
|
|
329500
|
-
context[cxapi2.PATH_METADATA_ENABLE_CONTEXT] = true;
|
|
329501
|
-
}
|
|
329502
|
-
const assetMetadata = settings.get(["assetMetadata"]) ?? true;
|
|
329503
|
-
if (assetMetadata) {
|
|
329504
|
-
context[cxapi2.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT] = true;
|
|
329505
|
-
}
|
|
329506
|
-
const versionReporting = settings.get(["versionReporting"]) ?? true;
|
|
329507
|
-
if (versionReporting) {
|
|
329508
|
-
context[cxapi2.ANALYTICS_REPORTING_ENABLED_CONTEXT] = true;
|
|
329509
|
-
}
|
|
329510
|
-
if (!versionReporting) {
|
|
329511
|
-
context["aws:cdk:disable-version-reporting"] = true;
|
|
329512
|
-
}
|
|
329513
|
-
const stagingEnabled = settings.get(["staging"]) ?? true;
|
|
329514
|
-
if (!stagingEnabled) {
|
|
329515
|
-
context[cxapi2.DISABLE_ASSET_STAGING_CONTEXT] = true;
|
|
329516
|
-
}
|
|
329517
|
-
const bundlingStacks = settings.get(["bundlingStacks"]) ?? ["**"];
|
|
329518
|
-
context[cxapi2.BUNDLING_STACKS] = bundlingStacks;
|
|
329519
|
-
return context;
|
|
329520
|
-
}
|
|
329521
|
-
function synthParametersFromSettings(settings) {
|
|
329522
|
-
return {
|
|
329523
|
-
context: contextFromSettings(settings),
|
|
329524
|
-
env: {
|
|
329525
|
-
// An environment variable instead of a context variable, so it can also
|
|
329526
|
-
// be accessed in framework code where we don't have access to a construct tree.
|
|
329527
|
-
...settings.get(["debug"]) ? { CDK_DEBUG: "true" } : {}
|
|
329528
|
-
}
|
|
329529
|
-
};
|
|
329530
|
-
}
|
|
329531
|
-
function spaceAvailableForContext(env, limit) {
|
|
329532
|
-
const size = /* @__PURE__ */ __name((value) => value != null ? Buffer.byteLength(value) : 0, "size");
|
|
329533
|
-
const usedSpace = Object.entries(env).map(([k16, v17]) => k16 === cxapi2.CONTEXT_ENV ? size(k16) : size(k16) + size(v17)).reduce((a16, b16) => a16 + b16, 0);
|
|
329534
|
-
return Math.max(0, limit - usedSpace);
|
|
329535
|
-
}
|
|
329536
|
-
async function guessExecutable(commandLine, debugFn) {
|
|
329537
|
-
const fullFile = await checkFile(commandLine);
|
|
329538
|
-
if (fullFile) {
|
|
329539
|
-
return guessInterpreter(fullFile);
|
|
329540
|
-
}
|
|
329541
|
-
const [first, rest] = splitFirstShellWord(commandLine);
|
|
329542
|
-
const firstFile = await checkFile(first);
|
|
329543
|
-
if (firstFile) {
|
|
329544
|
-
return `${guessInterpreter(firstFile)} ${rest}`.trim();
|
|
329545
|
-
}
|
|
329546
|
-
await debugFn(`Not a file: '${commandLine}'. Using '${commandLine} as command-line`);
|
|
329547
|
-
return commandLine;
|
|
329548
|
-
}
|
|
329549
|
-
function guessInterpreter(file) {
|
|
329550
|
-
const isWindows2 = process.platform === "win32";
|
|
329551
|
-
const handler = EXTENSION_MAP[path25.extname(file.fileName)];
|
|
329552
|
-
if (handler && (!file.isExecutable || isWindows2)) {
|
|
329553
|
-
return handler(file.fileName);
|
|
329554
|
-
}
|
|
329555
|
-
return quoteSpaces(file.fileName);
|
|
329556
|
-
}
|
|
329557
|
-
function executeNode(scriptFile) {
|
|
329558
|
-
return `${quoteSpaces(process.execPath)} ${quoteSpaces(scriptFile)}`;
|
|
329559
|
-
}
|
|
329560
|
-
function splitFirstShellWord(commandLine) {
|
|
329561
|
-
commandLine = commandLine.trim();
|
|
329562
|
-
if (commandLine[0] === '"') {
|
|
329563
|
-
const endQuote = commandLine.indexOf('"', 1);
|
|
329564
|
-
return endQuote > -1 ? [commandLine.slice(1, endQuote), commandLine.slice(endQuote + 1).trim()] : [commandLine, ""];
|
|
329565
|
-
} else {
|
|
329566
|
-
const space = commandLine.indexOf(" ");
|
|
329567
|
-
return space > -1 ? [commandLine.slice(0, space), commandLine.slice(space + 1)] : [commandLine, ""];
|
|
329568
|
-
}
|
|
329569
|
-
}
|
|
329570
|
-
async function checkFile(fileName) {
|
|
329571
|
-
try {
|
|
329572
|
-
const fstat = await fs25.stat(fileName);
|
|
329573
|
-
return {
|
|
329574
|
-
fileName,
|
|
329575
|
-
// eslint-disable-next-line no-bitwise
|
|
329576
|
-
isExecutable: (fstat.mode & fs25.constants.X_OK) !== 0
|
|
329577
|
-
};
|
|
329578
|
-
} catch {
|
|
329579
|
-
return void 0;
|
|
329580
|
-
}
|
|
329581
|
-
}
|
|
329582
|
-
function quoteSpaces(part) {
|
|
329583
|
-
if (part.includes(" ")) {
|
|
329584
|
-
return `"${part}"`;
|
|
329585
|
-
}
|
|
329586
|
-
return part;
|
|
329587
|
-
}
|
|
329588
|
-
var path25, cxapi2, fs25, EXTENSION_MAP;
|
|
329589
|
-
var init_environment3 = __esm({
|
|
329590
|
-
"../toolkit-lib/lib/api/cloud-assembly/environment.ts"() {
|
|
329591
|
-
"use strict";
|
|
329592
|
-
path25 = __toESM(require("path"));
|
|
329593
|
-
cxapi2 = __toESM(require_lib4());
|
|
329594
|
-
fs25 = __toESM(require_lib6());
|
|
329595
|
-
__name(prepareDefaultEnvironment, "prepareDefaultEnvironment");
|
|
329596
|
-
__name(contextFromSettings, "contextFromSettings");
|
|
329597
|
-
__name(synthParametersFromSettings, "synthParametersFromSettings");
|
|
329598
|
-
__name(spaceAvailableForContext, "spaceAvailableForContext");
|
|
329599
|
-
__name(guessExecutable, "guessExecutable");
|
|
329600
|
-
__name(guessInterpreter, "guessInterpreter");
|
|
329601
|
-
EXTENSION_MAP = {
|
|
329602
|
-
".js": executeNode
|
|
329603
|
-
};
|
|
329604
|
-
__name(executeNode, "executeNode");
|
|
329605
|
-
__name(splitFirstShellWord, "splitFirstShellWord");
|
|
329606
|
-
__name(checkFile, "checkFile");
|
|
329607
|
-
__name(quoteSpaces, "quoteSpaces");
|
|
329608
|
-
}
|
|
329609
|
-
});
|
|
329610
|
-
|
|
329611
|
-
// ../toolkit-lib/lib/api/cloud-assembly/private/prepare-source.ts
|
|
329612
|
-
function writeContextToEnv(env, context, completeness) {
|
|
329613
|
-
let contextOverflowLocation = null;
|
|
329614
|
-
const envVariableSizeLimit = os8.platform() === "win32" ? 32760 : 131072;
|
|
329615
|
-
const completeEnv = { ...completeness === "add-process-env-later" ? process.env : {}, ...env };
|
|
329616
|
-
const [smallContext, overflow] = splitBySize(context, spaceAvailableForContext(completeEnv, envVariableSizeLimit));
|
|
329617
|
-
env[cxapi3.CONTEXT_ENV] = JSON.stringify(smallContext);
|
|
329618
|
-
if (Object.keys(overflow ?? {}).length > 0) {
|
|
329619
|
-
const contextDir = fs26.mkdtempSync(path26.join(os8.tmpdir(), "cdk-context"));
|
|
329620
|
-
contextOverflowLocation = path26.join(contextDir, "context-overflow.json");
|
|
329621
|
-
fs26.writeJSONSync(contextOverflowLocation, overflow);
|
|
329622
|
-
env[cxapi3.CONTEXT_OVERFLOW_LOCATION_ENV] = contextOverflowLocation;
|
|
329623
|
-
}
|
|
329624
|
-
return async () => {
|
|
329625
|
-
if (contextOverflowLocation) {
|
|
329626
|
-
await fs26.promises.rm(path26.dirname(contextOverflowLocation), { recursive: true, force: true });
|
|
329627
|
-
}
|
|
329628
|
-
};
|
|
329629
|
-
}
|
|
329630
|
-
async function checkContextOverflowSupport(assembly, ioHelper) {
|
|
329631
|
-
const traceFn = /* @__PURE__ */ __name((msg) => ioHelper.defaults.trace(msg), "traceFn");
|
|
329632
|
-
const tree = await loadTree(assembly, traceFn);
|
|
329633
|
-
if (!frameworkSupportsContextOverflow(tree)) {
|
|
329634
|
-
await ioHelper.notify(IO.CDK_ASSEMBLY_W0010.msg("Part of the context could not be sent to the application. Please update the AWS CDK library to the latest version."));
|
|
329635
|
-
}
|
|
329636
|
-
}
|
|
329637
|
-
function frameworkSupportsContextOverflow(tree) {
|
|
329638
|
-
return !some(tree, (node) => {
|
|
329639
|
-
const fqn = node.constructInfo?.fqn;
|
|
329640
|
-
const version = node.constructInfo?.version;
|
|
329641
|
-
return fqn === "aws-cdk-lib.App" && version !== "0.0.0" && version != null && (0, import_semver2.lte)(version, "2.38.0") || fqn === "@aws-cdk/core.App";
|
|
329642
|
-
});
|
|
329643
|
-
}
|
|
329644
|
-
async function assemblyFromDirectory(assemblyDir, ioHelper, loadOptions = {}) {
|
|
329645
|
-
try {
|
|
329646
|
-
const assembly = new import_cloud_assembly_api10.CloudAssembly(assemblyDir, {
|
|
329647
|
-
skipVersionCheck: !(loadOptions.checkVersion ?? true),
|
|
329648
|
-
skipEnumCheck: !(loadOptions.checkEnums ?? true),
|
|
329649
|
-
// We sort as we deploy
|
|
329650
|
-
topoSort: false
|
|
329651
|
-
});
|
|
329652
|
-
await checkContextOverflowSupport(assembly, ioHelper);
|
|
329653
|
-
return assembly;
|
|
329654
|
-
} catch (err) {
|
|
329655
|
-
if (err.message.includes(cxschema7.VERSION_MISMATCH)) {
|
|
329656
|
-
const message2 = "This AWS CDK Toolkit is not compatible with the AWS CDK library used by your application. Please upgrade to the latest version.";
|
|
329657
|
-
await ioHelper.notify(IO.CDK_ASSEMBLY_E1111.msg(message2, { error: err }));
|
|
329658
|
-
throw new ToolkitError(`${message2}
|
|
329659
|
-
(${err.message}`);
|
|
329660
|
-
}
|
|
329661
|
-
throw err;
|
|
329662
|
-
}
|
|
329663
|
-
}
|
|
329664
|
-
function settingsFromSynthOptions(synthOpts = {}) {
|
|
329665
|
-
return new Settings({
|
|
329666
|
-
debug: false,
|
|
329667
|
-
pathMetadata: true,
|
|
329668
|
-
versionReporting: true,
|
|
329669
|
-
assetMetadata: true,
|
|
329670
|
-
assetStaging: true,
|
|
329671
|
-
...synthOpts
|
|
329672
|
-
}, true);
|
|
329673
|
-
}
|
|
329674
|
-
function parametersFromSynthOptions(synthOptions) {
|
|
329675
|
-
return synthParametersFromSettings(settingsFromSynthOptions(synthOptions ?? {}));
|
|
329676
|
-
}
|
|
329677
|
-
var import_dispose_polyfill2, os8, path26, import_node_util2, import_cloud_assembly_api10, cxschema7, cxapi3, fs26, import_semver2, ExecutionEnvironment;
|
|
329678
|
-
var init_prepare_source = __esm({
|
|
329679
|
-
"../toolkit-lib/lib/api/cloud-assembly/private/prepare-source.ts"() {
|
|
329680
|
-
"use strict";
|
|
329681
|
-
import_dispose_polyfill2 = __toESM(require_dispose_polyfill());
|
|
329682
|
-
os8 = __toESM(require("node:os"));
|
|
329683
|
-
path26 = __toESM(require("node:path"));
|
|
329684
|
-
import_node_util2 = require("node:util");
|
|
329685
|
-
import_cloud_assembly_api10 = __toESM(require_lib3());
|
|
329686
|
-
cxschema7 = __toESM(require_lib2());
|
|
329687
|
-
cxapi3 = __toESM(require_lib4());
|
|
329688
|
-
fs26 = __toESM(require_lib6());
|
|
329689
|
-
import_semver2 = __toESM(require_semver4());
|
|
329690
|
-
init_toolkit_error();
|
|
329691
|
-
init_util();
|
|
329692
|
-
init_private();
|
|
329693
|
-
init_rwlock();
|
|
329694
|
-
init_settings();
|
|
329695
|
-
init_tree();
|
|
329696
|
-
init_environment3();
|
|
329697
|
-
ExecutionEnvironment = class _ExecutionEnvironment {
|
|
329698
|
-
static {
|
|
329699
|
-
__name(this, "ExecutionEnvironment");
|
|
329700
|
-
}
|
|
329701
|
-
/**
|
|
329702
|
-
* Create an ExecutionEnvironment
|
|
329703
|
-
*
|
|
329704
|
-
* An ExecutionEnvironment holds a writer lock on the given directory which will
|
|
329705
|
-
* be cleaned up when the object is disposed.
|
|
329706
|
-
*
|
|
329707
|
-
* A temporary directory will be created if none is supplied, which will be cleaned
|
|
329708
|
-
* up when this object is disposed.
|
|
329709
|
-
*
|
|
329710
|
-
* If `markSuccessful()` is called, the writer lock is converted to a reader lock
|
|
329711
|
-
* and temporary directories will not be cleaned up anymore.
|
|
329712
|
-
*/
|
|
329713
|
-
static async create(services, options) {
|
|
329714
|
-
let outDirIsTemporary = false;
|
|
329715
|
-
let dir = options.outdir;
|
|
329716
|
-
if (!dir) {
|
|
329717
|
-
outDirIsTemporary = true;
|
|
329718
|
-
dir = fs26.mkdtempSync(path26.join(fs26.realpathSync(os8.tmpdir()), "cdk.out"));
|
|
329719
|
-
}
|
|
329720
|
-
const lock = await new RWLock(dir).acquireWrite();
|
|
329721
|
-
const opts = {
|
|
329722
|
-
outdir: dir,
|
|
329723
|
-
resolveDefaultAppEnv: options.resolveDefaultAppEnv
|
|
329724
|
-
};
|
|
329725
|
-
return new _ExecutionEnvironment(services, opts, {
|
|
329726
|
-
lock,
|
|
329727
|
-
outDirIsTemporary
|
|
329728
|
-
});
|
|
329729
|
-
}
|
|
329730
|
-
/**
|
|
329731
|
-
* Should the outdir be disposed of.
|
|
329732
|
-
*/
|
|
329733
|
-
get shouldDisposeOutDir() {
|
|
329734
|
-
return this.shouldClean;
|
|
329735
|
-
}
|
|
329736
|
-
/**
|
|
329737
|
-
* The directory the cloud assembly will be written to.
|
|
329738
|
-
*/
|
|
329739
|
-
outdir;
|
|
329740
|
-
options;
|
|
329741
|
-
ioHelper;
|
|
329742
|
-
sdkProvider;
|
|
329743
|
-
debugFn;
|
|
329744
|
-
lock;
|
|
329745
|
-
shouldClean;
|
|
329746
|
-
constructor(services, options, { lock, outDirIsTemporary }) {
|
|
329747
|
-
this.ioHelper = services.ioHelper;
|
|
329748
|
-
this.sdkProvider = services.sdkProvider;
|
|
329749
|
-
this.debugFn = (msg) => this.ioHelper.defaults.debug(msg);
|
|
329750
|
-
this.lock = lock;
|
|
329751
|
-
this.shouldClean = outDirIsTemporary;
|
|
329752
|
-
this.outdir = options.outdir;
|
|
329753
|
-
this.options = options;
|
|
329754
|
-
}
|
|
329755
|
-
async [Symbol.asyncDispose]() {
|
|
329756
|
-
await this.lock?.release();
|
|
329757
|
-
if (this.shouldDisposeOutDir) {
|
|
329758
|
-
await fs26.rm(this.outdir, { recursive: true, force: true });
|
|
329759
|
-
}
|
|
329760
|
-
}
|
|
329761
|
-
/**
|
|
329762
|
-
* Mark the execution as successful, which stops the writer lock from being released upon disposal
|
|
329763
|
-
*/
|
|
329764
|
-
async markSuccessful() {
|
|
329765
|
-
if (!this.lock) {
|
|
329766
|
-
throw new TypeError("Cannot mark successful more than once");
|
|
329767
|
-
}
|
|
329768
|
-
const readLock = await this.lock.convertToReaderLock();
|
|
329769
|
-
this.lock = void 0;
|
|
329770
|
-
this.shouldClean = false;
|
|
329771
|
-
return { readLock };
|
|
329772
|
-
}
|
|
329773
|
-
/**
|
|
329774
|
-
* Begin an execution in this environment
|
|
329775
|
-
*
|
|
329776
|
-
* This will acquire a write lock on the given environment. The write lock
|
|
329777
|
-
* will be released automatically when the return object is disposed, unless it
|
|
329778
|
-
* is converted to a reader lock.
|
|
329779
|
-
*/
|
|
329780
|
-
async beginExecution() {
|
|
329781
|
-
const lock = await new RWLock(this.outdir).acquireWrite();
|
|
329782
|
-
let converted = false;
|
|
329783
|
-
return {
|
|
329784
|
-
async writeToReadLock() {
|
|
329785
|
-
converted = true;
|
|
329786
|
-
return lock.convertToReaderLock();
|
|
329787
|
-
},
|
|
329788
|
-
[Symbol.asyncDispose]: async () => {
|
|
329789
|
-
if (!converted) {
|
|
329790
|
-
await lock.release();
|
|
329791
|
-
}
|
|
329792
|
-
}
|
|
329793
|
-
};
|
|
329794
|
-
}
|
|
329795
|
-
/**
|
|
329796
|
-
* Guess the executable from the command-line argument
|
|
329797
|
-
*
|
|
329798
|
-
* Only do this if the file is NOT marked as executable. If it is,
|
|
329799
|
-
* we'll defer to the shebang inside the file itself.
|
|
329800
|
-
*
|
|
329801
|
-
* If we're on Windows, we ALWAYS take the handler, since it's hard to
|
|
329802
|
-
* verify if registry associations have or have not been set up for this
|
|
329803
|
-
* file type, so we'll assume the worst and take control.
|
|
329804
|
-
*/
|
|
329805
|
-
guessExecutable(app) {
|
|
329806
|
-
return guessExecutable(app, this.debugFn);
|
|
329807
|
-
}
|
|
329808
|
-
/**
|
|
329809
|
-
* If we don't have region/account defined in context, we fall back to the default SDK behavior
|
|
329810
|
-
* where region is retrieved from ~/.aws/config and account is based on default credentials provider
|
|
329811
|
-
* chain and then STS is queried.
|
|
329812
|
-
*
|
|
329813
|
-
* This is done opportunistically: for example, if we can't access STS for some reason or the region
|
|
329814
|
-
* is not configured, the context value will be 'null' and there could failures down the line. In
|
|
329815
|
-
* some cases, synthesis does not require region/account information at all, so that might be perfectly
|
|
329816
|
-
* fine in certain scenarios.
|
|
329817
|
-
*/
|
|
329818
|
-
async defaultEnvVars() {
|
|
329819
|
-
const debugFn = /* @__PURE__ */ __name((msg) => this.ioHelper.notify(IO.CDK_ASSEMBLY_I0010.msg(msg)), "debugFn");
|
|
329820
|
-
const env = this.options.resolveDefaultAppEnv ? await prepareDefaultEnvironment(this.sdkProvider, debugFn) : {};
|
|
329821
|
-
env[cxapi3.OUTDIR_ENV] = this.outdir;
|
|
329822
|
-
await debugFn((0, import_node_util2.format)("outdir:", this.outdir));
|
|
329823
|
-
env[cxapi3.CLI_ASM_VERSION_ENV] = cxschema7.Manifest.version();
|
|
329824
|
-
env[cxapi3.CLI_VERSION_ENV] = versionNumber();
|
|
329825
|
-
await debugFn((0, import_node_util2.format)("env:", env));
|
|
329826
|
-
return env;
|
|
329827
|
-
}
|
|
329828
|
-
/**
|
|
329829
|
-
* Run code from a different working directory
|
|
329830
|
-
*/
|
|
329831
|
-
async changeDir(block, workingDir) {
|
|
329832
|
-
const originalWorkingDir = process.cwd();
|
|
329833
|
-
try {
|
|
329834
|
-
if (workingDir) {
|
|
329835
|
-
process.chdir(workingDir);
|
|
329836
|
-
}
|
|
329837
|
-
return await block();
|
|
329838
|
-
} finally {
|
|
329839
|
-
if (workingDir) {
|
|
329840
|
-
process.chdir(originalWorkingDir);
|
|
329841
|
-
}
|
|
329842
|
-
}
|
|
329843
|
-
}
|
|
329844
|
-
};
|
|
329845
|
-
__name(writeContextToEnv, "writeContextToEnv");
|
|
329846
|
-
__name(checkContextOverflowSupport, "checkContextOverflowSupport");
|
|
329847
|
-
__name(frameworkSupportsContextOverflow, "frameworkSupportsContextOverflow");
|
|
329848
|
-
__name(assemblyFromDirectory, "assemblyFromDirectory");
|
|
329849
|
-
__name(settingsFromSynthOptions, "settingsFromSynthOptions");
|
|
329850
|
-
__name(parametersFromSynthOptions, "parametersFromSynthOptions");
|
|
329851
|
-
}
|
|
329852
|
-
});
|
|
329853
|
-
|
|
329854
330384
|
// ../toolkit-lib/lib/api/cloud-assembly/private/stack-selectors.ts
|
|
329855
330385
|
var ALL_STACKS;
|
|
329856
330386
|
var init_stack_selectors = __esm({
|
|
@@ -329881,14 +330411,14 @@ async function assemblyFromSource(ioHelper, assemblySource, cache16 = true) {
|
|
|
329881
330411
|
return assemblySource;
|
|
329882
330412
|
}
|
|
329883
330413
|
if (cache16) {
|
|
329884
|
-
|
|
329885
|
-
return ret;
|
|
330414
|
+
return new StackAssembly(new CachedCloudAssembly(await assemblySource.produce()), ioHelper);
|
|
329886
330415
|
}
|
|
329887
330416
|
return new StackAssembly(await assemblySource.produce(), ioHelper);
|
|
329888
330417
|
}
|
|
329889
330418
|
var init_private4 = __esm({
|
|
329890
330419
|
"../toolkit-lib/lib/toolkit/private/index.ts"() {
|
|
329891
330420
|
"use strict";
|
|
330421
|
+
init_cloud_assembly3();
|
|
329892
330422
|
init_private3();
|
|
329893
330423
|
__name(assemblyFromSource, "assemblyFromSource");
|
|
329894
330424
|
}
|
|
@@ -329927,11 +330457,11 @@ var init_private5 = __esm({
|
|
|
329927
330457
|
});
|
|
329928
330458
|
|
|
329929
330459
|
// ../toolkit-lib/lib/actions/bootstrap/index.ts
|
|
329930
|
-
var
|
|
330460
|
+
var path29, BootstrapEnvironments, BootstrapStackParameters, BootstrapSource, BootstrapTemplate;
|
|
329931
330461
|
var init_bootstrap2 = __esm({
|
|
329932
330462
|
"../toolkit-lib/lib/actions/bootstrap/index.ts"() {
|
|
329933
330463
|
"use strict";
|
|
329934
|
-
|
|
330464
|
+
path29 = __toESM(require("path"));
|
|
329935
330465
|
init_private5();
|
|
329936
330466
|
init_private3();
|
|
329937
330467
|
init_private();
|
|
@@ -330054,7 +330584,7 @@ var init_bootstrap2 = __esm({
|
|
|
330054
330584
|
template = await loadStructuredFile(source.templateFile);
|
|
330055
330585
|
break;
|
|
330056
330586
|
case "default":
|
|
330057
|
-
template = await loadStructuredFile(
|
|
330587
|
+
template = await loadStructuredFile(path29.join(bundledPackageRootDir(__dirname), "lib", "api", "bootstrap", "bootstrap-template.yaml"));
|
|
330058
330588
|
break;
|
|
330059
330589
|
}
|
|
330060
330590
|
return new _BootstrapTemplate(template);
|
|
@@ -332579,7 +333109,7 @@ function onlyChanges(xs) {
|
|
|
332579
333109
|
return ret;
|
|
332580
333110
|
}
|
|
332581
333111
|
var import_assert, import_service_spec_types2, TemplateDiff, Difference, PropertyDifference, DifferenceCollection, ConditionDifference, MappingDifference, MetadataDifference, OutputDifference, ParameterDifference, ResourceImpact, ResourceDifference;
|
|
332582
|
-
var
|
|
333112
|
+
var init_types5 = __esm({
|
|
332583
333113
|
"../cloudformation-diff/lib/diff/types.ts"() {
|
|
332584
333114
|
"use strict";
|
|
332585
333115
|
import_assert = require("assert");
|
|
@@ -333109,7 +333639,7 @@ function _asString(value) {
|
|
|
333109
333639
|
var init_diff2 = __esm({
|
|
333110
333640
|
"../cloudformation-diff/lib/diff/index.ts"() {
|
|
333111
333641
|
"use strict";
|
|
333112
|
-
|
|
333642
|
+
init_types5();
|
|
333113
333643
|
init_util4();
|
|
333114
333644
|
__name(diffAttribute, "diffAttribute");
|
|
333115
333645
|
__name(diffCondition, "diffCondition");
|
|
@@ -333128,7 +333658,7 @@ var TemplateAndChangeSetDiffMerger;
|
|
|
333128
333658
|
var init_template_and_changeset_diff_merger = __esm({
|
|
333129
333659
|
"../cloudformation-diff/lib/diff/template-and-changeset-diff-merger.ts"() {
|
|
333130
333660
|
"use strict";
|
|
333131
|
-
|
|
333661
|
+
init_types5();
|
|
333132
333662
|
TemplateAndChangeSetDiffMerger = class _TemplateAndChangeSetDiffMerger {
|
|
333133
333663
|
static {
|
|
333134
333664
|
__name(this, "TemplateAndChangeSetDiffMerger");
|
|
@@ -333416,9 +333946,9 @@ var init_diff_template = __esm({
|
|
|
333416
333946
|
"use strict";
|
|
333417
333947
|
init_diff2();
|
|
333418
333948
|
init_template_and_changeset_diff_merger();
|
|
333419
|
-
|
|
333949
|
+
init_types5();
|
|
333420
333950
|
init_util4();
|
|
333421
|
-
|
|
333951
|
+
init_types5();
|
|
333422
333952
|
DIFF_HANDLERS = {
|
|
333423
333953
|
AWSTemplateFormatVersion: /* @__PURE__ */ __name((diff, oldValue, newValue) => diff.awsTemplateFormatVersion = diffAttribute(oldValue, newValue), "AWSTemplateFormatVersion"),
|
|
333424
333954
|
Description: /* @__PURE__ */ __name((diff, oldValue, newValue) => diff.description = diffAttribute(oldValue, newValue), "Description"),
|
|
@@ -340020,11 +340550,11 @@ function _diffStrings(oldStr, newStr, context) {
|
|
|
340020
340550
|
}
|
|
340021
340551
|
__name(_findIndent, "_findIndent");
|
|
340022
340552
|
}
|
|
340023
|
-
var
|
|
340553
|
+
var import_util42, chalk10, PATH_METADATA_KEY2, structuredPatch, ADDITION, CONTEXT, UPDATE, REMOVAL, IMPORT, Formatter;
|
|
340024
340554
|
var init_format = __esm({
|
|
340025
340555
|
"../cloudformation-diff/lib/format.ts"() {
|
|
340026
340556
|
"use strict";
|
|
340027
|
-
|
|
340557
|
+
import_util42 = require("util");
|
|
340028
340558
|
chalk10 = __toESM(require_source());
|
|
340029
340559
|
init_util4();
|
|
340030
340560
|
init_diff_template();
|
|
@@ -340052,10 +340582,10 @@ var init_format = __esm({
|
|
|
340052
340582
|
__name(this, "Formatter");
|
|
340053
340583
|
}
|
|
340054
340584
|
print(fmt, ...args) {
|
|
340055
|
-
this.stream.write(chalk10.reset((0,
|
|
340585
|
+
this.stream.write(chalk10.reset((0, import_util42.format)(fmt, ...args)) + "\n");
|
|
340056
340586
|
}
|
|
340057
340587
|
warning(fmt, ...args) {
|
|
340058
|
-
this.stream.write(chalk10.yellow((0,
|
|
340588
|
+
this.stream.write(chalk10.yellow((0, import_util42.format)(fmt, ...args)) + "\n");
|
|
340059
340589
|
}
|
|
340060
340590
|
formatSection(title, entryType, collection, formatter = this.formatDifference.bind(this)) {
|
|
340061
340591
|
if (collection.differenceCount === 0) {
|
|
@@ -340692,7 +341222,7 @@ async function prepareAsset(ioHelper, asset, assetManifest, envResources, toolki
|
|
|
340692
341222
|
}
|
|
340693
341223
|
}
|
|
340694
341224
|
async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, packaging) {
|
|
340695
|
-
const extension = packaging === cxschema8.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" :
|
|
341225
|
+
const extension = packaging === cxschema8.FileAssetPackaging.ZIP_DIRECTORY ? ".zip" : path30.extname(asset.path);
|
|
340696
341226
|
const baseName = `${asset.sourceHash}${extension}`;
|
|
340697
341227
|
const s3Prefix = asset.id === asset.sourceHash ? "assets/" : `assets/${asset.id}/`;
|
|
340698
341228
|
const key = `${s3Prefix}${baseName}`;
|
|
@@ -340707,7 +341237,7 @@ async function prepareFileAsset(ioHelper, asset, assetManifest, toolkitInfo, pac
|
|
|
340707
341237
|
});
|
|
340708
341238
|
return {
|
|
340709
341239
|
[asset.s3BucketParameter]: toolkitInfo.bucketName,
|
|
340710
|
-
[asset.s3KeyParameter]: `${s3Prefix}${
|
|
341240
|
+
[asset.s3KeyParameter]: `${s3Prefix}${cxapi5.ASSET_PREFIX_SEPARATOR}${baseName}`,
|
|
340711
341241
|
[asset.artifactHashParameter]: asset.sourceHash
|
|
340712
341242
|
};
|
|
340713
341243
|
}
|
|
@@ -340736,12 +341266,12 @@ async function prepareDockerImageAsset(asset, assetManifest, envResources) {
|
|
|
340736
341266
|
}
|
|
340737
341267
|
return { [asset.imageNameParameter]: `${repositoryUri2}:${imageTag}` };
|
|
340738
341268
|
}
|
|
340739
|
-
var
|
|
341269
|
+
var path30, cxapi5, cxschema8, chalk12;
|
|
340740
341270
|
var init_assets3 = __esm({
|
|
340741
341271
|
"../toolkit-lib/lib/api/deployments/assets.ts"() {
|
|
340742
341272
|
"use strict";
|
|
340743
|
-
|
|
340744
|
-
|
|
341273
|
+
path30 = __toESM(require("path"));
|
|
341274
|
+
cxapi5 = __toESM(require_lib3());
|
|
340745
341275
|
cxschema8 = __toESM(require_lib2());
|
|
340746
341276
|
chalk12 = __toESM(require_source());
|
|
340747
341277
|
init_toolkit_error();
|
|
@@ -340983,7 +341513,7 @@ var init_synth = __esm({
|
|
|
340983
341513
|
});
|
|
340984
341514
|
|
|
340985
341515
|
// ../toolkit-lib/lib/payloads/types.ts
|
|
340986
|
-
var
|
|
341516
|
+
var init_types6 = __esm({
|
|
340987
341517
|
"../toolkit-lib/lib/payloads/types.ts"() {
|
|
340988
341518
|
"use strict";
|
|
340989
341519
|
}
|
|
@@ -341071,7 +341601,7 @@ var init_payloads = __esm({
|
|
|
341071
341601
|
init_rollback();
|
|
341072
341602
|
init_stack_activity();
|
|
341073
341603
|
init_synth();
|
|
341074
|
-
|
|
341604
|
+
init_types6();
|
|
341075
341605
|
init_progress2();
|
|
341076
341606
|
init_refactor();
|
|
341077
341607
|
init_watch();
|
|
@@ -342464,7 +342994,7 @@ async function applyHotswapOperation(sdk, ioSpan, hotswapOperation) {
|
|
|
342464
342994
|
sdk.appendCustomUserAgent(customUserAgent);
|
|
342465
342995
|
const resourceText = /* @__PURE__ */ __name((r16) => r16.description ?? `${r16.resourceType} '${r16.physicalName ?? r16.logicalId}'`, "resourceText");
|
|
342466
342996
|
await ioSpan.notify(IO.CDK_TOOLKIT_I5402.msg(
|
|
342467
|
-
hotswapOperation.change.resources.map((r16) => (0,
|
|
342997
|
+
hotswapOperation.change.resources.map((r16) => (0, import_util48.format)(` ${ICON} %s`, chalk13.bold(resourceText(r16)))).join("\n"),
|
|
342468
342998
|
hotswapOperation.change
|
|
342469
342999
|
));
|
|
342470
343000
|
try {
|
|
@@ -342479,7 +343009,7 @@ async function applyHotswapOperation(sdk, ioSpan, hotswapOperation) {
|
|
|
342479
343009
|
throw e16;
|
|
342480
343010
|
}
|
|
342481
343011
|
await ioSpan.notify(IO.CDK_TOOLKIT_I5403.msg(
|
|
342482
|
-
hotswapOperation.change.resources.map((r16) => (0,
|
|
343012
|
+
hotswapOperation.change.resources.map((r16) => (0, import_util48.format)(` ${ICON} %s %s`, chalk13.bold(resourceText(r16)), chalk13.green("hotswapped!"))).join("\n"),
|
|
342483
343013
|
hotswapOperation.change
|
|
342484
343014
|
));
|
|
342485
343015
|
sdk.removeCustomUserAgent(customUserAgent);
|
|
@@ -342508,9 +343038,9 @@ async function logRejectedChanges(ioSpan, rejectedChanges, hotswapMode) {
|
|
|
342508
343038
|
}
|
|
342509
343039
|
const messages = [""];
|
|
342510
343040
|
if (hotswapMode === "hotswap-only") {
|
|
342511
|
-
messages.push((0,
|
|
343041
|
+
messages.push((0, import_util48.format)("%s %s", chalk13.red("\u26A0\uFE0F"), chalk13.red("The following non-hotswappable changes were found. To reconcile these using CloudFormation, specify --hotswap-fallback")));
|
|
342512
343042
|
} else {
|
|
342513
|
-
messages.push((0,
|
|
343043
|
+
messages.push((0, import_util48.format)("%s %s", chalk13.red("\u26A0\uFE0F"), chalk13.red("The following non-hotswappable changes were found:")));
|
|
342514
343044
|
}
|
|
342515
343045
|
for (const { change } of rejectedChanges) {
|
|
342516
343046
|
messages.push(" " + nonHotswappableChangeMessage(change));
|
|
@@ -342523,7 +343053,7 @@ function nonHotswappableChangeMessage(change) {
|
|
|
342523
343053
|
const reason = change.description ?? change.reason;
|
|
342524
343054
|
switch (subject.type) {
|
|
342525
343055
|
case "Output":
|
|
342526
|
-
return (0,
|
|
343056
|
+
return (0, import_util48.format)(
|
|
342527
343057
|
"output: %s, reason: %s",
|
|
342528
343058
|
chalk13.bold(subject.logicalId),
|
|
342529
343059
|
chalk13.red(reason)
|
|
@@ -342534,7 +343064,7 @@ function nonHotswappableChangeMessage(change) {
|
|
|
342534
343064
|
}
|
|
342535
343065
|
function nonHotswappableResourceMessage(subject, reason) {
|
|
342536
343066
|
if (subject.rejectedProperties?.length) {
|
|
342537
|
-
return (0,
|
|
343067
|
+
return (0, import_util48.format)(
|
|
342538
343068
|
"resource: %s, type: %s, rejected changes: %s, reason: %s",
|
|
342539
343069
|
chalk13.bold(subject.logicalId),
|
|
342540
343070
|
chalk13.bold(subject.resourceType),
|
|
@@ -342542,18 +343072,18 @@ function nonHotswappableResourceMessage(subject, reason) {
|
|
|
342542
343072
|
chalk13.red(reason)
|
|
342543
343073
|
);
|
|
342544
343074
|
}
|
|
342545
|
-
return (0,
|
|
343075
|
+
return (0, import_util48.format)(
|
|
342546
343076
|
"resource: %s, type: %s, reason: %s",
|
|
342547
343077
|
chalk13.bold(subject.logicalId),
|
|
342548
343078
|
chalk13.bold(subject.resourceType),
|
|
342549
343079
|
chalk13.red(reason)
|
|
342550
343080
|
);
|
|
342551
343081
|
}
|
|
342552
|
-
var
|
|
343082
|
+
var import_util48, cfn_diff, chalk13, pLimit2, RESOURCE_DETECTORS;
|
|
342553
343083
|
var init_hotswap_deployments = __esm({
|
|
342554
343084
|
"../toolkit-lib/lib/api/hotswap/hotswap-deployments.ts"() {
|
|
342555
343085
|
"use strict";
|
|
342556
|
-
|
|
343086
|
+
import_util48 = require("util");
|
|
342557
343087
|
cfn_diff = __toESM(require_lib11());
|
|
342558
343088
|
chalk13 = __toESM(require_source());
|
|
342559
343089
|
init_payloads();
|
|
@@ -342718,7 +343248,7 @@ async function deployStack(options, ioHelper) {
|
|
|
342718
343248
|
await ioHelper.defaults.debug(`${deployName}: skipping deployment (use --force to override)`);
|
|
342719
343249
|
if (deploymentMethod?.method === "hotswap") {
|
|
342720
343250
|
await ioHelper.defaults.info(
|
|
342721
|
-
(0,
|
|
343251
|
+
(0, import_util50.format)(
|
|
342722
343252
|
`
|
|
342723
343253
|
${ICON} %s
|
|
342724
343254
|
`,
|
|
@@ -342769,7 +343299,7 @@ async function deployStack(options, ioHelper) {
|
|
|
342769
343299
|
if (hotswapDeploymentResult) {
|
|
342770
343300
|
return hotswapDeploymentResult;
|
|
342771
343301
|
}
|
|
342772
|
-
await ioHelper.defaults.info((0,
|
|
343302
|
+
await ioHelper.defaults.info((0, import_util50.format)(
|
|
342773
343303
|
"Could not perform a hotswap deployment, as the stack %s contains non-Asset changes",
|
|
342774
343304
|
stackArtifact.displayName
|
|
342775
343305
|
));
|
|
@@ -342777,7 +343307,7 @@ async function deployStack(options, ioHelper) {
|
|
|
342777
343307
|
if (!(e16 instanceof CfnEvaluationException)) {
|
|
342778
343308
|
throw e16;
|
|
342779
343309
|
}
|
|
342780
|
-
await ioHelper.defaults.info((0,
|
|
343310
|
+
await ioHelper.defaults.info((0, import_util50.format)(
|
|
342781
343311
|
"Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: %s",
|
|
342782
343312
|
formatErrorMessage(e16)
|
|
342783
343313
|
));
|
|
@@ -342904,11 +343434,11 @@ function hasReplacement(cs) {
|
|
|
342904
343434
|
return a16 === "ReplaceAndDelete" || a16 === "ReplaceAndRetain" || a16 === "ReplaceAndSnapshot";
|
|
342905
343435
|
});
|
|
342906
343436
|
}
|
|
342907
|
-
var
|
|
343437
|
+
var import_util50, chalk14, FullCloudFormationDeployment;
|
|
342908
343438
|
var init_deploy_stack = __esm({
|
|
342909
343439
|
"../toolkit-lib/lib/api/deployments/deploy-stack.ts"() {
|
|
342910
343440
|
"use strict";
|
|
342911
|
-
|
|
343441
|
+
import_util50 = require("util");
|
|
342912
343442
|
chalk14 = __toESM(require_source());
|
|
342913
343443
|
init_esm3();
|
|
342914
343444
|
init_asset_manifest_builder();
|
|
@@ -342967,9 +343497,9 @@ var init_deploy_stack = __esm({
|
|
|
342967
343497
|
const changeSetDescription = await this.createChangeSet(changeSetName, execute, importExistingResources);
|
|
342968
343498
|
await this.updateTerminationProtection();
|
|
342969
343499
|
if (changeSetHasNoChanges(changeSetDescription)) {
|
|
342970
|
-
await this.ioHelper.defaults.debug((0,
|
|
343500
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("No changes are to be performed on %s.", this.stackName));
|
|
342971
343501
|
if (execute) {
|
|
342972
|
-
await this.ioHelper.defaults.debug((0,
|
|
343502
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("Deleting empty change set %s", changeSetDescription.ChangeSetId));
|
|
342973
343503
|
await this.cfn.deleteChangeSet({
|
|
342974
343504
|
StackName: this.stackName,
|
|
342975
343505
|
ChangeSetName: changeSetName
|
|
@@ -342994,7 +343524,7 @@ var init_deploy_stack = __esm({
|
|
|
342994
343524
|
};
|
|
342995
343525
|
}
|
|
342996
343526
|
if (!execute) {
|
|
342997
|
-
await this.ioHelper.defaults.info((0,
|
|
343527
|
+
await this.ioHelper.defaults.info((0, import_util50.format)(
|
|
342998
343528
|
"Changeset %s created and waiting in review for manual execution (--no-execute)",
|
|
342999
343529
|
changeSetDescription.ChangeSetId
|
|
343000
343530
|
));
|
|
@@ -343022,7 +343552,7 @@ var init_deploy_stack = __esm({
|
|
|
343022
343552
|
async createChangeSet(changeSetName, willExecute, importExistingResources) {
|
|
343023
343553
|
await this.cleanupOldChangeset(changeSetName);
|
|
343024
343554
|
await this.ioHelper.defaults.debug(`Attempting to create ChangeSet with name ${changeSetName} to ${this.verb} stack ${this.stackName}`);
|
|
343025
|
-
await this.ioHelper.defaults.info((0,
|
|
343555
|
+
await this.ioHelper.defaults.info((0, import_util50.format)("%s: creating CloudFormation changeset...", chalk14.bold(this.stackName)));
|
|
343026
343556
|
const changeSet = await this.cfn.createChangeSet({
|
|
343027
343557
|
StackName: this.stackName,
|
|
343028
343558
|
ChangeSetName: changeSetName,
|
|
@@ -343033,7 +343563,7 @@ var init_deploy_stack = __esm({
|
|
|
343033
343563
|
ImportExistingResources: importExistingResources,
|
|
343034
343564
|
...this.commonPrepareOptions()
|
|
343035
343565
|
});
|
|
343036
|
-
await this.ioHelper.defaults.debug((0,
|
|
343566
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("Initiated creation of changeset: %s; waiting for it to finish creating...", changeSet.Id));
|
|
343037
343567
|
const environmentResourcesRegistry = new EnvironmentResourcesRegistry();
|
|
343038
343568
|
const envResources = environmentResourcesRegistry.for(this.options.resolvedEnvironment, this.options.sdk, this.ioHelper);
|
|
343039
343569
|
const validationReporter = new EarlyValidationReporter(this.options.sdk, envResources);
|
|
@@ -343043,7 +343573,7 @@ var init_deploy_stack = __esm({
|
|
|
343043
343573
|
});
|
|
343044
343574
|
}
|
|
343045
343575
|
async executeChangeSet(changeSet) {
|
|
343046
|
-
await this.ioHelper.defaults.debug((0,
|
|
343576
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("Initiating execution of changeset %s on stack %s", changeSet.ChangeSetId, this.stackName));
|
|
343047
343577
|
await this.cfn.executeChangeSet({
|
|
343048
343578
|
StackName: this.stackName,
|
|
343049
343579
|
ChangeSetName: changeSet.ChangeSetName,
|
|
@@ -343051,7 +343581,7 @@ var init_deploy_stack = __esm({
|
|
|
343051
343581
|
...this.commonExecuteOptions()
|
|
343052
343582
|
});
|
|
343053
343583
|
await this.ioHelper.defaults.debug(
|
|
343054
|
-
(0,
|
|
343584
|
+
(0, import_util50.format)(
|
|
343055
343585
|
"Execution of changeset %s on stack %s has started; waiting for the update to complete...",
|
|
343056
343586
|
changeSet.ChangeSetId,
|
|
343057
343587
|
this.stackName
|
|
@@ -343073,7 +343603,7 @@ var init_deploy_stack = __esm({
|
|
|
343073
343603
|
const terminationProtection = this.stackArtifact.terminationProtection ?? false;
|
|
343074
343604
|
if (!!this.cloudFormationStack.terminationProtection !== terminationProtection) {
|
|
343075
343605
|
await this.ioHelper.defaults.debug(
|
|
343076
|
-
(0,
|
|
343606
|
+
(0, import_util50.format)(
|
|
343077
343607
|
"Updating termination protection from %s to %s for stack %s",
|
|
343078
343608
|
this.cloudFormationStack.terminationProtection,
|
|
343079
343609
|
terminationProtection,
|
|
@@ -343084,11 +343614,11 @@ var init_deploy_stack = __esm({
|
|
|
343084
343614
|
StackName: this.stackName,
|
|
343085
343615
|
EnableTerminationProtection: terminationProtection
|
|
343086
343616
|
});
|
|
343087
|
-
await this.ioHelper.defaults.debug((0,
|
|
343617
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("Termination protection updated to %s for stack %s", terminationProtection, this.stackName));
|
|
343088
343618
|
}
|
|
343089
343619
|
}
|
|
343090
343620
|
async directDeployment() {
|
|
343091
|
-
await this.ioHelper.defaults.info((0,
|
|
343621
|
+
await this.ioHelper.defaults.info((0, import_util50.format)("%s: %s stack...", chalk14.bold(this.stackName), this.update ? "updating" : "creating"));
|
|
343092
343622
|
const startTime = /* @__PURE__ */ new Date();
|
|
343093
343623
|
if (this.update) {
|
|
343094
343624
|
await this.updateTerminationProtection();
|
|
@@ -343101,7 +343631,7 @@ var init_deploy_stack = __esm({
|
|
|
343101
343631
|
});
|
|
343102
343632
|
} catch (err) {
|
|
343103
343633
|
if (err.message === "No updates are to be performed.") {
|
|
343104
|
-
await this.ioHelper.defaults.debug((0,
|
|
343634
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("No updates are to be performed for stack %s", this.stackName));
|
|
343105
343635
|
return {
|
|
343106
343636
|
type: "did-deploy-stack",
|
|
343107
343637
|
noOp: true,
|
|
@@ -343146,7 +343676,7 @@ var init_deploy_stack = __esm({
|
|
|
343146
343676
|
} finally {
|
|
343147
343677
|
await monitor.stop();
|
|
343148
343678
|
}
|
|
343149
|
-
await this.ioHelper.defaults.debug((0,
|
|
343679
|
+
await this.ioHelper.defaults.debug((0, import_util50.format)("Stack %s has completed updating", this.stackName));
|
|
343150
343680
|
return {
|
|
343151
343681
|
type: "did-deploy-stack",
|
|
343152
343682
|
noOp: false,
|
|
@@ -343603,14 +344133,14 @@ function removeNonImportResources(stack) {
|
|
|
343603
344133
|
delete template.Outputs;
|
|
343604
344134
|
return template;
|
|
343605
344135
|
}
|
|
343606
|
-
var
|
|
344136
|
+
var import_util53, cfnDiff, chalk16, fs30, ResourceImporter;
|
|
343607
344137
|
var init_importer = __esm({
|
|
343608
344138
|
"../toolkit-lib/lib/api/resource-import/importer.ts"() {
|
|
343609
344139
|
"use strict";
|
|
343610
|
-
|
|
344140
|
+
import_util53 = require("util");
|
|
343611
344141
|
cfnDiff = __toESM(require_lib11());
|
|
343612
344142
|
chalk16 = __toESM(require_source());
|
|
343613
|
-
|
|
344143
|
+
fs30 = __toESM(require_lib6());
|
|
343614
344144
|
init_toolkit_error();
|
|
343615
344145
|
init_deployments2();
|
|
343616
344146
|
init_private();
|
|
@@ -343647,18 +344177,18 @@ var init_importer = __esm({
|
|
|
343647
344177
|
* Load the resources to import from a file
|
|
343648
344178
|
*/
|
|
343649
344179
|
async loadResourceIdentifiers(available, filename) {
|
|
343650
|
-
const contents = await
|
|
344180
|
+
const contents = await fs30.readJson(filename);
|
|
343651
344181
|
const ret = { importResources: [], resourceMap: {} };
|
|
343652
344182
|
for (const resource of available) {
|
|
343653
344183
|
const descr = this.describeResource(resource.logicalId);
|
|
343654
344184
|
const idProps = contents[resource.logicalId];
|
|
343655
344185
|
if (idProps) {
|
|
343656
|
-
await this.ioHelper.defaults.info((0,
|
|
344186
|
+
await this.ioHelper.defaults.info((0, import_util53.format)("%s: importing using %s", chalk16.blue(descr), chalk16.blue(fmtdict(idProps))));
|
|
343657
344187
|
ret.importResources.push(resource);
|
|
343658
344188
|
ret.resourceMap[resource.logicalId] = idProps;
|
|
343659
344189
|
delete contents[resource.logicalId];
|
|
343660
344190
|
} else {
|
|
343661
|
-
await this.ioHelper.defaults.info((0,
|
|
344191
|
+
await this.ioHelper.defaults.info((0, import_util53.format)("%s: skipping", chalk16.blue(descr)));
|
|
343662
344192
|
}
|
|
343663
344193
|
}
|
|
343664
344194
|
const unknown = Object.keys(contents);
|
|
@@ -343702,9 +344232,9 @@ var init_importer = __esm({
|
|
|
343702
344232
|
});
|
|
343703
344233
|
assertIsSuccessfulDeployStackResult(result2);
|
|
343704
344234
|
const message2 = result2.noOp ? " \u2705 %s (no changes)" : " \u2705 %s";
|
|
343705
|
-
await this.ioHelper.defaults.info("\n" + chalk16.green((0,
|
|
344235
|
+
await this.ioHelper.defaults.info("\n" + chalk16.green((0, import_util53.format)(message2, this.stack.displayName)));
|
|
343706
344236
|
} catch (e16) {
|
|
343707
|
-
await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0,
|
|
344237
|
+
await this.ioHelper.notify(IO.CDK_TOOLKIT_E3900.msg((0, import_util53.format)("\n \u274C %s failed: %s", chalk16.bold(this.stack.displayName), e16), { error: e16 }));
|
|
343708
344238
|
throw e16;
|
|
343709
344239
|
}
|
|
343710
344240
|
}
|
|
@@ -343831,7 +344361,7 @@ var init_importer = __esm({
|
|
|
343831
344361
|
for (const idProp of idProps) {
|
|
343832
344362
|
const defaultValue = resourceProps[idProp] ?? "";
|
|
343833
344363
|
const response = await this.ioHelper.requestResponse(IO.CDK_TOOLKIT_I3110.req(
|
|
343834
|
-
(0,
|
|
344364
|
+
(0, import_util53.format)(promptPattern, chalk16.blue(idProp)),
|
|
343835
344365
|
{
|
|
343836
344366
|
resource: {
|
|
343837
344367
|
name: resourceName,
|
|
@@ -343889,12 +344419,12 @@ var init_importer = __esm({
|
|
|
343889
344419
|
});
|
|
343890
344420
|
|
|
343891
344421
|
// ../toolkit-lib/lib/api/resource-import/migrator.ts
|
|
343892
|
-
var chalk17,
|
|
344422
|
+
var chalk17, fs31, ResourceMigrator;
|
|
343893
344423
|
var init_migrator = __esm({
|
|
343894
344424
|
"../toolkit-lib/lib/api/resource-import/migrator.ts"() {
|
|
343895
344425
|
"use strict";
|
|
343896
344426
|
chalk17 = __toESM(require_source());
|
|
343897
|
-
|
|
344427
|
+
fs31 = __toESM(require_lib6());
|
|
343898
344428
|
init_importer();
|
|
343899
344429
|
init_util();
|
|
343900
344430
|
init_private();
|
|
@@ -343925,7 +344455,7 @@ var init_migrator = __esm({
|
|
|
343925
344455
|
await this.ioHelper.defaults.info(`${chalk17.bold(stack.displayName)}: creating stack for resource migration...`);
|
|
343926
344456
|
await this.ioHelper.defaults.info(`${chalk17.bold(stack.displayName)}: importing resources into stack...`);
|
|
343927
344457
|
await this.performResourceMigration(migrateDeployment, resourcesToImport, options);
|
|
343928
|
-
|
|
344458
|
+
fs31.rmSync("migrate.json");
|
|
343929
344459
|
await this.ioHelper.defaults.info(`${chalk17.bold(stack.displayName)}: applying CDKMetadata and Outputs to stack (if applicable)...`);
|
|
343930
344460
|
}
|
|
343931
344461
|
}
|
|
@@ -343950,7 +344480,7 @@ var init_migrator = __esm({
|
|
|
343950
344480
|
}
|
|
343951
344481
|
async tryGetResources(environment) {
|
|
343952
344482
|
try {
|
|
343953
|
-
const migrateFile =
|
|
344483
|
+
const migrateFile = fs31.readJsonSync("migrate.json", {
|
|
343954
344484
|
encoding: "utf-8"
|
|
343955
344485
|
});
|
|
343956
344486
|
const sourceEnv = migrateFile.Source.split(":");
|
|
@@ -344121,12 +344651,14 @@ var init_graph = __esm({
|
|
|
344121
344651
|
const exp = exports2[value["Fn::ImportValue"]];
|
|
344122
344652
|
if (exp != null) {
|
|
344123
344653
|
const v17 = exp.value;
|
|
344124
|
-
if (
|
|
344125
|
-
|
|
344126
|
-
|
|
344127
|
-
|
|
344128
|
-
|
|
344129
|
-
|
|
344654
|
+
if (v17 != null && typeof v17 === "object") {
|
|
344655
|
+
if ("Fn::GetAtt" in v17) {
|
|
344656
|
+
const id = Array.isArray(v17["Fn::GetAtt"]) ? v17["Fn::GetAtt"][0] : v17["Fn::GetAtt"].split(".")[0];
|
|
344657
|
+
return [`${exp.stackName}.${id}`];
|
|
344658
|
+
}
|
|
344659
|
+
if ("Ref" in v17) {
|
|
344660
|
+
return [`${exp.stackName}.${v17.Ref}`];
|
|
344661
|
+
}
|
|
344130
344662
|
}
|
|
344131
344663
|
return [`${exp.stackName}.${v17}`];
|
|
344132
344664
|
}
|
|
@@ -344273,10 +344805,14 @@ function stripReferences(value, exports2) {
|
|
|
344273
344805
|
const exp = exports2[value["Fn::ImportValue"]];
|
|
344274
344806
|
if (exp != null) {
|
|
344275
344807
|
const v17 = exp.value;
|
|
344276
|
-
if (
|
|
344277
|
-
|
|
344278
|
-
|
|
344279
|
-
|
|
344808
|
+
if (v17 != null && typeof v17 === "object") {
|
|
344809
|
+
if ("Ref" in v17) {
|
|
344810
|
+
return { __cloud_ref__: "Ref" };
|
|
344811
|
+
} else if ("Fn::GetAtt" in v17) {
|
|
344812
|
+
return { __cloud_ref__: "Fn::GetAtt" };
|
|
344813
|
+
}
|
|
344814
|
+
} else {
|
|
344815
|
+
return v17;
|
|
344280
344816
|
}
|
|
344281
344817
|
}
|
|
344282
344818
|
}
|
|
@@ -344735,10 +345271,10 @@ async function localFileDiff(stacks, options) {
|
|
|
344735
345271
|
"Can only select one stack when comparing to fixed template. Use --exclusively to avoid selecting multiple stacks."
|
|
344736
345272
|
);
|
|
344737
345273
|
}
|
|
344738
|
-
if (!await
|
|
345274
|
+
if (!await fs32.pathExists(methodOptions.path)) {
|
|
344739
345275
|
throw new ToolkitError(`There is no file at ${methodOptions.path}`);
|
|
344740
345276
|
}
|
|
344741
|
-
const file =
|
|
345277
|
+
const file = fs32.readFileSync(methodOptions.path).toString();
|
|
344742
345278
|
const template = deserializeStructure(file);
|
|
344743
345279
|
return [{
|
|
344744
345280
|
oldTemplate: template,
|
|
@@ -344828,11 +345364,11 @@ function appendObject(obj1, obj2) {
|
|
|
344828
345364
|
}
|
|
344829
345365
|
return obj1;
|
|
344830
345366
|
}
|
|
344831
|
-
var
|
|
345367
|
+
var fs32;
|
|
344832
345368
|
var init_helpers4 = __esm({
|
|
344833
345369
|
"../toolkit-lib/lib/actions/diff/private/helpers.ts"() {
|
|
344834
345370
|
"use strict";
|
|
344835
|
-
|
|
345371
|
+
fs32 = __toESM(require_lib6());
|
|
344836
345372
|
init_esm3();
|
|
344837
345373
|
init_diff();
|
|
344838
345374
|
init_cfn_api();
|
|
@@ -344903,7 +345439,7 @@ var init_private8 = __esm({
|
|
|
344903
345439
|
});
|
|
344904
345440
|
|
|
344905
345441
|
// ../toolkit-lib/lib/api/aws-auth/types.ts
|
|
344906
|
-
var
|
|
345442
|
+
var init_types7 = __esm({
|
|
344907
345443
|
"../toolkit-lib/lib/api/aws-auth/types.ts"() {
|
|
344908
345444
|
"use strict";
|
|
344909
345445
|
}
|
|
@@ -345003,7 +345539,7 @@ __export(aws_auth_exports, {
|
|
|
345003
345539
|
var init_aws_auth = __esm({
|
|
345004
345540
|
"../toolkit-lib/lib/api/aws-auth/index.ts"() {
|
|
345005
345541
|
"use strict";
|
|
345006
|
-
|
|
345542
|
+
init_types7();
|
|
345007
345543
|
init_base_credentials();
|
|
345008
345544
|
}
|
|
345009
345545
|
});
|
|
@@ -345027,15 +345563,15 @@ function bootstrapVersionFromTemplate(template) {
|
|
|
345027
345563
|
function bootstrapVariantFromTemplate(template) {
|
|
345028
345564
|
return template.Parameters?.[BOOTSTRAP_VARIANT_PARAMETER]?.Default ?? DEFAULT_BOOTSTRAP_VARIANT;
|
|
345029
345565
|
}
|
|
345030
|
-
var
|
|
345566
|
+
var os10, path31, import_cloud_assembly_api13, import_cloud_assembly_schema6, fs33, BootstrapStack;
|
|
345031
345567
|
var init_deploy_bootstrap = __esm({
|
|
345032
345568
|
"../toolkit-lib/lib/api/bootstrap/deploy-bootstrap.ts"() {
|
|
345033
345569
|
"use strict";
|
|
345034
|
-
|
|
345035
|
-
|
|
345570
|
+
os10 = __toESM(require("os"));
|
|
345571
|
+
path31 = __toESM(require("path"));
|
|
345036
345572
|
import_cloud_assembly_api13 = __toESM(require_lib3());
|
|
345037
345573
|
import_cloud_assembly_schema6 = __toESM(require_lib2());
|
|
345038
|
-
|
|
345574
|
+
fs33 = __toESM(require_lib6());
|
|
345039
345575
|
init_bootstrap_props();
|
|
345040
345576
|
init_deployments2();
|
|
345041
345577
|
init_deploy_stack();
|
|
@@ -345103,11 +345639,11 @@ var init_deploy_bootstrap = __esm({
|
|
|
345103
345639
|
return abortResponse;
|
|
345104
345640
|
}
|
|
345105
345641
|
}
|
|
345106
|
-
const outdir = await
|
|
345642
|
+
const outdir = await fs33.mkdtemp(path31.join(os10.tmpdir(), "cdk-bootstrap"));
|
|
345107
345643
|
try {
|
|
345108
345644
|
const builder = new import_cloud_assembly_api13.CloudAssemblyBuilder(outdir);
|
|
345109
345645
|
const templateFile = `${this.toolkitStackName}.template.json`;
|
|
345110
|
-
await
|
|
345646
|
+
await fs33.writeJson(path31.join(builder.outdir, templateFile), template, {
|
|
345111
345647
|
spaces: 2
|
|
345112
345648
|
});
|
|
345113
345649
|
builder.addArtifact(this.toolkitStackName, {
|
|
@@ -345136,7 +345672,7 @@ var init_deploy_bootstrap = __esm({
|
|
|
345136
345672
|
assertIsSuccessfulDeployStackResult(ret);
|
|
345137
345673
|
return ret;
|
|
345138
345674
|
} finally {
|
|
345139
|
-
await
|
|
345675
|
+
await fs33.rm(outdir, { recursive: true, force: true });
|
|
345140
345676
|
}
|
|
345141
345677
|
}
|
|
345142
345678
|
};
|
|
@@ -345241,11 +345777,11 @@ function splitCfnArray(xs) {
|
|
|
345241
345777
|
function intersection(xs, ys) {
|
|
345242
345778
|
return new Set(Array.from(xs).filter((x16) => ys.has(x16)));
|
|
345243
345779
|
}
|
|
345244
|
-
var
|
|
345780
|
+
var path32, Bootstrapper, USE_AWS_MANAGED_KEY, CREATE_NEW_KEY, CDK_BOOTSTRAP_PERMISSIONS_BOUNDARY;
|
|
345245
345781
|
var init_bootstrap_environment = __esm({
|
|
345246
345782
|
"../toolkit-lib/lib/api/bootstrap/bootstrap-environment.ts"() {
|
|
345247
345783
|
"use strict";
|
|
345248
|
-
|
|
345784
|
+
path32 = __toESM(require("path"));
|
|
345249
345785
|
init_deploy_bootstrap();
|
|
345250
345786
|
init_legacy_template();
|
|
345251
345787
|
init_toolkit_error();
|
|
@@ -345513,7 +346049,7 @@ var init_bootstrap_environment = __esm({
|
|
|
345513
346049
|
case "custom":
|
|
345514
346050
|
return loadStructuredFile(this.source.templateFile);
|
|
345515
346051
|
case "default":
|
|
345516
|
-
return loadStructuredFile(
|
|
346052
|
+
return loadStructuredFile(path32.join(bundledPackageRootDir(__dirname), "lib", "api", "bootstrap", "bootstrap-template.yaml"));
|
|
345517
346053
|
case "legacy":
|
|
345518
346054
|
return legacyBootstrapTemplate(legacyParams);
|
|
345519
346055
|
}
|
|
@@ -345537,529 +346073,6 @@ var init_bootstrap3 = __esm({
|
|
|
345537
346073
|
}
|
|
345538
346074
|
});
|
|
345539
346075
|
|
|
345540
|
-
// ../toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly.ts
|
|
345541
|
-
var import_dispose_polyfill3, BorrowedAssembly;
|
|
345542
|
-
var init_borrowed_assembly = __esm({
|
|
345543
|
-
"../toolkit-lib/lib/api/cloud-assembly/private/borrowed-assembly.ts"() {
|
|
345544
|
-
"use strict";
|
|
345545
|
-
import_dispose_polyfill3 = __toESM(require_dispose_polyfill());
|
|
345546
|
-
BorrowedAssembly = class {
|
|
345547
|
-
constructor(cloudAssembly) {
|
|
345548
|
-
this.cloudAssembly = cloudAssembly;
|
|
345549
|
-
}
|
|
345550
|
-
static {
|
|
345551
|
-
__name(this, "BorrowedAssembly");
|
|
345552
|
-
}
|
|
345553
|
-
async _unlock() {
|
|
345554
|
-
}
|
|
345555
|
-
async dispose() {
|
|
345556
|
-
}
|
|
345557
|
-
async [Symbol.asyncDispose]() {
|
|
345558
|
-
}
|
|
345559
|
-
};
|
|
345560
|
-
}
|
|
345561
|
-
});
|
|
345562
|
-
|
|
345563
|
-
// ../toolkit-lib/lib/api/cloud-assembly/cached-source.ts
|
|
345564
|
-
var import_dispose_polyfill4, CachedCloudAssembly;
|
|
345565
|
-
var init_cached_source = __esm({
|
|
345566
|
-
"../toolkit-lib/lib/api/cloud-assembly/cached-source.ts"() {
|
|
345567
|
-
"use strict";
|
|
345568
|
-
import_dispose_polyfill4 = __toESM(require_dispose_polyfill());
|
|
345569
|
-
init_borrowed_assembly();
|
|
345570
|
-
CachedCloudAssembly = class {
|
|
345571
|
-
static {
|
|
345572
|
-
__name(this, "CachedCloudAssembly");
|
|
345573
|
-
}
|
|
345574
|
-
asm;
|
|
345575
|
-
constructor(asm) {
|
|
345576
|
-
this.asm = asm;
|
|
345577
|
-
}
|
|
345578
|
-
get cloudAssembly() {
|
|
345579
|
-
return this.asm.cloudAssembly;
|
|
345580
|
-
}
|
|
345581
|
-
async produce() {
|
|
345582
|
-
return new BorrowedAssembly(this.asm.cloudAssembly);
|
|
345583
|
-
}
|
|
345584
|
-
_unlock() {
|
|
345585
|
-
return this.asm._unlock();
|
|
345586
|
-
}
|
|
345587
|
-
dispose() {
|
|
345588
|
-
return this.asm.dispose();
|
|
345589
|
-
}
|
|
345590
|
-
[Symbol.asyncDispose]() {
|
|
345591
|
-
return this.dispose();
|
|
345592
|
-
}
|
|
345593
|
-
};
|
|
345594
|
-
}
|
|
345595
|
-
});
|
|
345596
|
-
|
|
345597
|
-
// ../toolkit-lib/lib/api/cloud-assembly/context-store.ts
|
|
345598
|
-
function persistableContext(context) {
|
|
345599
|
-
return Object.fromEntries(Object.entries(context).filter(([_2, value]) => !isTransientValue2(value)));
|
|
345600
|
-
}
|
|
345601
|
-
function isTransientValue2(x16) {
|
|
345602
|
-
return x16 && typeof x16 === "object" && x16[TRANSIENT_CONTEXT_KEY];
|
|
345603
|
-
}
|
|
345604
|
-
async function settingsFromFile(filename) {
|
|
345605
|
-
try {
|
|
345606
|
-
const data2 = JSON.parse(await import_fs7.promises.readFile(filename, "utf-8"));
|
|
345607
|
-
return new Settings(data2);
|
|
345608
|
-
} catch (e16) {
|
|
345609
|
-
if (e16.code === "ENOENT") {
|
|
345610
|
-
return new Settings();
|
|
345611
|
-
}
|
|
345612
|
-
throw e16;
|
|
345613
|
-
}
|
|
345614
|
-
}
|
|
345615
|
-
var import_fs7, os10, path31, CdkAppMultiContext, FileContext, MemoryContext;
|
|
345616
|
-
var init_context_store = __esm({
|
|
345617
|
-
"../toolkit-lib/lib/api/cloud-assembly/context-store.ts"() {
|
|
345618
|
-
"use strict";
|
|
345619
|
-
import_fs7 = require("fs");
|
|
345620
|
-
os10 = __toESM(require("os"));
|
|
345621
|
-
path31 = __toESM(require("path"));
|
|
345622
|
-
init_toolkit_error();
|
|
345623
|
-
init_context();
|
|
345624
|
-
init_settings();
|
|
345625
|
-
CdkAppMultiContext = class {
|
|
345626
|
-
constructor(appDirectory, commandlineContext) {
|
|
345627
|
-
this.commandlineContext = commandlineContext;
|
|
345628
|
-
this.configContextFile = path31.join(appDirectory, "cdk.json");
|
|
345629
|
-
this.projectContextFile = path31.join(appDirectory, "cdk.context.json");
|
|
345630
|
-
this.userConfigFile = path31.join(os10.homedir() ?? "/tmp", ".cdk.json");
|
|
345631
|
-
}
|
|
345632
|
-
static {
|
|
345633
|
-
__name(this, "CdkAppMultiContext");
|
|
345634
|
-
}
|
|
345635
|
-
_context;
|
|
345636
|
-
configContextFile;
|
|
345637
|
-
projectContextFile;
|
|
345638
|
-
userConfigFile;
|
|
345639
|
-
async read() {
|
|
345640
|
-
const context = await this.asyncInitialize();
|
|
345641
|
-
return context.all;
|
|
345642
|
-
}
|
|
345643
|
-
async update(updates) {
|
|
345644
|
-
const context = await this.asyncInitialize();
|
|
345645
|
-
for (const [key, value] of Object.entries(updates)) {
|
|
345646
|
-
context.set(key, value);
|
|
345647
|
-
}
|
|
345648
|
-
await context.save(this.projectContextFile);
|
|
345649
|
-
}
|
|
345650
|
-
/**
|
|
345651
|
-
* Initialize the `Context` object
|
|
345652
|
-
*
|
|
345653
|
-
* This code all exists to reuse code that's already there, to minimize
|
|
345654
|
-
* the chances of the new code behaving subtly differently than the
|
|
345655
|
-
* old code.
|
|
345656
|
-
*
|
|
345657
|
-
* It might be most of this is unnecessary now...
|
|
345658
|
-
*/
|
|
345659
|
-
async asyncInitialize() {
|
|
345660
|
-
if (this._context) {
|
|
345661
|
-
return this._context;
|
|
345662
|
-
}
|
|
345663
|
-
const contextSources = [
|
|
345664
|
-
{ bag: new Settings(this.commandlineContext, true) },
|
|
345665
|
-
{
|
|
345666
|
-
fileName: this.configContextFile,
|
|
345667
|
-
bag: (await settingsFromFile(this.configContextFile)).subSettings(["context"]).makeReadOnly()
|
|
345668
|
-
},
|
|
345669
|
-
{
|
|
345670
|
-
fileName: this.projectContextFile,
|
|
345671
|
-
bag: await settingsFromFile(this.projectContextFile)
|
|
345672
|
-
},
|
|
345673
|
-
{
|
|
345674
|
-
fileName: this.userConfigFile,
|
|
345675
|
-
bag: (await settingsFromFile(this.userConfigFile)).subSettings(["context"]).makeReadOnly()
|
|
345676
|
-
}
|
|
345677
|
-
];
|
|
345678
|
-
this._context = new Context(...contextSources);
|
|
345679
|
-
return this._context;
|
|
345680
|
-
}
|
|
345681
|
-
};
|
|
345682
|
-
FileContext = class {
|
|
345683
|
-
constructor(fileName) {
|
|
345684
|
-
this.fileName = fileName;
|
|
345685
|
-
}
|
|
345686
|
-
static {
|
|
345687
|
-
__name(this, "FileContext");
|
|
345688
|
-
}
|
|
345689
|
-
_cache;
|
|
345690
|
-
async read() {
|
|
345691
|
-
if (!this._cache) {
|
|
345692
|
-
try {
|
|
345693
|
-
this._cache = JSON.parse(await import_fs7.promises.readFile(this.fileName, "utf-8"));
|
|
345694
|
-
} catch (e16) {
|
|
345695
|
-
if (e16.code === "ENOENT") {
|
|
345696
|
-
this._cache = {};
|
|
345697
|
-
} else {
|
|
345698
|
-
throw e16;
|
|
345699
|
-
}
|
|
345700
|
-
}
|
|
345701
|
-
}
|
|
345702
|
-
if (!this._cache || typeof this._cache !== "object") {
|
|
345703
|
-
throw new ToolkitError(`${this.fileName} must contain an object, got: ${JSON.stringify(this._cache)}`);
|
|
345704
|
-
}
|
|
345705
|
-
return this._cache;
|
|
345706
|
-
}
|
|
345707
|
-
async update(updates) {
|
|
345708
|
-
this._cache = {
|
|
345709
|
-
...await this.read(),
|
|
345710
|
-
...updates
|
|
345711
|
-
};
|
|
345712
|
-
const persistable = persistableContext(this._cache);
|
|
345713
|
-
await import_fs7.promises.writeFile(this.fileName, JSON.stringify(persistable, void 0, 2), "utf-8");
|
|
345714
|
-
}
|
|
345715
|
-
};
|
|
345716
|
-
MemoryContext = class {
|
|
345717
|
-
static {
|
|
345718
|
-
__name(this, "MemoryContext");
|
|
345719
|
-
}
|
|
345720
|
-
context = {};
|
|
345721
|
-
constructor(initialContext) {
|
|
345722
|
-
this.context = { ...initialContext };
|
|
345723
|
-
}
|
|
345724
|
-
read() {
|
|
345725
|
-
return Promise.resolve(this.context);
|
|
345726
|
-
}
|
|
345727
|
-
update(updates) {
|
|
345728
|
-
this.context = {
|
|
345729
|
-
...this.context,
|
|
345730
|
-
...updates
|
|
345731
|
-
};
|
|
345732
|
-
return Promise.resolve();
|
|
345733
|
-
}
|
|
345734
|
-
};
|
|
345735
|
-
__name(persistableContext, "persistableContext");
|
|
345736
|
-
__name(isTransientValue2, "isTransientValue");
|
|
345737
|
-
__name(settingsFromFile, "settingsFromFile");
|
|
345738
|
-
}
|
|
345739
|
-
});
|
|
345740
|
-
|
|
345741
|
-
// ../toolkit-lib/lib/api/cloud-assembly/private/readable-assembly.ts
|
|
345742
|
-
var import_node_fs, ReadableCloudAssembly;
|
|
345743
|
-
var init_readable_assembly = __esm({
|
|
345744
|
-
"../toolkit-lib/lib/api/cloud-assembly/private/readable-assembly.ts"() {
|
|
345745
|
-
"use strict";
|
|
345746
|
-
import_node_fs = require("node:fs");
|
|
345747
|
-
ReadableCloudAssembly = class {
|
|
345748
|
-
constructor(cloudAssembly, lock, options) {
|
|
345749
|
-
this.cloudAssembly = cloudAssembly;
|
|
345750
|
-
this.lock = lock;
|
|
345751
|
-
this.options = options;
|
|
345752
|
-
}
|
|
345753
|
-
static {
|
|
345754
|
-
__name(this, "ReadableCloudAssembly");
|
|
345755
|
-
}
|
|
345756
|
-
async _unlock() {
|
|
345757
|
-
return this.lock.release();
|
|
345758
|
-
}
|
|
345759
|
-
async dispose() {
|
|
345760
|
-
await this.lock.release();
|
|
345761
|
-
if (this.options?.deleteOnDispose) {
|
|
345762
|
-
await import_node_fs.promises.rm(this.cloudAssembly.directory, { recursive: true, force: true });
|
|
345763
|
-
}
|
|
345764
|
-
}
|
|
345765
|
-
[Symbol.asyncDispose]() {
|
|
345766
|
-
return this.dispose();
|
|
345767
|
-
}
|
|
345768
|
-
};
|
|
345769
|
-
}
|
|
345770
|
-
});
|
|
345771
|
-
|
|
345772
|
-
// ../toolkit-lib/lib/api/cloud-assembly/source-builder.ts
|
|
345773
|
-
var path32, import_util56, cxapi5, fs33, CloudAssemblySourceBuilder;
|
|
345774
|
-
var init_source_builder = __esm({
|
|
345775
|
-
"../toolkit-lib/lib/api/cloud-assembly/source-builder.ts"() {
|
|
345776
|
-
"use strict";
|
|
345777
|
-
path32 = __toESM(require("path"));
|
|
345778
|
-
import_util56 = require("util");
|
|
345779
|
-
cxapi5 = __toESM(require_lib3());
|
|
345780
|
-
fs33 = __toESM(require_lib6());
|
|
345781
|
-
init_context_store();
|
|
345782
|
-
init_rwlock();
|
|
345783
|
-
init_cached_source();
|
|
345784
|
-
init_context_aware_source();
|
|
345785
|
-
init_exec();
|
|
345786
|
-
init_prepare_source();
|
|
345787
|
-
init_readable_assembly();
|
|
345788
|
-
init_toolkit_error();
|
|
345789
|
-
init_util();
|
|
345790
|
-
init_private();
|
|
345791
|
-
init_helpers();
|
|
345792
|
-
CloudAssemblySourceBuilder = class {
|
|
345793
|
-
static {
|
|
345794
|
-
__name(this, "CloudAssemblySourceBuilder");
|
|
345795
|
-
}
|
|
345796
|
-
/**
|
|
345797
|
-
* Create a Cloud Assembly from a Cloud Assembly builder function.
|
|
345798
|
-
*
|
|
345799
|
-
* ## Outdir
|
|
345800
|
-
*
|
|
345801
|
-
* If no output directory is given, it will synthesize into a temporary system
|
|
345802
|
-
* directory. The temporary directory will be cleaned up, unless
|
|
345803
|
-
* `disposeOutdir: false`.
|
|
345804
|
-
*
|
|
345805
|
-
* A write lock will be acquired on the output directory for the duration of
|
|
345806
|
-
* the CDK app synthesis (which means that no two apps can synthesize at the
|
|
345807
|
-
* same time), and after synthesis a read lock will be acquired on the
|
|
345808
|
-
* directory. This means that while the CloudAssembly is being used, no CDK
|
|
345809
|
-
* app synthesis can take place into that directory.
|
|
345810
|
-
*
|
|
345811
|
-
* ## Context
|
|
345812
|
-
*
|
|
345813
|
-
* If no `contextStore` is given, a `MemoryContext` will be used. This means
|
|
345814
|
-
* no provider lookups will be persisted anywhere by default. Use a different
|
|
345815
|
-
* type of context store if you want persistence between synth operations.
|
|
345816
|
-
*
|
|
345817
|
-
* @param builder - the builder function
|
|
345818
|
-
* @param props - additional configuration properties
|
|
345819
|
-
* @returns the CloudAssembly source
|
|
345820
|
-
*/
|
|
345821
|
-
async fromAssemblyBuilder(builder, props = {}) {
|
|
345822
|
-
const services = await this.sourceBuilderServices();
|
|
345823
|
-
const contextStore = props.contextStore ?? new MemoryContext();
|
|
345824
|
-
const contextAssemblyProps = {
|
|
345825
|
-
services,
|
|
345826
|
-
contextStore,
|
|
345827
|
-
lookups: props.lookups
|
|
345828
|
-
};
|
|
345829
|
-
const outdir = props.outdir ? path32.resolve(props.outdir) : void 0;
|
|
345830
|
-
return new ContextAwareCloudAssemblySource(
|
|
345831
|
-
{
|
|
345832
|
-
produce: /* @__PURE__ */ __name(async () => {
|
|
345833
|
-
var _stack = [];
|
|
345834
|
-
try {
|
|
345835
|
-
const execution = __using(_stack, await ExecutionEnvironment.create(services, {
|
|
345836
|
-
outdir,
|
|
345837
|
-
resolveDefaultAppEnv: props.resolveDefaultEnvironment ?? true
|
|
345838
|
-
}), true);
|
|
345839
|
-
const synthParams = parametersFromSynthOptions(props.synthOptions);
|
|
345840
|
-
const fullContext = {
|
|
345841
|
-
...await contextStore.read(),
|
|
345842
|
-
...synthParams.context
|
|
345843
|
-
};
|
|
345844
|
-
await services.ioHelper.defaults.debug((0, import_util56.format)("context:", fullContext));
|
|
345845
|
-
const env = noUndefined({
|
|
345846
|
-
// Versioning, outdir, default account and region
|
|
345847
|
-
...await execution.defaultEnvVars(),
|
|
345848
|
-
// Environment variables derived from settings
|
|
345849
|
-
...synthParams.env
|
|
345850
|
-
});
|
|
345851
|
-
const cleanupContextTemp = writeContextToEnv(env, fullContext, "env-is-complete");
|
|
345852
|
-
const _cleanupEnv = __using(_stack, props.clobberEnv ?? true ? temporarilyWriteEnv(env) : void 0);
|
|
345853
|
-
let assembly;
|
|
345854
|
-
try {
|
|
345855
|
-
assembly = await builder({
|
|
345856
|
-
outdir: execution.outdir,
|
|
345857
|
-
context: fullContext,
|
|
345858
|
-
env
|
|
345859
|
-
});
|
|
345860
|
-
} catch (error4) {
|
|
345861
|
-
if (ToolkitError.isToolkitError(error4)) {
|
|
345862
|
-
throw error4;
|
|
345863
|
-
}
|
|
345864
|
-
throw AssemblyError.withCause("Assembly builder failed", error4);
|
|
345865
|
-
} finally {
|
|
345866
|
-
await cleanupContextTemp();
|
|
345867
|
-
}
|
|
345868
|
-
const asm = cxapi5.CloudAssembly.isCloudAssembly(assembly) ? assembly : await assemblyFromDirectory(assembly.directory, services.ioHelper, props.loadAssemblyOptions);
|
|
345869
|
-
const success2 = await execution.markSuccessful();
|
|
345870
|
-
const deleteOnDispose = props.disposeOutdir ?? execution.shouldDisposeOutDir;
|
|
345871
|
-
return new ReadableCloudAssembly(asm, success2.readLock, { deleteOnDispose });
|
|
345872
|
-
} catch (_2) {
|
|
345873
|
-
var _error = _2, _hasError = true;
|
|
345874
|
-
} finally {
|
|
345875
|
-
var _promise = __callDispose(_stack, _error, _hasError);
|
|
345876
|
-
_promise && await _promise;
|
|
345877
|
-
}
|
|
345878
|
-
}, "produce")
|
|
345879
|
-
},
|
|
345880
|
-
contextAssemblyProps
|
|
345881
|
-
);
|
|
345882
|
-
}
|
|
345883
|
-
/**
|
|
345884
|
-
* Creates a Cloud Assembly from an existing assembly directory.
|
|
345885
|
-
*
|
|
345886
|
-
* A read lock will be acquired for the directory. This means that while
|
|
345887
|
-
* the CloudAssembly is being used, no CDK app synthesis can take place into
|
|
345888
|
-
* that directory.
|
|
345889
|
-
*
|
|
345890
|
-
* @param directory - directory the directory of a already produced Cloud Assembly.
|
|
345891
|
-
* @returns the CloudAssembly source
|
|
345892
|
-
*/
|
|
345893
|
-
async fromAssemblyDirectory(directory, props = {}) {
|
|
345894
|
-
const services = await this.sourceBuilderServices();
|
|
345895
|
-
return {
|
|
345896
|
-
async produce() {
|
|
345897
|
-
await services.ioHelper.notify(IO.CDK_ASSEMBLY_I0150.msg("--app points to a cloud assembly, so we bypass synth"));
|
|
345898
|
-
const readLock = await new RWLock(directory).acquireRead();
|
|
345899
|
-
try {
|
|
345900
|
-
const asm = await assemblyFromDirectory(directory, services.ioHelper, props.loadAssemblyOptions);
|
|
345901
|
-
const assembly = new ReadableCloudAssembly(asm, readLock, { deleteOnDispose: false });
|
|
345902
|
-
if (assembly.cloudAssembly.manifest.missing && assembly.cloudAssembly.manifest.missing.length > 0) {
|
|
345903
|
-
if (props.failOnMissingContext ?? true) {
|
|
345904
|
-
const missingKeysSet = missingContextKeys(assembly.cloudAssembly.manifest.missing);
|
|
345905
|
-
const missingKeys = Array.from(missingKeysSet);
|
|
345906
|
-
throw AssemblyError.withCause(
|
|
345907
|
-
`Assembly contains missing context. Make sure all necessary context is already in 'cdk.context.json' by running 'cdk synth' on a machine with sufficient AWS credentials and committing the result. Missing context keys: '${missingKeys.join(", ")}'`,
|
|
345908
|
-
"Error producing assembly"
|
|
345909
|
-
);
|
|
345910
|
-
}
|
|
345911
|
-
}
|
|
345912
|
-
return new CachedCloudAssembly(assembly);
|
|
345913
|
-
} catch (e16) {
|
|
345914
|
-
await readLock.release();
|
|
345915
|
-
throw e16;
|
|
345916
|
-
}
|
|
345917
|
-
}
|
|
345918
|
-
};
|
|
345919
|
-
}
|
|
345920
|
-
/**
|
|
345921
|
-
* Use an AWS CDK app exectuable as source.
|
|
345922
|
-
*
|
|
345923
|
-
* `app` is a command line that will be executed to produce a Cloud Assembly.
|
|
345924
|
-
* The command will be executed in a shell, so it must come from a trusted source.
|
|
345925
|
-
*
|
|
345926
|
-
* The subprocess will execute in `workingDirectory`, which defaults to
|
|
345927
|
-
* the current process' working directory if not given.
|
|
345928
|
-
*
|
|
345929
|
-
* ## Outdir
|
|
345930
|
-
*
|
|
345931
|
-
* If an output directory is supplied, relative paths are evaluated with
|
|
345932
|
-
* respect to the current process' working directory. If an output directory
|
|
345933
|
-
* is not supplied, the default is a `cdk.out` directory underneath
|
|
345934
|
-
* `workingDirectory`. The output directory will not be cleaned up unless
|
|
345935
|
-
* `disposeOutdir: true`.
|
|
345936
|
-
*
|
|
345937
|
-
* A write lock will be acquired on the output directory for the duration of
|
|
345938
|
-
* the CDK app synthesis (which means that no two apps can synthesize at the
|
|
345939
|
-
* same time), and after synthesis a read lock will be acquired on the
|
|
345940
|
-
* directory. This means that while the CloudAssembly is being used, no CDK
|
|
345941
|
-
* app synthesis can take place into that directory.
|
|
345942
|
-
*
|
|
345943
|
-
* ## Context
|
|
345944
|
-
*
|
|
345945
|
-
* If no `contextStore` is given, a `CdkAppMultiContext` will be used, initialized
|
|
345946
|
-
* to the app's `workingDirectory`. This means that context will be loaded from
|
|
345947
|
-
* all the CDK's default context sources, and updates will be written to
|
|
345948
|
-
* `cdk.context.json`.
|
|
345949
|
-
*
|
|
345950
|
-
* @param props - additional configuration properties
|
|
345951
|
-
* @returns the CloudAssembly source
|
|
345952
|
-
*/
|
|
345953
|
-
async fromCdkApp(app, props = {}) {
|
|
345954
|
-
const services = await this.sourceBuilderServices();
|
|
345955
|
-
const workingDirectory = props.workingDirectory ?? process.cwd();
|
|
345956
|
-
const outdir = props.outdir ? path32.resolve(props.outdir) : path32.resolve(workingDirectory, "cdk.out");
|
|
345957
|
-
const contextStore = props.contextStore ?? new CdkAppMultiContext(workingDirectory);
|
|
345958
|
-
const contextAssemblyProps = {
|
|
345959
|
-
services,
|
|
345960
|
-
contextStore,
|
|
345961
|
-
lookups: props.lookups
|
|
345962
|
-
};
|
|
345963
|
-
return new ContextAwareCloudAssemblySource(
|
|
345964
|
-
{
|
|
345965
|
-
produce: /* @__PURE__ */ __name(async () => {
|
|
345966
|
-
var _stack = [];
|
|
345967
|
-
try {
|
|
345968
|
-
try {
|
|
345969
|
-
fs33.mkdirpSync(outdir);
|
|
345970
|
-
} catch (e16) {
|
|
345971
|
-
throw new ToolkitError(`Could not create output directory at '${outdir}' (${e16.message}).`);
|
|
345972
|
-
}
|
|
345973
|
-
const execution = __using(_stack, await ExecutionEnvironment.create(services, {
|
|
345974
|
-
outdir,
|
|
345975
|
-
resolveDefaultAppEnv: props.resolveDefaultEnvironment ?? true
|
|
345976
|
-
}), true);
|
|
345977
|
-
const commandLine = await execution.guessExecutable(app);
|
|
345978
|
-
const synthParams = parametersFromSynthOptions(props.synthOptions);
|
|
345979
|
-
const fullContext = {
|
|
345980
|
-
...await contextStore.read(),
|
|
345981
|
-
...synthParams.context
|
|
345982
|
-
};
|
|
345983
|
-
await services.ioHelper.defaults.debug((0, import_util56.format)("context:", fullContext));
|
|
345984
|
-
const env = noUndefined({
|
|
345985
|
-
// Need to start with full env of `writeContextToEnv` will not be able to do the size
|
|
345986
|
-
// calculation correctly.
|
|
345987
|
-
...process.env,
|
|
345988
|
-
// User gave us something
|
|
345989
|
-
...props.env,
|
|
345990
|
-
// Versioning, outdir, default account and region
|
|
345991
|
-
...await execution.defaultEnvVars(),
|
|
345992
|
-
// Environment variables derived from settings
|
|
345993
|
-
...synthParams.env
|
|
345994
|
-
});
|
|
345995
|
-
const cleanupTemp = writeContextToEnv(env, fullContext, "env-is-complete");
|
|
345996
|
-
try {
|
|
345997
|
-
await execInChildProcess(commandLine, {
|
|
345998
|
-
eventPublisher: /* @__PURE__ */ __name(async (type, line) => {
|
|
345999
|
-
switch (type) {
|
|
346000
|
-
case "data_stdout":
|
|
346001
|
-
await services.ioHelper.notify(IO.CDK_ASSEMBLY_I1001.msg(line));
|
|
346002
|
-
break;
|
|
346003
|
-
case "data_stderr":
|
|
346004
|
-
await services.ioHelper.notify(IO.CDK_ASSEMBLY_E1002.msg(line));
|
|
346005
|
-
break;
|
|
346006
|
-
}
|
|
346007
|
-
}, "eventPublisher"),
|
|
346008
|
-
env,
|
|
346009
|
-
cwd: workingDirectory
|
|
346010
|
-
});
|
|
346011
|
-
} finally {
|
|
346012
|
-
await cleanupTemp();
|
|
346013
|
-
}
|
|
346014
|
-
const asm = await assemblyFromDirectory(outdir, services.ioHelper, props.loadAssemblyOptions);
|
|
346015
|
-
const success2 = await execution.markSuccessful();
|
|
346016
|
-
const deleteOnDispose = props.disposeOutdir ?? execution.shouldDisposeOutDir;
|
|
346017
|
-
return new ReadableCloudAssembly(asm, success2.readLock, { deleteOnDispose });
|
|
346018
|
-
} catch (_2) {
|
|
346019
|
-
var _error = _2, _hasError = true;
|
|
346020
|
-
} finally {
|
|
346021
|
-
var _promise = __callDispose(_stack, _error, _hasError);
|
|
346022
|
-
_promise && await _promise;
|
|
346023
|
-
}
|
|
346024
|
-
}, "produce")
|
|
346025
|
-
},
|
|
346026
|
-
contextAssemblyProps
|
|
346027
|
-
);
|
|
346028
|
-
}
|
|
346029
|
-
};
|
|
346030
|
-
}
|
|
346031
|
-
});
|
|
346032
|
-
|
|
346033
|
-
// ../toolkit-lib/lib/api/cloud-assembly/types.ts
|
|
346034
|
-
var init_types7 = __esm({
|
|
346035
|
-
"../toolkit-lib/lib/api/cloud-assembly/types.ts"() {
|
|
346036
|
-
"use strict";
|
|
346037
|
-
}
|
|
346038
|
-
});
|
|
346039
|
-
|
|
346040
|
-
// ../toolkit-lib/lib/api/cloud-assembly/index.ts
|
|
346041
|
-
var cloud_assembly_exports3 = {};
|
|
346042
|
-
__export(cloud_assembly_exports3, {
|
|
346043
|
-
CachedCloudAssembly: () => CachedCloudAssembly,
|
|
346044
|
-
CdkAppMultiContext: () => CdkAppMultiContext,
|
|
346045
|
-
CloudAssemblySourceBuilder: () => CloudAssemblySourceBuilder,
|
|
346046
|
-
ExpandStackSelection: () => ExpandStackSelection,
|
|
346047
|
-
FileContext: () => FileContext,
|
|
346048
|
-
MemoryContext: () => MemoryContext,
|
|
346049
|
-
StackSelectionStrategy: () => StackSelectionStrategy,
|
|
346050
|
-
persistableContext: () => persistableContext
|
|
346051
|
-
});
|
|
346052
|
-
var init_cloud_assembly3 = __esm({
|
|
346053
|
-
"../toolkit-lib/lib/api/cloud-assembly/index.ts"() {
|
|
346054
|
-
"use strict";
|
|
346055
|
-
init_stack_selector();
|
|
346056
|
-
init_cached_source();
|
|
346057
|
-
init_source_builder();
|
|
346058
|
-
init_types7();
|
|
346059
|
-
init_context_store();
|
|
346060
|
-
}
|
|
346061
|
-
});
|
|
346062
|
-
|
|
346063
346076
|
// ../toolkit-lib/lib/api/diff/diff-formatter.ts
|
|
346064
346077
|
function buildLogicalToPathMap(stack) {
|
|
346065
346078
|
const map2 = {};
|
|
@@ -348861,6 +348874,10 @@ var init_toolkit_lib = __esm({
|
|
|
348861
348874
|
static {
|
|
348862
348875
|
__name(this, "ToolkitLibRunnerEngine");
|
|
348863
348876
|
}
|
|
348877
|
+
toolkit;
|
|
348878
|
+
options;
|
|
348879
|
+
showOutput;
|
|
348880
|
+
ioHost;
|
|
348864
348881
|
constructor(options) {
|
|
348865
348882
|
this.options = options;
|
|
348866
348883
|
this.showOutput = options.showOutput ?? false;
|
|
@@ -348882,47 +348899,42 @@ var init_toolkit_lib = __esm({
|
|
|
348882
348899
|
// Logging
|
|
348883
348900
|
// - options.color
|
|
348884
348901
|
// SDK
|
|
348885
|
-
// - options.profile
|
|
348886
348902
|
// - options.proxy
|
|
348887
348903
|
// - options.caBundlePath
|
|
348888
348904
|
});
|
|
348889
348905
|
}
|
|
348890
348906
|
/**
|
|
348891
|
-
* Synthesizes the CDK app
|
|
348907
|
+
* Synthesizes the CDK app
|
|
348892
348908
|
*/
|
|
348893
348909
|
async synth(options) {
|
|
348894
|
-
const cx = await this.cx(
|
|
348895
|
-
|
|
348896
|
-
|
|
348897
|
-
|
|
348898
|
-
});
|
|
348899
|
-
await this.validateRegion(lock);
|
|
348900
|
-
await lock.dispose();
|
|
348901
|
-
}
|
|
348902
|
-
/**
|
|
348903
|
-
* Synthesizes the CDK app quickly, by bypassing the Toolkit and just invoking the app command
|
|
348904
|
-
*/
|
|
348905
|
-
async synthFast(options) {
|
|
348906
|
-
const cx = await this.toolkit.fromCdkApp(options.execCmd.join(" "), {
|
|
348907
|
-
workingDirectory: this.options.workingDirectory,
|
|
348908
|
-
outdir: options.output ? path34.join(this.options.workingDirectory, options.output) : void 0,
|
|
348909
|
-
contextStore: new import_toolkit_lib.MemoryContext(options.context),
|
|
348910
|
+
const cx = await this.cx({
|
|
348911
|
+
app: options.app,
|
|
348912
|
+
output: options.output,
|
|
348913
|
+
context: options.context,
|
|
348910
348914
|
lookups: false,
|
|
348911
348915
|
resolveDefaultEnvironment: false,
|
|
348912
|
-
env:
|
|
348913
|
-
|
|
348914
|
-
|
|
348915
|
-
|
|
348916
|
-
synthOptions: {
|
|
348917
|
-
versionReporting: false,
|
|
348918
|
-
pathMetadata: false,
|
|
348919
|
-
assetMetadata: false
|
|
348920
|
-
}
|
|
348916
|
+
env: options.env,
|
|
348917
|
+
versionReporting: false,
|
|
348918
|
+
pathMetadata: false,
|
|
348919
|
+
assetMetadata: false
|
|
348921
348920
|
});
|
|
348922
348921
|
try {
|
|
348923
|
-
|
|
348924
|
-
|
|
348925
|
-
|
|
348922
|
+
var _stack = [];
|
|
348923
|
+
try {
|
|
348924
|
+
const lock = __using(_stack, await this.toolkit.synth(cx, {
|
|
348925
|
+
validateStacks: false,
|
|
348926
|
+
stacks: {
|
|
348927
|
+
strategy: import_toolkit_lib.StackSelectionStrategy.ALL_STACKS,
|
|
348928
|
+
failOnEmpty: false
|
|
348929
|
+
}
|
|
348930
|
+
}), true);
|
|
348931
|
+
await this.validateRegion(lock);
|
|
348932
|
+
} catch (_2) {
|
|
348933
|
+
var _error = _2, _hasError = true;
|
|
348934
|
+
} finally {
|
|
348935
|
+
var _promise = __callDispose(_stack, _error, _hasError);
|
|
348936
|
+
_promise && await _promise;
|
|
348937
|
+
}
|
|
348926
348938
|
} catch (e16) {
|
|
348927
348939
|
if (e16.message.includes("Missing context keys")) {
|
|
348928
348940
|
return;
|
|
@@ -348944,15 +348956,14 @@ var init_toolkit_lib = __esm({
|
|
|
348944
348956
|
* Deploys the CDK app
|
|
348945
348957
|
*/
|
|
348946
348958
|
async deploy(options) {
|
|
348947
|
-
if (options.watch) {
|
|
348948
|
-
return this.watch(options);
|
|
348949
|
-
}
|
|
348950
348959
|
const cx = await this.cx(options);
|
|
348951
348960
|
await this.toolkit.deploy(cx, {
|
|
348952
348961
|
roleArn: options.roleArn,
|
|
348953
348962
|
traceLogs: options.traceLogs,
|
|
348954
348963
|
stacks: this.stackSelector(options),
|
|
348955
|
-
deploymentMethod:
|
|
348964
|
+
deploymentMethod: {
|
|
348965
|
+
method: "change-set"
|
|
348966
|
+
},
|
|
348956
348967
|
outputsFile: options.outputsFile ? path34.join(this.options.workingDirectory, options.outputsFile) : void 0
|
|
348957
348968
|
});
|
|
348958
348969
|
}
|
|
@@ -348966,7 +348977,7 @@ var init_toolkit_lib = __esm({
|
|
|
348966
348977
|
roleArn: options.roleArn,
|
|
348967
348978
|
traceLogs: options.traceLogs,
|
|
348968
348979
|
stacks: this.stackSelector(options),
|
|
348969
|
-
deploymentMethod:
|
|
348980
|
+
deploymentMethod: options.deploymentMethod
|
|
348970
348981
|
});
|
|
348971
348982
|
await watcher.waitForEnd();
|
|
348972
348983
|
} catch (e16) {
|
|
@@ -349012,7 +349023,11 @@ var init_toolkit_lib = __esm({
|
|
|
349012
349023
|
outdir,
|
|
349013
349024
|
lookups: options.lookups,
|
|
349014
349025
|
contextStore: new import_toolkit_lib.MemoryContext(options.context),
|
|
349015
|
-
|
|
349026
|
+
resolveDefaultEnvironment: options.resolveDefaultEnvironment,
|
|
349027
|
+
env: {
|
|
349028
|
+
...this.options.env,
|
|
349029
|
+
...options.env
|
|
349030
|
+
},
|
|
349016
349031
|
synthOptions: {
|
|
349017
349032
|
debug: options.debug,
|
|
349018
349033
|
versionReporting: options.versionReporting ?? false,
|
|
@@ -349032,20 +349047,6 @@ var init_toolkit_lib = __esm({
|
|
|
349032
349047
|
expand: options.exclusively ? import_toolkit_lib.ExpandStackSelection.NONE : import_toolkit_lib.ExpandStackSelection.UPSTREAM
|
|
349033
349048
|
};
|
|
349034
349049
|
}
|
|
349035
|
-
/**
|
|
349036
|
-
* Creates a DeploymentMethod from the provided options.
|
|
349037
|
-
*/
|
|
349038
|
-
deploymentMethod(options) {
|
|
349039
|
-
if (options.hotswap && options.hotswap !== "full-deployment") {
|
|
349040
|
-
return {
|
|
349041
|
-
method: "hotswap",
|
|
349042
|
-
fallback: options.hotswap === "fall-back" ? { method: "change-set" } : void 0
|
|
349043
|
-
};
|
|
349044
|
-
}
|
|
349045
|
-
return {
|
|
349046
|
-
method: options.deploymentMethod ?? "change-set"
|
|
349047
|
-
};
|
|
349048
|
-
}
|
|
349049
349050
|
/**
|
|
349050
349051
|
* Check that the regions for the stacks in the CloudAssembly match the regions requested on the engine
|
|
349051
349052
|
*
|
|
@@ -349070,6 +349071,9 @@ var init_toolkit_lib = __esm({
|
|
|
349070
349071
|
* This catches that misconfiguration.
|
|
349071
349072
|
*/
|
|
349072
349073
|
async validateRegion(asm) {
|
|
349074
|
+
if (this.options.region === import_cloud_assembly_api14.UNKNOWN_REGION) {
|
|
349075
|
+
return;
|
|
349076
|
+
}
|
|
349073
349077
|
for (const stack of asm.cloudAssembly.stacksRecursively) {
|
|
349074
349078
|
if (stack.environment.region !== this.options.region && stack.environment.region !== import_cloud_assembly_api14.UNKNOWN_REGION) {
|
|
349075
349079
|
this.ioHost.notify({
|
|
@@ -349194,9 +349198,7 @@ var init_cloud_assembly4 = __esm({
|
|
|
349194
349198
|
static {
|
|
349195
349199
|
__name(this, "AssemblyManifestReader");
|
|
349196
349200
|
}
|
|
349197
|
-
static
|
|
349198
|
-
this.DEFAULT_FILENAME = "manifest.json";
|
|
349199
|
-
}
|
|
349201
|
+
static DEFAULT_FILENAME = "manifest.json";
|
|
349200
349202
|
/**
|
|
349201
349203
|
* Reads a Cloud Assembly manifest from a file
|
|
349202
349204
|
*/
|
|
@@ -349225,6 +349227,10 @@ var init_cloud_assembly4 = __esm({
|
|
|
349225
349227
|
}
|
|
349226
349228
|
return _AssemblyManifestReader.fromFile(filePath);
|
|
349227
349229
|
}
|
|
349230
|
+
/**
|
|
349231
|
+
* The directory where the manifest was found
|
|
349232
|
+
*/
|
|
349233
|
+
directory;
|
|
349228
349234
|
/**
|
|
349229
349235
|
* Get the stacks from the manifest
|
|
349230
349236
|
* returns a map of artifactId to CloudFormation template
|
|
@@ -349432,15 +349438,68 @@ var init_runner_base = __esm({
|
|
|
349432
349438
|
init_integ_manifest();
|
|
349433
349439
|
DESTRUCTIVE_CHANGES = "!!DESTRUCTIVE_CHANGES:";
|
|
349434
349440
|
IntegRunner = class {
|
|
349441
|
+
static {
|
|
349442
|
+
__name(this, "IntegRunner");
|
|
349443
|
+
}
|
|
349444
|
+
/**
|
|
349445
|
+
* The directory where the snapshot will be stored
|
|
349446
|
+
*/
|
|
349447
|
+
snapshotDir;
|
|
349448
|
+
/**
|
|
349449
|
+
* An instance of the CDK CLI
|
|
349450
|
+
*/
|
|
349451
|
+
cdk;
|
|
349452
|
+
/**
|
|
349453
|
+
* Pretty name of the test
|
|
349454
|
+
*/
|
|
349455
|
+
testName;
|
|
349456
|
+
/**
|
|
349457
|
+
* The value used in the '--app' CLI parameter
|
|
349458
|
+
*
|
|
349459
|
+
* Path to the integ test source file, relative to `this.directory`.
|
|
349460
|
+
*/
|
|
349461
|
+
cdkApp;
|
|
349462
|
+
/**
|
|
349463
|
+
* The path where the `cdk.context.json` file
|
|
349464
|
+
* will be created
|
|
349465
|
+
*/
|
|
349466
|
+
cdkContextPath;
|
|
349467
|
+
/**
|
|
349468
|
+
* The working directory that the integration tests will be
|
|
349469
|
+
* executed from
|
|
349470
|
+
*/
|
|
349471
|
+
directory;
|
|
349472
|
+
/**
|
|
349473
|
+
* The test to run
|
|
349474
|
+
*/
|
|
349475
|
+
test;
|
|
349476
|
+
/**
|
|
349477
|
+
* Default options to pass to the CDK CLI
|
|
349478
|
+
*/
|
|
349479
|
+
defaultArgs = {
|
|
349480
|
+
pathMetadata: false,
|
|
349481
|
+
assetMetadata: false,
|
|
349482
|
+
versionReporting: false
|
|
349483
|
+
};
|
|
349484
|
+
/**
|
|
349485
|
+
* The directory where the CDK will be synthed to
|
|
349486
|
+
*
|
|
349487
|
+
* Relative to cwd.
|
|
349488
|
+
*/
|
|
349489
|
+
cdkOutDir;
|
|
349490
|
+
/**
|
|
349491
|
+
* The profile to use for the CDK CLI calls
|
|
349492
|
+
*/
|
|
349493
|
+
profile;
|
|
349494
|
+
/**
|
|
349495
|
+
* Show output from the integ test run.
|
|
349496
|
+
*/
|
|
349497
|
+
showOutput;
|
|
349498
|
+
_destructiveChanges;
|
|
349499
|
+
legacyContext;
|
|
349500
|
+
_expectedTestSuite;
|
|
349501
|
+
_actualTestSuite;
|
|
349435
349502
|
constructor(options) {
|
|
349436
|
-
/**
|
|
349437
|
-
* Default options to pass to the CDK CLI
|
|
349438
|
-
*/
|
|
349439
|
-
this.defaultArgs = {
|
|
349440
|
-
pathMetadata: false,
|
|
349441
|
-
assetMetadata: false,
|
|
349442
|
-
versionReporting: false
|
|
349443
|
-
};
|
|
349444
349503
|
this.test = options.test;
|
|
349445
349504
|
this.directory = this.test.directory;
|
|
349446
349505
|
this.testName = this.test.testName;
|
|
@@ -349453,9 +349512,6 @@ var init_runner_base = __esm({
|
|
|
349453
349512
|
const testRunCommand = this.test.appCommand;
|
|
349454
349513
|
this.cdkApp = testRunCommand.replace("{filePath}", path36.relative(this.directory, this.test.fileName));
|
|
349455
349514
|
}
|
|
349456
|
-
static {
|
|
349457
|
-
__name(this, "IntegRunner");
|
|
349458
|
-
}
|
|
349459
349515
|
/**
|
|
349460
349516
|
* Return the list of expected (i.e. existing) test cases for this integration test
|
|
349461
349517
|
*/
|
|
@@ -349474,8 +349530,8 @@ var init_runner_base = __esm({
|
|
|
349474
349530
|
* This will synth and then load the integration test manifest
|
|
349475
349531
|
*/
|
|
349476
349532
|
async generateActualSnapshot() {
|
|
349477
|
-
await this.cdk.
|
|
349478
|
-
|
|
349533
|
+
await this.cdk.synth({
|
|
349534
|
+
app: this.cdkApp,
|
|
349479
349535
|
// we don't know the "actual" context yet (this method is what generates it) so just
|
|
349480
349536
|
// use the "expected" context. This is only run in order to read the manifest
|
|
349481
349537
|
context: this.getContext((await this.expectedTestSuite())?.synthContext),
|
|
@@ -349630,8 +349686,8 @@ var init_runner_base = __esm({
|
|
|
349630
349686
|
fs37.removeSync(this.snapshotDir);
|
|
349631
349687
|
}
|
|
349632
349688
|
const actualTestSuite = await this.actualTestSuite();
|
|
349633
|
-
await this.cdk.
|
|
349634
|
-
|
|
349689
|
+
await this.cdk.synth({
|
|
349690
|
+
app: this.cdkApp,
|
|
349635
349691
|
context: this.getContext(actualTestSuite.enableLookups ? DEFAULT_SYNTH_OPTIONS.context : {}),
|
|
349636
349692
|
env: DEFAULT_SYNTH_OPTIONS.env,
|
|
349637
349693
|
output: path36.relative(this.directory, this.snapshotDir)
|
|
@@ -349724,13 +349780,6 @@ var init_runner_base = __esm({
|
|
|
349724
349780
|
}
|
|
349725
349781
|
});
|
|
349726
349782
|
|
|
349727
|
-
// lib/engines/cdk-interface.ts
|
|
349728
|
-
var init_cdk_interface = __esm({
|
|
349729
|
-
"lib/engines/cdk-interface.ts"() {
|
|
349730
|
-
"use strict";
|
|
349731
|
-
}
|
|
349732
|
-
});
|
|
349733
|
-
|
|
349734
349783
|
// lib/workers/common.ts
|
|
349735
349784
|
function formatAssertionResults(results) {
|
|
349736
349785
|
return Object.entries(results).map(([id, result2]) => (0, import_util64.format)("%s%s", id, result2.status === "success" ? ` - ${result2.status}` : `
|
|
@@ -349772,7 +349821,6 @@ var init_integ_test_runner = __esm({
|
|
|
349772
349821
|
fs38 = __toESM(require_lib5());
|
|
349773
349822
|
workerpool = __toESM(require_src());
|
|
349774
349823
|
init_runner_base();
|
|
349775
|
-
init_cdk_interface();
|
|
349776
349824
|
init_logger();
|
|
349777
349825
|
init_utils();
|
|
349778
349826
|
init_common8();
|
|
@@ -349869,15 +349917,17 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
349869
349917
|
await this.watch(
|
|
349870
349918
|
{
|
|
349871
349919
|
...this.defaultArgs,
|
|
349872
|
-
|
|
349873
|
-
|
|
349874
|
-
|
|
349920
|
+
deploymentMethod: {
|
|
349921
|
+
method: "hotswap",
|
|
349922
|
+
fallback: {
|
|
349923
|
+
method: "change-set"
|
|
349924
|
+
}
|
|
349925
|
+
},
|
|
349875
349926
|
profile: this.profile,
|
|
349876
349927
|
requireApproval: import_cloud_assembly_schema9.RequireApproval.NEVER,
|
|
349877
349928
|
traceLogs: enableForVerbosityLevel(2) ?? false,
|
|
349878
349929
|
verbose: enableForVerbosityLevel(3),
|
|
349879
|
-
debug: enableForVerbosityLevel(4)
|
|
349880
|
-
watch: true
|
|
349930
|
+
debug: enableForVerbosityLevel(4)
|
|
349881
349931
|
},
|
|
349882
349932
|
options.testCaseName,
|
|
349883
349933
|
options.verbosity ?? 0
|
|
@@ -349981,7 +350031,7 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
349981
350031
|
);
|
|
349982
350032
|
}
|
|
349983
350033
|
}
|
|
349984
|
-
async watch(
|
|
350034
|
+
async watch(options, testCaseName, verbosity) {
|
|
349985
350035
|
const actualTestSuite = await this.actualTestSuite();
|
|
349986
350036
|
const actualTestCase = actualTestSuite.testSuite[testCaseName];
|
|
349987
350037
|
if (actualTestCase.hooks?.preDeploy) {
|
|
@@ -349991,8 +350041,8 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
349991
350041
|
});
|
|
349992
350042
|
});
|
|
349993
350043
|
}
|
|
349994
|
-
const
|
|
349995
|
-
...
|
|
350044
|
+
const watchArgs = {
|
|
350045
|
+
...options,
|
|
349996
350046
|
lookups: actualTestSuite.enableLookups,
|
|
349997
350047
|
stacks: [
|
|
349998
350048
|
...actualTestCase.stacks,
|
|
@@ -350013,8 +350063,8 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
350013
350063
|
...process.env.AWS_REGION ? [`AWS_REGION=${process.env.AWS_REGION}`] : [],
|
|
350014
350064
|
"cdk destroy",
|
|
350015
350065
|
`-a '${this.cdkApp}'`,
|
|
350016
|
-
|
|
350017
|
-
`--profile ${
|
|
350066
|
+
watchArgs.stacks.join(" "),
|
|
350067
|
+
`--profile ${watchArgs.profile}`
|
|
350018
350068
|
].join(" ")}`
|
|
350019
350069
|
]
|
|
350020
350070
|
};
|
|
@@ -350028,9 +350078,9 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
350028
350078
|
`-a '${this.cdkApp}'`,
|
|
350029
350079
|
`-o '${this.cdkOutDir}'`,
|
|
350030
350080
|
...Object.entries(this.getContext()).flatMap(([k16, v17]) => typeof v17 !== "object" ? [`-c '${k16}=${v17}'`] : []),
|
|
350031
|
-
|
|
350032
|
-
`--outputs-file ${
|
|
350033
|
-
`--profile ${
|
|
350081
|
+
watchArgs.stacks.join(" "),
|
|
350082
|
+
`--outputs-file ${watchArgs.outputsFile}`,
|
|
350083
|
+
`--profile ${watchArgs.profile}`,
|
|
350034
350084
|
"--hotswap-fallback"
|
|
350035
350085
|
].join(" ")}`
|
|
350036
350086
|
]
|
|
@@ -350084,7 +350134,7 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
350084
350134
|
});
|
|
350085
350135
|
});
|
|
350086
350136
|
const { promise: waiter, resolve: resolve13 } = promiseWithResolvers();
|
|
350087
|
-
await this.cdk.watch(
|
|
350137
|
+
await this.cdk.watch(watchArgs, {
|
|
350088
350138
|
// if `-v` (or above) is passed then stream the logs
|
|
350089
350139
|
onStdout: /* @__PURE__ */ __name((message2) => {
|
|
350090
350140
|
if (verbosity > 0) {
|
|
@@ -350233,13 +350283,14 @@ https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/integ-tests-alpha`
|
|
|
350233
350283
|
});
|
|
350234
350284
|
|
|
350235
350285
|
// lib/runner/snapshot-test-runner.ts
|
|
350236
|
-
var path38, import_stream2, import_string_decoder, import_cloudformation_diff4, IntegSnapshotRunner, StringWritable;
|
|
350286
|
+
var path38, import_stream2, import_string_decoder, import_cloud_assembly_api17, import_cloudformation_diff4, IntegSnapshotRunner, StringWritable;
|
|
350237
350287
|
var init_snapshot_test_runner = __esm({
|
|
350238
350288
|
"lib/runner/snapshot-test-runner.ts"() {
|
|
350239
350289
|
"use strict";
|
|
350240
350290
|
path38 = __toESM(require("path"));
|
|
350241
350291
|
import_stream2 = require("stream");
|
|
350242
350292
|
import_string_decoder = require("string_decoder");
|
|
350293
|
+
import_cloud_assembly_api17 = __toESM(require_lib3());
|
|
350243
350294
|
import_cloudformation_diff4 = __toESM(require_lib11());
|
|
350244
350295
|
init_cloud_assembly4();
|
|
350245
350296
|
init_runner_base();
|
|
@@ -350251,7 +350302,7 @@ var init_snapshot_test_runner = __esm({
|
|
|
350251
350302
|
constructor(options) {
|
|
350252
350303
|
super({
|
|
350253
350304
|
...options,
|
|
350254
|
-
region:
|
|
350305
|
+
region: import_cloud_assembly_api17.UNKNOWN_REGION
|
|
350255
350306
|
});
|
|
350256
350307
|
}
|
|
350257
350308
|
/**
|
|
@@ -350267,8 +350318,8 @@ var init_snapshot_test_runner = __esm({
|
|
|
350267
350318
|
const actualTestSuite = await this.actualTestSuite();
|
|
350268
350319
|
const expectedSnapshotAssembly = this.getSnapshotAssembly(this.snapshotDir, expectedTestSuite?.stacks);
|
|
350269
350320
|
const env = DEFAULT_SYNTH_OPTIONS.env;
|
|
350270
|
-
await this.cdk.
|
|
350271
|
-
|
|
350321
|
+
await this.cdk.synth({
|
|
350322
|
+
app: this.cdkApp,
|
|
350272
350323
|
context: this.getContext(actualTestSuite.enableLookups ? DEFAULT_SYNTH_OPTIONS.context : {}),
|
|
350273
350324
|
env,
|
|
350274
350325
|
output: path38.relative(this.directory, this.cdkOutDir)
|
|
@@ -350512,6 +350563,8 @@ var init_snapshot_test_runner = __esm({
|
|
|
350512
350563
|
static {
|
|
350513
350564
|
__name(this, "StringWritable");
|
|
350514
350565
|
}
|
|
350566
|
+
data;
|
|
350567
|
+
_decoder;
|
|
350515
350568
|
constructor(options) {
|
|
350516
350569
|
super(options);
|
|
350517
350570
|
this._decoder = new import_string_decoder.StringDecoder();
|
|
@@ -350557,6 +350610,55 @@ var init_integration_tests = __esm({
|
|
|
350557
350610
|
static {
|
|
350558
350611
|
__name(this, "IntegTest");
|
|
350559
350612
|
}
|
|
350613
|
+
/**
|
|
350614
|
+
* The name of the file to run
|
|
350615
|
+
*
|
|
350616
|
+
* Path is relative to the current working directory.
|
|
350617
|
+
*/
|
|
350618
|
+
fileName;
|
|
350619
|
+
/**
|
|
350620
|
+
* Relative path to the file to run
|
|
350621
|
+
*
|
|
350622
|
+
* Relative from the "discovery root".
|
|
350623
|
+
*/
|
|
350624
|
+
discoveryRelativeFileName;
|
|
350625
|
+
/**
|
|
350626
|
+
* The absolute path to the file
|
|
350627
|
+
*/
|
|
350628
|
+
absoluteFileName;
|
|
350629
|
+
/**
|
|
350630
|
+
* The normalized name of the test. This name
|
|
350631
|
+
* will be the same regardless of what directory the tool
|
|
350632
|
+
* is run from.
|
|
350633
|
+
*/
|
|
350634
|
+
normalizedTestName;
|
|
350635
|
+
/**
|
|
350636
|
+
* Directory the test is in
|
|
350637
|
+
*/
|
|
350638
|
+
directory;
|
|
350639
|
+
/**
|
|
350640
|
+
* Display name for the test
|
|
350641
|
+
*
|
|
350642
|
+
* Depends on the discovery directory.
|
|
350643
|
+
*
|
|
350644
|
+
* Looks like `integ.mytest` or `package/test/integ.mytest`.
|
|
350645
|
+
*/
|
|
350646
|
+
testName;
|
|
350647
|
+
/**
|
|
350648
|
+
* Path of the snapshot directory for this test
|
|
350649
|
+
*/
|
|
350650
|
+
snapshotDir;
|
|
350651
|
+
/**
|
|
350652
|
+
* Path to the temporary output directory for this test
|
|
350653
|
+
*/
|
|
350654
|
+
temporaryOutputDir;
|
|
350655
|
+
/**
|
|
350656
|
+
* The CLI command used to run this test.
|
|
350657
|
+
* If it contains {filePath}, the test file names will be substituted at that place in the command for each run.
|
|
350658
|
+
*
|
|
350659
|
+
* @default - test run command will be `node {filePath}`
|
|
350660
|
+
*/
|
|
350661
|
+
appCommand;
|
|
350560
350662
|
/**
|
|
350561
350663
|
* Whether this test matches the user-given name
|
|
350562
350664
|
*
|