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 (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -65,7 +65,7 @@
65
65
  function _createForOfIteratorHelper(r, e) {
66
66
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
67
67
  if (!t) {
68
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e ) {
68
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) {
69
69
  t && (r = t);
70
70
  var n = 0,
71
71
  F = function () {};
@@ -3192,6 +3192,14 @@
3192
3192
  * @typedef {any} AnyValue
3193
3193
  */
3194
3194
 
3195
+ /**
3196
+ * @type {{
3197
+ * [key: string]: {
3198
+ * encode: (param: any, inArray?: boolean) => string,
3199
+ * decode: (param: string, inArray?: boolean) => any
3200
+ * }
3201
+ * }}
3202
+ */
3195
3203
  var types = {
3196
3204
  invalid: {
3197
3205
  /**
@@ -4102,7 +4110,6 @@
4102
4110
  return null;
4103
4111
  }
4104
4112
  // array, date, number, string, binary (should already have detected "invalid")
4105
- // @ts-expect-error Argument may be ignored
4106
4113
  return types[getKeyType(key)].encode(key, inArray);
4107
4114
  }
4108
4115
 
@@ -5657,7 +5664,7 @@
5657
5664
  if ("object" != _typeof$2(e) || null === e) return e;
5658
5665
  var r = e[Symbol.toPrimitive];
5659
5666
  if (void 0 !== r) {
5660
- var n = r.call(e, t );
5667
+ var n = r.call(e, t);
5661
5668
  if ("object" != _typeof$2(n)) return n;
5662
5669
  throw new TypeError("@@toPrimitive must return a primitive value.");
5663
5670
  }
@@ -5713,7 +5720,7 @@
5713
5720
  var t = Object.hasOwn,
5714
5721
  r = Object.getPrototypeOf;
5715
5722
  function isThenable(e, t) {
5716
- return isObject(e) && "function" == typeof e.then && (!t );
5723
+ return isObject(e) && "function" == typeof e.then && (!t);
5717
5724
  }
5718
5725
  function toStringTag(e) {
5719
5726
  return Object.prototype.toString.call(e).slice(8, -1);
@@ -9335,6 +9342,8 @@
9335
9342
  function IDBDatabase() {
9336
9343
  this.__versionTransaction = null;
9337
9344
  this.__objectStores = null;
9345
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9346
+ this.__transactions = [];
9338
9347
  throw new TypeError('Illegal constructor');
9339
9348
  }
9340
9349
  var IDBDatabaseAlias = IDBDatabase;
@@ -9398,6 +9407,8 @@
9398
9407
  this.__setOptions({
9399
9408
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
9400
9409
  });
9410
+
9411
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9401
9412
  this.__transactions = [];
9402
9413
 
9403
9414
  /** @type {{[key: string]: IDBObjectStore}} */
@@ -9527,6 +9538,7 @@
9527
9538
  if (this.__unblocking) {
9528
9539
  this.__unblocking.check();
9529
9540
  }
9541
+ this.__transactions = [];
9530
9542
  };
9531
9543
 
9532
9544
  /**
@@ -9625,6 +9637,7 @@
9625
9637
  };
9626
9638
  trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
9627
9639
  });
9640
+ me.__transactions = [];
9628
9641
  };
9629
9642
  defineOuterInterface(IDBDatabase.prototype, listeners);
9630
9643
  defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
@@ -10232,6 +10245,10 @@
10232
10245
 
10233
10246
  // eslint-disable-next-line camelcase -- Clear API
10234
10247
  req.transaction.on__complete = function () {
10248
+ var pos = connection.__transactions.indexOf(req.transaction);
10249
+ if (pos > -1) {
10250
+ connection.__transactions.splice(pos, 1);
10251
+ }
10235
10252
  if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
10236
10253
  req.__transaction = null;
10237
10254
  var err = createDOMException('AbortError', 'The connection has been closed.');
@@ -10614,9 +10631,10 @@
10614
10631
  conn.__forceClose(msg);
10615
10632
  }
10616
10633
  if (isNullish(dbName)) {
10617
- Object.values(me.__connections).forEach(function (conn) {
10618
- // @ts-expect-error It's ok
10619
- forceClose(conn);
10634
+ Object.values(me.__connections).forEach(function (connections) {
10635
+ connections.forEach(function (connection) {
10636
+ forceClose(connection);
10637
+ });
10620
10638
  });
10621
10639
  } else if (!me.__connections[dbName]) {
10622
10640
  console.log('No database connections with that name to force close');
@@ -10625,7 +10643,7 @@
10625
10643
  forceClose(conn);
10626
10644
  });
10627
10645
  } else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
10628
- throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to lose');
10646
+ throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
10629
10647
  } else {
10630
10648
  forceClose(me.__connections[dbName][connIdx]);
10631
10649
  }