Skip to content

Commit f2f756e

Browse files
authored
Merge pull request #280 from terminusdb/add_baseServer
add pagination to getVersionDiff
2 parents 2b5f435 + 681dd56 commit f2f756e

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

RELEASE_NOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Fix getCommitsLog in WOQLClient
44

55
## New 🚀
6+
* add pagination to getVersionDiff
67
* add getDocumentHistory in WOQLClient class
78
* add baseServer property to ConnectionConfig class
89

docs/api/typedef.md

+11
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,14 @@ the manage capability command type
212212
| [updated] | <code>boolean</code> | Last updated time (excludes history) false is the default |
213213
| [created] | <code>boolean</code> | Created date of object (excludes history) false is the default |
214214

215+
216+
## DiffObject
217+
##### DiffObject: ` Object`
218+
**Properties**
219+
220+
| Name | Type | Description |
221+
| --- | --- | --- |
222+
| [Object] | <code>keep</code> | Index to start from, 0 is the default |
223+
| [number] | <code>start</code> | Amount of commits to show, 10 is the default |
224+
| [number] | <code>count</code> | Last updated time (excludes history) false is the default |
225+

docs/api/woqlclient.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ Get the patch of difference between branches or commits.
13371337
| beforeVersion | <code>string</code> | Before branch/commit to compare |
13381338
| afterVersion | <code>string</code> | After branch/commit to compare |
13391339
| [id] | <code>string</code> | The document id to be diffed, if it is omitted all the documents will be compared |
1340-
| [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. |
1340+
| [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. |
13411341
13421342
**Example**
13431343
```javascript
@@ -1360,7 +1360,7 @@ client.getVersionDiff("main", afterCommit, "Person/Tom" ).then(diffResult=>{
13601360
})
13611361

13621362
//This is to view the changes between two branches with the keep options
1363-
const options = {"keep":{"@id":true, "name": true}}
1363+
const options = {"keep":{"@id":true, "name": true}, start:0, count:10}
13641364
client.getVersionDiff("main","mybranch",options).then(diffResult=>{
13651365
console.log(diffResult)
13661366
})

lib/typedef.js

+7
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,11 @@ const { ACTIONS } = Utils.ACTIONS;
177177
* @property {boolean} [created] - Created date of object (excludes history) false is the default
178178
*/
179179

180+
/**
181+
* @typedef {Object} DiffObject
182+
* @property {keep} [Object] - Index to start from, 0 is the default
183+
* @property {start} [number] - Amount of commits to show, 10 is the default
184+
* @property {count} [number] - Last updated time (excludes history) false is the default
185+
*/
186+
180187
module.exports = {};

lib/woqlClient.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ WOQLClient.prototype.updateDocument = function (json, params, dbId, message = 'u
13241324
const docParams = params || {};
13251325
docParams.author = this.author();
13261326
docParams.message = message;
1327-
if (docParams.create) {
1327+
if (create) {
13281328
docParams.create = create;
13291329
}
13301330
if (dbId) {
@@ -1750,7 +1750,8 @@ WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, i
17501750
* @param {string} afterVersion - After branch/commit to compare
17511751
* @param {string} [id] - The document id to be diffed,
17521752
* if it is omitted all the documents will be compared
1753-
* @param {object} [options] - {keep:{}} Options to send to the diff endpoint.
1753+
* @param {typedef.DiffObject} [options] - {keep:{},count:10,start:0}
1754+
* Options to send to the diff endpoint.
17541755
* The diff api outputs the changes between the input (branches or commits),
17551756
* in options you can list the properties that you would like to see in the diff result in any case.
17561757
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
@@ -1774,7 +1775,7 @@ WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, i
17741775
* })
17751776
*
17761777
* //This is to view the changes between two branches with the keep options
1777-
* const options = {"keep":{"@id":true, "name": true}}
1778+
* const options = {"keep":{"@id":true, "name": true}, start:0, count:10}
17781779
* client.getVersionDiff("main","mybranch",options).then(diffResult=>{
17791780
* console.log(diffResult)
17801781
* })

0 commit comments

Comments
 (0)