cqrs-swissknife
Advanced tools
Comparing version 0.4.56 to 0.4.57
@@ -13,7 +13,7 @@ 'use strict'; | ||
await handler(event, vm, api); | ||
} | ||
}; | ||
const buildViewModelFunction = (viewModelFunctions) => { | ||
if (!viewModelFunctions.length) | ||
throw new Error(`No view model function specified for event ${eventFullName}`); | ||
throw new Error(`No view model function specified for event!`); | ||
@@ -24,3 +24,3 @@ if (viewModelFunctions.length === 1) | ||
return compositeHandler(viewModelFunctions); | ||
} | ||
}; | ||
@@ -30,3 +30,3 @@ module.exports = ({ eventFullName, reaction, identifier }, { ViewBuilder, PreEventExtender, EventExtender }, customApiBuilder = noop) => { | ||
let viewModelFunctions = []; | ||
const viewModelFunctions = []; | ||
let eventExtenderFunction; | ||
@@ -33,0 +33,0 @@ let preEventExtenderFunction; |
@@ -5,2 +5,9 @@ 'use strict'; | ||
const shouldHandle = (fn) => { | ||
if (!fn || typeof fn !== 'function') | ||
throw new Error('Condition is missing or not a function.'); | ||
return fn.length === 1 ? { shouldHandleEvent: fn } : { shouldHandle: fn }; | ||
}; | ||
const only = { | ||
@@ -13,2 +20,5 @@ ifNotExists() { | ||
}, | ||
if(condition) { | ||
return shouldHandle(condition); | ||
}, | ||
}; | ||
@@ -45,3 +55,2 @@ | ||
module.exports = { | ||
@@ -48,0 +57,0 @@ settings, |
@@ -22,5 +22,3 @@ 'use strict'; | ||
const rulesNormalizer = (context, aggregateName, commandBussinessRules, rules) => { | ||
return [...toFlatArray(rules), ...commandBussinessRules].map((rule, index) => ruleNormalizer(context, aggregateName, index, rule)); | ||
}; | ||
const rulesNormalizer = (context, aggregateName, commandBussinessRules, rules) => [...toFlatArray(rules), ...commandBussinessRules].map((rule, index) => ruleNormalizer(context, aggregateName, index, rule)); | ||
@@ -27,0 +25,0 @@ module.exports = ( |
{ | ||
"name": "cqrs-swissknife", | ||
"version": "0.4.56", | ||
"version": "0.4.57", | ||
"description": "", | ||
@@ -15,5 +15,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"eslint": "^5.4.0", | ||
"eslint": "^5.13.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.14.0" | ||
"eslint-plugin-import": "^2.16.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "author": "eCollect AG.", |
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
33379
879