Skip to content

Commit 8d692ab

Browse files
committed
feat(server): query eXist-db version
closes #270
1 parent 501bb77 commit 8d692ab

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

components/database.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ function shutdownDb (client) {
66
return client.promisedMethodCall('shutdown', [])
77
}
88

9+
function version (client) {
10+
return client.promisedMethodCall('getVersion', [])
11+
}
12+
913
module.exports = {
1014
shutdown: shutdownDb,
11-
syncToDisk: syncDbToDisk
15+
syncToDisk: syncDbToDisk,
16+
version
1217
}

readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,15 @@ Returns an array of user info objects (see [getUserInfo()](#getuserinfo)).
575575

576576
Status: working
577577

578+
#### version
579+
580+
Query the eXist-db version running on the server.
581+
Returns the SemVer version as a string (e.g. `5.4.1` or `6.1.0-SNAPSHOT`).
582+
583+
```js
584+
db.server.version()
585+
```
586+
578587
#### syncToDisk
579588

580589
```js

spec/tests/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ test('check for default mime type extensions', function (t) {
1515
t.end()
1616
})
1717

18+
test('raw command', async function (t) {
19+
try {
20+
const db = connect()
21+
const res = await db.client.promisedMethodCall('getVersion', [])
22+
t.ok(res, res)
23+
} catch (e) {
24+
t.fail(e)
25+
}
26+
})
27+
28+
test('get version', async function (t) {
29+
try {
30+
const db = connect()
31+
const res = await db.server.version()
32+
t.ok(res, res)
33+
} catch (e) {
34+
t.fail(e)
35+
}
36+
})
37+
1838
test('extend mime type definitions', function (t) {
1939
const testPath = 'test.bar'
2040
const testExtension = 'bar'

0 commit comments

Comments
 (0)