import type { TypedDocumentNode } from "@graphql-typed-document-node/core"; import type { GqlVariables } from "./useGqlOperations.js"; export type GqlSubscriptionStatus = "idle" | "connecting" | "open" | "closed"; export type GqlSubscriptionOptions = { variables: TVariables; /** `false` keeps the subscription closed (`status: "idle"`). Default `true`. */ enabled?: boolean; /** Receives each pushed payload, in server order. */ onData: (data: TData) => void; /** Receives transport failures and payload-level GraphQL errors. */ onError?: (error: Error) => void; }; export type GqlSubscriptionResult = { status: GqlSubscriptionStatus; }; /** * Consumes a GraphQL subscription over SSE using the context client. * * Opens on mount and whenever the document/variables change, and aborts the * in-flight stream on unmount. A transport failure schedules a reconnect with * exponential backoff (capped at 15s); a server-sent `complete` is terminal * (`status: "closed"`), as is `enabled: false` (`status: "idle"`, nothing * opens). `onData`/`onError` are read through a ref, so handler identity never * restarts the stream. */ export declare function useGqlSubscription(document: TypedDocumentNode, options: GqlSubscriptionOptions): GqlSubscriptionResult; //# sourceMappingURL=useGqlSubscription.d.ts.map