From ccc39dd151d9201a7205ed0785933aae8e5eb2ce Mon Sep 17 00:00:00 2001 From: Charly POLY Date: Sat, 4 Mar 2023 19:14:08 -0800 Subject: [PATCH] feat: `getExecution(id)` --- .changeset/beige-worms-smoke.md | 5 +++++ src/index.ts | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/beige-worms-smoke.md diff --git a/.changeset/beige-worms-smoke.md b/.changeset/beige-worms-smoke.md new file mode 100644 index 00000000..f53b5c43 --- /dev/null +++ b/.changeset/beige-worms-smoke.md @@ -0,0 +1,5 @@ +--- +"@defer/client": minor +--- + +expose a `getExecution(id)` function diff --git a/src/index.ts b/src/index.ts index 62626baa..6398003e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,7 @@ const FakeID = "00000000000000000000000000000000"; import { enqueueExecution, EnqueueExecutionResponse, + fetchExecution, waitExecutionResult, } from "./client.js"; import { DeferError } from "./errors.js"; @@ -37,6 +38,11 @@ export function configure(opts = {} as Options): void { return; } +export const getExecution = (id: string, client?: HTTPClient) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return fetchExecution(client || __httpClient!, { id }); +}; + export type UnPromise = F extends Promise ? R : F; export type DelayString = `${string}${Units}`;