indexeddbshim 8.0.0 → 9.0.0

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.
@@ -1,23 +1,18 @@
1
- /*! indexeddbshim - v7.1.0 - 6/15/2021 */
1
+ /*! indexeddbshim - v9.0.0 - 1/5/2022 */
2
2
 
3
3
  (function (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
5
5
  factory();
6
- }((function () { 'use strict';
6
+ })((function () { 'use strict';
7
7
 
8
8
  function ownKeys(object, enumerableOnly) {
9
9
  var keys = Object.keys(object);
10
10
 
11
11
  if (Object.getOwnPropertySymbols) {
12
12
  var symbols = Object.getOwnPropertySymbols(object);
13
-
14
- if (enumerableOnly) {
15
- symbols = symbols.filter(function (sym) {
16
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
17
- });
18
- }
19
-
20
- keys.push.apply(keys, symbols);
13
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
14
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
15
+ })), keys.push.apply(keys, symbols);
21
16
  }
22
17
 
23
18
  return keys;
@@ -25,19 +20,12 @@
25
20
 
26
21
  function _objectSpread2(target) {
27
22
  for (var i = 1; i < arguments.length; i++) {
28
- var source = arguments[i] != null ? arguments[i] : {};
29
-
30
- if (i % 2) {
31
- ownKeys(Object(source), true).forEach(function (key) {
32
- _defineProperty(target, key, source[key]);
33
- });
34
- } else if (Object.getOwnPropertyDescriptors) {
35
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
36
- } else {
37
- ownKeys(Object(source)).forEach(function (key) {
38
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39
- });
40
- }
23
+ var source = null != arguments[i] ? arguments[i] : {};
24
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
25
+ _defineProperty(target, key, source[key]);
26
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
27
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
28
+ });
41
29
  }
42
30
 
43
31
  return target;
@@ -46,17 +34,11 @@
46
34
  function _typeof$1(obj) {
47
35
  "@babel/helpers - typeof";
48
36
 
49
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
50
- _typeof$1 = function (obj) {
51
- return typeof obj;
52
- };
53
- } else {
54
- _typeof$1 = function (obj) {
55
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
56
- };
57
- }
58
-
59
- return _typeof$1(obj);
37
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
38
+ return typeof obj;
39
+ } : function (obj) {
40
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
41
+ }, _typeof$1(obj);
60
42
  }
61
43
 
62
44
  function _classCallCheck(instance, Constructor) {
@@ -78,6 +60,9 @@
78
60
  function _createClass(Constructor, protoProps, staticProps) {
79
61
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
80
62
  if (staticProps) _defineProperties(Constructor, staticProps);
63
+ Object.defineProperty(Constructor, "prototype", {
64
+ writable: false
65
+ });
81
66
  return Constructor;
82
67
  }
83
68
 
@@ -1218,10 +1203,10 @@
1218
1203
  // Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
1219
1204
  // but Chrome having problems
1220
1205
  if (unmatchedHighSurrogate) {
1221
- return '^2' + unmatchedHighSurrogate.charCodeAt().toString(16).padStart(4, '0');
1206
+ return '^2' + unmatchedHighSurrogate.codePointAt().toString(16).padStart(4, '0');
1222
1207
  }
1223
1208
 
1224
- return (precedingLow || '') + '^3' + unmatchedLowSurrogate.charCodeAt().toString(16).padStart(4, '0');
1209
+ return (precedingLow || '') + '^3' + unmatchedLowSurrogate.codePointAt().toString(16).padStart(4, '0');
1225
1210
  });
1226
1211
  }
1227
1212
 
@@ -1281,6 +1266,7 @@
1281
1266
  if (CFG.databaseCharacterEscapeList !== false) {
1282
1267
  db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\0-\x1F"\*\/:<>\?\\\|\x7F]/g, // eslint-disable-line no-control-regex
1283
1268
  function (n0) {
1269
+ // eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
1284
1270
  return '^1' + n0.charCodeAt().toString(16).padStart(2, '0');
1285
1271
  });
1286
1272
  }
@@ -1296,9 +1282,9 @@
1296
1282
 
1297
1283
  function unescapeUnmatchedSurrogates(arg) {
1298
1284
  return arg.replace(/(\^+)3(d[0-9a-f]{3})/g, function (_, esc, lowSurr) {
1299
- return esc.length % 2 ? esc.slice(1) + String.fromCharCode(Number.parseInt(lowSurr, 16)) : _;
1285
+ return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(lowSurr, 16)) : _;
1300
1286
  }).replace(/(\^+)2(d[0-9a-f]{3})/g, function (_, esc, highSurr) {
1301
- return esc.length % 2 ? esc.slice(1) + String.fromCharCode(Number.parseInt(highSurr, 16)) : _;
1287
+ return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(highSurr, 16)) : _;
1302
1288
  });
1303
1289
  } // Not in use internally but supplied for convenience
1304
1290
 
@@ -1923,6 +1909,8 @@
1923
1909
 
1924
1910
 
1925
1911
  IDBRequest.__super = function IDBRequest() {
1912
+ var _this = this;
1913
+
1926
1914
  this[Symbol.toStringTag] = 'IDBRequest';
1927
1915
 
1928
1916
  this.__setOptions({
@@ -1931,12 +1919,12 @@
1931
1919
  });
1932
1920
 
1933
1921
  doneFlagGetters.forEach(function (prop) {
1934
- Object.defineProperty(this, '__' + prop, {
1922
+ Object.defineProperty(_this, '__' + prop, {
1935
1923
  enumerable: false,
1936
1924
  configurable: false,
1937
1925
  writable: true
1938
1926
  });
1939
- Object.defineProperty(this, prop, {
1927
+ Object.defineProperty(_this, prop, {
1940
1928
  enumerable: true,
1941
1929
  configurable: true,
1942
1930
  get: function get() {
@@ -1947,7 +1935,7 @@
1947
1935
  return this['__' + prop];
1948
1936
  }
1949
1937
  });
1950
- }, this);
1938
+ });
1951
1939
  defineReadonlyProperties(this, readonlyProperties$5, {
1952
1940
  readyState: {
1953
1941
  get readyState() {
@@ -2269,7 +2257,7 @@
2269
2257
  };
2270
2258
  var keyTypes = Object.keys(keyTypeToEncodedChar);
2271
2259
  keyTypes.forEach(function (k) {
2272
- keyTypeToEncodedChar[k] = String.fromCharCode(keyTypeToEncodedChar[k]);
2260
+ keyTypeToEncodedChar[k] = String.fromCodePoint(keyTypeToEncodedChar[k]);
2273
2261
  });
2274
2262
  var encodedCharToKeyType = keyTypes.reduce(function (o, k) {
2275
2263
  o[keyTypeToEncodedChar[k]] = k;
@@ -3751,11 +3739,11 @@
3751
3739
  return this._items;
3752
3740
  },
3753
3741
  forEach: function forEach(cb, thisArg) {
3754
- // eslint-disable-next-line unicorn/no-array-callback-reference
3742
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
3755
3743
  this._items.forEach(cb, thisArg);
3756
3744
  },
3757
3745
  map: function map(cb, thisArg) {
3758
- // eslint-disable-next-line unicorn/no-array-callback-reference
3746
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
3759
3747
  return this._items.map(cb, thisArg);
3760
3748
  },
3761
3749
  indexOf: function indexOf(str) {
@@ -3767,9 +3755,7 @@
3767
3755
  this._length++;
3768
3756
  this.sortList();
3769
3757
  },
3770
- splice: function splice()
3771
- /* index, howmany, item1, ..., itemX */
3772
- {
3758
+ splice: function splice() {
3773
3759
  var _this$_items;
3774
3760
 
3775
3761
  (_this$_items = this._items).splice.apply(_this$_items, arguments);
@@ -3988,9 +3974,7 @@
3988
3974
  executeNextRequest();
3989
3975
  }
3990
3976
 
3991
- function error()
3992
- /* tx, err */
3993
- {
3977
+ function error() {
3994
3978
  if (me.__errored || me.__requestsFinished) {
3995
3979
  // We've already called "onerror", "onabort", or thrown within
3996
3980
  // the transaction, so don't do it again.
@@ -4316,8 +4300,8 @@
4316
4300
  // Store was already created so we restore to name before the rename
4317
4301
  if ('__pendingName' in store && me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
4318
4302
  ) {
4319
- store.__name = store.__originalName;
4320
- }
4303
+ store.__name = store.__originalName;
4304
+ }
4321
4305
 
4322
4306
  store.__indexNames = store.__oldIndexNames;
4323
4307
  delete store.__pendingDelete;
@@ -4325,8 +4309,8 @@
4325
4309
  // Index was already created so we restore to name before the rename
4326
4310
  if ('__pendingName' in index && store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
4327
4311
  ) {
4328
- index.__name = index.__originalName;
4329
- }
4312
+ index.__name = index.__originalName;
4313
+ }
4330
4314
 
4331
4315
  delete index.__pendingDelete;
4332
4316
  });
@@ -6944,7 +6928,7 @@
6944
6928
  /**
6945
6929
  * `FileList` polyfill.
6946
6930
  */
6947
- var FileList = /*#__PURE__*/function () {
6931
+ var FileList = /*#__PURE__*/function (_Symbol$toStringTag) {
6948
6932
  /**
6949
6933
  * Set private properties and length.
6950
6934
  */
@@ -6973,7 +6957,7 @@
6973
6957
  */
6974
6958
 
6975
6959
  }, {
6976
- key: Symbol.toStringTag,
6960
+ key: _Symbol$toStringTag,
6977
6961
  get: function get() {
6978
6962
  /* eslint-enable class-methods-use-this */
6979
6963
  return 'FileList';
@@ -6981,7 +6965,7 @@
6981
6965
  }]);
6982
6966
 
6983
6967
  return FileList;
6984
- }();
6968
+ }(Symbol.toStringTag);
6985
6969
 
6986
6970
  return new FileList(o);
6987
6971
  }
@@ -8117,9 +8101,9 @@
8117
8101
  */
8118
8102
 
8119
8103
 
8120
- IDBIndex.prototype.openCursor = function ()
8121
- /* query, direction */
8122
- {
8104
+ IDBIndex.prototype.openCursor = function
8105
+ /* query, direction */
8106
+ () {
8123
8107
  /* eslint-enable jsdoc/check-param-names */
8124
8108
  var me = this; // eslint-disable-next-line prefer-rest-params
8125
8109
 
@@ -8143,9 +8127,9 @@
8143
8127
  */
8144
8128
 
8145
8129
 
8146
- IDBIndex.prototype.openKeyCursor = function ()
8147
- /* query, direction */
8148
- {
8130
+ IDBIndex.prototype.openKeyCursor = function
8131
+ /* query, direction */
8132
+ () {
8149
8133
  /* eslint-enable jsdoc/check-param-names */
8150
8134
  var me = this; // eslint-disable-next-line prefer-rest-params
8151
8135
 
@@ -8178,9 +8162,9 @@
8178
8162
  return this.__fetchIndexData(query, 'key', true);
8179
8163
  };
8180
8164
 
8181
- IDBIndex.prototype.getAll = function ()
8182
- /* query, count */
8183
- {
8165
+ IDBIndex.prototype.getAll = function
8166
+ /* query, count */
8167
+ () {
8184
8168
  // eslint-disable-next-line prefer-rest-params
8185
8169
  var _arguments3 = Array.prototype.slice.call(arguments),
8186
8170
  query = _arguments3[0],
@@ -8189,9 +8173,9 @@
8189
8173
  return this.__fetchIndexData(query, 'value', false, count);
8190
8174
  };
8191
8175
 
8192
- IDBIndex.prototype.getAllKeys = function ()
8193
- /* query, count */
8194
- {
8176
+ IDBIndex.prototype.getAllKeys = function
8177
+ /* query, count */
8178
+ () {
8195
8179
  // eslint-disable-next-line prefer-rest-params
8196
8180
  var _arguments4 = Array.prototype.slice.call(arguments),
8197
8181
  query = _arguments4[0],
@@ -8200,9 +8184,9 @@
8200
8184
  return this.__fetchIndexData(query, 'key', false, count);
8201
8185
  };
8202
8186
 
8203
- IDBIndex.prototype.count = function ()
8204
- /* query */
8205
- {
8187
+ IDBIndex.prototype.count = function
8188
+ /* query */
8189
+ () {
8206
8190
  var me = this; // eslint-disable-next-line prefer-rest-params
8207
8191
 
8208
8192
  var query = arguments[0]; // With the exception of needing to check whether the index has been
@@ -9154,9 +9138,9 @@
9154
9138
  return this.__get(query, true);
9155
9139
  };
9156
9140
 
9157
- IDBObjectStore.prototype.getAll = function ()
9158
- /* query, count */
9159
- {
9141
+ IDBObjectStore.prototype.getAll = function
9142
+ /* query, count */
9143
+ () {
9160
9144
  // eslint-disable-next-line prefer-rest-params
9161
9145
  var _arguments = Array.prototype.slice.call(arguments),
9162
9146
  query = _arguments[0],
@@ -9165,9 +9149,9 @@
9165
9149
  return this.__get(query, false, true, count);
9166
9150
  };
9167
9151
 
9168
- IDBObjectStore.prototype.getAllKeys = function ()
9169
- /* query, count */
9170
- {
9152
+ IDBObjectStore.prototype.getAllKeys = function
9153
+ /* query, count */
9154
+ () {
9171
9155
  // eslint-disable-next-line prefer-rest-params
9172
9156
  var _arguments2 = Array.prototype.slice.call(arguments),
9173
9157
  query = _arguments2[0],
@@ -9244,9 +9228,9 @@
9244
9228
  }, undefined, me);
9245
9229
  };
9246
9230
 
9247
- IDBObjectStore.prototype.count = function ()
9248
- /* query */
9249
- {
9231
+ IDBObjectStore.prototype.count = function
9232
+ /* query */
9233
+ () {
9250
9234
  var me = this; // eslint-disable-next-line prefer-rest-params
9251
9235
 
9252
9236
  var query = arguments[0];
@@ -9263,9 +9247,9 @@
9263
9247
  return IDBCursorWithValue.__createInstance(query, 'next', me, me, 'key', 'value', true).__request;
9264
9248
  };
9265
9249
 
9266
- IDBObjectStore.prototype.openCursor = function ()
9267
- /* query, direction */
9268
- {
9250
+ IDBObjectStore.prototype.openCursor = function
9251
+ /* query, direction */
9252
+ () {
9269
9253
  var me = this; // eslint-disable-next-line prefer-rest-params
9270
9254
 
9271
9255
  var _arguments3 = Array.prototype.slice.call(arguments),
@@ -9285,9 +9269,9 @@
9285
9269
  return cursor.__request;
9286
9270
  };
9287
9271
 
9288
- IDBObjectStore.prototype.openKeyCursor = function ()
9289
- /* query, direction */
9290
- {
9272
+ IDBObjectStore.prototype.openKeyCursor = function
9273
+ /* query, direction */
9274
+ () {
9291
9275
  var me = this;
9292
9276
 
9293
9277
  if (!(me instanceof IDBObjectStore)) {
@@ -10313,7 +10297,7 @@
10313
10297
  var escapedDatabaseName; // eslint-disable-next-line no-useless-catch
10314
10298
 
10315
10299
  try {
10316
- escapedDatabaseName = escapeDatabaseNameForSQLAndFiles(name); // eslint-disable-next-line radar/no-useless-catch
10300
+ escapedDatabaseName = escapeDatabaseNameForSQLAndFiles(name); // eslint-disable-next-line sonarjs/no-useless-catch
10317
10301
  } catch (err) {
10318
10302
  throw err; // new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
10319
10303
  }
@@ -10621,7 +10605,7 @@
10621
10605
  var escapedDatabaseName; // eslint-disable-next-line no-useless-catch
10622
10606
 
10623
10607
  try {
10624
- escapedDatabaseName = escapeDatabaseNameForSQLAndFiles(name); // eslint-disable-next-line radar/no-useless-catch
10608
+ escapedDatabaseName = escapeDatabaseNameForSQLAndFiles(name); // eslint-disable-next-line sonarjs/no-useless-catch
10625
10609
  } catch (err) {
10626
10610
  throw err; // throw new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
10627
10611
  }
@@ -10943,9 +10927,7 @@
10943
10927
  return _construct(IDBCursor, args);
10944
10928
  };
10945
10929
 
10946
- IDBCursor.prototype.__find = function ()
10947
- /* key, tx, success, error, recordsToLoad */
10948
- {
10930
+ IDBCursor.prototype.__find = function () {
10949
10931
  if (this.__multiEntryIndex) {
10950
10932
  this.__findMultiEntry.apply(this, arguments);
10951
10933
  } else {
@@ -11357,9 +11339,9 @@
11357
11339
  });
11358
11340
  };
11359
11341
 
11360
- IDBCursor.prototype["continue"] = function ()
11361
- /* key */
11362
- {
11342
+ IDBCursor.prototype["continue"] = function
11343
+ /* key */
11344
+ () {
11363
11345
  // eslint-disable-next-line prefer-rest-params
11364
11346
  this.__continue(arguments[0]);
11365
11347
  };
@@ -11610,7 +11592,6 @@
11610
11592
  var _o, _mutatorMap;
11611
11593
 
11612
11594
  var o = (_o = {}, _mutatorMap = {}, _mutatorMap[name] = _mutatorMap[name] || {}, _mutatorMap[name].get = function () {
11613
- // eslint-disable-next-line unicorn/prefer-prototype-methods
11614
11595
  return propDesc.get.call(this);
11615
11596
  }, _defineEnumerableProperties(_o, _mutatorMap), _o);
11616
11597
  desc = Object.getOwnPropertyDescriptor(o, name);
@@ -11669,7 +11650,6 @@
11669
11650
  var shimIDBFactory = IDBFactory;
11670
11651
 
11671
11652
  if (CFG.win.openDatabase !== undefined) {
11672
- // eslint-disable-next-line unicorn/prefer-prototype-methods
11673
11653
  shimIndexedDB.__openDatabase = CFG.win.openDatabase.bind(CFG.win); // We cache here in case the function is overwritten later as by the IndexedDB support promises tests
11674
11654
  // Polyfill ALL of IndexedDB, using WebSQL
11675
11655
 
@@ -11810,5 +11790,5 @@
11810
11790
 
11811
11791
  setGlobalVars();
11812
11792
 
11813
- })));
11793
+ }));
11814
11794
  //# sourceMappingURL=indexeddbshim.js.map