indexeddbshim 15.0.0 → 15.0.1

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,4 +1,4 @@
1
- /*! indexeddbshim - v14.0.0 - 7/16/2024 */
1
+ /*! indexeddbshim - v15.0.0 - 8/3/2024 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -72,7 +72,7 @@
72
72
  function _createForOfIteratorHelper(r, e) {
73
73
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
74
74
  if (!t) {
75
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e ) {
75
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) {
76
76
  t && (r = t);
77
77
  var n = 0,
78
78
  F = function () {};
@@ -3199,6 +3199,14 @@
3199
3199
  * @typedef {any} AnyValue
3200
3200
  */
3201
3201
 
3202
+ /**
3203
+ * @type {{
3204
+ * [key: string]: {
3205
+ * encode: (param: any, inArray?: boolean) => string,
3206
+ * decode: (param: string, inArray?: boolean) => any
3207
+ * }
3208
+ * }}
3209
+ */
3202
3210
  var types = {
3203
3211
  invalid: {
3204
3212
  /**
@@ -4109,7 +4117,6 @@
4109
4117
  return null;
4110
4118
  }
4111
4119
  // array, date, number, string, binary (should already have detected "invalid")
4112
- // @ts-expect-error Argument may be ignored
4113
4120
  return types[getKeyType(key)].encode(key, inArray);
4114
4121
  }
4115
4122
 
@@ -5664,7 +5671,7 @@
5664
5671
  if ("object" != _typeof$2(e) || null === e) return e;
5665
5672
  var r = e[Symbol.toPrimitive];
5666
5673
  if (void 0 !== r) {
5667
- var n = r.call(e, t );
5674
+ var n = r.call(e, t);
5668
5675
  if ("object" != _typeof$2(n)) return n;
5669
5676
  throw new TypeError("@@toPrimitive must return a primitive value.");
5670
5677
  }
@@ -5720,7 +5727,7 @@
5720
5727
  var t = Object.hasOwn,
5721
5728
  r = Object.getPrototypeOf;
5722
5729
  function isThenable(e, t) {
5723
- return isObject(e) && "function" == typeof e.then && (!t );
5730
+ return isObject(e) && "function" == typeof e.then && (!t);
5724
5731
  }
5725
5732
  function toStringTag(e) {
5726
5733
  return Object.prototype.toString.call(e).slice(8, -1);
@@ -9342,6 +9349,8 @@
9342
9349
  function IDBDatabase() {
9343
9350
  this.__versionTransaction = null;
9344
9351
  this.__objectStores = null;
9352
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9353
+ this.__transactions = [];
9345
9354
  throw new TypeError('Illegal constructor');
9346
9355
  }
9347
9356
  var IDBDatabaseAlias = IDBDatabase;
@@ -9405,6 +9414,8 @@
9405
9414
  this.__setOptions({
9406
9415
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
9407
9416
  });
9417
+
9418
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9408
9419
  this.__transactions = [];
9409
9420
 
9410
9421
  /** @type {{[key: string]: IDBObjectStore}} */
@@ -9534,6 +9545,7 @@
9534
9545
  if (this.__unblocking) {
9535
9546
  this.__unblocking.check();
9536
9547
  }
9548
+ this.__transactions = [];
9537
9549
  };
9538
9550
 
9539
9551
  /**
@@ -9632,6 +9644,7 @@
9632
9644
  };
9633
9645
  trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
9634
9646
  });
9647
+ me.__transactions = [];
9635
9648
  };
9636
9649
  defineOuterInterface(IDBDatabase.prototype, listeners);
9637
9650
  defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
@@ -10239,6 +10252,10 @@
10239
10252
 
10240
10253
  // eslint-disable-next-line camelcase -- Clear API
10241
10254
  req.transaction.on__complete = function () {
10255
+ var pos = connection.__transactions.indexOf(req.transaction);
10256
+ if (pos > -1) {
10257
+ connection.__transactions.splice(pos, 1);
10258
+ }
10242
10259
  if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
10243
10260
  req.__transaction = null;
10244
10261
  var err = createDOMException('AbortError', 'The connection has been closed.');
@@ -10621,9 +10638,10 @@
10621
10638
  conn.__forceClose(msg);
10622
10639
  }
10623
10640
  if (isNullish(dbName)) {
10624
- Object.values(me.__connections).forEach(function (conn) {
10625
- // @ts-expect-error It's ok
10626
- forceClose(conn);
10641
+ Object.values(me.__connections).forEach(function (connections) {
10642
+ connections.forEach(function (connection) {
10643
+ forceClose(connection);
10644
+ });
10627
10645
  });
10628
10646
  } else if (!me.__connections[dbName]) {
10629
10647
  console.log('No database connections with that name to force close');
@@ -10632,7 +10650,7 @@
10632
10650
  forceClose(conn);
10633
10651
  });
10634
10652
  } else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
10635
- throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to lose');
10653
+ throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
10636
10654
  } else {
10637
10655
  forceClose(me.__connections[dbName][connIdx]);
10638
10656
  }