export { REALTIME_CAP_POLL_LIVE } from "../realtime-protocol.js"; interface Query { queryKey: readonly unknown[]; state?: { error?: unknown; }; } interface QueryClient { invalidateQueries(opts?: { queryKey?: string[]; predicate?: (query: Query) => boolean; }, options?: { cancelRefetch?: boolean; }): unknown; isFetching?(filters?: { queryKey?: string[]; predicate?: (query: Query) => boolean; }): number; } export declare function registerCollabActivityResource(resource: { resourceType: string; resourceId: string; }): () => void; export declare function registerOwnCollabSource(source: string): void; type CollabActivityEvent = { source?: string; resourceType?: string; resourceId?: string; requestSource?: string; }; /** * For a collab connection's own ~12 s poll. A viewer on a screen nobody else * is on has no presence to notice, but that poll still carries the design's * resource-scoped events from the other screens, and the shared transport is * asleep on the 1-5 minute idle cadence until something wakes it. */ export declare function noteCollabPollActivity(events: readonly CollabActivityEvent[]): void; /** * Declare that another person is working on the same resource as this tab. * While any lease is held, the shared transport polls every 2.5 s whenever no * stream (local SSE or the hosted gateway) is connected, so their edits land in * seconds instead of at the idle cadence. A no-op while a stream is live. * Returns the release function; callers must release when the other person * leaves or the page unmounts. */ export declare function acquireCollabPollBoost(): () => void; export type SyncEvent = { version?: number; cursorId?: string; source?: string; type?: string; key?: string; requestSource?: string; [k: string]: unknown; }; export declare function isInteractionCriticalSyncEvent(event: SyncEvent): boolean; /** @internal */ export declare function _resetSyncTransportRegistryForTests(): void; export interface SubscribeSyncEventsOptions { onEvents: (events: SyncEvent[], version: number | undefined) => void; onSseStateChange?: (connected: boolean, capabilities?: readonly string[]) => void; pollUrl?: string; sseUrl?: string | false; pauseWhenHidden?: boolean; interval?: number; fallbackInterval?: number; } export declare function subscribeSyncEvents(options: SubscribeSyncEventsOptions): () => void; export declare function useDbSync(options?: { queryClient?: QueryClient; queryKeys?: string[]; realtime?: { reason: string; }; pollUrl?: string; sseUrl?: string | false; /** @deprecated Use pollUrl instead */ eventsUrl?: string; onEvent?: (data: any) => void; interval?: number; fallbackInterval?: number; pauseWhenHidden?: boolean; ignoreSource?: string; actionInvalidatePredicate?: (query: Query, events: readonly SyncEvent[]) => boolean; suppressActionInvalidationFor?: string[]; }): void; /** @deprecated Use useDbSync instead */ export declare const useFileWatcher: typeof useDbSync; export declare function useScreenRefreshKey(options?: { enabled?: boolean; pollUrl?: string; sseUrl?: string | false; interval?: number; fallbackInterval?: number; pauseWhenHidden?: boolean; }): number;