json-diff-ts 5.0.0-alpha.9 → 5.0.0

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
@@ -32,6 +32,8 @@ interface Options {
32
32
  /** @deprecated Use `arrayIdentityKeys` instead. */
33
33
  embeddedObjKeys?: EmbeddedObjKeysType | EmbeddedObjKeysMapType;
34
34
  keysToSkip?: readonly string[];
35
+ /** Compare only these paths and their descendants. Array element keys are omitted. */
36
+ keysToInclude?: readonly string[];
35
37
  treatTypeChangeAsReplace?: boolean;
36
38
  }
37
39
  /**
@@ -96,7 +98,7 @@ declare const atomizeChangeset: (obj: Changeset | IChange, path?: string, embedd
96
98
  * If it represents a leaf node, it sets the key, type, value, and oldValue of the current change object.
97
99
  * Finally, it pushes the unflattened change object into the changes array.
98
100
  */
99
- declare const unatomizeChangeset: (changes: IAtomicChange | IAtomicChange[]) => IChange[];
101
+ declare const unatomizeChangeset: (changes: IAtomicChange | IAtomicChange[]) => Changeset;
100
102
  /**
101
103
  * Determines the type of a given object.
102
104
  *
@@ -166,6 +168,7 @@ type AtomPathSegment = {
166
168
  property: string;
167
169
  value: unknown;
168
170
  literalKey?: boolean;
171
+ memberPath?: string[];
169
172
  } | {
170
173
  type: 'valueFilter';
171
174
  value: unknown;
@@ -238,11 +241,7 @@ declare function fromAtom(atom: IJsonAtom): IAtomicChange[];
238
241
  * Requires all replace/remove operations to have oldValue.
239
242
  */
240
243
  declare function invertAtom(atom: IJsonAtom): IJsonAtom;
241
- /**
242
- * Apply a JSON Atom document to an object.
243
- * Processes operations sequentially. Handles root operations directly.
244
- * Returns the result (MUST use return value for root primitive replacements).
245
- */
244
+ /** Apply operations sequentially in place; use the return value for root changes. */
246
245
  declare function applyAtom(obj: any, atom: IJsonAtom): any;
247
246
  /**
248
247
  * Revert a JSON Atom by computing its inverse and applying it.
@@ -252,7 +251,7 @@ declare function revertAtom(obj: any, atom: IJsonAtom): any;
252
251
 
253
252
  /**
254
253
  * Returns a copy of the operation containing only spec-defined keys
255
- * (`op`, `path`, `value`, `oldValue`). Complement of `operationExtensions`.
254
+ * (`op`, `path`, `from`, `value`, `oldValue`). Complement of `operationExtensions`.
256
255
  */
257
256
  declare function operationSpecDict(op: IAtomOperation): IAtomOperation;
258
257
  /**
package/dist/index.d.ts CHANGED
@@ -32,6 +32,8 @@ interface Options {
32
32
  /** @deprecated Use `arrayIdentityKeys` instead. */
33
33
  embeddedObjKeys?: EmbeddedObjKeysType | EmbeddedObjKeysMapType;
34
34
  keysToSkip?: readonly string[];
35
+ /** Compare only these paths and their descendants. Array element keys are omitted. */
36
+ keysToInclude?: readonly string[];
35
37
  treatTypeChangeAsReplace?: boolean;
36
38
  }
37
39
  /**
@@ -96,7 +98,7 @@ declare const atomizeChangeset: (obj: Changeset | IChange, path?: string, embedd
96
98
  * If it represents a leaf node, it sets the key, type, value, and oldValue of the current change object.
97
99
  * Finally, it pushes the unflattened change object into the changes array.
98
100
  */
99
- declare const unatomizeChangeset: (changes: IAtomicChange | IAtomicChange[]) => IChange[];
101
+ declare const unatomizeChangeset: (changes: IAtomicChange | IAtomicChange[]) => Changeset;
100
102
  /**
101
103
  * Determines the type of a given object.
102
104
  *
@@ -166,6 +168,7 @@ type AtomPathSegment = {
166
168
  property: string;
167
169
  value: unknown;
168
170
  literalKey?: boolean;
171
+ memberPath?: string[];
169
172
  } | {
170
173
  type: 'valueFilter';
171
174
  value: unknown;
@@ -238,11 +241,7 @@ declare function fromAtom(atom: IJsonAtom): IAtomicChange[];
238
241
  * Requires all replace/remove operations to have oldValue.
239
242
  */
240
243
  declare function invertAtom(atom: IJsonAtom): IJsonAtom;
241
- /**
242
- * Apply a JSON Atom document to an object.
243
- * Processes operations sequentially. Handles root operations directly.
244
- * Returns the result (MUST use return value for root primitive replacements).
245
- */
244
+ /** Apply operations sequentially in place; use the return value for root changes. */
246
245
  declare function applyAtom(obj: any, atom: IJsonAtom): any;
247
246
  /**
248
247
  * Revert a JSON Atom by computing its inverse and applying it.
@@ -252,7 +251,7 @@ declare function revertAtom(obj: any, atom: IJsonAtom): any;
252
251
 
253
252
  /**
254
253
  * Returns a copy of the operation containing only spec-defined keys
255
- * (`op`, `path`, `value`, `oldValue`). Complement of `operationExtensions`.
254
+ * (`op`, `path`, `from`, `value`, `oldValue`). Complement of `operationExtensions`.
256
255
  */
257
256
  declare function operationSpecDict(op: IAtomOperation): IAtomOperation;
258
257
  /**