alice-runtime
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "alice-runtime", | ||
"description": "The alice runtime is under heavy development. Expect many and uncommented breaking changes!", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "test-old": "npx mocha --ui bdd ./test --recursive", |
@@ -6,3 +6,3 @@ const R = require("ramda"); | ||
/** @type {array} */ | ||
const _callLog = []; | ||
let _callLog = []; | ||
@@ -14,3 +14,3 @@ /** | ||
*/ | ||
const addLog = (callType, payload) => { | ||
const add = (callType, payload) => { | ||
_callLog.push({ | ||
@@ -27,3 +27,3 @@ callType, | ||
*/ | ||
const getLogByCallType = callType => { | ||
const getByCallType = callType => { | ||
return R.pipe( | ||
@@ -35,5 +35,13 @@ R.filter(R.propEq("callType", callType)), | ||
/** | ||
* | ||
*/ | ||
const clear = () => { | ||
_callLog = []; | ||
}; | ||
return { | ||
addLog, | ||
getLogByCallType, | ||
add, | ||
getByCallType, | ||
clear, | ||
} | ||
@@ -40,0 +48,0 @@ }; |
@@ -5,9 +5,17 @@ const dc = require("node-dev-console"); | ||
const clearDatabase = async () => { | ||
const clearDatabase = async ({ | ||
createIndexAfterClear = false | ||
} = {}) => { | ||
dc.l("clearDatabase()"); | ||
const collections = await alice.listCollections({"type": "collection"}, {nameOnly: true}).toArray(); | ||
return Promise.all( | ||
await Promise.all( | ||
collections | ||
.map(({name: collectionName}) => alice.getCollection(collectionName).drop()) | ||
); | ||
if(createIndexAfterClear) { | ||
await alice.checkIndexes(); | ||
} | ||
return true; | ||
}; | ||
@@ -14,0 +22,0 @@ |
@@ -15,27 +15,29 @@ const R = require("ramda"); | ||
/** @return {Array} */ | ||
storeDataEvent: () => _log.getLogByCallType("storeDataEvent"), | ||
storeDataEvent: () => _log.getByCallType("storeDataEvent"), | ||
/** @return {Array} */ | ||
storeDataEventOnPayloadChange: () => _log.getLogByCallType("storeDataEventOnPayloadChange"), | ||
storeDataEventOnPayloadChange: () => _log.getByCallType("storeDataEventOnPayloadChange"), | ||
/** @return {Array} */ | ||
emitCommand: () => _log.getLogByCallType("emitCommand"), | ||
emitCommand: () => _log.getByCallType("emitCommand"), | ||
/** @return {Array} */ | ||
emitMultiCommand: () => _log.getLogByCallType("emitMultiCommand"), | ||
emitMultiCommand: () => _log.getByCallType("emitMultiCommand"), | ||
/** @return {Array} */ | ||
getDataEventStream: () => _log.getLogByCallType("getDataEventStream"), | ||
getDataEventStream: () => _log.getByCallType("getDataEventStream"), | ||
/** @return {Array} */ | ||
getLastDataEvent: () => _log.getLogByCallType("getLastDataEvent"), | ||
getLastDataEvent: () => _log.getByCallType("getLastDataEvent"), | ||
/** @return {Array} */ | ||
getCollectionView: () => _log.getLogByCallType("getCollectionView"), | ||
getCollectionView: () => _log.getByCallType("getCollectionView"), | ||
/** @return {Array} */ | ||
getCollectionPrivate: () => _log.getLogByCallType("getCollectionPrivate"), | ||
getCollectionPrivate: () => _log.getByCallType("getCollectionPrivate"), | ||
/** @return {Array} */ | ||
queryDataIndex: () => _log.getLogByCallType("queryDataIndex"), | ||
queryDataIndex: () => _log.getByCallType("queryDataIndex"), | ||
clear: _log.clear, | ||
}; | ||
@@ -45,3 +47,3 @@ | ||
storeDataEvent: input => { | ||
_log.addLog("storeDataEvent", input); | ||
_log.add("storeDataEvent", input); | ||
return alice.storeDataEvent(input); | ||
@@ -53,3 +55,3 @@ }, | ||
storeDataEventOnPayloadChange: input => { | ||
_log.addLog("storeDataEventOnPayloadChange", input); | ||
_log.add("storeDataEventOnPayloadChange", input); | ||
return alice.storeDataEventOnPayloadChange(input); | ||
@@ -61,3 +63,3 @@ }, | ||
emitCommand: input => { | ||
_log.addLog("emitCommand", input); | ||
_log.add("emitCommand", input); | ||
return alice.emitCommand(input); | ||
@@ -69,3 +71,3 @@ }, | ||
emitMultiCommand: input => { | ||
_log.addLog("emitMultiCommand", input); | ||
_log.add("emitMultiCommand", input); | ||
return alice.emitMultiCommand(input); | ||
@@ -77,3 +79,3 @@ }, | ||
getDataEventStream: input => { | ||
_log.addLog("getDataEventStream", input); | ||
_log.add("getDataEventStream", input); | ||
return alice.getDataEventStream(input); | ||
@@ -83,3 +85,3 @@ }, | ||
getLastDataEvent: input => { | ||
_log.addLog("getLastDataEvent", input); | ||
_log.add("getLastDataEvent", input); | ||
return alice.getLastDataEvent(input); | ||
@@ -91,3 +93,3 @@ }, | ||
getCollectionView: (name) => { | ||
_log.addLog("getCollectionView", name); | ||
_log.add("getCollectionView", name); | ||
return alice.getCollectionView(name); | ||
@@ -97,3 +99,3 @@ }, | ||
getCollectionPrivate: (name) => { | ||
_log.addLog("getCollectionPrivate", name); | ||
_log.add("getCollectionPrivate", name); | ||
return alice.getCollectionCommandPrivate(command, name); | ||
@@ -103,3 +105,3 @@ }, | ||
queryDataIndex: (query, options) => { | ||
_log.addLog("queryDataIndex", {query, options}); | ||
_log.add("queryDataIndex", {query, options}); | ||
return alice.queryDataIndex(query, options); | ||
@@ -106,0 +108,0 @@ }, |
@@ -11,10 +11,12 @@ const dc = require("node-dev-console"); | ||
/** @return {Array} */ | ||
emitCommand: () => _log.getLogByCallType("emitCommand"), | ||
emitCommand: () => _log.getByCallType("emitCommand"), | ||
/** @return {Array} */ | ||
emitMultiCommand: () => _log.getLogByCallType("emitMultiCommand"), | ||
emitMultiCommand: () => _log.getByCallType("emitMultiCommand"), | ||
clear: _log.clear, | ||
}; | ||
const emitCommand = async input => { | ||
_log.addLog("emitCommand", input); | ||
_log.add("emitCommand", input); | ||
return alice.emitCommand(input); | ||
@@ -24,3 +26,3 @@ }; | ||
const emitMultiCommand = async input => { | ||
_log.addLog("emitMultiCommand", input); | ||
_log.add("emitMultiCommand", input); | ||
return alice.emitMultiCommand(input); | ||
@@ -27,0 +29,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145924
3567