cqrs-eventdenormalizer
Advanced tools
Comparing version 1.1.10 to 1.1.11
@@ -267,5 +267,6 @@ 'use strict'; | ||
var vm = new viewmodel.ViewModel({ id: id }, this.repository); | ||
for (var prop in this.modelInitValues) { | ||
var clonedInitValues = _.cloneDeep(this.modelInitValues); | ||
for (var prop in clonedInitValues) { | ||
if (!vm.has(prop)) { | ||
vm.set(prop, this.modelInitValues[prop]); | ||
vm.set(prop, clonedInitValues[prop]); | ||
} | ||
@@ -292,5 +293,6 @@ } | ||
for (var prop in self.modelInitValues) { | ||
var clonedInitValues = _.cloneDeep(self.modelInitValues); | ||
for (var prop in clonedInitValues) { | ||
if (!vm.has(prop)) { | ||
vm.set(prop, self.modelInitValues[prop]); | ||
vm.set(prop, clonedInitValues[prop]); | ||
} | ||
@@ -344,5 +346,6 @@ } | ||
vms.forEach(function (vm) { | ||
for (var prop in self.modelInitValues) { | ||
var clonedInitValues = _.cloneDeep(self.modelInitValues); | ||
for (var prop in clonedInitValues) { | ||
if (!vm.has(prop)) { | ||
vm.set(prop, self.modelInitValues[prop]); | ||
vm.set(prop, clonedInitValues[prop]); | ||
} | ||
@@ -365,3 +368,3 @@ } | ||
}); | ||
return callback(null, mergedVms); | ||
@@ -368,0 +371,0 @@ } |
@@ -96,7 +96,7 @@ 'use strict'; | ||
}); | ||
this.onEventMissing(function (info, evt) { | ||
debug('missing events: ', info, evt); | ||
}); | ||
this.defaultEventExtension(function (evt) { | ||
@@ -317,3 +317,3 @@ return evt; | ||
debug('inject all needed dependencies...'); | ||
self.revisionGuard = new RevisionGuard(self.revisionGuardStore, self.options.revisionGuard); | ||
@@ -330,3 +330,3 @@ self.revisionGuard.onEventMissing(function (info, evt) { | ||
.useRepository(self.repository); | ||
self.revisionGuard.defineEvent(self.definitions.event); | ||
@@ -354,5 +354,5 @@ | ||
var self = this; | ||
var extendedEvent = evt; | ||
this.extendEventHandle(evt, function (err, extEvt) { | ||
@@ -459,3 +459,3 @@ if (err) { | ||
var self = this; | ||
this.eventDispatcher.dispatch(evt, function (errs, notifications) { | ||
@@ -543,3 +543,3 @@ | ||
var self = this; | ||
if (this.isCommandRejected(evt, callback)) { | ||
@@ -554,3 +554,3 @@ return; | ||
} | ||
if (!workWithRevisionGuard) { | ||
@@ -568,3 +568,3 @@ return this.dispatch(evt, callback); | ||
} | ||
self.dispatch(evt, function (errs, extendedEvt, notifications) { | ||
@@ -614,6 +614,15 @@ if (errs) { | ||
this.replayHandler.replayStreamed(fn); | ||
}, | ||
/** | ||
* Clears all collections and the revisionGuardStore. | ||
* @param {Function} callback The function, that will be called when this action is completed. | ||
* `function(err){}` | ||
*/ | ||
clear: function (callback) { | ||
this.replayHandler.clear(callback); | ||
} | ||
}); | ||
module.exports = Denormalizer; |
@@ -46,2 +46,21 @@ 'use strict'; | ||
/** | ||
* Clears all collections and the revisionGuardStore. | ||
* @param {Function} callback The function, that will be called when this action is completed. | ||
* `function(err){}` | ||
*/ | ||
clear: function (callback) { | ||
var self = this; | ||
async.parallel([ | ||
function (callback) { | ||
async.each(self.dispatcher.tree.getCollections(), function (col, callback) { | ||
col.repository.clear(callback); | ||
}, callback); | ||
}, | ||
function (callback) { | ||
self.store.clear(callback); | ||
} | ||
], callback); | ||
}, | ||
/** | ||
* Updates the revision in the store. | ||
@@ -96,4 +115,2 @@ * @param {Object} revisionMap The revision map. | ||
var isHandling = {}; | ||
var revisionMap = {}; | ||
@@ -100,0 +117,0 @@ var collections = {}; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
module.exports = function (tree) { | ||
if (!tree || _.isEmpty(tree)) { | ||
@@ -20,3 +20,3 @@ debug('no tree injected'); | ||
} | ||
var res = []; | ||
@@ -30,6 +30,15 @@ | ||
}); | ||
return res; | ||
}, | ||
getCollections: function () { | ||
if (!tree || _.isEmpty(tree)) { | ||
debug('no tree injected'); | ||
return null; | ||
} | ||
return tree.collections; | ||
}, | ||
getEventExtender: function (query) { | ||
@@ -40,5 +49,5 @@ if (!tree || _.isEmpty(tree)) { | ||
} | ||
var evtExt; | ||
for (var i = 0, len = tree.collections.length; i < len; i++) { | ||
@@ -96,3 +105,3 @@ var col = tree.collections[i]; | ||
col.defineOptions(options); | ||
col.getViewBuilders().forEach(function (vB) { | ||
@@ -99,0 +108,0 @@ vB.defineOptions(options); |
{ | ||
"author": "adrai", | ||
"name": "cqrs-eventdenormalizer", | ||
"version": "1.1.10", | ||
"version": "1.1.11", | ||
"private": false, | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"tolerance": "1.0.0", | ||
"viewmodel": "1.2.4" | ||
"viewmodel": "1.2.6" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
@@ -0,1 +1,5 @@ | ||
## [v1.1.11](https://github.com/adrai/node-cqrs-eventdenormalizer/compare/v1.1.10...v1.1.11) | ||
- fix deepClone issue in collection | ||
- added clear function to be used for rebuilding the readmodel | ||
## [v1.1.10](https://github.com/adrai/node-cqrs-eventdenormalizer/compare/v1.1.9...v1.1.10) | ||
@@ -2,0 +6,0 @@ - update viewmodel dependency |
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
188833
3129
+ Addedsift@0.2.3(transitive)
+ Addedviewmodel@1.2.6(transitive)
- Removedviewmodel@1.2.4(transitive)
Updatedviewmodel@1.2.6