/** * Retry logic with exponential backoff for transient failures. */ /** * gRPC status codes that are typically retryable. */ export declare const RETRYABLE_STATUS_CODES: { readonly DEADLINE_EXCEEDED: 4; readonly UNAVAILABLE: 14; }; /** * Configuration for retry behavior. */ export interface RetryConfig { /** Maximum number of retry attempts (default: 3). */ maxAttempts: number; /** Initial backoff duration in milliseconds (default: 100). */ initialBackoffMs: number; /** Maximum backoff duration in milliseconds (default: 10000). */ maxBackoffMs: number; /** Multiplier for exponential backoff (default: 2.0). */ backoffMultiplier: number; /** gRPC status codes that should trigger a retry. */ retryableStatusCodes: number[]; } /** * Default retry configuration. */ export declare const DEFAULT_RETRY_CONFIG: RetryConfig; /** * Partial retry configuration for overrides. */ export type PartialRetryConfig = Partial; /** * Merge partial config with defaults. */ export declare function mergeRetryConfig(partial: PartialRetryConfig): RetryConfig; /** * Check if an error is retryable based on gRPC status code. */ export declare function isRetryable(error: unknown, config: RetryConfig): boolean; /** * Calculate backoff time with jitter. * * @param attempt - The current attempt number (0-indexed). * @param initialMs - Initial backoff in milliseconds. * @param maxMs - Maximum backoff in milliseconds. * @param multiplier - Exponential multiplier. * @returns Backoff time in milliseconds. */ export declare function calculateBackoff(attempt: number, initialMs: number, maxMs: number, multiplier: number): number; /** * Execute an async function with retry logic. * * @param fn - The async function to execute. * @param config - Retry configuration. * @returns The result of the function. * @throws The last error if all retries are exhausted. */ export declare function withRetry(fn: () => Promise, config?: RetryConfig): Promise; /** * Create a retryable wrapper for an async function. * * @param fn - The async function to wrap. * @param config - Retry configuration. * @returns A wrapped function that will retry on transient failures. */ export declare function withRetryWrapper(fn: (...args: TArgs) => Promise, config?: RetryConfig): (...args: TArgs) => Promise; //# sourceMappingURL=retry.d.ts.map