sst 2.0.17 → 2.0.18

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.
@@ -25,5 +25,7 @@ export const set = (program) => program.command("set <name> <value>", "Set the v
25
25
  setting.succeed();
26
26
  const restarting = createSpinner(` Restarting all functions using ${blue(args.name)}...`).start();
27
27
  const count = await Config.restart(args.name);
28
- restarting.succeed(` Restarted ${count} functions`);
28
+ restarting.succeed(count === 1
29
+ ? ` Restarted ${count} function`
30
+ : ` Restarted ${count} functions`);
29
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.0.17",
3
+ "version": "2.0.18",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
package/sst.mjs CHANGED
@@ -2488,8 +2488,8 @@ var init_workers = __esm({
2488
2488
  import { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
2489
2489
  import iot from "aws-iot-device-sdk";
2490
2490
  function encode(input) {
2491
- const json3 = JSON.stringify(input);
2492
- const parts = json3.match(/.{1,100000}/g);
2491
+ const json = JSON.stringify(input);
2492
+ const parts = json.match(/.{1,100000}/g);
2493
2493
  if (!parts)
2494
2494
  return [];
2495
2495
  const id = Math.random().toString();
@@ -2884,7 +2884,6 @@ import {
2884
2884
  PutObjectCommand,
2885
2885
  DeleteObjectCommand
2886
2886
  } from "@aws-sdk/client-s3";
2887
- import { json } from "stream/consumers";
2888
2887
  async function metadata() {
2889
2888
  Logger.debug("Fetching app metadata");
2890
2889
  const [project, credentials, bootstrap2] = await Promise.all([
@@ -2902,8 +2901,9 @@ async function metadata() {
2902
2901
  Key: useS3Key(),
2903
2902
  Bucket: bootstrap2.bucket
2904
2903
  })
2905
- ).then((result2) => json(result2.Body));
2906
- return result;
2904
+ );
2905
+ const body = await result.Body.transformToString();
2906
+ return JSON.parse(body);
2907
2907
  } catch (ex) {
2908
2908
  Logger.debug("Fetching app metadata: not found");
2909
2909
  }
@@ -4477,7 +4477,6 @@ import {
4477
4477
  GetObjectCommand as GetObjectCommand2,
4478
4478
  ListObjectsV2Command
4479
4479
  } from "@aws-sdk/client-s3";
4480
- import { json as json2 } from "stream/consumers";
4481
4480
  async function metadata2() {
4482
4481
  Logger.debug("Fetching all metadata");
4483
4482
  const project = useProject();
@@ -4505,8 +4504,9 @@ async function metadata2() {
4505
4504
  Key: obj.Key,
4506
4505
  Bucket: bootstrap2.bucket
4507
4506
  })
4508
- ).then((result3) => json2(result3.Body));
4509
- return [stackID, result2];
4507
+ );
4508
+ const body = await result2.Body.transformToString();
4509
+ return [stackID, JSON.parse(body)];
4510
4510
  }) || []
4511
4511
  )
4512
4512
  );
@@ -4531,8 +4531,9 @@ async function metadataForStack(stackID) {
4531
4531
  Key: key,
4532
4532
  Bucket: bootstrap2.bucket
4533
4533
  })
4534
- ).then((result2) => json2(result2.Body));
4535
- return result;
4534
+ );
4535
+ const body = await result.Body.transformToString();
4536
+ return JSON.parse(body);
4536
4537
  } catch (ex) {
4537
4538
  console.error(ex);
4538
4539
  return [];
@@ -4874,14 +4875,14 @@ var init_node = __esm({
4874
4875
  }
4875
4876
  if (input.mode === "deploy" && nodejs.install) {
4876
4877
  const src = await find2(parsed.dir, "package.json");
4877
- const json3 = JSON.parse(
4878
+ const json = JSON.parse(
4878
4879
  await fs10.readFile(path10.join(src, "package.json")).then((x) => x.toString())
4879
4880
  );
4880
4881
  fs10.writeFile(
4881
4882
  path10.join(input.out, "package.json"),
4882
4883
  JSON.stringify({
4883
4884
  dependencies: Object.fromEntries(
4884
- nodejs.install?.map((x) => [x, json3.dependencies?.[x] || "*"])
4885
+ nodejs.install?.map((x) => [x, json.dependencies?.[x] || "*"])
4885
4886
  )
4886
4887
  })
4887
4888
  );
@@ -7068,7 +7069,9 @@ var set = (program2) => program2.command(
7068
7069
  ` Restarting all functions using ${blue4(args.name)}...`
7069
7070
  ).start();
7070
7071
  const count = await Config2.restart(args.name);
7071
- restarting.succeed(` Restarted ${count} functions`);
7072
+ restarting.succeed(
7073
+ count === 1 ? ` Restarted ${count} function` : ` Restarted ${count} functions`
7074
+ );
7072
7075
  }
7073
7076
  );
7074
7077
 
@@ -1,7 +1,6 @@
1
1
  import { useBootstrap } from "../bootstrap.js";
2
2
  import { useAWSCredentials } from "../credentials.js";
3
3
  import { S3Client, GetObjectCommand, PutObjectCommand, DeleteObjectCommand, } from "@aws-sdk/client-s3";
4
- import { json } from "stream/consumers";
5
4
  import { Context } from "../context/context.js";
6
5
  import { Logger } from "../logger.js";
7
6
  import { useProject } from "../project.js";
@@ -17,13 +16,12 @@ async function metadata() {
17
16
  credentials,
18
17
  });
19
18
  try {
20
- const result = await s3
21
- .send(new GetObjectCommand({
19
+ const result = await s3.send(new GetObjectCommand({
22
20
  Key: useS3Key(),
23
21
  Bucket: bootstrap.bucket,
24
- }))
25
- .then((result) => json(result.Body));
26
- return result;
22
+ }));
23
+ const body = await result.Body.transformToString();
24
+ return JSON.parse(body);
27
25
  }
28
26
  catch (ex) {
29
27
  Logger.debug("Fetching app metadata: not found");
@@ -1,7 +1,6 @@
1
1
  import { useBootstrap } from "../bootstrap.js";
2
2
  import { useAWSCredentials, useAWSCredentialsProvider, } from "../credentials.js";
3
3
  import { S3Client, GetObjectCommand, ListObjectsV2Command, } from "@aws-sdk/client-s3";
4
- import { json } from "stream/consumers";
5
4
  import { useCache } from "../cache.js";
6
5
  import { Context } from "../context/context.js";
7
6
  import { useBus } from "../bus.js";
@@ -25,13 +24,12 @@ export async function metadata() {
25
24
  }));
26
25
  const result = Object.fromEntries(await Promise.all(list.Contents?.map(async (obj) => {
27
26
  const stackID = obj.Key?.split("/").pop();
28
- const result = await s3
29
- .send(new GetObjectCommand({
27
+ const result = await s3.send(new GetObjectCommand({
30
28
  Key: obj.Key,
31
29
  Bucket: bootstrap.bucket,
32
- }))
33
- .then((result) => json(result.Body));
34
- return [stackID, result];
30
+ }));
31
+ const body = await result.Body.transformToString();
32
+ return [stackID, JSON.parse(body)];
35
33
  }) || []));
36
34
  Logger.debug("Fetched metadata from", list.KeyCount, "stacks");
37
35
  return result;
@@ -49,13 +47,12 @@ export async function metadataForStack(stackID) {
49
47
  const key = `stackMetadata/app.${project.config.name}/stage.${project.config.stage}/stack.${stackID}.json`;
50
48
  Logger.debug("Getting metadata", key, "from", bootstrap.bucket);
51
49
  try {
52
- const result = await s3
53
- .send(new GetObjectCommand({
50
+ const result = await s3.send(new GetObjectCommand({
54
51
  Key: key,
55
52
  Bucket: bootstrap.bucket,
56
- }))
57
- .then((result) => json(result.Body));
58
- return result;
53
+ }));
54
+ const body = await result.Body.transformToString();
55
+ return JSON.parse(body);
59
56
  }
60
57
  catch (ex) {
61
58
  console.error(ex);