Comparing version 3.4.25 to 3.4.26
@@ -29,3 +29,3 @@ import { AwsOptions } from "./client.js"; | ||
*/ | ||
interface Resource { | ||
export interface Resource { | ||
/** | ||
@@ -56,3 +56,3 @@ * The ARN of the cluster. | ||
} | ||
interface Options { | ||
export interface Options { | ||
/** | ||
@@ -63,5 +63,35 @@ * Configure the AWS client. | ||
} | ||
interface Task { | ||
/** | ||
* The ARN of the task. | ||
*/ | ||
arn: string; | ||
/** | ||
* The status of the task. | ||
*/ | ||
status: string; | ||
} | ||
export interface DescribeResponse extends Task { | ||
/** | ||
* The raw response from the AWS ECS DescribeTasks API. | ||
* @see [@aws-sdk/client-ecs.DescribeTasksResponse](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/DescribeTasksResponse/) | ||
*/ | ||
response: any; | ||
} | ||
export interface RunResponse extends Task { | ||
/** | ||
* The raw response from the AWS ECS RunTask API. | ||
* @see [@aws-sdk/client-ecs.RunTaskResponse](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/RunTaskResponse/) | ||
*/ | ||
response: any; | ||
} | ||
export interface StopResponse extends Task { | ||
/** | ||
* The raw response from the AWS ECS StopTask API. | ||
* @see [@aws-sdk/client-ecs.StopTaskResponse](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/StopTaskResponse/) | ||
*/ | ||
response: any; | ||
} | ||
/** | ||
* Gets the details of a task. Tasks stopped longer than 1 hour are not returned. | ||
* | ||
* @example | ||
@@ -84,3 +114,3 @@ * For example, let's say you have started task. | ||
*/ | ||
function describe(resource: Resource, task: string, options?: Options): Promise<any>; | ||
export function describe(resource: Resource, task: string, options?: Options): Promise<DescribeResponse>; | ||
/** | ||
@@ -118,5 +148,5 @@ * Runs a task. | ||
*/ | ||
function run(resource: Resource, environment?: Record<string, string>, options?: { | ||
export function run(resource: Resource, environment?: Record<string, string>, options?: { | ||
aws?: AwsOptions; | ||
}): Promise<any>; | ||
}): Promise<RunResponse>; | ||
/** | ||
@@ -146,15 +176,16 @@ * Stops a task. | ||
*/ | ||
function stop(resource: Resource, task: string, options?: Options): Promise<any>; | ||
class DescribeError extends Error { | ||
export function stop(resource: Resource, task: string, options?: Options): Promise<StopResponse>; | ||
export class DescribeError extends Error { | ||
readonly response: Response; | ||
constructor(response: Response); | ||
} | ||
class RunError extends Error { | ||
export class RunError extends Error { | ||
readonly response: Response; | ||
constructor(response: Response); | ||
} | ||
class StopError extends Error { | ||
export class StopError extends Error { | ||
readonly response: Response; | ||
constructor(response: Response); | ||
} | ||
export {}; | ||
} |
@@ -19,3 +19,2 @@ import { client } from "./client.js"; | ||
* Gets the details of a task. Tasks stopped longer than 1 hour are not returned. | ||
* | ||
* @example | ||
@@ -55,3 +54,10 @@ * For example, let's say you have started task. | ||
throw new DescribeError(res); | ||
return res.json(); | ||
const data = (await res.json()); | ||
if (!data.tasks?.length) | ||
throw new DescribeError(res); | ||
return { | ||
arn: data.tasks[0].taskArn, | ||
status: data.tasks[0].lastStatus, | ||
response: data, | ||
}; | ||
} | ||
@@ -125,3 +131,10 @@ task_1.describe = describe; | ||
throw new RunError(res); | ||
return res.json(); | ||
const data = (await res.json()); | ||
if (!data.tasks?.length) | ||
throw new RunError(res); | ||
return { | ||
arn: data.tasks[0].taskArn, | ||
status: data.tasks[0].lastStatus, | ||
response: data, | ||
}; | ||
} | ||
@@ -170,3 +183,10 @@ task_1.run = run; | ||
throw new StopError(res); | ||
return res.json(); | ||
const data = (await res.json()); | ||
if (!data.task) | ||
throw new StopError(res); | ||
return { | ||
arn: data.task.taskArn, | ||
status: data.task.lastStatus, | ||
response: data, | ||
}; | ||
} | ||
@@ -173,0 +193,0 @@ task_1.stop = stop; |
@@ -6,3 +6,3 @@ { | ||
"sideEffects": false, | ||
"version": "3.4.25", | ||
"version": "3.4.26", | ||
"main": "./dist/index.js", | ||
@@ -50,7 +50,7 @@ "exports": { | ||
"optionalDependencies": { | ||
"sst-linux-x86": "3.4.25", | ||
"sst-linux-arm64": "3.4.25", | ||
"sst-linux-x64": "3.4.25", | ||
"sst-darwin-x64": "3.4.25", | ||
"sst-darwin-arm64": "3.4.25" | ||
"sst-linux-x64": "3.4.26", | ||
"sst-linux-x86": "3.4.26", | ||
"sst-linux-arm64": "3.4.26", | ||
"sst-darwin-x64": "3.4.26", | ||
"sst-darwin-arm64": "3.4.26" | ||
}, | ||
@@ -57,0 +57,0 @@ "dependencies": { |
81832
58
2288