tsonik
Version:
A TypeScript client library for the Iconik API based on Swagger documentation
44 lines • 1.25 kB
TypeScript
import { RetryConfig } from './config';
/**
* Determine if an error should be retried based on configuration
*/
export declare function shouldRetryError(error: unknown, config: Required<RetryConfig>): boolean;
/**
* Calculate delay for exponential backoff with jitter
*/
export declare function calculateDelay(attemptNumber: number, config: Required<RetryConfig>): number;
/**
* Create a retry wrapper function for HTTP requests
*/
export declare function createRetryWrapper<T>(requestFn: () => Promise<T>, retryConfig?: RetryConfig): Promise<T>;
/**
* Extract request information for logging
*/
export declare function extractRequestInfo(error: unknown): {
method?: string;
url?: string;
status?: number;
code?: string;
};
/**
* Create a retry configuration for specific use cases
*/
export declare const RetryPresets: {
/**
* Conservative retry for read operations
*/
conservative: () => RetryConfig;
/**
* Aggressive retry for critical operations
*/
aggressive: () => RetryConfig;
/**
* Rate limit specific retry
*/
rateLimit: () => RetryConfig;
/**
* Network error specific retry
*/
networkOnly: () => RetryConfig;
};
//# sourceMappingURL=utils.d.ts.map