sst 2.0.0-rc.34 → 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/runtime/iot.js +3 -0
- package/sst.mjs +92 -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/runtime/iot.js
CHANGED
|
@@ -11,4 +11,7 @@ export const useIOTBridge = Context.memo(async () => {
|
|
|
11
11
|
bus.subscribe("function.error", async (evt) => {
|
|
12
12
|
iot.publish(topic, "function.error", evt.properties);
|
|
13
13
|
});
|
|
14
|
+
bus.subscribe("function.ack", async (evt) => {
|
|
15
|
+
iot.publish(topic, "function.ack", evt.properties);
|
|
16
|
+
});
|
|
14
17
|
});
|
package/sst.mjs
CHANGED
|
@@ -2133,10 +2133,24 @@ var init_iot2 = __esm({
|
|
|
2133
2133
|
bus.subscribe("function.error", async (evt) => {
|
|
2134
2134
|
iot2.publish(topic, "function.error", evt.properties);
|
|
2135
2135
|
});
|
|
2136
|
+
bus.subscribe("function.ack", async (evt) => {
|
|
2137
|
+
iot2.publish(topic, "function.ack", evt.properties);
|
|
2138
|
+
});
|
|
2136
2139
|
});
|
|
2137
2140
|
}
|
|
2138
2141
|
});
|
|
2139
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
|
+
|
|
2140
2154
|
// src/stacks/monitor.ts
|
|
2141
2155
|
import {
|
|
2142
2156
|
CloudFormationClient,
|
|
@@ -3125,7 +3139,69 @@ var init_cloudformation_deployments = __esm({
|
|
|
3125
3139
|
}
|
|
3126
3140
|
});
|
|
3127
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
|
+
|
|
3128
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
|
+
}
|
|
3129
3205
|
async function deployMany(stacks) {
|
|
3130
3206
|
Logger.debug(
|
|
3131
3207
|
"Deploying stacks",
|
|
@@ -3136,11 +3212,7 @@ async function deployMany(stacks) {
|
|
|
3136
3212
|
const bus = useBus();
|
|
3137
3213
|
const complete = /* @__PURE__ */ new Set();
|
|
3138
3214
|
const todo = new Set(stacks.map((s) => s.id));
|
|
3139
|
-
const pending = /* @__PURE__ */ new Set();
|
|
3140
3215
|
const results = {};
|
|
3141
|
-
bus.subscribe("stack.updated", (evt) => {
|
|
3142
|
-
pending.add(evt.properties.stackID);
|
|
3143
|
-
});
|
|
3144
3216
|
return new Promise((resolve) => {
|
|
3145
3217
|
async function trigger() {
|
|
3146
3218
|
for (const stack of stacks) {
|
|
@@ -3300,7 +3372,7 @@ var init_bootstrap = __esm({
|
|
|
3300
3372
|
STACK_NAME = "SSTBootstrap";
|
|
3301
3373
|
OUTPUT_VERSION = "Version";
|
|
3302
3374
|
OUTPUT_BUCKET = "BucketName";
|
|
3303
|
-
LATEST_VERSION = "
|
|
3375
|
+
LATEST_VERSION = "5";
|
|
3304
3376
|
__dirname = url3.fileURLToPath(new URL(".", import.meta.url));
|
|
3305
3377
|
useBootstrap = Context.memo(async () => {
|
|
3306
3378
|
Logger.debug("Initializing bootstrap context");
|
|
@@ -3329,7 +3401,7 @@ var init_bootstrap = __esm({
|
|
|
3329
3401
|
const fn = new Function(stack, "MetadataHandler", {
|
|
3330
3402
|
code: Code.fromAsset(path8.resolve(__dirname, "support/bootstrap-metadata-function")),
|
|
3331
3403
|
handler: "index.handler",
|
|
3332
|
-
runtime: Runtime.
|
|
3404
|
+
runtime: Runtime.NODEJS_18_X,
|
|
3333
3405
|
initialPolicy: [
|
|
3334
3406
|
new PolicyStatement({
|
|
3335
3407
|
actions: ["cloudformation:DescribeStacks"],
|
|
@@ -3338,6 +3410,10 @@ var init_bootstrap = __esm({
|
|
|
3338
3410
|
new PolicyStatement({
|
|
3339
3411
|
actions: ["s3:PutObject", "s3:DeleteObject"],
|
|
3340
3412
|
resources: [bucket.bucketArn + "/*"]
|
|
3413
|
+
}),
|
|
3414
|
+
new PolicyStatement({
|
|
3415
|
+
actions: ["iot:Publish"],
|
|
3416
|
+
resources: [`arn:${stack.partition}:iot:${stack.region}:${stack.account}:topic//sst/*`]
|
|
3341
3417
|
})
|
|
3342
3418
|
]
|
|
3343
3419
|
});
|
|
@@ -4308,11 +4384,7 @@ async function removeMany(stacks) {
|
|
|
4308
4384
|
const bus = useBus();
|
|
4309
4385
|
const complete = /* @__PURE__ */ new Set();
|
|
4310
4386
|
const todo = new Set(stacks.map((s) => s.id));
|
|
4311
|
-
const pending = /* @__PURE__ */ new Set();
|
|
4312
4387
|
const results = {};
|
|
4313
|
-
bus.subscribe("stack.updated", (evt) => {
|
|
4314
|
-
pending.add(evt.properties.stackID);
|
|
4315
|
-
});
|
|
4316
4388
|
return new Promise((resolve) => {
|
|
4317
4389
|
async function trigger() {
|
|
4318
4390
|
for (const stack of stacks) {
|
|
@@ -4404,9 +4476,11 @@ __export(stacks_exports, {
|
|
|
4404
4476
|
isPending: () => isPending,
|
|
4405
4477
|
isSuccess: () => isSuccess,
|
|
4406
4478
|
load: () => load,
|
|
4479
|
+
loadAssembly: () => loadAssembly,
|
|
4407
4480
|
metadata: () => metadata,
|
|
4408
4481
|
metadataForStack: () => metadataForStack,
|
|
4409
4482
|
monitor: () => monitor,
|
|
4483
|
+
publishAssets: () => publishAssets4,
|
|
4410
4484
|
remove: () => remove,
|
|
4411
4485
|
removeMany: () => removeMany,
|
|
4412
4486
|
synth: () => synth,
|
|
@@ -4415,6 +4489,7 @@ __export(stacks_exports, {
|
|
|
4415
4489
|
var init_stacks = __esm({
|
|
4416
4490
|
"src/stacks/index.ts"() {
|
|
4417
4491
|
"use strict";
|
|
4492
|
+
init_assembly();
|
|
4418
4493
|
init_build();
|
|
4419
4494
|
init_deploy();
|
|
4420
4495
|
init_metadata();
|
|
@@ -5252,7 +5327,7 @@ function parse(ssmName) {
|
|
|
5252
5327
|
return {
|
|
5253
5328
|
type: parts[4],
|
|
5254
5329
|
id: parts[5],
|
|
5255
|
-
prop: parts.slice(6)
|
|
5330
|
+
prop: parts.slice(6).join("/")
|
|
5256
5331
|
};
|
|
5257
5332
|
}
|
|
5258
5333
|
var Config, FALLBACK_STAGE, SECRET_UPDATED_AT_ENV, PREFIX;
|
|
@@ -5287,7 +5362,7 @@ var init_config = __esm({
|
|
|
5287
5362
|
}
|
|
5288
5363
|
Config2.parameters = parameters;
|
|
5289
5364
|
function envFor(input) {
|
|
5290
|
-
return `SST_${input.type}_${input.prop}_${input.id}`;
|
|
5365
|
+
return `SST_${input.type}_${input.prop}_${normalizeID(input.id)}`;
|
|
5291
5366
|
}
|
|
5292
5367
|
Config2.envFor = envFor;
|
|
5293
5368
|
function pathFor(input) {
|
|
@@ -5323,7 +5398,7 @@ var init_config = __esm({
|
|
|
5323
5398
|
SST_STAGE: project.config.stage,
|
|
5324
5399
|
...pipe(
|
|
5325
5400
|
parameters2,
|
|
5326
|
-
map((p) => [
|
|
5401
|
+
map((p) => [envFor(p), p.value]),
|
|
5327
5402
|
Object.fromEntries
|
|
5328
5403
|
)
|
|
5329
5404
|
};
|
|
@@ -5911,10 +5986,9 @@ var deploy2 = (program2) => program2.command(
|
|
|
5911
5986
|
const React3 = await import("react");
|
|
5912
5987
|
const { printDeploymentResults: printDeploymentResults2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
5913
5988
|
const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
|
5914
|
-
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
5915
5989
|
const { dim: dim3, blue: blue5, bold: bold2 } = await import("colorette");
|
|
5916
5990
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
5917
|
-
const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
5991
|
+
const { loadAssembly: loadAssembly2, Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
5918
5992
|
const { render } = await import("ink");
|
|
5919
5993
|
const { DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
5920
5994
|
const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
@@ -5930,7 +6004,7 @@ var deploy2 = (program2) => program2.command(
|
|
|
5930
6004
|
console.log();
|
|
5931
6005
|
const assembly = await async function() {
|
|
5932
6006
|
if (args.from) {
|
|
5933
|
-
const result2 =
|
|
6007
|
+
const result2 = await loadAssembly2(args.from);
|
|
5934
6008
|
return result2;
|
|
5935
6009
|
}
|
|
5936
6010
|
const spinner = createSpinner2({
|
|
@@ -5975,10 +6049,9 @@ var remove2 = (program2) => program2.command(
|
|
|
5975
6049
|
}),
|
|
5976
6050
|
async (args) => {
|
|
5977
6051
|
const React3 = await import("react");
|
|
5978
|
-
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
5979
6052
|
const { dim: dim3, blue: blue5, bold: bold2 } = await import("colorette");
|
|
5980
6053
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
5981
|
-
const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
6054
|
+
const { loadAssembly: loadAssembly2, Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
5982
6055
|
const { render } = await import("ink");
|
|
5983
6056
|
const { DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
5984
6057
|
const { printDeploymentResults: printDeploymentResults2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
@@ -5995,7 +6068,7 @@ var remove2 = (program2) => program2.command(
|
|
|
5995
6068
|
console.log();
|
|
5996
6069
|
const assembly = await async function() {
|
|
5997
6070
|
if (args.from) {
|
|
5998
|
-
const result =
|
|
6071
|
+
const result = await loadAssembly2(args.from);
|
|
5999
6072
|
return result;
|
|
6000
6073
|
}
|
|
6001
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) {
|