sst 4.10.1 → 4.11.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.
package/dist/aws/bus.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { aws } from "./client.js";
1
+ import { type AwsOptions } from "./client.js";
2
2
  import { Resource } from "../resource/index.js";
3
3
  import { event } from "../event/index.js";
4
4
  import { EventBridgeEvent, EventBridgeHandler, Context } from "aws-lambda";
@@ -19,7 +19,7 @@ export declare namespace bus {
19
19
  name: string;
20
20
  }, def: Definition | string, properties: Definition["$input"], options?: {
21
21
  metadata?: Definition["$metadata"];
22
- aws?: aws.Options;
22
+ aws?: AwsOptions;
23
23
  }): Promise<any>;
24
24
  class PublishError extends Error {
25
25
  readonly response: Response;
package/dist/aws/bus.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aws } from "./client.js";
1
+ import { awsFetch } from "./client.js";
2
2
  import { Resource } from "../resource/index.js";
3
3
  export var bus;
4
4
  (function (bus) {
@@ -25,7 +25,7 @@ export var bus;
25
25
  metadata: options?.metadata || {},
26
26
  }
27
27
  : await def.create(properties, options?.metadata);
28
- const res = await aws.fetch("events", "/", {
28
+ const res = await awsFetch("events", "/", {
29
29
  method: "POST",
30
30
  headers: {
31
31
  "X-Amz-Target": "AWSEvents.PutEvents",
@@ -1,12 +1,8 @@
1
1
  import { AwsClient } from "aws4fetch";
2
2
  type AwsFetchOptions = Exclude<Parameters<AwsClient["fetch"]>[1], null | undefined>;
3
- export declare namespace aws {
4
- type Options = Exclude<Parameters<AwsClient["fetch"]>[1], null | undefined>["aws"];
5
- function client(): Promise<AwsClient>;
6
- function fetch(service: string, path: string, init: Omit<AwsFetchOptions, "aws">, options?: {
7
- aws?: Options;
8
- }): Promise<Response>;
9
- }
3
+ export type AwsOptions = Exclude<Parameters<AwsClient["fetch"]>[1], null | undefined>["aws"];
10
4
  export declare function client(): Promise<AwsClient>;
11
- export type AwsOptions = aws.Options;
5
+ export declare function awsFetch(service: string, path: string, init: Omit<AwsFetchOptions, "aws">, options?: {
6
+ aws?: AwsOptions;
7
+ }): Promise<Response>;
12
8
  export {};
@@ -13,40 +13,32 @@ async function getCredentials(url) {
13
13
  cachedCredentials = credentials;
14
14
  return credentials;
15
15
  }
16
- export var aws;
17
- (function (aws) {
18
- async function client() {
19
- if (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) {
20
- return new AwsClient({
21
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
22
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
23
- sessionToken: process.env.AWS_SESSION_TOKEN,
24
- region: process.env.AWS_REGION,
25
- });
26
- }
27
- if (process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) {
28
- const credentials = await getCredentials("http://169.254.170.2" +
29
- process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI);
30
- return new AwsClient({
31
- accessKeyId: credentials.AccessKeyId,
32
- secretAccessKey: credentials.SecretAccessKey,
33
- sessionToken: credentials.Token,
34
- region: process.env.AWS_REGION,
35
- });
36
- }
37
- throw new Error("No AWS credentials found");
16
+ export async function client() {
17
+ if (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) {
18
+ return new AwsClient({
19
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
20
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
21
+ sessionToken: process.env.AWS_SESSION_TOKEN,
22
+ region: process.env.AWS_REGION,
23
+ });
38
24
  }
39
- aws.client = client;
40
- async function fetch(service, path, init, options) {
41
- const c = await client();
42
- const region = options?.aws?.region ?? c.region;
43
- return c.fetch(`https://${service}.${region}.amazonaws.com${path}`, {
44
- ...init,
45
- aws: options?.aws,
25
+ if (process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) {
26
+ const credentials = await getCredentials("http://169.254.170.2" +
27
+ process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI);
28
+ return new AwsClient({
29
+ accessKeyId: credentials.AccessKeyId,
30
+ secretAccessKey: credentials.SecretAccessKey,
31
+ sessionToken: credentials.Token,
32
+ region: process.env.AWS_REGION,
46
33
  });
47
34
  }
48
- aws.fetch = fetch;
49
- })(aws || (aws = {}));
50
- export async function client() {
51
- return aws.client();
35
+ throw new Error("No AWS credentials found");
36
+ }
37
+ export async function awsFetch(service, path, init, options) {
38
+ const c = await client();
39
+ const region = options?.aws?.region ?? c.region;
40
+ return c.fetch(`https://${service}.${region}.amazonaws.com${path}`, {
41
+ ...init,
42
+ aws: options?.aws,
43
+ });
52
44
  }
@@ -1,4 +1,4 @@
1
- import { aws } from "./client.js";
1
+ import { type AwsOptions } from "./client.js";
2
2
  /**
3
3
  * The `task` client SDK is available through the following.
4
4
  *
@@ -61,7 +61,7 @@ export declare namespace task {
61
61
  * Configure the options for the [aws4fetch](https://github.com/mhart/aws4fetch)
62
62
  * [`AWSClient`](https://github.com/mhart/aws4fetch?tab=readme-ov-file#new-awsclientoptions) used internally by the SDK.
63
63
  */
64
- aws?: aws.Options;
64
+ aws?: AwsOptions;
65
65
  }
66
66
  export interface RunOptions extends Options {
67
67
  /**
package/dist/aws/task.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aws } from "./client.js";
1
+ import { awsFetch } from "./client.js";
2
2
  /**
3
3
  * The `task` client SDK is available through the following.
4
4
  *
@@ -40,7 +40,7 @@ export var task;
40
40
  * [`DescribeTasks`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html).
41
41
  */
42
42
  async function describe(resource, task, options) {
43
- const res = await aws.fetch("ecs", "/", {
43
+ const res = await awsFetch("ecs", "/", {
44
44
  method: "POST",
45
45
  headers: {
46
46
  "X-Amz-Target": "AmazonEC2ContainerServiceV20141113.DescribeTasks",
@@ -102,7 +102,7 @@ export var task;
102
102
  * [`RunTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html).
103
103
  */
104
104
  async function run(resource, environment, options) {
105
- const res = await aws.fetch("ecs", "/", {
105
+ const res = await awsFetch("ecs", "/", {
106
106
  method: "POST",
107
107
  headers: {
108
108
  "X-Amz-Target": "AmazonEC2ContainerServiceV20141113.RunTask",
@@ -182,7 +182,7 @@ export var task;
182
182
  * [`StopTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_StopTask.html).
183
183
  */
184
184
  async function stop(resource, task, options) {
185
- const res = await aws.fetch("ecs", "/", {
185
+ const res = await awsFetch("ecs", "/", {
186
186
  method: "POST",
187
187
  headers: {
188
188
  "X-Amz-Target": "AmazonEC2ContainerServiceV20141113.StopTask",
@@ -1,5 +1,5 @@
1
1
  import * as durable from "@aws/durable-execution-sdk-js";
2
- import { aws } from "./client.js";
2
+ import { type AwsOptions } from "./client.js";
3
3
  /**
4
4
  * The `workflow` SDK is a thin wrapper around the
5
5
  * [`@aws/durable-execution-sdk-js`](https://www.npmjs.com/package/@aws/durable-execution-sdk-js)
@@ -100,7 +100,7 @@ export declare namespace workflow {
100
100
  * Configure the options for the [aws4fetch](https://github.com/mhart/aws4fetch)
101
101
  * [`AWSClient`](https://github.com/mhart/aws4fetch?tab=readme-ov-file#new-awsclientoptions) used internally by the SDK.
102
102
  */
103
- aws?: aws.Options;
103
+ aws?: AwsOptions;
104
104
  }
105
105
  interface StartResponse {
106
106
  /**
@@ -1,5 +1,5 @@
1
1
  import * as durable from "@aws/durable-execution-sdk-js";
2
- import { aws } from "./client.js";
2
+ import { awsFetch } from "./client.js";
3
3
  /**
4
4
  * The `workflow` SDK is a thin wrapper around the
5
5
  * [`@aws/durable-execution-sdk-js`](https://www.npmjs.com/package/@aws/durable-execution-sdk-js)
@@ -102,7 +102,7 @@ export var workflow;
102
102
  const query = new URLSearchParams({
103
103
  Qualifier: resource.qualifier,
104
104
  });
105
- const response = await aws.fetch("lambda", `/2015-03-31/functions/${encodeURIComponent(resource.name)}/invocations?${query.toString()}`, {
105
+ const response = await awsFetch("lambda", `/2015-03-31/functions/${encodeURIComponent(resource.name)}/invocations?${query.toString()}`, {
106
106
  method: "POST",
107
107
  headers: {
108
108
  "Content-Type": "application/json",
@@ -153,7 +153,7 @@ export var workflow;
153
153
  params.set("StartedBefore", startedBefore);
154
154
  if (direction === "desc")
155
155
  params.set("ReverseOrder", "true");
156
- const response = await aws.fetch("lambda", `/2025-12-01/functions/${encodeURIComponent(resource.name)}/durable-executions?${params.toString()}`, {
156
+ const response = await awsFetch("lambda", `/2025-12-01/functions/${encodeURIComponent(resource.name)}/durable-executions?${params.toString()}`, {
157
157
  method: "GET",
158
158
  }, options);
159
159
  if (!response.ok)
@@ -171,7 +171,7 @@ export var workflow;
171
171
  * Get the details for a single workflow execution.
172
172
  */
173
173
  async function describe(arn, options) {
174
- const response = await aws.fetch("lambda", `/2025-12-01/durable-executions/${encodeURIComponent(arn)}`, {
174
+ const response = await awsFetch("lambda", `/2025-12-01/durable-executions/${encodeURIComponent(arn)}`, {
175
175
  method: "GET",
176
176
  }, options);
177
177
  if (!response.ok)
@@ -195,7 +195,7 @@ export var workflow;
195
195
  * Stop a running workflow execution.
196
196
  */
197
197
  async function stop(arn, input, options) {
198
- const response = await aws.fetch("lambda", `/2025-12-01/durable-executions/${encodeURIComponent(arn)}/stop`, {
198
+ const response = await awsFetch("lambda", `/2025-12-01/durable-executions/${encodeURIComponent(arn)}/stop`, {
199
199
  method: "POST",
200
200
  headers: input?.error
201
201
  ? {
@@ -225,7 +225,7 @@ export var workflow;
225
225
  * [`SendDurableExecutionCallbackSuccess`](https://docs.aws.amazon.com/lambda/latest/api/API_SendDurableExecutionCallbackSuccess.html).
226
226
  */
227
227
  async function succeed(token, input = {}, options) {
228
- const response = await aws.fetch("lambda", `/2025-12-01/durable-execution-callbacks/${encodeURIComponent(token)}/succeed`, {
228
+ const response = await awsFetch("lambda", `/2025-12-01/durable-execution-callbacks/${encodeURIComponent(token)}/succeed`, {
229
229
  method: "POST",
230
230
  headers: {
231
231
  "Content-Type": "application/json",
@@ -245,7 +245,7 @@ export var workflow;
245
245
  * [`SendDurableExecutionCallbackFailure`](https://docs.aws.amazon.com/lambda/latest/api/API_SendDurableExecutionCallbackFailure.html).
246
246
  */
247
247
  async function fail(token, input, options) {
248
- const response = await aws.fetch("lambda", `/2025-12-01/durable-execution-callbacks/${encodeURIComponent(token)}/fail`, {
248
+ const response = await awsFetch("lambda", `/2025-12-01/durable-execution-callbacks/${encodeURIComponent(token)}/fail`, {
249
249
  method: "POST",
250
250
  headers: {
251
251
  "Content-Type": "application/json",
@@ -266,7 +266,7 @@ export var workflow;
266
266
  * [`SendDurableExecutionCallbackHeartbeat`](https://docs.aws.amazon.com/lambda/latest/api/API_SendDurableExecutionCallbackHeartbeat.html).
267
267
  */
268
268
  async function heartbeat(token, options) {
269
- const response = await aws.fetch("lambda", `/2025-12-01/durable-execution-callbacks/${encodeURIComponent(token)}/heartbeat`, {
269
+ const response = await awsFetch("lambda", `/2025-12-01/durable-execution-callbacks/${encodeURIComponent(token)}/heartbeat`, {
270
270
  method: "POST",
271
271
  }, options);
272
272
  if (!response.ok)
@@ -5,6 +5,9 @@ export function fromCloudflareEnv(input) {
5
5
  loadFromCloudflareEnv(input);
6
6
  }
7
7
  export function wrapCloudflareHandler(handler) {
8
+ if (handler == null) {
9
+ return undefined;
10
+ }
8
11
  if (typeof handler === "function" && handler.hasOwnProperty("prototype")) {
9
12
  return class extends handler {
10
13
  constructor(ctx, env) {
@@ -1,5 +1,5 @@
1
1
  import { Resource } from "../resource/index.js";
2
- import { aws } from "../aws/client.js";
2
+ import { client } from "../aws/client.js";
3
3
  /**
4
4
  * Create a client to interact with the Vector database.
5
5
  * @example
@@ -48,7 +48,7 @@ export function VectorClient(name) {
48
48
  }
49
49
  async function invokeFunction(functionName, body, errorMessage, attempts = 0) {
50
50
  try {
51
- const c = await aws.client();
51
+ const c = await client();
52
52
  const endpoint = `https://lambda.${process.env.AWS_REGION}.amazonaws.com/2015-03-31`;
53
53
  const response = await c.fetch(`${endpoint}/functions/${functionName}/invocations`, {
54
54
  method: "POST",
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "./dist/resource/node.js",
7
7
  "./dist/resource/cloudflare.js"
8
8
  ],
9
- "version": "4.10.1",
9
+ "version": "4.11.0",
10
10
  "main": "./dist/index.js",
11
11
  "repository": {
12
12
  "type": "git",
@@ -58,14 +58,14 @@
58
58
  "sst": "./bin/sst.mjs"
59
59
  },
60
60
  "optionalDependencies": {
61
- "sst-linux-x64": "4.10.1",
62
- "sst-linux-x86": "4.10.1",
63
- "sst-darwin-x64": "4.10.1",
64
- "sst-linux-arm64": "4.10.1",
65
- "sst-darwin-arm64": "4.10.1",
66
- "sst-win32-x64": "4.10.1",
67
- "sst-win32-x86": "4.10.1",
68
- "sst-win32-arm64": "4.10.1"
61
+ "sst-linux-x64": "4.11.0",
62
+ "sst-linux-x86": "4.11.0",
63
+ "sst-darwin-x64": "4.11.0",
64
+ "sst-linux-arm64": "4.11.0",
65
+ "sst-darwin-arm64": "4.11.0",
66
+ "sst-win32-x64": "4.11.0",
67
+ "sst-win32-x86": "4.11.0",
68
+ "sst-win32-arm64": "4.11.0"
69
69
  },
70
70
  "dependencies": {
71
71
  "@aws/durable-execution-sdk-js": "1.0.2",