/** * Configuration options for retry policies */ export interface RetryPolicyOptions { /** Maximum number of retry attempts */ maxRetries: number; /** Initial delay in milliseconds */ initialDelayMs: number; /** Maximum delay in milliseconds */ maxDelayMs?: number; /** Exponential backoff factor */ backoffFactor?: number; /** Whether to apply jitter to delays */ jitter?: boolean; /** Function to determine if an error should trigger a retry */ shouldRetry?: (error: any) => boolean; /** Callback function called before each retry attempt */ onRetry?: (attempt: number, delay: number, error: any) => void; /** Callback function called when all retries are exhausted */ onFailure?: (error: any) => void; } /** * Result of a retry policy evaluation */ export interface RetryPolicyResult { /** Whether the operation should be retried */ shouldRetry: boolean; /** Delay in milliseconds before next retry */ delay: number; /** Current attempt number */ attempt: number; /** Whether this is the final attempt */ isFinalAttempt: boolean; } /** * Jitter configuration for retry delays */ export interface JitterConfig { /** Type of jitter to apply */ type: 'none' | 'full' | 'equal' | 'decorrelated'; /** Jitter factor (0-1) */ factor?: number; } /** * Backoff strategy configuration */ export interface BackoffConfig { /** Type of backoff strategy */ type: 'exponential' | 'linear' | 'constant'; /** Base delay in milliseconds */ baseDelay: number; /** Maximum delay in milliseconds */ maxDelay: number; /** Backoff factor for exponential strategies */ factor?: number; /** Jitter configuration */ jitter?: JitterConfig; } /** * Per-operation-type retry configuration */ export interface OperationRetryConfig { /** Maximum number of retry attempts */ maxAttempts?: number; /** Initial backoff delay in milliseconds */ backoffMs?: number; /** Backoff multiplier for exponential growth */ multiplier?: number; /** Maximum delay cap in milliseconds */ maxDelayMs?: number; /** Whether to apply jitter to delays */ jitter?: boolean; /** Function to determine if an error should trigger a retry */ shouldRetry?: (error: unknown) => boolean; /** Callback function called before each retry attempt */ onRetry?: (attempt: number, delay: number, error: unknown) => void; } /** * Configuration for creating a retry policy with per-operation-type overrides */ export interface OperationTypePolicyConfig { /** Default retry configuration applied to all operation types */ default: OperationRetryConfig; /** Per-operation-type overrides that merge with the default config */ operations?: Record; } /** * Options passed when executing an operation with a retry policy */ export interface ExecuteOptions { /** The operation type to use for config lookup */ operationType?: string; /** AbortSignal for cancellation support */ signal?: AbortSignal; } /** * Result of executing an operation with retry */ export interface ExecuteResult { /** The result of the successful operation */ result: T; /** The number of attempts made (1 = succeeded on first try) */ attempts: number; } //# sourceMappingURL=types.d.ts.map