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}`;