logs-interceptor
Version:
High-performance, production-ready log interceptor for Node.js applications with Loki integration. Built with Clean Architecture principles. Supports Node.js, Browser, and Node-RED.
34 lines • 875 B
TypeScript
/**
* Interface for circuit breaker pattern
*/
export interface ICircuitBreaker {
/**
* Execute an operation with circuit breaker protection
*/
execute<T>(operation: () => Promise<T>): Promise<T>;
/**
* Record a successful operation
*/
recordSuccess(): void;
/**
* Record a failed operation
*/
recordFailure(): void;
/**
* Get current circuit breaker state
*/
getState(): CircuitBreakerState;
/**
* Reset the circuit breaker
*/
reset(): void;
}
export type CircuitBreakerStateType = 'closed' | 'open' | 'half-open';
export interface CircuitBreakerState {
readonly state: CircuitBreakerStateType;
readonly failures: number;
readonly successCount: number;
readonly lastFailure?: number;
readonly nextAttempt?: number;
}
//# sourceMappingURL=ICircuitBreaker.d.ts.map