sst 3.4.28 → 3.4.30
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/task.d.ts +47 -24
- package/dist/aws/task.js +44 -20
- package/package.json +6 -6
package/dist/aws/task.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import { AwsOptions } from "./client.js";
|
|
|
6
6
|
* ```js title="src/app.ts"
|
|
7
7
|
* import { task } from "sst/aws/task";
|
|
8
8
|
* ```
|
|
9
|
+
*
|
|
10
|
+
* If you are not using Node.js, you can use the AWS SDK instead. For example, you can call
|
|
11
|
+
* [`RunTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html) to
|
|
12
|
+
* run a task.
|
|
9
13
|
*/
|
|
10
14
|
export declare namespace task {
|
|
11
15
|
/**
|
|
@@ -54,7 +58,8 @@ export declare namespace task {
|
|
|
54
58
|
}
|
|
55
59
|
export interface Options {
|
|
56
60
|
/**
|
|
57
|
-
* Configure the
|
|
61
|
+
* Configure the options for the [aws4fetch](https://github.com/mhart/aws4fetch)
|
|
62
|
+
* [`AWSClient`](https://github.com/mhart/aws4fetch?tab=readme-ov-file#new-awsclientoptions) used internally by the SDK.
|
|
58
63
|
*/
|
|
59
64
|
aws?: AwsOptions;
|
|
60
65
|
}
|
|
@@ -90,23 +95,30 @@ export declare namespace task {
|
|
|
90
95
|
response: any;
|
|
91
96
|
}
|
|
92
97
|
/**
|
|
93
|
-
*
|
|
98
|
+
* Get the details of a given task.
|
|
99
|
+
*
|
|
100
|
+
* :::note
|
|
101
|
+
* If a task had been stopped over an hour ago, it's not returned.
|
|
102
|
+
* :::
|
|
103
|
+
*
|
|
94
104
|
* @example
|
|
95
|
-
* For example, let's say you have started task.
|
|
96
105
|
*
|
|
97
|
-
*
|
|
98
|
-
* import { Resource } from "sst";
|
|
99
|
-
* import { task } from "sst/aws/task";
|
|
106
|
+
* For example, let's say you had previously started a task.
|
|
100
107
|
*
|
|
108
|
+
* ```js title="src/app.ts"
|
|
101
109
|
* const runRet = await task.run(Resource.MyTask);
|
|
102
110
|
* const taskArn = runRet.tasks[0].taskArn;
|
|
103
111
|
* ```
|
|
104
112
|
*
|
|
105
|
-
* You can get the details of the task
|
|
113
|
+
* You can use that to get the details of the task.
|
|
106
114
|
*
|
|
107
115
|
* ```js title="src/app.ts"
|
|
108
116
|
* const describeRet = await task.describe(Resource.MyTask, taskArn);
|
|
117
|
+
* console.log(describeRet.status);
|
|
109
118
|
* ```
|
|
119
|
+
*
|
|
120
|
+
* If you are not using Node.js, you can use the AWS SDK and call
|
|
121
|
+
* [`DescribeTasks`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html).
|
|
110
122
|
*/
|
|
111
123
|
export function describe(resource: Resource, task: string, options?: Options): Promise<DescribeResponse>;
|
|
112
124
|
/**
|
|
@@ -114,15 +126,15 @@ export declare namespace task {
|
|
|
114
126
|
*
|
|
115
127
|
* @example
|
|
116
128
|
*
|
|
117
|
-
* For example, let's say you have a task.
|
|
129
|
+
* For example, let's say you have defined a task.
|
|
118
130
|
*
|
|
119
131
|
* ```js title="sst.config.ts"
|
|
120
132
|
* cluster.addTask("MyTask");
|
|
121
133
|
* ```
|
|
122
134
|
*
|
|
123
|
-
* You can run
|
|
135
|
+
* You can then run the task in your application with the SDK.
|
|
124
136
|
*
|
|
125
|
-
* ```js title="src/app.ts"
|
|
137
|
+
* ```js title="src/app.ts" {4}
|
|
126
138
|
* import { Resource } from "sst";
|
|
127
139
|
* import { task } from "sst/aws/task";
|
|
128
140
|
*
|
|
@@ -130,31 +142,32 @@ export declare namespace task {
|
|
|
130
142
|
* const taskArn = runRet.tasks[0].taskArn;
|
|
131
143
|
* ```
|
|
132
144
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
145
|
+
* This internally calls an AWS SDK API that returns an array of tasks. But in our case,
|
|
146
|
+
* there's only one task.
|
|
147
|
+
*
|
|
148
|
+
* The `taskArn` is the ARN of the task. You can use it to call the `describe` or `stop`
|
|
149
|
+
* functions.
|
|
135
150
|
*
|
|
136
|
-
* You can also pass in environment variables to the task.
|
|
151
|
+
* You can also pass in any environment variables to the task.
|
|
137
152
|
*
|
|
138
153
|
* ```js title="src/app.ts"
|
|
139
154
|
* await task.run(Resource.MyTask, {
|
|
140
|
-
* MY_ENV_VAR: "my-value"
|
|
155
|
+
* MY_ENV_VAR: "my-value"
|
|
141
156
|
* });
|
|
142
157
|
* ```
|
|
158
|
+
*
|
|
159
|
+
* If you are not using Node.js, you can use the AWS SDK and call
|
|
160
|
+
* [`RunTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html).
|
|
143
161
|
*/
|
|
144
|
-
export function run(resource: Resource, environment?: Record<string, string>, options?:
|
|
145
|
-
aws?: AwsOptions;
|
|
146
|
-
}): Promise<RunResponse>;
|
|
162
|
+
export function run(resource: Resource, environment?: Record<string, string>, options?: Options): Promise<RunResponse>;
|
|
147
163
|
/**
|
|
148
164
|
* Stops a task.
|
|
149
165
|
*
|
|
150
166
|
* @example
|
|
151
167
|
*
|
|
152
|
-
* For example, let's say you
|
|
168
|
+
* For example, let's say you had previously started a task.
|
|
153
169
|
*
|
|
154
170
|
* ```js title="src/app.ts"
|
|
155
|
-
* import { Resource } from "sst";
|
|
156
|
-
* import { task } from "sst/aws/task";
|
|
157
|
-
*
|
|
158
171
|
* const runRet = await task.run(Resource.MyTask);
|
|
159
172
|
* const taskArn = runRet.tasks[0].taskArn;
|
|
160
173
|
* ```
|
|
@@ -163,10 +176,20 @@ export declare namespace task {
|
|
|
163
176
|
*
|
|
164
177
|
* ```js title="src/app.ts"
|
|
165
178
|
* const stopRet = await task.stop(Resource.MyTask, taskArn);
|
|
166
|
-
*
|
|
167
|
-
* // check if the task is stopped
|
|
168
|
-
* console.log(stopRet.task?.lastStatus);
|
|
169
179
|
* ```
|
|
180
|
+
*
|
|
181
|
+
* Stopping a task is asnychronous. When you call `stop`, AWS marks a task to be stopped,
|
|
182
|
+
* but it may take a few minutes for the task to actually stop.
|
|
183
|
+
*
|
|
184
|
+
* :::note
|
|
185
|
+
* Stopping a task in asyncrhonous.
|
|
186
|
+
* :::
|
|
187
|
+
*
|
|
188
|
+
* In most cases you probably don't need to check if it has been stopped. But if necessary,
|
|
189
|
+
* you can use the `describe` function to get a task's status.
|
|
190
|
+
*
|
|
191
|
+
* If you are not using Node.js, you can use the AWS SDK and call
|
|
192
|
+
* [`StopTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_StopTask.html).
|
|
170
193
|
*/
|
|
171
194
|
export function stop(resource: Resource, task: string, options?: Options): Promise<StopResponse>;
|
|
172
195
|
export class DescribeError extends Error {
|
package/dist/aws/task.js
CHANGED
|
@@ -6,6 +6,10 @@ import { client } from "./client.js";
|
|
|
6
6
|
* ```js title="src/app.ts"
|
|
7
7
|
* import { task } from "sst/aws/task";
|
|
8
8
|
* ```
|
|
9
|
+
*
|
|
10
|
+
* If you are not using Node.js, you can use the AWS SDK instead. For example, you can call
|
|
11
|
+
* [`RunTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html) to
|
|
12
|
+
* run a task.
|
|
9
13
|
*/
|
|
10
14
|
export var task;
|
|
11
15
|
(function (task_1) {
|
|
@@ -15,23 +19,30 @@ export var task;
|
|
|
15
19
|
return `https://ecs.${region}.amazonaws.com/`;
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
22
|
+
* Get the details of a given task.
|
|
23
|
+
*
|
|
24
|
+
* :::note
|
|
25
|
+
* If a task had been stopped over an hour ago, it's not returned.
|
|
26
|
+
* :::
|
|
27
|
+
*
|
|
19
28
|
* @example
|
|
20
|
-
* For example, let's say you have started task.
|
|
21
29
|
*
|
|
22
|
-
*
|
|
23
|
-
* import { Resource } from "sst";
|
|
24
|
-
* import { task } from "sst/aws/task";
|
|
30
|
+
* For example, let's say you had previously started a task.
|
|
25
31
|
*
|
|
32
|
+
* ```js title="src/app.ts"
|
|
26
33
|
* const runRet = await task.run(Resource.MyTask);
|
|
27
34
|
* const taskArn = runRet.tasks[0].taskArn;
|
|
28
35
|
* ```
|
|
29
36
|
*
|
|
30
|
-
* You can get the details of the task
|
|
37
|
+
* You can use that to get the details of the task.
|
|
31
38
|
*
|
|
32
39
|
* ```js title="src/app.ts"
|
|
33
40
|
* const describeRet = await task.describe(Resource.MyTask, taskArn);
|
|
41
|
+
* console.log(describeRet.status);
|
|
34
42
|
* ```
|
|
43
|
+
*
|
|
44
|
+
* If you are not using Node.js, you can use the AWS SDK and call
|
|
45
|
+
* [`DescribeTasks`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTasks.html).
|
|
35
46
|
*/
|
|
36
47
|
async function describe(resource, task, options) {
|
|
37
48
|
const c = await client();
|
|
@@ -65,15 +76,15 @@ export var task;
|
|
|
65
76
|
*
|
|
66
77
|
* @example
|
|
67
78
|
*
|
|
68
|
-
* For example, let's say you have a task.
|
|
79
|
+
* For example, let's say you have defined a task.
|
|
69
80
|
*
|
|
70
81
|
* ```js title="sst.config.ts"
|
|
71
82
|
* cluster.addTask("MyTask");
|
|
72
83
|
* ```
|
|
73
84
|
*
|
|
74
|
-
* You can run
|
|
85
|
+
* You can then run the task in your application with the SDK.
|
|
75
86
|
*
|
|
76
|
-
* ```js title="src/app.ts"
|
|
87
|
+
* ```js title="src/app.ts" {4}
|
|
77
88
|
* import { Resource } from "sst";
|
|
78
89
|
* import { task } from "sst/aws/task";
|
|
79
90
|
*
|
|
@@ -81,16 +92,22 @@ export var task;
|
|
|
81
92
|
* const taskArn = runRet.tasks[0].taskArn;
|
|
82
93
|
* ```
|
|
83
94
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
95
|
+
* This internally calls an AWS SDK API that returns an array of tasks. But in our case,
|
|
96
|
+
* there's only one task.
|
|
97
|
+
*
|
|
98
|
+
* The `taskArn` is the ARN of the task. You can use it to call the `describe` or `stop`
|
|
99
|
+
* functions.
|
|
86
100
|
*
|
|
87
|
-
* You can also pass in environment variables to the task.
|
|
101
|
+
* You can also pass in any environment variables to the task.
|
|
88
102
|
*
|
|
89
103
|
* ```js title="src/app.ts"
|
|
90
104
|
* await task.run(Resource.MyTask, {
|
|
91
|
-
* MY_ENV_VAR: "my-value"
|
|
105
|
+
* MY_ENV_VAR: "my-value"
|
|
92
106
|
* });
|
|
93
107
|
* ```
|
|
108
|
+
*
|
|
109
|
+
* If you are not using Node.js, you can use the AWS SDK and call
|
|
110
|
+
* [`RunTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html).
|
|
94
111
|
*/
|
|
95
112
|
async function run(resource, environment, options) {
|
|
96
113
|
const c = await client();
|
|
@@ -141,12 +158,9 @@ export var task;
|
|
|
141
158
|
*
|
|
142
159
|
* @example
|
|
143
160
|
*
|
|
144
|
-
* For example, let's say you
|
|
161
|
+
* For example, let's say you had previously started a task.
|
|
145
162
|
*
|
|
146
163
|
* ```js title="src/app.ts"
|
|
147
|
-
* import { Resource } from "sst";
|
|
148
|
-
* import { task } from "sst/aws/task";
|
|
149
|
-
*
|
|
150
164
|
* const runRet = await task.run(Resource.MyTask);
|
|
151
165
|
* const taskArn = runRet.tasks[0].taskArn;
|
|
152
166
|
* ```
|
|
@@ -155,10 +169,20 @@ export var task;
|
|
|
155
169
|
*
|
|
156
170
|
* ```js title="src/app.ts"
|
|
157
171
|
* const stopRet = await task.stop(Resource.MyTask, taskArn);
|
|
158
|
-
*
|
|
159
|
-
* // check if the task is stopped
|
|
160
|
-
* console.log(stopRet.task?.lastStatus);
|
|
161
172
|
* ```
|
|
173
|
+
*
|
|
174
|
+
* Stopping a task is asnychronous. When you call `stop`, AWS marks a task to be stopped,
|
|
175
|
+
* but it may take a few minutes for the task to actually stop.
|
|
176
|
+
*
|
|
177
|
+
* :::note
|
|
178
|
+
* Stopping a task in asyncrhonous.
|
|
179
|
+
* :::
|
|
180
|
+
*
|
|
181
|
+
* In most cases you probably don't need to check if it has been stopped. But if necessary,
|
|
182
|
+
* you can use the `describe` function to get a task's status.
|
|
183
|
+
*
|
|
184
|
+
* If you are not using Node.js, you can use the AWS SDK and call
|
|
185
|
+
* [`StopTask`](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_StopTask.html).
|
|
162
186
|
*/
|
|
163
187
|
async function stop(resource, task, options) {
|
|
164
188
|
const c = await client();
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "sst",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"version": "3.4.
|
|
6
|
+
"version": "3.4.30",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/index.js",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"sst-linux-x64": "3.4.
|
|
50
|
-
"sst-linux-x86": "3.4.
|
|
51
|
-
"sst-linux-arm64": "3.4.
|
|
52
|
-
"sst-darwin-x64": "3.4.
|
|
53
|
-
"sst-darwin-arm64": "3.4.
|
|
49
|
+
"sst-linux-x64": "3.4.30",
|
|
50
|
+
"sst-linux-x86": "3.4.30",
|
|
51
|
+
"sst-linux-arm64": "3.4.30",
|
|
52
|
+
"sst-darwin-x64": "3.4.30",
|
|
53
|
+
"sst-darwin-arm64": "3.4.30"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"aws4fetch": "^1.0.18",
|