From 01755a08b1cac66ef4b155bd4329180ff62a9670 Mon Sep 17 00:00:00 2001 From: phillmac Date: Thu, 9 May 2019 13:52:28 +1000 Subject: [PATCH] Add capabilities to db_info --- src/lib/db-manager.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/db-manager.js b/src/lib/db-manager.js index 934a442..f970ee8 100644 --- a/src/lib/db-manager.js +++ b/src/lib/db-manager.js @@ -67,7 +67,21 @@ class DBManager { replicate: db.options.replicate, }, type: db.type, - uid: db.uid + uid: db.uid, + capabilities: Object.keys( //TODO: cleanup this mess once tc39 object.fromEntries aproved + Object.assign ({}, ... // https://tc39.github.io/proposal-object-from-entries + Object.entries({ + add: typeof db.add == 'function', + get: typeof db.get == 'function', + inc: typeof db.inc == 'function', + iterator: typeof db.iterator == 'function', + put: typeof db.put == 'function', + query: typeof db.query == 'function', + remove: typeof (db.del || db.remove) == 'function', + value: typeof db.value == 'function' + }).filter(([k,v]) => v).map(([k,v]) => ({[k]:v})) + ) + ) }; }; }