This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
dddbase.min.js
1 lines (1 loc) · 4.08 KB
/
dddbase.min.js
1
var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},DDD;!function(a){var b=function(){function a(a){this.value=a}return a.prototype.getValue=function(){return this.value},a.prototype.equals=function(a){return null==a?!1:this==a?!0:this.value===a.getValue()},a}();a.Identity=b;var c=function(a){function b(b){a.call(this,b)}return __extends(b,a),b}(b);a.NumberIdentity=c}(DDD||(DDD={}));var DDD;!function(a){var b=function(){function a(a){this.identity=a}return a.prototype.getIdentity=function(){return this.identity},a.prototype.equals=function(a){return null==a?!1:this==a?!0:this.identity.equals(a.getIdentity())},a}();a.Entity=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(){function a(a){this.core=a}return a.prototype.resolve=function(a){var b=this;return monapt.future(function(c){c.success(b.core.resolveOption(a).get())})},a.prototype.store=function(a){var b=this;return monapt.future(function(c){c.success(b.core.store(a))})},a.prototype.storeList=function(a){var b=this;return monapt.future(function(c){c.success(b.core.storeList(a))})},a.prototype.deleteByEntity=function(a){var b=this;return monapt.future(function(c){b.core.deleteByEntity(a),c.success(b)})},a.prototype.deleteByIdentity=function(a){var b=this;return monapt.future(function(c){b.core.deleteByIdentity(a),c.success(b)})},a}();a.AsyncRepository=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(){function a(a){this.parse=a.parse,this.stringify=a.stringify}return a.prototype.resolveOption=function(a){var b=this.resolve(a);return null!=b?new monapt.Some(b):new monapt.None},a.prototype.resolve=function(a){var b=JSON.parse(localStorage.getItem(a.getValue()));return b?this.parse(b):null},a.prototype.store=function(a){return localStorage.setItem(a.getIdentity().getValue(),this.stringify(a)),a},a.prototype.storeList=function(a){for(var b in a)this.store(a[b]);return a},a.prototype.deleteByEntity=function(a){return this.deleteByIdentity(a.getIdentity()),this},a.prototype.deleteByIdentity=function(a){return localStorage.removeItem(a.getValue()),this},a}();a.OnLocalStorageRepository=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(b){function c(c){b.call(this,new a.OnLocalStorageRepository(c))}return __extends(c,b),c}(a.AsyncRepository);a.AsyncOnLocalStorageRepository=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(){function a(){this.entities={}}return a.prototype.resolveOption=function(a){var b=this.resolve(a);return null!=b?new monapt.Some(b):new monapt.None},a.prototype.resolve=function(a){return this.entities[a.getValue()]},a.prototype.store=function(a){return this.entities[a.getIdentity().getValue()]=a,a},a.prototype.storeList=function(a){for(var b in a)this.store(a[b]);return a},a.prototype.deleteByEntity=function(a){return this.deleteByIdentity(a.getIdentity()),this},a.prototype.deleteByIdentity=function(a){return delete this.entities[a.getValue()],this},a}();a.OnMemoryRepository=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(b){function c(){b.call(this,new a.OnMemoryRepository)}return __extends(c,b),c}(a.AsyncRepository);a.AsyncOnMemoryRepository=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(){function a(a){this.parse=a.parse,this.stringify=a.stringify}return a.prototype.resolveOption=function(a){var b=this.resolve(a);return null!=b?new monapt.Some(b):new monapt.None},a.prototype.resolve=function(a){var b=sessionStorage.getItem(a.getValue()),c=b?JSON.parse(b):null;return c?this.parse(c):null},a.prototype.store=function(a){return sessionStorage.setItem(a.getIdentity().getValue(),this.stringify(a)),a},a.prototype.storeList=function(a){for(var b in a)this.store(a[b]);return a},a.prototype.deleteByEntity=function(a){return this.deleteByIdentity(a.getIdentity()),this},a.prototype.deleteByIdentity=function(a){return sessionStorage.removeItem(a.getValue()),this},a}();a.OnSessionStorageRepository=b}(DDD||(DDD={}));var DDD;!function(a){var b=function(b){function c(c){b.call(this,new a.OnSessionStorageRepository(c))}return __extends(c,b),c}(a.AsyncRepository);a.AsyncOnSessionStorageRepository=b}(DDD||(DDD={}));