import { Observable } from 'rxjs'; import IdleQueue from 'custom-idle-queue'; import { RxCollection } from './rx-collection'; import { RxDatabase } from './rx-database'; import { RxAttachment, RxAttachmentCreator } from './rx-attachment'; export type RxDocument = RxDocumentBase & RxDocumentType & OrmMethods; export type RxDocumentTypeWithRev = RxDocumentType & { _rev: string }; declare type AtomicUpdateFunction = (doc: RxDocumentType) => RxDocumentType | Promise; export declare class RxDocumentBase { readonly collection: RxCollection; readonly deleted: boolean; readonly $: Observable; readonly deleted$: Observable; readonly primary: string; get$(path: string): Observable; get(objPath: string): any; populate(objPath: string): Promise | any>; // change data of document atomicUpdate(fun: AtomicUpdateFunction): Promise>; atomicSet(objPath: string, value: any): Promise>; update(updateObj: any): Promise; remove(): Promise; // only for temporary documents set(objPath: string, value: any): RxDocument; save(): Promise; // attachments putAttachment(creator: RxAttachmentCreator): Promise>; getAttachment(id: string): RxAttachment; allAttachments(): RxAttachment[]; readonly allAttachments$: Observable[]>; toJSON(): RxDocumentTypeWithRev; toJSON(withRevAndAttachments: false): RxDocumentType; destroy(): void; } export declare class RxLocalDocument extends RxDocumentBase<{}> { readonly parent: Parent; isLocal(): true; }