@capture.dev/fast-json-patch 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -26,7 +26,7 @@ declare class PatchError extends Error {
|
|
|
26
26
|
constructor(message: string, name: JsonPatchErrorName, index?: number, operation?: any, tree?: any);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
type Operation = AddOperation<
|
|
29
|
+
type Operation<T = any> = AddOperation<T> | RemoveOperation | ReplaceOperation<T> | MoveOperation | CopyOperation | TestOperation<T> | GetOperation<T>;
|
|
30
30
|
interface Validator<T> {
|
|
31
31
|
(operation: Operation, index: number, document: T, existingPathFragment: string): void;
|
|
32
32
|
}
|
|
@@ -35,39 +35,39 @@ interface OperationResult<T> {
|
|
|
35
35
|
test?: boolean;
|
|
36
36
|
newDocument: T;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
type BaseOperation = {
|
|
39
39
|
path: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
40
|
+
};
|
|
41
|
+
type AddOperation<T> = BaseOperation & {
|
|
42
42
|
op: "add";
|
|
43
43
|
value: T;
|
|
44
|
-
}
|
|
45
|
-
|
|
44
|
+
};
|
|
45
|
+
type RemoveOperation = BaseOperation & {
|
|
46
46
|
op: "remove";
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
};
|
|
48
|
+
type ReplaceOperation<T> = BaseOperation & {
|
|
49
49
|
op: "replace";
|
|
50
50
|
value: T;
|
|
51
|
-
}
|
|
52
|
-
|
|
51
|
+
};
|
|
52
|
+
type MoveOperation = BaseOperation & {
|
|
53
53
|
op: "move";
|
|
54
54
|
from: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
55
|
+
};
|
|
56
|
+
type CopyOperation = BaseOperation & {
|
|
57
57
|
op: "copy";
|
|
58
58
|
from: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
};
|
|
60
|
+
type TestOperation<T> = BaseOperation & {
|
|
61
61
|
op: "test";
|
|
62
62
|
value: T;
|
|
63
|
-
}
|
|
64
|
-
|
|
63
|
+
};
|
|
64
|
+
type GetOperation<T> = BaseOperation & {
|
|
65
65
|
op: "_get";
|
|
66
66
|
value: T;
|
|
67
|
-
}
|
|
68
|
-
|
|
67
|
+
};
|
|
68
|
+
type PatchResult<T> = Array<OperationResult<T>> & {
|
|
69
69
|
newDocument: T;
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
/**
|
|
72
72
|
* Retrieves a value from a JSON document by a JSON pointer.
|
|
73
73
|
* Returns the value.
|
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ declare class PatchError extends Error {
|
|
|
26
26
|
constructor(message: string, name: JsonPatchErrorName, index?: number, operation?: any, tree?: any);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
type Operation = AddOperation<
|
|
29
|
+
type Operation<T = any> = AddOperation<T> | RemoveOperation | ReplaceOperation<T> | MoveOperation | CopyOperation | TestOperation<T> | GetOperation<T>;
|
|
30
30
|
interface Validator<T> {
|
|
31
31
|
(operation: Operation, index: number, document: T, existingPathFragment: string): void;
|
|
32
32
|
}
|
|
@@ -35,39 +35,39 @@ interface OperationResult<T> {
|
|
|
35
35
|
test?: boolean;
|
|
36
36
|
newDocument: T;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
type BaseOperation = {
|
|
39
39
|
path: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
40
|
+
};
|
|
41
|
+
type AddOperation<T> = BaseOperation & {
|
|
42
42
|
op: "add";
|
|
43
43
|
value: T;
|
|
44
|
-
}
|
|
45
|
-
|
|
44
|
+
};
|
|
45
|
+
type RemoveOperation = BaseOperation & {
|
|
46
46
|
op: "remove";
|
|
47
|
-
}
|
|
48
|
-
|
|
47
|
+
};
|
|
48
|
+
type ReplaceOperation<T> = BaseOperation & {
|
|
49
49
|
op: "replace";
|
|
50
50
|
value: T;
|
|
51
|
-
}
|
|
52
|
-
|
|
51
|
+
};
|
|
52
|
+
type MoveOperation = BaseOperation & {
|
|
53
53
|
op: "move";
|
|
54
54
|
from: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
55
|
+
};
|
|
56
|
+
type CopyOperation = BaseOperation & {
|
|
57
57
|
op: "copy";
|
|
58
58
|
from: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
};
|
|
60
|
+
type TestOperation<T> = BaseOperation & {
|
|
61
61
|
op: "test";
|
|
62
62
|
value: T;
|
|
63
|
-
}
|
|
64
|
-
|
|
63
|
+
};
|
|
64
|
+
type GetOperation<T> = BaseOperation & {
|
|
65
65
|
op: "_get";
|
|
66
66
|
value: T;
|
|
67
|
-
}
|
|
68
|
-
|
|
67
|
+
};
|
|
68
|
+
type PatchResult<T> = Array<OperationResult<T>> & {
|
|
69
69
|
newDocument: T;
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
/**
|
|
72
72
|
* Retrieves a value from a JSON document by a JSON pointer.
|
|
73
73
|
* Returns the value.
|
package/package.json
CHANGED