import { JSONObject, RecordPathData } from '../constants'; import { RecordCore, WriteAckCallback } from './record-core'; import { MergeStrategy } from './merge-strategy'; import { Emitter } from '../util/emitter'; export type SubscriptionCallback = (data: any) => void; export declare class Record extends Emitter { private record; debugId: string | null; private subscriptions; constructor(record: RecordCore); get name(): string; get isReady(): boolean; get version(): number; get hasProvider(): boolean; whenReady(): Promise; whenReady(callback: ((record: Record) => void)): void; get(path?: string): any; set(data: JSONObject, callback?: WriteAckCallback): void; set(path: string, data: RecordPathData | undefined, callback?: WriteAckCallback): void; setWithAck(data: JSONObject): Promise; setWithAck(data: JSONObject, callback: ((error: string) => void)): void; setWithAck(path: string, data: RecordPathData | undefined): Promise; setWithAck(path: string, data: RecordPathData | undefined, callback: ((error: string) => void)): void; setWithAck(data: JSONObject, callback?: ((error: string) => void)): Promise | void; /** * Applies an ordered batch of {path, data} patches atomically (one PATCH_MULTI * message on the wire, one server-side version bump). Set `data: undefined` * on a patch to delete that path. */ setMulti(patches: Array<{ path: string; data: any; }>, callback?: WriteAckCallback): void; setMultiWithAck(patches: Array<{ path: string; data: any; }>): Promise; setMultiWithAck(patches: Array<{ path: string; data: any; }>, callback: WriteAckCallback): void; /** * Deletes a path from the record. Equivalent to doing `record.set(path, undefined)` * * @param {String} path The path to be deleted */ erase(path: string): void; /** * Deletes a path from the record and either takes a callback that will be called when the * write has been done or returns a promise that will resolve when the write is done. */ eraseWithAck(path: string): Promise; eraseWithAck(path: string, callback: ((error: string) => void)): void; subscribe(callback: SubscriptionCallback, triggerNow?: boolean): void; subscribe(path: string, callback: SubscriptionCallback, triggerNow?: boolean): void; unsubscribe(callback: SubscriptionCallback): void; unsubscribe(path: string, callback: SubscriptionCallback): void; discard(): void; delete(callback?: (error: string | null) => void): void | Promise; setMergeStrategy(mergeStrategy: MergeStrategy): void; }