@ngx-pwa/local-storage
Advanced tools
Comparing version 7.2.0 to 7.2.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@ngx-pwa/local-storage",["exports","@angular/core","rxjs","rxjs/operators","@angular/common"],t):t((e["ngx-pwa"]=e["ngx-pwa"]||{},e["ngx-pwa"]["local-storage"]={}),e.ng.core,e.rxjs,e.rxjs.operators,e.ng.common)}(this,function(e,t,s,c,r){"use strict";var n=new t.InjectionToken("localStoragePrefix",{providedIn:"root",factory:function(){return""}});var o=function(){function e(e){void 0===e&&(e=null),this.userPrefix=e,this.prefix="",e&&(this.prefix=e+"_")}return Object.defineProperty(e.prototype,"size",{get:function(){return s.of(localStorage.length)},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e){var t=localStorage.getItem(""+this.prefix+e),r=null;if(null!=t)try{r=JSON.parse(t)}catch(n){return s.throwError(new Error("Invalid data in localStorage."))}return s.of(r)},e.prototype.setItem=function(e,t){return localStorage.setItem(""+this.prefix+e,JSON.stringify(t)),s.of(!0)},e.prototype.removeItem=function(e){return localStorage.removeItem(""+this.prefix+e),s.of(!0)},e.prototype.clear=function(){return localStorage.clear(),s.of(!0)},e.prototype.keys=function(){for(var e=[],t=0;t<localStorage.length;t+=1)e.push(this.getKey(t));return s.of(e)},e.prototype.has=function(e){for(var t=0;t<localStorage.length;t+=1)if(e===this.getKey(t))return s.of(!0);return s.of(!1)},e.prototype.getKey=function(e){var t=localStorage.key(e);return null!==t?""===this.prefix?t:t.substr(this.prefix.length):null},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Optional},{type:t.Inject,args:[n]}]}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(n,8))},token:e,providedIn:"root"}),e}(),a=function(){function e(e){void 0===e&&(e=null),this.prefix=e,this.dbName="ngStorage",this.objectStoreName="localStorage",this.keyPath="key",this.dataPath="value",this.fallback=null,e&&(this.dbName=e+"_"+this.dbName),this.database=new s.ReplaySubject,this.connect(e)}return Object.defineProperty(e.prototype,"size",{get:function(){var n=this;return this.fallback?this.fallback.size:this.transaction("readonly").pipe(c.mergeMap(function(e){var t=e.count(),r=s.fromEvent(t,"success").pipe(c.map(function(e){return e.target.result}));return s.race(r,n.toErrorObservable(t,"length"))}),c.first())},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e){return this.fallback?this.fallback.getItem(e):this.getItemFromTransaction(e)},e.prototype.getItemFromTransaction=function(t,e){var r=this;return(e?s.of(e):this.transaction()).pipe(c.map(function(e){return e.get(t)}),c.mergeMap(function(e){var t=s.fromEvent(e,"success").pipe(c.map(function(e){return e.target.result}),c.map(function(e){return e&&r.dataPath in e?e[r.dataPath]:null}));return s.race(t,r.toErrorObservable(e,"getter"))}),c.first())},e.prototype.setItem=function(o,a){var i,u=this;return this.fallback?this.fallback.setItem(o,a):null==a?s.of(!0):this.transaction("readwrite").pipe(c.tap(function(e){i=e}),c.mergeMap(function(){return u.getItemFromTransaction(o,i)}),c.map(function(e){return null==e?"add":"put"}),c.mergeMap(function(e){var t,r,n;switch(e){case"add":n=i.add(((t={})[u.dataPath]=a,t),o);break;case"put":default:n=i.put(((r={})[u.dataPath]=a,r),o)}return s.race(u.toSuccessObservable(n),u.toErrorObservable(n,"setter"))}),c.first())},e.prototype.removeItem=function(r){var n=this;return this.fallback?this.fallback.removeItem(r):this.getItem(r).pipe(c.mergeMap(function(e){return null!=e?n.transaction("readwrite").pipe(c.mergeMap(function(e){var t=e["delete"](r);return s.race(n.toSuccessObservable(t),n.toErrorObservable(t,"remover"))})):s.of(!0)}),c.first())},e.prototype.clear=function(){var r=this;return this.fallback?this.fallback.clear():this.transaction("readwrite").pipe(c.mergeMap(function(e){var t=e.clear();return s.race(r.toSuccessObservable(t),r.toErrorObservable(t,"clearer"))}),c.first())},e.prototype.keys=function(){var n=this;return this.fallback?this.fallback.keys():this.transaction("readonly").pipe(c.mergeMap(function(e){var t=e.getAllKeys(),r=s.fromEvent(t,"success").pipe(c.map(function(e){return e.target.result}));return s.race(r,n.toErrorObservable(t,"keys"))}),c.first())},e.prototype.has=function(t){var r=this;return this.fallback?this.fallback.has(t):this.transaction("readonly").pipe(c.map(function(e){return e.getKey(t)}),c.mergeMap(function(e){var t=s.fromEvent(e,"success").pipe(c.map(function(e){return e.target.result}),c.map(function(e){return e!==undefined}));return s.race(t,r.toErrorObservable(e,"has"))}),c.first())},e.prototype.connect=function(e){var t,r=this;void 0===e&&(e=null);try{t=indexedDB.open(this.dbName)}catch(o){return void this.setFallback(e)}s.fromEvent(t,"upgradeneeded").pipe(c.first()).subscribe(function(e){var t=e.target.result;t.objectStoreNames.contains(r.objectStoreName)||t.createObjectStore(r.objectStoreName)});var n=s.fromEvent(t,"success");s.race(n,this.toErrorObservable(t,"connection")).pipe(c.first()).subscribe(function(e){r.database.next(e.target.result)},function(){r.setFallback(e)})},e.prototype.transaction=function(t){var r=this;return void 0===t&&(t="readonly"),this.database.pipe(c.map(function(e){return e.transaction([r.objectStoreName],t).objectStore(r.objectStoreName)}))},e.prototype.toSuccessObservable=function(e){return s.fromEvent(e,"success").pipe(c.map(function(){return!0}))},e.prototype.toErrorObservable=function(e,t){return void 0===t&&(t=""),s.fromEvent(e,"error").pipe(c.mergeMap(function(){return s.throwError(new Error("IndexedDB "+t+" issue : "+e.error.message+"."))}))},e.prototype.setFallback=function(e){this.fallback=new o(e)},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Optional},{type:t.Inject,args:[n]}]}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(n,8))},token:e,providedIn:"root"}),e}(),i=function(){function e(){this.localStorage=new Map}return Object.defineProperty(e.prototype,"size",{get:function(){return s.of(this.localStorage.size)},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e){var t=this.localStorage.get(e);return s.of(t!==undefined?t:null)},e.prototype.setItem=function(e,t){return this.localStorage.set(e,t),s.of(!0)},e.prototype.removeItem=function(e){return this.localStorage["delete"](e),s.of(!0)},e.prototype.clear=function(){return this.localStorage.clear(),s.of(!0)},e.prototype.keys=function(){return s.of(Array.from(this.localStorage.keys()))},e.prototype.has=function(e){return s.of(this.localStorage.has(e))},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();function u(e,t){return r.isPlatformBrowser(e)&&"indexedDB"in window&&indexedDB!==undefined&&null!==indexedDB?new a(t):r.isPlatformBrowser(e)&&"localStorage"in window&&localStorage!==undefined&&null!==localStorage?new o(t):new i}var l=function(){function e(){}return e.decorators=[{type:t.Injectable,args:[{providedIn:"root",useFactory:u,deps:[t.PLATFORM_ID,[new t.Optional,n]]}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return u(t.inject(t.PLATFORM_ID),t.inject(n,8))},token:e,providedIn:"root"}),e}();function p(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}var f=function(){function e(){}return e.prototype.validate=function(e,t){if(!((t.hasOwnProperty("const")&&t["const"]!==undefined||t.hasOwnProperty("enum")&&null!=t["enum"]||t.hasOwnProperty("type")&&null!=t.type)&&"array"!==t.type&&"object"!==t.type||t.hasOwnProperty("properties")&&null!=t.properties||t.hasOwnProperty("items")&&null!=t.items))throw new Error("Each value must have a 'type' or 'properties' or 'items' or 'const' or 'enum', to enforce strict types.");return(!t.hasOwnProperty("const")||t["const"]===undefined||e===t["const"])&&(!!this.validateEnum(e,t)&&(!!this.validateType(e,t)&&(!!this.validateItems(e,t)&&(!!this.validateProperties(e,t)&&!!this.validateRequired(e,t)))))},e.prototype.isObjectNotNull=function(e){return null!==e&&"object"==typeof e},e.prototype.validateProperties=function(e,t){if(!t.hasOwnProperty("properties")||null==t.properties)return!0;if(!this.isObjectNotNull(e))return!1;if(Object.keys(t.properties).length!==Object.keys(e).length)return!1;for(var r in t.properties)if(t.properties.hasOwnProperty(r)&&e.hasOwnProperty(r)&&!this.validate(e[r],t.properties[r]))return!1;return!0},e.prototype.validateRequired=function(e,t){var r,n;if(!t.hasOwnProperty("required")||null==t.required)return!0;if(!this.isObjectNotNull(e))return!1;try{for(var o=p(t.required),a=o.next();!a.done;a=o.next()){var i=a.value;if(!t.properties||!t.properties.hasOwnProperty(i))throw new Error("'required' properties must be described in 'properties' too.");if(!e.hasOwnProperty(i))return!1}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o["return"])&&n.call(o)}finally{if(r)throw r.error}}return!0},e.prototype.validateEnum=function(e,t){return!t.hasOwnProperty("enum")||null==t["enum"]||-1!==t["enum"].indexOf(e)},e.prototype.validateType=function(e,t){if(!t.hasOwnProperty("type")||null==t.type)return!0;switch(t.type){case"null":return null===e;case"string":return this.validateString(e,t);case"number":case"integer":return this.validateNumber(e,t);case"boolean":return"boolean"==typeof e;case"object":return"object"==typeof e;case"array":return Array.isArray(e)}return!0},e.prototype.validateItems=function(e,t){var r,n;if(!t.hasOwnProperty("items")||null==t.items)return!0;if(!Array.isArray(e))return!1;if(t.hasOwnProperty("maxItems")&&null!=t.maxItems){if(!Number.isInteger(t.maxItems)||t.maxItems<0)throw new Error("'maxItems' must be a non-negative integer.");if(e.length>t.maxItems)return!1}if(t.hasOwnProperty("minItems")&&null!=t.minItems){if(!Number.isInteger(t.minItems)||t.minItems<0)throw new Error("'minItems' must be a non-negative integer.");if(e.length<t.minItems)return!1}if(t.hasOwnProperty("uniqueItems")&&null!=t.uniqueItems&&t.uniqueItems){var o=new Set(e);if(e.length!==o.size)return!1}if(Array.isArray(t.items))return this.validateItemsList(e,t);try{for(var a=p(e),i=a.next();!i.done;i=a.next()){var u=i.value;if(!this.validate(u,t.items))return!1}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=a["return"])&&n.call(a)}finally{if(r)throw r.error}}return!0},e.prototype.validateItemsList=function(e,t){var r=t.items;if(e.length!==r.length)return!1;for(var n=0;n<r.length;n+=1)if(!this.validate(e[n],r[n]))return!1;return!0},e.prototype.validateString=function(e,t){if("string"!=typeof e)return!1;if(t.hasOwnProperty("maxLength")&&null!=t.maxLength){if(!Number.isInteger(t.maxLength)||t.maxLength<0)throw new Error("'maxLength' must be a non-negative integer.");if(e.length>t.maxLength)return!1}if(t.hasOwnProperty("minLength")&&null!=t.minLength){if(!Number.isInteger(t.minLength)||t.minLength<0)throw new Error("'minLength' must be a non-negative integer.");if(e.length<t.minLength)return!1}if(t.hasOwnProperty("pattern")&&null!=t.pattern&&!new RegExp(t.pattern).test(e))return!1;return!0},e.prototype.validateNumber=function(e,t){if("number"!=typeof e)return!1;if("integer"===t.type&&!Number.isInteger(e))return!1;if(t.hasOwnProperty("multipleOf")&&null!=t.multipleOf){if(t.multipleOf<=0)throw new Error("'multipleOf' must be a number strictly greater than 0.");if(!Number.isInteger(e/t.multipleOf))return!1}return!(t.hasOwnProperty("maximum")&&null!=t.maximum&&e>t.maximum)&&(!(t.hasOwnProperty("exclusiveMaximum")&&null!=t.exclusiveMaximum&&e>=t.exclusiveMaximum)&&(!(t.hasOwnProperty("minimum")&&null!=t.minimum&&e<t.minimum)&&!(t.hasOwnProperty("exclusiveMinimum")&&null!=t.exclusiveMinimum&&e<=t.exclusiveMinimum)))},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),m=function(){function e(e,t){this.database=e,this.jsonValidator=t,this.getItemOptionsDefault={schema:null}}return Object.defineProperty(e.prototype,"size",{get:function(){return this.database.size},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e,n){var o=this;return void 0===n&&(n=this.getItemOptionsDefault),this.database.getItem(e).pipe(c.mergeMap(function(e){if(null===e)return s.of(null);if(n.schema){var t=!0;try{t=o.jsonValidator.validate(e,n.schema)}catch(r){return s.throwError(r)}if(!t)return s.throwError(new Error("JSON invalid"))}return s.of(e)}))},e.prototype.getUnsafeItem=function(e){return this.database.getItem(e)},e.prototype.setItem=function(e,t){return this.database.setItem(e,t)},e.prototype.removeItem=function(e){return this.database.removeItem(e)},e.prototype.clear=function(){return this.database.clear()},e.prototype.keys=function(){return this.database.keys()},e.prototype.has=function(e){return this.database.has(e)},e.prototype.setItemSubscribe=function(e,t){this.setItem(e,t).subscribe(function(){},function(){})},e.prototype.removeItemSubscribe=function(e){this.removeItem(e).subscribe(function(){},function(){})},e.prototype.clearSubscribe=function(){this.clear().subscribe(function(){},function(){})},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:l},{type:f}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(l),t.inject(f))},token:e,providedIn:"root"}),e}();e.LocalDatabase=l,e.IndexedDBDatabase=a,e.LocalStorageDatabase=o,e.MockLocalDatabase=i,e.JSONValidator=f,e.LocalStorage=m,e.localStorageProviders=function h(e){return[e.prefix?{provide:n,useValue:e.prefix}:[]]},e.LOCAL_STORAGE_PREFIX=n,e.ɵa=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("@ngx-pwa/local-storage",["exports","@angular/core","rxjs","rxjs/operators","@angular/common"],t):t((e["ngx-pwa"]=e["ngx-pwa"]||{},e["ngx-pwa"]["local-storage"]={}),e.ng.core,e.rxjs,e.rxjs.operators,e.ng.common)}(this,function(e,t,s,c,r){"use strict";var n=new t.InjectionToken("localStoragePrefix",{providedIn:"root",factory:function(){return""}});var o=function(){function e(e){void 0===e&&(e=null),this.userPrefix=e,this.prefix="",e&&(this.prefix=e+"_")}return Object.defineProperty(e.prototype,"size",{get:function(){return s.of(localStorage.length)},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e){var t=localStorage.getItem(""+this.prefix+e),r=null;if(null!=t)try{r=JSON.parse(t)}catch(n){return s.throwError(new Error("Invalid data in localStorage."))}return s.of(r)},e.prototype.setItem=function(e,t){return localStorage.setItem(""+this.prefix+e,JSON.stringify(t)),s.of(!0)},e.prototype.removeItem=function(e){return localStorage.removeItem(""+this.prefix+e),s.of(!0)},e.prototype.clear=function(){return localStorage.clear(),s.of(!0)},e.prototype.keys=function(){for(var e=[],t=0;t<localStorage.length;t+=1)e.push(this.getKey(t));return s.of(e)},e.prototype.has=function(e){for(var t=0;t<localStorage.length;t+=1)if(e===this.getKey(t))return s.of(!0);return s.of(!1)},e.prototype.getKey=function(e){var t=localStorage.key(e);return null!==t?""===this.prefix?t:t.substr(this.prefix.length):null},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Optional},{type:t.Inject,args:[n]}]}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(n,8))},token:e,providedIn:"root"}),e}(),a=function(){function e(e){void 0===e&&(e=null),this.prefix=e,this.dbName="ngStorage",this.objectStoreName="localStorage",this.keyPath="key",this.dataPath="value",this.fallback=null,e&&(this.dbName=e+"_"+this.dbName),this.database=new s.ReplaySubject,this.connect(e)}return Object.defineProperty(e.prototype,"size",{get:function(){var n=this;return this.fallback?this.fallback.size:this.transaction("readonly").pipe(c.mergeMap(function(e){var t=e.count(),r=s.fromEvent(t,"success").pipe(c.map(function(e){return e.target.result}));return s.race(r,n.toErrorObservable(t,"length"))}),c.first())},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e){return this.fallback?this.fallback.getItem(e):this.getItemFromTransaction(e)},e.prototype.getItemFromTransaction=function(t,e){var r=this;return(e?s.of(e):this.transaction()).pipe(c.map(function(e){return e.get(t)}),c.mergeMap(function(e){var t=s.fromEvent(e,"success").pipe(c.map(function(e){return e.target.result}),c.map(function(e){return e&&r.dataPath in e?e[r.dataPath]:null}));return s.race(t,r.toErrorObservable(e,"getter"))}),c.first())},e.prototype.setItem=function(o,a){var i,u=this;return this.fallback?this.fallback.setItem(o,a):null==a?s.of(!0):this.transaction("readwrite").pipe(c.tap(function(e){i=e}),c.mergeMap(function(){return u.getItemFromTransaction(o,i)}),c.map(function(e){return null==e?"add":"put"}),c.mergeMap(function(e){var t,r,n;switch(e){case"add":n=i.add(((t={})[u.dataPath]=a,t),o);break;case"put":default:n=i.put(((r={})[u.dataPath]=a,r),o)}return s.race(u.toSuccessObservable(n),u.toErrorObservable(n,"setter"))}),c.first())},e.prototype.removeItem=function(r){var n=this;return this.fallback?this.fallback.removeItem(r):this.getItem(r).pipe(c.mergeMap(function(e){return null!=e?n.transaction("readwrite").pipe(c.mergeMap(function(e){var t=e["delete"](r);return s.race(n.toSuccessObservable(t),n.toErrorObservable(t,"remover"))})):s.of(!0)}),c.first())},e.prototype.clear=function(){var r=this;return this.fallback?this.fallback.clear():this.transaction("readwrite").pipe(c.mergeMap(function(e){var t=e.clear();return s.race(r.toSuccessObservable(t),r.toErrorObservable(t,"clearer"))}),c.first())},e.prototype.keys=function(){var n=this;return this.fallback?this.fallback.keys():this.transaction("readonly").pipe(c.mergeMap(function(e){var t=e.getAllKeys(),r=s.fromEvent(t,"success").pipe(c.map(function(e){return e.target.result}));return s.race(r,n.toErrorObservable(t,"keys"))}),c.first())},e.prototype.has=function(t){var r=this;return this.fallback?this.fallback.has(t):this.transaction("readonly").pipe(c.map(function(e){return e.getKey(t)}),c.mergeMap(function(e){var t=s.fromEvent(e,"success").pipe(c.map(function(e){return e.target.result}),c.map(function(e){return e!==undefined}));return s.race(t,r.toErrorObservable(e,"has"))}),c.first())},e.prototype.connect=function(e){var t,r=this;void 0===e&&(e=null);try{t=indexedDB.open(this.dbName)}catch(o){return void this.setFallback(e)}s.fromEvent(t,"upgradeneeded").pipe(c.first()).subscribe(function(e){var t=e.target.result;t.objectStoreNames.contains(r.objectStoreName)||t.createObjectStore(r.objectStoreName)});var n=s.fromEvent(t,"success");s.race(n,this.toErrorObservable(t,"connection")).pipe(c.first()).subscribe(function(e){r.database.next(e.target.result)},function(){r.setFallback(e)})},e.prototype.transaction=function(t){var r=this;return void 0===t&&(t="readonly"),this.database.pipe(c.map(function(e){return e.transaction([r.objectStoreName],t).objectStore(r.objectStoreName)}))},e.prototype.toSuccessObservable=function(e){return s.fromEvent(e,"success").pipe(c.map(function(){return!0}))},e.prototype.toErrorObservable=function(e,t){return void 0===t&&(t=""),s.fromEvent(e,"error").pipe(c.mergeMap(function(){return s.throwError(new Error("IndexedDB "+t+" issue : "+e.error.message+"."))}))},e.prototype.setFallback=function(e){this.fallback=new o(e)},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:undefined,decorators:[{type:t.Optional},{type:t.Inject,args:[n]}]}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(n,8))},token:e,providedIn:"root"}),e}(),i=function(){function e(){this.localStorage=new Map}return Object.defineProperty(e.prototype,"size",{get:function(){return s.of(this.localStorage.size)},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e){var t=this.localStorage.get(e);return s.of(t!==undefined?t:null)},e.prototype.setItem=function(e,t){return this.localStorage.set(e,t),s.of(!0)},e.prototype.removeItem=function(e){return this.localStorage["delete"](e),s.of(!0)},e.prototype.clear=function(){return this.localStorage.clear(),s.of(!0)},e.prototype.keys=function(){return s.of(Array.from(this.localStorage.keys()))},e.prototype.has=function(e){return s.of(this.localStorage.has(e))},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();function u(e,t){return r.isPlatformBrowser(e)&&"indexedDB"in window&&indexedDB!==undefined&&null!==indexedDB?new a(t):r.isPlatformBrowser(e)&&"localStorage"in window&&localStorage!==undefined&&null!==localStorage?new o(t):new i}var l=function(){function e(){}return e.decorators=[{type:t.Injectable,args:[{providedIn:"root",useFactory:u,deps:[t.PLATFORM_ID,[new t.Optional,n]]}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return u(t.inject(t.PLATFORM_ID),t.inject(n,8))},token:e,providedIn:"root"}),e}();function p(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}var f=function(){function e(){}return e.prototype.validate=function(e,t){if(!((t.hasOwnProperty("const")&&t["const"]!==undefined||t.hasOwnProperty("enum")&&null!=t["enum"]||t.hasOwnProperty("type")&&null!=t.type)&&"array"!==t.type&&"object"!==t.type||t.hasOwnProperty("properties")&&null!=t.properties||t.hasOwnProperty("items")&&null!=t.items))throw new Error("Each value must have a 'type' or 'properties' or 'items' or 'const' or 'enum', to enforce strict types.");return(!t.hasOwnProperty("const")||t["const"]===undefined||e===t["const"])&&(!!this.validateEnum(e,t)&&(!!this.validateType(e,t)&&(!!this.validateItems(e,t)&&(!!this.validateProperties(e,t)&&!!this.validateRequired(e,t)))))},e.prototype.isObjectNotNull=function(e){return null!==e&&"object"==typeof e},e.prototype.validateProperties=function(e,t){if(!t.hasOwnProperty("properties")||null==t.properties)return!0;if(!this.isObjectNotNull(e))return!1;if(Object.keys(t.properties).length<Object.keys(e).length)return!1;for(var r in t.properties)if(t.properties.hasOwnProperty(r)&&e.hasOwnProperty(r)&&!this.validate(e[r],t.properties[r]))return!1;return!0},e.prototype.validateRequired=function(e,t){var r,n;if(!t.hasOwnProperty("required")||null==t.required)return!0;if(!this.isObjectNotNull(e))return!1;try{for(var o=p(t.required),a=o.next();!a.done;a=o.next()){var i=a.value;if(!t.properties||!t.properties.hasOwnProperty(i))throw new Error("'required' properties must be described in 'properties' too.");if(!e.hasOwnProperty(i))return!1}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o["return"])&&n.call(o)}finally{if(r)throw r.error}}return!0},e.prototype.validateEnum=function(e,t){return!t.hasOwnProperty("enum")||null==t["enum"]||-1!==t["enum"].indexOf(e)},e.prototype.validateType=function(e,t){if(!t.hasOwnProperty("type")||null==t.type)return!0;switch(t.type){case"null":return null===e;case"string":return this.validateString(e,t);case"number":case"integer":return this.validateNumber(e,t);case"boolean":return"boolean"==typeof e;case"object":return"object"==typeof e;case"array":return Array.isArray(e)}return!0},e.prototype.validateItems=function(e,t){var r,n;if(!t.hasOwnProperty("items")||null==t.items)return!0;if(!Array.isArray(e))return!1;if(t.hasOwnProperty("maxItems")&&null!=t.maxItems){if(!Number.isInteger(t.maxItems)||t.maxItems<0)throw new Error("'maxItems' must be a non-negative integer.");if(e.length>t.maxItems)return!1}if(t.hasOwnProperty("minItems")&&null!=t.minItems){if(!Number.isInteger(t.minItems)||t.minItems<0)throw new Error("'minItems' must be a non-negative integer.");if(e.length<t.minItems)return!1}if(t.hasOwnProperty("uniqueItems")&&null!=t.uniqueItems&&t.uniqueItems){var o=new Set(e);if(e.length!==o.size)return!1}if(Array.isArray(t.items))return this.validateItemsList(e,t);try{for(var a=p(e),i=a.next();!i.done;i=a.next()){var u=i.value;if(!this.validate(u,t.items))return!1}}catch(s){r={error:s}}finally{try{i&&!i.done&&(n=a["return"])&&n.call(a)}finally{if(r)throw r.error}}return!0},e.prototype.validateItemsList=function(e,t){var r=t.items;if(e.length!==r.length)return!1;for(var n=0;n<r.length;n+=1)if(!this.validate(e[n],r[n]))return!1;return!0},e.prototype.validateString=function(e,t){if("string"!=typeof e)return!1;if(t.hasOwnProperty("maxLength")&&null!=t.maxLength){if(!Number.isInteger(t.maxLength)||t.maxLength<0)throw new Error("'maxLength' must be a non-negative integer.");if(e.length>t.maxLength)return!1}if(t.hasOwnProperty("minLength")&&null!=t.minLength){if(!Number.isInteger(t.minLength)||t.minLength<0)throw new Error("'minLength' must be a non-negative integer.");if(e.length<t.minLength)return!1}if(t.hasOwnProperty("pattern")&&null!=t.pattern&&!new RegExp(t.pattern).test(e))return!1;return!0},e.prototype.validateNumber=function(e,t){if("number"!=typeof e)return!1;if("integer"===t.type&&!Number.isInteger(e))return!1;if(t.hasOwnProperty("multipleOf")&&null!=t.multipleOf){if(t.multipleOf<=0)throw new Error("'multipleOf' must be a number strictly greater than 0.");if(!Number.isInteger(e/t.multipleOf))return!1}return!(t.hasOwnProperty("maximum")&&null!=t.maximum&&e>t.maximum)&&(!(t.hasOwnProperty("exclusiveMaximum")&&null!=t.exclusiveMaximum&&e>=t.exclusiveMaximum)&&(!(t.hasOwnProperty("minimum")&&null!=t.minimum&&e<t.minimum)&&!(t.hasOwnProperty("exclusiveMinimum")&&null!=t.exclusiveMinimum&&e<=t.exclusiveMinimum)))},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=t.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),m=function(){function e(e,t){this.database=e,this.jsonValidator=t,this.getItemOptionsDefault={schema:null}}return Object.defineProperty(e.prototype,"size",{get:function(){return this.database.size},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e,n){var o=this;return void 0===n&&(n=this.getItemOptionsDefault),this.database.getItem(e).pipe(c.mergeMap(function(e){if(null===e)return s.of(null);if(n.schema){var t=!0;try{t=o.jsonValidator.validate(e,n.schema)}catch(r){return s.throwError(r)}if(!t)return s.throwError(new Error("JSON invalid"))}return s.of(e)}))},e.prototype.getUnsafeItem=function(e){return this.database.getItem(e)},e.prototype.setItem=function(e,t){return this.database.setItem(e,t)},e.prototype.removeItem=function(e){return this.database.removeItem(e)},e.prototype.clear=function(){return this.database.clear()},e.prototype.keys=function(){return this.database.keys()},e.prototype.has=function(e){return this.database.has(e)},e.prototype.setItemSubscribe=function(e,t){this.setItem(e,t).subscribe(function(){},function(){})},e.prototype.removeItemSubscribe=function(e){this.removeItem(e).subscribe(function(){},function(){})},e.prototype.clearSubscribe=function(){this.clear().subscribe(function(){},function(){})},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:l},{type:f}]},e.ngInjectableDef=t.defineInjectable({factory:function(){return new e(t.inject(l),t.inject(f))},token:e,providedIn:"root"}),e}();e.LocalDatabase=l,e.IndexedDBDatabase=a,e.LocalStorageDatabase=o,e.MockLocalDatabase=i,e.JSONValidator=f,e.LocalStorage=m,e.localStorageProviders=function h(e){return[e.prefix?{provide:n,useValue:e.prefix}:[]]},e.LOCAL_STORAGE_PREFIX=n,e.ɵa=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-pwa-local-storage.umd.min.js.map |
@@ -74,3 +74,3 @@ /** | ||
*/ | ||
if (Object.keys(schema.properties).length !== Object.keys(data).length) { | ||
if (Object.keys(schema.properties).length < Object.keys(data).length) { | ||
return false; | ||
@@ -305,2 +305,2 @@ } | ||
/** @nocollapse */ JSONValidator.ngInjectableDef = i0.defineInjectable({ factory: function JSONValidator_Factory() { return new JSONValidator(); }, token: JSONValidator, providedIn: "root" }); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNvbi12YWxpZGF0b3IuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4LXB3YS9sb2NhbC1zdG9yYWdlLyIsInNvdXJjZXMiOlsibGliL3ZhbGlkYXRpb24vanNvbi12YWxpZGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7Ozs7O0FBUzNDLE1BQU0sT0FBTyxhQUFhOzs7Ozs7Ozs7OztJQVl4QixRQUFRLENBQUMsSUFBUyxFQUFFLE1BQWtCO1FBRXBDLDRFQUE0RTtRQUM1RSxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxPQUFPLENBQUMsSUFBSSxNQUFNLENBQUMsS0FBSyxLQUFLLFNBQVMsQ0FBQztlQUNsRSxDQUFDLENBQUMsTUFBTSxDQUFDLG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NoZW1hLmhhc093blByb3BlcnR5KCdleGNsdXNpdmVNaW5pbXVtJykgJiYgKHNjaGVtYS5leGNsdXNpdmVNaW5pbXVtICE9IG51bGwpKSB7XG5cbiAgICAgIGlmIChkYXRhIDw9IHNjaGVtYS5leGNsdXNpdmVNaW5pbXVtKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cblxuICAgIH1cblxuICAgIHJldHVybiB0cnVlO1xuXG4gIH1cblxufVxuIl19 |
@@ -108,3 +108,3 @@ /** | ||
*/ | ||
if (Object.keys(schema.properties).length !== Object.keys(data).length) { | ||
if (Object.keys(schema.properties).length < Object.keys(data).length) { | ||
return false; | ||
@@ -405,2 +405,2 @@ } | ||
export { JSONValidator }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNvbi12YWxpZGF0b3IuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4LXB3YS9sb2NhbC1zdG9yYWdlLyIsInNvdXJjZXMiOlsibGliL3ZhbGlkYXRpb24vanNvbi12YWxpZGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOzs7OztBQU0zQztJQUFBO0tBeVhDO0lBcFhDOzs7Ozs7Ozs7T0FTRzs7Ozs7Ozs7Ozs7SUFDSCxnQ0FBUTs7Ozs7Ozs7OztJQUFSLFVBQVMsSUFBUyxFQUFFLE1BQWtCO1FBRXBDLDRFQUE0RTtRQUM1RSxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxPQUFPLENBQUMsSUFBSSxNQUFNLENBQUMsS0FBSyxLQUFLLFNBQVMsQ0FBQztlQUNsRSxDQUFDLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQyxNQUFNLENBQUMsSUFBSSxNQUFNLENBQUMsSUFBSSxJ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bScpICYmIChzY2hlbWEubWF4aW11bSAhPSBudWxsKSkge1xuXG4gICAgICBpZiAoZGF0YSA+IHNjaGVtYS5tYXhpbXVtKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cblxuICAgIH1cblxuICAgIGlmIChzY2hlbWEuaGFzT3duUHJvcGVydHkoJ2V4Y2x1c2l2ZU1heGltdW0nKSAmJiAoc2NoZW1hLmV4Y2x1c2l2ZU1heGltdW0gIT0gbnVsbCkpIHtcblxuICAgICAgaWYgKGRhdGEgPj0gc2NoZW1hLmV4Y2x1c2l2ZU1heGltdW0pIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuXG4gICAgfVxuXG4gICAgaWYgKHNjaGVtYS5oYXNPd25Qcm9wZXJ0eSgnbWluaW11bScpICYmIChzY2hlbWEubWluaW11bSAhPSBudWxsKSkge1xuXG4gICAgICBpZiAoZGF0YSA8IHNjaGVtYS5taW5pbXVtKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cblxuICAgIH1cblxuICAgIGlmIChzY2hlbWEuaGFzT3duUHJvcGVydHkoJ2V4Y2x1c2l2ZU1pbmltdW0nKSAmJiAoc2NoZW1hLmV4Y2x1c2l2ZU1pbmltdW0gIT0gbnVsbCkpIHtcblxuICAgICAgaWYgKGRhdGEgPD0gc2NoZW1hLmV4Y2x1c2l2ZU1pbmltdW0pIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuXG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG5cbiAgfVxuXG59XG4iXX0= |
{ | ||
"name": "@ngx-pwa/local-storage", | ||
"version": "7.2.0", | ||
"version": "7.2.1", | ||
"description": "Efficient local storage module for Angular apps and PWA: simple API based on native localStorage API, but internally stored via the asynchronous IndexedDB API for performance, and wrapped in RxJS observables to be homogeneous with other Angular modules.", | ||
@@ -5,0 +5,0 @@ "author": "Cyrille Tuzi", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
936211