UNPKG

eventric-testing

Version:
977 lines (820 loc) 30.9 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["eventric-testing"] = factory(); else root["eventric-testing"] = 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__) { var EventricTesting, aggregateFactory, eventualConsistencyUtilities, fakePromise, fakeRemoteContexts, remoteFactory, slice = [].slice; aggregateFactory = __webpack_require__(1); fakePromise = __webpack_require__(2); eventualConsistencyUtilities = __webpack_require__(3); remoteFactory = __webpack_require__(4); fakeRemoteContexts = []; EventricTesting = (function() { function EventricTesting() {} EventricTesting.prototype.resolve = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.resolve.apply(fakePromise, args); }; EventricTesting.prototype.reject = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.reject.apply(fakePromise, args); }; EventricTesting.prototype.rejectAsync = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.rejectAsync.apply(fakePromise, args); }; EventricTesting.prototype.createAggregate = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return aggregateFactory.createAggregate.apply(aggregateFactory, args); }; EventricTesting.prototype.setupFakeRemoteContext = function() { var args, fakeRemoteContext; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; fakeRemoteContext = remoteFactory.setupFakeRemoteContext.apply(remoteFactory, args); fakeRemoteContexts.push(fakeRemoteContext); return fakeRemoteContext; }; EventricTesting.prototype.destroy = function(eventric) { var contexts, destroyContextsPromise, destroyRemotesPromise; if (!eventric) { throw new Error('eventric instance missing'); } contexts = this._getRegisteredEventricContexts(eventric); contexts.forEach((function(_this) { return function(context) { return _this._makeContextInoperative(eventric, context); }; })(this)); destroyContextsPromise = Promise.all(contexts.map(function(context) { return context.destroy(); })); destroyRemotesPromise = Promise.all(fakeRemoteContexts.map(function(fakeRemoteContext) { return fakeRemoteContext.$destroy(); })); destroyRemotesPromise = destroyRemotesPromise.then(function() { return fakeRemoteContexts = []; }); return Promise.all([destroyContextsPromise, destroyRemotesPromise]); }; EventricTesting.prototype.waitForQueryToReturnResult = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return eventualConsistencyUtilities.waitForQueryToReturnResult.apply(eventualConsistencyUtilities, args); }; EventricTesting.prototype.waitForCommandToResolve = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return eventualConsistencyUtilities.waitForCommandToResolve.apply(eventualConsistencyUtilities, args); }; EventricTesting.prototype.waitForResult = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return eventualConsistencyUtilities.waitForResult.apply(eventualConsistencyUtilities, args); }; EventricTesting.prototype._getRegisteredEventricContexts = function(eventric) { return Object.keys(eventric._contexts).map(function(contextName) { return eventric._contexts[contextName]; }); }; EventricTesting.prototype._makeContextInoperative = function(eventric, context) { var domainEventsStore; context.command = function() { return Promise.resolve(eventric.generateUuid()); }; context.getEventBus().publishDomainEvent = function() { return Promise.resolve(); }; domainEventsStore = context.getDomainEventsStore(); if (domainEventsStore) { return domainEventsStore.saveDomainEvent = function() { return Promise.resolve(); }; } }; return EventricTesting; })(); module.exports = new EventricTesting; /***/ }, /* 1 */ /***/ function(module, exports) { var AggregateFactory; AggregateFactory = (function() { function AggregateFactory() {} AggregateFactory.prototype.createAggregate = function(eventric, AggregateClass, domainEvents) { var context; if (!eventric) { throw new Error('eventric instance missing'); } context = eventric.context("EventricTesting-" + (Math.random())); context.addAggregate('TestAggregate', this._createAggregateClassWithFakeCreateFunction(AggregateClass)); context.defineDomainEvents(domainEvents); context.addCommandHandlers({ CreateAggregate: function() { return this.$aggregate.create('TestAggregate'); } }); return context.initialize().then(function() { return context.command('CreateAggregate'); }).then(function(aggregate) { return context.destroy().then(function() { return aggregate; }); }); }; AggregateFactory.prototype._createAggregateClassWithFakeCreateFunction = function(AggregateClass) { var WrappedAggregateClass; WrappedAggregateClass = function() { var aggregateInstance, originalCreate; aggregateInstance = new AggregateClass; originalCreate = aggregateInstance.create; aggregateInstance.create = function() { return aggregateInstance.create = originalCreate; }; return aggregateInstance; }; return WrappedAggregateClass; }; return AggregateFactory; })(); module.exports = new AggregateFactory; /***/ }, /* 2 */ /***/ function(module, exports) { var FakePromise, _isPromise, slice = [].slice; _isPromise = function(promise) { return promise && typeof promise.then === 'function' && typeof promise["catch"] === 'function'; }; FakePromise = (function() { function FakePromise() {} FakePromise.prototype.resolve = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return { then: function(callback) { var promise; if (callback == null) { callback = function() {}; } promise = callback.apply(this, args); if (_isPromise(promise)) { return promise; } else { return this; } }, "catch": function() { return this; } }; }; FakePromise.prototype.reject = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return { then: function() { return this; }, "catch": function(callback) { var promise; if (callback == null) { callback = function() {}; } promise = callback.apply(this, args); if (_isPromise(promise)) { promise; } else { this; } return this; } }; }; FakePromise.prototype.rejectAsync = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return { then: function() { return this; }, "catch": function(callback) { if (callback == null) { callback = function() {}; } setTimeout(function() { return callback.apply(this, args); }, 0); return this; } }; }; return FakePromise; })(); module.exports = new FakePromise; /***/ }, /* 3 */ /***/ function(module, exports) { var EventualConsistencyUtilities; EventualConsistencyUtilities = (function() { function EventualConsistencyUtilities() {} EventualConsistencyUtilities.prototype.waitForQueryToReturnResult = function(context, queryName, params, timeout) { if (timeout == null) { timeout = 5000; } return this.waitForResult(function() { return context.query(queryName, params); }, timeout)["catch"](function(error) { var ref; if ((error != null ? (ref = error.message) != null ? ref.indexOf('waitForResult') : void 0 : void 0) > -1) { throw new Error("waitForQueryToReturnResult timed out for query '" + queryName + "' on context '" + context.name + "'\nwith params " + (JSON.stringify(params))); } else { throw error; } }); }; EventualConsistencyUtilities.prototype.waitForCommandToResolve = function(context, commandName, params, timeout) { if (timeout == null) { timeout = 5000; } return this.waitForResult(function() { return context.command(commandName, params).then(function(result) { return result || true; })["catch"](function() { return void 0; }); }, timeout)["catch"](function() { throw new Error("waitForCommandToResolve timed out for command '" + commandName + "' on context '" + context.name + "'\nwith params " + (JSON.stringify(params))); }); }; EventualConsistencyUtilities.prototype.waitForResult = function(promiseFactory, timeout) { if (timeout == null) { timeout = 5000; } return new Promise(function(resolve, reject) { var pollPromise, startTime; startTime = new Date(); pollPromise = function() { return promiseFactory().then(function(result) { var timeoutExceeded; if (result != null) { resolve(result); return; } timeoutExceeded = (new Date() - startTime) >= timeout; if (!timeoutExceeded) { setTimeout(pollPromise, 15); return; } return reject(new Error("waitForResult timed out for '" + (promiseFactory.toString()) + "'")); })["catch"](reject); }; return pollPromise(); }); }; return EventualConsistencyUtilities; })(); module.exports = new EventualConsistencyUtilities; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { var DomainEvent, RemoteFactory, equal, fakePromise, inmemoryRemote; equal = __webpack_require__(5); fakePromise = __webpack_require__(2); inmemoryRemote = __webpack_require__(8); DomainEvent = __webpack_require__(9); RemoteFactory = (function() { function RemoteFactory() {} RemoteFactory.prototype.setupFakeRemoteContext = function(eventric, contextName, domainEvents) { var fakeRemoteContext, originalSubscribeToAllDomainEvents, originalSubscribeToDomainEvent, originalSubscribeToDomainEventWithAggregateId; if (domainEvents == null) { domainEvents = {}; } if (!eventric) { throw new Error('eventric instance missing'); } fakeRemoteContext = eventric.remoteContext(contextName); fakeRemoteContext._context = eventric.context(contextName); fakeRemoteContext._mostCurrentEmitOperation = fakePromise.resolve(); fakeRemoteContext._domainEvents = []; fakeRemoteContext._subscriberIds = []; fakeRemoteContext._commandStubs = []; fakeRemoteContext._context.defineDomainEvents(domainEvents); fakeRemoteContext.setClient(inmemoryRemote.client); fakeRemoteContext.$emitDomainEvent = function(domainEventName, aggregateId, domainEventPayload) { var domainEvent, endpoint; domainEvent = this._createDomainEvent(domainEventName, aggregateId, domainEventPayload); this._domainEvents.push(domainEvent); endpoint = inmemoryRemote.endpoint; return this._mostCurrentEmitOperation = this._mostCurrentEmitOperation.then(function() { var contextAndNameEventPublish, contextEventPublish, fullEventNamePublish; contextEventPublish = endpoint.publish(contextName, domainEvent); contextAndNameEventPublish = endpoint.publish(contextName, domainEvent.name, domainEvent); if (domainEvent.aggregate) { fullEventNamePublish = endpoint.publish(contextName, domainEvent.name, domainEvent.aggregate.id, domainEvent); return Promise.all([contextEventPublish, contextAndNameEventPublish, fullEventNamePublish]); } else { return Promise.all([contextEventPublish, contextAndNameEventPublish]); } }); }; fakeRemoteContext.$waitForEmitDomainEvent = function() { return fakeRemoteContext._mostCurrentEmitOperation; }; fakeRemoteContext._createDomainEvent = function(domainEventName, aggregateId, domainEventConstructorParams) { var DomainEventPayloadConstructor, payload; DomainEventPayloadConstructor = fakeRemoteContext._context.getDomainEventPayloadConstructor(domainEventName); if (!DomainEventPayloadConstructor) { throw new Error("Tried to create domain event '" + domainEventName + "' which is not defined"); } payload = {}; DomainEventPayloadConstructor.apply(payload, [domainEventConstructorParams]); return new DomainEvent({ id: eventric.generateUuid(), name: domainEventName, aggregate: { id: aggregateId, name: 'EventricTesting' }, context: this._context.name, payload: payload }); }; fakeRemoteContext.findDomainEventsByName = function(names) { if (!(names instanceof Array)) { names = [names]; } return fakePromise.resolve(this._domainEvents.filter(function(x) { return names.indexOf(x.name) > -1; })); }; fakeRemoteContext.findDomainEventsByNameAndAggregateId = function(names, aggregateIds) { if (!(names instanceof Array)) { names = [names]; } if (!(aggregateIds instanceof Array)) { aggregateIds = [aggregateIds]; } return fakePromise.resolve(this._domainEvents.filter(function(x) { return names.indexOf(x.name) > -1 && x.aggregate && aggregateIds.indexOf(x.aggregate.id) > -1; })); }; originalSubscribeToAllDomainEvents = fakeRemoteContext.subscribeToAllDomainEvents; fakeRemoteContext.subscribeToAllDomainEvents = function() { return originalSubscribeToAllDomainEvents.apply(this, arguments).then((function(_this) { return function(subscriberId) { _this._subscriberIds.push(subscriberId); return subscriberId; }; })(this)); }; originalSubscribeToDomainEvent = fakeRemoteContext.subscribeToDomainEvent; fakeRemoteContext.subscribeToDomainEvent = function() { return originalSubscribeToDomainEvent.apply(this, arguments).then((function(_this) { return function(subscriberId) { _this._subscriberIds.push(subscriberId); return subscriberId; }; })(this)); }; originalSubscribeToDomainEventWithAggregateId = fakeRemoteContext.subscribeToDomainEventWithAggregateId; fakeRemoteContext.subscribeToDomainEventWithAggregateId = function() { return originalSubscribeToDomainEventWithAggregateId.apply(this, arguments).then((function(_this) { return function(subscriberId) { _this._subscriberIds.push(subscriberId); return subscriberId; }; })(this)); }; fakeRemoteContext.$destroy = function() { this._domainEvents = []; this._commandStubs = []; return this._mostCurrentEmitOperation.then((function(_this) { return function() { var i, len, ref, subscriberId, subscriptionRemovals; _this._mostCurrentEmitOperation = fakePromise.resolve(); subscriptionRemovals = []; ref = _this._subscriberIds; for (i = 0, len = ref.length; i < len; i++) { subscriberId = ref[i]; subscriptionRemovals.push(fakeRemoteContext.unsubscribeFromDomainEvent(subscriberId)); } _this._subscriberIds = []; return Promise.all(subscriptionRemovals); }; })(this)); }; fakeRemoteContext.$onCommand = function(command, payload) { var commandStub; commandStub = { command: command, payload: payload, domainEvents: [], yieldsDomainEvent: function(eventName, aggregateId, payload) { this.domainEvents.push({ eventName: eventName, aggregateId: aggregateId, payload: payload }); return this; } }; this._commandStubs.push(commandStub); return commandStub; }; fakeRemoteContext.command = function(command, payload) { var domainEvent, emitDomainEventAsync, filteredCommandStub, filteredCommandStubs, i, j, len, len1, ref; filteredCommandStubs = this._commandStubs.filter(function(commandStub) { return command === commandStub.command && equal(payload, commandStub.payload); }); if (!filteredCommandStubs.length) { return Promise.resolve(); } emitDomainEventAsync = (function(_this) { return function(domainEvent) { return setTimeout(function() { return _this.$emitDomainEvent(domainEvent.eventName, domainEvent.aggregateId, domainEvent.payload); }); }; })(this); for (i = 0, len = filteredCommandStubs.length; i < len; i++) { filteredCommandStub = filteredCommandStubs[i]; ref = filteredCommandStub.domainEvents; for (j = 0, len1 = ref.length; j < len1; j++) { domainEvent = ref[j]; emitDomainEventAsync(domainEvent); } } return Promise.resolve(); }; fakeRemoteContext.query = function() { return Promise.resolve(); }; return fakeRemoteContext; }; return RemoteFactory; })(); module.exports = new RemoteFactory; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { var pSlice = Array.prototype.slice; var objectKeys = __webpack_require__(6); var isArguments = __webpack_require__(7); var deepEqual = module.exports = function (actual, expected, opts) { if (!opts) opts = {}; // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; } else if (actual instanceof Date && expected instanceof Date) { return actual.getTime() === expected.getTime(); // 7.3. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { return opts.strict ? actual === expected : actual == expected; // 7.4. For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified // with Object.prototype.hasOwnProperty.call), the same set of keys // (although not necessarily the same order), equivalent values for every // corresponding key, and an identical 'prototype' property. Note: this // accounts for both named and indexed properties on Arrays. } else { return objEquiv(actual, expected, opts); } } function isUndefinedOrNull(value) { return value === null || value === undefined; } function isBuffer (x) { if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { return false; } if (x.length > 0 && typeof x[0] !== 'number') return false; return true; } function objEquiv(a, b, opts) { var i, key; if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) return false; // an identical 'prototype' property. if (a.prototype !== b.prototype) return false; //~~~I've managed to break Object.keys through screwy arguments passing. // Converting to array solves the problem. if (isArguments(a)) { if (!isArguments(b)) { return false; } a = pSlice.call(a); b = pSlice.call(b); return deepEqual(a, b, opts); } if (isBuffer(a)) { if (!isBuffer(b)) { return false; } if (a.length !== b.length) return false; for (i = 0; i < a.length; i++) { if (a[i] !== b[i]) return false; } return true; } try { var ka = objectKeys(a), kb = objectKeys(b); } catch (e) {//happens when one is a string literal and the other isn't return false; } // having the same number of owned properties (keys incorporates // hasOwnProperty) if (ka.length != kb.length) return false; //the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); //~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] != kb[i]) return false; } //equivalent values for every corresponding key, and //~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!deepEqual(a[key], b[key], opts)) return false; } return typeof a === typeof b; } /***/ }, /* 6 */ /***/ function(module, exports) { exports = module.exports = typeof Object.keys === 'function' ? Object.keys : shim; exports.shim = shim; function shim (obj) { var keys = []; for (var key in obj) keys.push(key); return keys; } /***/ }, /* 7 */ /***/ function(module, exports) { var supportsArgumentsClass = (function(){ return Object.prototype.toString.call(arguments) })() == '[object Arguments]'; exports = module.exports = supportsArgumentsClass ? supported : unsupported; exports.supported = supported; function supported(object) { return Object.prototype.toString.call(object) == '[object Arguments]'; }; exports.unsupported = unsupported; function unsupported(object){ return object && typeof object == 'object' && typeof object.length == 'number' && Object.prototype.hasOwnProperty.call(object, 'callee') && !Object.prototype.propertyIsEnumerable.call(object, 'callee') || false; }; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { (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; /***/ } /******/ ]) }); ; /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(10); /***/ }, /* 10 */ /***/ function(module, exports) { var DomainEvent; DomainEvent = (function() { function DomainEvent(params) { this.id = params.id; this.name = params.name; this.payload = params.payload; this.aggregate = params.aggregate; this.context = params.context; this.timestamp = new Date().getTime(); } return DomainEvent; })(); module.exports = DomainEvent; /***/ } /******/ ]) }); ;