import type { GraphileConfig } from 'graphile-config'; import type { DocumentNode, ExecutionResult, GraphQLSchema } from 'graphql'; /** * A single event yielded by a subscription iterator. */ export interface SubscriptionEvent> { data?: TData | null; errors?: readonly { message: string; }[]; } /** * Options for `subscribe()`. */ export interface SubscribeOptions { schema: GraphQLSchema; resolvedPreset: GraphileConfig.ResolvedPreset; query: string | DocumentNode; variables?: Record; contextValue?: Record; } /** * Call grafast.subscribe() and return the raw async iterator. * * The caller is responsible for iterating the result and calling `.return()` * when done. * * @returns An AsyncIterableIterator that yields ExecutionResult events, * or an ExecutionResult if subscription setup failed. */ export declare function subscribe(opts: SubscribeOptions): Promise | ExecutionResult>; /** * Wait for the next event from a subscription iterator, with a timeout. * * @param iterator - The async iterator returned by `subscribe()` * @param timeoutMs - Maximum time to wait (default: 5000ms) * @returns The next subscription event * @throws If the timeout is exceeded or the iterator completes without a value */ export declare function waitForEvent>(iterator: AsyncIterableIterator, timeoutMs?: number): Promise>; /** * Collect multiple events from a subscription iterator. * * @param iterator - The async iterator returned by `subscribe()` * @param count - Number of events to collect * @param timeoutMs - Maximum time to wait for all events (default: 10000ms) * @returns Array of collected events */ export declare function collectEvents>(iterator: AsyncIterableIterator, count: number, timeoutMs?: number): Promise[]>;