@defer.run/client
Advanced tools
Comparing version 0.4.0 to 0.5.0-alpha-20230208140706-398a6bf
@@ -25,3 +25,3 @@ "use strict"; | ||
exports.isDeferExecution = isDeferExecution; | ||
const defer = (fn) => { | ||
const defer = (fn, options) => { | ||
const ret = (...args) => { | ||
@@ -45,3 +45,3 @@ if (debug) { | ||
ret.__fn = fn; | ||
ret.__metadata = { version: constants_js_1.INTERNAL_VERSION }; | ||
ret.__metadata = { version: constants_js_1.INTERNAL_VERSION, retry: options?.retry }; | ||
ret.await = async (...args) => { | ||
@@ -48,0 +48,0 @@ const executionResult = (await (0, exports.defer)(fn)(...args)); |
@@ -17,3 +17,3 @@ // @ts-expect-error untyped dep | ||
export const isDeferExecution = (obj) => !!obj.__deferExecutionResponse; | ||
export const defer = (fn) => { | ||
export const defer = (fn, options) => { | ||
const ret = (...args) => { | ||
@@ -37,3 +37,3 @@ if (debug) { | ||
ret.__fn = fn; | ||
ret.__metadata = { version: INTERNAL_VERSION }; | ||
ret.__metadata = { version: INTERNAL_VERSION, retry: options?.retry }; | ||
ret.await = async (...args) => { | ||
@@ -40,0 +40,0 @@ const executionResult = (await defer(fn)(...args)); |
{ | ||
"name": "@defer.run/client", | ||
"version": "0.4.0", | ||
"version": "0.5.0-alpha-20230208140706-398a6bf", | ||
"description": "cua JavaScript client", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -20,2 +20,3 @@ import type { Units } from "parse-duration"; | ||
cron?: string; | ||
retry?: RetryPolicy | boolean | undefined; | ||
}; | ||
@@ -44,2 +45,14 @@ } | ||
export declare const isDeferExecution: (obj: any) => obj is DeferExecuteResponse; | ||
export interface DeferOptions { | ||
retry?: RetryPolicy | boolean; | ||
} | ||
export interface RetryPolicy { | ||
maxAttempts?: number; | ||
backoff: RetryBackoffPolicy; | ||
} | ||
export interface RetryBackoffPolicy { | ||
initialDelay?: number; | ||
maxDelay?: number; | ||
multiplier?: number; | ||
} | ||
export declare const defer: Defer; | ||
@@ -46,0 +59,0 @@ interface DeferDelay { |
Sorry, the diff of this file is not supported yet
31100
626