New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eventric

Package Overview
Dependencies
Maintainers
2
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventric - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

src/helper_async.js

348

dist/eventric.js

@@ -11,4 +11,4 @@ (function() {

var AggregateEntity, AggregateEntityCollection, MixinSetGet, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
MixinSetGet = eventric('MixinSetGet');

@@ -223,4 +223,5 @@ AggregateEntity = eventric('AggregateEntity');

'eventric/aggregate_entity_collection': function(exports, require, module) {
var AggregateEntityCollection, _;
_ = require('underscore');
var AggregateEntityCollection, eventric, _;
eventric = require('eventric');
_ = eventric('HelperUnderscore');
Function.prototype.prop = function(propName, desc) {

@@ -312,4 +313,4 @@ if (desc == null) {

var AggregateRepository, MixinRegisterAndGetClass, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
MixinRegisterAndGetClass = eventric('MixinRegisterAndGetClass');

@@ -364,4 +365,4 @@ AggregateRepository = (function() {

var AggregateEntity, AggregateEntityCollection, AggregateRoot, MixinSetGet, MixinSnapshot, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
AggregateEntity = eventric('AggregateEntity');

@@ -601,9 +602,35 @@ AggregateEntityCollection = eventric('AggregateEntityCollection');

'eventric/command_service': function(exports, require, module) {
var CommandService, DomainEventService, eventric;
var CommandService, DomainEventService, async, eventric;
eventric = require('eventric');
async = eventric('HelperAsync');
DomainEventService = eventric('DomainEventService');
CommandService = (function() {
function CommandService(_domainEventService, _aggregateRepository) {
var originalFunction, originalFunctionName, _proxy, _queue;
this._domainEventService = _domainEventService;
this._aggregateRepository = _aggregateRepository;
_queue = async.queue((function(_this) {
return function(payload, next) {
var _ref;
return (_ref = payload.originalFunction).call.apply(_ref, [_this].concat(__slice.call(payload["arguments"]), [next]));
};
})(this), 1);
_proxy = function(_originalFunctionName, _originalFunction) {
return function() {
var originalCallback;
originalCallback = arguments[arguments.length - 1];
delete arguments[arguments.length - 1];
return _queue.push({
originalFunction: _originalFunction,
"arguments": arguments
}, originalCallback);
};
};
for (originalFunctionName in this) {
originalFunction = this[originalFunctionName];
if (typeof originalFunction !== 'function' || originalFunctionName === 'constructor' || (originalFunctionName.indexOf('_')) === 0) {
continue;
}
this[originalFunctionName] = _proxy(originalFunctionName, originalFunction);
}
}

@@ -642,13 +669,2 @@

CommandService.prototype.commandAggregateClosure = function(aggregateName, aggregateId) {
return (function(_this) {
return function() {
var callback, commandName, params, _arg, _i;
_arg = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), callback = arguments[_i++];
commandName = _arg[0], params = _arg[1];
return _this.commandAggregate(aggregateName, aggregateId, commandName, params, callback);
};
})(this);
};
CommandService.prototype.commandAggregate = function() {

@@ -660,2 +676,3 @@ var aggregateId, aggregateName, callback, commandName, params, _arg, _i;

return function(err, aggregate) {
var errorCallback, errorCallbackCalled;
if (err) {

@@ -674,6 +691,14 @@ return callback(err, null);

}
if (typeof params !== 'object') {
if (!(params instanceof Array)) {
params = [params];
}
aggregate[commandName].apply(aggregate, params);
errorCallbackCalled = false;
errorCallback = function(err) {
errorCallbackCalled = true;
return callback(err);
};
aggregate[commandName].apply(aggregate, __slice.call(params).concat([errorCallback]));
if (errorCallbackCalled) {
return;
}
return _this._generateSaveAndTriggerDomainEvent(commandName, aggregate, callback);

@@ -688,9 +713,11 @@ };

domainEvents = aggregate.getDomainEvents();
return this._domainEventService.saveAndTrigger(domainEvents, function(err) {
if (err) {
return callback(err, null);
}
aggregate.clearChanges();
return callback(null, aggregate.id);
});
return this._domainEventService.saveAndTrigger(domainEvents, (function(_this) {
return function(err) {
if (err) {
return callback(err, null);
}
aggregate.clearChanges();
return typeof callback === "function" ? callback(null, aggregate.id) : void 0;
};
})(this));
};

@@ -707,7 +734,9 @@

'eventric/domain_event_service': function(exports, require, module) {
var Backbone, DomainEventService, _;
_ = require('underscore');
Backbone = require('backbone');
var DomainEventService, MixinEvents, async, eventric, _;
eventric = require('eventric');
_ = eventric('HelperUnderscore');
async = eventric('HelperAsync');
MixinEvents = eventric('MixinEvents');
DomainEventService = (function() {
_.extend(DomainEventService.prototype, Backbone.Events);
_.extend(DomainEventService.prototype, MixinEvents);

@@ -719,9 +748,7 @@ function DomainEventService(_eventStore) {

DomainEventService.prototype.saveAndTrigger = function(domainEvents, callback) {
var domainEvent, _i, _len;
for (_i = 0, _len = domainEvents.length; _i < _len; _i++) {
domainEvent = domainEvents[_i];
this._eventStore.save(domainEvent, (function(_this) {
return function(err) {
return async.eachSeries(domainEvents, (function(_this) {
return function(domainEvent, next) {
return _this._eventStore.save(domainEvent, function(err) {
if (err) {
return callback(err);
return next(err);
}

@@ -732,7 +759,14 @@ _this.trigger('DomainEvent', domainEvent);

_this.trigger("" + domainEvent.aggregate.name + "/" + domainEvent.aggregate.id, domainEvent);
return _this.trigger("" + domainEvent.aggregate.name + ":" + domainEvent.name + "/" + domainEvent.aggregate.id, domainEvent);
};
})(this));
}
return callback(null);
_this.trigger("" + domainEvent.aggregate.name + ":" + domainEvent.name + "/" + domainEvent.aggregate.id, domainEvent);
return next(null);
});
};
})(this), (function(_this) {
return function(err) {
if (err) {
return callback(err);
}
return callback(null);
};
})(this));
};

@@ -769,2 +803,5 @@

MixinSetGet: './mixin_setget',
MixinEvents: './mixin_events',
HelperUnderscore: './helper_underscore',
HelperAsync: './helper_async',
BoundedContext: './bounded_context',

@@ -788,2 +825,202 @@ BoundedContextService: './bounded_context_service'

window.require.register({
'eventric/mixin_events': function(exports, require, module) {
var Events, MixinEvents, eventSplitter, eventric, eventsApi, listenMethods, triggerEvents, _;
eventric = require('eventric');
_ = eventric('HelperUnderscore');
Events = MixinEvents = {
on: function(name, callback, context) {
var events;
if (!eventsApi(this, "on", name, [callback, context]) || !callback) {
return this;
}
this._events || (this._events = {});
events = this._events[name] || (this._events[name] = []);
events.push({
callback: callback,
context: context,
ctx: context || this
});
return this;
},
once: function(name, callback, context) {
var once, self;
if (!eventsApi(this, "once", name, [callback, context]) || !callback) {
return this;
}
self = this;
once = _.once(function() {
self.off(name, once);
callback.apply(this, arguments_);
});
once._callback = callback;
return this.on(name, once, context);
},
off: function(name, callback, context) {
var ev, events, i, j, k, l, names, retain;
retain = void 0;
ev = void 0;
events = void 0;
names = void 0;
i = void 0;
l = void 0;
j = void 0;
k = void 0;
if (!this._events || !eventsApi(this, "off", name, [callback, context])) {
return this;
}
if (!name && !callback && !context) {
this._events = void 0;
return this;
}
names = (name ? [name] : _.keys(this._events));
i = 0;
l = names.length;
while (i < l) {
name = names[i];
if (events = this._events[name]) {
this._events[name] = retain = [];
if (callback || context) {
j = 0;
k = events.length;
while (j < k) {
ev = events[j];
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) || (context && context !== ev.context)) {
retain.push(ev);
}
j++;
}
}
if (!retain.length) {
delete this._events[name];
}
}
i++;
}
return this;
},
trigger: function(name) {
var allEvents, args, events;
if (!this._events) {
return this;
}
args = slice.call(arguments_, 1);
if (!eventsApi(this, "trigger", name, args)) {
return this;
}
events = this._events[name];
allEvents = this._events.all;
if (events) {
triggerEvents(events, args);
}
if (allEvents) {
triggerEvents(allEvents, arguments_);
}
return this;
},
stopListening: function(obj, name, callback) {
var id, listeningTo, remove;
listeningTo = this._listeningTo;
if (!listeningTo) {
return this;
}
remove = !name && !callback;
if (!callback && typeof name === "object") {
callback = this;
}
if (obj) {
(listeningTo = {})[obj._listenId] = obj;
}
for (id in listeningTo) {
obj = listeningTo[id];
obj.off(name, callback, this);
if (remove || _.isEmpty(obj._events)) {
delete this._listeningTo[id];
}
}
return this;
}
};
eventSplitter = /\s+/;
eventsApi = function(obj, action, name, rest) {
var i, key, l, names;
if (!name) {
return true;
}
if (typeof name === "object") {
for (key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
if (eventSplitter.test(name)) {
names = name.split(eventSplitter);
i = 0;
l = names.length;
while (i < l) {
obj[action].apply(obj, [names[i]].concat(rest));
i++;
}
return false;
}
return true;
};
triggerEvents = function(events, args) {
var a1, a2, a3, ev, i, l;
ev = void 0;
i = -1;
l = events.length;
a1 = args[0];
a2 = args[1];
a3 = args[2];
switch (args.length) {
case 0:
while (++i < l) {
(ev = events[i]).callback.call(ev.ctx);
}
break;
case 1:
while (++i < l) {
(ev = events[i]).callback.call(ev.ctx, a1);
}
break;
case 2:
while (++i < l) {
(ev = events[i]).callback.call(ev.ctx, a1, a2);
}
break;
case 3:
while (++i < l) {
(ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
}
break;
default:
while (++i < l) {
(ev = events[i]).callback.apply(ev.ctx, args);
}
}
};
listenMethods = {
listenTo: "on",
listenToOnce: "once"
};
_.each(listenMethods, function(implementation, method) {
Events[method] = function(obj, name, callback) {
var id, listeningTo;
listeningTo = this._listeningTo || (this._listeningTo = {});
id = obj._listenId || (obj._listenId = _.uniqueId("l"));
listeningTo[id] = obj;
if (!callback && typeof name === "object") {
callback = this;
}
obj[implementation](name, callback, this);
return this;
};
});
Events.bind = Events.on;
Events.unbind = Events.off;
return module.exports = MixinEvents;
}
});
window.require.register({
'eventric/mixin_registerandgetclass': function(exports, require, module) {

@@ -913,4 +1150,3 @@ var MixinRegisterAndGetClass;

'eventric/read_aggregate_entity': function(exports, require, module) {
var AggregateEntity, MixinSetGet, ReadAggregateEntity, eventric, _;
_ = require('underscore');
var AggregateEntity, MixinSetGet, ReadAggregateEntity, eventric;
eventric = require('eventric');

@@ -936,5 +1172,5 @@ AggregateEntity = eventric('AggregateEntity');

var MixinRegisterAndGetClass, ReadAggregateRepository, async, eventric, _;
_ = require('underscore');
async = require('async');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
async = eventric('HelperAsync');
MixinRegisterAndGetClass = eventric('MixinRegisterAndGetClass');

@@ -1111,9 +1347,8 @@ ReadAggregateRepository = (function() {

'eventric/read_aggregate_root': function(exports, require, module) {
var Backbone, MixinSetGet, MixinSnapshot, ReadAggregateEntity, ReadAggregateRoot, eventric, _;
_ = require('underscore');
Backbone = require('backbone');
var MixinEvents, MixinSnapshot, ReadAggregateEntity, ReadAggregateRoot, eventric, _;
eventric = require('eventric');
_ = eventric('HelperUnderscore');
ReadAggregateEntity = eventric('ReadAggregateEntity');
MixinSnapshot = eventric('MixinSnapshot');
MixinSetGet = eventric('MixinSetGet');
MixinEvents = eventric('MixinEvents');
ReadAggregateRoot = (function(_super) {

@@ -1126,3 +1361,3 @@ __extends(ReadAggregateRoot, _super);

_.extend(ReadAggregateRoot.prototype, Backbone.Events);
_.extend(ReadAggregateRoot.prototype, MixinEvents);

@@ -1140,4 +1375,5 @@ _.extend(ReadAggregateRoot.prototype, MixinSnapshot.prototype);

'eventric/read_mix': function(exports, require, module) {
var ReadMix, _;
_ = require('underscore');
var ReadMix, eventric, _;
eventric = require('eventric');
_ = eventric('HelperUnderscore');
ReadMix = (function() {

@@ -1205,4 +1441,4 @@ function ReadMix() {}

var MixinRegisterAndGetClass, ReadMixRepository, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
MixinRegisterAndGetClass = eventric('MixinRegisterAndGetClass');

@@ -1247,4 +1483,4 @@ ReadMixRepository = (function() {

var MixinRegisterAndGetClass, RemoteBoundedContext, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
MixinRegisterAndGetClass = eventric('MixinRegisterAndGetClass');

@@ -1314,4 +1550,4 @@ RemoteBoundedContext = (function() {

var MixinRegisterAndGetClass, RemoteCommandService, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
MixinRegisterAndGetClass = eventric('MixinRegisterAndGetClass');

@@ -1385,4 +1621,4 @@ RemoteCommandService = (function() {

var MixinRegisterAndGetClass, RemoteRepositoryService, eventric, _;
_ = require('underscore');
eventric = require('eventric');
_ = eventric('HelperUnderscore');
MixinRegisterAndGetClass = eventric('MixinRegisterAndGetClass');

@@ -1389,0 +1625,0 @@ RemoteRepositoryService = (function() {

8

package.json

@@ -19,3 +19,3 @@ {

"author": "eFa Team <team@efa-gmbh.com>",
"version": "0.0.6",
"version": "0.0.7",
"repository": {

@@ -54,7 +54,3 @@ "type": "git",

},
"dependencies": {
"backbone": "*",
"underscore": "*",
"async": "*"
},
"dependencies": {},
"licenses": [

@@ -61,0 +57,0 @@ {

@@ -12,3 +12,3 @@ ![eventric logo](https://raw.githubusercontent.com/wiki/efacilitation/eventric/eventric_logo.png)

* BoundedContexts
* BoundedContexts / MicroServices
* CQRS

@@ -15,0 +15,0 @@ * EventSourcing

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

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

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