UNPKG

reactbits-mcp-server

Version:

MCP Server for React Bits - Access 99+ React components with animations, backgrounds, and UI elements

68 lines (67 loc) 1.59 kB
/** * Circuit breaker states */ declare enum CircuitBreakerState { CLOSED = "CLOSED", OPEN = "OPEN", HALF_OPEN = "HALF_OPEN" } /** * Circuit breaker configuration */ interface CircuitBreakerConfig { failureThreshold: number; recoveryTimeout: number; monitoringPeriod: number; } /** * Circuit breaker implementation for protecting external calls */ declare class CircuitBreaker { private state; private failureCount; private lastFailureTime; private config; constructor(config: CircuitBreakerConfig); /** * Execute a function with circuit breaker protection * @param fn - Function to execute * @returns Promise with the result */ execute<T>(fn: () => Promise<T>): Promise<T>; /** * Handle successful execution */ private onSuccess; /** * Handle failed execution */ private onFailure; /** * Check if we should attempt to reset the circuit breaker * @returns True if we should attempt reset */ private shouldAttemptReset; /** * Get current circuit breaker state * @returns Current state */ getState(): CircuitBreakerState; /** * Get failure count * @returns Current failure count */ getFailureCount(): number; /** * Reset the circuit breaker manually */ reset(): void; } /** * Circuit breaker instances for different types of operations */ export declare const circuitBreakers: { external: CircuitBreaker; filesystem: CircuitBreaker; }; export { CircuitBreaker, CircuitBreakerState };