sst 2.0.0-rc.35 → 2.0.0-rc.36
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/bootstrap.js +6 -2
- package/cdk/cloudformation-deployments-wrapper.d.ts +2 -0
- package/cdk/cloudformation-deployments-wrapper.js +25 -0
- package/cdk/cloudformation-deployments.d.ts +18 -3
- package/cli/commands/deploy.js +5 -3
- package/cli/commands/remove.js +2 -3
- package/config.d.ts +1 -1
- package/config.js +3 -3
- package/package.json +2 -1
- package/sst.mjs +89 -19
- package/stacks/assembly.d.ts +1 -0
- package/stacks/assembly.js +4 -0
- package/stacks/deploy.d.ts +1 -0
- package/stacks/deploy.js +19 -4
- package/stacks/index.d.ts +1 -0
- package/stacks/index.js +1 -0
- package/stacks/metadata.d.ts +2 -0
- package/stacks/remove.js +0 -4
- package/support/bootstrap-metadata-function/index.mjs +68032 -30124
package/bootstrap.js
CHANGED
|
@@ -19,7 +19,7 @@ import { Stacks } from "./stacks/index.js";
|
|
|
19
19
|
const STACK_NAME = "SSTBootstrap";
|
|
20
20
|
const OUTPUT_VERSION = "Version";
|
|
21
21
|
const OUTPUT_BUCKET = "BucketName";
|
|
22
|
-
const LATEST_VERSION = "
|
|
22
|
+
const LATEST_VERSION = "5";
|
|
23
23
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
24
24
|
export const useBootstrap = Context.memo(async () => {
|
|
25
25
|
Logger.debug("Initializing bootstrap context");
|
|
@@ -50,7 +50,7 @@ export const useBootstrap = Context.memo(async () => {
|
|
|
50
50
|
const fn = new Function(stack, "MetadataHandler", {
|
|
51
51
|
code: Code.fromAsset(path.resolve(__dirname, "support/bootstrap-metadata-function")),
|
|
52
52
|
handler: "index.handler",
|
|
53
|
-
runtime: Runtime.
|
|
53
|
+
runtime: Runtime.NODEJS_18_X,
|
|
54
54
|
initialPolicy: [
|
|
55
55
|
new PolicyStatement({
|
|
56
56
|
actions: ["cloudformation:DescribeStacks"],
|
|
@@ -60,6 +60,10 @@ export const useBootstrap = Context.memo(async () => {
|
|
|
60
60
|
actions: ["s3:PutObject", "s3:DeleteObject"],
|
|
61
61
|
resources: [bucket.bucketArn + "/*"],
|
|
62
62
|
}),
|
|
63
|
+
new PolicyStatement({
|
|
64
|
+
actions: ["iot:Publish"],
|
|
65
|
+
resources: [`arn:${stack.partition}:iot:${stack.region}:${stack.account}:topic//sst/*`],
|
|
66
|
+
}),
|
|
63
67
|
],
|
|
64
68
|
});
|
|
65
69
|
const queue = new Queue(stack, "MetadataQueue");
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolkitInfo } from "aws-cdk/lib/api/toolkit-info.js";
|
|
2
|
+
import { Context } from "../context/context.js";
|
|
3
|
+
export async function publishAssets(deployment, options) {
|
|
4
|
+
const toolkitInfo = await useToolkitInfo().lookup(deployment, options);
|
|
5
|
+
await deployment.publishStackAssets(options.stack, toolkitInfo, {
|
|
6
|
+
buildAssets: options.buildAssets ?? true,
|
|
7
|
+
publishOptions: {
|
|
8
|
+
quiet: options.quiet,
|
|
9
|
+
parallel: options.assetParallelism,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
const useToolkitInfo = Context.memo(() => {
|
|
14
|
+
const state = new Map();
|
|
15
|
+
return {
|
|
16
|
+
async lookup(deployment, options) {
|
|
17
|
+
if (state.has(deployment))
|
|
18
|
+
return state.get(deployment);
|
|
19
|
+
const { stackSdk, resolvedEnvironment } = await deployment.prepareSdkFor(options.stack, options.roleArn);
|
|
20
|
+
const toolkitInfo = await ToolkitInfo.lookup(resolvedEnvironment, stackSdk, options.toolkitStackName);
|
|
21
|
+
state.set(deployment, toolkitInfo);
|
|
22
|
+
return toolkitInfo;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as cxapi from "@aws-cdk/cx-api";
|
|
2
2
|
import { Tag } from "aws-cdk/lib/cdk-toolkit.js";
|
|
3
|
-
import { BuildAssetsOptions } from "aws-cdk/lib/util/asset-publishing.js";
|
|
3
|
+
import { BuildAssetsOptions, PublishAssetsOptions } from "aws-cdk/lib/util/asset-publishing.js";
|
|
4
|
+
import { Mode } from "aws-cdk/lib/api/aws-auth/credentials.js";
|
|
4
5
|
import { ISDK } from "aws-cdk/lib/api/aws-auth/sdk.js";
|
|
5
6
|
import { SdkProvider } from "aws-cdk/lib/api/aws-auth/sdk-provider.js";
|
|
6
7
|
import { DeployStackResult, DeploymentMethod } from "./deploy-stack.js";
|
|
8
|
+
import { ToolkitInfo } from "aws-cdk/lib/api/toolkit-info.js";
|
|
7
9
|
import { Template, ResourcesToImport, ResourceIdentifierSummaries } from "aws-cdk/lib/api/util/cloudformation.js";
|
|
8
10
|
import { StackActivityProgress } from "aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.js";
|
|
9
11
|
/**
|
|
@@ -203,6 +205,18 @@ export interface BuildStackAssetsOptions {
|
|
|
203
205
|
*/
|
|
204
206
|
readonly buildOptions?: BuildAssetsOptions;
|
|
205
207
|
}
|
|
208
|
+
interface PublishStackAssetsOptions {
|
|
209
|
+
/**
|
|
210
|
+
* Whether to build assets before publishing.
|
|
211
|
+
*
|
|
212
|
+
* @default true To remain backward compatible.
|
|
213
|
+
*/
|
|
214
|
+
readonly buildAssets?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Options to pass on to `publishAsests()` function
|
|
217
|
+
*/
|
|
218
|
+
readonly publishOptions?: Omit<PublishAssetsOptions, "buildAssets">;
|
|
219
|
+
}
|
|
206
220
|
export interface DestroyStackOptions {
|
|
207
221
|
stack: cxapi.CloudFormationStackArtifact;
|
|
208
222
|
deployName?: string;
|
|
@@ -264,7 +278,7 @@ export declare class CloudFormationDeployments {
|
|
|
264
278
|
* - SDK loaded with the right credentials for calling `CreateChangeSet`.
|
|
265
279
|
* - The Execution Role that should be passed to CloudFormation.
|
|
266
280
|
*/
|
|
267
|
-
|
|
281
|
+
prepareSdkFor(stack: cxapi.CloudFormationStackArtifact, roleArn?: string, mode?: Mode): Promise<PreparedSdkForEnvironment>;
|
|
268
282
|
/**
|
|
269
283
|
* Build a stack's assets.
|
|
270
284
|
*/
|
|
@@ -272,9 +286,10 @@ export declare class CloudFormationDeployments {
|
|
|
272
286
|
/**
|
|
273
287
|
* Publish all asset manifests that are referenced by the given stack
|
|
274
288
|
*/
|
|
275
|
-
|
|
289
|
+
publishStackAssets(stack: cxapi.CloudFormationStackArtifact, toolkitInfo: ToolkitInfo, options?: PublishStackAssetsOptions): Promise<void>;
|
|
276
290
|
/**
|
|
277
291
|
* Validate that the bootstrap stack has the right version for this stack
|
|
278
292
|
*/
|
|
279
293
|
private validateBootstrapStackVersion;
|
|
280
294
|
}
|
|
295
|
+
export {};
|
package/cli/commands/deploy.js
CHANGED
|
@@ -10,10 +10,9 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
10
10
|
const React = await import("react");
|
|
11
11
|
const { printDeploymentResults } = await import("../ui/deploy.js");
|
|
12
12
|
const { createSpinner } = await import("../spinner.js");
|
|
13
|
-
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
14
13
|
const { dim, blue, bold } = await import("colorette");
|
|
15
14
|
const { useProject } = await import("../../project.js");
|
|
16
|
-
const { Stacks } = await import("../../stacks/index.js");
|
|
15
|
+
const { loadAssembly, Stacks } = await import("../../stacks/index.js");
|
|
17
16
|
const { render } = await import("ink");
|
|
18
17
|
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
19
18
|
const { Colors } = await import("../colors.js");
|
|
@@ -23,9 +22,12 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
23
22
|
console.log();
|
|
24
23
|
console.log(` ${Colors.primary(`➜`)} ${bold(`Stage:`)} ${dim(project.config.stage)}`);
|
|
25
24
|
console.log();
|
|
25
|
+
// Generate cloud assembly
|
|
26
|
+
// - if --from is specified, we will use the existing cloud assembly
|
|
27
|
+
// - if --from is not specified, we will call synth to generate
|
|
26
28
|
const assembly = await (async function () {
|
|
27
29
|
if (args.from) {
|
|
28
|
-
const result =
|
|
30
|
+
const result = await loadAssembly(args.from);
|
|
29
31
|
return result;
|
|
30
32
|
}
|
|
31
33
|
const spinner = createSpinner({
|
package/cli/commands/remove.js
CHANGED
|
@@ -3,10 +3,9 @@ export const remove = (program) => program.command("remove [filter]", "Remove yo
|
|
|
3
3
|
describe: "Optionally filter stacks to remove",
|
|
4
4
|
}), async (args) => {
|
|
5
5
|
const React = await import("react");
|
|
6
|
-
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
7
6
|
const { dim, blue, bold } = await import("colorette");
|
|
8
7
|
const { useProject } = await import("../../project.js");
|
|
9
|
-
const { Stacks } = await import("../../stacks/index.js");
|
|
8
|
+
const { loadAssembly, Stacks } = await import("../../stacks/index.js");
|
|
10
9
|
const { render } = await import("ink");
|
|
11
10
|
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
12
11
|
const { printDeploymentResults } = await import("../ui/deploy.js");
|
|
@@ -19,7 +18,7 @@ export const remove = (program) => program.command("remove [filter]", "Remove yo
|
|
|
19
18
|
console.log();
|
|
20
19
|
const assembly = await (async function () {
|
|
21
20
|
if (args.from) {
|
|
22
|
-
const result =
|
|
21
|
+
const result = await loadAssembly(args.from);
|
|
23
22
|
return result;
|
|
24
23
|
}
|
|
25
24
|
return await Stacks.synth({
|
package/config.d.ts
CHANGED
package/config.js
CHANGED
|
@@ -30,7 +30,7 @@ export var Config;
|
|
|
30
30
|
}
|
|
31
31
|
Config.parameters = parameters;
|
|
32
32
|
function envFor(input) {
|
|
33
|
-
return `SST_${input.type}_${input.prop}_${input.id}`;
|
|
33
|
+
return `SST_${input.type}_${input.prop}_${normalizeID(input.id)}`;
|
|
34
34
|
}
|
|
35
35
|
Config.envFor = envFor;
|
|
36
36
|
function pathFor(input) {
|
|
@@ -64,7 +64,7 @@ export var Config;
|
|
|
64
64
|
const env = {
|
|
65
65
|
SST_APP: project.config.name,
|
|
66
66
|
SST_STAGE: project.config.stage,
|
|
67
|
-
...pipe(parameters, map((p) => [
|
|
67
|
+
...pipe(parameters, map((p) => [envFor(p), p.value]), Object.fromEntries),
|
|
68
68
|
};
|
|
69
69
|
return env;
|
|
70
70
|
}
|
|
@@ -168,6 +168,6 @@ function parse(ssmName) {
|
|
|
168
168
|
return {
|
|
169
169
|
type: parts[4],
|
|
170
170
|
id: parts[5],
|
|
171
|
-
prop: parts.slice(6),
|
|
171
|
+
prop: parts.slice(6).join("/"),
|
|
172
172
|
};
|
|
173
173
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sst",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.36",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sst": "cli/sst.js"
|
|
6
6
|
},
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@aws-cdk/region-info": "2.55.0",
|
|
33
33
|
"@aws-sdk/client-cloudformation": "3.208.0",
|
|
34
34
|
"@aws-sdk/client-iot": "3.208.0",
|
|
35
|
+
"@aws-sdk/client-iot-data-plane": "3.208.0",
|
|
35
36
|
"@aws-sdk/client-lambda": "3.208.0",
|
|
36
37
|
"@aws-sdk/client-rds-data": "3.208.0",
|
|
37
38
|
"@aws-sdk/client-s3": "3.208.0",
|
package/sst.mjs
CHANGED
|
@@ -2140,6 +2140,17 @@ var init_iot2 = __esm({
|
|
|
2140
2140
|
}
|
|
2141
2141
|
});
|
|
2142
2142
|
|
|
2143
|
+
// src/stacks/assembly.ts
|
|
2144
|
+
async function loadAssembly(from) {
|
|
2145
|
+
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
2146
|
+
return new CloudAssembly(from);
|
|
2147
|
+
}
|
|
2148
|
+
var init_assembly = __esm({
|
|
2149
|
+
"src/stacks/assembly.ts"() {
|
|
2150
|
+
"use strict";
|
|
2151
|
+
}
|
|
2152
|
+
});
|
|
2153
|
+
|
|
2143
2154
|
// src/stacks/monitor.ts
|
|
2144
2155
|
import {
|
|
2145
2156
|
CloudFormationClient,
|
|
@@ -3128,7 +3139,69 @@ var init_cloudformation_deployments = __esm({
|
|
|
3128
3139
|
}
|
|
3129
3140
|
});
|
|
3130
3141
|
|
|
3142
|
+
// src/cdk/cloudformation-deployments-wrapper.ts
|
|
3143
|
+
var cloudformation_deployments_wrapper_exports = {};
|
|
3144
|
+
__export(cloudformation_deployments_wrapper_exports, {
|
|
3145
|
+
publishAssets: () => publishAssets3
|
|
3146
|
+
});
|
|
3147
|
+
import { ToolkitInfo as ToolkitInfo2 } from "aws-cdk/lib/api/toolkit-info.js";
|
|
3148
|
+
async function publishAssets3(deployment, options) {
|
|
3149
|
+
const toolkitInfo = await useToolkitInfo().lookup(deployment, options);
|
|
3150
|
+
await deployment.publishStackAssets(options.stack, toolkitInfo, {
|
|
3151
|
+
buildAssets: options.buildAssets ?? true,
|
|
3152
|
+
publishOptions: {
|
|
3153
|
+
quiet: options.quiet,
|
|
3154
|
+
parallel: options.assetParallelism
|
|
3155
|
+
}
|
|
3156
|
+
});
|
|
3157
|
+
}
|
|
3158
|
+
var useToolkitInfo;
|
|
3159
|
+
var init_cloudformation_deployments_wrapper = __esm({
|
|
3160
|
+
"src/cdk/cloudformation-deployments-wrapper.ts"() {
|
|
3161
|
+
"use strict";
|
|
3162
|
+
init_context();
|
|
3163
|
+
useToolkitInfo = Context.memo(() => {
|
|
3164
|
+
const state2 = /* @__PURE__ */ new Map();
|
|
3165
|
+
return {
|
|
3166
|
+
async lookup(deployment, options) {
|
|
3167
|
+
if (state2.has(deployment))
|
|
3168
|
+
return state2.get(deployment);
|
|
3169
|
+
const { stackSdk, resolvedEnvironment } = await deployment.prepareSdkFor(options.stack, options.roleArn);
|
|
3170
|
+
const toolkitInfo = await ToolkitInfo2.lookup(
|
|
3171
|
+
resolvedEnvironment,
|
|
3172
|
+
stackSdk,
|
|
3173
|
+
options.toolkitStackName
|
|
3174
|
+
);
|
|
3175
|
+
state2.set(deployment, toolkitInfo);
|
|
3176
|
+
return toolkitInfo;
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
});
|
|
3180
|
+
}
|
|
3181
|
+
});
|
|
3182
|
+
|
|
3131
3183
|
// src/stacks/deploy.ts
|
|
3184
|
+
async function publishAssets4(stacks) {
|
|
3185
|
+
Logger.debug("Publishing assets");
|
|
3186
|
+
const provider = await useAWSProvider();
|
|
3187
|
+
const { CloudFormationDeployments: CloudFormationDeployments2 } = await Promise.resolve().then(() => (init_cloudformation_deployments(), cloudformation_deployments_exports));
|
|
3188
|
+
const { publishAssets: publishAssets5 } = await Promise.resolve().then(() => (init_cloudformation_deployments_wrapper(), cloudformation_deployments_wrapper_exports));
|
|
3189
|
+
const deployment = new CloudFormationDeployments2({
|
|
3190
|
+
sdkProvider: provider
|
|
3191
|
+
});
|
|
3192
|
+
for (const stack of stacks) {
|
|
3193
|
+
await publishAssets5(
|
|
3194
|
+
deployment,
|
|
3195
|
+
{
|
|
3196
|
+
stack,
|
|
3197
|
+
quiet: true,
|
|
3198
|
+
deploymentMethod: {
|
|
3199
|
+
method: "direct"
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
);
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3132
3205
|
async function deployMany(stacks) {
|
|
3133
3206
|
Logger.debug(
|
|
3134
3207
|
"Deploying stacks",
|
|
@@ -3139,11 +3212,7 @@ async function deployMany(stacks) {
|
|
|
3139
3212
|
const bus = useBus();
|
|
3140
3213
|
const complete = /* @__PURE__ */ new Set();
|
|
3141
3214
|
const todo = new Set(stacks.map((s) => s.id));
|
|
3142
|
-
const pending = /* @__PURE__ */ new Set();
|
|
3143
3215
|
const results = {};
|
|
3144
|
-
bus.subscribe("stack.updated", (evt) => {
|
|
3145
|
-
pending.add(evt.properties.stackID);
|
|
3146
|
-
});
|
|
3147
3216
|
return new Promise((resolve) => {
|
|
3148
3217
|
async function trigger() {
|
|
3149
3218
|
for (const stack of stacks) {
|
|
@@ -3303,7 +3372,7 @@ var init_bootstrap = __esm({
|
|
|
3303
3372
|
STACK_NAME = "SSTBootstrap";
|
|
3304
3373
|
OUTPUT_VERSION = "Version";
|
|
3305
3374
|
OUTPUT_BUCKET = "BucketName";
|
|
3306
|
-
LATEST_VERSION = "
|
|
3375
|
+
LATEST_VERSION = "5";
|
|
3307
3376
|
__dirname = url3.fileURLToPath(new URL(".", import.meta.url));
|
|
3308
3377
|
useBootstrap = Context.memo(async () => {
|
|
3309
3378
|
Logger.debug("Initializing bootstrap context");
|
|
@@ -3332,7 +3401,7 @@ var init_bootstrap = __esm({
|
|
|
3332
3401
|
const fn = new Function(stack, "MetadataHandler", {
|
|
3333
3402
|
code: Code.fromAsset(path8.resolve(__dirname, "support/bootstrap-metadata-function")),
|
|
3334
3403
|
handler: "index.handler",
|
|
3335
|
-
runtime: Runtime.
|
|
3404
|
+
runtime: Runtime.NODEJS_18_X,
|
|
3336
3405
|
initialPolicy: [
|
|
3337
3406
|
new PolicyStatement({
|
|
3338
3407
|
actions: ["cloudformation:DescribeStacks"],
|
|
@@ -3341,6 +3410,10 @@ var init_bootstrap = __esm({
|
|
|
3341
3410
|
new PolicyStatement({
|
|
3342
3411
|
actions: ["s3:PutObject", "s3:DeleteObject"],
|
|
3343
3412
|
resources: [bucket.bucketArn + "/*"]
|
|
3413
|
+
}),
|
|
3414
|
+
new PolicyStatement({
|
|
3415
|
+
actions: ["iot:Publish"],
|
|
3416
|
+
resources: [`arn:${stack.partition}:iot:${stack.region}:${stack.account}:topic//sst/*`]
|
|
3344
3417
|
})
|
|
3345
3418
|
]
|
|
3346
3419
|
});
|
|
@@ -4311,11 +4384,7 @@ async function removeMany(stacks) {
|
|
|
4311
4384
|
const bus = useBus();
|
|
4312
4385
|
const complete = /* @__PURE__ */ new Set();
|
|
4313
4386
|
const todo = new Set(stacks.map((s) => s.id));
|
|
4314
|
-
const pending = /* @__PURE__ */ new Set();
|
|
4315
4387
|
const results = {};
|
|
4316
|
-
bus.subscribe("stack.updated", (evt) => {
|
|
4317
|
-
pending.add(evt.properties.stackID);
|
|
4318
|
-
});
|
|
4319
4388
|
return new Promise((resolve) => {
|
|
4320
4389
|
async function trigger() {
|
|
4321
4390
|
for (const stack of stacks) {
|
|
@@ -4407,9 +4476,11 @@ __export(stacks_exports, {
|
|
|
4407
4476
|
isPending: () => isPending,
|
|
4408
4477
|
isSuccess: () => isSuccess,
|
|
4409
4478
|
load: () => load,
|
|
4479
|
+
loadAssembly: () => loadAssembly,
|
|
4410
4480
|
metadata: () => metadata,
|
|
4411
4481
|
metadataForStack: () => metadataForStack,
|
|
4412
4482
|
monitor: () => monitor,
|
|
4483
|
+
publishAssets: () => publishAssets4,
|
|
4413
4484
|
remove: () => remove,
|
|
4414
4485
|
removeMany: () => removeMany,
|
|
4415
4486
|
synth: () => synth,
|
|
@@ -4418,6 +4489,7 @@ __export(stacks_exports, {
|
|
|
4418
4489
|
var init_stacks = __esm({
|
|
4419
4490
|
"src/stacks/index.ts"() {
|
|
4420
4491
|
"use strict";
|
|
4492
|
+
init_assembly();
|
|
4421
4493
|
init_build();
|
|
4422
4494
|
init_deploy();
|
|
4423
4495
|
init_metadata();
|
|
@@ -5255,7 +5327,7 @@ function parse(ssmName) {
|
|
|
5255
5327
|
return {
|
|
5256
5328
|
type: parts[4],
|
|
5257
5329
|
id: parts[5],
|
|
5258
|
-
prop: parts.slice(6)
|
|
5330
|
+
prop: parts.slice(6).join("/")
|
|
5259
5331
|
};
|
|
5260
5332
|
}
|
|
5261
5333
|
var Config, FALLBACK_STAGE, SECRET_UPDATED_AT_ENV, PREFIX;
|
|
@@ -5290,7 +5362,7 @@ var init_config = __esm({
|
|
|
5290
5362
|
}
|
|
5291
5363
|
Config2.parameters = parameters;
|
|
5292
5364
|
function envFor(input) {
|
|
5293
|
-
return `SST_${input.type}_${input.prop}_${input.id}`;
|
|
5365
|
+
return `SST_${input.type}_${input.prop}_${normalizeID(input.id)}`;
|
|
5294
5366
|
}
|
|
5295
5367
|
Config2.envFor = envFor;
|
|
5296
5368
|
function pathFor(input) {
|
|
@@ -5326,7 +5398,7 @@ var init_config = __esm({
|
|
|
5326
5398
|
SST_STAGE: project.config.stage,
|
|
5327
5399
|
...pipe(
|
|
5328
5400
|
parameters2,
|
|
5329
|
-
map((p) => [
|
|
5401
|
+
map((p) => [envFor(p), p.value]),
|
|
5330
5402
|
Object.fromEntries
|
|
5331
5403
|
)
|
|
5332
5404
|
};
|
|
@@ -5914,10 +5986,9 @@ var deploy2 = (program2) => program2.command(
|
|
|
5914
5986
|
const React3 = await import("react");
|
|
5915
5987
|
const { printDeploymentResults: printDeploymentResults2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
5916
5988
|
const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
|
5917
|
-
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
5918
5989
|
const { dim: dim3, blue: blue5, bold: bold2 } = await import("colorette");
|
|
5919
5990
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
5920
|
-
const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
5991
|
+
const { loadAssembly: loadAssembly2, Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
5921
5992
|
const { render } = await import("ink");
|
|
5922
5993
|
const { DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
5923
5994
|
const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
@@ -5933,7 +6004,7 @@ var deploy2 = (program2) => program2.command(
|
|
|
5933
6004
|
console.log();
|
|
5934
6005
|
const assembly = await async function() {
|
|
5935
6006
|
if (args.from) {
|
|
5936
|
-
const result2 =
|
|
6007
|
+
const result2 = await loadAssembly2(args.from);
|
|
5937
6008
|
return result2;
|
|
5938
6009
|
}
|
|
5939
6010
|
const spinner = createSpinner2({
|
|
@@ -5978,10 +6049,9 @@ var remove2 = (program2) => program2.command(
|
|
|
5978
6049
|
}),
|
|
5979
6050
|
async (args) => {
|
|
5980
6051
|
const React3 = await import("react");
|
|
5981
|
-
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
5982
6052
|
const { dim: dim3, blue: blue5, bold: bold2 } = await import("colorette");
|
|
5983
6053
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
5984
|
-
const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
6054
|
+
const { loadAssembly: loadAssembly2, Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
5985
6055
|
const { render } = await import("ink");
|
|
5986
6056
|
const { DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
5987
6057
|
const { printDeploymentResults: printDeploymentResults2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
@@ -5998,7 +6068,7 @@ var remove2 = (program2) => program2.command(
|
|
|
5998
6068
|
console.log();
|
|
5999
6069
|
const assembly = await async function() {
|
|
6000
6070
|
if (args.from) {
|
|
6001
|
-
const result =
|
|
6071
|
+
const result = await loadAssembly2(args.from);
|
|
6002
6072
|
return result;
|
|
6003
6073
|
}
|
|
6004
6074
|
return await Stacks.synth({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadAssembly(from: string): Promise<import("aws-cdk-lib/cx-api").CloudAssembly>;
|
package/stacks/deploy.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CloudFormationStackArtifact } from "aws-cdk-lib/cx-api";
|
|
2
2
|
import { StackDeploymentResult } from "./monitor.js";
|
|
3
|
+
export declare function publishAssets(stacks: CloudFormationStackArtifact[]): Promise<void>;
|
|
3
4
|
export declare function deployMany(stacks: CloudFormationStackArtifact[]): Promise<Record<string, {
|
|
4
5
|
status: string;
|
|
5
6
|
outputs: Record<string, string>;
|
package/stacks/deploy.js
CHANGED
|
@@ -2,6 +2,25 @@ import { useBus } from "../bus.js";
|
|
|
2
2
|
import { useAWSProvider } from "../credentials.js";
|
|
3
3
|
import { Logger } from "../logger.js";
|
|
4
4
|
import { isFailed, monitor } from "./monitor.js";
|
|
5
|
+
export async function publishAssets(stacks) {
|
|
6
|
+
// TODO: use memo in cloudformation-deployments.ts
|
|
7
|
+
Logger.debug("Publishing assets");
|
|
8
|
+
const provider = await useAWSProvider();
|
|
9
|
+
const { CloudFormationDeployments } = await import("../cdk/cloudformation-deployments.js");
|
|
10
|
+
const { publishAssets } = await import("../cdk/cloudformation-deployments-wrapper.js");
|
|
11
|
+
const deployment = new CloudFormationDeployments({
|
|
12
|
+
sdkProvider: provider,
|
|
13
|
+
});
|
|
14
|
+
for (const stack of stacks) {
|
|
15
|
+
await publishAssets(deployment, {
|
|
16
|
+
stack: stack,
|
|
17
|
+
quiet: true,
|
|
18
|
+
deploymentMethod: {
|
|
19
|
+
method: "direct",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
5
24
|
export async function deployMany(stacks) {
|
|
6
25
|
Logger.debug("Deploying stacks", stacks.map((s) => s.stackName));
|
|
7
26
|
const { CloudFormationStackArtifact } = await import("aws-cdk-lib/cx-api");
|
|
@@ -9,11 +28,7 @@ export async function deployMany(stacks) {
|
|
|
9
28
|
const bus = useBus();
|
|
10
29
|
const complete = new Set();
|
|
11
30
|
const todo = new Set(stacks.map((s) => s.id));
|
|
12
|
-
const pending = new Set();
|
|
13
31
|
const results = {};
|
|
14
|
-
bus.subscribe("stack.updated", (evt) => {
|
|
15
|
-
pending.add(evt.properties.stackID);
|
|
16
|
-
});
|
|
17
32
|
return new Promise((resolve) => {
|
|
18
33
|
async function trigger() {
|
|
19
34
|
for (const stack of stacks) {
|
package/stacks/index.d.ts
CHANGED
package/stacks/index.js
CHANGED
package/stacks/metadata.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { Metadata } from "../constructs/Metadata.js";
|
|
|
2
2
|
declare module "../bus.js" {
|
|
3
3
|
interface Events {
|
|
4
4
|
"stacks.metadata": Awaited<ReturnType<typeof metadata>>;
|
|
5
|
+
"stacks.metadata.updated": {};
|
|
6
|
+
"stacks.metadata.deleted": {};
|
|
5
7
|
}
|
|
6
8
|
}
|
|
7
9
|
export declare function metadata(): Promise<Record<string, Metadata[]>>;
|
package/stacks/remove.js
CHANGED
|
@@ -8,11 +8,7 @@ export async function removeMany(stacks) {
|
|
|
8
8
|
const bus = useBus();
|
|
9
9
|
const complete = new Set();
|
|
10
10
|
const todo = new Set(stacks.map((s) => s.id));
|
|
11
|
-
const pending = new Set();
|
|
12
11
|
const results = {};
|
|
13
|
-
bus.subscribe("stack.updated", (evt) => {
|
|
14
|
-
pending.add(evt.properties.stackID);
|
|
15
|
-
});
|
|
16
12
|
return new Promise((resolve) => {
|
|
17
13
|
async function trigger() {
|
|
18
14
|
for (const stack of stacks) {
|