Skip to content

Commit

Permalink
Merge pull request #280 from terminusdb/add_baseServer
Browse files Browse the repository at this point in the history
add pagination to getVersionDiff
  • Loading branch information
KittyJose authored May 3, 2023
2 parents 2b5f435 + 681dd56 commit f2f756e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Fix getCommitsLog in WOQLClient

## New 🚀
* add pagination to getVersionDiff
* add getDocumentHistory in WOQLClient class
* add baseServer property to ConnectionConfig class

Expand Down
11 changes: 11 additions & 0 deletions docs/api/typedef.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,14 @@ the manage capability command type
| [updated] | <code>boolean</code> | Last updated time (excludes history) false is the default |
| [created] | <code>boolean</code> | Created date of object (excludes history) false is the default |


## DiffObject
##### DiffObject: ` Object`
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| [Object] | <code>keep</code> | Index to start from, 0 is the default |
| [number] | <code>start</code> | Amount of commits to show, 10 is the default |
| [number] | <code>count</code> | Last updated time (excludes history) false is the default |

4 changes: 2 additions & 2 deletions docs/api/woqlclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ Get the patch of difference between branches or commits.
| beforeVersion | <code>string</code> | Before branch/commit to compare |
| afterVersion | <code>string</code> | After branch/commit to compare |
| [id] | <code>string</code> | The document id to be diffed, if it is omitted all the documents will be compared |
| [options] | <code>object</code> | {keep:{}} Options to send to the diff endpoint. The diff api outputs the changes between the input (branches or commits), in options you can list the properties that you would like to see in the diff result in any case. |
| [options] | <code>typedef.DiffObject</code> | {keep:{},count:10,start:0} Options to send to the diff endpoint. The diff api outputs the changes between the input (branches or commits), in options you can list the properties that you would like to see in the diff result in any case. |
**Example**
```javascript
Expand All @@ -1360,7 +1360,7 @@ client.getVersionDiff("main", afterCommit, "Person/Tom" ).then(diffResult=>{
})

//This is to view the changes between two branches with the keep options
const options = {"keep":{"@id":true, "name": true}}
const options = {"keep":{"@id":true, "name": true}, start:0, count:10}
client.getVersionDiff("main","mybranch",options).then(diffResult=>{
console.log(diffResult)
})
Expand Down
7 changes: 7 additions & 0 deletions lib/typedef.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,11 @@ const { ACTIONS } = Utils.ACTIONS;
* @property {boolean} [created] - Created date of object (excludes history) false is the default
*/

/**
* @typedef {Object} DiffObject
* @property {keep} [Object] - Index to start from, 0 is the default
* @property {start} [number] - Amount of commits to show, 10 is the default
* @property {count} [number] - Last updated time (excludes history) false is the default
*/

module.exports = {};
7 changes: 4 additions & 3 deletions lib/woqlClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ WOQLClient.prototype.updateDocument = function (json, params, dbId, message = 'u
const docParams = params || {};
docParams.author = this.author();
docParams.message = message;
if (docParams.create) {
if (create) {
docParams.create = create;
}
if (dbId) {
Expand Down Expand Up @@ -1750,7 +1750,8 @@ WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, i
* @param {string} afterVersion - After branch/commit to compare
* @param {string} [id] - The document id to be diffed,
* if it is omitted all the documents will be compared
* @param {object} [options] - {keep:{}} Options to send to the diff endpoint.
* @param {typedef.DiffObject} [options] - {keep:{},count:10,start:0}
* Options to send to the diff endpoint.
* The diff api outputs the changes between the input (branches or commits),
* in options you can list the properties that you would like to see in the diff result in any case.
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
Expand All @@ -1774,7 +1775,7 @@ WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, i
* })
*
* //This is to view the changes between two branches with the keep options
* const options = {"keep":{"@id":true, "name": true}}
* const options = {"keep":{"@id":true, "name": true}, start:0, count:10}
* client.getVersionDiff("main","mybranch",options).then(diffResult=>{
* console.log(diffResult)
* })
Expand Down

0 comments on commit f2f756e

Please sign in to comment.