@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 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<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;
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
- interface BaseOperation {
38
+ type BaseOperation = {
39
39
  path: string;
40
- }
41
- interface AddOperation<T> extends BaseOperation {
40
+ };
41
+ type AddOperation<T> = BaseOperation & {
42
42
  op: "add";
43
43
  value: T;
44
- }
45
- interface RemoveOperation extends BaseOperation {
44
+ };
45
+ type RemoveOperation = BaseOperation & {
46
46
  op: "remove";
47
- }
48
- interface ReplaceOperation<T> extends BaseOperation {
47
+ };
48
+ type ReplaceOperation<T> = BaseOperation & {
49
49
  op: "replace";
50
50
  value: T;
51
- }
52
- interface MoveOperation extends BaseOperation {
51
+ };
52
+ type MoveOperation = BaseOperation & {
53
53
  op: "move";
54
54
  from: string;
55
- }
56
- interface CopyOperation extends BaseOperation {
55
+ };
56
+ type CopyOperation = BaseOperation & {
57
57
  op: "copy";
58
58
  from: string;
59
- }
60
- interface TestOperation<T> extends BaseOperation {
59
+ };
60
+ type TestOperation<T> = BaseOperation & {
61
61
  op: "test";
62
62
  value: T;
63
- }
64
- interface GetOperation<T> extends BaseOperation {
63
+ };
64
+ type GetOperation<T> = BaseOperation & {
65
65
  op: "_get";
66
66
  value: T;
67
- }
68
- interface PatchResult<T> extends Array<OperationResult<T>> {
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<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;
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
- interface BaseOperation {
38
+ type BaseOperation = {
39
39
  path: string;
40
- }
41
- interface AddOperation<T> extends BaseOperation {
40
+ };
41
+ type AddOperation<T> = BaseOperation & {
42
42
  op: "add";
43
43
  value: T;
44
- }
45
- interface RemoveOperation extends BaseOperation {
44
+ };
45
+ type RemoveOperation = BaseOperation & {
46
46
  op: "remove";
47
- }
48
- interface ReplaceOperation<T> extends BaseOperation {
47
+ };
48
+ type ReplaceOperation<T> = BaseOperation & {
49
49
  op: "replace";
50
50
  value: T;
51
- }
52
- interface MoveOperation extends BaseOperation {
51
+ };
52
+ type MoveOperation = BaseOperation & {
53
53
  op: "move";
54
54
  from: string;
55
- }
56
- interface CopyOperation extends BaseOperation {
55
+ };
56
+ type CopyOperation = BaseOperation & {
57
57
  op: "copy";
58
58
  from: string;
59
- }
60
- interface TestOperation<T> extends BaseOperation {
59
+ };
60
+ type TestOperation<T> = BaseOperation & {
61
61
  op: "test";
62
62
  value: T;
63
- }
64
- interface GetOperation<T> extends BaseOperation {
63
+ };
64
+ type GetOperation<T> = BaseOperation & {
65
65
  op: "_get";
66
66
  value: T;
67
- }
68
- interface PatchResult<T> extends Array<OperationResult<T>> {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capture.dev/fast-json-patch",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Fast implementation of JSON-Patch (RFC-6902) with duplex (observe changes) capabilities",