sst 2.5.3 → 2.5.5
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/cli/commands/bind.js +89 -64
- package/cli/commands/version.js +1 -0
- package/constructs/Api.d.ts +1 -1
- package/constructs/Api.js +1 -1
- package/constructs/ApiGatewayV1Api.d.ts +1 -1
- package/constructs/ApiGatewayV1Api.js +4 -2
- package/constructs/AppSyncApi.d.ts +1 -1
- package/constructs/AppSyncApi.js +1 -1
- package/constructs/Auth.d.ts +1 -1
- package/constructs/Auth.js +1 -1
- package/constructs/Bucket.d.ts +1 -1
- package/constructs/Bucket.js +1 -1
- package/constructs/Cognito.d.ts +1 -1
- package/constructs/Cognito.js +1 -1
- package/constructs/Cron.d.ts +1 -1
- package/constructs/Cron.js +1 -1
- package/constructs/EventBus.d.ts +1 -1
- package/constructs/EventBus.js +1 -1
- package/constructs/Function.d.ts +1 -1
- package/constructs/Function.js +1 -1
- package/constructs/Job.d.ts +38 -2
- package/constructs/Job.js +4 -2
- package/constructs/KinesisStream.d.ts +1 -1
- package/constructs/KinesisStream.js +1 -1
- package/constructs/Parameter.d.ts +1 -1
- package/constructs/Parameter.js +1 -1
- package/constructs/Queue.d.ts +1 -1
- package/constructs/Queue.js +1 -1
- package/constructs/RDS.d.ts +2 -2
- package/constructs/RDS.js +1 -1
- package/constructs/Script.d.ts +2 -2
- package/constructs/Script.js +1 -1
- package/constructs/Secret.d.ts +1 -1
- package/constructs/Secret.js +1 -1
- package/constructs/Stack.d.ts +1 -1
- package/constructs/Stack.js +1 -1
- package/constructs/StaticSite.d.ts +2 -2
- package/constructs/StaticSite.js +1 -1
- package/constructs/Table.d.ts +1 -1
- package/constructs/Table.js +1 -1
- package/constructs/Topic.d.ts +1 -1
- package/constructs/Topic.js +1 -1
- package/constructs/WebSocketApi.d.ts +1 -1
- package/constructs/WebSocketApi.js +1 -1
- package/constructs/future/Auth.d.ts +1 -1
- package/constructs/future/Auth.js +1 -1
- package/node/graphql/index.d.ts +4 -0
- package/node/graphql/index.js +5 -0
- package/package.json +1 -1
- package/project.d.ts +1 -0
- package/project.js +7 -2
- package/runtime/handlers/go.js +8 -2
- package/runtime/handlers/node.js +2 -2
- package/runtime/handlers.js +8 -3
- package/sst.mjs +110 -70
- package/support/bootstrap-metadata-function/index.mjs +238 -238
- package/support/custom-resources/index.mjs +238 -238
package/constructs/Stack.js
CHANGED
|
@@ -13,7 +13,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
|
13
13
|
* @example
|
|
14
14
|
*
|
|
15
15
|
* ```js
|
|
16
|
-
* import { StackContext } from "
|
|
16
|
+
* import { StackContext } from "sst/constructs";
|
|
17
17
|
*
|
|
18
18
|
* export function MyStack({ stack }: StackContext) {
|
|
19
19
|
* // Define your stack
|
|
@@ -226,7 +226,7 @@ export interface StaticSiteProps {
|
|
|
226
226
|
*/
|
|
227
227
|
id?: string;
|
|
228
228
|
/**
|
|
229
|
-
* Allows you to override default settings this construct uses internally to
|
|
229
|
+
* Allows you to override default settings this construct uses internally to create the bucket
|
|
230
230
|
*
|
|
231
231
|
* @example
|
|
232
232
|
* ```js
|
|
@@ -273,7 +273,7 @@ export interface StaticSiteCdkDistributionProps extends BaseSiteCdkDistributionP
|
|
|
273
273
|
* Deploys a plain HTML website in the `path/to/src` directory.
|
|
274
274
|
*
|
|
275
275
|
* ```js
|
|
276
|
-
* import { StaticSite } from "
|
|
276
|
+
* import { StaticSite } from "sst/constructs";
|
|
277
277
|
*
|
|
278
278
|
* new StaticSite(stack, "Site", {
|
|
279
279
|
* path: "path/to/src",
|
package/constructs/StaticSite.js
CHANGED
|
@@ -34,7 +34,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
|
34
34
|
* Deploys a plain HTML website in the `path/to/src` directory.
|
|
35
35
|
*
|
|
36
36
|
* ```js
|
|
37
|
-
* import { StaticSite } from "
|
|
37
|
+
* import { StaticSite } from "sst/constructs";
|
|
38
38
|
*
|
|
39
39
|
* new StaticSite(stack, "Site", {
|
|
40
40
|
* path: "path/to/src",
|
package/constructs/Table.d.ts
CHANGED
|
@@ -259,7 +259,7 @@ export interface TableProps {
|
|
|
259
259
|
* Deploys a plain HTML website in the `path/to/src` directory.
|
|
260
260
|
*
|
|
261
261
|
* ```js
|
|
262
|
-
* import { Table } from "
|
|
262
|
+
* import { Table } from "sst/constructs";
|
|
263
263
|
*
|
|
264
264
|
* new Table(stack, "Notes", {
|
|
265
265
|
* fields: {
|
package/constructs/Table.js
CHANGED
|
@@ -15,7 +15,7 @@ import { Function as Fn, } from "./Function.js";
|
|
|
15
15
|
* Deploys a plain HTML website in the `path/to/src` directory.
|
|
16
16
|
*
|
|
17
17
|
* ```js
|
|
18
|
-
* import { Table } from "
|
|
18
|
+
* import { Table } from "sst/constructs";
|
|
19
19
|
*
|
|
20
20
|
* new Table(stack, "Notes", {
|
|
21
21
|
* fields: {
|
package/constructs/Topic.d.ts
CHANGED
package/constructs/Topic.js
CHANGED
|
@@ -202,7 +202,7 @@ export interface WebSocketApiCdkStageProps extends Omit<apig.WebSocketStageProps
|
|
|
202
202
|
*
|
|
203
203
|
* @example
|
|
204
204
|
* ```js
|
|
205
|
-
* import { WebSocketApi } from "
|
|
205
|
+
* import { WebSocketApi } from "sst/constructs";
|
|
206
206
|
*
|
|
207
207
|
* new WebSocketApi(stack, "Api", {
|
|
208
208
|
* routes: {
|
|
@@ -18,7 +18,7 @@ import * as apigV2AccessLog from "./util/apiGatewayV2AccessLog.js";
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```js
|
|
21
|
-
* import { WebSocketApi } from "
|
|
21
|
+
* import { WebSocketApi } from "sst/constructs";
|
|
22
22
|
*
|
|
23
23
|
* new WebSocketApi(stack, "Api", {
|
|
24
24
|
* routes: {
|
|
@@ -55,7 +55,7 @@ export interface ApiAttachmentProps {
|
|
|
55
55
|
* SST Auth is a lightweight authentication solution for your applications. With a simple set of configuration you can deploy a function attached to your API that can handle various authentication flows. *
|
|
56
56
|
* @example
|
|
57
57
|
* ```
|
|
58
|
-
* import { Auth } from "
|
|
58
|
+
* import { Auth } from "sst/constructs"
|
|
59
59
|
*
|
|
60
60
|
* new Auth(stack, "auth", {
|
|
61
61
|
* authenticator: "functions/authenticator.handler"
|
|
@@ -9,7 +9,7 @@ import { CustomResource } from "aws-cdk-lib";
|
|
|
9
9
|
* SST Auth is a lightweight authentication solution for your applications. With a simple set of configuration you can deploy a function attached to your API that can handle various authentication flows. *
|
|
10
10
|
* @example
|
|
11
11
|
* ```
|
|
12
|
-
* import { Auth } from "
|
|
12
|
+
* import { Auth } from "sst/constructs"
|
|
13
13
|
*
|
|
14
14
|
* new Auth(stack, "auth", {
|
|
15
15
|
* authenticator: "functions/authenticator.handler"
|
package/node/graphql/index.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ interface GraphQLHandlerConfig<C> {
|
|
|
23
23
|
* Override the GraphQL execute function, sometimes used by plugins
|
|
24
24
|
*/
|
|
25
25
|
execute?: ProcessRequestOptions<any, any>["execute"];
|
|
26
|
+
/**
|
|
27
|
+
* Disable introspection for production
|
|
28
|
+
*/
|
|
29
|
+
disableIntrospection?: boolean;
|
|
26
30
|
}
|
|
27
31
|
export declare function GraphQLHandler<C>(config: GraphQLHandlerConfig<C>): (event: APIGatewayProxyEventV2, context: Context) => Promise<{
|
|
28
32
|
statusCode: any;
|
package/node/graphql/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { specifiedRules, NoSchemaIntrospectionCustomRule, } from "graphql";
|
|
1
2
|
import { getGraphQLParameters, processRequest,
|
|
2
3
|
// @ts-expect-error
|
|
3
4
|
} from "graphql-helix";
|
|
@@ -12,11 +13,15 @@ export function GraphQLHandler(config) {
|
|
|
12
13
|
headers: useHeaders(),
|
|
13
14
|
};
|
|
14
15
|
const { operationName, query, variables } = getGraphQLParameters(request);
|
|
16
|
+
const validationRules = config.disableIntrospection
|
|
17
|
+
? [...specifiedRules, NoSchemaIntrospectionCustomRule]
|
|
18
|
+
: [...specifiedRules];
|
|
15
19
|
const result = await processRequest({
|
|
16
20
|
operationName,
|
|
17
21
|
query,
|
|
18
22
|
variables,
|
|
19
23
|
request,
|
|
24
|
+
validationRules,
|
|
20
25
|
execute: config.execute,
|
|
21
26
|
schema: config.schema,
|
|
22
27
|
formatPayload: config.formatPayload,
|
package/package.json
CHANGED
package/project.d.ts
CHANGED
package/project.js
CHANGED
|
@@ -47,12 +47,16 @@ export async function initProject(globals) {
|
|
|
47
47
|
config.stage ||
|
|
48
48
|
(await usePersonalStage(out)) ||
|
|
49
49
|
(await promptPersonalStage(out));
|
|
50
|
-
const [version, cdkVersion] = await (async () => {
|
|
50
|
+
const [version, cdkVersion, constructsVersion] = await (async () => {
|
|
51
51
|
try {
|
|
52
52
|
const packageJson = JSON.parse(await fs
|
|
53
53
|
.readFile(url.fileURLToPath(new URL("./package.json", import.meta.url)))
|
|
54
54
|
.then((x) => x.toString()));
|
|
55
|
-
return [
|
|
55
|
+
return [
|
|
56
|
+
packageJson.version,
|
|
57
|
+
packageJson.dependencies["aws-cdk-lib"],
|
|
58
|
+
packageJson.dependencies["constructs"],
|
|
59
|
+
];
|
|
56
60
|
}
|
|
57
61
|
catch {
|
|
58
62
|
return ["unknown", "unknown"];
|
|
@@ -61,6 +65,7 @@ export async function initProject(globals) {
|
|
|
61
65
|
const project = {
|
|
62
66
|
version,
|
|
63
67
|
cdkVersion,
|
|
68
|
+
constructsVersion,
|
|
64
69
|
config: {
|
|
65
70
|
...config,
|
|
66
71
|
stage,
|
package/runtime/handlers/go.js
CHANGED
|
@@ -67,7 +67,10 @@ export const useGoHandler = Context.memo(async () => {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
catch (ex) {
|
|
70
|
-
|
|
70
|
+
return {
|
|
71
|
+
type: "error",
|
|
72
|
+
errors: [String(ex)],
|
|
73
|
+
};
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
if (input.mode === "deploy") {
|
|
@@ -85,7 +88,10 @@ export const useGoHandler = Context.memo(async () => {
|
|
|
85
88
|
});
|
|
86
89
|
}
|
|
87
90
|
catch (ex) {
|
|
88
|
-
|
|
91
|
+
return {
|
|
92
|
+
type: "error",
|
|
93
|
+
errors: [String(ex)],
|
|
94
|
+
};
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
return {
|
package/runtime/handlers/node.js
CHANGED
|
@@ -125,8 +125,8 @@ export const useNodeHandler = Context.memo(async () => {
|
|
|
125
125
|
js: [
|
|
126
126
|
`import { createRequire as topLevelCreateRequire } from 'module';`,
|
|
127
127
|
`const require = topLevelCreateRequire(import.meta.url);`,
|
|
128
|
-
`import { fileURLToPath as topLevelFileUrlToPath } from "url"`,
|
|
129
|
-
`const __dirname = topLevelFileUrlToPath(new
|
|
128
|
+
`import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
|
|
129
|
+
`const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
|
|
130
130
|
nodejs.banner || "",
|
|
131
131
|
].join("\n"),
|
|
132
132
|
},
|
package/runtime/handlers.js
CHANGED
|
@@ -56,9 +56,14 @@ export const useRuntimeHandlers = Context.memo(() => {
|
|
|
56
56
|
recursive: true,
|
|
57
57
|
});
|
|
58
58
|
if (mode === "start") {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
try {
|
|
60
|
+
const dir = path.dirname(toPath);
|
|
61
|
+
await fs.mkdir(dir, { recursive: true });
|
|
62
|
+
await fs.symlink(fromPath, toPath);
|
|
63
|
+
}
|
|
64
|
+
catch (ex) {
|
|
65
|
+
Logger.debug("Failed to symlink", fromPath, toPath, ex);
|
|
66
|
+
}
|
|
62
67
|
}
|
|
63
68
|
}));
|
|
64
69
|
}
|
package/sst.mjs
CHANGED
|
@@ -353,14 +353,18 @@ async function initProject(globals) {
|
|
|
353
353
|
}();
|
|
354
354
|
const config = await Promise.resolve(sstConfig.config(globals));
|
|
355
355
|
const stage = globals.stage || config.stage || await usePersonalStage(out) || await promptPersonalStage(out);
|
|
356
|
-
const [version2, cdkVersion] = await (async () => {
|
|
356
|
+
const [version2, cdkVersion, constructsVersion] = await (async () => {
|
|
357
357
|
try {
|
|
358
358
|
const packageJson = JSON.parse(
|
|
359
359
|
await fs4.readFile(
|
|
360
360
|
url2.fileURLToPath(new URL("./package.json", import.meta.url))
|
|
361
361
|
).then((x) => x.toString())
|
|
362
362
|
);
|
|
363
|
-
return [
|
|
363
|
+
return [
|
|
364
|
+
packageJson.version,
|
|
365
|
+
packageJson.dependencies["aws-cdk-lib"],
|
|
366
|
+
packageJson.dependencies["constructs"]
|
|
367
|
+
];
|
|
364
368
|
} catch {
|
|
365
369
|
return ["unknown", "unknown"];
|
|
366
370
|
}
|
|
@@ -368,6 +372,7 @@ async function initProject(globals) {
|
|
|
368
372
|
const project = {
|
|
369
373
|
version: version2,
|
|
370
374
|
cdkVersion,
|
|
375
|
+
constructsVersion,
|
|
371
376
|
config: {
|
|
372
377
|
...config,
|
|
373
378
|
stage,
|
|
@@ -3583,9 +3588,13 @@ var init_handlers = __esm({
|
|
|
3583
3588
|
recursive: true
|
|
3584
3589
|
});
|
|
3585
3590
|
if (mode === "start") {
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3591
|
+
try {
|
|
3592
|
+
const dir = path7.dirname(toPath);
|
|
3593
|
+
await fs7.mkdir(dir, { recursive: true });
|
|
3594
|
+
await fs7.symlink(fromPath, toPath);
|
|
3595
|
+
} catch (ex) {
|
|
3596
|
+
Logger.debug("Failed to symlink", fromPath, toPath, ex);
|
|
3597
|
+
}
|
|
3589
3598
|
}
|
|
3590
3599
|
})
|
|
3591
3600
|
);
|
|
@@ -4221,8 +4230,8 @@ var init_node = __esm({
|
|
|
4221
4230
|
js: [
|
|
4222
4231
|
`import { createRequire as topLevelCreateRequire } from 'module';`,
|
|
4223
4232
|
`const require = topLevelCreateRequire(import.meta.url);`,
|
|
4224
|
-
`import { fileURLToPath as topLevelFileUrlToPath } from "url"`,
|
|
4225
|
-
`const __dirname = topLevelFileUrlToPath(new
|
|
4233
|
+
`import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
|
|
4234
|
+
`const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
|
|
4226
4235
|
nodejs.banner || ""
|
|
4227
4236
|
].join("\n")
|
|
4228
4237
|
}
|
|
@@ -4419,7 +4428,10 @@ var init_go = __esm({
|
|
|
4419
4428
|
}
|
|
4420
4429
|
);
|
|
4421
4430
|
} catch (ex) {
|
|
4422
|
-
|
|
4431
|
+
return {
|
|
4432
|
+
type: "error",
|
|
4433
|
+
errors: [String(ex)]
|
|
4434
|
+
};
|
|
4423
4435
|
}
|
|
4424
4436
|
}
|
|
4425
4437
|
if (input.mode === "deploy") {
|
|
@@ -4439,7 +4451,10 @@ var init_go = __esm({
|
|
|
4439
4451
|
}
|
|
4440
4452
|
);
|
|
4441
4453
|
} catch (ex) {
|
|
4442
|
-
|
|
4454
|
+
return {
|
|
4455
|
+
type: "error",
|
|
4456
|
+
errors: [String(ex)]
|
|
4457
|
+
};
|
|
4443
4458
|
}
|
|
4444
4459
|
}
|
|
4445
4460
|
return {
|
|
@@ -7103,12 +7118,7 @@ Are you sure you want to run this stage in dev mode? [y/N] `,
|
|
|
7103
7118
|
// src/cli/commands/bind.ts
|
|
7104
7119
|
init_error();
|
|
7105
7120
|
import path18 from "path";
|
|
7106
|
-
var
|
|
7107
|
-
NextjsSite: "next.config",
|
|
7108
|
-
AstroSite: "astro.config",
|
|
7109
|
-
RemixSite: "remix.config",
|
|
7110
|
-
SolidStartSite: "vite.config",
|
|
7111
|
-
SlsNextjsSite: "next.config"
|
|
7121
|
+
var OutdatedMetadataError = class extends Error {
|
|
7112
7122
|
};
|
|
7113
7123
|
var bind = (program2) => program2.command(
|
|
7114
7124
|
["bind <command..>", "env <command..>"],
|
|
@@ -7137,21 +7147,32 @@ var bind = (program2) => program2.command(
|
|
|
7137
7147
|
const bus = useBus2();
|
|
7138
7148
|
const project = useProject2();
|
|
7139
7149
|
const command = args.command?.join(" ");
|
|
7140
|
-
const
|
|
7150
|
+
const isSite = await isRunningInSite();
|
|
7141
7151
|
let p;
|
|
7142
7152
|
let timer;
|
|
7143
7153
|
let siteConfigCache;
|
|
7144
7154
|
if (!command) {
|
|
7145
7155
|
throw new VisibleError(
|
|
7146
|
-
`Command is required, e.g. sst bind ${
|
|
7156
|
+
`Command is required, e.g. sst bind ${isSite ? "next dev" : "vitest run"}`
|
|
7147
7157
|
);
|
|
7148
7158
|
}
|
|
7149
|
-
|
|
7150
|
-
if (!initialMetadata && !isSsrSite) {
|
|
7159
|
+
if (!isSite) {
|
|
7151
7160
|
Logger2.debug("Running in script mode.");
|
|
7152
7161
|
return await bindScript();
|
|
7153
7162
|
}
|
|
7154
|
-
|
|
7163
|
+
try {
|
|
7164
|
+
await bindSite("init");
|
|
7165
|
+
} catch (e) {
|
|
7166
|
+
if (e instanceof OutdatedMetadataError) {
|
|
7167
|
+
Colors2.line(
|
|
7168
|
+
Colors2.warning(
|
|
7169
|
+
"Warning: This was deployed with an old version of SST. Run `sst dev` or `sst deploy` to update."
|
|
7170
|
+
)
|
|
7171
|
+
);
|
|
7172
|
+
return await bindScript();
|
|
7173
|
+
}
|
|
7174
|
+
throw e;
|
|
7175
|
+
}
|
|
7155
7176
|
bus.subscribe(
|
|
7156
7177
|
"stacks.metadata.updated",
|
|
7157
7178
|
() => bindSite("metadata_updated")
|
|
@@ -7162,9 +7183,7 @@ var bind = (program2) => program2.command(
|
|
|
7162
7183
|
);
|
|
7163
7184
|
bus.subscribe("config.secret.updated", (payload) => {
|
|
7164
7185
|
const secretName = payload.properties.name;
|
|
7165
|
-
if (siteConfigCache?.secrets
|
|
7166
|
-
return;
|
|
7167
|
-
if (!siteConfigCache.secrets.includes(secretName))
|
|
7186
|
+
if (!(siteConfigCache?.secrets || []).includes(secretName))
|
|
7168
7187
|
return;
|
|
7169
7188
|
Colors2.line(
|
|
7170
7189
|
`
|
|
@@ -7173,26 +7192,47 @@ var bind = (program2) => program2.command(
|
|
|
7173
7192
|
);
|
|
7174
7193
|
bindSite("secrets_updated");
|
|
7175
7194
|
});
|
|
7176
|
-
async function
|
|
7195
|
+
async function isRunningInSite() {
|
|
7177
7196
|
const { existsAsync: existsAsync3 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
7178
7197
|
const { readFile } = await import("fs/promises");
|
|
7198
|
+
const SITE_CONFIGS = [
|
|
7199
|
+
{ file: "next.config", multiExtension: true },
|
|
7200
|
+
{ file: "astro.config", multiExtension: true },
|
|
7201
|
+
{ file: "remix.config", multiExtension: true },
|
|
7202
|
+
{ file: "svelte.config", multiExtension: true },
|
|
7203
|
+
{ file: "gatsby-config", multiExtension: true },
|
|
7204
|
+
{ file: "angular.json" },
|
|
7205
|
+
{ file: "ember-cli-build.js" },
|
|
7206
|
+
{
|
|
7207
|
+
file: "vite.config",
|
|
7208
|
+
multiExtension: true,
|
|
7209
|
+
match: /solid-start|plugin-vue|plugin-react|@preact\/preset-vite/
|
|
7210
|
+
},
|
|
7211
|
+
{ file: "package.json", match: /react-scripts/ },
|
|
7212
|
+
{ file: "index.html" }
|
|
7213
|
+
];
|
|
7179
7214
|
const results = await Promise.all(
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7215
|
+
SITE_CONFIGS.map((site) => {
|
|
7216
|
+
const files = site.multiExtension ? [".js", ".cjs", ".mjs", ".ts"].map(
|
|
7217
|
+
(ext) => `${site.file}${ext}`
|
|
7218
|
+
) : [site.file];
|
|
7219
|
+
return files.map(async (file) => {
|
|
7220
|
+
const exists = await existsAsync3(file);
|
|
7221
|
+
if (!exists)
|
|
7222
|
+
return false;
|
|
7223
|
+
if (site.match) {
|
|
7224
|
+
const content = await readFile(file);
|
|
7225
|
+
return content.toString().match(site.match);
|
|
7186
7226
|
}
|
|
7187
|
-
return
|
|
7188
|
-
})
|
|
7189
|
-
).flat()
|
|
7227
|
+
return true;
|
|
7228
|
+
});
|
|
7229
|
+
}).flat()
|
|
7190
7230
|
);
|
|
7191
7231
|
return results.some(Boolean);
|
|
7192
7232
|
}
|
|
7193
7233
|
async function bindSite(reason) {
|
|
7194
|
-
const siteMetadata =
|
|
7195
|
-
const siteConfig = await
|
|
7234
|
+
const siteMetadata = await getSiteMetadataUntilAvailable();
|
|
7235
|
+
const siteConfig = await parseSiteMetadata(siteMetadata);
|
|
7196
7236
|
if (reason === "metadata_updated") {
|
|
7197
7237
|
if (areEnvsSame(siteConfig.envs, siteConfigCache?.envs || {}))
|
|
7198
7238
|
return;
|
|
@@ -7237,42 +7277,13 @@ var bind = (program2) => program2.command(
|
|
|
7237
7277
|
...await localIamCredentials()
|
|
7238
7278
|
});
|
|
7239
7279
|
}
|
|
7240
|
-
async function parseSiteConfig(metadata3) {
|
|
7241
|
-
const { LambdaClient: LambdaClient2, GetFunctionCommand } = await import("@aws-sdk/client-lambda");
|
|
7242
|
-
const { useAWSClient: useAWSClient2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
|
|
7243
|
-
const isBindSupported = metadata3.type !== "StaticSite" && metadata3.type !== "SlsNextjsSite";
|
|
7244
|
-
if (!isBindSupported) {
|
|
7245
|
-
return { envs: metadata3.data.environment };
|
|
7246
|
-
}
|
|
7247
|
-
const lambda = useAWSClient2(LambdaClient2);
|
|
7248
|
-
const { Configuration: functionConfig } = await lambda.send(
|
|
7249
|
-
new GetFunctionCommand({
|
|
7250
|
-
FunctionName: metadata3.data.server
|
|
7251
|
-
})
|
|
7252
|
-
);
|
|
7253
|
-
return {
|
|
7254
|
-
role: functionConfig?.Role,
|
|
7255
|
-
envs: functionConfig?.Environment?.Variables || {},
|
|
7256
|
-
secrets: metadata3.data.secrets
|
|
7257
|
-
};
|
|
7258
|
-
}
|
|
7259
7280
|
async function getSiteMetadataUntilAvailable() {
|
|
7260
7281
|
const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
|
7261
7282
|
const spinner = createSpinner2({});
|
|
7262
7283
|
while (true) {
|
|
7263
7284
|
const data2 = await getSiteMetadata();
|
|
7264
7285
|
if (!data2) {
|
|
7265
|
-
spinner.start(
|
|
7266
|
-
"Make sure `sst dev` is running..."
|
|
7267
|
-
);
|
|
7268
|
-
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
7269
|
-
continue;
|
|
7270
|
-
}
|
|
7271
|
-
const isBindSupported = data2.type !== "StaticSite" && data2.type !== "SlsNextjsSite";
|
|
7272
|
-
if (isBindSupported && !data2.data.server || !isBindSupported && !data2.data.environment) {
|
|
7273
|
-
spinner.start(
|
|
7274
|
-
"This was deployed with an old version of SST. Make sure to restart `sst dev`..."
|
|
7275
|
-
);
|
|
7286
|
+
spinner.start("Make sure `sst dev` is running...");
|
|
7276
7287
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
7277
7288
|
continue;
|
|
7278
7289
|
}
|
|
@@ -7284,12 +7295,40 @@ var bind = (program2) => program2.command(
|
|
|
7284
7295
|
const { metadata: metadata3 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
7285
7296
|
const metadataData = await metadata3();
|
|
7286
7297
|
return Object.values(metadataData).flat().filter(
|
|
7287
|
-
(c) =>
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7298
|
+
(c) => [
|
|
7299
|
+
"StaticSite",
|
|
7300
|
+
"NextjsSite",
|
|
7301
|
+
"AstroSite",
|
|
7302
|
+
"RemixSite",
|
|
7303
|
+
"SolidStartSite",
|
|
7304
|
+
"SlsNextjsSite"
|
|
7305
|
+
].includes(c.type)
|
|
7306
|
+
).find((c) => {
|
|
7307
|
+
const isSsr = c.type !== "StaticSite" && c.type !== "SlsNextjsSite";
|
|
7308
|
+
if (!c.data.path || isSsr && !c.data.server || !isSsr && !c.data.environment) {
|
|
7309
|
+
throw new OutdatedMetadataError();
|
|
7310
|
+
}
|
|
7311
|
+
return path18.resolve(project.paths.root, c.data.path) === process.cwd();
|
|
7312
|
+
});
|
|
7313
|
+
}
|
|
7314
|
+
async function parseSiteMetadata(metadata3) {
|
|
7315
|
+
const { LambdaClient: LambdaClient2, GetFunctionCommand } = await import("@aws-sdk/client-lambda");
|
|
7316
|
+
const { useAWSClient: useAWSClient2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
|
|
7317
|
+
const isBindSupported = metadata3.type !== "StaticSite" && metadata3.type !== "SlsNextjsSite";
|
|
7318
|
+
if (!isBindSupported) {
|
|
7319
|
+
return { envs: metadata3.data.environment };
|
|
7320
|
+
}
|
|
7321
|
+
const lambda = useAWSClient2(LambdaClient2);
|
|
7322
|
+
const { Configuration: functionConfig } = await lambda.send(
|
|
7323
|
+
new GetFunctionCommand({
|
|
7324
|
+
FunctionName: metadata3.data.server
|
|
7325
|
+
})
|
|
7292
7326
|
);
|
|
7327
|
+
return {
|
|
7328
|
+
role: functionConfig?.Role,
|
|
7329
|
+
envs: functionConfig?.Environment?.Variables || {},
|
|
7330
|
+
secrets: metadata3.data.secrets
|
|
7331
|
+
};
|
|
7293
7332
|
}
|
|
7294
7333
|
async function assumeSsrRole(roleArn) {
|
|
7295
7334
|
const { STSClient: STSClient2, AssumeRoleCommand } = await import("@aws-sdk/client-sts");
|
|
@@ -8024,6 +8063,7 @@ var version = (program2) => program2.command(
|
|
|
8024
8063
|
const project = useProject2();
|
|
8025
8064
|
Colors2.line(Colors2.bold(`SST:`), `v${project.version}`);
|
|
8026
8065
|
Colors2.line(Colors2.bold(`CDK:`), `v${project.cdkVersion}`);
|
|
8066
|
+
Colors2.line(Colors2.bold(`Constructs:`), `v${project.constructsVersion}`);
|
|
8027
8067
|
}
|
|
8028
8068
|
);
|
|
8029
8069
|
|