supamend
Version:
Pluggable DevSecOps Security Scanner with 10+ scanners and multiple reporting channels
29 lines • 990 B
TypeScript
import { Logger, LogContext } from './logger';
export interface RetryOptions {
maxAttempts?: number;
baseDelay?: number;
maxDelay?: number;
backoffMultiplier?: number;
context?: LogContext;
logger?: Logger;
}
export interface RetryResult<T> {
success: boolean;
result?: T;
error?: Error;
attempts: number;
totalTime: number;
}
/**
* Retry a function with exponential backoff
*/
export declare function retry<T>(operation: () => Promise<T>, options?: RetryOptions): Promise<RetryResult<T>>;
/**
* Retry a function with custom retry condition
*/
export declare function retryWithCondition<T>(operation: () => Promise<T>, shouldRetry: (error: Error, attempt: number) => boolean, options?: RetryOptions): Promise<RetryResult<T>>;
/**
* Retry a function with timeout
*/
export declare function retryWithTimeout<T>(operation: () => Promise<T>, timeout: number, options?: RetryOptions): Promise<RetryResult<T>>;
//# sourceMappingURL=retry.d.ts.map