Comparing version 0.0.12 to 0.0.13
@@ -1,2 +0,2 @@ | ||
var AggregateEntity, AggregateEntityCollection, AggregateRoot, MixinSetGet, MixinSnapshot, eventric, _, | ||
var AggregateEntity, AggregateEntityCollection, AggregateRoot, DomainEvent, MixinSetGet, MixinSnapshot, eventric, _, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -17,2 +17,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
DomainEvent = eventric('DomainEvent'); | ||
AggregateRoot = (function(_super) { | ||
@@ -29,3 +31,3 @@ __extends(AggregateRoot, _super); | ||
AggregateRoot.prototype.generateDomainEvent = function(eventName, params) { | ||
var changes, event; | ||
var changes, domainEvent, eventParams; | ||
if (params == null) { | ||
@@ -37,5 +39,4 @@ params = {}; | ||
} | ||
event = { | ||
eventParams = { | ||
name: eventName, | ||
timestamp: new Date().getTime(), | ||
aggregate: this.getMetaData() | ||
@@ -46,6 +47,7 @@ }; | ||
if (Object.keys(changes).length > 0) { | ||
event.aggregate.changed = changes; | ||
eventParams.aggregate.changed = changes; | ||
} | ||
} | ||
return this._domainEvents.push(event); | ||
domainEvent = new DomainEvent(eventParams); | ||
return this._domainEvents.push(domainEvent); | ||
}; | ||
@@ -52,0 +54,0 @@ |
@@ -22,10 +22,14 @@ var DomainEventService, MixinEvents, async, eventric, _; | ||
return _this._eventStore.save(domainEvent, function(err) { | ||
var aggregateId, aggregateName, eventName; | ||
if (err) { | ||
return next(err); | ||
} | ||
eventName = domainEvent.getName(); | ||
aggregateId = domainEvent.getAggregateId(); | ||
aggregateName = domainEvent.getAggregateName(); | ||
_this.trigger('DomainEvent', domainEvent); | ||
_this.trigger(domainEvent.aggregate.name, domainEvent); | ||
_this.trigger("" + domainEvent.aggregate.name + ":" + domainEvent.name, domainEvent); | ||
_this.trigger("" + domainEvent.aggregate.name + "/" + domainEvent.aggregate.id, domainEvent); | ||
_this.trigger("" + domainEvent.aggregate.name + ":" + domainEvent.name + "/" + domainEvent.aggregate.id, domainEvent); | ||
_this.trigger(aggregateName, domainEvent); | ||
_this.trigger("" + aggregateName + ":" + eventName, domainEvent); | ||
_this.trigger("" + aggregateName + "/" + aggregateId, domainEvent); | ||
_this.trigger("" + aggregateName + ":" + eventName + "/" + aggregateId, domainEvent); | ||
return next(null); | ||
@@ -32,0 +36,0 @@ }); |
@@ -26,3 +26,4 @@ var moduleDefinition; | ||
BoundedContext: './bounded_context', | ||
BoundedContextService: './bounded_context_service' | ||
BoundedContextService: './bounded_context_service', | ||
DomainEvent: './domain_event' | ||
}; | ||
@@ -29,0 +30,0 @@ |
@@ -19,3 +19,3 @@ { | ||
"author": "eFa Team <team@efa-gmbh.com>", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"repository": { | ||
@@ -27,4 +27,4 @@ "type": "git", | ||
"scripts": { | ||
"test": "node_modules/.bin/coffeegulp spec", | ||
"prepublish": "node_modules/.bin/coffeegulp build" | ||
"test": "node_modules/.bin/gulp spec", | ||
"prepublish": "node_modules/.bin/gulp build" | ||
}, | ||
@@ -34,3 +34,2 @@ "devDependencies": { | ||
"coffee-script": "*", | ||
"coffeegulp": "*", | ||
"commonjs-require": "*", | ||
@@ -37,0 +36,0 @@ "expect.js": "*", |
@@ -34,3 +34,3 @@  | ||
```shell | ||
coffeegulp spec | ||
gulp spec | ||
``` | ||
@@ -41,3 +41,3 @@ | ||
```shell | ||
NODE_ENV=workstation coffeegulp watch | ||
NODE_ENV=workstation gulp watch | ||
``` | ||
@@ -44,0 +44,0 @@ |
Sorry, the diff of this file is too big to display
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
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
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
Sorry, the diff of this file is not supported yet
267174
24
85
4925