@@ -1468,23 +1468,25 @@ WOQLClient.prototype.userOrganizations = function (orgList) {
1468
1468
* Get the patch of difference between two documents.
1469
1469
* @param {object } before - The current state of JSON document
1470
1470
* @param {object } after - The updated state of JSON document
1471
+ * @param {object } options [{}] - Options to send to the diff endpoint
1471
1472
* @returns {Promise } A promise that returns the call response object, or an Error if rejected.
1472
1473
* @example
1473
1474
* const diff = await client.getDiff(
1474
1475
* { "@id ": "Person/Jane", "@type": "Person", name: "Jane" },
1475
1476
* { "@id ": "Person/Jane", "@type": "Person", name: "Janine" }
1476
1477
* );
1477
1478
*/
1478
- WOQLClient . prototype . getDiff = function ( before , after ) {
1479
+ WOQLClient . prototype . getDiff = function ( before , after , options ) {
1479
1480
if ( typeof before !== 'object' || typeof after !== 'object' ) {
1480
1481
const errmsg = '"before" or "after" parameter error - you must specify a valid before or after json document' ;
1481
1482
1482
1483
return Promise . reject (
1483
1484
new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . GET_DIFF , errmsg ) ) ,
1484
1485
) ;
1485
1486
}
1487
+ const opt = ( typeof options === 'undefined' ) ? { } : options ;
1488
+ const payload = { before, after, ...opt } ;
1486
1489
1487
- const payload = { before, after } ;
1488
1490
return this . dispatch (
1489
1491
CONST . POST ,
1490
1492
`${ this . connectionConfig . apiURL ( ) } diff` ,
@@ -1497,6 +1499,7 @@ WOQLClient.prototype.getDiff = function (before, after) {
1497
1499
* @param {string } id - The object id to be diffed
1498
1500
* @param {string } beforeVersion - The version from which to compare the object
1499
1501
* @param {object } after - The updated state of JSON document
1502
+ * @param {object } options [{}] - Options to send to the diff endpoint
1500
1503
* @returns {Promise } A promise that returns the call response object, or an Error if rejected.
1501
1504
* @example
1502
1505
* const diff = await client.getVersionObjectDiff(
@@ -1505,16 +1508,18 @@ WOQLClient.prototype.getDiff = function (before, after) {
1505
1508
* { "@id ": "Person/Jane", "@type": "Person", name: "Janine" }
1506
1509
* );
1507
1510
*/
1508
- WOQLClient . prototype . getVersionObjectDiff = function ( id , beforeVersion , after ) {
1511
+ WOQLClient . prototype . getVersionObjectDiff = function ( id , beforeVersion , after , options ) {
1509
1512
if ( typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof after !== 'object' ) {
1510
1513
const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version' ;
1511
1514
1512
1515
return Promise . reject (
1513
1516
new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . GET_DIFF , errmsg ) ) ,
1514
1517
) ;
1515
1518
}
1516
-
1517
- const payload = { document_id : id , before_data_version : beforeVersion , after } ;
1519
+ const opt = ( typeof options === 'undefined' ) ? { } : options ;
1520
+ const payload = {
1521
+ document_id : id , before_data_version : beforeVersion , after, ...opt ,
1522
+ } ;
1518
1523
return this . dispatch (
1519
1524
CONST . POST ,
1520
1525
this . connectionConfig . diffURL ( ) ,
@@ -1527,6 +1532,7 @@ WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after)
1527
1532
* @param {string } id - The object id to be diffed
1528
1533
* @param {string } beforeVersion - The version from which to compare the object
1529
1534
* @param {string } afterVersion - The version to which to compare the object
1535
+ * @param {object } options [{}] - Options to send to the diff endpoint
1530
1536
* @returns {Promise } A promise that returns the call response object, or an Error if rejected.
1531
1537
* @example
1532
1538
* const diff = await client.getVersionDiff(
@@ -1535,19 +1541,20 @@ WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after)
1535
1541
* "branch:73rqpooz65kbsheuno5dsayh71x7wf4"
1536
1542
* );
1537
1543
*/
1538
- WOQLClient . prototype . getVersionDiff = function ( id , beforeVersion , afterVersion ) {
1544
+ WOQLClient . prototype . getVersionDiff = function ( id , beforeVersion , afterVersion , options ) {
1539
1545
if ( typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof afterVersion !== 'string' ) {
1540
1546
const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version' ;
1541
1547
1542
1548
return Promise . reject (
1543
1549
new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . GET_DIFF , errmsg ) ) ,
1544
1550
) ;
1545
1551
}
1546
-
1552
+ const opt = ( typeof options === 'undefined' ) ? { } : options ;
1547
1553
const payload = {
1548
1554
document_id : id ,
1549
1555
before_data_version : beforeVersion ,
1550
1556
after_data_version : afterVersion ,
1557
+ ...opt ,
1551
1558
} ;
1552
1559
return this . dispatch (
1553
1560
CONST . POST ,
0 commit comments