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 +2 -2
- package/dist/aws/bus.js +2 -2
- package/dist/aws/client.d.ts +4 -8
- package/dist/aws/client.js +25 -33
- package/dist/aws/task.d.ts +2 -2
- package/dist/aws/task.js +4 -4
- package/dist/aws/workflow.d.ts +2 -2
- package/dist/aws/workflow.js +8 -8
- package/dist/resource/cloudflare.js +3 -0
- package/dist/vector/index.js +2 -2
- package/package.json +9 -9
package/dist/aws/bus.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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?:
|
|
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 {
|
|
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
|
|
28
|
+
const res = await awsFetch("events", "/", {
|
|
29
29
|
method: "POST",
|
|
30
30
|
headers: {
|
|
31
31
|
"X-Amz-Target": "AWSEvents.PutEvents",
|
package/dist/aws/client.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { AwsClient } from "aws4fetch";
|
|
2
2
|
type AwsFetchOptions = Exclude<Parameters<AwsClient["fetch"]>[1], null | undefined>;
|
|
3
|
-
export
|
|
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
|
|
5
|
+
export declare function awsFetch(service: string, path: string, init: Omit<AwsFetchOptions, "aws">, options?: {
|
|
6
|
+
aws?: AwsOptions;
|
|
7
|
+
}): Promise<Response>;
|
|
12
8
|
export {};
|
package/dist/aws/client.js
CHANGED
|
@@ -13,40 +13,32 @@ async function getCredentials(url) {
|
|
|
13
13
|
cachedCredentials = credentials;
|
|
14
14
|
return credentials;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
49
|
-
}
|
|
50
|
-
export async function
|
|
51
|
-
|
|
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
|
}
|
package/dist/aws/task.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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?:
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
185
|
+
const res = await awsFetch("ecs", "/", {
|
|
186
186
|
method: "POST",
|
|
187
187
|
headers: {
|
|
188
188
|
"X-Amz-Target": "AmazonEC2ContainerServiceV20141113.StopTask",
|
package/dist/aws/workflow.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as durable from "@aws/durable-execution-sdk-js";
|
|
2
|
-
import {
|
|
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?:
|
|
103
|
+
aws?: AwsOptions;
|
|
104
104
|
}
|
|
105
105
|
interface StartResponse {
|
|
106
106
|
/**
|
package/dist/aws/workflow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as durable from "@aws/durable-execution-sdk-js";
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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) {
|
package/dist/vector/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Resource } from "../resource/index.js";
|
|
2
|
-
import {
|
|
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
|
|
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.
|
|
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.
|
|
62
|
-
"sst-linux-x86": "4.
|
|
63
|
-
"sst-darwin-x64": "4.
|
|
64
|
-
"sst-linux-arm64": "4.
|
|
65
|
-
"sst-darwin-arm64": "4.
|
|
66
|
-
"sst-win32-x64": "4.
|
|
67
|
-
"sst-win32-x86": "4.
|
|
68
|
-
"sst-win32-arm64": "4.
|
|
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",
|