/** * 🔄 Retry Helper Utility * * Provides robust retry logic with exponential backoff for network operations. * Used throughout the Onairos SDK for handling transient failures gracefully. */ export interface RetryOptions { /** Maximum number of retry attempts */ maxRetries: number; /** Base delay between retries in milliseconds */ baseDelay: number; /** Maximum delay between retries in milliseconds */ maxDelay: number; /** Whether to use exponential backoff */ exponentialBackoff: boolean; /** Function to determine if an error should trigger a retry */ shouldRetry?: (error: any, attempt: number) => boolean; /** Function called before each retry attempt */ onRetry?: (error: any, attempt: number, nextDelay: number) => void; /** Enable logging of retry attempts */ enableLogging: boolean; } export interface RetryResult { success: boolean; data?: T; error?: Error; attempts: number; totalDuration: number; } /** * Default retry options for the Onairos SDK */ export declare const DEFAULT_RETRY_OPTIONS: RetryOptions; /** * Execute a function with retry logic and exponential backoff * @param fn Function to execute (should return a Promise) * @param options Retry configuration options * @returns Promise with retry result */ export declare function withRetry(fn: () => Promise, options?: Partial): Promise>; /** * Retry configuration for API calls */ export declare const API_RETRY_OPTIONS: Partial; /** * Specialized retry for network/connectivity issues */ export declare const NETWORK_RETRY_OPTIONS: Partial; /** * Create a retry wrapper for fetch requests * @param url Request URL * @param options Fetch options * @param retryOptions Retry configuration * @returns Promise with fetch response */ export declare function fetchWithRetry(url: string, options?: RequestInit, retryOptions?: Partial): Promise; /** * Health check function with retry for testing connectivity * @param url URL to check * @param timeout Timeout in milliseconds * @returns Promise indicating if the service is reachable */ export declare function healthCheck(url: string, timeout?: number): Promise<{ reachable: boolean; status?: number; error?: string; duration: number; }>; //# sourceMappingURL=retryHelper.d.ts.map