@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.
@@ -1971,7 +1971,7 @@ function getKeyPrefix(options, defaultConfig) {
1971
1971
  return (options.name || defaultConfig.name) + "/" + (options.storeName || defaultConfig.storeName) + "/";
1972
1972
  }
1973
1973
 
1974
- function executeCallback$1(promise, callback) {
1974
+ function executeCallback(promise, callback) {
1975
1975
  if (callback) {
1976
1976
  promise.then(function (result) {
1977
1977
  callback(null, result);
@@ -2112,7 +2112,7 @@ function clear$1(callback) {
2112
2112
  var promise = this.ready().then(function () {
2113
2113
  _this._dbInfo.mStore.clear();
2114
2114
  });
2115
- executeCallback$1(promise, callback);
2115
+ executeCallback(promise, callback);
2116
2116
  return promise;
2117
2117
  }
2118
2118
 
@@ -2121,7 +2121,7 @@ function dropInstance$1(_options, _cb) {
2121
2121
  var outPromise = promise.then(function (keyPrefix) {
2122
2122
  Store.resolve(keyPrefix).drop();
2123
2123
  });
2124
- executeCallback$1(outPromise, callback);
2124
+ executeCallback(outPromise, callback);
2125
2125
  return promise;
2126
2126
  }
2127
2127
 
@@ -2133,7 +2133,7 @@ function getItem$1(key$, callback) {
2133
2133
  // Deserialise if the result is not null or undefined
2134
2134
  return result == null ? null : _this._dbInfo.serializer.deserialize(result); //tslint:disable-line:triple-equals
2135
2135
  });
2136
- executeCallback$1(promise, callback);
2136
+ executeCallback(promise, callback);
2137
2137
  return promise;
2138
2138
  }
2139
2139
 
@@ -2157,7 +2157,7 @@ function iterate$1(iterator, callback) {
2157
2157
  }
2158
2158
  }
2159
2159
  });
2160
- executeCallback$1(promise, callback);
2160
+ executeCallback(promise, callback);
2161
2161
  return promise;
2162
2162
  }
2163
2163
 
@@ -2176,7 +2176,7 @@ function key$1(idx, callback) {
2176
2176
  }
2177
2177
  return result;
2178
2178
  });
2179
- executeCallback$1(promise, callback);
2179
+ executeCallback(promise, callback);
2180
2180
  return promise;
2181
2181
  }
2182
2182
 
@@ -2185,13 +2185,13 @@ function keys$1(callback) {
2185
2185
  var promise = this.ready().then(function () {
2186
2186
  return _this._dbInfo.mStore.keys();
2187
2187
  });
2188
- executeCallback$1(promise, callback);
2188
+ executeCallback(promise, callback);
2189
2189
  return promise;
2190
2190
  }
2191
2191
 
2192
2192
  function length$1(callback) {
2193
2193
  var promise = this.keys().then(function (keys$) { return keys$.length; });
2194
- executeCallback$1(promise, callback);
2194
+ executeCallback(promise, callback);
2195
2195
  return promise;
2196
2196
  }
2197
2197
 
@@ -2201,7 +2201,7 @@ function removeItem$1(key$, callback) {
2201
2201
  var promise = this.ready().then(function () {
2202
2202
  _this._dbInfo.mStore.rm(key$);
2203
2203
  });
2204
- executeCallback$1(promise, callback);
2204
+ executeCallback(promise, callback);
2205
2205
  return promise;
2206
2206
  }
2207
2207
 
@@ -2231,7 +2231,7 @@ function setItem$1(key$, value, callback) {
2231
2231
  });
2232
2232
  });
2233
2233
  });
2234
- executeCallback$1(promise, callback);
2234
+ executeCallback(promise, callback);
2235
2235
  return promise;
2236
2236
  }
2237
2237
 
@@ -7881,253 +7881,282 @@ function requireLocalforageSetitems () {
7881
7881
 
7882
7882
  var localforageSetitemsExports = requireLocalforageSetitems();
7883
7883
 
7884
- function getSerializerPromise(localForageInstance) {
7885
- if (getSerializerPromise.result) {
7886
- return getSerializerPromise.result;
7887
- }
7888
- if (!localForageInstance || typeof localForageInstance.getSerializer !== 'function') {
7889
- return Promise.reject(new Error('localforage.getSerializer() was not available! ' + 'localforage v1.4+ is required!'));
7890
- }
7891
- getSerializerPromise.result = localForageInstance.getSerializer();
7892
- return getSerializerPromise.result;
7893
- }
7884
+ var localforageGetitems$1 = {exports: {}};
7894
7885
 
7886
+ var localforageGetitems = localforageGetitems$1.exports;
7895
7887
 
7888
+ var hasRequiredLocalforageGetitems;
7896
7889
 
7897
- function executeCallback(promise, callback) {
7898
- if (callback) {
7899
- promise.then(function (result) {
7900
- callback(null, result);
7901
- }, function (error) {
7902
- callback(error);
7903
- });
7904
- }
7905
- return promise;
7906
- }
7890
+ function requireLocalforageGetitems () {
7891
+ if (hasRequiredLocalforageGetitems) return localforageGetitems$1.exports;
7892
+ hasRequiredLocalforageGetitems = 1;
7893
+ (function (module, exports) {
7894
+ (function (global, factory) {
7895
+ factory(exports, requireLocalforage()) ;
7896
+ }(localforageGetitems, (function (exports,localforage) {
7897
+ localforage = 'default' in localforage ? localforage['default'] : localforage;
7907
7898
 
7908
- function getItemKeyValue(key, callback) {
7909
- var localforageInstance = this;
7910
- var promise = localforageInstance.getItem(key).then(function (value) {
7911
- return {
7912
- key: key,
7913
- value: value
7914
- };
7915
- });
7916
- executeCallback(promise, callback);
7917
- return promise;
7918
- }
7899
+ function getSerializerPromise(localForageInstance) {
7900
+ if (getSerializerPromise.result) {
7901
+ return getSerializerPromise.result;
7902
+ }
7903
+ if (!localForageInstance || typeof localForageInstance.getSerializer !== 'function') {
7904
+ return Promise.reject(new Error('localforage.getSerializer() was not available! ' + 'localforage v1.4+ is required!'));
7905
+ }
7906
+ getSerializerPromise.result = localForageInstance.getSerializer();
7907
+ return getSerializerPromise.result;
7908
+ }
7919
7909
 
7920
- function getItemsGeneric(keys /*, callback*/) {
7921
- var localforageInstance = this;
7922
- var promise = new Promise(function (resolve, reject) {
7923
- var itemPromises = [];
7924
7910
 
7925
- for (var i = 0, len = keys.length; i < len; i++) {
7926
- itemPromises.push(getItemKeyValue.call(localforageInstance, keys[i]));
7927
- }
7928
7911
 
7929
- Promise.all(itemPromises).then(function (keyValuePairs) {
7930
- var result = {};
7931
- for (var i = 0, len = keyValuePairs.length; i < len; i++) {
7932
- var keyValuePair = keyValuePairs[i];
7912
+ function executeCallback(promise, callback) {
7913
+ if (callback) {
7914
+ promise.then(function (result) {
7915
+ callback(null, result);
7916
+ }, function (error) {
7917
+ callback(error);
7918
+ });
7919
+ }
7920
+ return promise;
7921
+ }
7933
7922
 
7934
- result[keyValuePair.key] = keyValuePair.value;
7935
- }
7936
- resolve(result);
7937
- }).catch(reject);
7938
- });
7939
- return promise;
7940
- }
7923
+ function getItemKeyValue(key, callback) {
7924
+ var localforageInstance = this;
7925
+ var promise = localforageInstance.getItem(key).then(function (value) {
7926
+ return {
7927
+ key: key,
7928
+ value: value
7929
+ };
7930
+ });
7931
+ executeCallback(promise, callback);
7932
+ return promise;
7933
+ }
7941
7934
 
7935
+ function getItemsGeneric(keys /*, callback*/) {
7936
+ var localforageInstance = this;
7937
+ var promise = new Promise(function (resolve, reject) {
7938
+ var itemPromises = [];
7942
7939
 
7940
+ for (var i = 0, len = keys.length; i < len; i++) {
7941
+ itemPromises.push(getItemKeyValue.call(localforageInstance, keys[i]));
7942
+ }
7943
7943
 
7944
+ Promise.all(itemPromises).then(function (keyValuePairs) {
7945
+ var result = {};
7946
+ for (var i = 0, len = keyValuePairs.length; i < len; i++) {
7947
+ var keyValuePair = keyValuePairs[i];
7944
7948
 
7949
+ result[keyValuePair.key] = keyValuePair.value;
7950
+ }
7951
+ resolve(result);
7952
+ }).catch(reject);
7953
+ });
7954
+ return promise;
7955
+ }
7945
7956
 
7946
- function getAllItemsUsingIterate() {
7947
- var localforageInstance = this;
7948
- var accumulator = {};
7949
- return localforageInstance.iterate(function (value, key /*, iterationNumber*/) {
7950
- accumulator[key] = value;
7951
- }).then(function () {
7952
- return accumulator;
7953
- });
7954
- }
7955
7957
 
7956
- function getIDBKeyRange() {
7957
- /* global IDBKeyRange, webkitIDBKeyRange, mozIDBKeyRange */
7958
- if (typeof IDBKeyRange !== 'undefined') {
7959
- return IDBKeyRange;
7960
- }
7961
- if (typeof webkitIDBKeyRange !== 'undefined') {
7962
- return webkitIDBKeyRange;
7963
- }
7964
- if (typeof mozIDBKeyRange !== 'undefined') {
7965
- return mozIDBKeyRange;
7966
- }
7967
- }
7968
7958
 
7969
- var idbKeyRange = getIDBKeyRange();
7970
7959
 
7971
- function getItemsIndexedDB(keys /*, callback*/) {
7972
- keys = keys.slice();
7973
- var localforageInstance = this;
7974
- function comparer(a, b) {
7975
- return a < b ? -1 : a > b ? 1 : 0;
7976
- }
7977
7960
 
7978
- var promise = new Promise(function (resolve, reject) {
7979
- localforageInstance.ready().then(function () {
7980
- // Thanks https://hacks.mozilla.org/2014/06/breaking-the-borders-of-indexeddb/
7981
- var dbInfo = localforageInstance._dbInfo;
7982
- var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
7961
+ function getAllItemsUsingIterate() {
7962
+ var localforageInstance = this;
7963
+ var accumulator = {};
7964
+ return localforageInstance.iterate(function (value, key /*, iterationNumber*/) {
7965
+ accumulator[key] = value;
7966
+ }).then(function () {
7967
+ return accumulator;
7968
+ });
7969
+ }
7983
7970
 
7984
- var set = keys.sort(comparer);
7971
+ function getIDBKeyRange() {
7972
+ /* global IDBKeyRange, webkitIDBKeyRange, mozIDBKeyRange */
7973
+ if (typeof IDBKeyRange !== 'undefined') {
7974
+ return IDBKeyRange;
7975
+ }
7976
+ if (typeof webkitIDBKeyRange !== 'undefined') {
7977
+ return webkitIDBKeyRange;
7978
+ }
7979
+ if (typeof mozIDBKeyRange !== 'undefined') {
7980
+ return mozIDBKeyRange;
7981
+ }
7982
+ }
7985
7983
 
7986
- var keyRangeValue = idbKeyRange.bound(keys[0], keys[keys.length - 1], false, false);
7984
+ var idbKeyRange = getIDBKeyRange();
7987
7985
 
7988
- var req;
7986
+ function getItemsIndexedDB(keys /*, callback*/) {
7987
+ keys = keys.slice();
7988
+ var localforageInstance = this;
7989
+ function comparer(a, b) {
7990
+ return a < b ? -1 : a > b ? 1 : 0;
7991
+ }
7989
7992
 
7990
- if ('getAll' in store) {
7991
- req = store.getAll(keyRangeValue);
7992
- req.onsuccess = function () {
7993
- var value = req.result;
7994
- if (value === undefined) {
7995
- value = null;
7996
- }
7997
- resolve(value);
7998
- };
7999
- } else {
8000
- req = store.openCursor(keyRangeValue);
8001
- var result = {};
8002
- var i = 0;
7993
+ var promise = new Promise(function (resolve, reject) {
7994
+ localforageInstance.ready().then(function () {
7995
+ // Thanks https://hacks.mozilla.org/2014/06/breaking-the-borders-of-indexeddb/
7996
+ var dbInfo = localforageInstance._dbInfo;
7997
+ var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
8003
7998
 
8004
- req.onsuccess = function () /*event*/{
8005
- var cursor = req.result; // event.target.result;
7999
+ var set = keys.sort(comparer);
8006
8000
 
8007
- if (!cursor) {
8008
- resolve(result);
8009
- return;
8010
- }
8001
+ var keyRangeValue = idbKeyRange.bound(keys[0], keys[keys.length - 1], false, false);
8011
8002
 
8012
- var key = cursor.key;
8003
+ var req;
8013
8004
 
8014
- while (key > set[i]) {
8015
- i++; // The cursor has passed beyond this key. Check next.
8005
+ if ('getAll' in store) {
8006
+ req = store.getAll(keyRangeValue);
8007
+ req.onsuccess = function () {
8008
+ var value = req.result;
8009
+ if (value === undefined) {
8010
+ value = null;
8011
+ }
8012
+ resolve(value);
8013
+ };
8014
+ } else {
8015
+ req = store.openCursor(keyRangeValue);
8016
+ var result = {};
8017
+ var i = 0;
8016
8018
 
8017
- if (i === set.length) {
8018
- // There is no next. Stop searching.
8019
- resolve(result);
8020
- return;
8021
- }
8022
- }
8019
+ req.onsuccess = function () /*event*/{
8020
+ var cursor = req.result; // event.target.result;
8023
8021
 
8024
- if (key === set[i]) {
8025
- // The current cursor value should be included and we should continue
8026
- // a single step in case next item has the same key or possibly our
8027
- // next key in set.
8028
- var value = cursor.value;
8029
- if (value === undefined) {
8030
- value = null;
8031
- }
8022
+ if (!cursor) {
8023
+ resolve(result);
8024
+ return;
8025
+ }
8032
8026
 
8033
- result[key] = value;
8034
- // onfound(cursor.value);
8035
- cursor.continue();
8036
- } else {
8037
- // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.
8038
- cursor.continue(set[i]);
8039
- }
8040
- };
8041
- }
8027
+ var key = cursor.key;
8042
8028
 
8043
- req.onerror = function () /*event*/{
8044
- reject(req.error);
8045
- };
8046
- }).catch(reject);
8047
- });
8048
- return promise;
8049
- }
8029
+ while (key > set[i]) {
8030
+ i++; // The cursor has passed beyond this key. Check next.
8050
8031
 
8051
- function getItemsWebsql(keys /*, callback*/) {
8052
- var localforageInstance = this;
8053
- var promise = new Promise(function (resolve, reject) {
8054
- localforageInstance.ready().then(function () {
8055
- return getSerializerPromise(localforageInstance);
8056
- }).then(function (serializer) {
8057
- var dbInfo = localforageInstance._dbInfo;
8058
- dbInfo.db.transaction(function (t) {
8032
+ if (i === set.length) {
8033
+ // There is no next. Stop searching.
8034
+ resolve(result);
8035
+ return;
8036
+ }
8037
+ }
8059
8038
 
8060
- var queryParts = new Array(keys.length);
8061
- for (var i = 0, len = keys.length; i < len; i++) {
8062
- queryParts[i] = '?';
8063
- }
8039
+ if (key === set[i]) {
8040
+ // The current cursor value should be included and we should continue
8041
+ // a single step in case next item has the same key or possibly our
8042
+ // next key in set.
8043
+ var value = cursor.value;
8044
+ if (value === undefined) {
8045
+ value = null;
8046
+ }
8064
8047
 
8065
- t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE (key IN (' + queryParts.join(',') + '))', keys, function (t, results) {
8048
+ result[key] = value;
8049
+ // onfound(cursor.value);
8050
+ cursor.continue();
8051
+ } else {
8052
+ // cursor.key not yet at set[i]. Forward cursor to the next key to hunt for.
8053
+ cursor.continue(set[i]);
8054
+ }
8055
+ };
8056
+ }
8066
8057
 
8067
- var result = {};
8058
+ req.onerror = function () /*event*/{
8059
+ reject(req.error);
8060
+ };
8061
+ }).catch(reject);
8062
+ });
8063
+ return promise;
8064
+ }
8068
8065
 
8069
- var rows = results.rows;
8070
- for (var i = 0, len = rows.length; i < len; i++) {
8071
- var item = rows.item(i);
8072
- var value = item.value;
8066
+ function getItemsWebsql(keys /*, callback*/) {
8067
+ var localforageInstance = this;
8068
+ var promise = new Promise(function (resolve, reject) {
8069
+ localforageInstance.ready().then(function () {
8070
+ return getSerializerPromise(localforageInstance);
8071
+ }).then(function (serializer) {
8072
+ var dbInfo = localforageInstance._dbInfo;
8073
+ dbInfo.db.transaction(function (t) {
8073
8074
 
8074
- // Check to see if this is serialized content we need to
8075
- // unpack.
8076
- if (value) {
8077
- value = serializer.deserialize(value);
8078
- }
8075
+ var queryParts = new Array(keys.length);
8076
+ for (var i = 0, len = keys.length; i < len; i++) {
8077
+ queryParts[i] = '?';
8078
+ }
8079
8079
 
8080
- result[item.key] = value;
8081
- }
8080
+ t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE (key IN (' + queryParts.join(',') + '))', keys, function (t, results) {
8082
8081
 
8083
- resolve(result);
8084
- }, function (t, error) {
8085
- reject(error);
8086
- });
8087
- });
8088
- }).catch(reject);
8089
- });
8090
- return promise;
8091
- }
8082
+ var result = {};
8092
8083
 
8093
- function localforageGetItems(keys, callback) {
8094
- var localforageInstance = this;
8084
+ var rows = results.rows;
8085
+ for (var i = 0, len = rows.length; i < len; i++) {
8086
+ var item = rows.item(i);
8087
+ var value = item.value;
8095
8088
 
8096
- var promise;
8097
- if (!arguments.length || keys === null) {
8098
- promise = getAllItemsUsingIterate.apply(localforageInstance);
8099
- } else {
8100
- var currentDriver = localforageInstance.driver();
8101
- if (currentDriver === localforageInstance.INDEXEDDB) {
8102
- promise = getItemsIndexedDB.apply(localforageInstance, arguments);
8103
- } else if (currentDriver === localforageInstance.WEBSQL) {
8104
- promise = getItemsWebsql.apply(localforageInstance, arguments);
8105
- } else {
8106
- promise = getItemsGeneric.apply(localforageInstance, arguments);
8107
- }
8108
- }
8089
+ // Check to see if this is serialized content we need to
8090
+ // unpack.
8091
+ if (value) {
8092
+ value = serializer.deserialize(value);
8093
+ }
8109
8094
 
8110
- executeCallback(promise, callback);
8111
- return promise;
8112
- }
8095
+ result[item.key] = value;
8096
+ }
8113
8097
 
8114
- function extendPrototype(localforage$$1) {
8115
- var localforagePrototype = Object.getPrototypeOf(localforage$$1);
8116
- if (localforagePrototype) {
8117
- localforagePrototype.getItems = localforageGetItems;
8118
- localforagePrototype.getItems.indexedDB = function () {
8119
- return getItemsIndexedDB.apply(this, arguments);
8120
- };
8121
- localforagePrototype.getItems.websql = function () {
8122
- return getItemsWebsql.apply(this, arguments);
8123
- };
8124
- localforagePrototype.getItems.generic = function () {
8125
- return getItemsGeneric.apply(this, arguments);
8126
- };
8127
- }
8098
+ resolve(result);
8099
+ }, function (t, error) {
8100
+ reject(error);
8101
+ });
8102
+ });
8103
+ }).catch(reject);
8104
+ });
8105
+ return promise;
8106
+ }
8107
+
8108
+ function localforageGetItems(keys, callback) {
8109
+ var localforageInstance = this;
8110
+
8111
+ var promise;
8112
+ if (!arguments.length || keys === null) {
8113
+ promise = getAllItemsUsingIterate.apply(localforageInstance);
8114
+ } else {
8115
+ var currentDriver = localforageInstance.driver();
8116
+ if (currentDriver === localforageInstance.INDEXEDDB) {
8117
+ promise = getItemsIndexedDB.apply(localforageInstance, arguments);
8118
+ } else if (currentDriver === localforageInstance.WEBSQL) {
8119
+ promise = getItemsWebsql.apply(localforageInstance, arguments);
8120
+ } else {
8121
+ promise = getItemsGeneric.apply(localforageInstance, arguments);
8122
+ }
8123
+ }
8124
+
8125
+ executeCallback(promise, callback);
8126
+ return promise;
8127
+ }
8128
+
8129
+ function extendPrototype(localforage$$1) {
8130
+ var localforagePrototype = Object.getPrototypeOf(localforage$$1);
8131
+ if (localforagePrototype) {
8132
+ localforagePrototype.getItems = localforageGetItems;
8133
+ localforagePrototype.getItems.indexedDB = function () {
8134
+ return getItemsIndexedDB.apply(this, arguments);
8135
+ };
8136
+ localforagePrototype.getItems.websql = function () {
8137
+ return getItemsWebsql.apply(this, arguments);
8138
+ };
8139
+ localforagePrototype.getItems.generic = function () {
8140
+ return getItemsGeneric.apply(this, arguments);
8141
+ };
8142
+ }
8143
+ }
8144
+
8145
+ var extendPrototypeResult = extendPrototype(localforage);
8146
+
8147
+ exports.localforageGetItems = localforageGetItems;
8148
+ exports.extendPrototype = extendPrototype;
8149
+ exports.extendPrototypeResult = extendPrototypeResult;
8150
+ exports.getItemsGeneric = getItemsGeneric;
8151
+
8152
+ Object.defineProperty(exports, '__esModule', { value: true });
8153
+
8154
+ })));
8155
+ } (localforageGetitems$1, localforageGetitems$1.exports));
8156
+ return localforageGetitems$1.exports;
8128
8157
  }
8129
8158
 
8130
- extendPrototype(localForage);
8159
+ var localforageGetitemsExports = requireLocalforageGetitems();
8131
8160
 
8132
8161
  /** Used for built-in method references. */
8133
8162
  var objectProto$7 = Object.prototype;
@@ -8580,7 +8609,7 @@ function sync(method, model, options = {}) {
8580
8609
  const IN_MEMORY = _driver;
8581
8610
  localForage.defineDriver(memoryDriver);
8582
8611
  localforageSetitemsExports.extendPrototype(localForage);
8583
- extendPrototype(localForage);
8612
+ localforageGetitemsExports.extendPrototype(localForage);
8584
8613
  // Every storage instance is registered with a WeakRef so that flushAll() can
8585
8614
  // reach pending writes without keeping instances alive. There's no leak and no
8586
8615
  // lifecycle hook to maintain: an instance is collected once its owning model or
@@ -8770,33 +8799,17 @@ class PersistentStorage {
8770
8799
  caughtError = error instanceof Error ? error : new Error(error?.message ?? String(error));
8771
8800
  }
8772
8801
  }
8773
- if (resp) {
8774
- if (options && options.success) {
8775
- // When storing, we don't pass back the response (which is
8776
- // the set attributes returned from localforage because
8777
- // Skeletor sets them again on the model and due to the async
8778
- // nature of localforage it can cause stale attributes to be
8779
- // set on a model after it's been updated in the meantime.
8780
- const data = method === 'read' ? resp : null;
8781
- options.success(data, options);
8782
- }
8783
- }
8784
- else if (method === 'read' && !caughtError) {
8785
- // A read that finds no record is a normal empty result (first run /
8786
- // empty storage), not an error. Resolve with `null` so the callback
8787
- // and promise forms of fetch() agree and a first-run read never
8788
- // rejects.
8789
- if (options && options.success) {
8790
- options.success(null, options);
8791
- }
8802
+ if (caughtError) {
8803
+ options?.error?.(caughtError);
8792
8804
  }
8793
- else {
8794
- // A genuine failure (storage threw, or a write produced no result):
8795
- // surface a real Error so consumers get a stack and `instanceof Error`
8796
- // holds.
8797
- if (options && options.error) {
8798
- options.error(caughtError ?? new Error('Record Not Found'));
8799
- }
8805
+ else if (options?.success) {
8806
+ // When storing, we don't pass back the response (which is the set
8807
+ // attributes returned from localforage) because Skeletor sets them
8808
+ // again on the model and due to the async nature of localforage it can
8809
+ // cause stale attributes to be set on a model after it's been updated
8810
+ // in the meantime.
8811
+ const data = method === 'read' ? (resp ?? null) : null;
8812
+ options.success(data, options);
8800
8813
  }
8801
8814
  }
8802
8815
  localSync.__name__ = 'localSync';