@defer/client
Advanced tools
Comparing version 1.2.0-alpha-20230316211840-d9dcfae to 1.2.0-alpha-20230316215837-6df9ddd
@@ -65,3 +65,3 @@ "use strict"; | ||
} | ||
const getExecution = (id) => { | ||
async function getExecution(id) { | ||
if (__httpClient) | ||
@@ -71,5 +71,5 @@ return (0, client_js_1.fetchExecution)(__httpClient, { id }); | ||
if (response) | ||
return response; | ||
return Promise.resolve(response); | ||
throw new errors_js_1.APIError("execution not found", ""); | ||
}; | ||
} | ||
exports.getExecution = getExecution; | ||
@@ -76,0 +76,0 @@ const defer = (fn, options) => { |
@@ -57,3 +57,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
} | ||
export const getExecution = (id) => { | ||
export async function getExecution(id) { | ||
if (__httpClient) | ||
@@ -63,5 +63,5 @@ return fetchExecution(__httpClient, { id }); | ||
if (response) | ||
return response; | ||
return Promise.resolve(response); | ||
throw new APIError("execution not found", ""); | ||
}; | ||
} | ||
export const defer = (fn, options) => { | ||
@@ -68,0 +68,0 @@ const ret = async (...args) => { |
{ | ||
"name": "@defer/client", | ||
"version": "1.2.0-alpha-20230316211840-d9dcfae", | ||
"version": "1.2.0-alpha-20230316215837-6df9ddd", | ||
"description": "Zero infrastructure NodeJS background jobs", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
import { Units } from "parse-duration"; | ||
import { EnqueueExecutionResponse, ExecutionState, FetchExecutionResponse } from "./client.js"; | ||
import { EnqueueExecutionResponse, FetchExecutionResponse } from "./client.js"; | ||
interface Options { | ||
@@ -10,7 +10,3 @@ accessToken?: string; | ||
export declare const deferEnabled: () => boolean; | ||
export declare const getExecution: (id: string) => Promise<FetchExecutionResponse> | { | ||
id: string; | ||
state: ExecutionState; | ||
result?: any; | ||
}; | ||
export declare function getExecution(id: string): Promise<FetchExecutionResponse>; | ||
export declare type UnPromise<F> = F extends Promise<infer R> ? R : F; | ||
@@ -17,0 +13,0 @@ export declare type DelayString = `${string}${Units}`; |
Sorry, the diff of this file is not supported yet
39309
922