Skip to content

Commit

Permalink
feat(server): query eXist-db version
Browse files Browse the repository at this point in the history
closes #270
  • Loading branch information
line-o committed Oct 27, 2022
1 parent 501bb77 commit 8d692ab
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ function shutdownDb (client) {
return client.promisedMethodCall('shutdown', [])
}

function version (client) {
return client.promisedMethodCall('getVersion', [])
}

module.exports = {
shutdown: shutdownDb,
syncToDisk: syncDbToDisk
syncToDisk: syncDbToDisk,
version
}
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,15 @@ Returns an array of user info objects (see [getUserInfo()](#getuserinfo)).
Status: working
#### version
Query the eXist-db version running on the server.
Returns the SemVer version as a string (e.g. `5.4.1` or `6.1.0-SNAPSHOT`).
```js
db.server.version()
```
#### syncToDisk
```js
Expand Down
20 changes: 20 additions & 0 deletions spec/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ test('check for default mime type extensions', function (t) {
t.end()
})

test('raw command', async function (t) {
try {
const db = connect()
const res = await db.client.promisedMethodCall('getVersion', [])
t.ok(res, res)
} catch (e) {
t.fail(e)
}
})

test('get version', async function (t) {
try {
const db = connect()
const res = await db.server.version()
t.ok(res, res)
} catch (e) {
t.fail(e)
}
})

test('extend mime type definitions', function (t) {
const testPath = 'test.bar'
const testExtension = 'bar'
Expand Down

0 comments on commit 8d692ab

Please sign in to comment.