sst 2.19.2 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/runtime/handlers/node.js +13 -6
- package/sst.mjs +300 -21
- package/support/base-site-archiver.mjs +14 -14
- package/support/bootstrap-metadata-function/index.mjs +3734 -1114
- package/support/bridge/bridge.mjs +36 -36
- package/support/custom-resources/index.mjs +8495 -3739
- package/support/edge-function/edge-lambda-version.mjs +2 -2
- package/support/edge-function/edge-lambda.mjs +2 -2
- package/support/edge-function/s3-bucket.mjs +2 -2
- package/support/event-bus-retrier/index.mjs +24 -24
- package/support/job-invoker/index.mjs +2836 -576
- package/support/nodejs-runtime/index.mjs +2 -0
- package/support/rds-migrator/index.mjs +19 -19
- package/support/script-function/index.mjs +3491 -943
- package/support/ssr-site-function-archiver.mjs +11 -11
package/sst.mjs
CHANGED
|
@@ -26,6 +26,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
return to;
|
|
27
27
|
};
|
|
28
28
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
33
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
34
|
mod
|
|
31
35
|
));
|
|
@@ -123,7 +127,7 @@ var init_logger = __esm({
|
|
|
123
127
|
"use strict";
|
|
124
128
|
init_context();
|
|
125
129
|
init_project();
|
|
126
|
-
previous = new Date();
|
|
130
|
+
previous = /* @__PURE__ */ new Date();
|
|
127
131
|
useFile = Context.memo(async () => {
|
|
128
132
|
const project = useProject();
|
|
129
133
|
const filePath = path.join(project.paths.out, "debug.log");
|
|
@@ -132,11 +136,11 @@ var init_logger = __esm({
|
|
|
132
136
|
});
|
|
133
137
|
Logger = {
|
|
134
138
|
debug(...parts) {
|
|
135
|
-
const now = new Date();
|
|
139
|
+
const now = /* @__PURE__ */ new Date();
|
|
136
140
|
const diff3 = now.getTime() - previous.getTime();
|
|
137
141
|
previous = now;
|
|
138
142
|
const line = [
|
|
139
|
-
new Date().toISOString(),
|
|
143
|
+
(/* @__PURE__ */ new Date()).toISOString(),
|
|
140
144
|
`+${diff3}ms`.padStart(8),
|
|
141
145
|
"[debug]",
|
|
142
146
|
...parts.map((x) => {
|
|
@@ -315,6 +319,14 @@ async function load(input, shallow) {
|
|
|
315
319
|
`const require = topLevelCreateRequire(import.meta.url);`
|
|
316
320
|
].join("")
|
|
317
321
|
},
|
|
322
|
+
// The entry can have any file name (ie. "stacks/anything.ts"). We want the
|
|
323
|
+
// build output to be always named "lib/index.js". This allow us to always
|
|
324
|
+
// import from "buildDir" without needing to pass "anything" around.
|
|
325
|
+
// stdin: {
|
|
326
|
+
// contents,
|
|
327
|
+
// loader: "ts",
|
|
328
|
+
// resolveDir: path.dirname(input),
|
|
329
|
+
// },
|
|
318
330
|
entryPoints: [input]
|
|
319
331
|
});
|
|
320
332
|
const mod = await dynamicImport(outfile);
|
|
@@ -648,13 +660,16 @@ function getEnvironmentData() {
|
|
|
648
660
|
const cpus = os2.cpus() || [];
|
|
649
661
|
const ciInfo2 = getCiInfo();
|
|
650
662
|
data = {
|
|
663
|
+
// Software information
|
|
651
664
|
systemPlatform: os2.platform(),
|
|
652
665
|
systemRelease: os2.release(),
|
|
653
666
|
systemArchitecture: os2.arch(),
|
|
667
|
+
// Machine information
|
|
654
668
|
cpuCount: cpus.length,
|
|
655
669
|
cpuModel: cpus.length ? cpus[0].model : null,
|
|
656
670
|
cpuSpeed: cpus.length ? cpus[0].speed : null,
|
|
657
671
|
memoryInMb: Math.trunc(os2.totalmem() / Math.pow(1024, 2)),
|
|
672
|
+
// Environment information
|
|
658
673
|
isCI: ciInfo2.isCI,
|
|
659
674
|
ciName: ciInfo2.name,
|
|
660
675
|
sstVersion: useProject().version
|
|
@@ -847,9 +862,10 @@ var init_spinner = __esm({
|
|
|
847
862
|
}
|
|
848
863
|
});
|
|
849
864
|
|
|
850
|
-
// ../../node_modules/.pnpm/tslib@2.
|
|
865
|
+
// ../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs
|
|
851
866
|
var tslib_es6_exports = {};
|
|
852
867
|
__export(tslib_es6_exports, {
|
|
868
|
+
__addDisposableResource: () => __addDisposableResource,
|
|
853
869
|
__assign: () => __assign,
|
|
854
870
|
__asyncDelegator: () => __asyncDelegator,
|
|
855
871
|
__asyncGenerator: () => __asyncGenerator,
|
|
@@ -861,6 +877,7 @@ __export(tslib_es6_exports, {
|
|
|
861
877
|
__classPrivateFieldSet: () => __classPrivateFieldSet,
|
|
862
878
|
__createBinding: () => __createBinding,
|
|
863
879
|
__decorate: () => __decorate,
|
|
880
|
+
__disposeResources: () => __disposeResources,
|
|
864
881
|
__esDecorate: () => __esDecorate,
|
|
865
882
|
__exportStar: () => __exportStar,
|
|
866
883
|
__extends: () => __extends,
|
|
@@ -878,7 +895,8 @@ __export(tslib_es6_exports, {
|
|
|
878
895
|
__spread: () => __spread,
|
|
879
896
|
__spreadArray: () => __spreadArray,
|
|
880
897
|
__spreadArrays: () => __spreadArrays,
|
|
881
|
-
__values: () => __values
|
|
898
|
+
__values: () => __values,
|
|
899
|
+
default: () => tslib_es6_default
|
|
882
900
|
});
|
|
883
901
|
function __extends(d, b) {
|
|
884
902
|
if (typeof b !== "function" && b !== null)
|
|
@@ -948,10 +966,10 @@ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, e
|
|
|
948
966
|
if (_ = accept(result.set))
|
|
949
967
|
descriptor.set = _;
|
|
950
968
|
if (_ = accept(result.init))
|
|
951
|
-
initializers.
|
|
969
|
+
initializers.unshift(_);
|
|
952
970
|
} else if (_ = accept(result)) {
|
|
953
971
|
if (kind === "field")
|
|
954
|
-
initializers.
|
|
972
|
+
initializers.unshift(_);
|
|
955
973
|
else
|
|
956
974
|
descriptor[key] = _;
|
|
957
975
|
}
|
|
@@ -1262,9 +1280,56 @@ function __classPrivateFieldIn(state2, receiver) {
|
|
|
1262
1280
|
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
1263
1281
|
return typeof state2 === "function" ? receiver === state2 : state2.has(receiver);
|
|
1264
1282
|
}
|
|
1265
|
-
|
|
1283
|
+
function __addDisposableResource(env, value, async) {
|
|
1284
|
+
if (value !== null && value !== void 0) {
|
|
1285
|
+
if (typeof value !== "object")
|
|
1286
|
+
throw new TypeError("Object expected.");
|
|
1287
|
+
var dispose;
|
|
1288
|
+
if (async) {
|
|
1289
|
+
if (!Symbol.asyncDispose)
|
|
1290
|
+
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
1291
|
+
dispose = value[Symbol.asyncDispose];
|
|
1292
|
+
}
|
|
1293
|
+
if (dispose === void 0) {
|
|
1294
|
+
if (!Symbol.dispose)
|
|
1295
|
+
throw new TypeError("Symbol.dispose is not defined.");
|
|
1296
|
+
dispose = value[Symbol.dispose];
|
|
1297
|
+
}
|
|
1298
|
+
if (typeof dispose !== "function")
|
|
1299
|
+
throw new TypeError("Object not disposable.");
|
|
1300
|
+
env.stack.push({ value, dispose, async });
|
|
1301
|
+
} else if (async) {
|
|
1302
|
+
env.stack.push({ async: true });
|
|
1303
|
+
}
|
|
1304
|
+
return value;
|
|
1305
|
+
}
|
|
1306
|
+
function __disposeResources(env) {
|
|
1307
|
+
function fail(e) {
|
|
1308
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
1309
|
+
env.hasError = true;
|
|
1310
|
+
}
|
|
1311
|
+
function next() {
|
|
1312
|
+
while (env.stack.length) {
|
|
1313
|
+
var rec = env.stack.pop();
|
|
1314
|
+
try {
|
|
1315
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
1316
|
+
if (rec.async)
|
|
1317
|
+
return Promise.resolve(result).then(next, function(e) {
|
|
1318
|
+
fail(e);
|
|
1319
|
+
return next();
|
|
1320
|
+
});
|
|
1321
|
+
} catch (e) {
|
|
1322
|
+
fail(e);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
if (env.hasError)
|
|
1326
|
+
throw env.error;
|
|
1327
|
+
}
|
|
1328
|
+
return next();
|
|
1329
|
+
}
|
|
1330
|
+
var extendStatics, __assign, __createBinding, __setModuleDefault, _SuppressedError, tslib_es6_default;
|
|
1266
1331
|
var init_tslib_es6 = __esm({
|
|
1267
|
-
"../../node_modules/.pnpm/tslib@2.
|
|
1332
|
+
"../../node_modules/.pnpm/tslib@2.6.0/node_modules/tslib/tslib.es6.mjs"() {
|
|
1268
1333
|
extendStatics = function(d, b) {
|
|
1269
1334
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
1270
1335
|
d2.__proto__ = b2;
|
|
@@ -1307,6 +1372,39 @@ var init_tslib_es6 = __esm({
|
|
|
1307
1372
|
} : function(o, v) {
|
|
1308
1373
|
o["default"] = v;
|
|
1309
1374
|
};
|
|
1375
|
+
_SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error3, suppressed, message) {
|
|
1376
|
+
var e = new Error(message);
|
|
1377
|
+
return e.name = "SuppressedError", e.error = error3, e.suppressed = suppressed, e;
|
|
1378
|
+
};
|
|
1379
|
+
tslib_es6_default = {
|
|
1380
|
+
__extends,
|
|
1381
|
+
__assign,
|
|
1382
|
+
__rest,
|
|
1383
|
+
__decorate,
|
|
1384
|
+
__param,
|
|
1385
|
+
__metadata,
|
|
1386
|
+
__awaiter,
|
|
1387
|
+
__generator,
|
|
1388
|
+
__createBinding,
|
|
1389
|
+
__exportStar,
|
|
1390
|
+
__values,
|
|
1391
|
+
__read,
|
|
1392
|
+
__spread,
|
|
1393
|
+
__spreadArrays,
|
|
1394
|
+
__spreadArray,
|
|
1395
|
+
__await,
|
|
1396
|
+
__asyncGenerator,
|
|
1397
|
+
__asyncDelegator,
|
|
1398
|
+
__asyncValues,
|
|
1399
|
+
__makeTemplateObject,
|
|
1400
|
+
__importStar,
|
|
1401
|
+
__importDefault,
|
|
1402
|
+
__classPrivateFieldGet,
|
|
1403
|
+
__classPrivateFieldSet,
|
|
1404
|
+
__classPrivateFieldIn,
|
|
1405
|
+
__addDisposableResource,
|
|
1406
|
+
__disposeResources
|
|
1407
|
+
};
|
|
1310
1408
|
}
|
|
1311
1409
|
});
|
|
1312
1410
|
|
|
@@ -1682,6 +1780,9 @@ function useAWSClient(client, force = false) {
|
|
|
1682
1780
|
delayDecider: (_, attempts) => {
|
|
1683
1781
|
return Math.min(1.5 ** attempts * 100, 5e3);
|
|
1684
1782
|
},
|
|
1783
|
+
// AWS SDK v3 has an idea of "retry tokens" which are used to
|
|
1784
|
+
// prevent multiple retries from happening at the same time.
|
|
1785
|
+
// This is a workaround to disable that.
|
|
1685
1786
|
retryQuota: {
|
|
1686
1787
|
hasRetryTokens: () => true,
|
|
1687
1788
|
releaseRetryTokens: () => {
|
|
@@ -2018,7 +2119,8 @@ async function monitor(stack) {
|
|
|
2018
2119
|
"Resource update cancelled"
|
|
2019
2120
|
) || event.ResourceStatusReason.includes(
|
|
2020
2121
|
"Resource creation Initiated"
|
|
2021
|
-
) ||
|
|
2122
|
+
) || // ie. The following resource(s) failed to update: [MyResource10A5921D].
|
|
2123
|
+
event.ResourceStatusReason.startsWith(
|
|
2022
2124
|
"The following resource(s) failed to"
|
|
2023
2125
|
))
|
|
2024
2126
|
continue;
|
|
@@ -2040,7 +2142,8 @@ async function monitor(stack) {
|
|
|
2040
2142
|
"Resource update cancelled"
|
|
2041
2143
|
) || resource.ResourceStatusReason?.includes(
|
|
2042
2144
|
"Resource creation Initiated"
|
|
2043
|
-
) || resource.
|
|
2145
|
+
) || // ie. The following resource(s) failed to update: [MyResource10A5921D].
|
|
2146
|
+
resource.ResourceStatusReason?.startsWith(
|
|
2044
2147
|
"The following resource(s) failed to"
|
|
2045
2148
|
))
|
|
2046
2149
|
continue;
|
|
@@ -2163,6 +2266,9 @@ var init_docker = __esm({
|
|
|
2163
2266
|
this.logger = logger;
|
|
2164
2267
|
}
|
|
2165
2268
|
configDir = void 0;
|
|
2269
|
+
/**
|
|
2270
|
+
* Whether an image with the given tag exists
|
|
2271
|
+
*/
|
|
2166
2272
|
async exists(tag) {
|
|
2167
2273
|
try {
|
|
2168
2274
|
await this.execute(["inspect", tag], { quiet: true });
|
|
@@ -2214,9 +2320,13 @@ var init_docker = __esm({
|
|
|
2214
2320
|
];
|
|
2215
2321
|
await this.execute(buildCommand, {
|
|
2216
2322
|
cwd: options.directory,
|
|
2323
|
+
// TODO: remove after PR is merged
|
|
2217
2324
|
quiet: options.quiet
|
|
2218
2325
|
});
|
|
2219
2326
|
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Get credentials from ECR and run docker login
|
|
2329
|
+
*/
|
|
2220
2330
|
async login(ecr) {
|
|
2221
2331
|
const credentials = await obtainEcrCredentials(ecr);
|
|
2222
2332
|
await this.execute(
|
|
@@ -2229,6 +2339,9 @@ var init_docker = __esm({
|
|
|
2229
2339
|
],
|
|
2230
2340
|
{
|
|
2231
2341
|
input: credentials.password,
|
|
2342
|
+
// Need to quiet otherwise Docker will complain
|
|
2343
|
+
// 'WARNING! Your password will be stored unencrypted'
|
|
2344
|
+
// doesn't really matter since it's a token.
|
|
2232
2345
|
quiet: true
|
|
2233
2346
|
}
|
|
2234
2347
|
);
|
|
@@ -2236,9 +2349,19 @@ var init_docker = __esm({
|
|
|
2236
2349
|
async tag(sourceTag, targetTag) {
|
|
2237
2350
|
await this.execute(["tag", sourceTag, targetTag]);
|
|
2238
2351
|
}
|
|
2352
|
+
// TODO: remove after PR is merged
|
|
2239
2353
|
async push(options) {
|
|
2240
2354
|
await this.execute(["push", options.tag], { quiet: options.quiet });
|
|
2241
2355
|
}
|
|
2356
|
+
/**
|
|
2357
|
+
* If a CDK Docker Credentials file exists, creates a new Docker config directory.
|
|
2358
|
+
* Sets up `docker-credential-cdk-assets` to be the credential helper for each domain in the CDK config.
|
|
2359
|
+
* All future commands (e.g., `build`, `push`) will use this config.
|
|
2360
|
+
*
|
|
2361
|
+
* See https://docs.docker.com/engine/reference/commandline/login/#credential-helpers for more details on cred helpers.
|
|
2362
|
+
*
|
|
2363
|
+
* @returns true if CDK config was found and configured, false otherwise
|
|
2364
|
+
*/
|
|
2242
2365
|
configureCdkCredentials() {
|
|
2243
2366
|
const config = cdkCredentialsConfig();
|
|
2244
2367
|
if (!config) {
|
|
@@ -2260,6 +2383,12 @@ var init_docker = __esm({
|
|
|
2260
2383
|
);
|
|
2261
2384
|
return true;
|
|
2262
2385
|
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Removes any configured Docker config directory.
|
|
2388
|
+
* All future commands (e.g., `build`, `push`) will use the default config.
|
|
2389
|
+
*
|
|
2390
|
+
* This is useful after calling `configureCdkCredentials` to reset to default credentials.
|
|
2391
|
+
*/
|
|
2263
2392
|
resetAuthPlugins() {
|
|
2264
2393
|
this.configDir = void 0;
|
|
2265
2394
|
}
|
|
@@ -2296,6 +2425,9 @@ var init_docker = __esm({
|
|
|
2296
2425
|
DockerFactory = class {
|
|
2297
2426
|
enterLoggedInDestinationsCriticalSection = createCriticalSection();
|
|
2298
2427
|
loggedInDestinations = /* @__PURE__ */ new Set();
|
|
2428
|
+
/**
|
|
2429
|
+
* Gets a Docker instance for building images.
|
|
2430
|
+
*/
|
|
2299
2431
|
async forBuild(options) {
|
|
2300
2432
|
const docker = new Docker(options.logger);
|
|
2301
2433
|
let cdkDockerCredentialsConfigured = docker.configureCdkCredentials();
|
|
@@ -2304,6 +2436,9 @@ var init_docker = __esm({
|
|
|
2304
2436
|
}
|
|
2305
2437
|
return docker;
|
|
2306
2438
|
}
|
|
2439
|
+
/**
|
|
2440
|
+
* Gets a Docker instance for pushing images to ECR.
|
|
2441
|
+
*/
|
|
2307
2442
|
async forEcrPush(options) {
|
|
2308
2443
|
const docker = new Docker(options.logger);
|
|
2309
2444
|
await this.loginOncePerDestination(docker, options);
|
|
@@ -2380,6 +2515,7 @@ var init_container_images = __esm({
|
|
|
2380
2515
|
this.workDir,
|
|
2381
2516
|
this.asset,
|
|
2382
2517
|
this.host,
|
|
2518
|
+
// TODO: remove after PR is merged
|
|
2383
2519
|
{
|
|
2384
2520
|
quiet: this.options.quiet
|
|
2385
2521
|
}
|
|
@@ -2456,6 +2592,13 @@ var init_container_images = __esm({
|
|
|
2456
2592
|
};
|
|
2457
2593
|
return this.init;
|
|
2458
2594
|
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Check whether the image already exists in the ECR repo
|
|
2597
|
+
*
|
|
2598
|
+
* Use the fields from the destination to do the actual check. The imageUri
|
|
2599
|
+
* should correspond to that, but is only used to print Docker image location
|
|
2600
|
+
* for user benefit (the format is slightly different).
|
|
2601
|
+
*/
|
|
2459
2602
|
async destinationAlreadyExists(ecr, destination, imageUri) {
|
|
2460
2603
|
this.host.emitMessage(EventType.CHECK, `Check ${imageUri}`);
|
|
2461
2604
|
if (await imageExists(ecr, destination.repositoryName, destination.imageTag)) {
|
|
@@ -2476,6 +2619,12 @@ var init_container_images = __esm({
|
|
|
2476
2619
|
async build() {
|
|
2477
2620
|
return this.asset.source.executable ? this.buildExternalAsset(this.asset.source.executable) : this.buildDirectoryAsset();
|
|
2478
2621
|
}
|
|
2622
|
+
/**
|
|
2623
|
+
* Build a (local) Docker asset from a directory with a Dockerfile
|
|
2624
|
+
*
|
|
2625
|
+
* Tags under a deterministic, unique, local identifier wich will skip
|
|
2626
|
+
* the build if it already exists.
|
|
2627
|
+
*/
|
|
2479
2628
|
async buildDirectoryAsset() {
|
|
2480
2629
|
const localTagName = `cdkasset-${this.asset.id.assetId.toLowerCase()}`;
|
|
2481
2630
|
if (!await this.isImageCached(localTagName)) {
|
|
@@ -2486,6 +2635,12 @@ var init_container_images = __esm({
|
|
|
2486
2635
|
}
|
|
2487
2636
|
return localTagName;
|
|
2488
2637
|
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Build a (local) Docker asset by running an external command
|
|
2640
|
+
*
|
|
2641
|
+
* External command is responsible for deduplicating the build if possible,
|
|
2642
|
+
* and is expected to return the generated image identifier on stdout.
|
|
2643
|
+
*/
|
|
2489
2644
|
async buildExternalAsset(executable, cwd) {
|
|
2490
2645
|
const assetPath = cwd ?? this.workDir;
|
|
2491
2646
|
this.host.emitMessage(
|
|
@@ -2523,6 +2678,7 @@ var init_container_images = __esm({
|
|
|
2523
2678
|
outputs: source.dockerOutputs,
|
|
2524
2679
|
cacheFrom: source.cacheFrom,
|
|
2525
2680
|
cacheTo: source.cacheTo,
|
|
2681
|
+
// TODO: remove after PR is merged
|
|
2526
2682
|
quiet: this.options.quiet
|
|
2527
2683
|
});
|
|
2528
2684
|
}
|
|
@@ -2552,6 +2708,7 @@ function makeAssetHandler(manifest, asset, host, options) {
|
|
|
2552
2708
|
manifest.directory,
|
|
2553
2709
|
asset,
|
|
2554
2710
|
host,
|
|
2711
|
+
// TODO: remove after PR is merged
|
|
2555
2712
|
options
|
|
2556
2713
|
);
|
|
2557
2714
|
}
|
|
@@ -2595,7 +2752,13 @@ var init_publishing = __esm({
|
|
|
2595
2752
|
dockerFactory: new DockerFactory()
|
|
2596
2753
|
};
|
|
2597
2754
|
}
|
|
2755
|
+
/**
|
|
2756
|
+
* The message for the IPublishProgress interface
|
|
2757
|
+
*/
|
|
2598
2758
|
message = "Starting";
|
|
2759
|
+
/**
|
|
2760
|
+
* The current asset for the IPublishProgress interface
|
|
2761
|
+
*/
|
|
2599
2762
|
currentAsset;
|
|
2600
2763
|
failures = new Array();
|
|
2601
2764
|
assets;
|
|
@@ -2607,6 +2770,9 @@ var init_publishing = __esm({
|
|
|
2607
2770
|
buildAssets;
|
|
2608
2771
|
publishAssets;
|
|
2609
2772
|
handlerCache = /* @__PURE__ */ new Map();
|
|
2773
|
+
/**
|
|
2774
|
+
* Publish all assets from the manifest
|
|
2775
|
+
*/
|
|
2610
2776
|
async publish() {
|
|
2611
2777
|
if (this.publishInParallel) {
|
|
2612
2778
|
await Promise.all(
|
|
@@ -2625,6 +2791,9 @@ var init_publishing = __esm({
|
|
|
2625
2791
|
);
|
|
2626
2792
|
}
|
|
2627
2793
|
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Build a single asset from the manifest
|
|
2796
|
+
*/
|
|
2628
2797
|
async buildEntry(asset) {
|
|
2629
2798
|
try {
|
|
2630
2799
|
if (this.progressEvent(EventType2.START, `Building ${asset.id}`)) {
|
|
@@ -2648,6 +2817,9 @@ var init_publishing = __esm({
|
|
|
2648
2817
|
}
|
|
2649
2818
|
return true;
|
|
2650
2819
|
}
|
|
2820
|
+
/**
|
|
2821
|
+
* Publish a single asset from the manifest
|
|
2822
|
+
*/
|
|
2651
2823
|
async publishEntry(asset) {
|
|
2652
2824
|
try {
|
|
2653
2825
|
if (this.progressEvent(EventType2.START, `Publishing ${asset.id}`)) {
|
|
@@ -2671,10 +2843,18 @@ var init_publishing = __esm({
|
|
|
2671
2843
|
}
|
|
2672
2844
|
return true;
|
|
2673
2845
|
}
|
|
2846
|
+
/**
|
|
2847
|
+
* Return whether a single asset is published
|
|
2848
|
+
*/
|
|
2674
2849
|
isEntryPublished(asset) {
|
|
2675
2850
|
const handler = this.assetHandler(asset);
|
|
2676
2851
|
return handler.isPublished();
|
|
2677
2852
|
}
|
|
2853
|
+
/**
|
|
2854
|
+
* publish an asset (used by 'publish()')
|
|
2855
|
+
* @param asset The asset to publish
|
|
2856
|
+
* @returns false when publishing should stop
|
|
2857
|
+
*/
|
|
2678
2858
|
async publishAsset(asset) {
|
|
2679
2859
|
try {
|
|
2680
2860
|
if (this.progressEvent(EventType2.START, `Publishing ${asset.id}`)) {
|
|
@@ -2715,6 +2895,11 @@ var init_publishing = __esm({
|
|
|
2715
2895
|
get hasFailures() {
|
|
2716
2896
|
return this.failures.length > 0;
|
|
2717
2897
|
}
|
|
2898
|
+
/**
|
|
2899
|
+
* Publish a progress event to the listener, if present.
|
|
2900
|
+
*
|
|
2901
|
+
* Returns whether an abort is requested. Helper to get rid of repetitive code in publish().
|
|
2902
|
+
*/
|
|
2718
2903
|
progressEvent(event, message) {
|
|
2719
2904
|
this.message = message;
|
|
2720
2905
|
if (this.options.progressListener) {
|
|
@@ -2728,6 +2913,7 @@ var init_publishing = __esm({
|
|
|
2728
2913
|
return existing;
|
|
2729
2914
|
}
|
|
2730
2915
|
const ret = makeAssetHandler(this.manifest, asset, this.handlerHost, {
|
|
2916
|
+
// TODO: remove after PR is merged
|
|
2731
2917
|
quiet: this.options.quiet
|
|
2732
2918
|
});
|
|
2733
2919
|
this.handlerCache.set(asset, ret);
|
|
@@ -2757,6 +2943,7 @@ async function publishAssets(manifest, sdk, targetEnv, options = {}) {
|
|
|
2757
2943
|
publishInParallel: options.parallel ?? true,
|
|
2758
2944
|
buildAssets: options.buildAssets ?? true,
|
|
2759
2945
|
publishAssets: true,
|
|
2946
|
+
// TODO: remove after PR is merged
|
|
2760
2947
|
quiet: options.quiet
|
|
2761
2948
|
});
|
|
2762
2949
|
await publisher.publish();
|
|
@@ -2829,13 +3016,18 @@ var init_asset_publishing = __esm({
|
|
|
2829
3016
|
async secretsManagerClient(options) {
|
|
2830
3017
|
return (await this.sdk(options)).secretsManager();
|
|
2831
3018
|
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Get an SDK appropriate for the given client options
|
|
3021
|
+
*/
|
|
2832
3022
|
async sdk(options) {
|
|
2833
3023
|
const env = {
|
|
2834
3024
|
...this.targetEnv,
|
|
2835
3025
|
region: options.region ?? this.targetEnv.region
|
|
3026
|
+
// Default: same region as the stack
|
|
2836
3027
|
};
|
|
2837
3028
|
const cacheKey = JSON.stringify({
|
|
2838
3029
|
env,
|
|
3030
|
+
// region, name, account
|
|
2839
3031
|
assumeRuleArn: options.assumeRoleArn,
|
|
2840
3032
|
assumeRoleExternalId: options.assumeRoleExternalId,
|
|
2841
3033
|
quiet: options.quiet
|
|
@@ -3119,7 +3311,10 @@ async function destroyStack(options) {
|
|
|
3119
3311
|
);
|
|
3120
3312
|
}
|
|
3121
3313
|
} catch (e) {
|
|
3122
|
-
throw new Error(suffixWithErrors(
|
|
3314
|
+
throw new Error(suffixWithErrors(
|
|
3315
|
+
e.message
|
|
3316
|
+
/* , monitor?.errors */
|
|
3317
|
+
));
|
|
3123
3318
|
} finally {
|
|
3124
3319
|
}
|
|
3125
3320
|
}
|
|
@@ -3354,7 +3549,7 @@ var init_deploy_stack = __esm({
|
|
|
3354
3549
|
}
|
|
3355
3550
|
}
|
|
3356
3551
|
async directDeployment() {
|
|
3357
|
-
const startTime = new Date();
|
|
3552
|
+
const startTime = /* @__PURE__ */ new Date();
|
|
3358
3553
|
if (this.update) {
|
|
3359
3554
|
await this.cfn.updateStack({
|
|
3360
3555
|
StackName: this.stackName,
|
|
@@ -3392,7 +3587,10 @@ var init_deploy_stack = __esm({
|
|
|
3392
3587
|
}
|
|
3393
3588
|
finalState = successStack;
|
|
3394
3589
|
} catch (e) {
|
|
3395
|
-
throw new Error(suffixWithErrors(
|
|
3590
|
+
throw new Error(suffixWithErrors(
|
|
3591
|
+
e.message
|
|
3592
|
+
/*, monitor?.errors*/
|
|
3593
|
+
));
|
|
3396
3594
|
} finally {
|
|
3397
3595
|
}
|
|
3398
3596
|
debug2("Stack %s has completed updating", this.stackName);
|
|
@@ -3402,6 +3600,9 @@ var init_deploy_stack = __esm({
|
|
|
3402
3600
|
stackArn: finalState.stackId
|
|
3403
3601
|
};
|
|
3404
3602
|
}
|
|
3603
|
+
/**
|
|
3604
|
+
* Return the options that are shared between CreateStack, UpdateStack and CreateChangeSet
|
|
3605
|
+
*/
|
|
3405
3606
|
commonPrepareOptions() {
|
|
3406
3607
|
return {
|
|
3407
3608
|
Capabilities: [
|
|
@@ -3417,6 +3618,12 @@ var init_deploy_stack = __esm({
|
|
|
3417
3618
|
Tags: this.options.tags
|
|
3418
3619
|
};
|
|
3419
3620
|
}
|
|
3621
|
+
/**
|
|
3622
|
+
* Return the options that are shared between UpdateStack and CreateChangeSet
|
|
3623
|
+
*
|
|
3624
|
+
* Be careful not to add in keys for options that aren't used, as the features may not have been
|
|
3625
|
+
* deployed everywhere yet.
|
|
3626
|
+
*/
|
|
3420
3627
|
commonExecuteOptions() {
|
|
3421
3628
|
const shouldDisableRollback = this.options.rollback === false;
|
|
3422
3629
|
return {
|
|
@@ -3609,6 +3816,15 @@ var init_deployments = __esm({
|
|
|
3609
3816
|
}
|
|
3610
3817
|
return this.prepareSdkFor(stackArtifact, void 0, Mode2.ForReading);
|
|
3611
3818
|
}
|
|
3819
|
+
/**
|
|
3820
|
+
* Get the environment necessary for touching the given stack
|
|
3821
|
+
*
|
|
3822
|
+
* Returns the following:
|
|
3823
|
+
*
|
|
3824
|
+
* - The resolved environment for the stack (no more 'unknown-account/unknown-region')
|
|
3825
|
+
* - SDK loaded with the right credentials for calling `CreateChangeSet`.
|
|
3826
|
+
* - The Execution Role that should be passed to CloudFormation.
|
|
3827
|
+
*/
|
|
3612
3828
|
async prepareSdkFor(stack, roleArn, mode) {
|
|
3613
3829
|
if (!stack.environment) {
|
|
3614
3830
|
throw new Error(
|
|
@@ -3621,6 +3837,7 @@ var init_deployments = __esm({
|
|
|
3621
3837
|
const arns = await replaceEnvPlaceholders(
|
|
3622
3838
|
{
|
|
3623
3839
|
assumeRoleArn: stack.assumeRoleArn,
|
|
3840
|
+
// Use the override if given, otherwise use the field from the stack
|
|
3624
3841
|
cloudFormationRoleArn: roleArn ?? stack.cloudFormationExecutionRoleArn
|
|
3625
3842
|
},
|
|
3626
3843
|
resolvedEnvironment,
|
|
@@ -3640,6 +3857,24 @@ var init_deployments = __esm({
|
|
|
3640
3857
|
cloudFormationRoleArn: arns.cloudFormationRoleArn
|
|
3641
3858
|
};
|
|
3642
3859
|
}
|
|
3860
|
+
/**
|
|
3861
|
+
* Try to use the bootstrap lookupRole. There are two scenarios that are handled here
|
|
3862
|
+
* 1. The lookup role may not exist (it was added in bootstrap stack version 7)
|
|
3863
|
+
* 2. The lookup role may not have the correct permissions (ReadOnlyAccess was added in
|
|
3864
|
+
* bootstrap stack version 8)
|
|
3865
|
+
*
|
|
3866
|
+
* In the case of 1 (lookup role doesn't exist) `forEnvironment` will either:
|
|
3867
|
+
* 1. Return the default credentials if the default credentials are for the stack account
|
|
3868
|
+
* 2. Throw an error if the default credentials are not for the stack account.
|
|
3869
|
+
*
|
|
3870
|
+
* If we successfully assume the lookup role we then proceed to 2 and check whether the bootstrap
|
|
3871
|
+
* stack version is valid. If it is not we throw an error which should be handled in the calling
|
|
3872
|
+
* function (and fallback to use a different role, etc)
|
|
3873
|
+
*
|
|
3874
|
+
* If we do not successfully assume the lookup role, but do get back the default credentials
|
|
3875
|
+
* then return those and note that we are returning the default credentials. The calling
|
|
3876
|
+
* function can then decide to use them or fallback to another role.
|
|
3877
|
+
*/
|
|
3643
3878
|
async prepareSdkWithLookupRoleFor(stack) {
|
|
3644
3879
|
const resolvedEnvironment = await this.sdkProvider.resolveEnvironment(
|
|
3645
3880
|
stack.environment
|
|
@@ -3685,6 +3920,9 @@ var init_deployments = __esm({
|
|
|
3685
3920
|
throw e;
|
|
3686
3921
|
}
|
|
3687
3922
|
}
|
|
3923
|
+
/**
|
|
3924
|
+
* Look up the toolkit for a given environment, using a given SDK
|
|
3925
|
+
*/
|
|
3688
3926
|
async lookupToolkit(resolvedEnvironment, sdk, toolkitStackName) {
|
|
3689
3927
|
const key = `${resolvedEnvironment.account}:${resolvedEnvironment.region}:${toolkitStackName}`;
|
|
3690
3928
|
const existing = this.toolkitInfoCache.get(key);
|
|
@@ -3722,6 +3960,11 @@ var init_deployments = __esm({
|
|
|
3722
3960
|
const manifest = AssetManifest2.fromFile(asset.file);
|
|
3723
3961
|
return { manifest, stackEnv };
|
|
3724
3962
|
}
|
|
3963
|
+
/**
|
|
3964
|
+
* Build all assets in a manifest
|
|
3965
|
+
*
|
|
3966
|
+
* @deprecated Use `buildSingleAsset` instead
|
|
3967
|
+
*/
|
|
3725
3968
|
async buildAssets(asset, options) {
|
|
3726
3969
|
const { manifest, stackEnv } = await this.prepareAndValidateAssets(
|
|
3727
3970
|
asset,
|
|
@@ -3734,6 +3977,11 @@ var init_deployments = __esm({
|
|
|
3734
3977
|
options.buildOptions
|
|
3735
3978
|
);
|
|
3736
3979
|
}
|
|
3980
|
+
/**
|
|
3981
|
+
* Publish all assets in a manifest
|
|
3982
|
+
*
|
|
3983
|
+
* @deprecated Use `publishSingleAsset` instead
|
|
3984
|
+
*/
|
|
3737
3985
|
async publishAssets(asset, options) {
|
|
3738
3986
|
const { manifest, stackEnv } = await this.prepareAndValidateAssets(
|
|
3739
3987
|
asset,
|
|
@@ -3746,6 +3994,10 @@ var init_deployments = __esm({
|
|
|
3746
3994
|
options.publishOptions
|
|
3747
3995
|
);
|
|
3748
3996
|
}
|
|
3997
|
+
/**
|
|
3998
|
+
* Build a single asset from an asset manifest
|
|
3999
|
+
*/
|
|
4000
|
+
// eslint-disable-next-line max-len
|
|
3749
4001
|
async buildSingleAsset(assetArtifact, assetManifest, asset, options) {
|
|
3750
4002
|
const { stackSdk, resolvedEnvironment: stackEnv } = await this.prepareSdkFor(options.stack, options.roleArn, Mode2.ForWriting);
|
|
3751
4003
|
const toolkitInfo = await this.lookupToolkit(
|
|
@@ -3766,6 +4018,10 @@ var init_deployments = __esm({
|
|
|
3766
4018
|
);
|
|
3767
4019
|
await publisher.buildEntry(asset);
|
|
3768
4020
|
}
|
|
4021
|
+
/**
|
|
4022
|
+
* Publish a single asset from an asset manifest
|
|
4023
|
+
*/
|
|
4024
|
+
// eslint-disable-next-line max-len
|
|
3769
4025
|
async publishSingleAsset(assetManifest, asset, options) {
|
|
3770
4026
|
const { resolvedEnvironment: stackEnv } = await this.prepareSdkFor(
|
|
3771
4027
|
options.stack,
|
|
@@ -3779,6 +4035,9 @@ var init_deployments = __esm({
|
|
|
3779
4035
|
);
|
|
3780
4036
|
await publisher.publishEntry(asset);
|
|
3781
4037
|
}
|
|
4038
|
+
/**
|
|
4039
|
+
* Return whether a single asset has been published already
|
|
4040
|
+
*/
|
|
3782
4041
|
async isSingleAssetPublished(assetManifest, asset, options) {
|
|
3783
4042
|
const { resolvedEnvironment: stackEnv } = await this.prepareSdkFor(
|
|
3784
4043
|
options.stack,
|
|
@@ -3792,6 +4051,9 @@ var init_deployments = __esm({
|
|
|
3792
4051
|
);
|
|
3793
4052
|
return publisher.isEntryPublished(asset);
|
|
3794
4053
|
}
|
|
4054
|
+
/**
|
|
4055
|
+
* Validate that the bootstrap stack has the right version for this stack
|
|
4056
|
+
*/
|
|
3795
4057
|
async validateBootstrapStackVersion(stackName, requiresBootstrapStackVersion, bootstrapStackVersionSsmParameter, toolkitInfo) {
|
|
3796
4058
|
if (requiresBootstrapStackVersion === void 0) {
|
|
3797
4059
|
return;
|
|
@@ -5037,10 +5299,16 @@ var init_dotnet = __esm({
|
|
|
5037
5299
|
FRAMEWORK_MAP[input.props.runtime],
|
|
5038
5300
|
"/p:GenerateRuntimeConfigurationFiles=true",
|
|
5039
5301
|
"/clp:ForceConsoleColor",
|
|
5302
|
+
// warnings are not reported for repeated builds by default and this flag
|
|
5303
|
+
// does a clean before build. It takes a little longer to run, but the
|
|
5304
|
+
// warnings are consistently printed on each build.
|
|
5305
|
+
//"/target:Rebuild",
|
|
5040
5306
|
"--self-contained",
|
|
5041
5307
|
"false",
|
|
5308
|
+
// do not print "Build Engine version"
|
|
5042
5309
|
"-nologo"
|
|
5043
5310
|
].join(" "),
|
|
5311
|
+
// only print errors
|
|
5044
5312
|
{
|
|
5045
5313
|
cwd: srcPath
|
|
5046
5314
|
}
|
|
@@ -5096,7 +5364,7 @@ var init_node = __esm({
|
|
|
5096
5364
|
if (!result)
|
|
5097
5365
|
return false;
|
|
5098
5366
|
const relative = path10.relative(project.paths.root, input.file).split(path10.sep).join(path10.posix.sep);
|
|
5099
|
-
return Boolean(result.metafile?.inputs[relative]);
|
|
5367
|
+
return Boolean(result.last.metafile?.inputs[relative]);
|
|
5100
5368
|
},
|
|
5101
5369
|
canHandle: (input) => input.startsWith("nodejs"),
|
|
5102
5370
|
startWorker: async (input) => {
|
|
@@ -5164,9 +5432,12 @@ var init_node = __esm({
|
|
|
5164
5432
|
parsed.name + extension
|
|
5165
5433
|
);
|
|
5166
5434
|
const handler = path10.relative(input.out, target.replace(extension, parsed.ext)).split(path10.sep).join(path10.posix.sep);
|
|
5167
|
-
if (exists
|
|
5168
|
-
const result = await exists.rebuild();
|
|
5169
|
-
cache[input.functionID] =
|
|
5435
|
+
if (exists) {
|
|
5436
|
+
const result = await exists.ctx.rebuild();
|
|
5437
|
+
cache[input.functionID] = {
|
|
5438
|
+
ctx: exists.ctx,
|
|
5439
|
+
last: result
|
|
5440
|
+
};
|
|
5170
5441
|
return {
|
|
5171
5442
|
type: "success",
|
|
5172
5443
|
handler
|
|
@@ -5217,7 +5488,8 @@ var init_node = __esm({
|
|
|
5217
5488
|
...override
|
|
5218
5489
|
};
|
|
5219
5490
|
try {
|
|
5220
|
-
const
|
|
5491
|
+
const ctx = await esbuild2.context(options);
|
|
5492
|
+
const result = await ctx.rebuild();
|
|
5221
5493
|
const installPackages = [
|
|
5222
5494
|
...nodejs.install || [],
|
|
5223
5495
|
...forceExternal.filter((pkg) => pkg !== "aws-sdk").filter((pkg) => !external?.includes(pkg)).filter(
|
|
@@ -5284,7 +5556,10 @@ var init_node = __esm({
|
|
|
5284
5556
|
} catch {
|
|
5285
5557
|
}
|
|
5286
5558
|
}
|
|
5287
|
-
cache[input.functionID] =
|
|
5559
|
+
cache[input.functionID] = {
|
|
5560
|
+
ctx,
|
|
5561
|
+
last: result
|
|
5562
|
+
};
|
|
5288
5563
|
return {
|
|
5289
5564
|
type: "success",
|
|
5290
5565
|
handler
|
|
@@ -5711,7 +5986,8 @@ function bundle(options) {
|
|
|
5711
5986
|
);
|
|
5712
5987
|
const image = DockerImage.fromBuild(stagedir, {
|
|
5713
5988
|
buildArgs: {
|
|
5714
|
-
IMAGE: runtime.bundlingImage.image +
|
|
5989
|
+
IMAGE: runtime.bundlingImage.image + // the default x86_64 doesn't need to be set explicitly
|
|
5990
|
+
(architecture == "arm_64" ? ":latest-arm64" : "")
|
|
5715
5991
|
},
|
|
5716
5992
|
file: dockerfile
|
|
5717
5993
|
});
|
|
@@ -7482,6 +7758,7 @@ var init_kysely = __esm({
|
|
|
7482
7758
|
});
|
|
7483
7759
|
const dialect = db.engine.includes("postgres") ? new PostgresDialect() : new MysqlDialect();
|
|
7484
7760
|
const instrospection = await dialect.introspector.introspect({
|
|
7761
|
+
// @ts-ignore
|
|
7485
7762
|
db: k
|
|
7486
7763
|
});
|
|
7487
7764
|
logger("introspected tables");
|
|
@@ -8350,7 +8627,9 @@ var bind = (program2) => program2.command(
|
|
|
8350
8627
|
match: /solid-start|plugin-vue|plugin-react|@preact\/preset-vite/
|
|
8351
8628
|
},
|
|
8352
8629
|
{ file: "package.json", match: /react-scripts/ },
|
|
8630
|
+
// CRA
|
|
8353
8631
|
{ file: "index.html" }
|
|
8632
|
+
// plain HTML
|
|
8354
8633
|
];
|
|
8355
8634
|
const results = await Promise.all(
|
|
8356
8635
|
SITE_CONFIGS.map((site) => {
|