sst 2.2.1 → 2.2.3

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.
@@ -82,4 +82,5 @@ export const update = (program) => program.command("update [version]", "Update y
82
82
  }
83
83
  Colors.gap();
84
84
  Colors.line(`${Colors.primary(`➜`)} ${Colors.warning("Make sure to run: npm install (or pnpm install, or yarn)")}`);
85
+ process.exit(0);
85
86
  });
@@ -1,4 +1,4 @@
1
- /// <reference types="react" resolution-mode="require"/>
1
+ /// <reference types="react" />
2
2
  import { Stacks } from "../../stacks/index.js";
3
3
  import type { CloudAssembly } from "aws-cdk-lib/cx-api";
4
4
  interface Props {
package/cli/ui/deploy.js CHANGED
@@ -2,11 +2,9 @@ import React, { useState, useEffect } from "react";
2
2
  import { Box, Text } from "ink";
3
3
  import { useBus } from "../../bus.js";
4
4
  import { Stacks } from "../../stacks/index.js";
5
- import inkSpinner from "ink-spinner";
5
+ import Spinner from "ink-spinner";
6
6
  import { Colors } from "../colors.js";
7
7
  import { useProject } from "../../project.js";
8
- // @ts-ignore
9
- const { default: Spinner } = inkSpinner;
10
8
  export const DeploymentUI = (props) => {
11
9
  const [resources, setResources] = useState({});
12
10
  useEffect(() => {
@@ -1,2 +1,2 @@
1
- /// <reference types="react" resolution-mode="require"/>
1
+ /// <reference types="react" />
2
2
  export declare function Functions(): JSX.Element;
@@ -1,12 +1,10 @@
1
1
  import { dim } from "colorette";
2
2
  import { Text } from "ink";
3
- import inkSpinner from "ink-spinner";
3
+ import Spinner from "ink-spinner";
4
4
  import React, { useEffect, useState } from "react";
5
5
  import { useBus } from "../../bus.js";
6
6
  import { useFunctions } from "../../constructs/Function.js";
7
7
  import { Colors } from "../colors.js";
8
- // @ts-ignore
9
- const { default: Spinner } = inkSpinner;
10
8
  export function Functions() {
11
9
  const [functions, setFunctions] = useState({});
12
10
  useEffect(() => {
@@ -154,6 +154,14 @@ export function AuthHandler(input) {
154
154
  type,
155
155
  properties,
156
156
  });
157
+ useResponse().cookie({
158
+ key: "sst_auth_token",
159
+ value: token,
160
+ maxAge: 10 * 365 * 24 * 60 * 60,
161
+ secure: true,
162
+ sameSite: "None",
163
+ httpOnly: true,
164
+ });
157
165
  const { client_id, response_type, redirect_uri, state } = {
158
166
  ...useCookies(),
159
167
  ...useQueryParams(),
@@ -25,6 +25,13 @@ export function useSession() {
25
25
  return ctx;
26
26
  }
27
27
  function getPublicKey() {
28
+ // This is the auth function accessing the public key
29
+ if (process.env.AUTH_ID) {
30
+ // @ts-expect-error
31
+ const key = Config[process.env.AUTH_ID + "PublicKey"];
32
+ if (key)
33
+ return key;
34
+ }
28
35
  const [first] = Object.values(Auth);
29
36
  if (!first)
30
37
  throw new Error("No auth provider found. Did you forget to add one?");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
@@ -69,15 +69,15 @@
69
69
  "graphql": "*",
70
70
  "graphql-helix": "^1.12.0",
71
71
  "immer": "9",
72
- "ink": "^3.2.0",
73
- "ink-spinner": "^4.0.3",
72
+ "ink": "^4.0.0",
73
+ "ink-spinner": "^5.0.0",
74
74
  "kysely": "^0.23.4",
75
75
  "kysely-codegen": "^0.9.0",
76
76
  "kysely-data-api": "^0.2.0",
77
77
  "minimatch": "^6.1.6",
78
78
  "openid-client": "^5.1.8",
79
79
  "ora": "^6.1.2",
80
- "react": "17.0.2",
80
+ "react": "18.2.0",
81
81
  "remeda": "^1.3.0",
82
82
  "sst-aws-cdk": "2.62.2-3",
83
83
  "undici": "^5.12.0",
@@ -87,11 +87,10 @@
87
87
  "zip-local": "^0.3.5"
88
88
  },
89
89
  "devDependencies": {
90
- "adm-zip": "^0.5.10",
91
- "@aws-sdk/client-iam": "^3.279.0",
92
- "@aws-sdk/client-cloudfront": "^3.279.0",
93
90
  "@aws-sdk/client-api-gateway": "^3.208.0",
91
+ "@aws-sdk/client-cloudfront": "^3.279.0",
94
92
  "@aws-sdk/client-codebuild": "^3.279.0",
93
+ "@aws-sdk/client-iam": "^3.279.0",
95
94
  "@aws-sdk/types": "^3.272.0",
96
95
  "@graphql-tools/merge": "^8.3.16",
97
96
  "@sls-next/lambda-at-edge": "^3.7.0",
@@ -109,6 +108,7 @@
109
108
  "@types/uuid": "^8.3.4",
110
109
  "@types/ws": "^8.5.3",
111
110
  "@types/yargs": "^17.0.13",
111
+ "adm-zip": "^0.5.10",
112
112
  "archiver": "^5.3.1",
113
113
  "tsx": "^3.12.1",
114
114
  "typescript": "^4.9.5",
@@ -4,11 +4,10 @@ import { useRuntimeHandlers } from "../handlers.js";
4
4
  import { useRuntimeWorkers } from "../workers.js";
5
5
  import { Context } from "../../context/context.js";
6
6
  import { VisibleError } from "../../error.js";
7
- import { exec, spawn } from "child_process";
8
- import { promisify } from "util";
7
+ import { spawn } from "child_process";
9
8
  import { useRuntimeServerConfig } from "../server.js";
10
9
  import { isChild } from "../../util/fs.js";
11
- const execAsync = promisify(exec);
10
+ import { execAsync } from "../../util/process.js";
12
11
  export const useGoHandler = Context.memo(async () => {
13
12
  const workers = await useRuntimeWorkers();
14
13
  const server = await useRuntimeServerConfig();
@@ -58,7 +57,7 @@ export const useGoHandler = Context.memo(async () => {
58
57
  if (input.mode === "start") {
59
58
  try {
60
59
  const target = path.join(input.out, handlerName);
61
- const result = await execAsync(`go build -ldflags '-s -w' -o ${target} ./${src}`, {
60
+ const result = await execAsync(`go build -ldflags '-s -w' -o '${target}' ./${src}`, {
62
61
  cwd: project,
63
62
  env: {
64
63
  ...process.env,
@@ -72,7 +71,7 @@ export const useGoHandler = Context.memo(async () => {
72
71
  if (input.mode === "deploy") {
73
72
  try {
74
73
  const target = path.join(input.out, "bootstrap");
75
- await execAsync(`go build -ldflags '-s -w' -o ${target} ./${src}`, {
74
+ await execAsync(`go build -ldflags '-s -w' -o '${target}' ./${src}`, {
76
75
  cwd: project,
77
76
  env: {
78
77
  ...process.env,
package/sst.mjs CHANGED
@@ -4737,8 +4737,7 @@ __export(go_exports, {
4737
4737
  });
4738
4738
  import path10 from "path";
4739
4739
  import fs11 from "fs/promises";
4740
- import { exec as exec3, spawn as spawn2 } from "child_process";
4741
- import { promisify as promisify2 } from "util";
4740
+ import { spawn as spawn2 } from "child_process";
4742
4741
  async function find(dir, target) {
4743
4742
  if (dir === "/")
4744
4743
  throw new VisibleError(`Could not find a ${target} file`);
@@ -4746,7 +4745,7 @@ async function find(dir, target) {
4746
4745
  return dir;
4747
4746
  return find(path10.join(dir, ".."), target);
4748
4747
  }
4749
- var execAsync2, useGoHandler;
4748
+ var useGoHandler;
4750
4749
  var init_go = __esm({
4751
4750
  "src/runtime/handlers/go.ts"() {
4752
4751
  "use strict";
@@ -4756,7 +4755,7 @@ var init_go = __esm({
4756
4755
  init_error();
4757
4756
  init_server2();
4758
4757
  init_fs();
4759
- execAsync2 = promisify2(exec3);
4758
+ init_process();
4760
4759
  useGoHandler = Context.memo(async () => {
4761
4760
  const workers = await useRuntimeWorkers();
4762
4761
  const server = await useRuntimeServerConfig();
@@ -4806,8 +4805,8 @@ var init_go = __esm({
4806
4805
  if (input.mode === "start") {
4807
4806
  try {
4808
4807
  const target = path10.join(input.out, handlerName);
4809
- const result = await execAsync2(
4810
- `go build -ldflags '-s -w' -o ${target} ./${src}`,
4808
+ const result = await execAsync(
4809
+ `go build -ldflags '-s -w' -o '${target}' ./${src}`,
4811
4810
  {
4812
4811
  cwd: project,
4813
4812
  env: {
@@ -4822,7 +4821,7 @@ var init_go = __esm({
4822
4821
  if (input.mode === "deploy") {
4823
4822
  try {
4824
4823
  const target = path10.join(input.out, "bootstrap");
4825
- await execAsync2(`go build -ldflags '-s -w' -o ${target} ./${src}`, {
4824
+ await execAsync(`go build -ldflags '-s -w' -o '${target}' ./${src}`, {
4826
4825
  cwd: project,
4827
4826
  env: {
4828
4827
  ...process.env,
@@ -4853,8 +4852,8 @@ __export(rust_exports, {
4853
4852
  import path11 from "path";
4854
4853
  import fs12 from "fs/promises";
4855
4854
  import { exec as exec4, spawn as spawn3 } from "child_process";
4856
- import { promisify as promisify3 } from "util";
4857
- var execAsync3, useRustHandler;
4855
+ import { promisify as promisify2 } from "util";
4856
+ var execAsync2, useRustHandler;
4858
4857
  var init_rust = __esm({
4859
4858
  "src/runtime/handlers/rust.ts"() {
4860
4859
  "use strict";
@@ -4864,7 +4863,7 @@ var init_rust = __esm({
4864
4863
  init_error();
4865
4864
  init_server2();
4866
4865
  init_fs();
4867
- execAsync3 = promisify3(exec4);
4866
+ execAsync2 = promisify2(exec4);
4868
4867
  useRustHandler = Context.memo(async () => {
4869
4868
  const workers = await useRuntimeWorkers();
4870
4869
  const server = await useRuntimeServerConfig();
@@ -4922,7 +4921,7 @@ var init_rust = __esm({
4922
4921
  sources.set(input.functionID, project);
4923
4922
  if (input.mode === "start") {
4924
4923
  try {
4925
- await execAsync3(`cargo build --bin ${parsed.name}`, {
4924
+ await execAsync2(`cargo build --bin ${parsed.name}`, {
4926
4925
  cwd: project,
4927
4926
  env: {
4928
4927
  ...process.env
@@ -4938,7 +4937,7 @@ var init_rust = __esm({
4938
4937
  }
4939
4938
  if (input.mode === "deploy") {
4940
4939
  try {
4941
- await execAsync3(`cargo lambda build --release --bin ${parsed.name}`, {
4940
+ await execAsync2(`cargo lambda build --release --bin ${parsed.name}`, {
4942
4941
  cwd: project,
4943
4942
  env: {
4944
4943
  ...process.env
@@ -5036,11 +5035,11 @@ __export(python_exports, {
5036
5035
  });
5037
5036
  import path13 from "path";
5038
5037
  import { exec as exec5, spawn as spawn4 } from "child_process";
5039
- import { promisify as promisify4 } from "util";
5038
+ import { promisify as promisify3 } from "util";
5040
5039
  import { Runtime } from "aws-cdk-lib/aws-lambda";
5041
5040
  import os3 from "os";
5042
5041
  import url6 from "url";
5043
- var execAsync4, RUNTIME_MAP, usePythonHandler;
5042
+ var execAsync3, RUNTIME_MAP, usePythonHandler;
5044
5043
  var init_python = __esm({
5045
5044
  "src/runtime/handlers/python.ts"() {
5046
5045
  "use strict";
@@ -5050,7 +5049,7 @@ var init_python = __esm({
5050
5049
  init_server2();
5051
5050
  init_fs();
5052
5051
  init_pythonBundling();
5053
- execAsync4 = promisify4(exec5);
5052
+ execAsync3 = promisify3(exec5);
5054
5053
  RUNTIME_MAP = {
5055
5054
  "python2.7": Runtime.PYTHON_2_7,
5056
5055
  "python3.6": Runtime.PYTHON_3_6,
@@ -5973,7 +5972,7 @@ __export(deploy_exports, {
5973
5972
  });
5974
5973
  import React, { useState, useEffect } from "react";
5975
5974
  import { Box, Text } from "ink";
5976
- import inkSpinner from "ink-spinner";
5975
+ import Spinner from "ink-spinner";
5977
5976
  function printDeploymentResults(assembly, results, remove4) {
5978
5977
  const success = Object.entries(results).filter(
5979
5978
  ([_stack, result]) => stacks_exports.isSuccess(result.status)
@@ -6058,7 +6057,7 @@ function getApiLogRoleHelper(error2) {
6058
6057
  return `This is a common error when configuring Access Log for WebSocket APIs. The AWS API Gateway service in your AWS account does not have permissions to the CloudWatch logs service. Follow this article to create an IAM role for logging to CloudWatch - https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/`;
6059
6058
  }
6060
6059
  }
6061
- var Spinner, DeploymentUI;
6060
+ var DeploymentUI;
6062
6061
  var init_deploy2 = __esm({
6063
6062
  "src/cli/ui/deploy.tsx"() {
6064
6063
  "use strict";
@@ -6066,7 +6065,6 @@ var init_deploy2 = __esm({
6066
6065
  init_stacks();
6067
6066
  init_colors();
6068
6067
  init_project();
6069
- ({ default: Spinner } = inkSpinner);
6070
6068
  DeploymentUI = (props) => {
6071
6069
  const [resources, setResources] = useState({});
6072
6070
  useEffect(() => {
@@ -6292,9 +6290,9 @@ __export(pothos_exports2, {
6292
6290
  });
6293
6291
  import fs16 from "fs/promises";
6294
6292
  import { exec as exec6 } from "child_process";
6295
- import { promisify as promisify5 } from "util";
6293
+ import { promisify as promisify4 } from "util";
6296
6294
  import path18 from "path";
6297
- var execAsync5, usePothosBuilder;
6295
+ var execAsync4, usePothosBuilder;
6298
6296
  var init_pothos2 = __esm({
6299
6297
  "src/cli/commands/plugins/pothos.ts"() {
6300
6298
  "use strict";
@@ -6302,7 +6300,7 @@ var init_pothos2 = __esm({
6302
6300
  init_context();
6303
6301
  init_pothos();
6304
6302
  init_colors();
6305
- execAsync5 = promisify5(exec6);
6303
+ execAsync4 = promisify4(exec6);
6306
6304
  usePothosBuilder = Context.memo(() => {
6307
6305
  let routes = [];
6308
6306
  const bus = useBus();
@@ -6313,7 +6311,7 @@ var init_pothos2 = __esm({
6313
6311
  });
6314
6312
  await fs16.writeFile(route.output, schema);
6315
6313
  if (Array.isArray(route.commands) && route.commands.length > 0) {
6316
- await Promise.all(route.commands.map((cmd) => execAsync5(cmd)));
6314
+ await Promise.all(route.commands.map((cmd) => execAsync4(cmd)));
6317
6315
  }
6318
6316
  Colors.line(Colors.success(`\u2714`), " Pothos: Extracted pothos schema");
6319
6317
  } catch (ex) {
@@ -7671,6 +7669,7 @@ var update = (program2) => program2.command(
7671
7669
  "Make sure to run: npm install (or pnpm install, or yarn)"
7672
7670
  )}`
7673
7671
  );
7672
+ process.exit(0);
7674
7673
  }
7675
7674
  );
7676
7675