1 | import { Pointer } from './pointer';
|
2 | export { Pointer };
|
3 | import { Operation, TestOperation, VoidableDiff } from './diff';
|
4 | export { Operation, TestOperation };
|
5 | export type Patch = Operation[];
|
6 | /**
|
7 | Apply a 'application/json-patch+json'-type patch to an object.
|
8 |
|
9 | `patch` *must* be an array of operations.
|
10 |
|
11 | > Operation objects MUST have exactly one "op" member, whose value
|
12 | > indicates the operation to perform. Its value MUST be one of "add",
|
13 | > "remove", "replace", "move", "copy", or "test"; other values are
|
14 | > errors.
|
15 |
|
16 | This method mutates the target object in-place.
|
17 |
|
18 | @returns list of results, one for each operation: `null` indicated success,
|
19 | otherwise, the result will be an instance of one of the Error classes:
|
20 | MissingError, InvalidOperationError, or TestError.
|
21 | */
|
22 | export declare function applyPatch(object: any, patch: Operation[]): (import("./patch").MissingError | import("./patch").TestError | import("./patch").InvalidOperationError | null)[];
|
23 | /**
|
24 | Produce a 'application/json-patch+json'-type patch to get from one object to
|
25 | another.
|
26 |
|
27 | This does not alter `input` or `output` unless they have a property getter with
|
28 | side-effects (which is not a good idea anyway).
|
29 |
|
30 | `diff` is called on each pair of comparable non-primitive nodes in the
|
31 | `input`/`output` object trees, producing nested patches. Return `undefined`
|
32 | to fall back to default behaviour.
|
33 |
|
34 | Returns list of operations to perform on `input` to produce `output`.
|
35 | */
|
36 | export declare function createPatch(input: any, output: any, diff?: VoidableDiff): Operation[];
|
37 | /**
|
38 | Produce an 'application/json-patch+json'-type list of tests, to verify that
|
39 | existing values in an object are identical to the those captured at some
|
40 | checkpoint (whenever this function is called).
|
41 |
|
42 | This does not alter `input` or `output` unless they have a property getter with
|
43 | side-effects (which is not a good idea anyway).
|
44 |
|
45 | Returns list of test operations.
|
46 | */
|
47 | export declare function createTests(input: any, patch: Operation[]): TestOperation[];
|