diff --git a/patches/localforage+1.10.0.patch b/patches/localforage+1.10.0.patch new file mode 100644 --- /dev/null +++ b/patches/localforage+1.10.0.patch @@ -0,0 +1,750 @@ +diff --git a/node_modules/localforage/dist/localforage.js b/node_modules/localforage/dist/localforage.js +index 4e3295b..9049388 100644 +--- a/node_modules/localforage/dist/localforage.js ++++ b/node_modules/localforage/dist/localforage.js +@@ -1125,6 +1125,172 @@ function removeItem(key, callback) { + return promise; + } + ++function getMultipleItems(keys, synchronizationKey) { ++ var self = this; ++ ++ var normalizedKeys = keys.map(normalizeKey); ++ var normalizedSynchronizationKey = normalizeKey(synchronizationKey); ++ ++ var promise = new Promise$1(function (resolve, reject) { ++ self.ready().then(function () { ++ createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { ++ if (err) { ++ return reject(err); ++ } ++ ++ try { ++ var store = transaction.objectStore(self._dbInfo.storeName); ++ ++ var allKeys = [].concat(normalizedKeys, [normalizedSynchronizationKey]); ++ var result = {}; ++ var values = {}; ++ ++ var placeRequest = function placeRequest(keysArray, index) { ++ var key = keysArray[index]; ++ var req = store.get(key); ++ ++ req.onsuccess = function () { ++ var value = req.result; ++ if (value === undefined) { ++ value = null; ++ } ++ ++ if (_isEncodedBlob(value)) { ++ value = _decodeBlob(value); ++ } ++ ++ if (key === normalizedSynchronizationKey) { ++ result['synchronizationValue'] = value; ++ } else { ++ values[key] = value; ++ } ++ ++ if (index < keysArray.length - 1) { ++ placeRequest(keysArray, index + 1); ++ return; ++ } ++ ++ result['values'] = values; ++ resolve(result); ++ }; ++ ++ req.onerror = function () { ++ reject(req.err); ++ }; ++ }; ++ ++ placeRequest(allKeys, 0); ++ } catch (e) { ++ reject(e); ++ } ++ }); ++ })["catch"](reject); ++ }); ++ ++ return promise; ++} ++ ++function setMultipleItems(input, synchronizationKey, expectedSynchronizationValue, newSynchronizationValue, forceWrite) { ++ var self = this; ++ var normalizedSynchronizationKey = normalizeKey(synchronizationKey); ++ ++ var promise = new Promise$1(function (resolve, reject) { ++ var dbInfo; ++ self.ready().then(function () { ++ dbInfo = self._dbInfo; ++ var inputArray = Object.entries(input); ++ return Promise$1.all(inputArray.map(function (_ref) { ++ var key = _ref[0], ++ value = _ref[1]; ++ ++ var normalizedKey = normalizeKey(key); ++ if (value === null) { ++ value = undefined; ++ } ++ ++ if (!toString.call(value) === '[object Blob]') { ++ return [normalizedKey, value]; ++ } ++ ++ return _checkBlobSupport(dbInfo.db).then(function (blobSupport) { ++ if (blobSupport) { ++ return [normalizedKey, value]; ++ } ++ return [normalizedKey, _encodeBlob(value)]; ++ }); ++ })); ++ }).then(function (inputArray) { ++ createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { ++ if (err) { ++ reject(err); ++ } ++ ++ try { ++ var store = transaction.objectStore(self._dbInfo.storeName); ++ ++ var req = store.get(normalizedSynchronizationKey); ++ ++ req.onsuccess = function () { ++ var value = req.result; ++ if (value === undefined) { ++ value = null; ++ } ++ if (value !== expectedSynchronizationValue && !forceWrite) { ++ reject('Another thread completed transaction'); ++ return; ++ } ++ ++ for (var _iterator = inputArray, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { ++ var _ref2; ++ ++ if (_isArray) { ++ if (_i >= _iterator.length) break; ++ _ref2 = _iterator[_i++]; ++ } else { ++ _i = _iterator.next(); ++ if (_i.done) break; ++ _ref2 = _i.value; ++ } ++ ++ var _ref3 = _ref2, ++ key = _ref3[0], ++ value = _ref3[1]; ++ ++ var writeRequest = store.put(value, key); ++ ++ writeRequest.onerror = function () { ++ reject(writeRequest.err); ++ }; ++ } ++ ++ var synchronizationValueWriteRequest = store.put(newSynchronizationValue, normalizedSynchronizationKey); ++ ++ synchronizationValueWriteRequest.onerror = function () { ++ reject(synchronizationValueWriteRequest.err); ++ }; ++ }; ++ ++ req.onerror = function () { ++ reject(req.err); ++ }; ++ ++ transaction.oncomplete = function () { ++ resolve(); ++ }; ++ ++ transaction.onabort = transaction.onerror = function () { ++ reject(transaction.error); ++ }; ++ } catch (e) { ++ reject(e); ++ } ++ }); ++ })["catch"](reject); ++ }); ++ ++ return promise; ++} ++ + function clear(callback) { + var self = this; + +@@ -1437,6 +1603,8 @@ var asyncStorage = { + getItem: getItem, + setItem: setItem, + removeItem: removeItem, ++ getMultipleItems: getMultipleItems, ++ setMultipleItems: setMultipleItems, + clear: clear, + length: length, + key: key, +@@ -2100,6 +2268,12 @@ var webSQLStorage = { + getItem: getItem$1, + setItem: setItem$1, + removeItem: removeItem$1, ++ getMultipleItems: function getMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, ++ setMultipleItems: function setMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, + clear: clear$1, + length: length$1, + key: key$1, +@@ -2422,6 +2596,12 @@ var localStorageWrapper = { + getItem: getItem$2, + setItem: setItem$2, + removeItem: removeItem$2, ++ getMultipleItems: function getMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, ++ setMultipleItems: function setMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, + clear: clear$2, + length: length$2, + key: key$2, +@@ -2466,7 +2646,7 @@ var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQ + + var OptionalDriverMethods = ['dropInstance']; + +-var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods); ++var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem', 'setMultipleItems', 'getMultipleItems'].concat(OptionalDriverMethods); + + var DefaultConfig = { + description: '', +@@ -2621,8 +2801,8 @@ var LocalForage = function () { + }; + }; + +- for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) { +- var optionalDriverMethod = OptionalDriverMethods[_i]; ++ for (var _i2 = 0, _len = OptionalDriverMethods.length; _i2 < _len; _i2++) { ++ var optionalDriverMethod = OptionalDriverMethods[_i2]; + if (!driverObject[optionalDriverMethod]) { + driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod); + } +diff --git a/node_modules/localforage/dist/localforage.min.js b/node_modules/localforage/dist/localforage.min.js +index 7403f8f..195b535 100644 +--- a/node_modules/localforage/dist/localforage.min.js ++++ b/node_modules/localforage/dist/localforage.min.js +@@ -4,4 +4,4 @@ + https://localforage.github.io/localForage + (c) 2013-2017 Mozilla, Apache License 2.0 + */ +-!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.localforage=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g=43)}}).catch(function(){return!1})}function n(a){return"boolean"==typeof xa?va.resolve(xa):m(a).then(function(a){return xa=a})}function o(a){var b=ya[a.name],c={};c.promise=new va(function(a,b){c.resolve=a,c.reject=b}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function p(a){var b=ya[a.name],c=b.deferredOperations.pop();if(c)return c.resolve(),c.promise}function q(a,b){var c=ya[a.name],d=c.deferredOperations.pop();if(d)return d.reject(b),d.promise}function r(a,b){return new va(function(c,d){if(ya[a.name]=ya[a.name]||B(),a.db){if(!b)return c(a.db);o(a),a.db.close()}var e=[a.name];b&&e.push(a.version);var f=ua.open.apply(ua,e);b&&(f.onupgradeneeded=function(b){var c=f.result;try{c.createObjectStore(a.storeName),b.oldVersion<=1&&c.createObjectStore(wa)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.')}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(a){a.target.close()},c(b),p(a)}})}function s(a){return r(a,!1)}function t(a){return r(a,!0)}function u(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function v(a){return new va(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function w(a){return g([l(atob(a.data))],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function y(a){var b=this,c=b._initReady().then(function(){var a=ya[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return i(c,a,a),c}function z(a){o(a);for(var b=ya[a.name],c=b.forages,d=0;d0&&(!a.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return va.resolve().then(function(){if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),t(a)}).then(function(){return z(a).then(function(){A(a,b,c,d-1)})}).catch(c);c(e)}}function B(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(a){function b(){return va.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=ya[d.name];f||(f=B(),ya[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=y);for(var g=[],h=0;h>4,k[i++]=(15&d)<<4|e>>2,k[i++]=(3&e)<<6|63&f;return j}function O(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=Da[(3&c[b])<<4|c[b+1]>>4],d+=Da[(15&c[b+1])<<2|c[b+2]>>6],d+=Da[63&c[b+2]];return c.length%3==2?d=d.substring(0,d.length-1)+"=":c.length%3==1&&(d=d.substring(0,d.length-2)+"=="),d}function P(a,b){var c="";if(a&&(c=Ua.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Ua.call(a.buffer))){var d,e=Ga;a instanceof ArrayBuffer?(d=a,e+=Ia):(d=a.buffer,"[object Int8Array]"===c?e+=Ka:"[object Uint8Array]"===c?e+=La:"[object Uint8ClampedArray]"===c?e+=Ma:"[object Int16Array]"===c?e+=Na:"[object Uint16Array]"===c?e+=Pa:"[object Int32Array]"===c?e+=Oa:"[object Uint32Array]"===c?e+=Qa:"[object Float32Array]"===c?e+=Ra:"[object Float64Array]"===c?e+=Sa:b(new Error("Failed to get type for BinaryArray"))),b(e+O(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=Ea+a.type+"~"+O(this.result);b(Ga+Ja+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function Q(a){if(a.substring(0,Ha)!==Ga)return JSON.parse(a);var b,c=a.substring(Ta),d=a.substring(Ha,Ta);if(d===Ja&&Fa.test(c)){var e=c.match(Fa);b=e[1],c=c.substring(e[0].length)}var f=N(c);switch(d){case Ia:return f;case Ja:return g([f],{type:b});case Ka:return new Int8Array(f);case La:return new Uint8Array(f);case Ma:return new Uint8ClampedArray(f);case Na:return new Int16Array(f);case Pa:return new Uint16Array(f);case Oa:return new Int32Array(f);case Qa:return new Uint32Array(f);case Ra:return new Float32Array(f);case Sa:return new Float64Array(f);default:throw new Error("Unkown type: "+d)}}function R(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function S(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];var e=new va(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){R(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Va,e}function T(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):R(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function U(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function V(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;h0)return void f(W.apply(e,[a,h,c,d-1]));g(b)}})})}).catch(g)});return h(f,c),f}function X(a,b,c){return W.apply(this,[a,b,c,1])}function Y(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function Z(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function $(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function _(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function aa(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f0}function ha(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=ea(a,b._defaultConfig),ga()?(b._dbInfo=c,c.serializer=Va,va.resolve()):va.reject()}function ia(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;c>=0;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return h(c,a),c}function ja(a,b){var c=this;a=j(a);var d=c.ready().then(function(){var b=c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return h(d,b),d}function ka(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=localStorage.length,g=1,h=0;h=0;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):va.reject("Invalid arguments"),h(d,b),d}function ra(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function sa(){for(var a=1;a=43)}}).catch(function(){return!1})}function n(a){return"boolean"==typeof za?xa.resolve(za):m(a).then(function(a){return za=a})}function o(a){var b=Aa[a.name],c={};c.promise=new xa(function(a,b){c.resolve=a,c.reject=b}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function p(a){var b=Aa[a.name],c=b.deferredOperations.pop();if(c)return c.resolve(),c.promise}function q(a,b){var c=Aa[a.name],d=c.deferredOperations.pop();if(d)return d.reject(b),d.promise}function r(a,b){return new xa(function(c,d){if(Aa[a.name]=Aa[a.name]||B(),a.db){if(!b)return c(a.db);o(a),a.db.close()}var e=[a.name];b&&e.push(a.version);var f=wa.open.apply(wa,e);b&&(f.onupgradeneeded=function(b){var c=f.result;try{c.createObjectStore(a.storeName),b.oldVersion<=1&&c.createObjectStore(ya)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.')}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(a){a.target.close()},c(b),p(a)}})}function s(a){return r(a,!1)}function t(a){return r(a,!0)}function u(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function v(a){return new xa(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function w(a){return g([l(atob(a.data))],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function y(a){var b=this,c=b._initReady().then(function(){var a=Aa[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return i(c,a,a),c}function z(a){o(a);for(var b=Aa[a.name],c=b.forages,d=0;d0&&(!a.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return xa.resolve().then(function(){if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),t(a)}).then(function(){return z(a).then(function(){A(a,b,c,d-1)})}).catch(c);c(e)}}function B(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(a){function b(){return xa.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=Aa[d.name];f||(f=B(),Aa[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=y);for(var g=[],h=0;h=f.length)break;m=f[j++]}else{if(j=f.next(),j.done)break;m=j.value}var n=m,o=n[0],b=n[1],p=k.put(b,o);p.onerror=function(){h(p.err)}}var q=k.put(d,g);q.onerror=function(){h(q.err)}},l.onerror=function(){h(l.err)},j.oncomplete=function(){b()},j.onabort=j.onerror=function(){h(j.error)}}catch(a){h(a)}})}).catch(h)})}function J(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){A(b._dbInfo,Da,function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.clear();e.oncomplete=function(){a()},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;c(a)}}catch(a){c(a)}})}).catch(c)});return h(c,a),c}function K(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){A(b._dbInfo,Ca,function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.count();g.onsuccess=function(){a(g.result)},g.onerror=function(){c(g.error)}}catch(a){c(a)}})}).catch(c)});return h(c,a),c}function L(a,b){var c=this,d=new xa(function(b,d){if(a<0)return void b(null);c.ready().then(function(){A(c._dbInfo,Ca,function(e,f){if(e)return d(e);try{var g=f.objectStore(c._dbInfo.storeName),h=!1,i=g.openKeyCursor();i.onsuccess=function(){var c=i.result;if(!c)return void b(null);0===a?b(c.key):h?b(c.key):(h=!0,c.advance(a))},i.onerror=function(){d(i.error)}}catch(a){d(a)}})}).catch(d)});return h(d,b),d}function M(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){A(b._dbInfo,Ca,function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.openKeyCursor(),h=[];g.onsuccess=function(){var b=g.result;if(!b)return void a(h);h.push(b.key),b.continue()},g.onerror=function(){c(g.error)}}catch(a){c(a)}})}).catch(c)});return h(c,a),c}function N(a,b){b=k.apply(this,arguments);var c=this.config();a="function"!=typeof a&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var d,e=this;if(a.name){var f=a.name===c.name&&e._dbInfo.db,g=f?xa.resolve(e._dbInfo.db):s(a).then(function(b){var c=Aa[a.name],d=c.forages;c.db=b;for(var e=0;e>4,k[i++]=(15&d)<<4|e>>2,k[i++]=(3&e)<<6|63&f;return j}function Q(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=Fa[(3&c[b])<<4|c[b+1]>>4],d+=Fa[(15&c[b+1])<<2|c[b+2]>>6],d+=Fa[63&c[b+2]];return c.length%3==2?d=d.substring(0,d.length-1)+"=":c.length%3==1&&(d=d.substring(0,d.length-2)+"=="),d}function R(a,b){var c="";if(a&&(c=Wa.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Wa.call(a.buffer))){var d,e=Ia;a instanceof ArrayBuffer?(d=a,e+=Ka):(d=a.buffer,"[object Int8Array]"===c?e+=Ma:"[object Uint8Array]"===c?e+=Na:"[object Uint8ClampedArray]"===c?e+=Oa:"[object Int16Array]"===c?e+=Pa:"[object Uint16Array]"===c?e+=Ra:"[object Int32Array]"===c?e+=Qa:"[object Uint32Array]"===c?e+=Sa:"[object Float32Array]"===c?e+=Ta:"[object Float64Array]"===c?e+=Ua:b(new Error("Failed to get type for BinaryArray"))),b(e+Q(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=Ga+a.type+"~"+Q(this.result);b(Ia+La+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function S(a){if(a.substring(0,Ja)!==Ia)return JSON.parse(a);var b,c=a.substring(Va),d=a.substring(Ja,Va);if(d===La&&Ha.test(c)){var e=c.match(Ha);b=e[1],c=c.substring(e[0].length)}var f=P(c);switch(d){case Ka:return f;case La:return g([f],{type:b});case Ma:return new Int8Array(f);case Na:return new Uint8Array(f);case Oa:return new Uint8ClampedArray(f);case Pa:return new Int16Array(f);case Ra:return new Uint16Array(f);case Qa:return new Int32Array(f);case Sa:return new Uint32Array(f);case Ta:return new Float32Array(f);case Ua:return new Float64Array(f);default:throw new Error("Unkown type: "+d)}}function T(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function U(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];var e=new xa(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){T(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Xa,e}function V(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):T(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function W(a,b){var c=this;a=j(a);var d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function X(a,b){var c=this,d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;h0)return void f(Y.apply(e,[a,h,c,d-1]));g(b)}})})}).catch(g)});return h(f,c),f}function Z(a,b,c){return Y.apply(this,[a,b,c,1])}function $(a,b){var c=this;a=j(a);var d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function _(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){V(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function aa(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){V(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function ba(a,b){var c=this,d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function ca(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){V(b,d,"SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f0}function ja(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=ga(a,b._defaultConfig),ia()?(b._dbInfo=c,c.serializer=Xa,xa.resolve()):xa.reject()}function ka(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;c>=0;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return h(c,a),c}function la(a,b){var c=this;a=j(a);var d=c.ready().then(function(){var b=c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return h(d,b),d}function ma(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=localStorage.length,g=1,h=0;h=0;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):xa.reject("Invalid arguments"),h(d,b),d}function ta(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function ua(){for(var a=1;a= _iterator.length) break; ++ _ref2 = _iterator[_i++]; ++ } else { ++ _i = _iterator.next(); ++ if (_i.done) break; ++ _ref2 = _i.value; ++ } ++ ++ var _ref3 = _ref2, ++ key = _ref3[0], ++ value = _ref3[1]; ++ ++ var writeRequest = store.put(value, key); ++ ++ writeRequest.onerror = function () { ++ reject(writeRequest.err); ++ }; ++ } ++ ++ var synchronizationValueWriteRequest = store.put(newSynchronizationValue, normalizedSynchronizationKey); ++ ++ synchronizationValueWriteRequest.onerror = function () { ++ reject(synchronizationValueWriteRequest.err); ++ }; ++ }; ++ ++ req.onerror = function () { ++ reject(req.err); ++ }; ++ ++ transaction.oncomplete = function () { ++ resolve(); ++ }; ++ ++ transaction.onabort = transaction.onerror = function () { ++ reject(transaction.error); ++ }; ++ } catch (e) { ++ reject(e); ++ } ++ }); ++ })["catch"](reject); ++ }); ++ ++ return promise; ++} ++ + function clear(callback) { + var self = this; + +@@ -1101,6 +1267,8 @@ var asyncStorage = { + getItem: getItem, + setItem: setItem, + removeItem: removeItem, ++ getMultipleItems: getMultipleItems, ++ setMultipleItems: setMultipleItems, + clear: clear, + length: length, + key: key, +@@ -1764,6 +1932,12 @@ var webSQLStorage = { + getItem: getItem$1, + setItem: setItem$1, + removeItem: removeItem$1, ++ getMultipleItems: function getMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, ++ setMultipleItems: function setMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, + clear: clear$1, + length: length$1, + key: key$1, +@@ -2086,6 +2260,12 @@ var localStorageWrapper = { + getItem: getItem$2, + setItem: setItem$2, + removeItem: removeItem$2, ++ getMultipleItems: function getMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, ++ setMultipleItems: function setMultipleItems() { ++ throw "Method unsupported for driver."; ++ }, + clear: clear$2, + length: length$2, + key: key$2, +@@ -2130,7 +2310,7 @@ var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQ + + var OptionalDriverMethods = ['dropInstance']; + +-var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods); ++var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem', 'setMultipleItems', 'getMultipleItems'].concat(OptionalDriverMethods); + + var DefaultConfig = { + description: '', +@@ -2285,8 +2465,8 @@ var LocalForage = function () { + }; + }; + +- for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) { +- var optionalDriverMethod = OptionalDriverMethods[_i]; ++ for (var _i2 = 0, _len = OptionalDriverMethods.length; _i2 < _len; _i2++) { ++ var optionalDriverMethod = OptionalDriverMethods[_i2]; + if (!driverObject[optionalDriverMethod]) { + driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod); + } +diff --git a/node_modules/localforage/dist/localforage.nopromises.min.js b/node_modules/localforage/dist/localforage.nopromises.min.js +index a4d5d02..f4ca5f0 100644 +--- a/node_modules/localforage/dist/localforage.nopromises.min.js ++++ b/node_modules/localforage/dist/localforage.nopromises.min.js +@@ -4,4 +4,4 @@ + https://localforage.github.io/localForage + (c) 2013-2017 Mozilla, Apache License 2.0 + */ +-!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.localforage=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g=43)}}).catch(function(){return!1})}function n(a){return"boolean"==typeof xa?va.resolve(xa):m(a).then(function(a){return xa=a})}function o(a){var b=ya[a.name],c={};c.promise=new va(function(a,b){c.resolve=a,c.reject=b}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function p(a){var b=ya[a.name],c=b.deferredOperations.pop();if(c)return c.resolve(),c.promise}function q(a,b){var c=ya[a.name],d=c.deferredOperations.pop();if(d)return d.reject(b),d.promise}function r(a,b){return new va(function(c,d){if(ya[a.name]=ya[a.name]||B(),a.db){if(!b)return c(a.db);o(a),a.db.close()}var e=[a.name];b&&e.push(a.version);var f=ua.open.apply(ua,e);b&&(f.onupgradeneeded=function(b){var c=f.result;try{c.createObjectStore(a.storeName),b.oldVersion<=1&&c.createObjectStore(wa)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.')}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(a){a.target.close()},c(b),p(a)}})}function s(a){return r(a,!1)}function t(a){return r(a,!0)}function u(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function v(a){return new va(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function w(a){return g([l(atob(a.data))],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function y(a){var b=this,c=b._initReady().then(function(){var a=ya[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return i(c,a,a),c}function z(a){o(a);for(var b=ya[a.name],c=b.forages,d=0;d0&&(!a.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return va.resolve().then(function(){if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),t(a)}).then(function(){return z(a).then(function(){A(a,b,c,d-1)})}).catch(c);c(e)}}function B(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(a){function b(){return va.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=ya[d.name];f||(f=B(),ya[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=y);for(var g=[],h=0;h>4,k[i++]=(15&d)<<4|e>>2,k[i++]=(3&e)<<6|63&f;return j}function O(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=Da[(3&c[b])<<4|c[b+1]>>4],d+=Da[(15&c[b+1])<<2|c[b+2]>>6],d+=Da[63&c[b+2]];return c.length%3==2?d=d.substring(0,d.length-1)+"=":c.length%3==1&&(d=d.substring(0,d.length-2)+"=="),d}function P(a,b){var c="";if(a&&(c=Ua.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Ua.call(a.buffer))){var d,e=Ga;a instanceof ArrayBuffer?(d=a,e+=Ia):(d=a.buffer,"[object Int8Array]"===c?e+=Ka:"[object Uint8Array]"===c?e+=La:"[object Uint8ClampedArray]"===c?e+=Ma:"[object Int16Array]"===c?e+=Na:"[object Uint16Array]"===c?e+=Pa:"[object Int32Array]"===c?e+=Oa:"[object Uint32Array]"===c?e+=Qa:"[object Float32Array]"===c?e+=Ra:"[object Float64Array]"===c?e+=Sa:b(new Error("Failed to get type for BinaryArray"))),b(e+O(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=Ea+a.type+"~"+O(this.result);b(Ga+Ja+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function Q(a){if(a.substring(0,Ha)!==Ga)return JSON.parse(a);var b,c=a.substring(Ta),d=a.substring(Ha,Ta);if(d===Ja&&Fa.test(c)){var e=c.match(Fa);b=e[1],c=c.substring(e[0].length)}var f=N(c);switch(d){case Ia:return f;case Ja:return g([f],{type:b});case Ka:return new Int8Array(f);case La:return new Uint8Array(f);case Ma:return new Uint8ClampedArray(f);case Na:return new Int16Array(f);case Pa:return new Uint16Array(f);case Oa:return new Int32Array(f);case Qa:return new Uint32Array(f);case Ra:return new Float32Array(f);case Sa:return new Float64Array(f);default:throw new Error("Unkown type: "+d)}}function R(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function S(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];var e=new va(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){R(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Va,e}function T(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):R(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function U(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function V(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;h0)return void f(W.apply(e,[a,h,c,d-1]));g(b)}})})}).catch(g)});return h(f,c),f}function X(a,b,c){return W.apply(this,[a,b,c,1])}function Y(a,b){var c=this;a=j(a);var d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function Z(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function $(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function _(a,b){var c=this,d=new va(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){T(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function aa(a){var b=this,c=new va(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){T(b,d,"SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f0}function ha(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=ea(a,b._defaultConfig),ga()?(b._dbInfo=c,c.serializer=Va,va.resolve()):va.reject()}function ia(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;c>=0;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return h(c,a),c}function ja(a,b){var c=this;a=j(a);var d=c.ready().then(function(){var b=c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return h(d,b),d}function ka(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=localStorage.length,g=1,h=0;h=0;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):va.reject("Invalid arguments"),h(d,b),d}function ra(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function sa(){for(var a=1;a=43)}}).catch(function(){return!1})}function n(a){return"boolean"==typeof za?xa.resolve(za):m(a).then(function(a){return za=a})}function o(a){var b=Aa[a.name],c={};c.promise=new xa(function(a,b){c.resolve=a,c.reject=b}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function p(a){var b=Aa[a.name],c=b.deferredOperations.pop();if(c)return c.resolve(),c.promise}function q(a,b){var c=Aa[a.name],d=c.deferredOperations.pop();if(d)return d.reject(b),d.promise}function r(a,b){return new xa(function(c,d){if(Aa[a.name]=Aa[a.name]||B(),a.db){if(!b)return c(a.db);o(a),a.db.close()}var e=[a.name];b&&e.push(a.version);var f=wa.open.apply(wa,e);b&&(f.onupgradeneeded=function(b){var c=f.result;try{c.createObjectStore(a.storeName),b.oldVersion<=1&&c.createObjectStore(ya)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+a.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+a.storeName+'" already exists.')}}),f.onerror=function(a){a.preventDefault(),d(f.error)},f.onsuccess=function(){var b=f.result;b.onversionchange=function(a){a.target.close()},c(b),p(a)}})}function s(a){return r(a,!1)}function t(a){return r(a,!0)}function u(a,b){if(!a.db)return!0;var c=!a.db.objectStoreNames.contains(a.storeName),d=a.versiona.db.version;if(d&&(a.version!==b&&console.warn('The database "'+a.name+"\" can't be downgraded from version "+a.db.version+" to version "+a.version+"."),a.version=a.db.version),e||c){if(c){var f=a.db.version+1;f>a.version&&(a.version=f)}return!0}return!1}function v(a){return new xa(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function w(a){return g([l(atob(a.data))],{type:a.type})}function x(a){return a&&a.__local_forage_encoded_blob}function y(a){var b=this,c=b._initReady().then(function(){var a=Aa[b._dbInfo.name];if(a&&a.dbReady)return a.dbReady});return i(c,a,a),c}function z(a){o(a);for(var b=Aa[a.name],c=b.forages,d=0;d0&&(!a.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return xa.resolve().then(function(){if(!a.db||"NotFoundError"===e.name&&!a.db.objectStoreNames.contains(a.storeName)&&a.version<=a.db.version)return a.db&&(a.version=a.db.version+1),t(a)}).then(function(){return z(a).then(function(){A(a,b,c,d-1)})}).catch(c);c(e)}}function B(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(a){function b(){return xa.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];var f=Aa[d.name];f||(f=B(),Aa[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=y);for(var g=[],h=0;h=f.length)break;m=f[j++]}else{if(j=f.next(),j.done)break;m=j.value}var n=m,o=n[0],b=n[1],p=k.put(b,o);p.onerror=function(){h(p.err)}}var q=k.put(d,g);q.onerror=function(){h(q.err)}},l.onerror=function(){h(l.err)},j.oncomplete=function(){b()},j.onabort=j.onerror=function(){h(j.error)}}catch(a){h(a)}})}).catch(h)})}function J(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){A(b._dbInfo,Da,function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.clear();e.oncomplete=function(){a()},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;c(a)}}catch(a){c(a)}})}).catch(c)});return h(c,a),c}function K(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){A(b._dbInfo,Ca,function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.count();g.onsuccess=function(){a(g.result)},g.onerror=function(){c(g.error)}}catch(a){c(a)}})}).catch(c)});return h(c,a),c}function L(a,b){var c=this,d=new xa(function(b,d){if(a<0)return void b(null);c.ready().then(function(){A(c._dbInfo,Ca,function(e,f){if(e)return d(e);try{var g=f.objectStore(c._dbInfo.storeName),h=!1,i=g.openKeyCursor();i.onsuccess=function(){var c=i.result;if(!c)return void b(null);0===a?b(c.key):h?b(c.key):(h=!0,c.advance(a))},i.onerror=function(){d(i.error)}}catch(a){d(a)}})}).catch(d)});return h(d,b),d}function M(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){A(b._dbInfo,Ca,function(d,e){if(d)return c(d);try{var f=e.objectStore(b._dbInfo.storeName),g=f.openKeyCursor(),h=[];g.onsuccess=function(){var b=g.result;if(!b)return void a(h);h.push(b.key),b.continue()},g.onerror=function(){c(g.error)}}catch(a){c(a)}})}).catch(c)});return h(c,a),c}function N(a,b){b=k.apply(this,arguments);var c=this.config();a="function"!=typeof a&&a||{},a.name||(a.name=a.name||c.name,a.storeName=a.storeName||c.storeName);var d,e=this;if(a.name){var f=a.name===c.name&&e._dbInfo.db,g=f?xa.resolve(e._dbInfo.db):s(a).then(function(b){var c=Aa[a.name],d=c.forages;c.db=b;for(var e=0;e>4,k[i++]=(15&d)<<4|e>>2,k[i++]=(3&e)<<6|63&f;return j}function Q(a){var b,c=new Uint8Array(a),d="";for(b=0;b>2],d+=Fa[(3&c[b])<<4|c[b+1]>>4],d+=Fa[(15&c[b+1])<<2|c[b+2]>>6],d+=Fa[63&c[b+2]];return c.length%3==2?d=d.substring(0,d.length-1)+"=":c.length%3==1&&(d=d.substring(0,d.length-2)+"=="),d}function R(a,b){var c="";if(a&&(c=Wa.call(a)),a&&("[object ArrayBuffer]"===c||a.buffer&&"[object ArrayBuffer]"===Wa.call(a.buffer))){var d,e=Ia;a instanceof ArrayBuffer?(d=a,e+=Ka):(d=a.buffer,"[object Int8Array]"===c?e+=Ma:"[object Uint8Array]"===c?e+=Na:"[object Uint8ClampedArray]"===c?e+=Oa:"[object Int16Array]"===c?e+=Pa:"[object Uint16Array]"===c?e+=Ra:"[object Int32Array]"===c?e+=Qa:"[object Uint32Array]"===c?e+=Sa:"[object Float32Array]"===c?e+=Ta:"[object Float64Array]"===c?e+=Ua:b(new Error("Failed to get type for BinaryArray"))),b(e+Q(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var c=Ga+a.type+"~"+Q(this.result);b(Ia+La+c)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(c){console.error("Couldn't convert value into a JSON string: ",a),b(null,c)}}function S(a){if(a.substring(0,Ja)!==Ia)return JSON.parse(a);var b,c=a.substring(Va),d=a.substring(Ja,Va);if(d===La&&Ha.test(c)){var e=c.match(Ha);b=e[1],c=c.substring(e[0].length)}var f=P(c);switch(d){case Ka:return f;case La:return g([f],{type:b});case Ma:return new Int8Array(f);case Na:return new Uint8Array(f);case Oa:return new Uint8ClampedArray(f);case Pa:return new Int16Array(f);case Ra:return new Uint16Array(f);case Qa:return new Int32Array(f);case Sa:return new Uint32Array(f);case Ta:return new Float32Array(f);case Ua:return new Float64Array(f);default:throw new Error("Unkown type: "+d)}}function T(a,b,c,d){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,d)}function U(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];var e=new xa(function(a,d){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(a){return d(a)}c.db.transaction(function(e){T(e,c,function(){b._dbInfo=c,a()},function(a,b){d(b)})},d)});return c.serializer=Xa,e}function V(a,b,c,d,e,f){a.executeSql(c,d,e,function(a,g){g.code===g.SYNTAX_ERR?a.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[b.storeName],function(a,h){h.rows.length?f(a,g):T(a,b,function(){a.executeSql(c,d,e,f)},f)},f):f(a,g)},f)}function W(a,b){var c=this;a=j(a);var d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function X(a,b){var c=this,d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;h0)return void f(Y.apply(e,[a,h,c,d-1]));g(b)}})})}).catch(g)});return h(f,c),f}function Z(a,b,c){return Y.apply(this,[a,b,c,1])}function $(a,b){var c=this;a=j(a);var d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function _(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){V(b,d,"DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function aa(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){V(b,d,"SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})}).catch(c)});return h(c,a),c}function ba(a,b){var c=this,d=new xa(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){V(c,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})}).catch(d)});return h(d,b),d}function ca(a){var b=this,c=new xa(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){V(b,d,"SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e '__WebKitDatabaseInfoTable__'",[],function(c,d){for(var e=[],f=0;f0}function ja(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=ga(a,b._defaultConfig),ia()?(b._dbInfo=c,c.serializer=Xa,xa.resolve()):xa.reject()}function ka(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=localStorage.length-1;c>=0;c--){var d=localStorage.key(c);0===d.indexOf(a)&&localStorage.removeItem(d)}});return h(c,a),c}function la(a,b){var c=this;a=j(a);var d=c.ready().then(function(){var b=c._dbInfo,d=localStorage.getItem(b.keyPrefix+a);return d&&(d=b.serializer.deserialize(d)),d});return h(d,b),d}function ma(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=localStorage.length,g=1,h=0;h=0;b--){var c=localStorage.key(b);0===c.indexOf(a)&&localStorage.removeItem(c)}}):xa.reject("Invalid arguments"),h(d,b),d}function ta(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function ua(){for(var a=1;a { throw "Method unsupported for driver."; }, ++ setMultipleItems: () => { throw "Method unsupported for driver."; }, + clear: clear, + length: length, + key: key, +diff --git a/node_modules/localforage/src/drivers/websql.js b/node_modules/localforage/src/drivers/websql.js +index 257d819..4fa2410 100644 +--- a/node_modules/localforage/src/drivers/websql.js ++++ b/node_modules/localforage/src/drivers/websql.js +@@ -600,6 +600,8 @@ var webSQLStorage = { + getItem: getItem, + setItem: setItem, + removeItem: removeItem, ++ getMultipleItems: () => { throw "Method unsupported for driver."; }, ++ setMultipleItems: () => { throw "Method unsupported for driver."; }, + clear: clear, + length: length, + key: key, +diff --git a/node_modules/localforage/src/localforage.js b/node_modules/localforage/src/localforage.js +index 8d3393d..847e5e5 100644 +--- a/node_modules/localforage/src/localforage.js ++++ b/node_modules/localforage/src/localforage.js +@@ -36,7 +36,9 @@ const LibraryMethods = [ + 'keys', + 'length', + 'removeItem', +- 'setItem' ++ 'setItem', ++ 'setMultipleItems', ++ 'getMultipleItems' + ].concat(OptionalDriverMethods); + + const DefaultConfig = { +diff --git a/node_modules/localforage/typings/localforage.d.ts b/node_modules/localforage/typings/localforage.d.ts +index 7fb8f58..850f6d6 100644 +--- a/node_modules/localforage/typings/localforage.d.ts ++++ b/node_modules/localforage/typings/localforage.d.ts +@@ -17,8 +17,12 @@ interface LocalForageOptions extends LocalForageDbInstanceOptions { + interface LocalForageDbMethodsCore { + getItem(key: string, callback?: (err: any, value: T | null) => void): Promise; + ++ getMultipleItems(keys: ReadonlyArray, synchronizationKey: string): Promise>; ++ + setItem(key: string, value: T, callback?: (err: any, value: T) => void): Promise; + ++ setMultipleItems(input: Readonly<{[key: string]: unknown}>, synchronizationKey: string, expectedSynchronizationValue?: string, newSynchronizationValue: string, forceWrite: boolean): Promise; ++ + removeItem(key: string, callback?: (err: any) => void): Promise; + + clear(callback?: (err: any) => void): Promise; diff --git a/web/flow-typed/npm/localforage_v1.5.x.js b/web/flow-typed/npm/localforage_v1.5.x.js --- a/web/flow-typed/npm/localforage_v1.5.x.js +++ b/web/flow-typed/npm/localforage_v1.5.x.js @@ -36,6 +36,17 @@ keys( successCallback?: (keyNames: Array) => mixed, ): ?Promise>, + getMultipleItems( + keys: $ReadOnlyArray<$Keys>, + synchronizationKey: string + ): Promise<{+values: T, +synchronizationValue: ?string}>, + setMultipleItems( + input: {+[string]: mixed}, + synchronizationKey: string, + expectedSynchronizationValue: ?string, + newSynchronizationValue: string, + forceWrite: boolean + ): Promise, ... }; @@ -65,6 +76,17 @@ keys( successCallback?: (keyNames: Array) => mixed, ): Promise>, + getMultipleItems( + keys: $ReadOnlyArray<$Keys>, + synchronizationKey: string + ): Promise<{+values: T, +synchronizationValue: ?string}>, + setMultipleItems( + input: {+[string]: mixed}, + synchronizationKey: string, + expectedSynchronizationValue: ?string, + newSynchronizationValue: string, + forceWrite: boolean + ): Promise, iterate( iteratorCallback: (value: T, key: string, iterationNumber: number) => mixed, successCallback?: (result: void | [string, T]) => mixed,