Comparing version 1.1.3 to 1.2.0
@@ -286,2 +286,16 @@ 'use strict'; | ||
/** | ||
* Returns the saga information. | ||
* @returns {Object} | ||
*/ | ||
getInfo: function () { | ||
if (!this.sagas) { | ||
var err = new Error('Not initialized!'); | ||
debug(err); | ||
throw err; | ||
} | ||
return this.sagas.getInfo(); | ||
}, | ||
/** | ||
* Call this function to forward it to the dispatcher. | ||
@@ -288,0 +302,0 @@ * @param {Object} evt The event object |
@@ -14,2 +14,24 @@ 'use strict'; | ||
getInfo: function () { | ||
if (!sagas || _.isEmpty(sagas)) { | ||
debug('no sagas injected'); | ||
return null; | ||
} | ||
var info = { | ||
sagas: [] | ||
}; | ||
sagas.forEach(function (s) { | ||
info.sagas.push({ | ||
name: s.name, | ||
aggregate: s.aggregate, | ||
context: s.context, | ||
version: s.version | ||
}); | ||
}); | ||
return info; | ||
}, | ||
getSagas: function (query) { | ||
@@ -20,3 +42,3 @@ if (!sagas || _.isEmpty(sagas)) { | ||
} | ||
var res = _.filter(sagas, function (s) { | ||
@@ -27,6 +49,6 @@ var isNameEqual = s.name === query.name; | ||
var isContextEqual = s.context === query.context; | ||
return isNameEqual && isVersionEqual && isAggregateEqual && isContextEqual; | ||
}); | ||
return res; | ||
@@ -40,7 +62,7 @@ }, | ||
} | ||
sagas.forEach(function (s) { | ||
s.defineOptions(options); | ||
}); | ||
return this; | ||
@@ -58,3 +80,3 @@ }, | ||
}); | ||
return this; | ||
@@ -61,0 +83,0 @@ }, |
{ | ||
"author": "adrai", | ||
"name": "cqrs-saga", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -291,2 +291,40 @@ # Introduction | ||
## Request saga information | ||
After the initialization you can request the saga information: | ||
pm.init(function (err) { | ||
pm.getInfo(); | ||
// ==> | ||
// { | ||
// "sagas": [ | ||
// { | ||
// "name": "orderConfirmed", | ||
// "aggregate": "order", | ||
// "context": "sale", | ||
// "version": 0 | ||
// }, | ||
// { | ||
// "name": "orderCreated", | ||
// "aggregate": "order", | ||
// "context": "sale", | ||
// "version": 0 | ||
// }, | ||
// { | ||
// "name": "paymentAccepted", | ||
// "aggregate": "payment", | ||
// "context": "sale", | ||
// "version": 2 | ||
// }, | ||
// { | ||
// "name": "seatsReserved", | ||
// "aggregate": "reservation", | ||
// "context": "sale", | ||
// "version": 0 | ||
// } | ||
// ] | ||
// } | ||
}); | ||
# Components definition | ||
@@ -470,3 +508,3 @@ | ||
Copyright (c) 2014 Adriano Raiano | ||
Copyright (c) 2015 Adriano Raiano | ||
@@ -473,0 +511,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
@@ -0,1 +1,4 @@ | ||
## [v1.2.0](https://github.com/adrai/node-cqrs-saga/compare/v1.1.3...v1.2.0) | ||
- added getInfo function | ||
## [v1.1.3](https://github.com/adrai/node-cqrs-saga/compare/v1.1.2...v1.1.3) | ||
@@ -2,0 +5,0 @@ - added commitstamp to getUndispatchedcommands |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3947
526
195332