import { BehaviorSubject } from 'rxjs'; import type { RxCollection, RxDocument, RxQueryOP, RxQuery, MangoQuery, MangoQuerySortPart, MangoQuerySelector } from './types'; import { PreparedQuery } from './rx-storate.interface'; export declare class RxQueryBase | RxDocument> { op: RxQueryOP; mangoQuery: Readonly; collection: RxCollection; id: number; /** * counts how often the execution on the whole db was done * (used for tests and debugging) */ _execOverDatabaseCount: number; other: any; constructor(op: RxQueryOP, mangoQuery: Readonly, collection: RxCollection); get $(): BehaviorSubject; _latestChangeEvent: -1 | any; _resultsData: any; _resultsDataMap: Map; _lastExecStart: number; _lastExecEnd: number; _resultsDocs$: BehaviorSubject; /** * ensures that the exec-runs * are not run in parallel */ _ensureEqualQueue: Promise; /** * Returns an observable that emits the results * This should behave like an rxjs-BehaviorSubject which means: * - Emit the current result-set on subscribe * - Emit the new result-set when an RxChangeEvent comes in * - Do not emit anything before the first result-set was created (no null) */ private _$?; /** * set the new result-data as result-docs of the query * @param newResultData json-docs that were recieved from pouchdb */ _setResultData(newResultData: any[]): RxDocument[]; /** * executes the query on the database * @return results-array with document-data */ _execOverDatabase(): Promise; /** * Execute the query * To have an easier implementations, * just subscribe and use the first result */ exec(throwIfMissing: true): Promise>; exec(): Promise; /** * cached call to get the massageSelector * @overwrites itself with the actual value */ get massageSelector(): any; /** * returns a string that is used for equal-comparisons * @overwrites itself with the actual value */ toString(): string; /** * returns the prepared query * @overwrites itself with the actual value */ toJSON(): PreparedQuery; /** * returns the key-compressed version of the query * @overwrites itself with the actual value */ keyCompress(): MangoQuery; /** * returns true if the document matches the query, * does not use the 'skip' and 'limit' * // TODO this was moved to rx-storage */ doesDocumentDataMatch(docData: RxDocumentType | any): boolean; /** * deletes all found documents * @return promise with deleted documents */ remove(): Promise; /** * helper function to transform RxQueryBase to RxQuery type */ get asRxQuery(): RxQuery; /** * updates all found documents * @overwritten by plugin (optional) */ update(_updateObj: any): Promise; where(_queryObj: MangoQuerySelector | keyof RxDocumentType | string): RxQuery; sort(_params: string | MangoQuerySortPart): RxQuery; skip(_amount: number | null): RxQuery; limit(_amount: number | null): RxQuery; } export declare function _getDefaultQuery(collection: RxCollection): MangoQuery; /** * run this query through the QueryCache */ export declare function tunnelQueryCache(rxQuery: RxQueryBase): RxQuery; export declare function createRxQuery(op: RxQueryOP, queryObj: MangoQuery, collection: RxCollection): RxQueryBase; export declare function isInstanceOf(obj: any): boolean;