cqrs-domain
Advanced tools
Comparing version 2.12.3 to 2.13.0
@@ -17,2 +17,4 @@ var Definition = require('../definitionBase'), | ||
this.externallyLoaded = meta.externallyLoaded || false; | ||
this.aggregates = []; | ||
@@ -19,0 +21,0 @@ } |
@@ -16,3 +16,3 @@ var util = require('util'), | ||
return undefined; | ||
}//, | ||
} | ||
// heartbeat: 60 * 1000 | ||
@@ -19,0 +19,0 @@ }; |
@@ -277,2 +277,10 @@ var debug = require('debug')('domain:structureLoader'), | ||
function reorderExternallyLoadedContexts (obj, ordered) { | ||
obj.contexts.forEach(function (ctxItem) { | ||
if (!ctxItem.value.externallyLoaded) | ||
return; | ||
ordered[ctxItem.name] = ctxItem.value; | ||
}); | ||
} | ||
function reorderAggregates (obj, ordered) { | ||
@@ -283,2 +291,5 @@ var generalContext = new Context({ name: '_general' }); | ||
var foundCtx = _.find(obj.contexts, function (ctx) { | ||
if (ctx.value.externallyLoaded) { | ||
return false; | ||
} | ||
if (aggItem.dottiedBase.indexOf('.') >= 0) { | ||
@@ -293,2 +304,5 @@ return aggItem.dottiedBase.indexOf(ctx.dottiedBase + '.') === 0; | ||
foundCtx = _.find(obj.contexts, function (ctx) { | ||
if (ctx.value.externallyLoaded) { | ||
return false; | ||
} | ||
return ctx.dottiedBase === ''; | ||
@@ -295,0 +309,0 @@ }); |
{ | ||
"author": "adrai", | ||
"name": "cqrs-domain", | ||
"version": "2.12.3", | ||
"version": "2.13.0", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -656,3 +656,15 @@ | ||
### Externally loaded context ( self-loaded ) | ||
A special option to define a context with all its aggregates, commands, events and rules exists by adding the externallyLoaded option to the context : | ||
module.exports = require('cqrs-domain').defineContext({ | ||
// optional, default is the directory name | ||
name: 'hr', | ||
externallyLoaded: true | ||
}); | ||
When doing so the context will be added 'as-is' to the domain, this means it won't go trough the normal tree loading and parsing process. | ||
This option is aimed mainly at plugin developers, as it leaves the responsibility of structuring the domain right in the hand of the one defining the context ( most-probably a plug-in ). | ||
## Aggregate | ||
@@ -659,0 +671,0 @@ |
@@ -0,1 +1,4 @@ | ||
## [v2.13.0](https://github.com/adrai/node-cqrs-domain/compare/v2.12.3...v2.13.0) | ||
- Introduce externallyLoaded option to context, and load those separately [#121](https://github.com/adrai/node-cqrs-domain/pull/121) thanks to [nanov](https://github.com/nanov) | ||
## [v2.12.3](https://github.com/adrai/node-cqrs-domain/compare/v2.12.2...v2.12.3) | ||
@@ -2,0 +5,0 @@ - update eventstore |
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
282015
6555
1255