-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
77 lines (67 loc) · 3.22 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
export class JSONPatchQueueSynchronous {
/**
* JSON Patch Queue for synchronous operations, and asynchronous networking.
* version: 3.0.0-rc.1
* @param {Object} Obj The target object where patches are applied
* @param {JSON-Pointer} versionPath JSON-Pointers to version numbers
* @param {function} apply apply(JSONobj, JSONPatchSequence) function to apply JSONPatch to object.
* @param {Boolean} [purist] If set to true adds test operation before replace.
*/
constructor(versionPath: String, apply: Function, purist: Boolean);
public version: Number;
/**
* Process received versioned JSON Patch.
* Applies or adds to queue.
* @param {JSONPatch} versionedJsonPatch patch to be applied
* @param {Function} [applyCallback] optional `function(object, consecutivePatch)` to be called when applied, if not given #apply will be called
*/
public receive(versionedJsonPatch: Object, applyCallback: Function);
/**
* Wraps JSON Patch sequence with version related operation objects
* @param {JSONPatch} sequence JSON Patch sequence to wrap
* @return {VersionedJSONPatch}
*/
public send(sequence: Array<Object>): Array<Object>;
public static getPropertyByJsonPointer(obj: Object, pointer: String): any;
/**
* Reset queue internals and object to new, given state
* @param obj object to apply new state to
* @param newState versioned object representing desired state along with versions
*/
public reset(obj: Object, newState: Object);
}
export class JSONPatchQueue {
/**
* JSON Patch Queue for asynchronous operations, and asynchronous networking.
* @param {Object} Obj The target object where patches are applied
* @param {Array<JSON-Pointer>} versionPaths JSON-Pointers to version numbers [local, remote]
* @param {function} apply apply(JSONobj, JSONPatchSequence) function to apply JSONPatch to object.
* @param {Boolean} [purist] If set to true adds test operation before replace.
* @version: 1.0.0
*/
constructor(obj: Object, versionPaths: String, apply: Function, purist: Boolean);
/** local version */
public localVersion: Number;
/** Latest acknowledged remote version */
public remoteVersion: Number;
/**
* Process received versioned JSON Patch
* Applies or adds to queue.
* @param {JSONPatch} versionedJsonPatch patch to be applied
* @param {Function} [applyCallback] optional `function(object, consecutivePatch)` to be called when applied, if not given #apply will be called
*/
public receive(versionedJsonPatch: Object, applyCallback: Function);
/**
* Wraps JSON Patch sequence with version related operation objects
* @param {JSONPatch} sequence JSON Patch sequence to wrap
* @return {VersionedJSONPatch}
*/
public send(sequence: Array<Object>): Array<Object>;
public static getPropertyByJsonPointer(obj: Object, pointer: String): any;
/**
* Reset queue internals and object to new, given state
* @param obj object to apply new state to
* @param newState versioned object representing desired state along with versions
*/
public reset(obj: Object, newState: Object) : Object
}