import { AbstractPowerSyncDatabase } from '../../../client/AbstractPowerSyncDatabase.js'; import { MetaBaseObserver } from '../../../utils/MetaBaseObserver.js'; import { WatchedQuery, WatchedQueryListener, WatchedQueryOptions, WatchedQueryState } from '../WatchedQuery.js'; /** * @internal */ export interface AbstractQueryProcessorOptions { db: AbstractPowerSyncDatabase; watchOptions: Settings; placeholderData: Data; } /** * @internal */ export interface LinkQueryOptions { abortSignal: AbortSignal; settings: Settings; } type MutableDeep = T extends ReadonlyArray ? U[] : T; /** * @internal Mutable version of {@link WatchedQueryState}. * This is used internally to allow updates to the state. */ export type MutableWatchedQueryState = { -readonly [P in keyof WatchedQueryState]: MutableDeep[P]>; }; type WatchedQueryProcessorListener = WatchedQueryListener; /** * Performs underlying watching and yields a stream of results. * @internal */ export declare abstract class AbstractQueryProcessor extends MetaBaseObserver> implements WatchedQuery { protected options: AbstractQueryProcessorOptions; readonly state: WatchedQueryState; protected abortController: AbortController; protected initialized: Promise; protected _closed: boolean; protected disposeListeners: (() => void) | null; get closed(): boolean; constructor(options: AbstractQueryProcessorOptions); protected constructInitialState(): WatchedQueryState; protected get reportFetching(): boolean; protected updateSettingsInternal(settings: Settings, signal: AbortSignal): Promise; /** * Updates the underlying query. */ updateSettings(settings: Settings): Promise; /** * This method is used to link a query to the subscribers of this listener class. * This method should perform actual query watching and report results via {@link updateState} method. */ protected abstract linkQuery(options: LinkQueryOptions): Promise; protected updateState(update: Partial>): Promise; /** * Configures base DB listeners and links the query to listeners. */ protected init(signal: AbortSignal): Promise; close(): Promise; /** * Runs a callback and reports errors to the error listeners. */ protected runWithReporting(callback: () => Promise): Promise; /** * Iterate listeners and reports errors to onError handlers. */ protected iterateAsyncListenersWithError(callback: (listener: Partial>) => Promise | void): Promise; } export {};