sst 2.24.16 → 2.24.17

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,10 @@ export type ApiHandlerTypes = Extract<HandlerTypes, "api" | "ws">;
10
10
  export declare const Api: ApiResources;
11
11
  export declare const AppSyncApi: AppSyncApiResources;
12
12
  export declare const ApiGatewayV1Api: ApiGatewayV1ApiResources;
13
+ export declare class Response {
14
+ readonly result: APIGatewayProxyStructuredResultV2;
15
+ constructor(result: APIGatewayProxyStructuredResultV2);
16
+ }
13
17
  /**
14
18
  * Create a new api handler that can be used to create an authenticated session.
15
19
  *
package/node/api/index.js CHANGED
@@ -6,6 +6,12 @@ export const AppSyncApi =
6
6
  /* @__PURE__ */ createProxy("AppSyncApi");
7
7
  export const ApiGatewayV1Api =
8
8
  /* @__PURE__ */ createProxy("ApiGatewayV1Api");
9
+ export class Response {
10
+ result;
11
+ constructor(result) {
12
+ this.result = result;
13
+ }
14
+ }
9
15
  /**
10
16
  * Create a new api handler that can be used to create an authenticated session.
11
17
  *
@@ -17,7 +23,17 @@ export const ApiGatewayV1Api =
17
23
  */
18
24
  export function ApiHandler(cb) {
19
25
  return Handler("api", async (evt, ctx) => {
20
- const result = await cb(evt, ctx);
26
+ let result;
27
+ try {
28
+ result = await cb(evt, ctx);
29
+ }
30
+ catch (e) {
31
+ if (e instanceof Response) {
32
+ result = e.result;
33
+ }
34
+ else
35
+ throw e;
36
+ }
21
37
  const serialized = useResponse().serialize(result || {});
22
38
  return serialized;
23
39
  });
@@ -93,9 +93,7 @@ function verify(token) {
93
93
  })(token);
94
94
  return jwt;
95
95
  }
96
- catch (e) {
97
- console.log(e);
98
- }
96
+ catch (e) { }
99
97
  }
100
98
  return {
101
99
  type: "public",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.24.16",
4
+ "version": "2.24.17",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },