Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cqrs-swissknife

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cqrs-swissknife - npm Package Compare versions

Comparing version 0.4.44 to 0.4.45

17

domain/builders/aggregateBuilder.js
'use strict';
const dotty = require('dotty');
const { asyncParamApiCallback, noop, toFlatArray } = require('../../utils');

@@ -14,3 +16,3 @@

preConditions,
businessRules,
commandBusinessRules,
validator,

@@ -26,7 +28,10 @@ command,

return businessRules.map(f => (current, previous, events, cmd) => {
if (dotty.get(cmd, command.definitions.command.name) === command.name)
return f(current, previous, events, cmd)
return;
});
return commandBusinessRules.map((f,i) => ({
name: `${aggregate.context}:${aggregate.name}:businessRule:${command.name}:${0}`,
rule(current, previous, events, cmd) {
if (dotty.get(cmd, command.definitions.command.name) === command.name)
return f(current, previous, events, cmd)
return;
},
}));
};

@@ -33,0 +38,0 @@

'use strict';
const dotty = require('dotty');
const { nextify, asyncParamCustomErrorApiCallback, toFlatArray } = require('../../utils');

@@ -103,7 +101,4 @@

if (item.businessRule) {
if (typeof item.businessRule !== 'function')
throw new Error('Invalid command businnes rule. Should be a function');
result.businessRules.push(item.businessRule);
}
if (item.commandBusinessRule)
result.commandBusinessRules.push(item.commandBusinessRule);

@@ -110,0 +105,0 @@ }

@@ -20,3 +20,9 @@ 'use strict';

const commandBusinessRule = (rule) => {
if (!rule || typeof rule !== 'function')
throw new Error('Rule missing or not a function.');
return { commandBusinessRule: condition };
};
const only = {

@@ -39,2 +45,5 @@ ifExists: sharedOnly.ifExists,

},
after(rule) { // businessRule
return commandBusinessRule(rule)
}
};

@@ -41,0 +50,0 @@

{
"name": "cqrs-swissknife",
"version": "0.4.44",
"version": "0.4.45",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc