mcp-quickbase
Version:
Work with Quickbase via Model Context Protocol
40 lines (39 loc) • 1.21 kB
TypeScript
/**
* Options for configuring retry behavior
*/
export interface RetryOptions {
/**
* Maximum number of retry attempts
*/
maxRetries: number;
/**
* Base delay in milliseconds between retries
*/
baseDelay: number;
/**
* Maximum delay in milliseconds between retries
*/
maxDelay?: number;
/**
* Factor to multiply delay by after each retry attempt
*/
backoffFactor?: number;
/**
* Function that determines if an error is retryable
*/
isRetryable?: (error: unknown) => boolean;
}
/**
* Calculates the delay time for a retry attempt with exponential backoff
* @param attempt Retry attempt number (0-based)
* @param options Retry options
* @returns Delay time in milliseconds
*/
export declare function calculateBackoff(attempt: number, options: RetryOptions): number;
/**
* Wrapper function that adds retry logic to any async function
* @param fn Function to add retry logic to
* @param options Retry options
* @returns Function with retry logic
*/
export declare function withRetry<T, Args extends unknown[]>(fn: (...args: Args) => Promise<T>, options?: Partial<RetryOptions>): (...args: Args) => Promise<T>;