Comparing version 0.0.41 to 0.0.42
{ | ||
"name": "eventric", | ||
"version": "0.0.41", | ||
"version": "0.0.42", | ||
"homepage": "https://github.com/efacilitation/eventric", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -41,6 +41,6 @@ var Aggregate, Repository, async, eventric, _, | ||
aggregate.applyDomainEvents(domainEvents); | ||
aggregate.id = aggregateId; | ||
if (_this._readAggregate) { | ||
aggregate = aggregate.toJSON(); | ||
} | ||
aggregate.id = aggregateId; | ||
return callback(null, aggregate); | ||
@@ -47,0 +47,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
require.register("eventric/aggregate",function(e,t,n){var r,i,o,a,u,s;u=t("eventric"),s=u.require("HelperUnderscore"),i=u.require("HelperClone"),o=u.require("DomainEvent"),a=u.require("HelperObjectDiff"),r=function(){function e(e,t){this._name=e,this._domainEvents=[],this._definition=t,this._oldRoot={},this._root=this._definition?new this._definition.root:{}}return e.prototype.create=function(e){return new Promise(function(t){return function(n,r){var i,o,a,u;if(t.id=t._generateUid(),"function"!=typeof t._root.create){for(a in e)u=e[a],t._root[a]=u;return n()}try{return i=t._root.create(e),i instanceof Promise?(i.then(function(){return n()}),i["catch"](function(e){return r(e)})):n()}catch(s){return o=s,r(o)}}}(this))},e.prototype.command=function(e){return new Promise(function(t){return function(n,r){var i,o,a;if(!(e.name in t._root))return o=new Error("Given commandName '"+e.name+"' not found as method in the "+t._name+" Aggregate Root"),r(o);e.params||(e.params=[]),e.params instanceof Array||(e.params=[e.params]);try{return i=(a=t._root)[e.name].apply(a,e.params),i instanceof Promise?(i.then(function(){return n()}),i["catch"](function(e){return r(e)})):n()}catch(u){return o=u,r(o)}}}(this))},e.prototype._generateUid=function(e){var t,n;return t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)},n=e||"-",t()+t()+n+t()+n+t()+n+t()+n+t()+t()+t()},e.prototype.generateDomainEvent=function(e,t){var n,r,i,u;return null==t&&(t={}),u={name:e,aggregate:{id:this.id,name:this._name}},n=a.calculateDifferences(this._oldRoot,this._root),u.aggregate.diff=n,u.aggregate.changed=a.applyDifferences({},n),i=this._getEntityMap(),Object.keys(i).length>0&&(u.aggregate.entityMap=i),r=new o(u),this._domainEvents.push(r)},e.prototype._getEntityMap=function(){var e,t,n,r;t={},r=this._definition.entities;for(n in r)e=r[n],t[n]=[],this._getPathsToEntityClass(e,this._root,t[n]);return t},e.prototype._getPathsToEntityClass=function(e,t,n,r){return null==r&&(r=[]),t instanceof e&&n.push(r),0===Object.keys(t).length&&(r=[]),s.each(t,function(t){return function(o,a){var u;return u=i(r),u.push(a),s.isObject(o)?t._getPathsToEntityClass(e,o,n,u):void 0}}(this)),r},e.prototype.getDomainEvents=function(){return this._domainEvents},e.prototype.applyDomainEvents=function(e){var t,n,r;for(n=0,r=e.length;r>n;n++)t=e[n],this._applyDomainEvent(t);return this._oldRoot=i(this._root)},e.prototype._applyDomainEvent=function(e){return e.aggregate.diff?a.applyDifferences(this._root,e.aggregate.diff):void 0},e.prototype.toJSON=function(){return i(this._root)},e}(),n.exports=r}),require.register("eventric/aggregate_service",function(e,t,n){var r,i,o,a,u,s,c=[].slice;u=t("eventric"),s=u.require("HelperUnderscore"),a=u.require("HelperAsync"),o=u.require("Repository"),r=u.require("Aggregate"),i=function(){function e(){}return e.prototype._aggregateDefinitions={},e.prototype.initialize=function(e,t){var n,r,i,o,u;this._eventStore=e,this._domainEventService=t,o=a.queue(function(e){return function(t,n){var r;return(r=t.originalFunction).call.apply(r,[e].concat(c.call(t.arguments))).then(function(e){return t.resolve(e),n()})["catch"](function(e){return t.reject(e),n(e)})}}(this),1),i=function(e,t){return function(){var e;return e=arguments,new Promise(function(n,r){return o.push({originalFunction:t,arguments:e,resolve:n,reject:r})})}},u=[];for(r in this)n=this[r],u.push("command"===r||"create"===r?this[r]=i(r,n):void 0);return u},e.prototype.create=function(e){return new Promise(function(t){return function(n,i){var o,a,u,s,c;return u=e.name,s=e.props,(a=t.getAggregateDefinition(u))?(o=new r(u,a),o.create(s).then(function(){return t._generateSaveAndTriggerDomainEvent(o,"create",n,i)})["catch"](function(e){return i(e)})):(c=new Error("Tried to create not registered AggregateDefinition '"+u+"'"),i(c))}}(this))},e.prototype.command=function(e){return new Promise(function(t){return function(n,r){var i,a,u,s,c,f,p;return a=e.id,u=e.name,c=e.methodName,f=e.methodParams,(i=t.getAggregateDefinition(u))?(p=new o({aggregateName:u,aggregateDefinition:i,eventStore:t._eventStore}),p.findById(a,function(e,i){return e?r(e):i?(f||(f=[]),i.command({name:c,params:f}).then(function(){return t._generateSaveAndTriggerDomainEvent(i,c,n,r)})["catch"](function(e){return r(e)})):(e=new Error("No "+u+" Aggregate with given aggregateId "+a+" found"),r(e))})):(s=new Error("Tried to command not registered AggregateDefinition '"+u+"'"),r(s))}}(this))},e.prototype._generateSaveAndTriggerDomainEvent=function(e,t,n,r){var i;return e.generateDomainEvent(t),i=e.getDomainEvents(),this._domainEventService.saveAndTrigger(i,function(){return function(t){return t?r(t):n(e.id)}}(this))},e.prototype.registerAggregateDefinition=function(e,t){return this._aggregateDefinitions[e]=t},e.prototype.getAggregateDefinition=function(e){return this._aggregateDefinitions[e]},e}(),n.exports=i}),require.register("eventric/bounded_context",function(e,t,n){var r,i,o,a,u,s;u=t("eventric"),s=u.require("HelperUnderscore"),r=u.require("AggregateService"),a=u.require("Repository"),o=u.require("DomainEventService"),i=function(){function e(){}return e.prototype._di={},e.prototype._params={},e.prototype._aggregateDefinitions={},e.prototype._readAggregateDefinitions={},e.prototype._repositories={},e.prototype._repositoryInstances={},e.prototype._adapters={},e.prototype._adapterInstances={},e.prototype._applicationServiceCommands={},e.prototype._applicationServiceQueries={},e.prototype._domainEventHandlers={},e.prototype.initialize=function(){return this._initializeEventStore(),this._domainEventService=new o,this._domainEventService.initialize(this._eventStore),this._initializeDomainEventHandlers(),this._aggregateService=new r,this._aggregateService.initialize(this._eventStore,this._domainEventService),this._initializeAggregateService(),this._di={aggregate:this._aggregateService,repository:function(e){return function(){return e.getRepository.apply(e,arguments)}}(this),adapter:function(e){return function(){return e.getAdapter.apply(e,arguments)}}(this)},this},e.prototype._initializeEventStore=function(){var e;if(this._params.store)return this._eventStore=this._params.store;if(e=u.get("store"))return this._eventStore=e;throw new Error("Missing Event Store for Bounded Context")},e.prototype._initializeDomainEventHandlers=function(){var e,t,n,r,i;r=this._domainEventHandlers,i=[];for(e in r)n=r[e],i.push(function(){var r,i,o;for(o=[],r=0,i=n.length;i>r;r++)t=n[r],o.push(this._domainEventService.on(e,t));return o}.call(this));return i},e.prototype._initializeAggregateService=function(){var e,t,n,r;n=this._aggregateDefinitions,r=[];for(t in n)e=n[t],r.push(this._aggregateService.registerAggregateDefinition(t,e));return r},e.prototype.set=function(e,t){return this._params[e]=t,this},e.prototype.addApplicationService=function(e){var t,n;for(t in e)switch(n=e[t],t){case"commands":this.addCommands(e[t]);break;case"queries":this.addQueries(e[t])}return this},e.prototype.addCommand=function(e,t){return this._applicationServiceCommands[e]=function(e){return function(){return t.apply(e._di,arguments)}}(this),this},e.prototype.addCommands=function(e){var t,n;for(n in e)t=e[n],this.addCommand(n,t);return this},e.prototype.addQuery=function(e,t){return this._applicationServiceQueries[e]=function(e){return function(){return t.apply(e._di,arguments)}}(this),this},e.prototype.addQueries=function(e){var t,n;for(n in e)t=e[n],this.addQuery(n,t);return this},e.prototype.addAggregate=function(e,t){return this._aggregateDefinitions[e]=t,this},e.prototype.addReadAggregate=function(e,t){return this._readAggregateDefinitions[e]=t,this},e.prototype.addRepository=function(e,t){return this._repositories[e]=t,this},e.prototype.addDomainEventHandler=function(e,t){return this._domainEventHandlers[e]||(this._domainEventHandlers[e]=[]),this._domainEventHandlers[e].push(function(e){return function(){return t.apply(e._di,arguments)}}(this)),this},e.prototype.addAdapter=function(e,t){return this._adapters[e]=t,this},e.prototype.addAdapters=function(e){var t,n;for(t in e)n=e[t],this.addAdapter(t,n);return this},e.prototype.getRepository=function(e){var t,n;return this._repositoryInstances[e]?this._repositoryInstances[e]:(n={aggregateName:e,eventStore:this._eventStore,readAggregate:!0},this._readAggregateDefinitions[e]&&(n.aggregateDefinition=this._readAggregateDefinitions[e]),t=new a(n),this._repositories[e]&&s.extend(t,this._repositories[e]),this._repositoryInstances[e]=t,t)},e.prototype.getAdapter=function(e){var t;return this._adapterInstances[e]?this._adapterInstances[e]:(t=new this._adapters[e],"function"==typeof t.initialize&&t.initialize(),this._adapterInstances[e]=t,t)},e.prototype.command=function(e,t){return new Promise(function(n){return function(r,i){var o;return n._applicationServiceCommands[e.name]?n._applicationServiceCommands[e.name](e.params,function(e,n){return r(n),"function"==typeof t?t(e,n):void 0}):(o=new Error("Given command "+e.name+" not registered on bounded context"),i(o),"function"==typeof t?t(o,null):void 0)}}(this))},e.prototype.query=function(e,t){return new Promise(function(n){return function(r,i){var o,a;return n._applicationServiceQueries[e.name]?n._applicationServiceQueries[e.name](e.params,function(e,n){return r(n),"function"==typeof t?t(e,n):void 0}):(a="Given query "+e.name+" not registered on bounded context",o=new Error(a),i(o),"function"==typeof t?t(o,null):void 0)}}(this))},e}(),n.exports=i}),require.register("eventric/domain_event",function(e,t,n){var r;r=function(){function e(e){this.name=e.name,this.timestamp=(new Date).getTime(),this.aggregate=e.aggregate}return e.prototype.getAggregateChanges=function(){return this.aggregate.changed},e.prototype.getAggregateName=function(){return this.aggregate.name},e.prototype.getAggregateId=function(){return this.aggregate.id},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getName=function(){return this.name},e}(),n.exports=r}),require.register("eventric/domain_event_service",function(e,t,n){var r,i,o,a,u;a=t("eventric"),o=a.require("HelperAsync"),i=a.require("HelperEvents"),u=a.require("HelperUnderscore"),r=function(){function e(){}return u.extend(e.prototype,i),e.prototype.initialize=function(e){this._eventStore=e},e.prototype.saveAndTrigger=function(e,t){return o.eachSeries(e,function(e){return function(t,n){return e._eventStore.save(t,function(r){var i,o,a;return r?n(r):(a=t.getName(),i=t.getAggregateId(),o=t.getAggregateName(),e.trigger("DomainEvent",t),e.trigger(o,t),e.trigger(""+o+":"+a,t),e.trigger(""+o+"/"+i,t),e.trigger(""+o+":"+a+"/"+i,t),n(null))})}}(this),function(){return function(e){return t(e?e:null)}}(this))},e}(),n.exports=r}),require.register("eventric/index",function(e,t,n){var r;t("./helper/promise"),r={BoundedContext:"./bounded_context",Aggregate:"./aggregate",AggregateService:"./aggregate_service",ReadAggregate:"./read_aggregate",ReadAggregateEntity:"./read_aggregate_entity",DomainEvent:"./domain_event",DomainEventService:"./domain_event_service",RemoteService:"./remote_service",RemoteBoundedContext:"./remote_bounded_context",Repository:"./repository",HelperAsync:"./helper/async",HelperEvents:"./helper/events",HelperUnderscore:"./helper/underscore",HelperClone:"./helper/clone",HelperObjectDiff:"./helper/diff2"},n.exports={_params:{},_domainEventHandlers:{},require:function(e){var n,i,o;i=null!=(o=r[e])?o:e;try{return t(i)}catch(a){throw n=a,console.log(n),n}},set:function(e,t){return this._params[e]=t},get:function(e){return this._params[e]},boundedContext:function(e){var t,n;if(!e)throw new Error("BoundedContexts must have a name");return t=this.require("BoundedContext"),n=new t,n.addDomainEventHandler("DomainEvent",function(t){return function(n){var r,i,o,a,u,s;if(t._domainEventHandlers[e]&&(i=n.getAggregateName()+":"+n.getName(),t._domainEventHandlers[e][i])){for(u=t._domainEventHandlers[e][i],s=[],o=0,a=u.length;a>o;o++)r=u[o],s.push(r(n));return s}}}(this)),n},addDomainEventHandler:function(e,t,n){return this._domainEventHandlers[e]||(this._domainEventHandlers[e]={}),this._domainEventHandlers[e][t]||(this._domainEventHandlers[e][t]=[]),this._domainEventHandlers[e][t].push(n)}}}),require.register("eventric/remote_bounded_context",function(e,t,n){var r,i,o;i=t("eventric"),o=i.require("HelperUnderscore"),r=function(){function e(e){this._remoteService=e}return e.prototype._boundedContextObjs={},e.prototype.command=function(e,t,n){return this.rpc({boundedContextName:e,method:"command",params:t},n)},e.prototype.query=function(e,t,n){return this.rpc({boundedContextName:e,method:"query",params:t},n)},e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteBoundedContext",e,t)},e.prototype.handle=function(e,t){var n,r;return n=this.getBoundedContextObj(e.boundedContextName),n?e.method in n?n[e.method](e.params,t):(r=new Error("RPC method "+e.method+" not found on Class "+e.boundedContextName),t(r,null)):(r=new Error("Tried to handle RPC class with not registered boundedContext "+e.boundedContextName),t(r,null))},e.prototype.registerBoundedContextObj=function(e,t){return this._boundedContextObjs[e]=t},e.prototype.getBoundedContextObj=function(e){return e in this._boundedContextObjs?this._boundedContextObjs[e]:!1},e}(),n.exports=r}),require.register("eventric/remote_service",function(e,t,n){var r;r=function(){function e(e){this._adapter=e,this._serviceHandlers={}}return e.prototype.rpc=function(e,t,n){var r;return r={service:e,payload:t},this._adapter.rpc(r,n)},e.prototype.handle=function(e,t){var n,r;return r=this.getServiceHandler(e.service),r?"handle"in r?r.handle(e.payload,t):(n=new Error("Service "+e.service+" has no handle method"),t(n,null)):(n=new Error("Tried to handle RPC call with not registered service "+e.service),t(n,null))},e.prototype.registerServiceHandler=function(e,t){return this._serviceHandlers[e]=t},e.prototype.getServiceHandler=function(e){return e in this._serviceHandlers?this._serviceHandlers[e]:!1},e}(),n.exports=r}),require.register("eventric/repository",function(e,t,n){var r,i,o,a,u,s=function(e,t){return function(){return e.apply(t,arguments)}},c=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};a=t("eventric"),u=a.require("HelperUnderscore"),o=a.require("HelperAsync"),r=a.require("Aggregate"),i=function(){function e(e){this.findIds=s(this.findIds,this),this.findById=s(this.findById,this);var t,n;this._aggregateName=e.aggregateName,this._aggregateDefinition=null!=(t=e.aggregateDefinition)?t:!1,this._eventStore=e.eventStore,this._readAggregate=null!=(n=e.readAggregate)?n:!1}return e.prototype.findById=function(e,t){return this._callbackIsAFunction(t)?this._eventStore.find(this._aggregateName,{"aggregate.id":e},function(n){return function(i,o){var a;return i?t(i,null):0===o.length?t(null,[]):(a=new r(n._aggregateName,n._aggregateDefinition),a.applyDomainEvents(o),a.id=e,n._readAggregate&&(a=a.toJSON()),t(null,a))}}(this)):void 0},e.prototype.find=function(e,t){return this._callbackIsAFunction(t)?this.findIds(e,function(e){return function(n,r){var i;return n?t(n,null):(i=[],o.whilst(function(){return r.length>0},function(t){var n;return n=r.shift(),e.findById(n,function(e,n){return e?t(e):0===n.length?t(null):(i.push(n),t(null))})},function(e){return e?t(e,null):t(null,i)}))}}(this)):void 0},e.prototype.findOne=function(e,t){return this._callbackIsAFunction(t)?this.find(e,function(){return function(e,n){return e?t(e,null):0===n.length?t(null,!1):t(null,n[0])}}(this)):void 0},e.prototype.findIds=function(e,t){return this._callbackIsAFunction(t)?this._eventStore.find(this._aggregateName,e,{"aggregate.id":1},function(){return function(e,n){var r,i,o,a,u;if(e)return t(e,null);for(r=[],o=0,a=n.length;a>o;o++)i=n[o],u=i.aggregate.id,c.call(r,u)<0&&r.push(i.aggregate.id);return t(null,r)}}(this)):void 0},e.prototype._callbackIsAFunction=function(e){if("function"==typeof e)return!0;throw new Error("No callback provided")},e}(),n.exports=i}),require.register("eventric/helper/async",function(e,t,n){!function(){function e(e){var n=!1;return function(){if(n)throw new Error("Callback was already called.");n=!0,e.apply(t,arguments)}}var t,r,i={};t=this,null!=t&&(r=t.async),i.noConflict=function(){return t.async=r,i};var o=Object.prototype.toString,a=Array.isArray||function(e){return"[object Array]"===o.call(e)},u=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n+=1)t(e[n],n,e)};"undefined"!=typeof process&&process.nextTick?(i.nextTick=process.nextTick,i.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:i.nextTick):"function"==typeof setImmediate?(i.nextTick=function(e){setImmediate(e)},i.setImmediate=i.nextTick):(i.nextTick=function(e){setTimeout(e,0)},i.setImmediate=i.nextTick),i.eachSeries=function(e,t,n){if(n=n||function(){},!e.length)return n();var r=0,i=function(){t(e[r],function(t){t?(n(t),n=function(){}):(r+=1,r>=e.length?n():i())})};i()},i.forEachSeries=i.eachSeries,i.iterator=function(e){var t=function(n){var r=function(){return e.length&&e[n].apply(null,arguments),r.next()};return r.next=function(){return n<e.length-1?t(n+1):null},r};return t(0)},i.whilst=function(e,t,n){e()?t(function(r){return r?n(r):void i.whilst(e,t,n)}):n()},i.queue=function(t,n){function r(e,t,n,r){return e.started||(e.started=!0),a(t)||(t=[t]),0==t.length?i.setImmediate(function(){e.drain&&e.drain()}):void u(t,function(t){var o={data:t,callback:"function"==typeof r?r:null};n?e.tasks.unshift(o):e.tasks.push(o),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),i.setImmediate(e.process)})}void 0===n&&(n=1);var o=0,s={tasks:[],concurrency:n,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(e,t){r(s,e,!1,t)},kill:function(){s.drain=null,s.tasks=[]},unshift:function(e,t){r(s,e,!0,t)},process:function(){if(!s.paused&&o<s.concurrency&&s.tasks.length){var n=s.tasks.shift();s.empty&&0===s.tasks.length&&s.empty(),o+=1;var r=function(){o-=1,n.callback&&n.callback.apply(n,arguments),s.drain&&s.tasks.length+o===0&&s.drain(),s.process()},i=e(r);t(n.data,i)}},length:function(){return s.tasks.length},running:function(){return o},idle:function(){return s.tasks.length+o===0},pause:function(){s.paused!==!0&&(s.paused=!0,s.process())},resume:function(){s.paused!==!1&&(s.paused=!1,s.process())}};return s},n.exports=i}()}),require.register("eventric/helper/clone",function(e,t,n){"use strict";function r(e){return Object.prototype.toString.call(e)}function i(e,t,n,r){function i(e,n){if(null===e)return null;if(0==n)return e;var c;if("object"!=typeof e)return e;if(o.isArray(e)?c=[]:o.isRegExp(e)?(c=new RegExp(e.source,o.getRegExpFlags(e)),e.lastIndex&&(c.lastIndex=e.lastIndex)):o.isDate(e)?c=new Date(e.getTime()):s&&Buffer.isBuffer(e)?(c=new Buffer(e.length),e.copy(c)):c=Object.create("undefined"==typeof r?Object.getPrototypeOf(e):r),t){var f=a.indexOf(e);if(-1!=f)return u[f];a.push(e),u.push(c)}for(var p in e)c[p]=i(e[p],n-1);return c}var a=[],u=[],s="undefined"!=typeof Buffer;return"undefined"==typeof t&&(t=!0),"undefined"==typeof n&&(n=1/0),i(e,n)}var o={isArray:function(e){return Array.isArray(e)||"object"==typeof e&&"[object Array]"===r(e)},isDate:function(e){return"object"==typeof e&&"[object Date]"===r(e)},isRegExp:function(e){return"object"==typeof e&&"[object RegExp]"===r(e)},getRegExpFlags:function(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}};"object"==typeof n&&(n.exports=i),i.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},n.exports=i}),require.register("eventric/helper/diff2",function(e,t,n){var r;r=function(){function e(){}return e.DIFFERENCE_TYPES={ADDED:"added",DELETED:"deleted",CHANGED:"changed"},e.prototype.calculateDifferences=function(t,n,r,i){var o,a,u;return null==r&&(r=""),null==i&&(i=[]),o=this._getType(n),a=this._getType(t),""!==r&&(u={key:r,valueType:o},i=[].concat(i,[u])),"function"==typeof t||"function"==typeof n?[]:t?n?a!==o?[this._createDifference(e.DIFFERENCE_TYPES.CHANGED,i,n)]:"object"==typeof t?this._getNestedDifferences(t,n,r,i):n!==t?[this._createDifference(e.DIFFERENCE_TYPES.CHANGED,i,n)]:[]:[this._createDifference(e.DIFFERENCE_TYPES.DELETED,i)]:[this._createDifference(e.DIFFERENCE_TYPES.ADDED,i,n)]},e.prototype._createDifference=function(e,t,n){return{type:e,path:t,value:n}},e.prototype._getNestedDifferences=function(e,t,n,r){var i,o;return null==n&&(n=""),null==r&&(r=[]),i=this._union(Object.keys(e),Object.keys(t)),o=i.map(function(n){return function(i){return n.calculateDifferences(e[i],t[i],i,r)}}(this)),this._flatten(o)},e.prototype._union=function(e,t){return e.concat(t.filter(function(t){return-1===e.indexOf(t)}))},e.prototype._flatten=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},e.prototype._getType=function(e){var t;return t=typeof e,"object"===t&&this._isArray(e)?"array":t},e.prototype._isArray=function(e){return"[object Array]"==={}.toString.call(e)},e.prototype.applyDifferences=function(t,n){var r;return r=this._clone(n),r.forEach(function(n){return function(r){var i,o;return i=r.path.pop().key,o=r.path.reduce(function(e,t){return e[t.key]||n._createValue(e,t.key,t.valueType),e[t.key]},t),r.type===e.DIFFERENCE_TYPES.CHANGED||r.type===e.DIFFERENCE_TYPES.ADDED?o[i]=r.value:delete o[i]}}(this)),t},e.prototype._createValue=function(e,t,n){return e[t]=this._createFromType(n)},e.prototype._createFromType=function(e){return"object"===e?{}:"array"===e?[]:void 0},e.prototype._clone=function(e){var t;return t=null,"object"==typeof e?(t=this._createFromType(this._getType(e)),Object.keys(e).forEach(function(n){return function(r){return t[r]=n._clone(e[r])}}(this))):t=e,t},e}(),n.exports=new r}),require.register("eventric/helper/events",function(e,t,n){eventric=t("eventric"),_=eventric.require("HelperUnderscore"),array=[],slice=array.slice;var r=HelperEvents={on:function(e,t,n){if(!o(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!o(this,"once",e,[t,n])||!t)return this;var r=this,i=_.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){if(!this._events||!o(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events=void 0,this;for(var r=e?[e]:_.keys(this._events),i=0,a=r.length;a>i;i++){e=r[i];var u=this._events[e];if(u)if(t||n){for(var s=[],c=0,f=u.length;f>c;c++){var p=u[c];(t&&t!==p.callback&&t!==p.callback._callback||n&&n!==p.context)&&s.push(p)}s.length?this._events[e]=s:delete this._events[e]}else delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=slice.call(arguments,1);if(!o(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&a(n,t),r&&a(r,arguments),this},stopListening:function(e,t,n){var r=this._listeningTo;if(!r)return this;var i=!t&&!n;n||"object"!=typeof t||(n=this),e&&((r={})[e._listenId]=e);for(var o in r)e=r[o],e.off(t,n,this),(i||_.isEmpty(e._events))&&delete this._listeningTo[o];return this}},i=/\s+/,o=function(e,t,n,r){if(!n)return!0;if("object"==typeof n){for(var o in n)e[t].apply(e,[o,n[o]].concat(r));return!1}if(i.test(n)){for(var a=n.split(i),u=0,s=a.length;s>u;u++)e[t].apply(e,[a[u]].concat(r));return!1}return!0},a=function(e,t){var n,r=-1,i=e.length,o=t[0],a=t[1],u=t[2];switch(t.length){case 0:for(;++r<i;)(n=e[r]).callback.call(n.ctx);return;case 1:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o);return;case 2:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,a);return;case 3:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,a,u);return;default:for(;++r<i;)(n=e[r]).callback.apply(n.ctx,t);return}},u={listenTo:"on",listenToOnce:"once"};_.each(u,function(e,t){r[t]=function(t,n,r){var i=this._listeningTo||(this._listeningTo={}),o=t._listenId||(t._listenId=_.uniqueId("l"));return i[o]=t,r||"object"!=typeof n||(r=this),t[e](n,r,this),this}}),r.bind=r.on,r.unbind=r.off,n.exports=HelperEvents}),require.register("eventric/helper/promise",function(){!function(){var e,t,n,r;!function(){var i={},o={};e=function(e,t,n){i[e]={deps:t,callback:n}},r=n=t=function(e){function n(t){if("."!==t.charAt(0))return t;for(var n=t.split("/"),r=e.split("/").slice(0,-1),i=0,o=n.length;o>i;i++){var a=n[i];if(".."===a)r.pop();else{if("."===a)continue;r.push(a)}}return r.join("/")}if(r._eak_seen=i,o[e])return o[e];if(o[e]={},!i[e])throw new Error("Could not find module "+e);for(var a,u=i[e],s=u.deps,c=u.callback,f=[],p=0,l=s.length;l>p;p++)f.push("exports"===s[p]?a={}:t(n(s[p])));var g=c.apply(this,f);return o[e]=a||g}}(),e("promise/all",["./utils","exports"],function(e,t){"use strict";function n(e){var t=this;if(!r(e))throw new TypeError("You must pass an array to all.");return new t(function(t,n){function r(e){return function(t){o(e,t)}}function o(e,n){u[e]=n,0===--s&&t(u)}var a,u=[],s=e.length;0===s&&t([]);for(var c=0;c<e.length;c++)a=e[c],a&&i(a.then)?a.then(r(c),n):o(c,a)})}var r=e.isArray,i=e.isFunction;t.all=n}),e("promise/asap",["exports"],function(e){"use strict";function t(){return function(){process.nextTick(i)}}function n(){var e=0,t=new s(i),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function r(){return function(){c.setTimeout(i,1)}}function i(){for(var e=0;e<f.length;e++){var t=f[e],n=t[0],r=t[1];n(r)}f=[]}function o(e,t){var n=f.push([e,t]);1===n&&a()}var a,u="undefined"!=typeof window?window:{},s=u.MutationObserver||u.WebKitMutationObserver,c="undefined"!=typeof global?global:void 0===this?window:this,f=[];a="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?t():s?n():r(),e.asap=o}),e("promise/config",["exports"],function(e){"use strict";function t(e,t){return 2!==arguments.length?n[e]:void(n[e]=t)}var n={instrument:!1};e.config=n,e.configure=t}),e("promise/polyfill",["./promise","./utils","exports"],function(e,t,n){"use strict";function r(){var e;e="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var t="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),o(t)}();t||(e.Promise=i)}var i=e.Promise,o=t.isFunction;n.polyfill=r}),e("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(e,t,n,r,i,o,a,u){"use strict";function s(e){if(!b(e))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof s))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],c(e,this)}function c(e,t){function n(e){h(t,e)}function r(e){v(t,e)}try{e(n,r)}catch(i){r(i)}}function f(e,t,n,r){var i,o,a,u,s=b(n);if(s)try{i=n(r),a=!0}catch(c){u=!0,o=c}else i=r,a=!0;g(t,i)||(s&&a?h(t,i):u?v(t,o):e===T?h(t,i):e===C&&v(t,i))}function p(e,t,n,r){var i=e._subscribers,o=i.length;i[o]=t,i[o+T]=n,i[o+C]=r}function l(e,t){for(var n,r,i=e._subscribers,o=e._detail,a=0;a<i.length;a+=3)n=i[a],r=i[a+t],f(t,n,r,o);e._subscribers=null}function g(e,t){var n,r=null;try{if(e===t)throw new TypeError("A promises callback cannot return that same promise.");if(E(t)&&(r=t.then,b(r)))return r.call(t,function(r){return n?!0:(n=!0,void(t!==r?h(e,r):d(e,r)))},function(t){return n?!0:(n=!0,void v(e,t))}),!0}catch(i){return n?!0:(v(e,i),!0)}return!1}function h(e,t){e===t?d(e,t):g(e,t)||d(e,t)}function d(e,t){e._state===j&&(e._state=k,e._detail=t,_.async(y,e))}function v(e,t){e._state===j&&(e._state=k,e._detail=t,_.async(m,e))}function y(e){l(e,e._state=T)}function m(e){l(e,e._state=C)}var _=e.config,E=(e.configure,t.objectOrFunction),b=t.isFunction,w=(t.now,n.all),x=r.race,D=i.resolve,A=o.reject,S=a.asap;_.async=S;var j=void 0,k=0,T=1,C=2;s.prototype={constructor:s,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(e,t){var n=this,r=new this.constructor(function(){});if(this._state){var i=arguments;_.async(function(){f(n._state,r,i[n._state-1],n._detail)})}else p(this,r,e,t);return r},"catch":function(e){return this.then(null,e)}},s.all=w,s.race=x,s.resolve=D,s.reject=A,u.Promise=s}),e("promise/race",["./utils","exports"],function(e,t){"use strict";function n(e){var t=this;if(!r(e))throw new TypeError("You must pass an array to race.");return new t(function(t,n){for(var r,i=0;i<e.length;i++)r=e[i],r&&"function"==typeof r.then?r.then(t,n):t(r)})}var r=e.isArray;t.race=n}),e("promise/reject",["exports"],function(e){"use strict";function t(e){var t=this;return new t(function(t,n){n(e)})}e.reject=t}),e("promise/resolve",["exports"],function(e){"use strict";function t(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=this;return new t(function(t){t(e)})}e.resolve=t}),e("promise/utils",["exports"],function(e){"use strict";function t(e){return n(e)||"object"==typeof e&&null!==e}function n(e){return"function"==typeof e}function r(e){return"[object Array]"===Object.prototype.toString.call(e)}var i=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=t,e.isFunction=n,e.isArray=r,e.now=i}),t("promise/polyfill").polyfill()}()}),require.register("eventric/helper/underscore",function(e,t,n){(function(){var t=this,r=t._,i={},o=Array.prototype,a=Object.prototype,u=Function.prototype,s=o.push,c=o.slice,f=(o.concat,a.toString),p=a.hasOwnProperty,l=Array.isArray,g=Object.keys,h=(u.bind,function(e){return e instanceof h?e:this instanceof h?void(this._wrapped=e):new h(e)});"undefined"!=typeof e?("undefined"!=typeof n&&n.exports&&(e=n.exports=h),e._=h):t._=h,h.VERSION="1.6.0",h.each=h.forEach=function(e,t,n){if(null==e)return e;if(e.length===+e.length){for(var r=0,o=e.length;o>r;r++)if(t.call(n,e[r],r,e)===i)return}else for(var a=h.keys(e),r=0,o=a.length;o>r;r++)if(t.call(n,e[a[r]],a[r],e)===i)return;return e},h.keys=function(e){if(!h.isObject(e))return[];if(g)return g(e);var t=[];for(var n in e)h.has(e,n)&&t.push(n);return t},h.invert=function(e){for(var t={},n=h.keys(e),r=0,i=n.length;i>r;r++)t[e[n[r]]]=n[r];return t},h.functions=h.methods=function(e){var t=[];for(var n in e)h.isFunction(e[n])&&t.push(n);return t.sort()},h.extend=function(e){return h.isObject(e)?(h.each(c.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e):e},h.defaults=function(e){return h.isObject(e)?(h.each(c.call(arguments,1),function(t){for(var n in t)void 0===e[n]&&(e[n]=t[n])}),e):e},h.isEqual=function(e,t){return eq(e,t,[],[])},h.isEmpty=function(e){if(null==e)return!0;if(h.isArray(e)||h.isString(e)||h.isArguments(e))return 0===e.length;for(var t in e)if(h.has(e,t))return!1;return!0},h.isElement=function(e){return!(!e||1!==e.nodeType)},h.isArray=l||function(e){return"[object Array]"==f.call(e)},h.isObject=function(e){return e===Object(e)},h.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){h["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),h.isArguments(arguments)||(h.isArguments=function(e){return h.has(e,"callee")}),"function"!=typeof/./&&(h.isFunction=function(e){return"function"==typeof e}),h.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},h.isNaN=function(e){return h.isNumber(e)&&e!=+e},h.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==f.call(e)},h.isNull=function(e){return null===e},h.isUndefined=function(e){return void 0===e},h.has=function(e,t){return null!=e&&p.call(e,t)},h.noConflict=function(){return t._=r,this},h.identity=function(e){return e},h.constant=function(e){return function(){return e}},h.noop=function(){},h.property=function(e){return function(t){return t[e]}},h.matches=function(e){return function(t){if(null==t)return h.isEmpty(e);if(t===e)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0}},h.times=function(e,t,n){for(var r=Array(Math.max(0,e)),i=0;e>i;i++)r[i]=t.call(n,i);return r},h.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1)) | ||
require.register("eventric/aggregate",function(e,t,n){var r,i,o,a,u,s;u=t("eventric"),s=u.require("HelperUnderscore"),i=u.require("HelperClone"),o=u.require("DomainEvent"),a=u.require("HelperObjectDiff"),r=function(){function e(e,t){this._name=e,this._domainEvents=[],this._definition=t,this._oldRoot={},this._root=this._definition?new this._definition.root:{}}return e.prototype.create=function(e){return new Promise(function(t){return function(n,r){var i,o,a,u;if(t.id=t._generateUid(),"function"!=typeof t._root.create){for(a in e)u=e[a],t._root[a]=u;return n()}try{return i=t._root.create(e),i instanceof Promise?(i.then(function(){return n()}),i["catch"](function(e){return r(e)})):n()}catch(s){return o=s,r(o)}}}(this))},e.prototype.command=function(e){return new Promise(function(t){return function(n,r){var i,o,a;if(!(e.name in t._root))return o=new Error("Given commandName '"+e.name+"' not found as method in the "+t._name+" Aggregate Root"),r(o);e.params||(e.params=[]),e.params instanceof Array||(e.params=[e.params]);try{return i=(a=t._root)[e.name].apply(a,e.params),i instanceof Promise?(i.then(function(){return n()}),i["catch"](function(e){return r(e)})):n()}catch(u){return o=u,r(o)}}}(this))},e.prototype._generateUid=function(e){var t,n;return t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)},n=e||"-",t()+t()+n+t()+n+t()+n+t()+n+t()+t()+t()},e.prototype.generateDomainEvent=function(e,t){var n,r,i,u;return null==t&&(t={}),u={name:e,aggregate:{id:this.id,name:this._name}},n=a.calculateDifferences(this._oldRoot,this._root),u.aggregate.diff=n,u.aggregate.changed=a.applyDifferences({},n),i=this._getEntityMap(),Object.keys(i).length>0&&(u.aggregate.entityMap=i),r=new o(u),this._domainEvents.push(r)},e.prototype._getEntityMap=function(){var e,t,n,r;t={},r=this._definition.entities;for(n in r)e=r[n],t[n]=[],this._getPathsToEntityClass(e,this._root,t[n]);return t},e.prototype._getPathsToEntityClass=function(e,t,n,r){return null==r&&(r=[]),t instanceof e&&n.push(r),0===Object.keys(t).length&&(r=[]),s.each(t,function(t){return function(o,a){var u;return u=i(r),u.push(a),s.isObject(o)?t._getPathsToEntityClass(e,o,n,u):void 0}}(this)),r},e.prototype.getDomainEvents=function(){return this._domainEvents},e.prototype.applyDomainEvents=function(e){var t,n,r;for(n=0,r=e.length;r>n;n++)t=e[n],this._applyDomainEvent(t);return this._oldRoot=i(this._root)},e.prototype._applyDomainEvent=function(e){return e.aggregate.diff?a.applyDifferences(this._root,e.aggregate.diff):void 0},e.prototype.toJSON=function(){return i(this._root)},e}(),n.exports=r}),require.register("eventric/aggregate_service",function(e,t,n){var r,i,o,a,u,s,c=[].slice;u=t("eventric"),s=u.require("HelperUnderscore"),a=u.require("HelperAsync"),o=u.require("Repository"),r=u.require("Aggregate"),i=function(){function e(){}return e.prototype._aggregateDefinitions={},e.prototype.initialize=function(e,t){var n,r,i,o,u;this._eventStore=e,this._domainEventService=t,o=a.queue(function(e){return function(t,n){var r;return(r=t.originalFunction).call.apply(r,[e].concat(c.call(t.arguments))).then(function(e){return t.resolve(e),n()})["catch"](function(e){return t.reject(e),n(e)})}}(this),1),i=function(e,t){return function(){var e;return e=arguments,new Promise(function(n,r){return o.push({originalFunction:t,arguments:e,resolve:n,reject:r})})}},u=[];for(r in this)n=this[r],u.push("command"===r||"create"===r?this[r]=i(r,n):void 0);return u},e.prototype.create=function(e){return new Promise(function(t){return function(n,i){var o,a,u,s,c;return u=e.name,s=e.props,(a=t.getAggregateDefinition(u))?(o=new r(u,a),o.create(s).then(function(){return t._generateSaveAndTriggerDomainEvent(o,"create",n,i)})["catch"](function(e){return i(e)})):(c=new Error("Tried to create not registered AggregateDefinition '"+u+"'"),i(c))}}(this))},e.prototype.command=function(e){return new Promise(function(t){return function(n,r){var i,a,u,s,c,f,p;return a=e.id,u=e.name,c=e.methodName,f=e.methodParams,(i=t.getAggregateDefinition(u))?(p=new o({aggregateName:u,aggregateDefinition:i,eventStore:t._eventStore}),p.findById(a,function(e,i){return e?r(e):i?(f||(f=[]),i.command({name:c,params:f}).then(function(){return t._generateSaveAndTriggerDomainEvent(i,c,n,r)})["catch"](function(e){return r(e)})):(e=new Error("No "+u+" Aggregate with given aggregateId "+a+" found"),r(e))})):(s=new Error("Tried to command not registered AggregateDefinition '"+u+"'"),r(s))}}(this))},e.prototype._generateSaveAndTriggerDomainEvent=function(e,t,n,r){var i;return e.generateDomainEvent(t),i=e.getDomainEvents(),this._domainEventService.saveAndTrigger(i,function(){return function(t){return t?r(t):n(e.id)}}(this))},e.prototype.registerAggregateDefinition=function(e,t){return this._aggregateDefinitions[e]=t},e.prototype.getAggregateDefinition=function(e){return this._aggregateDefinitions[e]},e}(),n.exports=i}),require.register("eventric/bounded_context",function(e,t,n){var r,i,o,a,u,s;u=t("eventric"),s=u.require("HelperUnderscore"),r=u.require("AggregateService"),a=u.require("Repository"),o=u.require("DomainEventService"),i=function(){function e(){}return e.prototype._di={},e.prototype._params={},e.prototype._aggregateDefinitions={},e.prototype._readAggregateDefinitions={},e.prototype._repositories={},e.prototype._repositoryInstances={},e.prototype._adapters={},e.prototype._adapterInstances={},e.prototype._applicationServiceCommands={},e.prototype._applicationServiceQueries={},e.prototype._domainEventHandlers={},e.prototype.initialize=function(){return this._initializeEventStore(),this._domainEventService=new o,this._domainEventService.initialize(this._eventStore),this._initializeDomainEventHandlers(),this._aggregateService=new r,this._aggregateService.initialize(this._eventStore,this._domainEventService),this._initializeAggregateService(),this._di={aggregate:this._aggregateService,repository:function(e){return function(){return e.getRepository.apply(e,arguments)}}(this),adapter:function(e){return function(){return e.getAdapter.apply(e,arguments)}}(this)},this},e.prototype._initializeEventStore=function(){var e;if(this._params.store)return this._eventStore=this._params.store;if(e=u.get("store"))return this._eventStore=e;throw new Error("Missing Event Store for Bounded Context")},e.prototype._initializeDomainEventHandlers=function(){var e,t,n,r,i;r=this._domainEventHandlers,i=[];for(e in r)n=r[e],i.push(function(){var r,i,o;for(o=[],r=0,i=n.length;i>r;r++)t=n[r],o.push(this._domainEventService.on(e,t));return o}.call(this));return i},e.prototype._initializeAggregateService=function(){var e,t,n,r;n=this._aggregateDefinitions,r=[];for(t in n)e=n[t],r.push(this._aggregateService.registerAggregateDefinition(t,e));return r},e.prototype.set=function(e,t){return this._params[e]=t,this},e.prototype.addApplicationService=function(e){var t,n;for(t in e)switch(n=e[t],t){case"commands":this.addCommands(e[t]);break;case"queries":this.addQueries(e[t])}return this},e.prototype.addCommand=function(e,t){return this._applicationServiceCommands[e]=function(e){return function(){return t.apply(e._di,arguments)}}(this),this},e.prototype.addCommands=function(e){var t,n;for(n in e)t=e[n],this.addCommand(n,t);return this},e.prototype.addQuery=function(e,t){return this._applicationServiceQueries[e]=function(e){return function(){return t.apply(e._di,arguments)}}(this),this},e.prototype.addQueries=function(e){var t,n;for(n in e)t=e[n],this.addQuery(n,t);return this},e.prototype.addAggregate=function(e,t){return this._aggregateDefinitions[e]=t,this},e.prototype.addReadAggregate=function(e,t){return this._readAggregateDefinitions[e]=t,this},e.prototype.addRepository=function(e,t){return this._repositories[e]=t,this},e.prototype.addDomainEventHandler=function(e,t){return this._domainEventHandlers[e]||(this._domainEventHandlers[e]=[]),this._domainEventHandlers[e].push(function(e){return function(){return t.apply(e._di,arguments)}}(this)),this},e.prototype.addAdapter=function(e,t){return this._adapters[e]=t,this},e.prototype.addAdapters=function(e){var t,n;for(t in e)n=e[t],this.addAdapter(t,n);return this},e.prototype.getRepository=function(e){var t,n;return this._repositoryInstances[e]?this._repositoryInstances[e]:(n={aggregateName:e,eventStore:this._eventStore,readAggregate:!0},this._readAggregateDefinitions[e]&&(n.aggregateDefinition=this._readAggregateDefinitions[e]),t=new a(n),this._repositories[e]&&s.extend(t,this._repositories[e]),this._repositoryInstances[e]=t,t)},e.prototype.getAdapter=function(e){var t;return this._adapterInstances[e]?this._adapterInstances[e]:(t=new this._adapters[e],"function"==typeof t.initialize&&t.initialize(),this._adapterInstances[e]=t,t)},e.prototype.command=function(e,t){return new Promise(function(n){return function(r,i){var o;return n._applicationServiceCommands[e.name]?n._applicationServiceCommands[e.name](e.params,function(e,n){return r(n),"function"==typeof t?t(e,n):void 0}):(o=new Error("Given command "+e.name+" not registered on bounded context"),i(o),"function"==typeof t?t(o,null):void 0)}}(this))},e.prototype.query=function(e,t){return new Promise(function(n){return function(r,i){var o,a;return n._applicationServiceQueries[e.name]?n._applicationServiceQueries[e.name](e.params,function(e,n){return r(n),"function"==typeof t?t(e,n):void 0}):(a="Given query "+e.name+" not registered on bounded context",o=new Error(a),i(o),"function"==typeof t?t(o,null):void 0)}}(this))},e}(),n.exports=i}),require.register("eventric/domain_event",function(e,t,n){var r;r=function(){function e(e){this.name=e.name,this.timestamp=(new Date).getTime(),this.aggregate=e.aggregate}return e.prototype.getAggregateChanges=function(){return this.aggregate.changed},e.prototype.getAggregateName=function(){return this.aggregate.name},e.prototype.getAggregateId=function(){return this.aggregate.id},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getName=function(){return this.name},e}(),n.exports=r}),require.register("eventric/domain_event_service",function(e,t,n){var r,i,o,a,u;a=t("eventric"),o=a.require("HelperAsync"),i=a.require("HelperEvents"),u=a.require("HelperUnderscore"),r=function(){function e(){}return u.extend(e.prototype,i),e.prototype.initialize=function(e){this._eventStore=e},e.prototype.saveAndTrigger=function(e,t){return o.eachSeries(e,function(e){return function(t,n){return e._eventStore.save(t,function(r){var i,o,a;return r?n(r):(a=t.getName(),i=t.getAggregateId(),o=t.getAggregateName(),e.trigger("DomainEvent",t),e.trigger(o,t),e.trigger(""+o+":"+a,t),e.trigger(""+o+"/"+i,t),e.trigger(""+o+":"+a+"/"+i,t),n(null))})}}(this),function(){return function(e){return t(e?e:null)}}(this))},e}(),n.exports=r}),require.register("eventric/index",function(e,t,n){var r;t("./helper/promise"),r={BoundedContext:"./bounded_context",Aggregate:"./aggregate",AggregateService:"./aggregate_service",ReadAggregate:"./read_aggregate",ReadAggregateEntity:"./read_aggregate_entity",DomainEvent:"./domain_event",DomainEventService:"./domain_event_service",RemoteService:"./remote_service",RemoteBoundedContext:"./remote_bounded_context",Repository:"./repository",HelperAsync:"./helper/async",HelperEvents:"./helper/events",HelperUnderscore:"./helper/underscore",HelperClone:"./helper/clone",HelperObjectDiff:"./helper/diff2"},n.exports={_params:{},_domainEventHandlers:{},require:function(e){var n,i,o;i=null!=(o=r[e])?o:e;try{return t(i)}catch(a){throw n=a,console.log(n),n}},set:function(e,t){return this._params[e]=t},get:function(e){return this._params[e]},boundedContext:function(e){var t,n;if(!e)throw new Error("BoundedContexts must have a name");return t=this.require("BoundedContext"),n=new t,n.addDomainEventHandler("DomainEvent",function(t){return function(n){var r,i,o,a,u,s;if(t._domainEventHandlers[e]&&(i=n.getAggregateName()+":"+n.getName(),t._domainEventHandlers[e][i])){for(u=t._domainEventHandlers[e][i],s=[],o=0,a=u.length;a>o;o++)r=u[o],s.push(r(n));return s}}}(this)),n},addDomainEventHandler:function(e,t,n){return this._domainEventHandlers[e]||(this._domainEventHandlers[e]={}),this._domainEventHandlers[e][t]||(this._domainEventHandlers[e][t]=[]),this._domainEventHandlers[e][t].push(n)}}}),require.register("eventric/remote_bounded_context",function(e,t,n){var r,i,o;i=t("eventric"),o=i.require("HelperUnderscore"),r=function(){function e(e){this._remoteService=e}return e.prototype._boundedContextObjs={},e.prototype.command=function(e,t,n){return this.rpc({boundedContextName:e,method:"command",params:t},n)},e.prototype.query=function(e,t,n){return this.rpc({boundedContextName:e,method:"query",params:t},n)},e.prototype.rpc=function(e,t){return this._remoteService.rpc("RemoteBoundedContext",e,t)},e.prototype.handle=function(e,t){var n,r;return n=this.getBoundedContextObj(e.boundedContextName),n?e.method in n?n[e.method](e.params,t):(r=new Error("RPC method "+e.method+" not found on Class "+e.boundedContextName),t(r,null)):(r=new Error("Tried to handle RPC class with not registered boundedContext "+e.boundedContextName),t(r,null))},e.prototype.registerBoundedContextObj=function(e,t){return this._boundedContextObjs[e]=t},e.prototype.getBoundedContextObj=function(e){return e in this._boundedContextObjs?this._boundedContextObjs[e]:!1},e}(),n.exports=r}),require.register("eventric/remote_service",function(e,t,n){var r;r=function(){function e(e){this._adapter=e,this._serviceHandlers={}}return e.prototype.rpc=function(e,t,n){var r;return r={service:e,payload:t},this._adapter.rpc(r,n)},e.prototype.handle=function(e,t){var n,r;return r=this.getServiceHandler(e.service),r?"handle"in r?r.handle(e.payload,t):(n=new Error("Service "+e.service+" has no handle method"),t(n,null)):(n=new Error("Tried to handle RPC call with not registered service "+e.service),t(n,null))},e.prototype.registerServiceHandler=function(e,t){return this._serviceHandlers[e]=t},e.prototype.getServiceHandler=function(e){return e in this._serviceHandlers?this._serviceHandlers[e]:!1},e}(),n.exports=r}),require.register("eventric/repository",function(e,t,n){var r,i,o,a,u,s=function(e,t){return function(){return e.apply(t,arguments)}},c=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};a=t("eventric"),u=a.require("HelperUnderscore"),o=a.require("HelperAsync"),r=a.require("Aggregate"),i=function(){function e(e){this.findIds=s(this.findIds,this),this.findById=s(this.findById,this);var t,n;this._aggregateName=e.aggregateName,this._aggregateDefinition=null!=(t=e.aggregateDefinition)?t:!1,this._eventStore=e.eventStore,this._readAggregate=null!=(n=e.readAggregate)?n:!1}return e.prototype.findById=function(e,t){return this._callbackIsAFunction(t)?this._eventStore.find(this._aggregateName,{"aggregate.id":e},function(n){return function(i,o){var a;return i?t(i,null):0===o.length?t(null,[]):(a=new r(n._aggregateName,n._aggregateDefinition),a.applyDomainEvents(o),n._readAggregate&&(a=a.toJSON()),a.id=e,t(null,a))}}(this)):void 0},e.prototype.find=function(e,t){return this._callbackIsAFunction(t)?this.findIds(e,function(e){return function(n,r){var i;return n?t(n,null):(i=[],o.whilst(function(){return r.length>0},function(t){var n;return n=r.shift(),e.findById(n,function(e,n){return e?t(e):0===n.length?t(null):(i.push(n),t(null))})},function(e){return e?t(e,null):t(null,i)}))}}(this)):void 0},e.prototype.findOne=function(e,t){return this._callbackIsAFunction(t)?this.find(e,function(){return function(e,n){return e?t(e,null):0===n.length?t(null,!1):t(null,n[0])}}(this)):void 0},e.prototype.findIds=function(e,t){return this._callbackIsAFunction(t)?this._eventStore.find(this._aggregateName,e,{"aggregate.id":1},function(){return function(e,n){var r,i,o,a,u;if(e)return t(e,null);for(r=[],o=0,a=n.length;a>o;o++)i=n[o],u=i.aggregate.id,c.call(r,u)<0&&r.push(i.aggregate.id);return t(null,r)}}(this)):void 0},e.prototype._callbackIsAFunction=function(e){if("function"==typeof e)return!0;throw new Error("No callback provided")},e}(),n.exports=i}),require.register("eventric/helper/async",function(e,t,n){!function(){function e(e){var n=!1;return function(){if(n)throw new Error("Callback was already called.");n=!0,e.apply(t,arguments)}}var t,r,i={};t=this,null!=t&&(r=t.async),i.noConflict=function(){return t.async=r,i};var o=Object.prototype.toString,a=Array.isArray||function(e){return"[object Array]"===o.call(e)},u=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n+=1)t(e[n],n,e)};"undefined"!=typeof process&&process.nextTick?(i.nextTick=process.nextTick,i.setImmediate="undefined"!=typeof setImmediate?function(e){setImmediate(e)}:i.nextTick):"function"==typeof setImmediate?(i.nextTick=function(e){setImmediate(e)},i.setImmediate=i.nextTick):(i.nextTick=function(e){setTimeout(e,0)},i.setImmediate=i.nextTick),i.eachSeries=function(e,t,n){if(n=n||function(){},!e.length)return n();var r=0,i=function(){t(e[r],function(t){t?(n(t),n=function(){}):(r+=1,r>=e.length?n():i())})};i()},i.forEachSeries=i.eachSeries,i.iterator=function(e){var t=function(n){var r=function(){return e.length&&e[n].apply(null,arguments),r.next()};return r.next=function(){return n<e.length-1?t(n+1):null},r};return t(0)},i.whilst=function(e,t,n){e()?t(function(r){return r?n(r):void i.whilst(e,t,n)}):n()},i.queue=function(t,n){function r(e,t,n,r){return e.started||(e.started=!0),a(t)||(t=[t]),0==t.length?i.setImmediate(function(){e.drain&&e.drain()}):void u(t,function(t){var o={data:t,callback:"function"==typeof r?r:null};n?e.tasks.unshift(o):e.tasks.push(o),e.saturated&&e.tasks.length===e.concurrency&&e.saturated(),i.setImmediate(e.process)})}void 0===n&&(n=1);var o=0,s={tasks:[],concurrency:n,saturated:null,empty:null,drain:null,started:!1,paused:!1,push:function(e,t){r(s,e,!1,t)},kill:function(){s.drain=null,s.tasks=[]},unshift:function(e,t){r(s,e,!0,t)},process:function(){if(!s.paused&&o<s.concurrency&&s.tasks.length){var n=s.tasks.shift();s.empty&&0===s.tasks.length&&s.empty(),o+=1;var r=function(){o-=1,n.callback&&n.callback.apply(n,arguments),s.drain&&s.tasks.length+o===0&&s.drain(),s.process()},i=e(r);t(n.data,i)}},length:function(){return s.tasks.length},running:function(){return o},idle:function(){return s.tasks.length+o===0},pause:function(){s.paused!==!0&&(s.paused=!0,s.process())},resume:function(){s.paused!==!1&&(s.paused=!1,s.process())}};return s},n.exports=i}()}),require.register("eventric/helper/clone",function(e,t,n){"use strict";function r(e){return Object.prototype.toString.call(e)}function i(e,t,n,r){function i(e,n){if(null===e)return null;if(0==n)return e;var c;if("object"!=typeof e)return e;if(o.isArray(e)?c=[]:o.isRegExp(e)?(c=new RegExp(e.source,o.getRegExpFlags(e)),e.lastIndex&&(c.lastIndex=e.lastIndex)):o.isDate(e)?c=new Date(e.getTime()):s&&Buffer.isBuffer(e)?(c=new Buffer(e.length),e.copy(c)):c=Object.create("undefined"==typeof r?Object.getPrototypeOf(e):r),t){var f=a.indexOf(e);if(-1!=f)return u[f];a.push(e),u.push(c)}for(var p in e)c[p]=i(e[p],n-1);return c}var a=[],u=[],s="undefined"!=typeof Buffer;return"undefined"==typeof t&&(t=!0),"undefined"==typeof n&&(n=1/0),i(e,n)}var o={isArray:function(e){return Array.isArray(e)||"object"==typeof e&&"[object Array]"===r(e)},isDate:function(e){return"object"==typeof e&&"[object Date]"===r(e)},isRegExp:function(e){return"object"==typeof e&&"[object RegExp]"===r(e)},getRegExpFlags:function(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}};"object"==typeof n&&(n.exports=i),i.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},n.exports=i}),require.register("eventric/helper/diff2",function(e,t,n){var r;r=function(){function e(){}return e.DIFFERENCE_TYPES={ADDED:"added",DELETED:"deleted",CHANGED:"changed"},e.prototype.calculateDifferences=function(t,n,r,i){var o,a,u;return null==r&&(r=""),null==i&&(i=[]),o=this._getType(n),a=this._getType(t),""!==r&&(u={key:r,valueType:o},i=[].concat(i,[u])),"function"==typeof t||"function"==typeof n?[]:t?n?a!==o?[this._createDifference(e.DIFFERENCE_TYPES.CHANGED,i,n)]:"object"==typeof t?this._getNestedDifferences(t,n,r,i):n!==t?[this._createDifference(e.DIFFERENCE_TYPES.CHANGED,i,n)]:[]:[this._createDifference(e.DIFFERENCE_TYPES.DELETED,i)]:[this._createDifference(e.DIFFERENCE_TYPES.ADDED,i,n)]},e.prototype._createDifference=function(e,t,n){return{type:e,path:t,value:n}},e.prototype._getNestedDifferences=function(e,t,n,r){var i,o;return null==n&&(n=""),null==r&&(r=[]),i=this._union(Object.keys(e),Object.keys(t)),o=i.map(function(n){return function(i){return n.calculateDifferences(e[i],t[i],i,r)}}(this)),this._flatten(o)},e.prototype._union=function(e,t){return e.concat(t.filter(function(t){return-1===e.indexOf(t)}))},e.prototype._flatten=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},e.prototype._getType=function(e){var t;return t=typeof e,"object"===t&&this._isArray(e)?"array":t},e.prototype._isArray=function(e){return"[object Array]"==={}.toString.call(e)},e.prototype.applyDifferences=function(t,n){var r;return r=this._clone(n),r.forEach(function(n){return function(r){var i,o;return i=r.path.pop().key,o=r.path.reduce(function(e,t){return e[t.key]||n._createValue(e,t.key,t.valueType),e[t.key]},t),r.type===e.DIFFERENCE_TYPES.CHANGED||r.type===e.DIFFERENCE_TYPES.ADDED?o[i]=r.value:delete o[i]}}(this)),t},e.prototype._createValue=function(e,t,n){return e[t]=this._createFromType(n)},e.prototype._createFromType=function(e){return"object"===e?{}:"array"===e?[]:void 0},e.prototype._clone=function(e){var t;return t=null,"object"==typeof e?(t=this._createFromType(this._getType(e)),Object.keys(e).forEach(function(n){return function(r){return t[r]=n._clone(e[r])}}(this))):t=e,t},e}(),n.exports=new r}),require.register("eventric/helper/events",function(e,t,n){eventric=t("eventric"),_=eventric.require("HelperUnderscore"),array=[],slice=array.slice;var r=HelperEvents={on:function(e,t,n){if(!o(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!o(this,"once",e,[t,n])||!t)return this;var r=this,i=_.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){if(!this._events||!o(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events=void 0,this;for(var r=e?[e]:_.keys(this._events),i=0,a=r.length;a>i;i++){e=r[i];var u=this._events[e];if(u)if(t||n){for(var s=[],c=0,f=u.length;f>c;c++){var p=u[c];(t&&t!==p.callback&&t!==p.callback._callback||n&&n!==p.context)&&s.push(p)}s.length?this._events[e]=s:delete this._events[e]}else delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=slice.call(arguments,1);if(!o(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&a(n,t),r&&a(r,arguments),this},stopListening:function(e,t,n){var r=this._listeningTo;if(!r)return this;var i=!t&&!n;n||"object"!=typeof t||(n=this),e&&((r={})[e._listenId]=e);for(var o in r)e=r[o],e.off(t,n,this),(i||_.isEmpty(e._events))&&delete this._listeningTo[o];return this}},i=/\s+/,o=function(e,t,n,r){if(!n)return!0;if("object"==typeof n){for(var o in n)e[t].apply(e,[o,n[o]].concat(r));return!1}if(i.test(n)){for(var a=n.split(i),u=0,s=a.length;s>u;u++)e[t].apply(e,[a[u]].concat(r));return!1}return!0},a=function(e,t){var n,r=-1,i=e.length,o=t[0],a=t[1],u=t[2];switch(t.length){case 0:for(;++r<i;)(n=e[r]).callback.call(n.ctx);return;case 1:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o);return;case 2:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,a);return;case 3:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,a,u);return;default:for(;++r<i;)(n=e[r]).callback.apply(n.ctx,t);return}},u={listenTo:"on",listenToOnce:"once"};_.each(u,function(e,t){r[t]=function(t,n,r){var i=this._listeningTo||(this._listeningTo={}),o=t._listenId||(t._listenId=_.uniqueId("l"));return i[o]=t,r||"object"!=typeof n||(r=this),t[e](n,r,this),this}}),r.bind=r.on,r.unbind=r.off,n.exports=HelperEvents}),require.register("eventric/helper/promise",function(){!function(){var e,t,n,r;!function(){var i={},o={};e=function(e,t,n){i[e]={deps:t,callback:n}},r=n=t=function(e){function n(t){if("."!==t.charAt(0))return t;for(var n=t.split("/"),r=e.split("/").slice(0,-1),i=0,o=n.length;o>i;i++){var a=n[i];if(".."===a)r.pop();else{if("."===a)continue;r.push(a)}}return r.join("/")}if(r._eak_seen=i,o[e])return o[e];if(o[e]={},!i[e])throw new Error("Could not find module "+e);for(var a,u=i[e],s=u.deps,c=u.callback,f=[],p=0,l=s.length;l>p;p++)f.push("exports"===s[p]?a={}:t(n(s[p])));var g=c.apply(this,f);return o[e]=a||g}}(),e("promise/all",["./utils","exports"],function(e,t){"use strict";function n(e){var t=this;if(!r(e))throw new TypeError("You must pass an array to all.");return new t(function(t,n){function r(e){return function(t){o(e,t)}}function o(e,n){u[e]=n,0===--s&&t(u)}var a,u=[],s=e.length;0===s&&t([]);for(var c=0;c<e.length;c++)a=e[c],a&&i(a.then)?a.then(r(c),n):o(c,a)})}var r=e.isArray,i=e.isFunction;t.all=n}),e("promise/asap",["exports"],function(e){"use strict";function t(){return function(){process.nextTick(i)}}function n(){var e=0,t=new s(i),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function r(){return function(){c.setTimeout(i,1)}}function i(){for(var e=0;e<f.length;e++){var t=f[e],n=t[0],r=t[1];n(r)}f=[]}function o(e,t){var n=f.push([e,t]);1===n&&a()}var a,u="undefined"!=typeof window?window:{},s=u.MutationObserver||u.WebKitMutationObserver,c="undefined"!=typeof global?global:void 0===this?window:this,f=[];a="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?t():s?n():r(),e.asap=o}),e("promise/config",["exports"],function(e){"use strict";function t(e,t){return 2!==arguments.length?n[e]:void(n[e]=t)}var n={instrument:!1};e.config=n,e.configure=t}),e("promise/polyfill",["./promise","./utils","exports"],function(e,t,n){"use strict";function r(){var e;e="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var t="Promise"in e&&"resolve"in e.Promise&&"reject"in e.Promise&&"all"in e.Promise&&"race"in e.Promise&&function(){var t;return new e.Promise(function(e){t=e}),o(t)}();t||(e.Promise=i)}var i=e.Promise,o=t.isFunction;n.polyfill=r}),e("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(e,t,n,r,i,o,a,u){"use strict";function s(e){if(!b(e))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof s))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],c(e,this)}function c(e,t){function n(e){h(t,e)}function r(e){v(t,e)}try{e(n,r)}catch(i){r(i)}}function f(e,t,n,r){var i,o,a,u,s=b(n);if(s)try{i=n(r),a=!0}catch(c){u=!0,o=c}else i=r,a=!0;g(t,i)||(s&&a?h(t,i):u?v(t,o):e===T?h(t,i):e===C&&v(t,i))}function p(e,t,n,r){var i=e._subscribers,o=i.length;i[o]=t,i[o+T]=n,i[o+C]=r}function l(e,t){for(var n,r,i=e._subscribers,o=e._detail,a=0;a<i.length;a+=3)n=i[a],r=i[a+t],f(t,n,r,o);e._subscribers=null}function g(e,t){var n,r=null;try{if(e===t)throw new TypeError("A promises callback cannot return that same promise.");if(E(t)&&(r=t.then,b(r)))return r.call(t,function(r){return n?!0:(n=!0,void(t!==r?h(e,r):d(e,r)))},function(t){return n?!0:(n=!0,void v(e,t))}),!0}catch(i){return n?!0:(v(e,i),!0)}return!1}function h(e,t){e===t?d(e,t):g(e,t)||d(e,t)}function d(e,t){e._state===j&&(e._state=k,e._detail=t,_.async(y,e))}function v(e,t){e._state===j&&(e._state=k,e._detail=t,_.async(m,e))}function y(e){l(e,e._state=T)}function m(e){l(e,e._state=C)}var _=e.config,E=(e.configure,t.objectOrFunction),b=t.isFunction,w=(t.now,n.all),x=r.race,D=i.resolve,A=o.reject,S=a.asap;_.async=S;var j=void 0,k=0,T=1,C=2;s.prototype={constructor:s,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(e,t){var n=this,r=new this.constructor(function(){});if(this._state){var i=arguments;_.async(function(){f(n._state,r,i[n._state-1],n._detail)})}else p(this,r,e,t);return r},"catch":function(e){return this.then(null,e)}},s.all=w,s.race=x,s.resolve=D,s.reject=A,u.Promise=s}),e("promise/race",["./utils","exports"],function(e,t){"use strict";function n(e){var t=this;if(!r(e))throw new TypeError("You must pass an array to race.");return new t(function(t,n){for(var r,i=0;i<e.length;i++)r=e[i],r&&"function"==typeof r.then?r.then(t,n):t(r)})}var r=e.isArray;t.race=n}),e("promise/reject",["exports"],function(e){"use strict";function t(e){var t=this;return new t(function(t,n){n(e)})}e.reject=t}),e("promise/resolve",["exports"],function(e){"use strict";function t(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=this;return new t(function(t){t(e)})}e.resolve=t}),e("promise/utils",["exports"],function(e){"use strict";function t(e){return n(e)||"object"==typeof e&&null!==e}function n(e){return"function"==typeof e}function r(e){return"[object Array]"===Object.prototype.toString.call(e)}var i=Date.now||function(){return(new Date).getTime()};e.objectOrFunction=t,e.isFunction=n,e.isArray=r,e.now=i}),t("promise/polyfill").polyfill()}()}),require.register("eventric/helper/underscore",function(e,t,n){(function(){var t=this,r=t._,i={},o=Array.prototype,a=Object.prototype,u=Function.prototype,s=o.push,c=o.slice,f=(o.concat,a.toString),p=a.hasOwnProperty,l=Array.isArray,g=Object.keys,h=(u.bind,function(e){return e instanceof h?e:this instanceof h?void(this._wrapped=e):new h(e)});"undefined"!=typeof e?("undefined"!=typeof n&&n.exports&&(e=n.exports=h),e._=h):t._=h,h.VERSION="1.6.0",h.each=h.forEach=function(e,t,n){if(null==e)return e;if(e.length===+e.length){for(var r=0,o=e.length;o>r;r++)if(t.call(n,e[r],r,e)===i)return}else for(var a=h.keys(e),r=0,o=a.length;o>r;r++)if(t.call(n,e[a[r]],a[r],e)===i)return;return e},h.keys=function(e){if(!h.isObject(e))return[];if(g)return g(e);var t=[];for(var n in e)h.has(e,n)&&t.push(n);return t},h.invert=function(e){for(var t={},n=h.keys(e),r=0,i=n.length;i>r;r++)t[e[n[r]]]=n[r];return t},h.functions=h.methods=function(e){var t=[];for(var n in e)h.isFunction(e[n])&&t.push(n);return t.sort()},h.extend=function(e){return h.isObject(e)?(h.each(c.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e):e},h.defaults=function(e){return h.isObject(e)?(h.each(c.call(arguments,1),function(t){for(var n in t)void 0===e[n]&&(e[n]=t[n])}),e):e},h.isEqual=function(e,t){return eq(e,t,[],[])},h.isEmpty=function(e){if(null==e)return!0;if(h.isArray(e)||h.isString(e)||h.isArguments(e))return 0===e.length;for(var t in e)if(h.has(e,t))return!1;return!0},h.isElement=function(e){return!(!e||1!==e.nodeType)},h.isArray=l||function(e){return"[object Array]"==f.call(e)},h.isObject=function(e){return e===Object(e)},h.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){h["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),h.isArguments(arguments)||(h.isArguments=function(e){return h.has(e,"callee")}),"function"!=typeof/./&&(h.isFunction=function(e){return"function"==typeof e}),h.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},h.isNaN=function(e){return h.isNumber(e)&&e!=+e},h.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==f.call(e)},h.isNull=function(e){return null===e},h.isUndefined=function(e){return void 0===e},h.has=function(e,t){return null!=e&&p.call(e,t)},h.noConflict=function(){return t._=r,this},h.identity=function(e){return e},h.constant=function(e){return function(){return e}},h.noop=function(){},h.property=function(e){return function(t){return t[e]}},h.matches=function(e){return function(t){if(null==t)return h.isEmpty(e);if(t===e)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0}},h.times=function(e,t,n){for(var r=Array(Math.max(0,e)),i=0;e>i;i++)r[i]=t.call(n,i);return r},h.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1)) | ||
},h.now=Date.now||function(){return(new Date).getTime()};var d={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};d.unescape=h.invert(d.escape);var v={escape:new RegExp("["+h.keys(d.escape).join("")+"]","g"),unescape:new RegExp("("+h.keys(d.unescape).join("|")+")","g")};h.each(["escape","unescape"],function(e){h[e]=function(t){return null==t?"":(""+t).replace(v[e],function(t){return d[e][t]})}}),h.result=function(e,t){if(null==e)return void 0;var n=e[t];return h.isFunction(n)?e[t]():n},h.mixin=function(e){h.each(h.functions(e),function(t){var n=h[t]=e[t];h.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),m.call(this,n.apply(h,e))}})};var y=0;h.uniqueId=function(e){var t=++y+"";return e?e+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};h.chain=function(e){return h(e).chain()};var m=function(e){return this._chain?h(e).chain():e};h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=o[e];h.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],m.call(this,n)}}),h.each(["concat","join","slice"],function(e){var t=o[e];h.prototype[e]=function(){return m.call(this,t.apply(this._wrapped,arguments))}}),h.extend(h.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)}); |
@@ -24,3 +24,3 @@ { | ||
"author": "eFa Team <team@efa-gmbh.com>", | ||
"version": "0.0.41", | ||
"version": "0.0.42", | ||
"repository": { | ||
@@ -27,0 +27,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
389150