UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

27 lines (26 loc) 1.16 kB
import { type JsonNode } from '../nodes'; import type { PatchBuilder } from '../../json-crdt-patch/PatchBuilder'; import type { Path } from '@jsonjoy.com/json-pointer/lib/types'; import type { Model } from '../model'; import type { Operation } from '../../json-patch'; export declare class JsonPatch<N extends JsonNode = JsonNode<any>> { protected readonly model: Model<N>; protected readonly pfx: Path; constructor(model: Model<N>, pfx?: Path); apply(ops: Operation[]): this; applyOp(op: Operation): this; protected builder(): PatchBuilder; toPath(path: string | Path): Path; add(path: string | Path, value: unknown): void; remove(path: string | Path): void; replace(path: string | Path, value: unknown): void; move(path: string | Path, from: string | Path): void; copy(path: string | Path, from: string | Path): void; test(path: string | Path, value: unknown): void; strIns(path: string | Path, pos: number, str: string): void; strDel(path: string | Path, pos: number, len: number, str?: string): void; get(path: string | Path): unknown; private _get; private json; private setRoot; }