@converse/skeletor 3.1.4 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +6 -0
- package/README.md +9 -3
- package/dist/skeletor.d.ts +8 -2
- package/dist/skeletor.esm.js +254 -241
- package/dist/skeletor.esm.js.map +1 -1
- package/dist/skeletor.js +254 -241
- package/dist/skeletor.js.map +1 -1
- package/dist/skeletor.min.js +4 -4
- package/dist/skeletor.node.js +255 -242
- package/dist/skeletor.node.mjs +255 -242
- package/package.json +3 -1
- package/src/declarations.d.ts +11 -0
- package/src/drivers/nodeSQLiteStorage.ts +2 -7
- package/src/drivers/types.ts +8 -2
- package/src/storage.ts +11 -26
package/dist/skeletor.js
CHANGED
|
@@ -1977,7 +1977,7 @@
|
|
|
1977
1977
|
return (options.name || defaultConfig.name) + "/" + (options.storeName || defaultConfig.storeName) + "/";
|
|
1978
1978
|
}
|
|
1979
1979
|
|
|
1980
|
-
function executeCallback
|
|
1980
|
+
function executeCallback(promise, callback) {
|
|
1981
1981
|
if (callback) {
|
|
1982
1982
|
promise.then(function (result) {
|
|
1983
1983
|
callback(null, result);
|
|
@@ -2118,7 +2118,7 @@
|
|
|
2118
2118
|
var promise = this.ready().then(function () {
|
|
2119
2119
|
_this._dbInfo.mStore.clear();
|
|
2120
2120
|
});
|
|
2121
|
-
executeCallback
|
|
2121
|
+
executeCallback(promise, callback);
|
|
2122
2122
|
return promise;
|
|
2123
2123
|
}
|
|
2124
2124
|
|
|
@@ -2127,7 +2127,7 @@
|
|
|
2127
2127
|
var outPromise = promise.then(function (keyPrefix) {
|
|
2128
2128
|
Store.resolve(keyPrefix).drop();
|
|
2129
2129
|
});
|
|
2130
|
-
executeCallback
|
|
2130
|
+
executeCallback(outPromise, callback);
|
|
2131
2131
|
return promise;
|
|
2132
2132
|
}
|
|
2133
2133
|
|
|
@@ -2139,7 +2139,7 @@
|
|
|
2139
2139
|
// Deserialise if the result is not null or undefined
|
|
2140
2140
|
return result == null ? null : _this._dbInfo.serializer.deserialize(result); //tslint:disable-line:triple-equals
|
|
2141
2141
|
});
|
|
2142
|
-
executeCallback
|
|
2142
|
+
executeCallback(promise, callback);
|
|
2143
2143
|
return promise;
|
|
2144
2144
|
}
|
|
2145
2145
|
|
|
@@ -2163,7 +2163,7 @@
|
|
|
2163
2163
|
}
|
|
2164
2164
|
}
|
|
2165
2165
|
});
|
|
2166
|
-
executeCallback
|
|
2166
|
+
executeCallback(promise, callback);
|
|
2167
2167
|
return promise;
|
|
2168
2168
|
}
|
|
2169
2169
|
|
|
@@ -2182,7 +2182,7 @@
|
|
|
2182
2182
|
}
|
|
2183
2183
|
return result;
|
|
2184
2184
|
});
|
|
2185
|
-
executeCallback
|
|
2185
|
+
executeCallback(promise, callback);
|
|
2186
2186
|
return promise;
|
|
2187
2187
|
}
|
|
2188
2188
|
|
|
@@ -2191,13 +2191,13 @@
|
|
|
2191
2191
|
var promise = this.ready().then(function () {
|
|
2192
2192
|
return _this._dbInfo.mStore.keys();
|
|
2193
2193
|
});
|
|
2194
|
-
executeCallback
|
|
2194
|
+
executeCallback(promise, callback);
|
|
2195
2195
|
return promise;
|
|
2196
2196
|
}
|
|
2197
2197
|
|
|
2198
2198
|
function length$1(callback) {
|
|
2199
2199
|
var promise = this.keys().then(function (keys$) { return keys$.length; });
|
|
2200
|
-
executeCallback
|
|
2200
|
+
executeCallback(promise, callback);
|
|
2201
2201
|
return promise;
|
|
2202
2202
|
}
|
|
2203
2203
|
|
|
@@ -2207,7 +2207,7 @@
|
|
|
2207
2207
|
var promise = this.ready().then(function () {
|
|
2208
2208
|
_this._dbInfo.mStore.rm(key$);
|
|
2209
2209
|
});
|
|
2210
|
-
executeCallback
|
|
2210
|
+
executeCallback(promise, callback);
|
|
2211
2211
|
return promise;
|
|
2212
2212
|
}
|
|
2213
2213
|
|
|
@@ -2237,7 +2237,7 @@
|
|
|
2237
2237
|
});
|
|
2238
2238
|
});
|
|
2239
2239
|
});
|
|
2240
|
-
executeCallback
|
|
2240
|
+
executeCallback(promise, callback);
|
|
2241
2241
|
return promise;
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
@@ -7887,253 +7887,282 @@
|
|
|
7887
7887
|
|
|
7888
7888
|
var localforageSetitemsExports = requireLocalforageSetitems();
|
|
7889
7889
|
|
|
7890
|
-
|
|
7891
|
-
if (getSerializerPromise.result) {
|
|
7892
|
-
return getSerializerPromise.result;
|
|
7893
|
-
}
|
|
7894
|
-
if (!localForageInstance || typeof localForageInstance.getSerializer !== 'function') {
|
|
7895
|
-
return Promise.reject(new Error('localforage.getSerializer() was not available! ' + 'localforage v1.4+ is required!'));
|
|
7896
|
-
}
|
|
7897
|
-
getSerializerPromise.result = localForageInstance.getSerializer();
|
|
7898
|
-
return getSerializerPromise.result;
|
|
7899
|
-
}
|
|
7890
|
+
var localforageGetitems$1 = {exports: {}};
|
|
7900
7891
|
|
|
7892
|
+
var localforageGetitems = localforageGetitems$1.exports;
|
|
7901
7893
|
|
|
7894
|
+
var hasRequiredLocalforageGetitems;
|
|
7902
7895
|
|
|
7903
|
-
function
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
return promise;
|
|
7912
|
-
}
|
|
7896
|
+
function requireLocalforageGetitems () {
|
|
7897
|
+
if (hasRequiredLocalforageGetitems) return localforageGetitems$1.exports;
|
|
7898
|
+
hasRequiredLocalforageGetitems = 1;
|
|
7899
|
+
(function (module, exports) {
|
|
7900
|
+
(function (global, factory) {
|
|
7901
|
+
factory(exports, requireLocalforage()) ;
|
|
7902
|
+
}(localforageGetitems, (function (exports,localforage) {
|
|
7903
|
+
localforage = 'default' in localforage ? localforage['default'] : localforage;
|
|
7913
7904
|
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
}
|
|
7905
|
+
function getSerializerPromise(localForageInstance) {
|
|
7906
|
+
if (getSerializerPromise.result) {
|
|
7907
|
+
return getSerializerPromise.result;
|
|
7908
|
+
}
|
|
7909
|
+
if (!localForageInstance || typeof localForageInstance.getSerializer !== 'function') {
|
|
7910
|
+
return Promise.reject(new Error('localforage.getSerializer() was not available! ' + 'localforage v1.4+ is required!'));
|
|
7911
|
+
}
|
|
7912
|
+
getSerializerPromise.result = localForageInstance.getSerializer();
|
|
7913
|
+
return getSerializerPromise.result;
|
|
7914
|
+
}
|
|
7925
7915
|
|
|
7926
|
-
function getItemsGeneric(keys /*, callback*/) {
|
|
7927
|
-
var localforageInstance = this;
|
|
7928
|
-
var promise = new Promise(function (resolve, reject) {
|
|
7929
|
-
var itemPromises = [];
|
|
7930
7916
|
|
|
7931
|
-
for (var i = 0, len = keys.length; i < len; i++) {
|
|
7932
|
-
itemPromises.push(getItemKeyValue.call(localforageInstance, keys[i]));
|
|
7933
|
-
}
|
|
7934
7917
|
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7918
|
+
function executeCallback(promise, callback) {
|
|
7919
|
+
if (callback) {
|
|
7920
|
+
promise.then(function (result) {
|
|
7921
|
+
callback(null, result);
|
|
7922
|
+
}, function (error) {
|
|
7923
|
+
callback(error);
|
|
7924
|
+
});
|
|
7925
|
+
}
|
|
7926
|
+
return promise;
|
|
7927
|
+
}
|
|
7939
7928
|
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7929
|
+
function getItemKeyValue(key, callback) {
|
|
7930
|
+
var localforageInstance = this;
|
|
7931
|
+
var promise = localforageInstance.getItem(key).then(function (value) {
|
|
7932
|
+
return {
|
|
7933
|
+
key: key,
|
|
7934
|
+
value: value
|
|
7935
|
+
};
|
|
7936
|
+
});
|
|
7937
|
+
executeCallback(promise, callback);
|
|
7938
|
+
return promise;
|
|
7939
|
+
}
|
|
7947
7940
|
|
|
7941
|
+
function getItemsGeneric(keys /*, callback*/) {
|
|
7942
|
+
var localforageInstance = this;
|
|
7943
|
+
var promise = new Promise(function (resolve, reject) {
|
|
7944
|
+
var itemPromises = [];
|
|
7948
7945
|
|
|
7946
|
+
for (var i = 0, len = keys.length; i < len; i++) {
|
|
7947
|
+
itemPromises.push(getItemKeyValue.call(localforageInstance, keys[i]));
|
|
7948
|
+
}
|
|
7949
7949
|
|
|
7950
|
+
Promise.all(itemPromises).then(function (keyValuePairs) {
|
|
7951
|
+
var result = {};
|
|
7952
|
+
for (var i = 0, len = keyValuePairs.length; i < len; i++) {
|
|
7953
|
+
var keyValuePair = keyValuePairs[i];
|
|
7950
7954
|
|
|
7955
|
+
result[keyValuePair.key] = keyValuePair.value;
|
|
7956
|
+
}
|
|
7957
|
+
resolve(result);
|
|
7958
|
+
}).catch(reject);
|
|
7959
|
+
});
|
|
7960
|
+
return promise;
|
|
7961
|
+
}
|
|
7951
7962
|
|
|
7952
|
-
function getAllItemsUsingIterate() {
|
|
7953
|
-
var localforageInstance = this;
|
|
7954
|
-
var accumulator = {};
|
|
7955
|
-
return localforageInstance.iterate(function (value, key /*, iterationNumber*/) {
|
|
7956
|
-
accumulator[key] = value;
|
|
7957
|
-
}).then(function () {
|
|
7958
|
-
return accumulator;
|
|
7959
|
-
});
|
|
7960
|
-
}
|
|
7961
7963
|
|
|
7962
|
-
function getIDBKeyRange() {
|
|
7963
|
-
/* global IDBKeyRange, webkitIDBKeyRange, mozIDBKeyRange */
|
|
7964
|
-
if (typeof IDBKeyRange !== 'undefined') {
|
|
7965
|
-
return IDBKeyRange;
|
|
7966
|
-
}
|
|
7967
|
-
if (typeof webkitIDBKeyRange !== 'undefined') {
|
|
7968
|
-
return webkitIDBKeyRange;
|
|
7969
|
-
}
|
|
7970
|
-
if (typeof mozIDBKeyRange !== 'undefined') {
|
|
7971
|
-
return mozIDBKeyRange;
|
|
7972
|
-
}
|
|
7973
|
-
}
|
|
7974
7964
|
|
|
7975
|
-
var idbKeyRange = getIDBKeyRange();
|
|
7976
7965
|
|
|
7977
|
-
function getItemsIndexedDB(keys /*, callback*/) {
|
|
7978
|
-
keys = keys.slice();
|
|
7979
|
-
var localforageInstance = this;
|
|
7980
|
-
function comparer(a, b) {
|
|
7981
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
7982
|
-
}
|
|
7983
7966
|
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7967
|
+
function getAllItemsUsingIterate() {
|
|
7968
|
+
var localforageInstance = this;
|
|
7969
|
+
var accumulator = {};
|
|
7970
|
+
return localforageInstance.iterate(function (value, key /*, iterationNumber*/) {
|
|
7971
|
+
accumulator[key] = value;
|
|
7972
|
+
}).then(function () {
|
|
7973
|
+
return accumulator;
|
|
7974
|
+
});
|
|
7975
|
+
}
|
|
7989
7976
|
|
|
7990
|
-
|
|
7977
|
+
function getIDBKeyRange() {
|
|
7978
|
+
/* global IDBKeyRange, webkitIDBKeyRange, mozIDBKeyRange */
|
|
7979
|
+
if (typeof IDBKeyRange !== 'undefined') {
|
|
7980
|
+
return IDBKeyRange;
|
|
7981
|
+
}
|
|
7982
|
+
if (typeof webkitIDBKeyRange !== 'undefined') {
|
|
7983
|
+
return webkitIDBKeyRange;
|
|
7984
|
+
}
|
|
7985
|
+
if (typeof mozIDBKeyRange !== 'undefined') {
|
|
7986
|
+
return mozIDBKeyRange;
|
|
7987
|
+
}
|
|
7988
|
+
}
|
|
7991
7989
|
|
|
7992
|
-
|
|
7990
|
+
var idbKeyRange = getIDBKeyRange();
|
|
7993
7991
|
|
|
7994
|
-
|
|
7992
|
+
function getItemsIndexedDB(keys /*, callback*/) {
|
|
7993
|
+
keys = keys.slice();
|
|
7994
|
+
var localforageInstance = this;
|
|
7995
|
+
function comparer(a, b) {
|
|
7996
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
7997
|
+
}
|
|
7995
7998
|
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
value = null;
|
|
8002
|
-
}
|
|
8003
|
-
resolve(value);
|
|
8004
|
-
};
|
|
8005
|
-
} else {
|
|
8006
|
-
req = store.openCursor(keyRangeValue);
|
|
8007
|
-
var result = {};
|
|
8008
|
-
var i = 0;
|
|
7999
|
+
var promise = new Promise(function (resolve, reject) {
|
|
8000
|
+
localforageInstance.ready().then(function () {
|
|
8001
|
+
// Thanks https://hacks.mozilla.org/2014/06/breaking-the-borders-of-indexeddb/
|
|
8002
|
+
var dbInfo = localforageInstance._dbInfo;
|
|
8003
|
+
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
|
|
8009
8004
|
|
|
8010
|
-
|
|
8011
|
-
var cursor = req.result; // event.target.result;
|
|
8005
|
+
var set = keys.sort(comparer);
|
|
8012
8006
|
|
|
8013
|
-
|
|
8014
|
-
resolve(result);
|
|
8015
|
-
return;
|
|
8016
|
-
}
|
|
8007
|
+
var keyRangeValue = idbKeyRange.bound(keys[0], keys[keys.length - 1], false, false);
|
|
8017
8008
|
|
|
8018
|
-
|
|
8009
|
+
var req;
|
|
8019
8010
|
|
|
8020
|
-
|
|
8021
|
-
|
|
8011
|
+
if ('getAll' in store) {
|
|
8012
|
+
req = store.getAll(keyRangeValue);
|
|
8013
|
+
req.onsuccess = function () {
|
|
8014
|
+
var value = req.result;
|
|
8015
|
+
if (value === undefined) {
|
|
8016
|
+
value = null;
|
|
8017
|
+
}
|
|
8018
|
+
resolve(value);
|
|
8019
|
+
};
|
|
8020
|
+
} else {
|
|
8021
|
+
req = store.openCursor(keyRangeValue);
|
|
8022
|
+
var result = {};
|
|
8023
|
+
var i = 0;
|
|
8022
8024
|
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
resolve(result);
|
|
8026
|
-
return;
|
|
8027
|
-
}
|
|
8028
|
-
}
|
|
8025
|
+
req.onsuccess = function () /*event*/{
|
|
8026
|
+
var cursor = req.result; // event.target.result;
|
|
8029
8027
|
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
var value = cursor.value;
|
|
8035
|
-
if (value === undefined) {
|
|
8036
|
-
value = null;
|
|
8037
|
-
}
|
|
8028
|
+
if (!cursor) {
|
|
8029
|
+
resolve(result);
|
|
8030
|
+
return;
|
|
8031
|
+
}
|
|
8038
8032
|
|
|
8039
|
-
|
|
8040
|
-
// onfound(cursor.value);
|
|
8041
|
-
cursor.continue();
|
|
8042
|
-
} else {
|
|
8043
|
-
// cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.
|
|
8044
|
-
cursor.continue(set[i]);
|
|
8045
|
-
}
|
|
8046
|
-
};
|
|
8047
|
-
}
|
|
8033
|
+
var key = cursor.key;
|
|
8048
8034
|
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
};
|
|
8052
|
-
}).catch(reject);
|
|
8053
|
-
});
|
|
8054
|
-
return promise;
|
|
8055
|
-
}
|
|
8035
|
+
while (key > set[i]) {
|
|
8036
|
+
i++; // The cursor has passed beyond this key. Check next.
|
|
8056
8037
|
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
var dbInfo = localforageInstance._dbInfo;
|
|
8064
|
-
dbInfo.db.transaction(function (t) {
|
|
8038
|
+
if (i === set.length) {
|
|
8039
|
+
// There is no next. Stop searching.
|
|
8040
|
+
resolve(result);
|
|
8041
|
+
return;
|
|
8042
|
+
}
|
|
8043
|
+
}
|
|
8065
8044
|
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8045
|
+
if (key === set[i]) {
|
|
8046
|
+
// The current cursor value should be included and we should continue
|
|
8047
|
+
// a single step in case next item has the same key or possibly our
|
|
8048
|
+
// next key in set.
|
|
8049
|
+
var value = cursor.value;
|
|
8050
|
+
if (value === undefined) {
|
|
8051
|
+
value = null;
|
|
8052
|
+
}
|
|
8070
8053
|
|
|
8071
|
-
|
|
8054
|
+
result[key] = value;
|
|
8055
|
+
// onfound(cursor.value);
|
|
8056
|
+
cursor.continue();
|
|
8057
|
+
} else {
|
|
8058
|
+
// cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.
|
|
8059
|
+
cursor.continue(set[i]);
|
|
8060
|
+
}
|
|
8061
|
+
};
|
|
8062
|
+
}
|
|
8072
8063
|
|
|
8073
|
-
|
|
8064
|
+
req.onerror = function () /*event*/{
|
|
8065
|
+
reject(req.error);
|
|
8066
|
+
};
|
|
8067
|
+
}).catch(reject);
|
|
8068
|
+
});
|
|
8069
|
+
return promise;
|
|
8070
|
+
}
|
|
8074
8071
|
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8072
|
+
function getItemsWebsql(keys /*, callback*/) {
|
|
8073
|
+
var localforageInstance = this;
|
|
8074
|
+
var promise = new Promise(function (resolve, reject) {
|
|
8075
|
+
localforageInstance.ready().then(function () {
|
|
8076
|
+
return getSerializerPromise(localforageInstance);
|
|
8077
|
+
}).then(function (serializer) {
|
|
8078
|
+
var dbInfo = localforageInstance._dbInfo;
|
|
8079
|
+
dbInfo.db.transaction(function (t) {
|
|
8079
8080
|
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
}
|
|
8081
|
+
var queryParts = new Array(keys.length);
|
|
8082
|
+
for (var i = 0, len = keys.length; i < len; i++) {
|
|
8083
|
+
queryParts[i] = '?';
|
|
8084
|
+
}
|
|
8085
8085
|
|
|
8086
|
-
|
|
8087
|
-
}
|
|
8086
|
+
t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE (key IN (' + queryParts.join(',') + '))', keys, function (t, results) {
|
|
8088
8087
|
|
|
8089
|
-
|
|
8090
|
-
}, function (t, error) {
|
|
8091
|
-
reject(error);
|
|
8092
|
-
});
|
|
8093
|
-
});
|
|
8094
|
-
}).catch(reject);
|
|
8095
|
-
});
|
|
8096
|
-
return promise;
|
|
8097
|
-
}
|
|
8088
|
+
var result = {};
|
|
8098
8089
|
|
|
8099
|
-
|
|
8100
|
-
|
|
8090
|
+
var rows = results.rows;
|
|
8091
|
+
for (var i = 0, len = rows.length; i < len; i++) {
|
|
8092
|
+
var item = rows.item(i);
|
|
8093
|
+
var value = item.value;
|
|
8101
8094
|
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
if (currentDriver === localforageInstance.INDEXEDDB) {
|
|
8108
|
-
promise = getItemsIndexedDB.apply(localforageInstance, arguments);
|
|
8109
|
-
} else if (currentDriver === localforageInstance.WEBSQL) {
|
|
8110
|
-
promise = getItemsWebsql.apply(localforageInstance, arguments);
|
|
8111
|
-
} else {
|
|
8112
|
-
promise = getItemsGeneric.apply(localforageInstance, arguments);
|
|
8113
|
-
}
|
|
8114
|
-
}
|
|
8095
|
+
// Check to see if this is serialized content we need to
|
|
8096
|
+
// unpack.
|
|
8097
|
+
if (value) {
|
|
8098
|
+
value = serializer.deserialize(value);
|
|
8099
|
+
}
|
|
8115
8100
|
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
}
|
|
8101
|
+
result[item.key] = value;
|
|
8102
|
+
}
|
|
8119
8103
|
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8104
|
+
resolve(result);
|
|
8105
|
+
}, function (t, error) {
|
|
8106
|
+
reject(error);
|
|
8107
|
+
});
|
|
8108
|
+
});
|
|
8109
|
+
}).catch(reject);
|
|
8110
|
+
});
|
|
8111
|
+
return promise;
|
|
8112
|
+
}
|
|
8113
|
+
|
|
8114
|
+
function localforageGetItems(keys, callback) {
|
|
8115
|
+
var localforageInstance = this;
|
|
8116
|
+
|
|
8117
|
+
var promise;
|
|
8118
|
+
if (!arguments.length || keys === null) {
|
|
8119
|
+
promise = getAllItemsUsingIterate.apply(localforageInstance);
|
|
8120
|
+
} else {
|
|
8121
|
+
var currentDriver = localforageInstance.driver();
|
|
8122
|
+
if (currentDriver === localforageInstance.INDEXEDDB) {
|
|
8123
|
+
promise = getItemsIndexedDB.apply(localforageInstance, arguments);
|
|
8124
|
+
} else if (currentDriver === localforageInstance.WEBSQL) {
|
|
8125
|
+
promise = getItemsWebsql.apply(localforageInstance, arguments);
|
|
8126
|
+
} else {
|
|
8127
|
+
promise = getItemsGeneric.apply(localforageInstance, arguments);
|
|
8128
|
+
}
|
|
8129
|
+
}
|
|
8130
|
+
|
|
8131
|
+
executeCallback(promise, callback);
|
|
8132
|
+
return promise;
|
|
8133
|
+
}
|
|
8134
|
+
|
|
8135
|
+
function extendPrototype(localforage$$1) {
|
|
8136
|
+
var localforagePrototype = Object.getPrototypeOf(localforage$$1);
|
|
8137
|
+
if (localforagePrototype) {
|
|
8138
|
+
localforagePrototype.getItems = localforageGetItems;
|
|
8139
|
+
localforagePrototype.getItems.indexedDB = function () {
|
|
8140
|
+
return getItemsIndexedDB.apply(this, arguments);
|
|
8141
|
+
};
|
|
8142
|
+
localforagePrototype.getItems.websql = function () {
|
|
8143
|
+
return getItemsWebsql.apply(this, arguments);
|
|
8144
|
+
};
|
|
8145
|
+
localforagePrototype.getItems.generic = function () {
|
|
8146
|
+
return getItemsGeneric.apply(this, arguments);
|
|
8147
|
+
};
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
|
|
8151
|
+
var extendPrototypeResult = extendPrototype(localforage);
|
|
8152
|
+
|
|
8153
|
+
exports.localforageGetItems = localforageGetItems;
|
|
8154
|
+
exports.extendPrototype = extendPrototype;
|
|
8155
|
+
exports.extendPrototypeResult = extendPrototypeResult;
|
|
8156
|
+
exports.getItemsGeneric = getItemsGeneric;
|
|
8157
|
+
|
|
8158
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
8159
|
+
|
|
8160
|
+
})));
|
|
8161
|
+
} (localforageGetitems$1, localforageGetitems$1.exports));
|
|
8162
|
+
return localforageGetitems$1.exports;
|
|
8134
8163
|
}
|
|
8135
8164
|
|
|
8136
|
-
|
|
8165
|
+
var localforageGetitemsExports = requireLocalforageGetitems();
|
|
8137
8166
|
|
|
8138
8167
|
/** Used for built-in method references. */
|
|
8139
8168
|
var objectProto$7 = Object.prototype;
|
|
@@ -8586,7 +8615,7 @@
|
|
|
8586
8615
|
const IN_MEMORY = _driver;
|
|
8587
8616
|
localForage.defineDriver(memoryDriver);
|
|
8588
8617
|
localforageSetitemsExports.extendPrototype(localForage);
|
|
8589
|
-
extendPrototype(localForage);
|
|
8618
|
+
localforageGetitemsExports.extendPrototype(localForage);
|
|
8590
8619
|
// Every storage instance is registered with a WeakRef so that flushAll() can
|
|
8591
8620
|
// reach pending writes without keeping instances alive. There's no leak and no
|
|
8592
8621
|
// lifecycle hook to maintain: an instance is collected once its owning model or
|
|
@@ -8776,33 +8805,17 @@
|
|
|
8776
8805
|
caughtError = error instanceof Error ? error : new Error(error?.message ?? String(error));
|
|
8777
8806
|
}
|
|
8778
8807
|
}
|
|
8779
|
-
if (
|
|
8780
|
-
|
|
8781
|
-
// When storing, we don't pass back the response (which is
|
|
8782
|
-
// the set attributes returned from localforage because
|
|
8783
|
-
// Skeletor sets them again on the model and due to the async
|
|
8784
|
-
// nature of localforage it can cause stale attributes to be
|
|
8785
|
-
// set on a model after it's been updated in the meantime.
|
|
8786
|
-
const data = method === 'read' ? resp : null;
|
|
8787
|
-
options.success(data, options);
|
|
8788
|
-
}
|
|
8789
|
-
}
|
|
8790
|
-
else if (method === 'read' && !caughtError) {
|
|
8791
|
-
// A read that finds no record is a normal empty result (first run /
|
|
8792
|
-
// empty storage), not an error. Resolve with `null` so the callback
|
|
8793
|
-
// and promise forms of fetch() agree and a first-run read never
|
|
8794
|
-
// rejects.
|
|
8795
|
-
if (options && options.success) {
|
|
8796
|
-
options.success(null, options);
|
|
8797
|
-
}
|
|
8808
|
+
if (caughtError) {
|
|
8809
|
+
options?.error?.(caughtError);
|
|
8798
8810
|
}
|
|
8799
|
-
else {
|
|
8800
|
-
//
|
|
8801
|
-
//
|
|
8802
|
-
//
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8811
|
+
else if (options?.success) {
|
|
8812
|
+
// When storing, we don't pass back the response (which is the set
|
|
8813
|
+
// attributes returned from localforage) because Skeletor sets them
|
|
8814
|
+
// again on the model and due to the async nature of localforage it can
|
|
8815
|
+
// cause stale attributes to be set on a model after it's been updated
|
|
8816
|
+
// in the meantime.
|
|
8817
|
+
const data = method === 'read' ? (resp ?? null) : null;
|
|
8818
|
+
options.success(data, options);
|
|
8806
8819
|
}
|
|
8807
8820
|
}
|
|
8808
8821
|
localSync.__name__ = 'localSync';
|