@@ -1468,23 +1468,25 @@ WOQLClient.prototype.userOrganizations = function (orgList) {
14681468 * Get the patch of difference between two documents.
14691469 * @param {object } before - The current state of JSON document
14701470 * @param {object } after - The updated state of JSON document
1471+ * @param {object } options [{}] - Options to send to the diff endpoint
14711472 * @returns {Promise } A promise that returns the call response object, or an Error if rejected.
14721473 * @example
14731474 * const diff = await client.getDiff(
14741475 * { "@id ": "Person/Jane", "@type": "Person", name: "Jane" },
14751476 * { "@id ": "Person/Jane", "@type": "Person", name: "Janine" }
14761477 * );
14771478 */
1478- WOQLClient . prototype . getDiff = function ( before , after ) {
1479+ WOQLClient . prototype . getDiff = function ( before , after , options ) {
14791480 if ( typeof before !== 'object' || typeof after !== 'object' ) {
14801481 const errmsg = '"before" or "after" parameter error - you must specify a valid before or after json document' ;
14811482
14821483 return Promise . reject (
14831484 new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . GET_DIFF , errmsg ) ) ,
14841485 ) ;
14851486 }
1487+ const opt = ( typeof options === 'undefined' ) ? { } : options ;
1488+ const payload = { before, after, ...opt } ;
14861489
1487- const payload = { before, after } ;
14881490 return this . dispatch (
14891491 CONST . POST ,
14901492 `${ this . connectionConfig . apiURL ( ) } diff` ,
@@ -1497,6 +1499,7 @@ WOQLClient.prototype.getDiff = function (before, after) {
14971499 * @param {string } id - The object id to be diffed
14981500 * @param {string } beforeVersion - The version from which to compare the object
14991501 * @param {object } after - The updated state of JSON document
1502+ * @param {object } options [{}] - Options to send to the diff endpoint
15001503 * @returns {Promise } A promise that returns the call response object, or an Error if rejected.
15011504 * @example
15021505 * const diff = await client.getVersionObjectDiff(
@@ -1505,16 +1508,18 @@ WOQLClient.prototype.getDiff = function (before, after) {
15051508 * { "@id ": "Person/Jane", "@type": "Person", name: "Janine" }
15061509 * );
15071510 */
1508- WOQLClient . prototype . getVersionObjectDiff = function ( id , beforeVersion , after ) {
1511+ WOQLClient . prototype . getVersionObjectDiff = function ( id , beforeVersion , after , options ) {
15091512 if ( typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof after !== 'object' ) {
15101513 const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version' ;
15111514
15121515 return Promise . reject (
15131516 new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . GET_DIFF , errmsg ) ) ,
15141517 ) ;
15151518 }
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+ } ;
15181523 return this . dispatch (
15191524 CONST . POST ,
15201525 this . connectionConfig . diffURL ( ) ,
@@ -1527,6 +1532,7 @@ WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after)
15271532 * @param {string } id - The object id to be diffed
15281533 * @param {string } beforeVersion - The version from which to compare the object
15291534 * @param {string } afterVersion - The version to which to compare the object
1535+ * @param {object } options [{}] - Options to send to the diff endpoint
15301536 * @returns {Promise } A promise that returns the call response object, or an Error if rejected.
15311537 * @example
15321538 * const diff = await client.getVersionDiff(
@@ -1535,19 +1541,20 @@ WOQLClient.prototype.getVersionObjectDiff = function (id, beforeVersion, after)
15351541 * "branch:73rqpooz65kbsheuno5dsayh71x7wf4"
15361542 * );
15371543 */
1538- WOQLClient . prototype . getVersionDiff = function ( id , beforeVersion , afterVersion ) {
1544+ WOQLClient . prototype . getVersionDiff = function ( id , beforeVersion , afterVersion , options ) {
15391545 if ( typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof afterVersion !== 'string' ) {
15401546 const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version' ;
15411547
15421548 return Promise . reject (
15431549 new Error ( ErrorMessage . getInvalidParameterMessage ( CONST . GET_DIFF , errmsg ) ) ,
15441550 ) ;
15451551 }
1546-
1552+ const opt = ( typeof options === 'undefined' ) ? { } : options ;
15471553 const payload = {
15481554 document_id : id ,
15491555 before_data_version : beforeVersion ,
15501556 after_data_version : afterVersion ,
1557+ ...opt ,
15511558 } ;
15521559 return this . dispatch (
15531560 CONST . POST ,
0 commit comments