@metis-w/api-client
Version:
Modern TypeScript HTTP API client with dynamic routes, parameterized endpoints, interceptors, and advanced features
31 lines • 1.21 kB
TypeScript
import { ClientError } from "../../types";
/**
* Manages retry logic for failed requests
*/
export declare class RetryManager {
/**
* Determines if the request should be retried based on the error type.
* Aborts are not retried, while timeouts and network errors are retried.
*
* @param error - The error object to evaluate
* @returns True if the request should be retried, false otherwise
*/
static shouldRetry(error: ClientError): boolean;
/**
* Delays execution for a specified number of milliseconds.
* Used for retry delays in case of request failures.
*
* @param ms - The number of milliseconds to delay
* @returns A Promise that resolves after the specified delay
*/
static delay(ms: number): Promise<void>;
/**
* Calculates exponential backoff delay
* @param attempt - Current attempt number (0-based)
* @param baseDelay - Base delay in milliseconds
* @param maxDelay - Maximum delay in milliseconds
* @returns Calculated delay with jitter
*/
static calculateBackoffDelay(attempt: number, baseDelay: number, maxDelay?: number): number;
}
//# sourceMappingURL=retry-manager.d.ts.map