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) :
@@ -77,7 +77,7 @@
77
77
  function _createForOfIteratorHelper(r, e) {
78
78
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
79
79
  if (!t) {
80
- if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e ) {
80
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) {
81
81
  t && (r = t);
82
82
  var n = 0,
83
83
  F = function () {};
@@ -3204,6 +3204,14 @@
3204
3204
  * @typedef {any} AnyValue
3205
3205
  */
3206
3206
 
3207
+ /**
3208
+ * @type {{
3209
+ * [key: string]: {
3210
+ * encode: (param: any, inArray?: boolean) => string,
3211
+ * decode: (param: string, inArray?: boolean) => any
3212
+ * }
3213
+ * }}
3214
+ */
3207
3215
  var types = {
3208
3216
  invalid: {
3209
3217
  /**
@@ -4114,7 +4122,6 @@
4114
4122
  return null;
4115
4123
  }
4116
4124
  // array, date, number, string, binary (should already have detected "invalid")
4117
- // @ts-expect-error Argument may be ignored
4118
4125
  return types[getKeyType(key)].encode(key, inArray);
4119
4126
  }
4120
4127
 
@@ -5669,7 +5676,7 @@
5669
5676
  if ("object" != _typeof$2(e) || null === e) return e;
5670
5677
  var r = e[Symbol.toPrimitive];
5671
5678
  if (void 0 !== r) {
5672
- var n = r.call(e, t );
5679
+ var n = r.call(e, t);
5673
5680
  if ("object" != _typeof$2(n)) return n;
5674
5681
  throw new TypeError("@@toPrimitive must return a primitive value.");
5675
5682
  }
@@ -5725,7 +5732,7 @@
5725
5732
  var t = Object.hasOwn,
5726
5733
  r = Object.getPrototypeOf;
5727
5734
  function isThenable(e, t) {
5728
- return isObject(e) && "function" == typeof e.then && (!t );
5735
+ return isObject(e) && "function" == typeof e.then && (!t);
5729
5736
  }
5730
5737
  function toStringTag(e) {
5731
5738
  return Object.prototype.toString.call(e).slice(8, -1);
@@ -9347,6 +9354,8 @@
9347
9354
  function IDBDatabase() {
9348
9355
  this.__versionTransaction = null;
9349
9356
  this.__objectStores = null;
9357
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9358
+ this.__transactions = [];
9350
9359
  throw new TypeError('Illegal constructor');
9351
9360
  }
9352
9361
  var IDBDatabaseAlias = IDBDatabase;
@@ -9410,6 +9419,8 @@
9410
9419
  this.__setOptions({
9411
9420
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
9412
9421
  });
9422
+
9423
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
9413
9424
  this.__transactions = [];
9414
9425
 
9415
9426
  /** @type {{[key: string]: IDBObjectStore}} */
@@ -9539,6 +9550,7 @@
9539
9550
  if (this.__unblocking) {
9540
9551
  this.__unblocking.check();
9541
9552
  }
9553
+ this.__transactions = [];
9542
9554
  };
9543
9555
 
9544
9556
  /**
@@ -9637,6 +9649,7 @@
9637
9649
  };
9638
9650
  trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
9639
9651
  });
9652
+ me.__transactions = [];
9640
9653
  };
9641
9654
  defineOuterInterface(IDBDatabase.prototype, listeners);
9642
9655
  defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
@@ -10244,6 +10257,10 @@
10244
10257
 
10245
10258
  // eslint-disable-next-line camelcase -- Clear API
10246
10259
  req.transaction.on__complete = function () {
10260
+ var pos = connection.__transactions.indexOf(req.transaction);
10261
+ if (pos > -1) {
10262
+ connection.__transactions.splice(pos, 1);
10263
+ }
10247
10264
  if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
10248
10265
  req.__transaction = null;
10249
10266
  var err = createDOMException('AbortError', 'The connection has been closed.');
@@ -10626,9 +10643,10 @@
10626
10643
  conn.__forceClose(msg);
10627
10644
  }
10628
10645
  if (isNullish(dbName)) {
10629
- Object.values(me.__connections).forEach(function (conn) {
10630
- // @ts-expect-error It's ok
10631
- forceClose(conn);
10646
+ Object.values(me.__connections).forEach(function (connections) {
10647
+ connections.forEach(function (connection) {
10648
+ forceClose(connection);
10649
+ });
10632
10650
  });
10633
10651
  } else if (!me.__connections[dbName]) {
10634
10652
  console.log('No database connections with that name to force close');
@@ -10637,7 +10655,7 @@
10637
10655
  forceClose(conn);
10638
10656
  });
10639
10657
  } else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
10640
- throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to lose');
10658
+ throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
10641
10659
  } else {
10642
10660
  forceClose(me.__connections[dbName][connIdx]);
10643
10661
  }