sst 3.4.25 → 3.4.26

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.
@@ -26,7 +26,7 @@ export declare namespace task {
26
26
  * console.log(Resource.MyTask);
27
27
  * ```
28
28
  */
29
- interface Resource {
29
+ export interface Resource {
30
30
  /**
31
31
  * The ARN of the cluster.
32
32
  */
@@ -52,15 +52,45 @@ export declare namespace task {
52
52
  */
53
53
  containers: string[];
54
54
  }
55
- interface Options {
55
+ export interface Options {
56
56
  /**
57
57
  * Configure the AWS client.
58
58
  */
59
59
  aws?: AwsOptions;
60
60
  }
61
+ interface Task {
62
+ /**
63
+ * The ARN of the task.
64
+ */
65
+ arn: string;
66
+ /**
67
+ * The status of the task.
68
+ */
69
+ status: string;
70
+ }
71
+ export interface DescribeResponse extends Task {
72
+ /**
73
+ * The raw response from the AWS ECS DescribeTasks API.
74
+ * @see [@aws-sdk/client-ecs.DescribeTasksResponse](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/DescribeTasksResponse/)
75
+ */
76
+ response: any;
77
+ }
78
+ export interface RunResponse extends Task {
79
+ /**
80
+ * The raw response from the AWS ECS RunTask API.
81
+ * @see [@aws-sdk/client-ecs.RunTaskResponse](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/RunTaskResponse/)
82
+ */
83
+ response: any;
84
+ }
85
+ export interface StopResponse extends Task {
86
+ /**
87
+ * The raw response from the AWS ECS StopTask API.
88
+ * @see [@aws-sdk/client-ecs.StopTaskResponse](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/StopTaskResponse/)
89
+ */
90
+ response: any;
91
+ }
61
92
  /**
62
93
  * Gets the details of a task. Tasks stopped longer than 1 hour are not returned.
63
- *
64
94
  * @example
65
95
  * For example, let's say you have started task.
66
96
  *
@@ -78,7 +108,7 @@ export declare namespace task {
78
108
  * const describeRet = await task.describe(Resource.MyTask, taskArn);
79
109
  * ```
80
110
  */
81
- function describe(resource: Resource, task: string, options?: Options): Promise<any>;
111
+ export function describe(resource: Resource, task: string, options?: Options): Promise<DescribeResponse>;
82
112
  /**
83
113
  * Runs a task.
84
114
  *
@@ -111,9 +141,9 @@ export declare namespace task {
111
141
  * });
112
142
  * ```
113
143
  */
114
- function run(resource: Resource, environment?: Record<string, string>, options?: {
144
+ export function run(resource: Resource, environment?: Record<string, string>, options?: {
115
145
  aws?: AwsOptions;
116
- }): Promise<any>;
146
+ }): Promise<RunResponse>;
117
147
  /**
118
148
  * Stops a task.
119
149
  *
@@ -138,17 +168,18 @@ export declare namespace task {
138
168
  * console.log(stopRet.task?.lastStatus);
139
169
  * ```
140
170
  */
141
- function stop(resource: Resource, task: string, options?: Options): Promise<any>;
142
- class DescribeError extends Error {
171
+ export function stop(resource: Resource, task: string, options?: Options): Promise<StopResponse>;
172
+ export class DescribeError extends Error {
143
173
  readonly response: Response;
144
174
  constructor(response: Response);
145
175
  }
146
- class RunError extends Error {
176
+ export class RunError extends Error {
147
177
  readonly response: Response;
148
178
  constructor(response: Response);
149
179
  }
150
- class StopError extends Error {
180
+ export class StopError extends Error {
151
181
  readonly response: Response;
152
182
  constructor(response: Response);
153
183
  }
184
+ export {};
154
185
  }
package/dist/aws/task.js CHANGED
@@ -16,7 +16,6 @@ export var task;
16
16
  }
17
17
  /**
18
18
  * Gets the details of a task. Tasks stopped longer than 1 hour are not returned.
19
- *
20
19
  * @example
21
20
  * For example, let's say you have started task.
22
21
  *
@@ -51,7 +50,14 @@ export var task;
51
50
  });
52
51
  if (!res.ok)
53
52
  throw new DescribeError(res);
54
- return res.json();
53
+ const data = (await res.json());
54
+ if (!data.tasks?.length)
55
+ throw new DescribeError(res);
56
+ return {
57
+ arn: data.tasks[0].taskArn,
58
+ status: data.tasks[0].lastStatus,
59
+ response: data,
60
+ };
55
61
  }
56
62
  task_1.describe = describe;
57
63
  /**
@@ -120,7 +126,14 @@ export var task;
120
126
  });
121
127
  if (!res.ok)
122
128
  throw new RunError(res);
123
- return res.json();
129
+ const data = (await res.json());
130
+ if (!data.tasks?.length)
131
+ throw new RunError(res);
132
+ return {
133
+ arn: data.tasks[0].taskArn,
134
+ status: data.tasks[0].lastStatus,
135
+ response: data,
136
+ };
124
137
  }
125
138
  task_1.run = run;
126
139
  /**
@@ -164,7 +177,14 @@ export var task;
164
177
  });
165
178
  if (!res.ok)
166
179
  throw new StopError(res);
167
- return res.json();
180
+ const data = (await res.json());
181
+ if (!data.task)
182
+ throw new StopError(res);
183
+ return {
184
+ arn: data.task.taskArn,
185
+ status: data.task.lastStatus,
186
+ response: data,
187
+ };
168
188
  }
169
189
  task_1.stop = stop;
170
190
  class DescribeError extends Error {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "sst",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "version": "3.4.25",
6
+ "version": "3.4.26",
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-x86": "3.4.25",
50
- "sst-linux-arm64": "3.4.25",
51
- "sst-linux-x64": "3.4.25",
52
- "sst-darwin-x64": "3.4.25",
53
- "sst-darwin-arm64": "3.4.25"
49
+ "sst-linux-x64": "3.4.26",
50
+ "sst-linux-x86": "3.4.26",
51
+ "sst-linux-arm64": "3.4.26",
52
+ "sst-darwin-x64": "3.4.26",
53
+ "sst-darwin-arm64": "3.4.26"
54
54
  },
55
55
  "dependencies": {
56
56
  "aws4fetch": "^1.0.18",