import { Callback, Path, ReadonlyDeep } from '../types'; import { type Segments } from '../types'; declare module './Model' { interface Model { /** * Sets the value at this model's path or a relative subpath, if different * from the current value based on a strict equality comparison (`===`). * * If a callback is provided, it's called when the write is committed or * fails. * * @param subpath * @param value * @returns the value previously at the path */ setDiff(subpath: Path, value: S, cb?: Callback): ReadonlyDeep | undefined; setDiff(value: T | undefined): ReadonlyDeep | undefined; setDiffPromised(subpath: Path, value: any): Promise; _setDiff(segments: Segments, value: any, cb?: (err: Error) => void): void; /** * Sets the value at this model's path or a relative subpath, if different * from the current value based on a recursive deep equal comparison. * * This attempts to issue fine-grained ops on subpaths if possible. * * If a callback is provided, it's called when the write is committed or * fails. * * @param subpath * @param value * @returns the value previously at the path */ setDiffDeep(subpath: Path, value: S, cb?: Callback): ReadonlyDeep | undefined; setDiffDeep(value: T): ReadonlyDeep | undefined; setDiffDeepPromised(subpath: Path, value: S): Promise; _setDiffDeep(segments: Segments, value: any, cb?: (err: Error) => void): void; /** * Sets the array value at this model's path or a relative subpath, based on * a strict equality comparison (`===`) between array items. * * This only issues array insert, remove, and move operations. * * If a callback is provided, it's called when the write is committed or * fails. * * @param subpath * @param value * @returns the value previously at the path */ setArrayDiff(subpath: Path, value: S, cb?: Callback): S; setArrayDiff(value: S): S; setArrayDiffPromised(subpath: Path, value: S): Promise; _setArrayDiff(segments: Segments, value: any, cb?: (err: Error) => void, equalFn?: any): void; /** * Sets the array value at this model's path or a relative subpath, based on * a deep equality comparison between array items. * * This only issues array insert, remove, and move operations. Unlike * `setDiffDeep`, this will never issue fine-grained ops inside of array * items. * * If a callback is provided, it's called when the write is committed or * fails. * * @param subpath * @param value * @returns the value previously at the path */ setArrayDiffDeep(subpath: Path, value: S, cb?: Callback): S; setArrayDiffDeep(value: S): S; setArrayDiffDeepPromised(subpath: Path, value: S): Promise; _setArrayDiffDeep(segments: Segments, value: any, cb?: (err: Error) => void): void; _setArrayDiff(segments: Segments, value: any, cb?: (err: Error) => void, equalFn?: any): S; _applyArrayDiff(segments: Segments, diff: any, cb?: (err: Error) => void): S; } }