import { Observable } from 'rxjs'; import BroadcastChannel from 'broadcast-channel'; import { RxCollectionCreator, RxCollection } from './rx-collection'; import { RxLocalDocument } from './rx-document'; import { RxChangeEventInsert, RxChangeEventUpdate, RxChangeEventRemove, RxChangeEventCollection } from './rx-change-event'; import { PouchSettings } from "./pouch"; export interface RxDatabaseCreator { name: string; adapter: any; password?: string; multiInstance?: boolean; queryChangeDetection?: boolean; ignoreDuplicate?: boolean; options?: any; pouchSettings?: PouchSettings; } // options for the server-plugin export interface ServerOptions { path?: string; port?: number; cors?: boolean; } export type RxDatabase = RxDatabaseBase & Collections; type collectionCreateType = (args: RxCollectionCreator) => Promise>; export declare class RxDatabaseBase { readonly name: string; readonly token: string; readonly multiInstance: boolean; readonly queryChangeDetection: boolean; readonly broadcastChannel: BroadcastChannel; readonly password: string; readonly collections: any; options?: any; pouchSettings?: PouchSettings; readonly $: Observable | RxChangeEventUpdate | RxChangeEventRemove | RxChangeEventCollection>; collection: collectionCreateType; destroy(): Promise; dump(): Promise; importDump(json: any): Promise; remove(): Promise; readonly isLeader: boolean; insertLocal(id: string, data: any): Promise>>; upsertLocal(id: string, data: any): Promise>>; getLocal(id: string): Promise>>; // from rxdb/plugins/server server(options?: ServerOptions): { app: any; server: any; }; /** * returns a promise which resolves when the instance becomes leader * @return {Promise} */ waitForLeadership(): Promise; /** * removes all internal collection-info * only use this if you have to upgrade from a major rxdb-version * do NEVER use this to change the schema of a collection */ dangerousRemoveCollectionInfo(): Promise; }