sst 2.8.2 → 2.8.4
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.d.ts +2 -0
- package/cli/commands/bootstrap.d.ts +2 -0
- package/cli/commands/build.d.ts +2 -0
- package/cli/commands/connect.d.ts +15 -0
- package/cli/commands/connect.js +37 -0
- package/cli/commands/console.d.ts +2 -0
- package/cli/commands/deploy.d.ts +2 -0
- package/cli/commands/dev.d.ts +2 -0
- package/cli/commands/diff.d.ts +2 -0
- package/cli/commands/remove.d.ts +2 -0
- package/cli/commands/secrets/get.d.ts +2 -0
- package/cli/commands/secrets/list.d.ts +2 -0
- package/cli/commands/secrets/load.d.ts +2 -0
- package/cli/commands/secrets/remove.d.ts +2 -0
- package/cli/commands/secrets/set.d.ts +2 -0
- package/cli/commands/telemetry.d.ts +2 -0
- package/cli/commands/transform.d.ts +2 -0
- package/cli/commands/update.d.ts +2 -0
- package/cli/commands/version.d.ts +2 -0
- package/cli/program.d.ts +2 -0
- package/cli/program.js +4 -0
- package/cli/sst.js +2 -0
- package/constructs/NextjsSite.js +14 -2
- package/constructs/SsrSite.d.ts +1 -1
- package/constructs/SsrSite.js +4 -2
- package/node/job/index.d.ts +1 -1
- package/node/job/index.js +4 -5
- package/package.json +1 -1
- package/sst.mjs +39874 -160
package/cli/commands/bind.d.ts
CHANGED
package/cli/commands/build.d.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
import type { Program } from "../program.js";
|
|
3
|
+
export declare const connect: (program: Program) => import("yargs").Argv<{
|
|
4
|
+
stage: string | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
profile: string | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
region: string | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
verbose: boolean | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
role: string | undefined;
|
|
13
|
+
} & {
|
|
14
|
+
future: boolean | undefined;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const connect = (program) => program.command("connect", "", (yargs) => yargs, async (args) => {
|
|
2
|
+
if (!args.future)
|
|
3
|
+
throw new Error("This command is not yet available.");
|
|
4
|
+
const { useAWSClient } = await import("../../credentials.js");
|
|
5
|
+
const { useProject } = await import("../../project.js");
|
|
6
|
+
const { useSTSIdentity } = await import("../../credentials.js");
|
|
7
|
+
const { IAMClient, CreateRoleCommand, AttachRolePolicyCommand } = await import("@aws-sdk/client-iam");
|
|
8
|
+
const client = useAWSClient(IAMClient);
|
|
9
|
+
await client
|
|
10
|
+
.send(new CreateRoleCommand({
|
|
11
|
+
RoleName: "sst",
|
|
12
|
+
AssumeRolePolicyDocument: JSON.stringify({
|
|
13
|
+
Version: "2012-10-17",
|
|
14
|
+
Statement: [
|
|
15
|
+
{
|
|
16
|
+
Effect: "Allow",
|
|
17
|
+
Principal: {
|
|
18
|
+
AWS: "arn:aws:iam::917397401067:root",
|
|
19
|
+
},
|
|
20
|
+
Action: "sts:AssumeRole",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
}),
|
|
24
|
+
}))
|
|
25
|
+
.catch((e) => {
|
|
26
|
+
if (e.Error.Code === "EntityAlreadyExists")
|
|
27
|
+
return;
|
|
28
|
+
throw e;
|
|
29
|
+
});
|
|
30
|
+
await client.send(new AttachRolePolicyCommand({
|
|
31
|
+
RoleName: "sst",
|
|
32
|
+
PolicyArn: "arn:aws:iam::aws:policy/AdministratorAccess",
|
|
33
|
+
}));
|
|
34
|
+
const project = useProject();
|
|
35
|
+
const identity = await useSTSIdentity();
|
|
36
|
+
console.log(`http://localhost:3000/connect?app=${project.config.name}&stage=${project.config.stage}&aws_account_id=${identity.Account}`);
|
|
37
|
+
});
|
package/cli/commands/deploy.d.ts
CHANGED
package/cli/commands/dev.d.ts
CHANGED
package/cli/commands/diff.d.ts
CHANGED
package/cli/commands/remove.d.ts
CHANGED
package/cli/commands/update.d.ts
CHANGED
package/cli/program.d.ts
CHANGED
package/cli/program.js
CHANGED
|
@@ -21,6 +21,10 @@ export const program = yargs(hideBin(process.argv))
|
|
|
21
21
|
.option("role", {
|
|
22
22
|
type: "string",
|
|
23
23
|
describe: "ARN of the IAM role to use when invoking AWS",
|
|
24
|
+
})
|
|
25
|
+
.option("future", {
|
|
26
|
+
type: "boolean",
|
|
27
|
+
describe: "DO NOT USE. For enabling untested, experimental features",
|
|
24
28
|
})
|
|
25
29
|
.group(["stage", "profile", "region", "role", "verbose", "help"], "Global:")
|
|
26
30
|
.middleware(async (argv) => {
|
package/cli/sst.js
CHANGED
|
@@ -25,6 +25,7 @@ import { transform } from "./commands/transform.js";
|
|
|
25
25
|
import { diff } from "./commands/diff.js";
|
|
26
26
|
import { version } from "./commands/version.js";
|
|
27
27
|
import { telemetry } from "./commands/telemetry.js";
|
|
28
|
+
import { connect } from "./commands/connect.js";
|
|
28
29
|
bootstrap(program);
|
|
29
30
|
dev(program);
|
|
30
31
|
deploy(program);
|
|
@@ -38,6 +39,7 @@ consoleCommand(program);
|
|
|
38
39
|
diff(program);
|
|
39
40
|
version(program);
|
|
40
41
|
telemetry(program);
|
|
42
|
+
connect(program);
|
|
41
43
|
if ("setSourceMapsEnabled" in process) {
|
|
42
44
|
// @ts-expect-error
|
|
43
45
|
process.setSourceMapsEnabled(true);
|
package/constructs/NextjsSite.js
CHANGED
|
@@ -153,7 +153,13 @@ export class NextjsSite extends SsrSite {
|
|
|
153
153
|
authType: FunctionUrlAuthType.NONE,
|
|
154
154
|
});
|
|
155
155
|
const serverOrigin = new HttpOrigin(Fn.parseDomainName(serverFnUrl.url));
|
|
156
|
-
const cachePolicy = cdk?.serverCachePolicy ??
|
|
156
|
+
const cachePolicy = cdk?.serverCachePolicy ??
|
|
157
|
+
this.buildServerCachePolicy([
|
|
158
|
+
"accept",
|
|
159
|
+
"rsc",
|
|
160
|
+
"next-router-prefetch",
|
|
161
|
+
"next-router-state-tree",
|
|
162
|
+
]);
|
|
157
163
|
const originRequestPolicy = this.buildServerOriginRequestPolicy();
|
|
158
164
|
const serverBehavior = this.buildServerBehaviorForRegional(serverOrigin, cachePolicy, originRequestPolicy);
|
|
159
165
|
return new Distribution(this, "Distribution", {
|
|
@@ -178,7 +184,13 @@ export class NextjsSite extends SsrSite {
|
|
|
178
184
|
const { cdk } = this.props;
|
|
179
185
|
const cfDistributionProps = cdk?.distribution || {};
|
|
180
186
|
const s3Origin = new S3Origin(this.cdk.bucket);
|
|
181
|
-
const cachePolicy = cdk?.serverCachePolicy ??
|
|
187
|
+
const cachePolicy = cdk?.serverCachePolicy ??
|
|
188
|
+
this.buildServerCachePolicy([
|
|
189
|
+
"accept",
|
|
190
|
+
"rsc",
|
|
191
|
+
"next-router-prefetch",
|
|
192
|
+
"next-router-state-tree",
|
|
193
|
+
]);
|
|
182
194
|
const originRequestPolicy = this.buildServerOriginRequestPolicy();
|
|
183
195
|
const functionVersion = this.serverLambdaForEdge.currentVersion;
|
|
184
196
|
const serverBehavior = this.buildServerBehaviorForEdge(functionVersion, s3Origin, cachePolicy, originRequestPolicy);
|
package/constructs/SsrSite.d.ts
CHANGED
|
@@ -276,7 +276,7 @@ export declare class SsrSite extends Construct implements SSTConstruct {
|
|
|
276
276
|
function: CfFunction;
|
|
277
277
|
}[];
|
|
278
278
|
private buildStaticFileBehaviors;
|
|
279
|
-
protected buildServerCachePolicy(): CachePolicy;
|
|
279
|
+
protected buildServerCachePolicy(allowedHeaders?: string[]): CachePolicy;
|
|
280
280
|
protected buildServerOriginRequestPolicy(): import("aws-cdk-lib/aws-cloudfront").IOriginRequestPolicy;
|
|
281
281
|
private createCloudFrontInvalidation;
|
|
282
282
|
protected validateCustomDomainSettings(): void;
|
package/constructs/SsrSite.js
CHANGED
|
@@ -608,10 +608,12 @@ function handler(event) {
|
|
|
608
608
|
}
|
|
609
609
|
return staticsBehaviours;
|
|
610
610
|
}
|
|
611
|
-
buildServerCachePolicy() {
|
|
611
|
+
buildServerCachePolicy(allowedHeaders) {
|
|
612
612
|
return new CachePolicy(this, "ServerCache", {
|
|
613
613
|
queryStringBehavior: CacheQueryStringBehavior.all(),
|
|
614
|
-
headerBehavior:
|
|
614
|
+
headerBehavior: allowedHeaders && allowedHeaders.length > 0
|
|
615
|
+
? CacheHeaderBehavior.allowList(...allowedHeaders)
|
|
616
|
+
: CacheHeaderBehavior.none(),
|
|
615
617
|
cookieBehavior: CacheCookieBehavior.all(),
|
|
616
618
|
defaultTtl: CdkDuration.days(0),
|
|
617
619
|
maxTtl: CdkDuration.days(365),
|
package/node/job/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type JobType = {
|
|
|
9
9
|
[T in keyof JobResources]: ReturnType<typeof JobControl<T>>;
|
|
10
10
|
};
|
|
11
11
|
export declare const Job: JobType;
|
|
12
|
-
declare function JobControl<Name extends keyof JobResources>(name: Name): {
|
|
12
|
+
declare function JobControl<Name extends keyof JobResources>(name: Name, vars: Record<string, string>): {
|
|
13
13
|
run(props: JobRunProps<Name>): Promise<void>;
|
|
14
14
|
};
|
|
15
15
|
/**
|
package/node/job/index.js
CHANGED
|
@@ -5,17 +5,16 @@ export const Job = /* @__PURE__ */ (() => {
|
|
|
5
5
|
const result = createProxy("Job");
|
|
6
6
|
const vars = getVariables2("Job");
|
|
7
7
|
Object.keys(vars).forEach((name) => {
|
|
8
|
-
// @ts-
|
|
9
|
-
result[name] = JobControl(name);
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
result[name] = JobControl(name, vars[name]);
|
|
10
10
|
});
|
|
11
11
|
return result;
|
|
12
12
|
})();
|
|
13
|
-
function JobControl(name) {
|
|
13
|
+
function JobControl(name, vars) {
|
|
14
14
|
return {
|
|
15
15
|
async run(props) {
|
|
16
16
|
// Handle job permission not granted
|
|
17
|
-
|
|
18
|
-
const functionName = jobData[name].functionName;
|
|
17
|
+
const functionName = vars.functionName;
|
|
19
18
|
// Invoke the Lambda function
|
|
20
19
|
const ret = await lambda.send(new InvokeCommand({
|
|
21
20
|
FunctionName: functionName,
|