sst 2.22.1 → 2.22.2

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.
@@ -91,7 +91,7 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
91
91
  printDeploymentResults(assembly, results);
92
92
  if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
93
93
  process.exit(1);
94
- fs.writeFile(path.join(project.paths.out, "outputs.json"), JSON.stringify(mapValues(results, (val) => val.outputs), null, 2));
94
+ fs.writeFile(project.config.outputs || path.join(project.paths.out, "outputs.json"), JSON.stringify(mapValues(results, (val) => val.outputs), null, 2));
95
95
  // Update app state
96
96
  await saveAppMetadata({ mode: "deploy" });
97
97
  process.exit(0);
@@ -232,7 +232,8 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
232
232
  }
233
233
  lastDeployed = nextChecksum;
234
234
  // Write outputs.json
235
- fs.writeFile(path.join(project.paths.out, "outputs.json"), JSON.stringify(mapValues(results, (val) => val.outputs), null, 2));
235
+ fs.writeFile(project.config.outputs ||
236
+ path.join(project.paths.out, "outputs.json"), JSON.stringify(mapValues(results, (val) => val.outputs), null, 2));
236
237
  isWorking = false;
237
238
  if (isDirty)
238
239
  build();
@@ -228,4 +228,5 @@ export declare class Cognito extends Construct implements SSTConstruct {
228
228
  private createAuthRole;
229
229
  private createUnauthRole;
230
230
  private buildSignInAliases;
231
+ private cognitoIdentityName;
231
232
  }
@@ -310,13 +310,14 @@ export class Cognito extends Construct {
310
310
  return lambda;
311
311
  }
312
312
  createAuthRole(identityPool) {
313
+ const identityName = this.cognitoIdentityName();
313
314
  const role = new Role(this, "IdentityPoolAuthRole", {
314
- assumedBy: new FederatedPrincipal("cognito-identity.amazonaws.com", {
315
+ assumedBy: new FederatedPrincipal(identityName, {
315
316
  StringEquals: {
316
- "cognito-identity.amazonaws.com:aud": identityPool.ref,
317
+ [`${identityName}:aud`]: identityPool.ref,
317
318
  },
318
319
  "ForAnyValue:StringLike": {
319
- "cognito-identity.amazonaws.com:amr": "authenticated",
320
+ [`${identityName}:amr`]: "authenticated",
320
321
  },
321
322
  }, "sts:AssumeRoleWithWebIdentity"),
322
323
  });
@@ -332,13 +333,14 @@ export class Cognito extends Construct {
332
333
  return role;
333
334
  }
334
335
  createUnauthRole(identityPool) {
336
+ const identityName = this.cognitoIdentityName();
335
337
  const role = new Role(this, "IdentityPoolUnauthRole", {
336
- assumedBy: new FederatedPrincipal("cognito-identity.amazonaws.com", {
338
+ assumedBy: new FederatedPrincipal(identityName, {
337
339
  StringEquals: {
338
- "cognito-identity.amazonaws.com:aud": identityPool.ref,
340
+ [`${identityName}:aud`]: identityPool.ref,
339
341
  },
340
342
  "ForAnyValue:StringLike": {
341
- "cognito-identity.amazonaws.com:amr": "unauthenticated",
343
+ [`${identityName}:amr`]: "unauthenticated",
342
344
  },
343
345
  }, "sts:AssumeRoleWithWebIdentity"),
344
346
  });
@@ -360,4 +362,9 @@ export class Cognito extends Construct {
360
362
  preferredUsername: login.includes("preferredUsername"),
361
363
  };
362
364
  }
365
+ cognitoIdentityName() {
366
+ return Stack.of(this).region.startsWith("us-gov-")
367
+ ? "cognito-identity-us-gov.amazonaws.com"
368
+ : "cognito-identity.amazonaws.com";
369
+ }
363
370
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.22.1",
4
+ "version": "2.22.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -66,7 +66,7 @@
66
66
  "cross-spawn": "^7.0.3",
67
67
  "dendriform-immer-patch-optimiser": "^2.1.0",
68
68
  "dotenv": "^16.0.3",
69
- "esbuild": "0.18.11",
69
+ "esbuild": "0.18.13",
70
70
  "express": "^4.18.2",
71
71
  "fast-jwt": "^1.6.1",
72
72
  "get-port": "^6.1.2",
@@ -117,7 +117,7 @@
117
117
  "archiver": "^5.3.1",
118
118
  "tsx": "^3.12.1",
119
119
  "typescript": "^4.9.5",
120
- "vitest": "^0.28.3"
120
+ "vitest": "^0.33.0"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "@sls-next/lambda-at-edge": "^3.7.0"
package/project.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface ConfigOptions {
11
11
  profile?: string;
12
12
  role?: string;
13
13
  ssmPrefix?: string;
14
+ outputs?: string;
14
15
  advanced?: {
15
16
  disableParameterizedStackNameCheck?: boolean;
16
17
  };
@@ -64,8 +64,8 @@ export const useGoHandler = Context.memo(async () => {
64
64
  const result = await execAsync([
65
65
  "go",
66
66
  "build",
67
- ...(ldFlags ? [`-ldflags "${ldFlags.join(" ")}"`] : []),
68
- ...(buildTags ? [`-t ${buildTags.join(" ")}`] : []),
67
+ ...(ldFlags.length ? [`-ldflags "${ldFlags.join(" ")}"`] : []),
68
+ ...(buildTags.length ? [`-tags ${buildTags.join(" ")}`] : []),
69
69
  `-o "${target}"`,
70
70
  `./${srcPath}`,
71
71
  ].join(" "), {
@@ -89,8 +89,8 @@ export const useGoHandler = Context.memo(async () => {
89
89
  await execAsync([
90
90
  "go",
91
91
  "build",
92
- ...(ldFlags ? [`-ldflags "${ldFlags.join(" ")}"`] : []),
93
- ...(buildTags ? [`-t ${buildTags.join(" ")}`] : []),
92
+ ...(ldFlags.length ? [`-ldflags "${ldFlags.join(" ")}"`] : []),
93
+ ...(buildTags.length ? [`-tags ${buildTags.join(" ")}`] : []),
94
94
  `-o "${target}"`,
95
95
  `./${srcPath}`,
96
96
  ].join(" "), {
@@ -15,6 +15,11 @@ export const useNodeHandler = Context.memo(async () => {
15
15
  const workers = await useRuntimeWorkers();
16
16
  const handlers = useRuntimeHandlers();
17
17
  const cache = {};
18
+ process.on("exit", () => {
19
+ for (const { ctx } of Object.values(cache)) {
20
+ ctx.dispose();
21
+ }
22
+ });
18
23
  const project = useProject();
19
24
  const threads = new Map();
20
25
  handlers.register({
package/sst.mjs CHANGED
@@ -5356,6 +5356,11 @@ var init_node = __esm({
5356
5356
  const workers = await useRuntimeWorkers();
5357
5357
  const handlers = useRuntimeHandlers();
5358
5358
  const cache = {};
5359
+ process.on("exit", () => {
5360
+ for (const { ctx } of Object.values(cache)) {
5361
+ ctx.dispose();
5362
+ }
5363
+ });
5359
5364
  const project = useProject();
5360
5365
  const threads = /* @__PURE__ */ new Map();
5361
5366
  handlers.register({
@@ -5670,8 +5675,8 @@ var init_go = __esm({
5670
5675
  [
5671
5676
  "go",
5672
5677
  "build",
5673
- ...ldFlags ? [`-ldflags "${ldFlags.join(" ")}"`] : [],
5674
- ...buildTags ? [`-t ${buildTags.join(" ")}`] : [],
5678
+ ...ldFlags.length ? [`-ldflags "${ldFlags.join(" ")}"`] : [],
5679
+ ...buildTags.length ? [`-tags ${buildTags.join(" ")}`] : [],
5675
5680
  `-o "${target}"`,
5676
5681
  `./${srcPath}`
5677
5682
  ].join(" "),
@@ -5697,8 +5702,8 @@ var init_go = __esm({
5697
5702
  [
5698
5703
  "go",
5699
5704
  "build",
5700
- ...ldFlags ? [`-ldflags "${ldFlags.join(" ")}"`] : [],
5701
- ...buildTags ? [`-t ${buildTags.join(" ")}`] : [],
5705
+ ...ldFlags.length ? [`-ldflags "${ldFlags.join(" ")}"`] : [],
5706
+ ...buildTags.length ? [`-tags ${buildTags.join(" ")}`] : [],
5702
5707
  `-o "${target}"`,
5703
5708
  `./${srcPath}`
5704
5709
  ].join(" "),
@@ -8655,7 +8660,7 @@ var dev = (program2) => program2.command(
8655
8660
  }
8656
8661
  lastDeployed = nextChecksum;
8657
8662
  fs19.writeFile(
8658
- path22.join(project.paths.out, "outputs.json"),
8663
+ project.config.outputs || path22.join(project.paths.out, "outputs.json"),
8659
8664
  JSON.stringify(
8660
8665
  mapValues(results, (val) => val.outputs),
8661
8666
  null,
@@ -9185,7 +9190,7 @@ Are you sure you want to deploy to this stage? (y/N) `,
9185
9190
  if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
9186
9191
  process.exit(1);
9187
9192
  fs18.writeFile(
9188
- path21.join(project.paths.out, "outputs.json"),
9193
+ project.config.outputs || path21.join(project.paths.out, "outputs.json"),
9189
9194
  JSON.stringify(
9190
9195
  mapValues(results, (val) => val.outputs),
9191
9196
  null,