Skip to content

Commit 19cb281

Browse files
Merge pull request #278 from terminusdb/history
fix WOQLClient.getCommitsLog with selected branch
2 parents 69a07f1 + 5676db6 commit 19cb281

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

docs/api/woqlclient.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,30 @@ If you would like to change branch or commit before apply use client.checkout("b
13831383
**Example**
13841384
```javascript
13851385
client.checkout("mybranch")
1386-
client.apply("main","mybranch","merge main").then(result=>{
1386+
client.apply("mybranch","mybranch_new","merge main").then(result=>{
1387+
console.log(result)
1388+
})
1389+
```
1390+
1391+
## docHistory
1392+
##### woqlClient.docHistory(id, [historyParams])
1393+
Get the document's history for a specific database or branch
1394+
1395+
1396+
| Param | Type | Description |
1397+
| --- | --- | --- |
1398+
| id | <code>string</code> | id of document to report history of |
1399+
| [historyParams] | <code>typedef.DocHistoryParams</code> | |
1400+
1401+
**Example**
1402+
```javascript
1403+
//this will return the last 5 commits for the Person/Anna document
1404+
client.checkout("mybranch")
1405+
client.docHistory("Person/Anna",{start:0,count:5}).then(result=>{
1406+
console.log(result)
1407+
})
1408+
//this will return the last and the first commit for the Person/Anna document
1409+
client.docHistory("Person/Anna",{updated:true,created:true}).then(result=>{
13871410
console.log(result)
13881411
})
13891412
```

lib/connectionConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ ConnectionConfig.prototype.queryURL = function () {
473473
* @returns {string}
474474
*/
475475
ConnectionConfig.prototype.log = function () {
476-
return this.dbBase('log');
476+
return this.branchBase('log');
477477
};
478478

479479
/**

lib/woqlClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ WOQLClient.prototype.getVersionDiff = function (beforeVersion, afterVersion, id,
18151815
* @param {object} [options] - {keep:{}} Options to send to the apply endpoint
18161816
* @example
18171817
* client.checkout("mybranch")
1818-
* client.apply("main","mybranch","merge main").then(result=>{
1818+
* client.apply("mybranch","mybranch_new","merge main").then(result=>{
18191819
* console.log(result)
18201820
* })
18211821
*/

test/connectionConfing.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ describe('connectionConfig tests', () => {
290290

291291
it('check cloud commits log url', function() {
292292
const tmpClient = new ConnectionConfig("http://127.0.0.1:6363/myteam/",{organization:'myteam',db:'mydb'})
293-
expect(tmpClient.log()).to.equal('http://127.0.0.1:6363/myteam/api/log/myteam/mydb')
293+
expect(tmpClient.log()).to.equal('http://127.0.0.1:6363/myteam/api/log/myteam/mydb/local/branch/main')
294294

295295
})
296296

0 commit comments

Comments
 (0)