sst 2.8.3 → 2.8.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.
@@ -10,6 +10,8 @@ export declare const bind: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  command: (string | number)[] | undefined;
15
17
  }>;
@@ -10,4 +10,6 @@ export declare const bootstrap: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  }>;
@@ -10,6 +10,8 @@ export declare const build: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  to: string | undefined;
15
17
  }>;
@@ -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:role/*",
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}&region=${project.config.region}`);
37
+ });
@@ -10,4 +10,6 @@ export declare const consoleCommand: (program: Program) => Promise<import("yargs
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  }>>;
@@ -10,6 +10,8 @@ export declare const deploy: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  from: string | undefined;
15
17
  } & {
@@ -10,6 +10,8 @@ export declare const dev: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  "increase-timeout": boolean | undefined;
15
17
  }>;
@@ -10,6 +10,8 @@ export declare const diff: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  dev: boolean | undefined;
15
17
  }>;
@@ -10,6 +10,8 @@ export declare const remove: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  from: string | undefined;
15
17
  } & {
@@ -10,6 +10,8 @@ export declare const get: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  name: string;
15
17
  } & {
@@ -10,6 +10,8 @@ export declare const list: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  format: string | undefined;
15
17
  }>;
@@ -10,6 +10,8 @@ export declare const load: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  filename: string;
15
17
  }>;
@@ -10,6 +10,8 @@ export declare const remove: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  name: string;
15
17
  } & {
@@ -10,6 +10,8 @@ export declare const set: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  name: string;
15
17
  } & {
@@ -10,6 +10,8 @@ export declare const telemetry: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  action: string;
15
17
  }>;
@@ -10,6 +10,8 @@ export declare const transform: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  mod: string;
15
17
  }>;
@@ -10,6 +10,8 @@ export declare const update: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  } & {
14
16
  version: string | undefined;
15
17
  }>;
@@ -10,4 +10,6 @@ export declare const version: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ future: boolean | undefined;
13
15
  }>;
package/cli/program.d.ts CHANGED
@@ -9,5 +9,7 @@ export declare const program: import("yargs").Argv<{
9
9
  verbose: boolean | undefined;
10
10
  } & {
11
11
  role: string | undefined;
12
+ } & {
13
+ future: boolean | undefined;
12
14
  }>;
13
15
  export type Program = typeof program;
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);
@@ -26,7 +26,7 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
26
26
  export class NextjsSite extends SsrSite {
27
27
  constructor(scope, id, props) {
28
28
  super(scope, id, {
29
- buildCommand: "npx --yes open-next@~1.1.0 build",
29
+ buildCommand: "npx --yes open-next@~1.2.0 build",
30
30
  ...props,
31
31
  });
32
32
  }
@@ -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-ignore
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
- // @ts-ignore
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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.8.3",
4
+ "version": "2.8.5",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },