import { r as ConnectionKey } from "./connection-key-CvX95c4J.js"; import { ClientLifecycleEvents } from "@kyneta/transport"; //#region src/types.d.ts /** * Discriminated union describing why an SSE connection was lost. * * Unlike WebSocket's DisconnectReason, SSE has no * `{ type: "closed"; code; reason }`: SSE has no close codes. */ type DisconnectReason = { type: "intentional"; } | { type: "error"; error: Error; } /** * This exchange closed the channel: it refused the server, or the * handshake outlasted its `establishTimeout`. */ | { type: "refused"; } | { type: "max-retries-exceeded"; attempts: number; }; /** * All possible states of the SSE client. * * An attempt runs from `connecting` until the exchange establishes the * channel. `connected` holds the stream's key, with the channel's * handshake in flight. * * ``` * disconnected → connecting → connected → established * ↓ ↓ ↓ * reconnecting ← ─ ┴ ─ ─ ─ ─ ─ ─ ┘ * ↓ * connecting (retry) * ↓ * disconnected (max retries) * ``` */ type SseClientState = { status: "disconnected"; reason?: DisconnectReason; } | { status: "connecting"; attempt: number; } | { status: "connected"; attempt: number; key: ConnectionKey; } | { status: "established"; key: ConnectionKey; } | { status: "reconnecting"; attempt: number; nextAttemptMs: number; }; /** * Lifecycle event callbacks for the SSE client. */ type SseClientLifecycleEvents = ClientLifecycleEvents; //#endregion export { SseClientLifecycleEvents as n, SseClientState as r, DisconnectReason as t }; //# sourceMappingURL=types-EGPx1Oeh.d.ts.map