UNPKG

datapilot-cli

Version:

Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform

100 lines 3.19 kB
/** * Retry logic utilities for DataPilot * Handles transient failures with configurable retry strategies */ import { DataPilotError } from '../core/types'; import type { LogContext } from './logger'; export interface RetryOptions { maxAttempts: number; baseDelayMs: number; maxDelayMs: number; backoffMultiplier: number; jitter: boolean; retryIf?: (error: unknown) => boolean; onRetry?: (error: unknown, attempt: number) => void; } export interface RetryResult<T> { success: boolean; result?: T; error?: Error; attempts: number; totalTime: number; } export declare class RetryManager { private static defaultOptions; /** * Execute operation with retry logic */ static retry<T>(operation: () => Promise<T>, options?: Partial<RetryOptions>, context?: LogContext): Promise<T>; /** * Execute operation with retry and return detailed result */ static retryWithResult<T>(operation: () => Promise<T>, options?: Partial<RetryOptions>, context?: LogContext): Promise<RetryResult<T>>; /** * Batch retry multiple operations */ static retryBatch<T>(operations: Array<() => Promise<T>>, options?: Partial<RetryOptions>, context?: LogContext): Promise<Array<RetryResult<T>>>; /** * Check if an error is retryable */ static isRetryableError(error: unknown): boolean; /** * Create retry-specific error with context */ static createRetryError(originalError: Error, attempts: number, totalTime: number, context?: LogContext): DataPilotError; /** * Calculate exponential backoff delay with jitter */ private static calculateDelay; /** * Promise-based delay */ private static delay; } /** * Specialized retry strategies for common operations */ export declare class RetryStrategies { /** * File operations retry strategy */ static fileOperations(): Partial<RetryOptions>; /** * Network operations retry strategy */ static networkOperations(): Partial<RetryOptions>; /** * Analysis operations retry strategy */ static analysisOperations(): Partial<RetryOptions>; /** * Memory-sensitive operations retry strategy */ static memorySensitiveOperations(): Partial<RetryOptions>; /** * Quick operations retry strategy (for fast, simple operations) */ static quickOperations(): Partial<RetryOptions>; } /** * Utility class for common retry patterns */ export declare class RetryUtils { /** * Retry file read operation */ static retryFileRead<T>(operation: () => Promise<T>, context?: LogContext): Promise<T>; /** * Retry network operation */ static retryNetworkOperation<T>(operation: () => Promise<T>, context?: LogContext): Promise<T>; /** * Retry analysis operation with error handling */ static retryAnalysis<T>(operation: () => Promise<T>, context?: LogContext): Promise<T>; /** * Wrap operation with automatic retry based on error type */ static autoRetry<T>(operation: () => Promise<T>, context?: LogContext): Promise<T>; } //# sourceMappingURL=retry.d.ts.map