sst 2.5.7 → 2.7.0

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.
Files changed (44) hide show
  1. package/cli/commands/secrets/load.d.ts +15 -0
  2. package/cli/commands/secrets/load.js +41 -0
  3. package/cli/commands/secrets/secrets.js +2 -0
  4. package/cli/commands/secrets/set.js +1 -1
  5. package/config.d.ts +1 -1
  6. package/config.js +3 -3
  7. package/constructs/NextjsSite.js +5 -1
  8. package/constructs/SsrSite.d.ts +7 -2
  9. package/constructs/SsrSite.js +14 -9
  10. package/node/api/index.d.ts +1 -4
  11. package/node/api/index.js +8 -9
  12. package/node/auth/auth.js +2 -2
  13. package/node/auth/index.js +1 -2
  14. package/node/bucket/index.js +2 -3
  15. package/node/config/index.js +4 -4
  16. package/node/event-bus/index.js +3 -3
  17. package/node/function/index.js +3 -3
  18. package/node/future/auth/adapter/link.d.ts +1 -1
  19. package/node/future/auth/adapter/link.js +5 -3
  20. package/node/future/auth/handler.js +7 -2
  21. package/node/future/auth/index.js +2 -3
  22. package/node/future/auth/session.js +3 -1
  23. package/node/graphql/index.d.ts +11 -38
  24. package/node/graphql/index.js +21 -45
  25. package/node/job/index.d.ts +1 -1
  26. package/node/job/index.js +11 -8
  27. package/node/kinesis-stream/index.js +3 -3
  28. package/node/queue/index.js +2 -3
  29. package/node/rds/index.js +2 -3
  30. package/node/site/index.js +18 -19
  31. package/node/table/index.js +4 -3
  32. package/node/topic/index.js +4 -3
  33. package/node/util/index.d.ts +1 -1
  34. package/node/util/index.js +4 -2
  35. package/package.json +4 -3
  36. package/sst.mjs +59 -4
  37. package/support/base-site-archiver.mjs +12 -12
  38. package/support/bootstrap-metadata-function/index.mjs +1409 -1345
  39. package/support/bridge/bridge.mjs +35 -46
  40. package/support/custom-resources/index.mjs +6503 -6439
  41. package/support/job-invoker/index.mjs +907 -90
  42. package/support/rds-migrator/index.mjs +16 -16
  43. package/support/script-function/index.mjs +907 -90
  44. package/support/ssr-site-function-archiver.mjs +9 -9
@@ -1,19 +1,18 @@
1
- import { createProxy, getVariables } from "../util/index.js";
2
- export const StaticSite = createProxy("StaticSite");
3
- export const ReactStaticSite = createProxy("ReactStaticSite");
4
- export const ViteStaticSite = createProxy("ViteStaticSite");
5
- export const RemixSite = createProxy("RemixSite");
6
- export const NextjsSite = createProxy("NextjsSite");
7
- export const SolidStartSite = createProxy("SolidStartSite");
8
- const staticSiteData = getVariables("StaticSite");
9
- const reactSiteData = getVariables("ReactStaticSite");
10
- const viteSiteData = getVariables("ViteStaticSite");
11
- const nextjsSiteData = getVariables("NextjsSite");
12
- const remixSiteData = getVariables("RemixSite");
13
- const solidStartSiteData = getVariables("SolidStartSite");
14
- Object.assign(StaticSite, staticSiteData);
15
- Object.assign(ReactStaticSite, reactSiteData);
16
- Object.assign(ViteStaticSite, viteSiteData);
17
- Object.assign(NextjsSite, nextjsSiteData);
18
- Object.assign(RemixSite, remixSiteData);
19
- Object.assign(SolidStartSite, solidStartSiteData);
1
+ import { createProxy } from "../util/index.js";
2
+ export const StaticSite =
3
+ /* @__PURE__ */ createProxy("StaticSite");
4
+ export const ReactStaticSite =
5
+ /* @__PURE__ */
6
+ createProxy("ReactStaticSite");
7
+ export const ViteStaticSite =
8
+ /* @__PURE__ */
9
+ createProxy("ViteStaticSite");
10
+ export const RemixSite =
11
+ /* @__PURE__ */
12
+ createProxy("RemixSite");
13
+ export const NextjsSite =
14
+ /* @__PURE__ */
15
+ createProxy("NextjsSite");
16
+ export const SolidStartSite =
17
+ /* @__PURE__ */
18
+ createProxy("SolidStartSite");
@@ -1,3 +1,4 @@
1
- import { createProxy, getVariables } from "../util/index.js";
2
- export const Table = createProxy("Table");
3
- Object.assign(Table, getVariables("Table"));
1
+ import { createProxy } from "../util/index.js";
2
+ export const Table =
3
+ /* @__PURE__ */
4
+ createProxy("Table");
@@ -1,3 +1,4 @@
1
- import { createProxy, getVariables } from "../util/index.js";
2
- export const Topic = createProxy("Topic");
3
- Object.assign(Topic, getVariables("Topic"));
1
+ import { createProxy } from "../util/index.js";
2
+ export const Topic =
3
+ /* @__PURE__ */
4
+ createProxy("Topic");
@@ -1,2 +1,2 @@
1
1
  export declare function createProxy<T extends object>(constructName: string): T;
2
- export declare function getVariables(constructName: string): Record<string, Record<string, string>>;
2
+ export declare function getVariables2(constructName: string): Record<string, Record<string, string>>;
@@ -14,7 +14,7 @@ let allVariables = {};
14
14
  // https://discord.com/channels/983865673656705025/1089184080534446110
15
15
  const _placeholder = await parseEnvironment();
16
16
  export function createProxy(constructName) {
17
- return new Proxy({}, {
17
+ const result = new Proxy({}, {
18
18
  get(target, prop) {
19
19
  if (typeof prop === "string") {
20
20
  // normalize prop to convert kebab cases like `my-table` to `my_table`
@@ -27,8 +27,10 @@ export function createProxy(constructName) {
27
27
  return Reflect.get(target, prop);
28
28
  },
29
29
  });
30
+ Object.assign(result, getVariables2(constructName));
31
+ return result;
30
32
  }
31
- export function getVariables(constructName) {
33
+ export function getVariables2(constructName) {
32
34
  return allVariables[constructName] || {};
33
35
  }
34
36
  async function parseEnvironment() {
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
+ "sideEffects": false,
2
3
  "name": "sst",
3
- "version": "2.5.7",
4
+ "version": "2.7.0",
4
5
  "bin": {
5
6
  "sst": "cli/sst.js"
6
7
  },
@@ -9,7 +10,7 @@
9
10
  "license": "MIT",
10
11
  "repository": {
11
12
  "type": "git",
12
- "url": "git+https://github.com/serverless-stack/sst.git",
13
+ "url": "git+https://github.com/estyrke/serverless-stack.git",
13
14
  "directory": "packages/cli"
14
15
  },
15
16
  "exports": {
@@ -67,7 +68,7 @@
67
68
  "get-port": "^6.1.2",
68
69
  "glob": "^8.0.3",
69
70
  "graphql": "*",
70
- "graphql-helix": "^1.12.0",
71
+ "graphql-yoga": "^3.9.0",
71
72
  "immer": "9",
72
73
  "ink": "^4.0.0",
73
74
  "ink-spinner": "^5.0.0",
package/sst.mjs CHANGED
@@ -6698,18 +6698,18 @@ var init_config = __esm({
6698
6698
  );
6699
6699
  }
6700
6700
  Config2.removeSecret = removeSecret;
6701
- async function restart(key) {
6701
+ async function restart(keys) {
6702
6702
  const metadata3 = await stacks_exports.metadata();
6703
6703
  const siteData = Object.values(metadata3).flat().filter(
6704
6704
  (c) => c.type === "AstroSite" || c.type === "NextjsSite" || c.type === "RemixSite" || c.type === "SolidStartSite"
6705
- ).filter((c) => c.data.secrets.includes(key));
6705
+ ).filter((c) => keys.some((key) => c.data.secrets.includes(key)));
6706
6706
  const siteDataPlaceholder = siteData.filter(
6707
6707
  (c) => c.data.mode === "placeholder"
6708
6708
  );
6709
6709
  const siteDataEdge = siteData.filter((c) => c.data.mode === "deployed").filter((c) => c.data.edge);
6710
6710
  const siteDataRegional = siteData.filter((c) => c.data.mode === "deployed").filter((c) => !c.data.edge);
6711
6711
  const regionalSiteArns = siteData.map((s) => s.data.server);
6712
- const functionData = Object.values(metadata3).flat().filter((c) => c.type === "Function").filter((c) => !regionalSiteArns.includes(c.data.arn)).filter((c) => c.data.secrets.includes(key));
6712
+ const functionData = Object.values(metadata3).flat().filter((c) => c.type === "Function").filter((c) => !regionalSiteArns.includes(c.data.arn)).filter((c) => keys.some((key) => c.data.secrets.includes(key)));
6713
6713
  const restartedSites = (await Promise.all(
6714
6714
  siteDataRegional.map(async (s) => {
6715
6715
  const restarted = await restartFunction(s.data.server);
@@ -7721,6 +7721,60 @@ var list = (program2) => program2.command(
7721
7721
  }
7722
7722
  );
7723
7723
 
7724
+ // src/cli/commands/secrets/load.ts
7725
+ var load2 = (program2) => program2.command(
7726
+ "load <filename>",
7727
+ "Loads secrets from an .env file",
7728
+ (yargs2) => yargs2.positional("filename", {
7729
+ type: "string",
7730
+ demandOption: true
7731
+ }),
7732
+ async (args) => {
7733
+ const { Config: Config2 } = await Promise.resolve().then(() => (init_config(), config_exports));
7734
+ const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
7735
+ const { blue: blue4 } = await import("colorette");
7736
+ const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
7737
+ const { parse: parse2 } = await import("dotenv");
7738
+ const fs18 = await import("fs/promises");
7739
+ const fileContent = await fs18.readFile(args.filename, "utf-8");
7740
+ const envVars = parse2(fileContent);
7741
+ const setting = createSpinner2(
7742
+ ` Setting secrets from "${args.filename}"`
7743
+ ).start();
7744
+ for (const [key, value] of Object.entries(envVars)) {
7745
+ await Config2.setSecret({ key, value });
7746
+ }
7747
+ setting.succeed();
7748
+ const envNames = Object.keys(envVars);
7749
+ const restarting = createSpinner2(
7750
+ ` Restarting all resources using ${blue4(envNames.join(", "))}...`
7751
+ ).start();
7752
+ const { edgeSites, sites, placeholderSites, functions } = await Config2.restart(envNames);
7753
+ restarting.stop().clear();
7754
+ const siteCount = sites.length + placeholderSites.length;
7755
+ if (siteCount > 0) {
7756
+ Colors2.line(
7757
+ Colors2.success(`\u2714 `),
7758
+ siteCount === 1 ? `Reloaded ${siteCount} site` : `Reloaded ${siteCount} sites`
7759
+ );
7760
+ }
7761
+ const functionCount = functions.length;
7762
+ if (functionCount > 0) {
7763
+ Colors2.line(
7764
+ Colors2.success(`\u2714 `),
7765
+ functionCount === 1 ? `Reloaded ${functionCount} function` : `Reloaded ${functionCount} functions`
7766
+ );
7767
+ }
7768
+ edgeSites.forEach(({ id, type }) => {
7769
+ Colors2.line(
7770
+ Colors2.primary(`\u279C `),
7771
+ `Redeploy the "${id}" ${type} to use the new secret`
7772
+ );
7773
+ });
7774
+ process.exit(0);
7775
+ }
7776
+ );
7777
+
7724
7778
  // src/cli/commands/secrets/remove.ts
7725
7779
  var remove3 = (program2) => program2.command(
7726
7780
  "remove <name>",
@@ -7779,7 +7833,7 @@ var set = (program2) => program2.command(
7779
7833
  const restarting = createSpinner2(
7780
7834
  ` Reloading all resources using ${blue4(args.name)}...`
7781
7835
  ).start();
7782
- const { edgeSites, sites, placeholderSites, functions } = await Config2.restart(args.name);
7836
+ const { edgeSites, sites, placeholderSites, functions } = await Config2.restart([args.name]);
7783
7837
  restarting.stop().clear();
7784
7838
  const siteCount = sites.length + placeholderSites.length;
7785
7839
  if (siteCount > 0) {
@@ -7811,6 +7865,7 @@ function secrets(program2) {
7811
7865
  yargs2.demandCommand(1);
7812
7866
  set(yargs2);
7813
7867
  get(yargs2);
7868
+ load2(yargs2);
7814
7869
  list(yargs2);
7815
7870
  remove3(yargs2);
7816
7871
  return yargs2;