import type { MangoQuery, RxQuery } from './types/rx-query'; import { SortComparator, QueryMatcher } from 'event-reduce-js'; export declare type PreparedQuery = MangoQuery | any; /** * TODO WORK IN PROGRESS! * This is an interface that abstracts the storage engine. * At the moment we only have PouchDB as storage but * in the future we want to create many more of them. * * Also see * @link https://github.com/pubkey/rxdb/issues/1636 * * */ export interface RxStorage { name: string; /** * pouchdb and others have some bugs * and behaviors that must be worked arround * before querying the collection. * For performance reason this preparation * runs in a single step so it can be cached * when the query is used multiple times * * @returns a format of the query than can be used with the storage */ prepareQuery(rxQuery: RxQuery, mutateableQuery: MangoQuery): PreparedQuery; /** * returns the sort-comparator, * which results in the equal sorting that a query over the db would do */ getSortComparator(primaryKey: string, query: MangoQuery): SortComparator; /** * returns a function * that can be used to check if a document * matches the query */ getQueryMatcher(primaryKey: string, query: MangoQuery): QueryMatcher; /** * creates a storage instance * that can contains the internal database * For example the PouchDB instance */ createStorageInstance(databaseName: string, collectionName: string, version: number, options?: any): RxStorageInstance; /** * creates the internal storage instance * which is used by the RxDatabase to store metadata * Created exactly once per RxDatabase */ createInternalStorageInstance(databaseName: string, options?: any): Promise; }