/** * Lifecycle state of a driver's connection to its database. */ export declare enum ConnectionState { Disconnected = "disconnected", Connecting = "connecting", Connected = "connected", /** Reachable but failing health probes, or mid-reconnect. Queries are still attempted. */ Degraded = "degraded" } export interface IConnectionResilienceOptions { /** * Milliseconds between health probes. 0 disables the periodic probe. Default 30000. */ HealthCheckInterval?: number; /** * Reconnect attempts per outage before giving up. Default 5. */ MaxRetries?: number; /** * First backoff delay in ms; doubles each attempt. Default 200. */ RetryDelay?: number; /** * Upper bound on the backoff delay in ms. Default 5000. */ MaxRetryDelay?: number; } /** * Error codes that mean the transport died rather than the statement being wrong. Retrying a * statement that the server rejected only multiplies the failure, so this set is deliberately * narrow: connection-level Node socket errors plus the mysql2 protocol codes for a lost or * exhausted connection. */ export declare const RETRYABLE_ERROR_CODES: ReadonlySet; /** * Backoff delay for attempt `n` (0-based), doubling from `base` and clamped to `max`. */ export declare function backoffDelay(attempt: number, base: number, max: number): number; /** * Promise-returning sleep used by the retry loop. */ export declare function delay(ms: number): Promise; /** * Walks an error and its `inner` / `cause` chain looking for a retryable code. Driver errors are * frequently wrapped ( OrmException carries the original in `inner` ), so a shallow check misses * exactly the cases that matter. */ export declare function isRetryableErrorCode(err: unknown): boolean; //# sourceMappingURL=resilience.d.ts.map