import type { Context } from '../context/context.js'; import { Disposable } from '../utils/Disposable.js'; import { QueryDiagnostic } from './diagnostics.js'; export type BaseQueryEvents = { change: (value: any) => void; statusChange: (status: QueryStatus) => void; }; export type BaseQueryOptions = { context: Context; initial: T; collection: string; key: string; shouldUpdate?: (updatedCollections: string[]) => boolean; }; export type QueryStatus = 'initial' | 'initializing' | 'revalidating' | 'ready'; export declare const ON_ALL_UNSUBSCRIBED: unique symbol; export declare const UPDATE: unique symbol; export declare abstract class BaseQuery extends Disposable { private _rawValue; private _value; private _events; private _internalUnsubscribes; private _allUnsubscribedHandler?; private _status; private _executionPromise; private _timing; private _startedAt; private _timingHistory; private _revalidationTimeout; private _needsTrailingRevalidation; protected context: Context; readonly collection: string; readonly key: string; readonly isListQuery: boolean; readonly type: string; constructor({ initial, context, collection, key, shouldUpdate, }: BaseQueryOptions); private revalidate; get current(): T; get resolved(): Promise; get subscribed(): boolean; get status(): QueryStatus; private set status(value); get hasDeleted(): boolean; /** * Subscribe to changes in the query value. * * @deprecated use the two parameter form instead */ subscribe(callback: (value: T) => void): () => void; /** * Subscribe to changes in the query value. */ subscribe(event: 'change', callback: (value: T) => void): () => void; /** * Subscribe to changes in the query state. */ subscribe(event: 'statusChange', callback: (status: QueryStatus) => void): () => void; protected setValue: (value: T) => void; protected refreshValue: () => void; private subscribeToDeleteAndRestore; execute: () => Promise; protected measureSweep: (work: () => Promise) => Promise; protected measureHydration: (work: () => Promise) => Promise; getDiagnostic: (active: boolean) => QueryDiagnostic; protected abstract run(): Promise; [ON_ALL_UNSUBSCRIBED]: (handler: (query: BaseQuery) => void) => void; get __rawValue(): T; }