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