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

cqrs-saga

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cqrs-saga - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

44

lib/definitions/saga.js

@@ -45,2 +45,6 @@ 'use strict';

});
this.defineShouldHandle(function (evt, saga) {
return true;
});
}

@@ -324,7 +328,17 @@

self.sagaFn.call(sagaThis, self.getPayload(evt), sagaModel, function (err) {
self.shouldHandle(evt, sagaModel, function (err, doHandle) {
if (err) {
return callb(err);
}
callb(null, sagaModel);
if (!doHandle) {
return callb(null, null);
}
self.sagaFn.call(sagaThis, self.getPayload(evt), sagaModel, function (err) {
if (err) {
return callb(err);
}
callb(null, sagaModel);
});
});

@@ -361,3 +375,3 @@ },

* @param {Function} fn The function to be injected.
* @returns {ProcessManagement} to be able to chain...
* @returns {Saga} to be able to chain...
*/

@@ -381,2 +395,26 @@ useAsId: function (fn) {

return this;
},
/**
* Inject shouldHandle function.
* @param {Function} fn The function to be injected.
* @returns {Saga} to be able to chain...
*/
defineShouldHandle: function (fn) {
if (!fn || !_.isFunction(fn)) {
var err = new Error('Please pass a valid function!');
debug(err);
throw err;
}
if (fn.length === 3) {
this.shouldHandle = fn;
return this;
}
this.shouldHandle = function (evt, saga, callback) {
callback(null, fn(evt, saga));
};
return this;
}

@@ -383,0 +421,0 @@

4

package.json
{
"author": "adrai",
"name": "cqrs-saga",
"version": "1.5.0",
"version": "1.6.0",
"private": false,

@@ -14,3 +14,3 @@ "main": "index.js",

"dependencies": {
"async": "1.0.0",
"async": "1.2.1",
"debug": "2.2.0",

@@ -17,0 +17,0 @@ "dotty": "0.0.2",

@@ -450,2 +450,11 @@ # Introduction

//});
//
// optional define a function that checks if an event should be handled
//.defineShouldHandle(function (evt, saga) {
// return true;
//});
// or
//.defineShouldHandle(function (evt, saga, callback) {
// callback(null, true');
//});

@@ -452,0 +461,0 @@

@@ -0,1 +1,4 @@

## [v1.6.0](https://github.com/adrai/node-cqrs-saga/compare/v1.5.0...v1.6.0)
- introduce possibility to define a shouldHandle function
## [v1.5.0](https://github.com/adrai/node-cqrs-saga/compare/v1.4.0...v1.5.0)

@@ -2,0 +5,0 @@ - when using revisionGuard, always save the last event

Sorry, the diff of this file is not supported yet

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