breathe-api
Version:
Model Context Protocol server for Breathe HR APIs with Swagger/OpenAPI support - also works with custom APIs
44 lines • 1.73 kB
TypeScript
import { ProgressTracker } from './progress-manager.js';
export interface RetryOptions {
maxRetries?: number;
initialDelayMs?: number;
maxDelayMs?: number;
backoffMultiplier?: number;
jitter?: boolean;
retryCondition?: (error: any, attempt: number) => boolean;
onRetry?: (error: any, attempt: number, delayMs: number) => void;
progressTracker?: ProgressTracker;
signal?: AbortSignal;
}
export declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
export declare function withRetry(options?: RetryOptions): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
export declare class CircuitBreaker {
private readonly name;
private readonly threshold;
private readonly timeout;
private readonly successThreshold;
private failures;
private lastFailureTime;
private state;
private successCount;
constructor(name: string, threshold?: number, timeout?: number, successThreshold?: number);
execute<T>(fn: () => Promise<T>): Promise<T>;
private onSuccess;
private onFailure;
getState(): {
state: string;
failures: number;
lastFailureTime: number;
};
reset(): void;
}
export declare class CircuitBreakerManager {
private breakers;
getBreaker(name: string, threshold?: number, timeout?: number, successThreshold?: number): CircuitBreaker;
execute<T>(serviceName: string, fn: () => Promise<T>, threshold?: number, timeout?: number): Promise<T>;
getAllStates(): Record<string, any>;
reset(name: string): void;
resetAll(): void;
}
export declare const circuitBreakerManager: CircuitBreakerManager;
//# sourceMappingURL=retry.d.ts.map