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

eventric

Package Overview
Dependencies
Maintainers
3
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.13.1 to 0.14.0

dist/specs/specs.js

589

dist/release/eventric.js

@@ -64,18 +64,18 @@ (function webpackUniversalModuleDefinition(root, factory) {

var Context, Eventric, GlobalContext, Projection, Remote, RemoteInMemory, StoreInMemory, uidGenerator,
var Context, Eventric, GlobalContext, Projection, Remote, StoreInMemory, remoteInmemory, uidGenerator,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
GlobalContext = __webpack_require__(2);
remoteInmemory = __webpack_require__(2);
RemoteInMemory = __webpack_require__(4);
GlobalContext = __webpack_require__(3);
Remote = __webpack_require__(7);
Remote = __webpack_require__(5);
Projection = __webpack_require__(11);
Projection = __webpack_require__(9);
Context = __webpack_require__(15);
Context = __webpack_require__(13);
StoreInMemory = __webpack_require__(26);
StoreInMemory = __webpack_require__(24);
uidGenerator = __webpack_require__(13);
uidGenerator = __webpack_require__(11);

@@ -94,3 +94,3 @@ Eventric = (function() {

this._projectionService = new Projection(this._globalContext);
this.addRemoteEndpoint('inmemory', RemoteInMemory.endpoint);
this.setRemoteEndpoint(remoteInmemory.endpoint);
this.setStore(StoreInMemory, {});

@@ -117,3 +117,3 @@ }

context = new Context(name, this._storeDefintion);
this._delegateAllDomainEventsToRemoteEndpoints(context);
this._delegateAllDomainEventsToRemoteEndpoint(context);
this._contexts[name] = context;

@@ -153,5 +153,5 @@ return context;

Eventric.prototype.addRemoteEndpoint = function(remoteName, remoteEndpoint) {
this._remoteEndpoints.push(remoteEndpoint);
return remoteEndpoint.setRPCHandler(this._handleRemoteRPCRequest);
Eventric.prototype.setRemoteEndpoint = function(remoteEndpoint) {
this._remoteEndpoint = remoteEndpoint;
return this._remoteEndpoint.setRPCHandler(this._handleRemoteRPCRequest);
};

@@ -190,11 +190,9 @@

Eventric.prototype._delegateAllDomainEventsToRemoteEndpoints = function(context) {
Eventric.prototype._delegateAllDomainEventsToRemoteEndpoint = function(context) {
return context.subscribeToAllDomainEvents((function(_this) {
return function(domainEvent) {
return _this._remoteEndpoints.forEach(function(remoteEndpoint) {
remoteEndpoint.publish(context.name, domainEvent.name, domainEvent);
if (domainEvent.aggregate) {
return remoteEndpoint.publish(context.name, domainEvent.name, domainEvent.aggregate.id, domainEvent);
}
});
_this._remoteEndpoint.publish(context.name, domainEvent.name, domainEvent);
if (domainEvent.aggregate) {
return _this._remoteEndpoint.publish(context.name, domainEvent.name, domainEvent.aggregate.id, domainEvent);
}
};

@@ -215,5 +213,224 @@ })(this));

module.exports = __webpack_require__(3);
(function webpackUniversalModuleDefinition(root, factory) {
if(true)
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define(factory);
else if(typeof exports === 'object')
exports["eventric-remote-inmemory"] = factory();
else
root["eventric-remote-inmemory"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = {
endpoint: __webpack_require__(1),
client: __webpack_require__(3)
};
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var InMemoryRemoteEndpoint, pubSub,
slice = [].slice;
pubSub = __webpack_require__(2);
InMemoryRemoteEndpoint = (function() {
function InMemoryRemoteEndpoint() {}
InMemoryRemoteEndpoint.prototype.setRPCHandler = function(handleRPCRequest) {
this.handleRPCRequest = handleRPCRequest;
};
InMemoryRemoteEndpoint.prototype.publish = function() {
var aggregateId, arg, contextName, domainEventName, fullEventName, i, payload;
contextName = arguments[0], arg = 3 <= arguments.length ? slice.call(arguments, 1, i = arguments.length - 1) : (i = 1, []), payload = arguments[i++];
domainEventName = arg[0], aggregateId = arg[1];
fullEventName = pubSub.getFullEventName(contextName, domainEventName, aggregateId);
return pubSub.publish(fullEventName, payload);
};
return InMemoryRemoteEndpoint;
})();
module.exports = new InMemoryRemoteEndpoint;
/***/ },
/* 2 */
/***/ function(module, exports) {
var PubSub,
slice = [].slice;
PubSub = (function() {
function PubSub() {
this._subscribers = [];
this._subscriberId = 0;
}
PubSub.prototype.subscribe = function(eventName, subscriberFunction) {
return new Promise((function(_this) {
return function(resolve) {
var subscriber;
subscriber = {
eventName: eventName,
subscriberFunction: subscriberFunction,
subscriberId: _this._getNextSubscriberId()
};
_this._subscribers.push(subscriber);
return resolve(subscriber.subscriberId);
};
})(this));
};
PubSub.prototype.publish = function(eventName, payload) {
var subscribers;
subscribers = this._getRelevantSubscribers(eventName);
return Promise.all(subscribers.map(function(subscriber) {
return subscriber.subscriberFunction(payload);
}));
};
PubSub.prototype._getRelevantSubscribers = function(eventName) {
if (eventName) {
return this._subscribers.filter(function(subscriber) {
return subscriber.eventName === eventName;
});
} else {
return this._subscribers;
}
};
PubSub.prototype.unsubscribe = function(subscriberId) {
return new Promise((function(_this) {
return function(resolve) {
_this._subscribers = _this._subscribers.filter(function(subscriber) {
return subscriber.subscriberId !== subscriberId;
});
return resolve();
};
})(this));
};
PubSub.prototype._getNextSubscriberId = function() {
return this._subscriberId++;
};
PubSub.prototype.getFullEventName = function() {
var eventParts;
eventParts = 1 <= arguments.length ? slice.call(arguments, 0) : [];
eventParts = eventParts.filter(function(eventPart) {
return eventPart != null;
});
return eventParts.join('/');
};
return PubSub;
})();
module.exports = new PubSub;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var InMemoryRemoteClient, endpoint, pubSub,
slice = [].slice;
endpoint = __webpack_require__(1);
pubSub = __webpack_require__(2);
InMemoryRemoteClient = (function() {
function InMemoryRemoteClient() {}
InMemoryRemoteClient.prototype.rpc = function(rpcRequest) {
return new Promise((function(_this) {
return function(resolve, reject) {
return endpoint.handleRPCRequest(rpcRequest, function(error, result) {
if (error) {
return reject(error);
} else {
return resolve(result);
}
});
};
})(this));
};
InMemoryRemoteClient.prototype.subscribe = function() {
var aggregateId, arg, contextName, domainEventName, fullEventName, handlerFunction, i;
contextName = arguments[0], arg = 3 <= arguments.length ? slice.call(arguments, 1, i = arguments.length - 1) : (i = 1, []), handlerFunction = arguments[i++];
domainEventName = arg[0], aggregateId = arg[1];
fullEventName = pubSub.getFullEventName(contextName, domainEventName, aggregateId);
return pubSub.subscribe(fullEventName, handlerFunction);
};
InMemoryRemoteClient.prototype.unsubscribe = function(subscriberId) {
return pubSub.unsubscribe(subscriberId);
};
return InMemoryRemoteClient;
})();
module.exports = new InMemoryRemoteClient;
/***/ }
/******/ ])
});
;
/***/ },

@@ -223,2 +440,9 @@ /* 3 */

module.exports = __webpack_require__(4);
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var GlobalContext,

@@ -287,204 +511,20 @@ slice = [].slice;

/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(5);
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
var InMemoryRemoteClient, InMemoryRemoteEndpoint, PubSub, customRemoteBridge, getFullEventName, pubSub,
slice = [].slice;
module.exports = __webpack_require__(6);
PubSub = __webpack_require__(6);
customRemoteBridge = null;
pubSub = new PubSub;
InMemoryRemoteEndpoint = (function() {
function InMemoryRemoteEndpoint() {
customRemoteBridge = (function(_this) {
return function(rpcRequest) {
return new Promise(function(resolve, reject) {
return _this._handleRPCRequest(rpcRequest, function(error, result) {
if (error) {
return reject(error);
}
return resolve(result);
});
});
};
})(this);
}
InMemoryRemoteEndpoint.prototype.setRPCHandler = function(_handleRPCRequest) {
this._handleRPCRequest = _handleRPCRequest;
};
InMemoryRemoteEndpoint.prototype.publish = function() {
var aggregateId, arg, contextName, domainEventName, fullEventName, i, payload;
contextName = arguments[0], arg = 3 <= arguments.length ? slice.call(arguments, 1, i = arguments.length - 1) : (i = 1, []), payload = arguments[i++];
domainEventName = arg[0], aggregateId = arg[1];
fullEventName = getFullEventName(contextName, domainEventName, aggregateId);
return pubSub.publish(fullEventName, payload);
};
return InMemoryRemoteEndpoint;
})();
module.exports.endpoint = new InMemoryRemoteEndpoint;
InMemoryRemoteClient = (function() {
function InMemoryRemoteClient() {}
InMemoryRemoteClient.prototype.rpc = function(rpcRequest) {
if (!customRemoteBridge) {
throw new Error('No Remote Endpoint available for in memory client');
}
return customRemoteBridge(rpcRequest);
};
InMemoryRemoteClient.prototype.subscribe = function() {
var aggregateId, arg, contextName, domainEventName, fullEventName, handlerFn, i;
contextName = arguments[0], arg = 3 <= arguments.length ? slice.call(arguments, 1, i = arguments.length - 1) : (i = 1, []), handlerFn = arguments[i++];
domainEventName = arg[0], aggregateId = arg[1];
fullEventName = getFullEventName(contextName, domainEventName, aggregateId);
return pubSub.subscribe(fullEventName, handlerFn);
};
InMemoryRemoteClient.prototype.unsubscribe = function(subscriberId) {
return pubSub.unsubscribe(subscriberId);
};
return InMemoryRemoteClient;
})();
module.exports.client = new InMemoryRemoteClient;
getFullEventName = function(contextName, domainEventName, aggregateId) {
var fullEventName;
fullEventName = contextName;
if (domainEventName) {
fullEventName += "/" + domainEventName;
}
if (aggregateId) {
fullEventName += "/" + aggregateId;
}
return fullEventName;
};
/***/ },
/* 6 */
/***/ function(module, exports) {
var PubSub;
PubSub = (function() {
function PubSub() {
this._subscribers = [];
this._subscriberId = 0;
this._pendingOperations = [];
}
PubSub.prototype.subscribe = function(eventName, subscriberFunction) {
return new Promise((function(_this) {
return function(resolve) {
var subscriber;
subscriber = {
eventName: eventName,
subscriberFunction: subscriberFunction,
subscriberId: _this._getNextSubscriberId()
};
_this._subscribers.push(subscriber);
return resolve(subscriber.subscriberId);
};
})(this));
};
PubSub.prototype.publish = function(eventName, payload) {
var executeSubscriberFunctions, subscribers;
subscribers = this._getRelevantSubscribers(eventName);
executeSubscriberFunctions = Promise.all(subscribers.map(function(subscriber) {
return subscriber.subscriberFunction(payload);
}));
this._addPendingOperation(executeSubscriberFunctions);
return executeSubscriberFunctions;
};
PubSub.prototype._getRelevantSubscribers = function(eventName) {
if (eventName) {
return this._subscribers.filter(function(subscriber) {
return subscriber.eventName === eventName;
});
} else {
return this._subscribers;
}
};
PubSub.prototype._addPendingOperation = function(pendingOperation) {
var errorSuppressedPendingOperation;
errorSuppressedPendingOperation = pendingOperation["catch"](function() {});
this._pendingOperations.push(errorSuppressedPendingOperation);
return errorSuppressedPendingOperation.then((function(_this) {
return function() {
return _this._pendingOperations.splice(_this._pendingOperations.indexOf(errorSuppressedPendingOperation), 1);
};
})(this));
};
PubSub.prototype.unsubscribe = function(subscriberId) {
return new Promise((function(_this) {
return function(resolve) {
_this._subscribers = _this._subscribers.filter(function(subscriber) {
return subscriber.subscriberId !== subscriberId;
});
return resolve();
};
})(this));
};
PubSub.prototype._getNextSubscriberId = function() {
return this._subscriberId++;
};
PubSub.prototype.destroy = function() {
return Promise.all(this._pendingOperations).then((function(_this) {
return function() {
return _this.publish = function(eventName, payload) {
return Promise.reject(new Error("Pub sub was destroyed, cannot publish " + eventName + " with payload " + (JSON.stringify(payload))));
};
};
})(this));
};
return PubSub;
})();
module.exports = PubSub;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(8);
var Projection, Remote, logger, remoteInmemory;
remoteInmemory = __webpack_require__(2);
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
logger = __webpack_require__(7);
var Projection, Remote, logger;
Projection = __webpack_require__(9);
logger = __webpack_require__(9);
Projection = __webpack_require__(11);
Remote = (function() {

@@ -496,5 +536,3 @@ Remote.ALLOWED_RPC_OPERATIONS = ['command', 'query', 'findDomainEventsByName', 'findDomainEventsByNameAndAggregateId'];

this.name = this._contextName;
this.InMemoryRemote = __webpack_require__(4);
this._params = {};
this._clients = {};
this._projectionClasses = {};

@@ -504,4 +542,3 @@ this._projectionInstances = {};

this.projectionService = new Projection(this);
this.addClient('inmemory', this.InMemoryRemote.client);
this.set('default client', 'inmemory');
this.setClient(remoteInmemory.client);
this._exposeRpcOperationsAsMemberFunctions();

@@ -520,44 +557,20 @@ }

Remote.prototype.set = function(key, value) {
this._params[key] = value;
return this;
};
Remote.prototype.get = function(key) {
return this._params[key];
};
Remote.prototype.subscribeToAllDomainEvents = function(handlerFn) {
var client, clientName;
clientName = this.get('default client');
client = this.getClient(clientName);
return client.subscribe(this._contextName, handlerFn);
return this._client.subscribe(this._contextName, handlerFn);
};
Remote.prototype.subscribeToDomainEvent = function(domainEventName, handlerFn) {
var client, clientName;
clientName = this.get('default client');
client = this.getClient(clientName);
return client.subscribe(this._contextName, domainEventName, handlerFn);
return this._client.subscribe(this._contextName, domainEventName, handlerFn);
};
Remote.prototype.subscribeToDomainEventWithAggregateId = function(domainEventName, aggregateId, handlerFn) {
var client, clientName;
clientName = this.get('default client');
client = this.getClient(clientName);
return client.subscribe(this._contextName, domainEventName, aggregateId, handlerFn);
return this._client.subscribe(this._contextName, domainEventName, aggregateId, handlerFn);
};
Remote.prototype.unsubscribeFromDomainEvent = function(subscriberId) {
var client, clientName;
clientName = this.get('default client');
client = this.getClient(clientName);
return client.unsubscribe(subscriberId);
return this._client.unsubscribe(subscriberId);
};
Remote.prototype._rpc = function(functionName, args) {
var client, clientName;
clientName = this.get('default client');
client = this.getClient(clientName);
return client.rpc({
return this._client.rpc({
contextName: this._contextName,

@@ -569,11 +582,7 @@ functionName: functionName,

Remote.prototype.addClient = function(clientName, client) {
this._clients[clientName] = client;
Remote.prototype.setClient = function(client) {
this._client = client;
return this;
};
Remote.prototype.getClient = function(clientName) {
return this._clients[clientName];
};
Remote.prototype.addProjection = function(projectionName, projectionClass) {

@@ -611,10 +620,10 @@ this._projectionClasses[projectionName] = projectionClass;

/***/ },
/* 9 */
/* 7 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(10);
module.exports = __webpack_require__(8);
/***/ },
/* 10 */
/* 8 */
/***/ function(module, exports) {

@@ -666,10 +675,10 @@

/***/ },
/* 11 */
/* 9 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(12);
module.exports = __webpack_require__(10);
/***/ },
/* 12 */
/* 10 */
/***/ function(module, exports, __webpack_require__) {

@@ -680,5 +689,5 @@

logger = __webpack_require__(9);
logger = __webpack_require__(7);
uidGenerator = __webpack_require__(13);
uidGenerator = __webpack_require__(11);

@@ -869,10 +878,10 @@ Projection = (function() {

/***/ },
/* 13 */
/* 11 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(14);
module.exports = __webpack_require__(12);
/***/ },
/* 14 */
/* 12 */
/***/ function(module, exports) {

@@ -904,10 +913,10 @@

/***/ },
/* 15 */
/* 13 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(16);
module.exports = __webpack_require__(14);
/***/ },
/* 16 */
/* 14 */
/***/ function(module, exports, __webpack_require__) {

@@ -919,13 +928,13 @@

EventBus = __webpack_require__(21);
EventBus = __webpack_require__(19);
Projection = __webpack_require__(11);
Projection = __webpack_require__(9);
DomainEvent = __webpack_require__(24);
DomainEvent = __webpack_require__(22);
AggregateRepository = __webpack_require__(17);
AggregateRepository = __webpack_require__(15);
logger = __webpack_require__(9);
logger = __webpack_require__(7);
uidGenerator = __webpack_require__(13);
uidGenerator = __webpack_require__(11);

@@ -1289,10 +1298,10 @@ Context = (function() {

/***/ },
/* 17 */
/* 15 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(18);
module.exports = __webpack_require__(16);
/***/ },
/* 18 */
/* 16 */
/***/ function(module, exports, __webpack_require__) {

@@ -1303,7 +1312,7 @@

Aggregate = __webpack_require__(19);
Aggregate = __webpack_require__(17);
logger = __webpack_require__(9);
logger = __webpack_require__(7);
uidGenerator = __webpack_require__(13);
uidGenerator = __webpack_require__(11);

@@ -1407,10 +1416,10 @@ AggregateRepository = (function() {

/***/ },
/* 19 */
/* 17 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(20);
module.exports = __webpack_require__(18);
/***/ },
/* 20 */
/* 18 */
/***/ function(module, exports, __webpack_require__) {

@@ -1421,3 +1430,3 @@

logger = __webpack_require__(9);
logger = __webpack_require__(7);

@@ -1485,10 +1494,10 @@ Aggregate = (function() {

/***/ },
/* 21 */
/* 19 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(22);
module.exports = __webpack_require__(20);
/***/ },
/* 22 */
/* 20 */
/***/ function(module, exports, __webpack_require__) {

@@ -1498,3 +1507,3 @@

Subscriber = __webpack_require__(23);
Subscriber = __webpack_require__(21);

@@ -1634,3 +1643,3 @@ EventBus = (function() {

/***/ },
/* 23 */
/* 21 */
/***/ function(module, exports) {

@@ -1653,10 +1662,10 @@

/***/ },
/* 24 */
/* 22 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(25);
module.exports = __webpack_require__(23);
/***/ },
/* 25 */
/* 23 */
/***/ function(module, exports) {

@@ -1684,10 +1693,10 @@

/***/ },
/* 26 */
/* 24 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(27);
module.exports = __webpack_require__(25);
/***/ },
/* 27 */
/* 25 */
/***/ function(module, exports) {

@@ -1694,0 +1703,0 @@

@@ -14,3 +14,3 @@ {

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

@@ -25,2 +25,5 @@ "type": "git",

},
"dependencies": {
"eventric-remote-inmemory": "0.1.1"
},
"devDependencies": {

@@ -30,7 +33,6 @@ "chai": "2.3.0",

"coffee-script": "1.9.3",
"del": "1.2.0",
"es6-promise": "2.1.1",
"gulp": "3.9.0",
"gulp-bump": "0.3.1",
"gulp-coffee": "2.3.1",
"gulp-karma": "0.0.4",
"gulp-mocha": "2.1.0",

@@ -40,9 +42,9 @@ "gulp-symlink": "2.1.2",

"gulp-watch": "4.2.4",
"karma": "0.12.35",
"karma-mocha": "0.1.10",
"karma": "0.12.37",
"karma-mocha": "0.2.0",
"karma-phantomjs-launcher": "0.2.0",
"karma-spec-reporter": "0.0.19",
"karma-spec-reporter": "0.0.20",
"mocha": "2.2.5",
"phantomjs": "1.9.17",
"run-sequence": "1.1.0",
"run-sequence": "1.1.2",
"sinon": "git://github.com/cjohansen/Sinon.JS#sinon-2.0",

@@ -49,0 +51,0 @@ "sinon-chai": "2.7.0",

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