import { type Context } from './contexts'; import { type Segments } from '../types'; import { ChildModel, ErrorCallback, Model } from './Model'; import { CollectionMap } from './CollectionMap'; import { ModelData } from '.'; import type { Doc as ShareDBDoc } from 'sharedb'; export type QueryOptions = string | { [key: string]: unknown; }; interface QueryCtor { new (model: Model, collectionName: string, expression: any, options: QueryOptions): Query; } declare module './Model' { interface Model { query(collectionName: string, expression: any, options?: QueryOptions): Query; sanitizeQuery(expression: any): any; _getOrCreateQuery(collectionName: string, expression: any, options: QueryOptions, QueryConstructor: QueryCtor): Query; _initQueries(items: any[]): void; _queries: Queries; } } export declare class Queries { map: Record; collectionMap: CollectionMap; constructor(); add(query: Query): void; remove(query: Query): void; get(contextId: any, collectionName: any, expression: any, options: any): Query<{}>; toJSON(): any[]; } export declare class Query { collectionName: string; context: Context; created: boolean; expression: any; extraSegments: string[]; fetchCount: number; hash: string; idMap: Record; idsSegments: string[]; model: Model; options: any; segments: Segments; shareQuery: any | null; subscribeCount: number; _pendingSubscribeCallbacks: any[]; constructor(model: ChildModel, collectionName: string, expression: any, options?: any); create(): void; destroy(): void; fetch(cb?: ErrorCallback): this; fetchPromised: any; subscribe(cb?: ErrorCallback): this; subscribePromised: any; _subscribeCb(cb: ErrorCallback): (err: Error, results: ShareDBDoc[], extra?: any) => void; _shareFetchedSubscribe(options: any, cb: any): void; _shareSubscribe(options: any, cb: any): void; _removeMapIds(ids: any): void; _addMapIds(ids: any): void; _diffMapIds(ids: string[]): void; _setExtra(extra: string[]): void; _setResults(results: ShareDBDoc[]): void; _setResultIds(ids: string[]): void; _maybeUnloadDocs(ids: any): void; _flushSubscribeCallbacks(err: any, cb: any): void; unfetch(cb?: (err?: Error, count?: number) => void): this; unfetchPromised: any; unsubscribe(cb?: (err?: Error, count?: number) => void): this; unsubscribePromised: any; _getShareResults(): any[]; get(): Array; getIds(): string[]; getExtra(): T; ref(from: any): import("./refList").RefList; refIds(from: any): ChildModel; refExtra(from: any, relPath?: any): ChildModel; serialize(): any[]; } export {};