How-to use the JS Client to diff a specific object or database branch
Diff an object
Return the diff from two objects
constdiffObjects=async () => {constbefore= { "@id":"Person/Jane","@type":"Person","name":"Jane"}constafter= { "@id":"Person/Jane","@type":"Person","name":"Janine"}constoptions= {keep:{ "@id":true,"name":true }}//in the options you can list the properties that you would like to see in the diff result.constdiffResult=awaitclient.getJSONDiff=function (before, after, options) {console.log("the diff result ",JSON.stringify(diffResult,null,4))}
Here is an example of a diff result between two objects
Get the patch of difference between a document and an object.
constdiffDocToObject=async () => {constjsonObject= { "@id":"Person/Jane","@type":"Person","name":"Jannet"}constoptions= {keep:{ "@id":true,"name":true }}//in the options you can list the properties that you would like to see in the diff result.constdiffResult=awaitclient.getVersionObjectDiff=function ("main", jsonObject,"Person/Jane", options) {console.log("the diff result ",JSON.stringify(diffResult,null,4))}