Skip to content

Commit

Permalink
feat: getExecution(id)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlypoly committed Mar 5, 2023
1 parent 53fe187 commit ccc39dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-worms-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@defer/client": minor
---

expose a `getExecution(id)` function
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const FakeID = "00000000000000000000000000000000";
import {
enqueueExecution,
EnqueueExecutionResponse,
fetchExecution,
waitExecutionResult,
} from "./client.js";
import { DeferError } from "./errors.js";
Expand Down Expand Up @@ -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> = F extends Promise<infer R> ? R : F;

export type DelayString = `${string}${Units}`;
Expand Down

0 comments on commit ccc39dd

Please sign in to comment.