@ngx-pwa/local-storage
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngx-pwa/local-storage",["exports","@angular/core","@angular/common","rxjs","rxjs/operators"],t):t(((e=e||self)["ngx-pwa"]=e["ngx-pwa"]||{},e["ngx-pwa"]["local-storage"]={}),e.ng.core,e.ng.common,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function a(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function u(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,n){t(r,n,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(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 p="indexedDB is not working",l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.message=p,t}return a(t,e),t}(Error),d="The storage is currently localStorage,\nwhere data must be serialized, and the provided data can't be serialized.",h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.message=d,t}return a(t,e),t}(Error),y=new t.InjectionToken("localStoragePrefix",{providedIn:"root",factory:function(){return""}}),g=new t.InjectionToken("localStoragePrefix",{providedIn:"root",factory:function(){return""}}),v="ngStorage",m=new t.InjectionToken("localStorageIDBDBName",{providedIn:"root",factory:function(){return v}}),b=1,I=new t.InjectionToken("localStorageIDBDBVersion",{providedIn:"root",factory:function(){return b}}),j="localStorage",x=new t.InjectionToken("localStorageIDBStoreName",{providedIn:"root",factory:function(){return j}}),S=!1,w=new t.InjectionToken("localStorageIDBWrap",{providedIn:"root",factory:function(){return S}});var O=function(){function e(e,t,r,o,i){void 0===e&&(e=v),void 0===t&&(t=j),void 0===r&&(r=b),void 0===o&&(o=S),void 0===i&&(i=""),this.database=new n.ReplaySubject(1),this.wrapIndex="value",this.dbName=i?i+"_"+e:e,this.storeName=t,this.dbVersion=r,this.noWrap=o,this.connect()}return Object.defineProperty(e.prototype,"backingStore",{get:function(){return{database:this.dbName,store:this.storeName,version:this.dbVersion}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var e=this;return this.transaction("readonly").pipe(o.mergeMap(function(t){var r=t.count();return e.requestEventsAndMapTo(r,function(){return r.result})}),o.first())},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t=this;return this.transaction("readonly").pipe(o.mergeMap(function(r){var n=r.get(e);return t.requestEventsAndMapTo(n,function(){return n.result!==undefined&&null!==n.result?!t.noWrap&&"object"==typeof n.result&&t.wrapIndex in n.result&&n.result[t.wrapIndex]!==undefined&&null!==n.result[t.wrapIndex]?n.result[t.wrapIndex]:n.result:undefined})}),o.first())},e.prototype.set=function(e,t){var r=this;return t===undefined?this["delete"](e):this.transaction("readwrite").pipe(o.mergeMap(function(n){var i=r.getKeyRequest(n,e);return r.requestEventsAndMapTo(i,function(){return i.result}).pipe(o.mergeMap(function(o){var i,a=r.noWrap?t:((i={})[r.wrapIndex]=t,i),u=o===undefined?n.add(a,e):n.put(a,e);return r.requestEventsAndMapTo(u,function(){return undefined})}))}),o.first())},e.prototype["delete"]=function(e){var t=this;return this.transaction("readwrite").pipe(o.mergeMap(function(r){var n=r["delete"](e);return t.requestEventsAndMapTo(n,function(){return undefined})}),o.first())},e.prototype.clear=function(){var e=this;return this.transaction("readwrite").pipe(o.mergeMap(function(t){var r=t.clear();return e.requestEventsAndMapTo(r,function(){return undefined})}),o.first())},e.prototype.keys=function(){var e=this;return this.transaction("readonly").pipe(o.first(),o.mergeMap(function(t){var r="openKeyCursor"in t?t.openKeyCursor():t.openCursor(),i=e.successEvent(r).pipe(o.takeWhile(function(){return null!==r.result}),o.map(function(){return r.result.key.toString()}),o.tap(function(){r.result["continue"]()})),a=e.errorEvent(r);return n.race([i,a])}))},e.prototype.has=function(e){var t=this;return this.transaction("readonly").pipe(o.mergeMap(function(r){var n=t.getKeyRequest(r,e);return t.requestEventsAndMapTo(n,function(){return n.result!==undefined})}),o.first())},e.prototype.connect=function(){var e,t=this;try{e=indexedDB.open(this.dbName,this.dbVersion)}catch(r){return void this.database.error(new l)}this.createStore(e),n.race([this.successEvent(e),this.errorEvent(e)]).pipe(o.first()).subscribe({next:function(){t.database.next(e.result)},error:function(){t.database.error(new l)}})},e.prototype.createStore=function(e){var t=this;n.fromEvent(e,"upgradeneeded").pipe(o.first()).subscribe({next:function(){e.result.objectStoreNames.contains(t.storeName)||e.result.createObjectStore(t.storeName)}})},e.prototype.transaction=function(e){var t=this;return this.database.pipe(o.mergeMap(function(r){var o;try{o=r.transaction([t.storeName],e).objectStore(t.storeName)}catch(i){return n.throwError(i)}return n.of(o)}))},e.prototype.successEvent=function(e){return n.fromEvent(e,"success")},e.prototype.errorEvent=function(e){return n.fromEvent(e,"error").pipe(o.mergeMap(function(){return n.throwError(e.error)}))},e.prototype.requestEventsAndMapTo=function(e,t){var r=this.successEvent(e).pipe(o.map(t)),i=this.errorEvent(e);return n.race([r,i])},e.prototype.getKeyRequest=function(e,t){return"getKey"in e?e.getKey(t):e.get(t)},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(m),t.ɵɵinject(x),t.ɵɵinject(I),t.ɵɵinject(w),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),c(0,t.Inject(m)),c(1,t.Inject(x)),c(2,t.Inject(I)),c(3,t.Inject(w)),c(4,t.Inject(y)),s("design:paramtypes",[Object,Object,Object,Object,Object])],e)}(),D=function(){function e(e,t){void 0===e&&(e=""),void 0===t&&(t=""),this.prefix=e||(t?t+"_":"")}return Object.defineProperty(e.prototype,"size",{get:function(){return n.of(localStorage.length)},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t,r=localStorage.getItem(this.prefixKey(e));if(r!==undefined&&null!==r)try{t=JSON.parse(r)}catch(o){return n.throwError(o)}return n.of(t)},e.prototype.set=function(e,t){var r=null,o=Object.getPrototypeOf(t);if("object"==typeof t&&null!==t&&!Array.isArray(t)&&o!==Object.prototype&&null!==o)return n.throwError(new h);try{r=JSON.stringify(t)}catch(i){return n.throwError(i)}try{localStorage.setItem(this.prefixKey(e),r)}catch(i){return n.throwError(i)}return n.of(undefined)},e.prototype["delete"]=function(e){return localStorage.removeItem(this.prefixKey(e)),n.of(undefined)},e.prototype.clear=function(){return localStorage.clear(),n.of(undefined)},e.prototype.keys=function(){var e=this;return new n.Observable(function(t){for(var r=0;r<localStorage.length;r+=1)t.next(e.getUnprefixedKey(r));t.complete()}).pipe(o.observeOn(n.asyncScheduler))},e.prototype.has=function(e){for(var t=0;t<localStorage.length;t+=1)if(e===this.getUnprefixedKey(t))return n.of(!0);return n.of(!1)},e.prototype.getUnprefixedKey=function(e){var t=localStorage.key(e);return null!==t?this.prefix?t.substr(this.prefix.length):t:null},e.prototype.prefixKey=function(e){return""+this.prefix+e},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(g),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),c(0,t.Inject(g)),c(1,t.Inject(y)),s("design:paramtypes",[Object,Object])],e)}(),E=function(){function e(){this.memoryStorage=new Map}return Object.defineProperty(e.prototype,"size",{get:function(){return n.of(this.memoryStorage.size)},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t=this.memoryStorage.get(e);return n.of(t)},e.prototype.set=function(e,t){return this.memoryStorage.set(e,t),n.of(undefined)},e.prototype["delete"]=function(e){return this.memoryStorage["delete"](e),n.of(undefined)},e.prototype.clear=function(){return this.memoryStorage.clear(),n.of(undefined)},e.prototype.keys=function(){return n.from(this.memoryStorage.keys())},e.prototype.has=function(e){return n.of(this.memoryStorage.has(e))},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"})],e)}();function k(e,t,n,o,i,a,u){return r.isPlatformBrowser(e)&&indexedDB!==undefined&&null!==indexedDB&&"open"in indexedDB?new O(n,o,i,a,u):r.isPlatformBrowser(e)&&localStorage!==undefined&&null!==localStorage&&"getItem"in localStorage?new D(t,u):new E}var B=function(){function e(){}return e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return k(t.ɵɵinject(t.PLATFORM_ID),t.ɵɵinject(g),t.ɵɵinject(m),t.ɵɵinject(x),t.ɵɵinject(I),t.ɵɵinject(w),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root",useFactory:k,deps:[t.PLATFORM_ID,g,m,x,I,w,y]})],e)}(),M="Data stored is not valid against the provided JSON schema.\nCheck your JSON schema, otherwise it means data has been corrupted.",P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.message=M,t}return a(t,e),t}(Error),N=function(){function e(){}return e.prototype.validate=function(e,t){switch(t.type){case"string":return this.validateString(e,t);case"number":case"integer":return this.validateNumber(e,t);case"boolean":return this.validateBoolean(e,t);case"array":return this.validateArray(e,t);case"object":return this.validateObject(e,t)}},e.prototype.validateString=function(e,t){if("string"!=typeof e)return!1;if(!this.validateConst(e,t))return!1;if(!this.validateEnum(e,t))return!1;if(t.maxLength!==undefined&&e.length>t.maxLength)return!1;if(t.minLength!==undefined&&e.length<t.minLength)return!1;if(t.pattern){var r=null;try{r=new RegExp(t.pattern)}catch(n){}if(r&&!r.test(e))return!1}return!0},e.prototype.validateNumber=function(e,t){return"number"==typeof e&&(!("integer"===t.type&&!Number.isInteger(e))&&(!!this.validateConst(e,t)&&(!!this.validateEnum(e,t)&&(!(t.multipleOf&&!Number.isInteger(e/t.multipleOf))&&(!(t.maximum!==undefined&&e>t.maximum)&&(!(t.exclusiveMaximum!==undefined&&e>=t.exclusiveMaximum)&&(!(t.minimum!==undefined&&e<t.minimum)&&!(t.exclusiveMinimum!==undefined&&e<=t.exclusiveMinimum))))))))},e.prototype.validateBoolean=function(e,t){return"boolean"==typeof e&&!!this.validateConst(e,t)},e.prototype.validateArray=function(e,t){var r,n;if(!Array.isArray(e))return!1;if(t.maxItems!==undefined&&e.length>t.maxItems)return!1;if(t.minItems!==undefined&&e.length<t.minItems)return!1;if(t.uniqueItems){var o=new Set(e);if(e.length!==o.size)return!1}if(Array.isArray(t.items))return this.validateTuple(e,t.items);try{for(var i=f(e),a=i.next();!a.done;a=i.next()){var u=a.value;if(!this.validate(u,t.items))return!1}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i["return"])&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.validateTuple=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<t.length;r+=1)if(!this.validate(e[r],t[r]))return!1;return!0},e.prototype.validateObject=function(e,t){var r,n;if(null===e||"object"!=typeof e)return!1;if(Object.keys(t.properties).length<Object.keys(e).length)return!1;if(t.required)try{for(var o=f(t.required),i=o.next();!i.done;i=o.next()){var a=i.value;if(!e.hasOwnProperty(a))return!1}}catch(c){r={error:c}}finally{try{i&&!i.done&&(n=o["return"])&&n.call(o)}finally{if(r)throw r.error}}for(var u in t.properties)if(t.properties.hasOwnProperty(u)&&e.hasOwnProperty(u)&&!this.validate(e[u],t.properties[u]))return!1;return!0},e.prototype.validateConst=function(e,t){return!t["const"]||e===t["const"]},e.prototype.validateEnum=function(e,t){return!t["enum"]||t["enum"].includes(e)},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"})],e)}(),A=function(){function e(e,t,r,n){void 0===t&&(t=new N),void 0===r&&(r=""),void 0===n&&(n=""),this.database=e,this.jsonValidator=t,this.LSPrefix=r,this.oldPrefix=n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.database.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backingEngine",{get:function(){return this.database instanceof O?"indexedDB":this.database instanceof D?"localStorage":this.database instanceof E?"memory":"unknown"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backingStore",{get:function(){return this.database instanceof O?this.database.backingStore:{database:"",store:"",version:0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fallbackBackingStore",{get:function(){return this.database instanceof D?{prefix:this.database.prefix}:{prefix:""}},enumerable:!0,configurable:!0}),e.prototype.get=function(e,t){var r=this;return this.database.get(e).pipe(this.catchIDBBroken(function(){return r.database.get(e)}),o.mergeMap(function(e){return e===undefined||null===e?n.of(undefined):t?r.jsonValidator.validate(e,t)?n.of(e):n.throwError(new P):n.of(e)}))},e.prototype.set=function(e,t,r){var o=this;return t===undefined||null===t?this["delete"](e):r&&!this.jsonValidator.validate(t,r)?n.throwError(new P):this.database.set(e,t).pipe(this.catchIDBBroken(function(){return o.database.set(e,t)}))},e.prototype["delete"]=function(e){var t=this;return this.database["delete"](e).pipe(this.catchIDBBroken(function(){return t.database["delete"](e)}))},e.prototype.clear=function(){var e=this;return this.database.clear().pipe(this.catchIDBBroken(function(){return e.database.clear()}))},e.prototype.keys=function(){var e=this;return this.database.keys().pipe(this.catchIDBBroken(function(){return e.database.keys()}))},e.prototype.has=function(e){var t=this;return this.database.has(e).pipe(this.catchIDBBroken(function(){return t.database.has(e)}))},e.prototype.catchIDBBroken=function(e){var t=this;return o.catchError(function(r){return r!==undefined&&null!==r&&r.message===p?(t.database=new D(t.LSPrefix,t.oldPrefix),e()):n.throwError(r)})},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(B),t.ɵɵinject(N),t.ɵɵinject(g),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),c(2,t.Inject(g)),c(3,t.Inject(y)),s("design:paramtypes",[B,N,Object,Object])],e)}(),T=function(){function e(e){this.storageMap=e}return Object.defineProperty(e.prototype,"size",{get:function(){return this.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.storageMap.size},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e,t){if(t){var r="schema"in t?t.schema:t;return this.storageMap.get(e,r).pipe(o.map(function(e){return e!==undefined?e:null}))}return this.storageMap.get(e).pipe(o.map(function(e){return e!==undefined?e:null}))},e.prototype.setItem=function(e,t,r){return this.storageMap.set(e,t,r).pipe(o.mapTo(!0))},e.prototype.removeItem=function(e){return this.storageMap["delete"](e).pipe(o.mapTo(!0))},e.prototype.clear=function(){return this.storageMap.clear().pipe(o.mapTo(!0))},e.prototype.keys=function(){return this.storageMap.keys().pipe(o.toArray())},e.prototype.has=function(e){return this.storageMap.has(e)},e.prototype.setItemSubscribe=function(e,t){this.setItem(e,t).subscribe({next:function(){},error:function(){}})},e.prototype.removeItemSubscribe=function(e){this.removeItem(e).subscribe({next:function(){},error:function(){}})},e.prototype.clearSubscribe=function(){this.clear().subscribe({next:function(){},error:function(){}})},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(A))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),s("design:paramtypes",[A])],e)}(),R=function(){function e(){}var r;return r=e,e.forRoot=function(e){return{ngModule:r,providers:[e.LSPrefix?{provide:g,useValue:e.LSPrefix}:[],e.IDBDBName?{provide:m,useValue:e.IDBDBName}:[],e.IDBStoreName?{provide:x,useValue:e.IDBStoreName}:[],e.IDBDBVersion?{provide:I,useValue:e.IDBDBVersion}:[],e.IDBNoWrap?{provide:w,useValue:e.IDBNoWrap}:[]]}},e=r=u([t.NgModule()],e)}();e.JSONValidator=N,e.LOCAL_STORAGE_PREFIX=y,e.LocalDatabase=B,e.LocalStorage=T,e.SERIALIZATION_ERROR=d,e.SerializationError=h,e.StorageMap=A,e.StorageModule=R,e.VALIDATION_ERROR=M,e.ValidationError=P,e.localStorageProviders=function(e){return[e.prefix?{provide:y,useValue:e.prefix}:[]]},e.ɵa=g,e.ɵb=m,e.ɵc=I,e.ɵd=x,e.ɵe=w,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngx-pwa/local-storage",["exports","@angular/core","@angular/common","rxjs","rxjs/operators"],t):t(((e=e||self)["ngx-pwa"]=e["ngx-pwa"]||{},e["ngx-pwa"]["local-storage"]={}),e.ng.core,e.ng.common,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function a(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function u(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,n){t(r,n,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(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 p="indexedDB is not working",l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.message=p,t}return a(t,e),t}(Error),d="The storage is currently localStorage,\nwhere data must be serialized, and the provided data can't be serialized.",h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.message=d,t}return a(t,e),t}(Error),y=new t.InjectionToken("localStoragePrefix",{providedIn:"root",factory:function(){return""}}),g=new t.InjectionToken("localStoragePrefix",{providedIn:"root",factory:function(){return""}}),v="ngStorage",m=new t.InjectionToken("localStorageIDBDBName",{providedIn:"root",factory:function(){return v}}),b=1,I=new t.InjectionToken("localStorageIDBDBVersion",{providedIn:"root",factory:function(){return b}}),j="localStorage",x=new t.InjectionToken("localStorageIDBStoreName",{providedIn:"root",factory:function(){return j}}),S=!1,w=new t.InjectionToken("localStorageIDBWrap",{providedIn:"root",factory:function(){return S}});var O=function(){function e(e,t,r,o,i){void 0===e&&(e=v),void 0===t&&(t=j),void 0===r&&(r=b),void 0===o&&(o=S),void 0===i&&(i=""),this.database=new n.ReplaySubject(1),this.wrapIndex="value",this.dbName=i?i+"_"+e:e,this.storeName=t,this.dbVersion=r,this.noWrap=o,this.connect()}return Object.defineProperty(e.prototype,"backingStore",{get:function(){return{database:this.dbName,store:this.storeName,version:this.dbVersion}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var e=this;return this.transaction("readonly").pipe(o.mergeMap(function(t){var r=t.count();return e.requestEventsAndMapTo(r,function(){return r.result})}),o.first())},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t=this;return this.transaction("readonly").pipe(o.mergeMap(function(r){var n=r.get(e);return t.requestEventsAndMapTo(n,function(){return n.result!==undefined&&null!==n.result?!t.noWrap&&"object"==typeof n.result&&t.wrapIndex in n.result&&n.result[t.wrapIndex]!==undefined&&null!==n.result[t.wrapIndex]?n.result[t.wrapIndex]:n.result:undefined})}),o.first())},e.prototype.set=function(e,t){var r=this;return t===undefined?this["delete"](e):this.transaction("readwrite").pipe(o.mergeMap(function(n){var i=r.getKeyRequest(n,e);return r.requestEventsAndMapTo(i,function(){return i.result}).pipe(o.mergeMap(function(o){var i,a=r.noWrap?t:((i={})[r.wrapIndex]=t,i),u=o===undefined?n.add(a,e):n.put(a,e);return r.requestEventsAndMapTo(u,function(){return undefined})}))}),o.first())},e.prototype["delete"]=function(e){var t=this;return this.transaction("readwrite").pipe(o.mergeMap(function(r){var n=r["delete"](e);return t.requestEventsAndMapTo(n,function(){return undefined})}),o.first())},e.prototype.clear=function(){var e=this;return this.transaction("readwrite").pipe(o.mergeMap(function(t){var r=t.clear();return e.requestEventsAndMapTo(r,function(){return undefined})}),o.first())},e.prototype.keys=function(){var e=this;return this.transaction("readonly").pipe(o.first(),o.mergeMap(function(t){var r="openKeyCursor"in t?t.openKeyCursor():t.openCursor(),i=e.successEvent(r).pipe(o.takeWhile(function(){return null!==r.result}),o.map(function(){return r.result.key.toString()}),o.tap(function(){r.result["continue"]()})),a=e.errorEvent(r);return n.race([i,a])}))},e.prototype.has=function(e){var t=this;return this.transaction("readonly").pipe(o.mergeMap(function(r){var n=t.getKeyRequest(r,e);return t.requestEventsAndMapTo(n,function(){return n.result!==undefined})}),o.first())},e.prototype.connect=function(){var e,t=this;try{e=indexedDB.open(this.dbName,this.dbVersion)}catch(r){return void this.database.error(new l)}this.createStore(e),n.race([this.successEvent(e),this.errorEvent(e)]).pipe(o.first()).subscribe({next:function(){t.database.next(e.result)},error:function(){t.database.error(new l)}})},e.prototype.createStore=function(e){var t=this;n.fromEvent(e,"upgradeneeded").pipe(o.first()).subscribe({next:function(){e.result.objectStoreNames.contains(t.storeName)||e.result.createObjectStore(t.storeName)}})},e.prototype.transaction=function(e){var t=this;return this.database.pipe(o.mergeMap(function(r){var o;try{o=r.transaction([t.storeName],e).objectStore(t.storeName)}catch(i){return n.throwError(i)}return n.of(o)}))},e.prototype.successEvent=function(e){return n.fromEvent(e,"success")},e.prototype.errorEvent=function(e){return n.fromEvent(e,"error").pipe(o.mergeMap(function(){return n.throwError(e.error)}))},e.prototype.requestEventsAndMapTo=function(e,t){var r=this.successEvent(e).pipe(o.map(t)),i=this.errorEvent(e);return n.race([r,i])},e.prototype.getKeyRequest=function(e,t){return"getKey"in e?e.getKey(t):e.get(t)},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(m),t.ɵɵinject(x),t.ɵɵinject(I),t.ɵɵinject(w),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),c(0,t.Inject(m)),c(1,t.Inject(x)),c(2,t.Inject(I)),c(3,t.Inject(w)),c(4,t.Inject(y)),s("design:paramtypes",[Object,Object,Object,Object,Object])],e)}(),D=function(){function e(e,t){void 0===e&&(e=""),void 0===t&&(t=""),this.prefix=e||(t?t+"_":"")}return Object.defineProperty(e.prototype,"size",{get:function(){return n.of(localStorage.length)},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t,r=localStorage.getItem(this.prefixKey(e));if(r!==undefined&&null!==r)try{t=JSON.parse(r)}catch(o){return n.throwError(o)}return n.of(t)},e.prototype.set=function(e,t){var r=null,o=Object.getPrototypeOf(t);if("object"==typeof t&&null!==t&&!Array.isArray(t)&&o!==Object.prototype&&null!==o)return n.throwError(new h);try{r=JSON.stringify(t)}catch(i){return n.throwError(i)}try{localStorage.setItem(this.prefixKey(e),r)}catch(i){return n.throwError(i)}return n.of(undefined)},e.prototype["delete"]=function(e){return localStorage.removeItem(this.prefixKey(e)),n.of(undefined)},e.prototype.clear=function(){return localStorage.clear(),n.of(undefined)},e.prototype.keys=function(){var e=this;return new n.Observable(function(t){for(var r=0;r<localStorage.length;r+=1)t.next(e.getUnprefixedKey(r));t.complete()}).pipe(o.observeOn(n.asyncScheduler))},e.prototype.has=function(e){for(var t=0;t<localStorage.length;t+=1)if(e===this.getUnprefixedKey(t))return n.of(!0);return n.of(!1)},e.prototype.getUnprefixedKey=function(e){var t=localStorage.key(e);return null!==t?this.prefix?t.substr(this.prefix.length):t:null},e.prototype.prefixKey=function(e){return""+this.prefix+e},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(g),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),c(0,t.Inject(g)),c(1,t.Inject(y)),s("design:paramtypes",[Object,Object])],e)}(),E=function(){function e(){this.memoryStorage=new Map}return Object.defineProperty(e.prototype,"size",{get:function(){return n.of(this.memoryStorage.size)},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t=this.memoryStorage.get(e);return n.of(t)},e.prototype.set=function(e,t){return this.memoryStorage.set(e,t),n.of(undefined)},e.prototype["delete"]=function(e){return this.memoryStorage["delete"](e),n.of(undefined)},e.prototype.clear=function(){return this.memoryStorage.clear(),n.of(undefined)},e.prototype.keys=function(){return n.from(this.memoryStorage.keys())},e.prototype.has=function(e){return n.of(this.memoryStorage.has(e))},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"})],e)}();function k(e,t,n,o,i,a,u){try{if(r.isPlatformBrowser(e)&&indexedDB!==undefined&&null!==indexedDB&&"open"in indexedDB)return new O(n,o,i,a,u);if(r.isPlatformBrowser(e)&&localStorage!==undefined&&null!==localStorage&&"getItem"in localStorage)return new D(t,u)}catch(c){}return new E}var B=function(){function e(){}return e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return k(t.ɵɵinject(t.PLATFORM_ID),t.ɵɵinject(g),t.ɵɵinject(m),t.ɵɵinject(x),t.ɵɵinject(I),t.ɵɵinject(w),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root",useFactory:k,deps:[t.PLATFORM_ID,g,m,x,I,w,y]})],e)}(),M="Data stored is not valid against the provided JSON schema.\nCheck your JSON schema, otherwise it means data has been corrupted.",P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.message=M,t}return a(t,e),t}(Error),N=function(){function e(){}return e.prototype.validate=function(e,t){switch(t.type){case"string":return this.validateString(e,t);case"number":case"integer":return this.validateNumber(e,t);case"boolean":return this.validateBoolean(e,t);case"array":return this.validateArray(e,t);case"object":return this.validateObject(e,t)}},e.prototype.validateString=function(e,t){if("string"!=typeof e)return!1;if(!this.validateConst(e,t))return!1;if(!this.validateEnum(e,t))return!1;if(t.maxLength!==undefined&&e.length>t.maxLength)return!1;if(t.minLength!==undefined&&e.length<t.minLength)return!1;if(t.pattern){var r=null;try{r=new RegExp(t.pattern)}catch(n){}if(r&&!r.test(e))return!1}return!0},e.prototype.validateNumber=function(e,t){return"number"==typeof e&&(!("integer"===t.type&&!Number.isInteger(e))&&(!!this.validateConst(e,t)&&(!!this.validateEnum(e,t)&&(!(t.multipleOf&&!Number.isInteger(e/t.multipleOf))&&(!(t.maximum!==undefined&&e>t.maximum)&&(!(t.exclusiveMaximum!==undefined&&e>=t.exclusiveMaximum)&&(!(t.minimum!==undefined&&e<t.minimum)&&!(t.exclusiveMinimum!==undefined&&e<=t.exclusiveMinimum))))))))},e.prototype.validateBoolean=function(e,t){return"boolean"==typeof e&&!!this.validateConst(e,t)},e.prototype.validateArray=function(e,t){var r,n;if(!Array.isArray(e))return!1;if(t.maxItems!==undefined&&e.length>t.maxItems)return!1;if(t.minItems!==undefined&&e.length<t.minItems)return!1;if(t.uniqueItems){var o=new Set(e);if(e.length!==o.size)return!1}if(Array.isArray(t.items))return this.validateTuple(e,t.items);try{for(var i=f(e),a=i.next();!a.done;a=i.next()){var u=a.value;if(!this.validate(u,t.items))return!1}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=i["return"])&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.validateTuple=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<t.length;r+=1)if(!this.validate(e[r],t[r]))return!1;return!0},e.prototype.validateObject=function(e,t){var r,n;if(null===e||"object"!=typeof e)return!1;if(Object.keys(t.properties).length<Object.keys(e).length)return!1;if(t.required)try{for(var o=f(t.required),i=o.next();!i.done;i=o.next()){var a=i.value;if(!e.hasOwnProperty(a))return!1}}catch(c){r={error:c}}finally{try{i&&!i.done&&(n=o["return"])&&n.call(o)}finally{if(r)throw r.error}}for(var u in t.properties)if(t.properties.hasOwnProperty(u)&&e.hasOwnProperty(u)&&!this.validate(e[u],t.properties[u]))return!1;return!0},e.prototype.validateConst=function(e,t){return!t["const"]||e===t["const"]},e.prototype.validateEnum=function(e,t){return!t["enum"]||t["enum"].includes(e)},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"})],e)}(),A=function(){function e(e,t,r,n){void 0===t&&(t=new N),void 0===r&&(r=""),void 0===n&&(n=""),this.database=e,this.jsonValidator=t,this.LSPrefix=r,this.oldPrefix=n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.database.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backingEngine",{get:function(){return this.database instanceof O?"indexedDB":this.database instanceof D?"localStorage":this.database instanceof E?"memory":"unknown"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backingStore",{get:function(){return this.database instanceof O?this.database.backingStore:{database:"",store:"",version:0}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fallbackBackingStore",{get:function(){return this.database instanceof D?{prefix:this.database.prefix}:{prefix:""}},enumerable:!0,configurable:!0}),e.prototype.get=function(e,t){var r=this;return this.database.get(e).pipe(this.catchIDBBroken(function(){return r.database.get(e)}),o.mergeMap(function(e){return e===undefined||null===e?n.of(undefined):t?r.jsonValidator.validate(e,t)?n.of(e):n.throwError(new P):n.of(e)}))},e.prototype.set=function(e,t,r){var o=this;return t===undefined||null===t?this["delete"](e):r&&!this.jsonValidator.validate(t,r)?n.throwError(new P):this.database.set(e,t).pipe(this.catchIDBBroken(function(){return o.database.set(e,t)}))},e.prototype["delete"]=function(e){var t=this;return this.database["delete"](e).pipe(this.catchIDBBroken(function(){return t.database["delete"](e)}))},e.prototype.clear=function(){var e=this;return this.database.clear().pipe(this.catchIDBBroken(function(){return e.database.clear()}))},e.prototype.keys=function(){var e=this;return this.database.keys().pipe(this.catchIDBBroken(function(){return e.database.keys()}))},e.prototype.has=function(e){var t=this;return this.database.has(e).pipe(this.catchIDBBroken(function(){return t.database.has(e)}))},e.prototype.catchIDBBroken=function(e){var t=this;return o.catchError(function(r){return r!==undefined&&null!==r&&r.message===p?(t.database=new D(t.LSPrefix,t.oldPrefix),e()):n.throwError(r)})},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(B),t.ɵɵinject(N),t.ɵɵinject(g),t.ɵɵinject(y))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),c(2,t.Inject(g)),c(3,t.Inject(y)),s("design:paramtypes",[B,N,Object,Object])],e)}(),T=function(){function e(e){this.storageMap=e}return Object.defineProperty(e.prototype,"size",{get:function(){return this.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.storageMap.size},enumerable:!0,configurable:!0}),e.prototype.getItem=function(e,t){if(t){var r="schema"in t?t.schema:t;return this.storageMap.get(e,r).pipe(o.map(function(e){return e!==undefined?e:null}))}return this.storageMap.get(e).pipe(o.map(function(e){return e!==undefined?e:null}))},e.prototype.setItem=function(e,t,r){return this.storageMap.set(e,t,r).pipe(o.mapTo(!0))},e.prototype.removeItem=function(e){return this.storageMap["delete"](e).pipe(o.mapTo(!0))},e.prototype.clear=function(){return this.storageMap.clear().pipe(o.mapTo(!0))},e.prototype.keys=function(){return this.storageMap.keys().pipe(o.toArray())},e.prototype.has=function(e){return this.storageMap.has(e)},e.prototype.setItemSubscribe=function(e,t){this.setItem(e,t).subscribe({next:function(){},error:function(){}})},e.prototype.removeItemSubscribe=function(e){this.removeItem(e).subscribe({next:function(){},error:function(){}})},e.prototype.clearSubscribe=function(){this.clear().subscribe({next:function(){},error:function(){}})},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(A))},token:e,providedIn:"root"}),e=u([t.Injectable({providedIn:"root"}),s("design:paramtypes",[A])],e)}(),R=function(){function e(){}var r;return r=e,e.forRoot=function(e){return{ngModule:r,providers:[e.LSPrefix?{provide:g,useValue:e.LSPrefix}:[],e.IDBDBName?{provide:m,useValue:e.IDBDBName}:[],e.IDBStoreName?{provide:x,useValue:e.IDBStoreName}:[],e.IDBDBVersion?{provide:I,useValue:e.IDBDBVersion}:[],e.IDBNoWrap?{provide:w,useValue:e.IDBNoWrap}:[]]}},e=r=u([t.NgModule()],e)}();e.JSONValidator=N,e.LOCAL_STORAGE_PREFIX=y,e.LocalDatabase=B,e.LocalStorage=T,e.SERIALIZATION_ERROR=d,e.SerializationError=h,e.StorageMap=A,e.StorageModule=R,e.VALIDATION_ERROR=M,e.ValidationError=P,e.localStorageProviders=function(e){return[e.prefix?{provide:y,useValue:e.prefix}:[]]},e.ɵa=g,e.ɵb=m,e.ɵc=I,e.ɵd=x,e.ɵe=w,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-pwa-local-storage.umd.min.js.map |
@@ -20,37 +20,43 @@ import * as tslib_1 from "tslib"; | ||
export function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix) { | ||
// Do not explicit `window` here, as the global object is not the same in web workers | ||
if (isPlatformBrowser(platformId) && (indexedDB !== undefined) && (indexedDB !== null) && ('open' in indexedDB)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `indexedDB` exists (issue: IE9) | ||
* - it could exist but be `undefined` or `null` (issue: IE / Edge private mode) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE10+ and all other browsers in normal mode | ||
* - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */ | ||
return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix); | ||
/* When storage is fully disabled in browser (via the "Block all cookies" option), | ||
* just trying to check `indexedDB` or `localStorage` variables causes a security exception. | ||
* Prevents https://github.com/cyrilletuzi/angular-async-local-storage/issues/118 | ||
*/ | ||
try { | ||
// Do not explicit `window` here, as the global object is not the same in web workers | ||
if (isPlatformBrowser(platformId) && (indexedDB !== undefined) && (indexedDB !== null) && ('open' in indexedDB)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `indexedDB` exists (issue: IE9) | ||
* - it could exist but be `undefined` or `null` (issue: IE / Edge private mode) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE10+ and all other browsers in normal mode | ||
* - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */ | ||
return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix); | ||
} | ||
else if (isPlatformBrowser(platformId) | ||
&& (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `localStorage` exists (to be sure) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE9 | ||
* - Safari cross-origin iframes, detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/issues/42} | ||
* - IE / Edge / Firefox private mode, but in this case, data will be swiped when the user leaves the app | ||
* For Firefox, can only be detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982} | ||
*/ | ||
return new LocalStorageDatabase(LSPrefix, oldPrefix); | ||
} | ||
} | ||
else if (isPlatformBrowser(platformId) | ||
&& (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `localStorage` exists (to be sure) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE9 | ||
* - Safari cross-origin iframes, detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/issues/42} | ||
* - IE / Edge / Firefox private mode, but in this case, data will be swiped when the user leaves the app | ||
* For Firefox, can only be detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982} | ||
*/ | ||
return new LocalStorageDatabase(LSPrefix, oldPrefix); | ||
} | ||
else { | ||
/* Will be the case for: | ||
* - Server-side rendering | ||
* - All other non-browser context | ||
*/ | ||
return new MemoryDatabase(); | ||
} | ||
catch (_a) { } | ||
/* Will be the case for: | ||
* - In browsers if storage has been fully disabled (via the "Block all cookies" option) | ||
* - Server-side rendering | ||
* - All other non-browser context | ||
*/ | ||
return new MemoryDatabase(); | ||
} | ||
@@ -77,2 +83,2 @@ let LocalDatabase = class LocalDatabase { | ||
export { LocalDatabase }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtZGF0YWJhc2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4LXB3YS9sb2NhbC1zdG9yYWdlLyIsInNvdXJjZXMiOlsibGliL2RhdGFiYXNlcy9sb2NhbC1kYXRhYmFzZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxXQUFXLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDeEQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFHcEQsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDekQsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDL0QsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQ25ELE9BQU8s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m9uLWJyb3dzZXIgY29udGV4dFxuICAgKi9cbiAgcmV0dXJuIG5ldyBNZW1vcnlEYXRhYmFzZSgpO1xuXG59XG5cbkBJbmplY3RhYmxlKHtcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnLFxuICB1c2VGYWN0b3J5OiBsb2NhbERhdGFiYXNlRmFjdG9yeSxcbiAgZGVwczogW1xuICAgIFBMQVRGT1JNX0lELFxuICAgIExTX1BSRUZJWCxcbiAgICBJREJfREJfTkFNRSxcbiAgICBJREJfU1RPUkVfTkFNRSxcbiAgICBJREJfREJfVkVSU0lPTixcbiAgICBJREJfTk9fV1JBUCxcbiAgICAvLyB0c2xpbnQ6ZGlzYWJsZS1uZXh0LWxpbmU6IGRlcHJlY2F0aW9uXG4gICAgTE9DQUxfU1RPUkFHRV9QUkVGSVgsXG4gIF1cbn0pXG5leHBvcnQgYWJzdHJhY3QgY2xhc3MgTG9jYWxEYXRhYmFzZSB7XG5cbiAgYWJzdHJhY3QgcmVhZG9ubHkgc2l6ZTogT2JzZXJ2YWJsZTxudW1iZXI+O1xuXG4gIGFic3RyYWN0IGdldDxUID0gYW55PihrZXk6IHN0cmluZyk6IE9ic2VydmFibGU8VCB8IHVuZGVmaW5lZD47XG4gIGFic3RyYWN0IHNldChrZXk6IHN0cmluZywgZGF0YTogYW55KTogT2JzZXJ2YWJsZTx1bmRlZmluZWQ+O1xuICBhYnN0cmFjdCBkZWxldGUoa2V5OiBzdHJpbmcpOiBPYnNlcnZhYmxlPHVuZGVmaW5lZD47XG4gIGFic3RyYWN0IGNsZWFyKCk6IE9ic2VydmFibGU8dW5kZWZpbmVkPjtcbiAgYWJzdHJhY3Qga2V5cygpOiBPYnNlcnZhYmxlPHN0cmluZz47XG4gIGFic3RyYWN0IGhhcyhrZXk6IHN0cmluZyk6IE9ic2VydmFibGU8Ym9vbGVhbj47XG5cbn1cbiJdfQ== |
@@ -20,37 +20,43 @@ import * as tslib_1 from "tslib"; | ||
export function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix) { | ||
// Do not explicit `window` here, as the global object is not the same in web workers | ||
if (isPlatformBrowser(platformId) && (indexedDB !== undefined) && (indexedDB !== null) && ('open' in indexedDB)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `indexedDB` exists (issue: IE9) | ||
* - it could exist but be `undefined` or `null` (issue: IE / Edge private mode) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE10+ and all other browsers in normal mode | ||
* - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */ | ||
return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix); | ||
/* When storage is fully disabled in browser (via the "Block all cookies" option), | ||
* just trying to check `indexedDB` or `localStorage` variables causes a security exception. | ||
* Prevents https://github.com/cyrilletuzi/angular-async-local-storage/issues/118 | ||
*/ | ||
try { | ||
// Do not explicit `window` here, as the global object is not the same in web workers | ||
if (isPlatformBrowser(platformId) && (indexedDB !== undefined) && (indexedDB !== null) && ('open' in indexedDB)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `indexedDB` exists (issue: IE9) | ||
* - it could exist but be `undefined` or `null` (issue: IE / Edge private mode) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE10+ and all other browsers in normal mode | ||
* - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */ | ||
return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix); | ||
} | ||
else if (isPlatformBrowser(platformId) | ||
&& (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `localStorage` exists (to be sure) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE9 | ||
* - Safari cross-origin iframes, detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/issues/42} | ||
* - IE / Edge / Firefox private mode, but in this case, data will be swiped when the user leaves the app | ||
* For Firefox, can only be detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982} | ||
*/ | ||
return new LocalStorageDatabase(LSPrefix, oldPrefix); | ||
} | ||
} | ||
else if (isPlatformBrowser(platformId) | ||
&& (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `localStorage` exists (to be sure) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE9 | ||
* - Safari cross-origin iframes, detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/issues/42} | ||
* - IE / Edge / Firefox private mode, but in this case, data will be swiped when the user leaves the app | ||
* For Firefox, can only be detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982} | ||
*/ | ||
return new LocalStorageDatabase(LSPrefix, oldPrefix); | ||
} | ||
else { | ||
/* Will be the case for: | ||
* - Server-side rendering | ||
* - All other non-browser context | ||
*/ | ||
return new MemoryDatabase(); | ||
} | ||
catch (_a) { } | ||
/* Will be the case for: | ||
* - In browsers if storage has been fully disabled (via the "Block all cookies" option) | ||
* - Server-side rendering | ||
* - All other non-browser context | ||
*/ | ||
return new MemoryDatabase(); | ||
} | ||
@@ -80,2 +86,2 @@ var LocalDatabase = /** @class */ (function () { | ||
export { LocalDatabase }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtZGF0YWJhc2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4LXB3YS9sb2NhbC1zdG9yYWdlLyIsInNvdXJjZXMiOlsibGliL2RhdGFiYXNlcy9sb2NhbC1kYXRhYmFzZS50cyJdLCJuYW1lcyI6W10s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YmxlPHVuZGVmaW5lZD47XG4gIGFic3RyYWN0IGRlbGV0ZShrZXk6IHN0cmluZyk6IE9ic2VydmFibGU8dW5kZWZpbmVkPjtcbiAgYWJzdHJhY3QgY2xlYXIoKTogT2JzZXJ2YWJsZTx1bmRlZmluZWQ+O1xuICBhYnN0cmFjdCBrZXlzKCk6IE9ic2VydmFibGU8c3RyaW5nPjtcbiAgYWJzdHJhY3QgaGFzKGtleTogc3RyaW5nKTogT2JzZXJ2YWJsZTxib29sZWFuPjtcblxufVxuIl19 |
@@ -759,37 +759,43 @@ import { __decorate, __param, __metadata } from 'tslib'; | ||
function localDatabaseFactory(platformId, LSPrefix, IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix) { | ||
// Do not explicit `window` here, as the global object is not the same in web workers | ||
if (isPlatformBrowser(platformId) && (indexedDB !== undefined) && (indexedDB !== null) && ('open' in indexedDB)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `indexedDB` exists (issue: IE9) | ||
* - it could exist but be `undefined` or `null` (issue: IE / Edge private mode) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE10+ and all other browsers in normal mode | ||
* - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */ | ||
return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix); | ||
/* When storage is fully disabled in browser (via the "Block all cookies" option), | ||
* just trying to check `indexedDB` or `localStorage` variables causes a security exception. | ||
* Prevents https://github.com/cyrilletuzi/angular-async-local-storage/issues/118 | ||
*/ | ||
try { | ||
// Do not explicit `window` here, as the global object is not the same in web workers | ||
if (isPlatformBrowser(platformId) && (indexedDB !== undefined) && (indexedDB !== null) && ('open' in indexedDB)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `indexedDB` exists (issue: IE9) | ||
* - it could exist but be `undefined` or `null` (issue: IE / Edge private mode) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE10+ and all other browsers in normal mode | ||
* - Chromium / Safari private mode, but in this case, data will be swiped when the user leaves the app */ | ||
return new IndexedDBDatabase(IDBDBName, IDBStoreName, IDBDBVersion, IDBNoWrap, oldPrefix); | ||
} | ||
else if (isPlatformBrowser(platformId) | ||
&& (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `localStorage` exists (to be sure) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE9 | ||
* - Safari cross-origin iframes, detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/issues/42} | ||
* - IE / Edge / Firefox private mode, but in this case, data will be swiped when the user leaves the app | ||
* For Firefox, can only be detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982} | ||
*/ | ||
return new LocalStorageDatabase(LSPrefix, oldPrefix); | ||
} | ||
} | ||
else if (isPlatformBrowser(platformId) | ||
&& (localStorage !== undefined) && (localStorage !== null) && ('getItem' in localStorage)) { | ||
/* Check: | ||
* - if we are in a browser context (issue: server-side rendering) | ||
* - if `localStorage` exists (to be sure) | ||
* - it could exists but not having a working API | ||
* Will be the case for: | ||
* - IE9 | ||
* - Safari cross-origin iframes, detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://github.com/cyrilletuzi/angular-async-local-storage/issues/42} | ||
* - IE / Edge / Firefox private mode, but in this case, data will be swiped when the user leaves the app | ||
* For Firefox, can only be detected later in `IndexedDBDatabase.connect()` | ||
* @see {@link https://bugzilla.mozilla.org/show_bug.cgi?id=781982} | ||
*/ | ||
return new LocalStorageDatabase(LSPrefix, oldPrefix); | ||
} | ||
else { | ||
/* Will be the case for: | ||
* - Server-side rendering | ||
* - All other non-browser context | ||
*/ | ||
return new MemoryDatabase(); | ||
} | ||
catch (_a) { } | ||
/* Will be the case for: | ||
* - In browsers if storage has been fully disabled (via the "Block all cookies" option) | ||
* - Server-side rendering | ||
* - All other non-browser context | ||
*/ | ||
return new MemoryDatabase(); | ||
} | ||
@@ -796,0 +802,0 @@ let LocalDatabase = class LocalDatabase { |
{ | ||
"name": "@ngx-pwa/local-storage", | ||
"version": "8.0.0", | ||
"version": "8.0.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 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
1076411
9124