UNPKG

retryable-operation

Version:

a simple package that allow executing retryable operation and providing retry options

12 lines 959 B
import { AttemptedFunction, RetryableOperation, RetryOptions, OperationResult } from "./retryable-operation"; export declare function operation<T = unknown, E = unknown>(options: RetryOptions<T>): RetryableOperation<T, E>; declare type BaseWrapOptions<T> = Omit<RetryOptions<T>, "fn">; export interface AutoWrapOptions<T> extends BaseWrapOptions<T> { autoAttempt?: true; } export declare type WrapOptions<T> = BaseWrapOptions<T> | AutoWrapOptions<T>; export declare function wrap<T = unknown, E = unknown>(fn: AttemptedFunction<T>, options: BaseWrapOptions<T>): RetryableOperation<T, E>; export declare function wrap<T = unknown, E = unknown>(fn: AttemptedFunction<T>, options: AutoWrapOptions<T>): Promise<OperationResult<T, E>>; export declare function retryable<T>(options?: BaseWrapOptions<T>): (_: any, _1: string, descriptor: PropertyDescriptor) => PropertyDescriptor; export { RetryableOperation, RetryOptions }; //# sourceMappingURL=retry.d.ts.map