export declare type SequenceType = 'constant' | 'fibonacci' | 'exponential' | 'linear'; export declare type Delayable = { type: SequenceType; beat?: number; maxDuration?: number; maxInterval?: number; maxIteration?: number; }; /** * retry decorator * * @retry() */ export declare function retry(config: Delayable, canRetry: (e: any) => Promise): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor; export interface Sequence { next(): T; } export declare function createSequence(type: SequenceType): Sequence; export declare function retryAction(action: () => Promise, canRetry: (e: any) => Promise, delay: Delayable): Promise; /** * repeat action until it resolves to promise * @param action async action that returns a Promise * @param canRetry when action rejects with err, check if the error can be retried * @param wait wait before issue the next repeat */ export declare function repeat(action: () => Promise, canRetry: (v: any) => Promise, wait: () => Promise): Promise;