Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 8f3acea

Browse files
authored
Merge pull request #11 from phillmac/feat/capabilities
Add capabilities to db_info: POST /db, GET /db/:dbname
2 parents 5365464 + 01755a0 commit 8f3acea

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/lib/db-manager.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,21 @@ class DBManager {
6767
replicate: db.options.replicate,
6868
},
6969
type: db.type,
70-
uid: db.uid
70+
uid: db.uid,
71+
capabilities: Object.keys( //TODO: cleanup this mess once tc39 object.fromEntries aproved
72+
Object.assign ({}, ... // https://tc39.github.io/proposal-object-from-entries
73+
Object.entries({
74+
add: typeof db.add == 'function',
75+
get: typeof db.get == 'function',
76+
inc: typeof db.inc == 'function',
77+
iterator: typeof db.iterator == 'function',
78+
put: typeof db.put == 'function',
79+
query: typeof db.query == 'function',
80+
remove: typeof (db.del || db.remove) == 'function',
81+
value: typeof db.value == 'function'
82+
}).filter(([k,v]) => v).map(([k,v]) => ({[k]:v}))
83+
)
84+
)
7185
};
7286
};
7387
}

0 commit comments

Comments
 (0)