/** * ORM Client - Runtime GraphQL executor * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import type { GraphQLAdapter, GraphQLError, QueryResult } from '@constructive-io/graphql-query/runtime'; import type { ConnectionState, ConnectionStateListener, RealtimeConfig, SubscriptionEvent, SubscriptionFieldMeta, Unsubscribe } from './realtime'; export type { GraphQLAdapter, GraphQLError, QueryResult, } from '@constructive-io/graphql-query/runtime'; export type { ConnectionState, ConnectionStateListener, RealtimeConfig, SubscribeOptions, SubscriptionEvent, SubscriptionFieldMeta, SubscriptionOperation, Unsubscribe, WsClient, } from './realtime'; export { RealtimeManager } from './realtime'; /** * Default adapter that uses fetch for HTTP requests. * * When no custom fetch is provided, uses @constructive-io/fetch which * handles *.localhost DNS rewriting and Host header preservation in * Node.js. Pass a custom fetch to override for test mocking or custom * proxy/credentials. */ export declare class FetchAdapter implements GraphQLAdapter { private endpoint; private headers; private fetchFn; constructor(endpoint: string, headers?: Record, fetchFn?: typeof globalThis.fetch); execute(document: string, variables?: Record): Promise>; setHeaders(headers: Record): void; getEndpoint(): string; } /** * Configuration for creating an ORM client. * Either provide endpoint (and optional headers/fetch) for HTTP requests, * or provide a custom adapter for alternative execution strategies. */ export interface OrmClientConfig { /** GraphQL endpoint URL (required if adapter not provided) */ endpoint?: string; /** Default headers for HTTP requests (only used with endpoint) */ headers?: Record; /** * Custom fetch implementation. Defaults to createFetch() from * @constructive-io/graphql-query/runtime which handles *.localhost * DNS and Host headers in Node.js. Pass your own for test mocking * or custom proxy/credentials. */ fetch?: typeof globalThis.fetch; /** Custom adapter for GraphQL execution (overrides endpoint/headers/fetch) */ adapter?: GraphQLAdapter; /** * Optional realtime (WebSocket) configuration. * When provided, enables subscription methods on models. * The WebSocket connection is created lazily on first subscribe(). */ realtime?: RealtimeConfig; } /** * Error thrown when GraphQL request fails */ export declare class GraphQLRequestError extends Error { readonly errors: GraphQLError[]; readonly data: unknown; constructor(errors: GraphQLError[], data?: unknown); } export declare class OrmClient { private adapter; private realtimeManager?; constructor(config: OrmClientConfig); execute(document: string, variables?: Record): Promise>; /** * Subscribe to a GraphQL subscription operation. * Used by generated model subscribe() methods. * @throws Error if realtime is not configured */ subscribe(meta: SubscriptionFieldMeta, document: string, variables: Record, options: { onEvent: (event: SubscriptionEvent) => void; onError?: (error: Error) => void; onComplete?: () => void; }): Unsubscribe; /** * Set headers for requests. * Only works if the adapter supports headers. */ setHeaders(headers: Record): void; /** * Get the endpoint URL. * Returns empty string if the adapter doesn't have an endpoint. */ getEndpoint(): string; /** Get current WebSocket connection state */ getConnectionState(): ConnectionState; /** Register a listener for WebSocket connection state changes */ onConnectionStateChange(listener: ConnectionStateListener): Unsubscribe; /** Number of active subscriptions */ getActiveSubscriptionCount(): number; /** Whether realtime is configured */ get isRealtimeEnabled(): boolean; /** Dispose the realtime manager (close WebSocket) */ dispose(): void; }