indexeddbshim 18.0.0 → 19.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.
Files changed (68) hide show
  1. package/dist/DOMException.d.ts +3 -7
  2. package/dist/DOMException.d.ts.map +1 -1
  3. package/dist/DOMStringList.d.ts +1 -2
  4. package/dist/DOMStringList.d.ts.map +1 -1
  5. package/dist/IDBCursor.d.ts +100 -52
  6. package/dist/IDBCursor.d.ts.map +1 -1
  7. package/dist/IDBFactory.d.ts.map +1 -1
  8. package/dist/IDBIndex.d.ts +8 -7
  9. package/dist/IDBIndex.d.ts.map +1 -1
  10. package/dist/IDBKeyRange.d.ts +3 -3
  11. package/dist/IDBKeyRange.d.ts.map +1 -1
  12. package/dist/IDBObjectStore.d.ts +22 -22
  13. package/dist/IDBObjectStore.d.ts.map +1 -1
  14. package/dist/IDBRequest.d.ts +2 -2
  15. package/dist/IDBRequest.d.ts.map +1 -1
  16. package/dist/IDBTransaction.d.ts +13 -13
  17. package/dist/IDBTransaction.d.ts.map +1 -1
  18. package/dist/Key.d.ts +14 -15
  19. package/dist/Key.d.ts.map +1 -1
  20. package/dist/Sca.d.ts +2 -2
  21. package/dist/Sca.d.ts.map +1 -1
  22. package/dist/cmp.d.ts +3 -3
  23. package/dist/cmp.d.ts.map +1 -1
  24. package/dist/indexeddbshim-Key.js +36 -45
  25. package/dist/indexeddbshim-Key.js.map +1 -1
  26. package/dist/indexeddbshim-Key.min.js +2 -2
  27. package/dist/indexeddbshim-Key.min.js.map +1 -1
  28. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +229 -213
  29. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  30. package/dist/indexeddbshim-UnicodeIdentifiers.js +226 -240
  31. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  32. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +3 -3
  33. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  34. package/dist/indexeddbshim-node.cjs +229 -213
  35. package/dist/indexeddbshim-node.cjs.map +1 -1
  36. package/dist/indexeddbshim-noninvasive.js +226 -240
  37. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  38. package/dist/indexeddbshim-noninvasive.min.js +3 -3
  39. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  40. package/dist/indexeddbshim.js +226 -240
  41. package/dist/indexeddbshim.js.map +1 -1
  42. package/dist/indexeddbshim.min.js +3 -3
  43. package/dist/indexeddbshim.min.js.map +1 -1
  44. package/dist/nodeWebSQL.d.ts +2 -2
  45. package/dist/nodeWebSQL.d.ts.map +1 -1
  46. package/dist/setGlobalVars.d.ts +1 -2
  47. package/dist/setGlobalVars.d.ts.map +1 -1
  48. package/dist/util.d.ts +20 -22
  49. package/dist/util.d.ts.map +1 -1
  50. package/package.json +1 -1
  51. package/src/CFG.js +1 -1
  52. package/src/DOMException.js +8 -10
  53. package/src/DOMStringList.js +6 -11
  54. package/src/Event.js +1 -4
  55. package/src/IDBCursor.js +95 -47
  56. package/src/IDBFactory.js +8 -5
  57. package/src/IDBIndex.js +10 -12
  58. package/src/IDBKeyRange.js +6 -5
  59. package/src/IDBObjectStore.js +37 -32
  60. package/src/IDBRequest.js +1 -1
  61. package/src/IDBTransaction.js +11 -11
  62. package/src/IDBVersionChangeEvent.js +1 -4
  63. package/src/Key.js +32 -31
  64. package/src/Sca.js +1 -1
  65. package/src/cmp.js +2 -2
  66. package/src/nodeWebSQL.js +5 -2
  67. package/src/setGlobalVars.js +8 -19
  68. package/src/util.js +19 -16
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v18.0.0 - 9/3/2026 */
1
+ /*! indexeddbshim - v19.0.1 - 9/3/2026 */
2
2
 
3
3
  (function (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -51,13 +51,6 @@
51
51
  function _classCallCheck(a, n) {
52
52
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
53
53
  }
54
- function _construct(t, e, r) {
55
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
56
- var o = [null];
57
- o.push.apply(o, e);
58
- var p = new (t.bind.apply(t, o))();
59
- return p;
60
- }
61
54
  function _defineProperties(e, r) {
62
55
  for (var t = 0; t < r.length; t++) {
63
56
  var o = r[t];
@@ -1925,7 +1918,7 @@
1925
1918
  // Callback not used by default
1926
1919
  // Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
1927
1920
  'escapeNULForSQLiteStatements', 'sqlMemoryQuota', 'createIndexes'].forEach(function (prop) {
1928
- /** @type {(val: any) => void} */
1921
+ /** @type {(val: ConfigValue) => void} */
1929
1922
  var validator;
1930
1923
  if (Array.isArray(prop)) {
1931
1924
  var _prop = prop;
@@ -2146,9 +2139,11 @@
2146
2139
  return base.replace(/[\/\\]+$/, '') + sep + name;
2147
2140
  }
2148
2141
 
2142
+ /* eslint-disable jsdoc/valid-types -- Bug */
2149
2143
  /**
2150
- * @typedef {Function} AnyClass
2144
+ * @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
2151
2145
  */
2146
+ /* eslint-enable jsdoc/valid-types -- Bug */
2152
2147
 
2153
2148
  // Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
2154
2149
  /**
@@ -2172,7 +2167,7 @@
2172
2167
 
2173
2168
  /**
2174
2169
  *
2175
- * @param {object} obj
2170
+ * @param {AnyValue} obj
2176
2171
  * @returns {boolean}
2177
2172
  */
2178
2173
  function isDate(obj) {
@@ -2181,7 +2176,7 @@
2181
2176
 
2182
2177
  /**
2183
2178
  *
2184
- * @param {object} obj
2179
+ * @param {AnyValue} obj
2185
2180
  * @returns {boolean}
2186
2181
  */
2187
2182
  function isBlob(obj) {
@@ -2190,7 +2185,7 @@
2190
2185
 
2191
2186
  /**
2192
2187
  *
2193
- * @param {object} obj
2188
+ * @param {AnyValue} obj
2194
2189
  * @returns {boolean}
2195
2190
  */
2196
2191
  function isFile(obj) {
@@ -2212,7 +2207,7 @@
2212
2207
  /**
2213
2208
  *
2214
2209
  * @param {AnyValue} obj
2215
- * @returns {boolean}
2210
+ * @returns {obj is Iterable<unknown>}
2216
2211
  */
2217
2212
  function isIterable(obj) {
2218
2213
  return isObj(obj) &&
@@ -2258,9 +2253,7 @@
2258
2253
 
2259
2254
  /**
2260
2255
  *
2261
- * @param {object & {
2262
- * [key: string]: any
2263
- * }} obj
2256
+ * @param {object} obj
2264
2257
  * @param {string[]} listeners
2265
2258
  * @returns {void}
2266
2259
  */
@@ -2268,9 +2261,9 @@
2268
2261
  listeners = typeof listeners === 'string' ? [listeners] : listeners;
2269
2262
  listeners.forEach(function (listener) {
2270
2263
  var o = _defineAccessor("set", _defineAccessor("get", {}, listener, function () {
2271
- return obj['__' + listener];
2264
+ return Reflect.get(obj, '__' + listener);
2272
2265
  }), listener, function (val) {
2273
- obj['__' + listener] = val;
2266
+ Reflect.set(obj, '__' + listener, val);
2274
2267
  });
2275
2268
  var desc = /** @type {PropertyDescriptor} */
2276
2269
  Object.getOwnPropertyDescriptor(o, listener);
@@ -2279,7 +2272,7 @@
2279
2272
  Object.defineProperty(obj, listener, desc);
2280
2273
  });
2281
2274
  listeners.forEach(function (l) {
2282
- obj[l] = null;
2275
+ Reflect.set(obj, l, null);
2283
2276
  });
2284
2277
  }
2285
2278
 
@@ -2288,7 +2281,7 @@
2288
2281
  * @param {object} obj
2289
2282
  * @param {string|string[]} props
2290
2283
  * @param {null|{
2291
- * [key: string]: any
2284
+ * [key: string]: unknown
2292
2285
  * }} getter
2293
2286
  * @returns {void}
2294
2287
  */
@@ -2424,7 +2417,7 @@
2424
2417
  }
2425
2418
 
2426
2419
  /**
2427
- * @typedef {any} AnyValue
2420
+ * @typedef {unknown} AnyValue
2428
2421
  */
2429
2422
 
2430
2423
  /**
@@ -2442,8 +2435,11 @@
2442
2435
  */
2443
2436
  function ToString(o) {
2444
2437
  // Todo: See `es-abstract/es7`
2445
- // `String()` will not throw with Symbols
2446
- return '' + o; // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2438
+ // `String()` will not throw with Symbols, but the unchecked `+ ''`
2439
+ // coercion deliberately does (Web IDL requires converting a symbol
2440
+ // to `DOMString` to throw a `TypeError`); the assertion only tells
2441
+ // the compiler to allow the coercion it cannot model.
2442
+ return '' + (/** @type {string} */o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2447
2443
  }
2448
2444
 
2449
2445
  /**
@@ -2550,12 +2546,9 @@
2550
2546
  // We don't add within polyfill repo as might not always be the desired implementation
2551
2547
  Object.defineProperty(ShimEvent, Symbol.hasInstance, {
2552
2548
  /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2553
- /**
2554
- * @typedef {any} AnyValue
2555
- */
2556
2549
  value:
2557
2550
  /**
2558
- * @param {AnyValue} obj
2551
+ * @param {unknown} obj
2559
2552
  * @returns {boolean}
2560
2553
  */
2561
2554
  function value(obj) {
@@ -2626,12 +2619,9 @@
2626
2619
  Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);
2627
2620
  });
2628
2621
  Object.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {
2629
- /**
2630
- * @typedef {any} AnyValue
2631
- */
2632
2622
  value:
2633
2623
  /**
2634
- * @param {AnyValue} obj
2624
+ * @param {unknown} obj
2635
2625
  * @returns {boolean}
2636
2626
  */
2637
2627
  function value(obj) {
@@ -2913,25 +2903,20 @@
2913
2903
  }
2914
2904
 
2915
2905
  /**
2916
- * @typedef {any} ArbitraryValue
2917
- */
2918
-
2919
- /**
2920
- * @param {ArbitraryValue} obj
2906
+ * @param {unknown} obj
2921
2907
  * @returns {boolean}
2922
2908
  */
2923
2909
  function isErrorOrDOMErrorOrDOMException(obj) {
2924
- return obj && _typeof(obj) === 'object' &&
2925
2910
  // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
2926
- typeof obj.name === 'string';
2911
+ return _typeof(obj) === 'object' && obj !== null && 'name' in obj && typeof obj.name === 'string';
2927
2912
  }
2928
2913
 
2929
2914
  /**
2930
2915
  * Finds the error argument. This is useful because some WebSQL callbacks
2931
2916
  * pass the error as the first argument, and some pass it as the second
2932
2917
  * argument.
2933
- * @param {(Error|{message?: string, name?: string}|any)[]} args
2934
- * @returns {Error|DOMException|undefined}
2918
+ * @param {unknown[]} args
2919
+ * @returns {unknown}
2935
2920
  */
2936
2921
  function findError(args) {
2937
2922
  var err;
@@ -2947,7 +2932,7 @@
2947
2932
  if (isErrorOrDOMErrorOrDOMException(arg)) {
2948
2933
  return arg;
2949
2934
  }
2950
- if (arg && typeof arg.message === 'string') {
2935
+ if (_typeof(arg) === 'object' && arg !== null && 'message' in arg && typeof arg.message === 'string') {
2951
2936
  err = arg;
2952
2937
  }
2953
2938
  }
@@ -3072,7 +3057,7 @@
3072
3057
  * @typedef {IDBRequest & EventTarget & import('eventtargeter').EventTargetInstance & {
3073
3058
  * transaction: import('./IDBTransaction.js').IDBTransactionFull,
3074
3059
  * __done: boolean,
3075
- * __result: import('./IDBDatabase.js').IDBDatabaseFull|undefined,
3060
+ * __result: unknown,
3076
3061
  * __error: null|DOMException|Error,
3077
3062
  * __source: null|import('./IDBDatabase.js').IDBDatabaseFull|
3078
3063
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
@@ -3542,8 +3527,8 @@
3542
3527
 
3543
3528
  /**
3544
3529
  * Compares two keys.
3545
- * @param {import('./Key.js').Key} first
3546
- * @param {import('./Key.js').Key} second
3530
+ * @param {import('./Key.js').Key|null|undefined} first
3531
+ * @param {import('./Key.js').Key|null|undefined} second
3547
3532
  * @returns {0|1|-1}
3548
3533
  */
3549
3534
  function cmp(first, second) {
@@ -3620,12 +3605,11 @@
3620
3605
  */
3621
3606
 
3622
3607
  /**
3623
- * @typedef {any} Value
3608
+ * @typedef {unknown} Value
3624
3609
  */
3625
3610
 
3626
3611
  /**
3627
- * @typedef {any} Key
3628
- * @todo Specify possible value more precisely
3612
+ * @typedef {IDBValidKey} Key
3629
3613
  */
3630
3614
 
3631
3615
  /**
@@ -3692,15 +3676,11 @@
3692
3676
  */
3693
3677
  var signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
3694
3678
 
3695
- /**
3696
- * @typedef {any} AnyValue
3697
- */
3698
-
3699
3679
  /**
3700
3680
  * @type {{
3701
3681
  * [key: string]: {
3702
- * encode: (param: any, inArray?: boolean) => string,
3703
- * decode: (param: string, inArray?: boolean) => any
3682
+ * encode(param: unknown, inArray?: boolean): string,
3683
+ * decode(param: string, inArray?: boolean): ValueType|undefined
3704
3684
  * }
3705
3685
  * }}
3706
3686
  */
@@ -4055,7 +4035,7 @@
4055
4035
  }
4056
4036
 
4057
4037
  /**
4058
- * @param {Key} key
4038
+ * @param {Value} key
4059
4039
  * @returns {KeyType|"invalid"}
4060
4040
  */
4061
4041
  function getKeyType(key) {
@@ -4199,7 +4179,7 @@
4199
4179
  case 'array':
4200
4180
  {
4201
4181
  // May throw (from binary)
4202
- var arr = /** @type {Array<any>} */input;
4182
+ var arr = /** @type {unknown[]} */input;
4203
4183
  var len = arr.length;
4204
4184
  safePush(seen, input);
4205
4185
 
@@ -4232,9 +4212,9 @@
4232
4212
  };
4233
4213
  }
4234
4214
  if (!multiEntry || !fullKeys && keys.every(function (k) {
4235
- return cmp(k, key.value) !== 0;
4215
+ return cmp(/** @type {Key} */k, /** @type {Key} */key.value) !== 0;
4236
4216
  }) || fullKeys && keys.every(function (k) {
4237
- return cmp(k, key) !== 0;
4217
+ return cmp(/** @type {Key} */k, /** @type {Key} */ /** @type {unknown} */key) !== 0;
4238
4218
  })) {
4239
4219
  safePush(keys, fullKeys ? key : key.value);
4240
4220
  }
@@ -4291,7 +4271,7 @@
4291
4271
 
4292
4272
  /**
4293
4273
  *
4294
- * @param {Key} key
4274
+ * @param {Value} key
4295
4275
  * @param {boolean} [fullKeys]
4296
4276
  * @returns {KeyValueObject}
4297
4277
  * @todo Document other allowable `key`?
@@ -4406,7 +4386,7 @@
4406
4386
  }
4407
4387
  if (keyPath === '') {
4408
4388
  return {
4409
- value: value
4389
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4410
4390
  };
4411
4391
  }
4412
4392
  var identifiers = keyPath.split('.');
@@ -4440,13 +4420,13 @@
4440
4420
  }) ? {
4441
4421
  failure: true
4442
4422
  } : {
4443
- value: value
4423
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4444
4424
  };
4445
4425
  }
4446
4426
 
4447
4427
  /**
4448
4428
  * Sets the inline key value.
4449
- * @param {{[key: string]: AnyValue}} value
4429
+ * @param {{[key: string]: Value}} value
4450
4430
  * @param {Key} key
4451
4431
  * @param {string} keyPath
4452
4432
  * @returns {void}
@@ -4464,7 +4444,7 @@
4464
4444
  configurable: true
4465
4445
  });
4466
4446
  }
4467
- value = value[identifier];
4447
+ value = /** @type {{[key: string]: Value}} */value[identifier];
4468
4448
  });
4469
4449
  Object.defineProperty(value, /** @type {string} */last, {
4470
4450
  value: key,
@@ -4549,7 +4529,7 @@
4549
4529
  * @returns {Key[]}
4550
4530
  */
4551
4531
  function findMultiEntryMatches(keyEntry, range) {
4552
- /** @type {unknown[]} */
4532
+ /** @type {Key[]} */
4553
4533
  var matches = [];
4554
4534
  if (Array.isArray(keyEntry)) {
4555
4535
  var _iterator4 = _createForOfIteratorHelper(keyEntry),
@@ -4588,7 +4568,7 @@
4588
4568
 
4589
4569
  /**
4590
4570
  * Not currently in use but keeping for spec parity.
4591
- * @param {Key} key
4571
+ * @param {KeyValueObject} key
4592
4572
  * @throws {Error} Upon a "bad key"
4593
4573
  * @returns {ValueType}
4594
4574
  */
@@ -4599,16 +4579,17 @@
4599
4579
  case 'number':
4600
4580
  case 'string':
4601
4581
  {
4602
- return value;
4582
+ return /** @type {number|string} */value;
4603
4583
  }
4604
4584
  case 'array':
4605
4585
  {
4606
4586
  /** @type {ValueType[]} */
4607
4587
  var array = [];
4608
- var len = value.length;
4588
+ var arrValue = /** @type {KeyValueObject[]} */value;
4589
+ var len = arrValue.length;
4609
4590
  var index = 0;
4610
4591
  while (index < len) {
4611
- var entry = convertKeyToValue(value[index]);
4592
+ var entry = convertKeyToValue(arrValue[index]);
4612
4593
  setArrayValue(array, index, entry);
4613
4594
  index++;
4614
4595
  }
@@ -4616,18 +4597,18 @@
4616
4597
  }
4617
4598
  case 'date':
4618
4599
  {
4619
- return new Date(value);
4600
+ return new Date(/** @type {number} */value);
4620
4601
  }
4621
4602
  case 'binary':
4622
4603
  {
4623
- var _len = value.length;
4604
+ var binValue = /** @type {Uint8Array} */value;
4605
+ var _len = binValue.length;
4624
4606
  var buffer = new ArrayBuffer(_len);
4625
4607
  // Set the entries in buffer's [[ArrayBufferData]] to those in `value`
4626
- var uint8 = new Uint8Array(buffer, value.byteOffset || 0, value.byteLength);
4627
- uint8.set(value);
4608
+ var uint8 = new Uint8Array(buffer, binValue.byteOffset || 0, binValue.byteLength);
4609
+ uint8.set(binValue);
4628
4610
  return buffer;
4629
4611
  }
4630
- case 'invalid':
4631
4612
  default:
4632
4613
  throw new Error('Bad key');
4633
4614
  }
@@ -4635,7 +4616,7 @@
4635
4616
 
4636
4617
  /**
4637
4618
  *
4638
- * @param {Key} key
4619
+ * @param {Value} key
4639
4620
  * @param {boolean} [inArray]
4640
4621
  * @returns {string|null}
4641
4622
  */
@@ -4650,7 +4631,7 @@
4650
4631
 
4651
4632
  /**
4652
4633
  *
4653
- * @param {Key} key
4634
+ * @param {string|null} key
4654
4635
  * @param {boolean} [inArray]
4655
4636
  * @throws {Error} Invalid number
4656
4637
  * @returns {undefined|ValueType}
@@ -4664,7 +4645,7 @@
4664
4645
 
4665
4646
  /**
4666
4647
  *
4667
- * @param {Key} key
4648
+ * @param {Value} key
4668
4649
  * @param {boolean} [inArray]
4669
4650
  * @returns {undefined|ValueType}
4670
4651
  */
@@ -4882,8 +4863,8 @@
4882
4863
  var IDBKeyRangeAlias = IDBKeyRange;
4883
4864
 
4884
4865
  /**
4885
- * @param {import('./Key.js').Key|null} lower
4886
- * @param {import('./Key.js').Key|null} upper
4866
+ * @param {import('./Key.js').Value} lower
4867
+ * @param {import('./Key.js').Value} upper
4887
4868
  * @param {boolean} lowerOpen
4888
4869
  * @param {boolean} upperOpen
4889
4870
  * @returns {import('./IDBKeyRange.js').IDBKeyRangeFull}
@@ -5080,10 +5061,11 @@
5080
5061
  function convertValueToKeyRange(value, nullDisallowed) {
5081
5062
  if (instanceOf(value, IDBKeyRange)) {
5082
5063
  // We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)
5083
- if (value.toString() !== '[object IDBKeyRange]') {
5084
- return IDBKeyRange.__createInstance(value.lower, value.upper, value.lowerOpen, value.upperOpen);
5064
+ var range = /** @type {IDBKeyRangeFull} */value;
5065
+ if (range.toString() !== '[object IDBKeyRange]') {
5066
+ return IDBKeyRange.__createInstance(range.lower, range.upper, range.lowerOpen, range.upperOpen);
5085
5067
  }
5086
- return value;
5068
+ return range;
5087
5069
  }
5088
5070
  if (isNullish(value)) {
5089
5071
  if (nullDisallowed) {
@@ -5110,7 +5092,7 @@
5110
5092
  * clone: () => DOMStringListFull,
5111
5093
  * contains: (str: string) => boolean,
5112
5094
  * indexOf: (str: string) => Integer,
5113
- * splice: (index: Integer, howmany: Integer, ...args: any) => void
5095
+ * splice: (index: Integer, howmany: Integer, ...args: string[]) => void
5114
5096
  * length: Integer
5115
5097
  * }} DOMStringListFull
5116
5098
  */
@@ -5226,9 +5208,10 @@
5226
5208
  },
5227
5209
  /**
5228
5210
  * @this {DOMStringListFull}
5229
- * @param {(value: string, i: Integer, arr: string[]) => any[]} cb
5211
+ * @template T
5212
+ * @param {(value: string, i: Integer, arr: string[]) => T} cb
5230
5213
  * @param {object} thisArg
5231
- * @returns {any[]}
5214
+ * @returns {T[]}
5232
5215
  */
5233
5216
  map: function map(cb, thisArg) {
5234
5217
  // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
@@ -5253,10 +5236,7 @@
5253
5236
  this.sortList();
5254
5237
  },
5255
5238
  /**
5256
- * @typedef {any} AnyArgs
5257
- */
5258
- /**
5259
- * @param {[index: Integer, howmany: Integer, ...args: any]} args
5239
+ * @param {[index: Integer, howmany: Integer, ...args: string[]]} args
5260
5240
  * @this {DOMStringListFull}
5261
5241
  * @returns {void}
5262
5242
  */
@@ -5294,12 +5274,9 @@
5294
5274
  }));
5295
5275
 
5296
5276
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
5297
- /**
5298
- * @typedef {any} AnyValue
5299
- */
5300
5277
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
5301
5278
  /**
5302
- * @param {AnyValue} obj
5279
+ * @param {unknown} obj
5303
5280
  * @returns {boolean}
5304
5281
  */
5305
5282
  value: function value(obj) {
@@ -5380,7 +5357,7 @@
5380
5357
  /**
5381
5358
  * @typedef {{
5382
5359
  * op: SQLCallback,
5383
- * args: any[],
5360
+ * args: unknown[],
5384
5361
  * req: import('./IDBRequest.js').IDBRequestFull|null
5385
5362
  * }} RequestInfo
5386
5363
  */
@@ -5432,17 +5409,17 @@
5432
5409
  * __pushToQueue: (
5433
5410
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5434
5411
  * callback: SQLCallback,
5435
- * args?: any[]
5412
+ * args?: unknown[]
5436
5413
  * ) => void,
5437
5414
  * __assertActive: () => void,
5438
5415
  * commit: () => void,
5439
5416
  * __addNonRequestToTransactionQueue: (
5440
5417
  * callback: SQLCallback,
5441
- * args?: any[]
5418
+ * args?: unknown[]
5442
5419
  * ) => void
5443
5420
  * __addToTransactionQueue: (
5444
5421
  * callback: SQLCallback,
5445
- * args: any[]|undefined,
5422
+ * args: unknown[]|undefined,
5446
5423
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5447
5424
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5448
5425
  * import('./IDBIndex.js').IDBIndexFull|
@@ -5644,7 +5621,7 @@
5644
5621
  i = -1;
5645
5622
 
5646
5623
  /**
5647
- * @typedef {any} IDBRequestResult
5624
+ * @typedef {unknown} IDBRequestResult
5648
5625
  */
5649
5626
 
5650
5627
  /**
@@ -6080,8 +6057,8 @@
6080
6057
  /**
6081
6058
  * @typedef {(
6082
6059
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6083
- * args: any[],
6084
- * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6060
+ * args: unknown[],
6061
+ * success: (result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6085
6062
  * error: (
6086
6063
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
6087
6064
  * err?: Error & {code?: number}
@@ -6093,7 +6070,7 @@
6093
6070
  /**
6094
6071
  * Adds a callback function to the transaction queue.
6095
6072
  * @param {SQLCallback} callback
6096
- * @param {any[]} args
6073
+ * @param {unknown[]} args
6097
6074
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6098
6075
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6099
6076
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6110,7 +6087,7 @@
6110
6087
  * Adds a callback function to the transaction queue without generating a
6111
6088
  * request.
6112
6089
  * @param {SQLCallback} callback
6113
- * @param {any[]} args
6090
+ * @param {unknown[]} args
6114
6091
  * @this {IDBTransactionFull}
6115
6092
  * @returns {void}
6116
6093
  */
@@ -6122,7 +6099,7 @@
6122
6099
  * Adds an IDBRequest to the transaction queue.
6123
6100
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6124
6101
  * @param {SQLCallback} callback
6125
- * @param {any[]} args
6102
+ * @param {unknown[]} args
6126
6103
  * @this {IDBTransactionFull}
6127
6104
  * @returns {void}
6128
6105
  */
@@ -6293,7 +6270,7 @@
6293
6270
  bubbles: true,
6294
6271
  cancelable: true
6295
6272
  });
6296
- return new SyncPromise(/** @type {(resolve: (value?: any) => void) => void} */
6273
+ return new SyncPromise(/** @type {(resolve: (value?: unknown) => void) => void} */
6297
6274
  function (resolve) {
6298
6275
  setTimeout(function () {
6299
6276
  if (!q.req) {
@@ -8456,7 +8433,7 @@
8456
8433
  }
8457
8434
 
8458
8435
  /**
8459
- * @typedef {any} AnyValue
8436
+ * @typedef {import('./Key.js').Value} AnyValue
8460
8437
  */
8461
8438
 
8462
8439
  /**
@@ -8566,7 +8543,7 @@
8566
8543
  * __keyPath: import('./Key.js').KeyPath,
8567
8544
  * __recreated?: boolean,
8568
8545
  * __fetchIndexData: (
8569
- * range: any,
8546
+ * range: Query,
8570
8547
  * opType: "value"|"key"|"count",
8571
8548
  * nullDisallowed: boolean,
8572
8549
  * count?: number
@@ -8938,7 +8915,7 @@
8938
8915
  };
8939
8916
 
8940
8917
  /**
8941
- * @typedef {any|IDBKeyRange} Query
8918
+ * @typedef {IDBValidKey|IDBKeyRange} Query
8942
8919
  */
8943
8920
 
8944
8921
  /**
@@ -9221,7 +9198,7 @@
9221
9198
  reject(err);
9222
9199
  });
9223
9200
  }));
9224
- SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: any) => PromiseLike<never>} */
9201
+ SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: unknown) => PromiseLike<never>} */
9225
9202
  error).catch(function (err) {
9226
9203
  console.log('Index rename error');
9227
9204
  throw err;
@@ -9233,14 +9210,10 @@
9233
9210
  });
9234
9211
  };
9235
9212
 
9236
- /**
9237
- * @typedef {any} AnyValue
9238
- */
9239
-
9240
9213
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
9241
9214
  Object.defineProperty(IDBIndex, Symbol.hasInstance, {
9242
9215
  /**
9243
- * @param {AnyValue} obj
9216
+ * @param {unknown} obj
9244
9217
  * @returns {boolean}
9245
9218
  */
9246
9219
  value: function value(obj) {
@@ -9268,7 +9241,9 @@
9268
9241
  * @param {string[]} sqlValues
9269
9242
  * @param {WebSQLTransaction} tx
9270
9243
  * @param {null|undefined} args
9271
- * @param {(result: number|undefined|[]|AnyValue|AnyValue[]) => void} success
9244
+ * @param {(
9245
+ * result: number|undefined|[]|import('./Key.js').Value|import('./Key.js').Value[]
9246
+ * ) => void} success
9272
9247
  * @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
9273
9248
  * @returns {void}
9274
9249
  */
@@ -9305,7 +9280,7 @@
9305
9280
  * @param {{
9306
9281
  * value: string
9307
9282
  * }} record
9308
- * @returns {AnyValue}
9283
+ * @returns {import('./Key.js').Value}
9309
9284
  */
9310
9285
  function (record) {
9311
9286
  // when opType is value
@@ -9319,9 +9294,9 @@
9319
9294
  var rowKey = /** @type {import('./Key.js').ValueTypeArray} */
9320
9295
  _decode(row[escapedIndexNameForKeyCol]);
9321
9296
  var record;
9322
- if (hasKey && (multiChecks && range.some(
9297
+ if (hasKey && (multiChecks && /** @type {import('./Key.js').ValueType[]} */range.some(
9323
9298
  /**
9324
- * @param {string} check
9299
+ * @param {import('./Key.js').ValueType} check
9325
9300
  * @returns {boolean}
9326
9301
  */
9327
9302
  function (check) {
@@ -9472,14 +9447,14 @@
9472
9447
  * __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
9473
9448
  * __validateKeyAndValueAndCloneValue: (
9474
9449
  * value: import('./Key.js').Value,
9475
- * key: import('./Key.js').Key,
9450
+ * key: import('./Key.js').Key|undefined,
9476
9451
  * cursorUpdate: boolean
9477
9452
  * ) => KeyValueArray,
9478
9453
  * __deriveKey: (
9479
9454
  * tx: WebSQLTransaction,
9480
9455
  * value: import('./Key.js').Value,
9481
- * key: import('./Key.js').Key,
9482
- * success: (key: import('./Key.js').Key, cn?: Integer) => void,
9456
+ * key: import('./Key.js').Key|undefined,
9457
+ * success: (key: import('./Key.js').Value, cn?: Integer) => void,
9483
9458
  * failCb: import('./Key.js').SQLFailureCallback
9484
9459
  * ) => void,
9485
9460
  * __checkIndexConstraints: (
@@ -9503,7 +9478,7 @@
9503
9478
  * error: (err: (Error & {code?: number})) => void
9504
9479
  * ) => void,
9505
9480
  * __get: (
9506
- * query: import('./Key.js').Value,
9481
+ * query: import('./IDBIndex.js').Query,
9507
9482
  * getKey?: boolean,
9508
9483
  * getAll?: boolean,
9509
9484
  * count?: Integer
@@ -9788,7 +9763,7 @@
9788
9763
  };
9789
9764
 
9790
9765
  /**
9791
- * @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
9766
+ * @typedef {[import('./Key.js').Key|undefined, import('./Key.js').Value]} KeyValueArray
9792
9767
  */
9793
9768
 
9794
9769
  // Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
@@ -9803,7 +9778,7 @@
9803
9778
  * Determines whether the given inline or out-of-line key is valid,
9804
9779
  * according to the object store's schema.
9805
9780
  * @param {import('./Key.js').Value} value Used for inline keys
9806
- * @param {import('./Key.js').Key} key Used for out-of-line keys
9781
+ * @param {import('./Key.js').Key|undefined} key Used for out-of-line keys
9807
9782
  * @param {boolean} cursorUpdate
9808
9783
  * @throws {DOMException}
9809
9784
  * @this {IDBObjectStoreFull}
@@ -9819,11 +9794,11 @@
9819
9794
  // occurs sync; then can make cloning and this method without callbacks (except where ok
9820
9795
  // to be async)
9821
9796
  var _clonedValue = cloneWithInactiveTransaction(/** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction, value);
9822
- key = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9823
- if (key.invalid) {
9797
+ var extractedKey = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9798
+ if ('invalid' in extractedKey && extractedKey.invalid) {
9824
9799
  throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');
9825
9800
  }
9826
- if (key.failure) {
9801
+ if ('failure' in extractedKey && extractedKey.failure) {
9827
9802
  if (!cursorUpdate) {
9828
9803
  if (!me.autoIncrement) {
9829
9804
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
@@ -9838,14 +9813,13 @@
9838
9813
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath');
9839
9814
  }
9840
9815
  // An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key
9841
- return [key.value, _clonedValue];
9816
+ return [(/** @type {import('./Key.js').Key} */extractedKey.value), _clonedValue];
9842
9817
  }
9843
9818
  if (key === undefined) {
9844
9819
  if (!me.autoIncrement) {
9845
9820
  throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
9846
9821
  }
9847
9822
  // A key will be generated
9848
- key = undefined;
9849
9823
  } else {
9850
9824
  convertValueToKeyRethrowingAndIfInvalid(key);
9851
9825
  }
@@ -9860,8 +9834,8 @@
9860
9834
  * a keyPath leading to a valid but non-numeric or < 1 key).
9861
9835
  * @param {WebSQLTransaction} tx
9862
9836
  * @param {import('./Key.js').Value} value
9863
- * @param {import('./Key.js').Key} key
9864
- * @param {(key: import('./Key.js').Key, cn?: Integer) => void} success
9837
+ * @param {import('./Key.js').Key|undefined} key
9838
+ * @param {(key: import('./Key.js').Value, cn?: Integer) => void} success
9865
9839
  * @param {import('./Key.js').SQLFailureCallback} failCb
9866
9840
  * @this {IDBObjectStoreFull}
9867
9841
  * @returns {void}
@@ -9876,9 +9850,8 @@
9876
9850
  */
9877
9851
  function keyCloneThenSuccess(oldCn) {
9878
9852
  // We want to return the original key, so we don't need to accept an argument here
9879
- encode(key, function (key) {
9880
- key = decode(key);
9881
- success(key, oldCn);
9853
+ encode(key, function (encodedKey) {
9854
+ success(decode(encodedKey), oldCn);
9882
9855
  });
9883
9856
  }
9884
9857
  if (me.autoIncrement) {
@@ -9892,7 +9865,7 @@
9892
9865
  if (me.keyPath !== null) {
9893
9866
  // Should not throw now as checked earlier
9894
9867
  // Todo: Could this not be an array here?
9895
- injectKeyIntoValueUsingKeyPath(value, key, /** @type {string} */me.keyPath);
9868
+ injectKeyIntoValueUsingKeyPath(/** @type {{[key: string]: import('./Key.js').Value}} */value, /** @type {import('./Key.js').Key} */key, /** @type {string} */me.keyPath);
9896
9869
  }
9897
9870
  success(key, oldCn);
9898
9871
  }, failCb);
@@ -9949,15 +9922,15 @@
9949
9922
  resolve(undefined);
9950
9923
  return;
9951
9924
  }
9952
- indexKey = indexKey.value;
9953
- if (indexKey === undefined) {
9925
+ var indexKeyValue = indexKey.value;
9926
+ if (indexKeyValue === undefined) {
9954
9927
  resolve(undefined);
9955
9928
  return;
9956
9929
  }
9957
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
9958
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
9930
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
9931
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
9959
9932
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
9960
- if (key === undefined || excludeKey !== undefined && cmp(key, excludeKey) === 0) {
9933
+ if (key === undefined || excludeKey !== undefined && cmp(/** @type {import('./Key.js').Key} */key, excludeKey) === 0) {
9961
9934
  resolve(undefined);
9962
9935
  return;
9963
9936
  }
@@ -10030,21 +10003,21 @@
10030
10003
  resolve(undefined);
10031
10004
  return;
10032
10005
  }
10033
- indexKey = indexKey.value;
10006
+ var indexKeyValue = indexKey.value;
10034
10007
  /**
10035
10008
  * @param {import('./IDBIndex.js').IDBIndexFull} index
10036
10009
  * @returns {void}
10037
10010
  */
10038
10011
  function setIndexInfo(index) {
10039
- if (indexKey === undefined) {
10012
+ if (indexKeyValue === undefined) {
10040
10013
  return;
10041
10014
  }
10042
10015
  paramMap[index.__currentName] = /** @type {string} */
10043
- _encode(indexKey, index.multiEntry);
10016
+ _encode(indexKeyValue, index.multiEntry);
10044
10017
  }
10045
10018
  if (index.unique) {
10046
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
10047
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
10019
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
10020
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
10048
10021
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
10049
10022
  if (key === undefined) {
10050
10023
  setIndexInfo(index);
@@ -10212,7 +10185,9 @@
10212
10185
  var key = arguments[5];
10213
10186
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
10214
10187
  store.transaction.__pushToQueue(request, function (tx, args, success, error) {
10215
- store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
10188
+ store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumberRaw, oldCn) {
10189
+ var clonedKeyOrCurrentNumber = /** @type {import('./Key.js').Key|Integer} */
10190
+ clonedKeyOrCurrentNumberRaw;
10216
10191
  encode(value, function (encoded) {
10217
10192
  /**
10218
10193
  * @param {WebSQLTransaction} tx
@@ -10265,7 +10240,7 @@
10265
10240
 
10266
10241
  /**
10267
10242
  *
10268
- * @param {import('./Key.js').Value} query
10243
+ * @param {import('./IDBIndex.js').Query} query
10269
10244
  * @param {boolean} [getKey]
10270
10245
  * @this {IDBObjectStoreFull}
10271
10246
  * @returns {import('./IDBRequest.js').IDBRequestFull}
@@ -10317,7 +10292,7 @@
10317
10292
 
10318
10293
  /**
10319
10294
  *
10320
- * @param {import('./Key.js').Value} query
10295
+ * @param {import('./IDBIndex.js').Query} query
10321
10296
  * @throws {TypeError}
10322
10297
  * @this {IDBObjectStoreFull}
10323
10298
  * @returns {import('./IDBRequest.js').IDBRequestFull}
@@ -10331,7 +10306,7 @@
10331
10306
 
10332
10307
  /**
10333
10308
  *
10334
- * @param {import('./Key.js').Value} query
10309
+ * @param {import('./IDBIndex.js').Query} query
10335
10310
  * @this {IDBObjectStoreFull}
10336
10311
  * @returns {import('./IDBRequest.js').IDBRequestFull}
10337
10312
  */
@@ -10386,7 +10361,7 @@
10386
10361
 
10387
10362
  /**
10388
10363
  *
10389
- * @param {import('./Key.js').Value} query
10364
+ * @param {import('./IDBIndex.js').Query} query
10390
10365
  * @throws {TypeError}
10391
10366
  * @this {IDBObjectStoreFull}
10392
10367
  * @returns {import('./IDBRequest.js').IDBRequestFull}
@@ -11598,7 +11573,7 @@
11598
11573
  var sysdbFinishedCb = function sysdbFinishedCb(systx, err, cb) {
11599
11574
  if (err) {
11600
11575
  /**
11601
- * @param {any} [errorToShow]
11576
+ * @param {unknown} [errorToShow]
11602
11577
  * @returns {void}
11603
11578
  */
11604
11579
  var manualRevert = function manualRevert(errorToShow) {
@@ -11622,7 +11597,9 @@
11622
11597
  cb(sqlErr); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11623
11598
  }, function () {
11624
11599
  isRevertingSysdb = false;
11625
- cb(errorToShow || reportError); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11600
+ // eslint-disable-next-line promise/no-callback-in-promise -- Convenient
11601
+ cb(/** @type {(Error & {code?: number})|undefined} */
11602
+ errorToShow || reportError);
11626
11603
  });
11627
11604
  };
11628
11605
  try {
@@ -11655,13 +11632,13 @@
11655
11632
  newVersion: version
11656
11633
  });
11657
11634
  req.__result = connection;
11658
- connection.__upgradeTransaction = req.__transaction = req.__result.__versionTransaction = IDBTransaction.__createInstance(req.__result, req.__result.objectStoreNames, 'versionchange');
11635
+ connection.__upgradeTransaction = req.__transaction = connection.__versionTransaction = IDBTransaction.__createInstance(connection, connection.objectStoreNames, 'versionchange');
11659
11636
  req.__done = true;
11660
11637
  req.transaction.__addNonRequestToTransactionQueue(
11661
11638
  /**
11662
11639
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11663
- * @param {any[]} args
11664
- * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11640
+ * @param {unknown[]} args
11641
+ * @param {(result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11665
11642
  * @returns {void}
11666
11643
  */
11667
11644
  function onupgradeneeded(tx, args, finished /* , error */) {
@@ -12362,16 +12339,16 @@
12362
12339
 
12363
12340
  /**
12364
12341
  * @typedef {IDBCursor & {
12365
- * primaryKey: import('./Key.js').Key,
12366
- * key: import('./Key.js').Key,
12342
+ * primaryKey: import('./Key.js').Key|null|undefined,
12343
+ * key: import('./Key.js').Key|null|undefined,
12367
12344
  * direction: string,
12368
12345
  * source: import('./IDBObjectStore.js').IDBObjectStoreFull|
12369
12346
  * import('./IDBIndex.js').IDBIndexFull,
12370
12347
  * __request: import('./IDBRequest.js').IDBRequestFull,
12371
12348
  * __advanceCount: Integer|undefined,
12372
12349
  * __indexSource: boolean,
12373
- * __key: import('./Key.js').Key,
12374
- * __primaryKey: import('./Key.js').Key,
12350
+ * __key: import('./Key.js').Key|null|undefined,
12351
+ * __primaryKey: import('./Key.js').Key|null|undefined,
12375
12352
  * __value: import('./Key.js').Value,
12376
12353
  * __store: import('./IDBObjectStore.js').IDBObjectStoreFull,
12377
12354
  * __range: import('./IDBKeyRange.js').IDBKeyRangeFull|undefined,
@@ -12379,13 +12356,13 @@
12379
12356
  * __valueColumnName: string,
12380
12357
  * __keyOnly: boolean,
12381
12358
  * __valueDecoder: {
12382
- * decode: (str: string) => any,
12359
+ * decode: (str: string) => import('./Key.js').Value,
12383
12360
  * },
12384
12361
  * __count: boolean,
12385
12362
  * __prefetchedIndex: Integer,
12386
12363
  * __prefetchedData: null|{
12387
12364
  * length: number;
12388
- * item(index: number): any;
12365
+ * item(index: number): unknown;
12389
12366
  * }|{
12390
12367
  * data: RowItemNonNull[],
12391
12368
  * length: Integer,
@@ -12400,7 +12377,14 @@
12400
12377
  * __multiEntryExhausted: boolean,
12401
12378
  * __invalidateCache: () => void,
12402
12379
  * __gotValue: boolean,
12403
- * __find: (...args: any[]) => void,
12380
+ * __find: (
12381
+ * key: import('./Key.js').Key|undefined,
12382
+ * primaryKey: import('./Key.js').Key|undefined,
12383
+ * tx: WebSQLTransaction,
12384
+ * success: KeySuccess,
12385
+ * error: FindError,
12386
+ * recordsToLoad?: Integer
12387
+ * ) => void,
12404
12388
  * __findBasic: (
12405
12389
  * key: import('./Key.js').Key|undefined,
12406
12390
  * primaryKey: import('./Key.js').Key|undefined,
@@ -12421,17 +12405,17 @@
12421
12405
  * __decode: (
12422
12406
  * rowItem: RowItemNonNull,
12423
12407
  * callback: (
12424
- * key: import('./Key.js').Key,
12408
+ * key: import('./Key.js').Key|undefined,
12425
12409
  * val: import('./Key.js').Value,
12426
- * primaryKey: import('./Key.js').Key,
12410
+ * primaryKey: import('./Key.js').Key|undefined,
12427
12411
  * encKey?: string
12428
12412
  * ) => void
12429
12413
  * ) => void,
12430
12414
  * __sourceOrEffectiveObjStoreDeleted: () => void,
12431
12415
  * __continue: (key?: import('./Key.js').Key, advanceContinue?: boolean) => void,
12432
12416
  * __continueFinish: (
12433
- * key: import('./Key.js').Key,
12434
- * primaryKey: import('./Key.js').Key,
12417
+ * key: import('./Key.js').Key|undefined,
12418
+ * primaryKey: import('./Key.js').Key|undefined,
12435
12419
  * advanceState: boolean
12436
12420
  * ) => void
12437
12421
  * }} IDBCursorFull
@@ -12464,7 +12448,7 @@
12464
12448
  * import('./IDBIndex.js').IDBIndexFull} source
12465
12449
  * @param {string} keyColumnName
12466
12450
  * @param {string} valueColumnName
12467
- * @param {boolean} count
12451
+ * @param {boolean} [count]
12468
12452
  * @this {IDBCursorFull}
12469
12453
  * @returns {void}
12470
12454
  */
@@ -12505,7 +12489,7 @@
12505
12489
  this.__valueColumnName = valueColumnName;
12506
12490
  this.__keyOnly = valueColumnName === 'key';
12507
12491
  this.__valueDecoder = this.__keyOnly ? Key : Sca;
12508
- this.__count = count;
12492
+ this.__count = Boolean(count);
12509
12493
  this.__prefetchedIndex = -1;
12510
12494
  this.__continuationKey = undefined;
12511
12495
  this.__continuationPrimaryKey = undefined;
@@ -12524,36 +12508,36 @@
12524
12508
 
12525
12509
  /**
12526
12510
  *
12527
- * @param {...any} args
12511
+ * @param {IDBKeyRange} query
12512
+ * @param {string} direction
12513
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
12514
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
12515
+ * import('./IDBIndex.js').IDBIndexFull} source
12516
+ * @param {string} keyColumnName
12517
+ * @param {string} valueColumnName
12518
+ * @param {boolean} [count]
12528
12519
  * @returns {IDBCursorFull}
12529
12520
  */
12530
- IDBCursor.__createInstance = function () {
12521
+ IDBCursor.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
12531
12522
  var IDBCursor = IDBCursorAlias.__super;
12532
12523
  IDBCursor.prototype = IDBCursorAlias.prototype;
12533
12524
 
12534
12525
  // @ts-expect-error It's ok
12535
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12536
- args[_key] = arguments[_key];
12537
- }
12538
- return _construct(IDBCursor, args);
12526
+ return new IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count);
12539
12527
  };
12540
12528
 
12541
12529
  /**
12542
12530
  *
12543
- * @param {...any} args
12531
+ * @param {import('./Key.js').Key|undefined} key
12532
+ * @param {import('./Key.js').Key|undefined} primaryKey
12533
+ * @param {WebSQLTransaction} tx
12534
+ * @param {KeySuccess} success
12535
+ * @param {FindError} error
12536
+ * @param {Integer} [recordsToLoad]
12544
12537
  * @this {IDBCursorFull}
12545
12538
  * @returns {void}
12546
12539
  */
12547
- IDBCursor.prototype.__find = function () {
12548
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12549
- args[_key2] = arguments[_key2];
12550
- }
12551
- var key = args[0],
12552
- primaryKey = args[1],
12553
- tx = args[2],
12554
- success = args[3],
12555
- error = args[4],
12556
- recordsToLoad = args[5];
12540
+ IDBCursor.prototype.__find = function (key, primaryKey, tx, success, error, recordsToLoad) {
12557
12541
  if (this.__multiEntryIndex) {
12558
12542
  this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
12559
12543
  } else {
@@ -12563,9 +12547,9 @@
12563
12547
 
12564
12548
  /**
12565
12549
  * @typedef {(
12566
- * k: import('./Key.js').Key,
12550
+ * k: import('./Key.js').Key|undefined,
12567
12551
  * val: import('./Key.js').Value,
12568
- * primKey: import('./Key.js').Key
12552
+ * primKey: import('./Key.js').Key|undefined
12569
12553
  * ) => void} KeySuccess
12570
12554
  */
12571
12555
 
@@ -12662,7 +12646,7 @@
12662
12646
  me.__prefetchedIndex = 0;
12663
12647
  me.__prefetchedData = data.rows;
12664
12648
  if (CFG.DEBUG) {
12665
- console.log('Preloaded ' + me.__prefetchedData.length + ' records for cursor');
12649
+ console.log('Preloaded ' + data.rows.length + ' records for cursor');
12666
12650
  }
12667
12651
  me.__decode(/** @type {RowItemNonNull} */data.rows.item(0), success);
12668
12652
  } else if (data.rows.length === 1) {
@@ -12787,7 +12771,7 @@
12787
12771
  for (var i = 0; i < data.rows.length; i++) {
12788
12772
  var rowItem = /** @type {RowItemNonNull} */data.rows.item(i);
12789
12773
  var rowKey = _decode(rowItem[me.__keyColumnName], true);
12790
- var matches = findMultiEntryMatches(rowKey, me.__range);
12774
+ var matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */rowKey, me.__range);
12791
12775
  ct += matches.length;
12792
12776
  }
12793
12777
  success(undefined, ct, undefined);
@@ -12807,7 +12791,7 @@
12807
12791
  for (var _i = 0; _i < data.rows.length; _i++) {
12808
12792
  var _rowItem = /** @type {RowItemNonNull} */data.rows.item(_i);
12809
12793
  var _rowKey = _decode(_rowItem[me.__keyColumnName], true);
12810
- var _matches = findMultiEntryMatches(_rowKey, me.__range);
12794
+ var _matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */_rowKey, me.__range);
12811
12795
  var _iterator = _createForOfIteratorHelper(_matches),
12812
12796
  _step;
12813
12797
  try {
@@ -12888,11 +12872,11 @@
12888
12872
  };
12889
12873
 
12890
12874
  /**
12891
- * @typedef {any} StructuredCloneValue
12875
+ * @typedef {import('./Key.js').Value} StructuredCloneValue
12892
12876
  */
12893
12877
 
12894
12878
  /**
12895
- * @typedef {any} IndexedDBKey
12879
+ * @typedef {import('./Key.js').Key} IndexedDBKey
12896
12880
  */
12897
12881
 
12898
12882
  /**
@@ -12904,9 +12888,9 @@
12904
12888
 
12905
12889
  /**
12906
12890
  * @callback SuccessCallback
12907
- * @param {IndexedDBKey} key
12891
+ * @param {IndexedDBKey|undefined} key
12908
12892
  * @param {StructuredCloneValue} value
12909
- * @param {IndexedDBKey} primaryKey
12893
+ * @param {IndexedDBKey|undefined} primaryKey
12910
12894
  * @returns {void}
12911
12895
  */
12912
12896
 
@@ -12946,9 +12930,9 @@
12946
12930
  *
12947
12931
  * @param {RowItemNonNull} rowItem
12948
12932
  * @param {(
12949
- * key: import('./Key.js').Key,
12933
+ * key: import('./Key.js').Key|undefined,
12950
12934
  * val: import('./Key.js').Value,
12951
- * primaryKey: import('./Key.js').Key,
12935
+ * primaryKey: import('./Key.js').Key|undefined,
12952
12936
  * encKey?: string
12953
12937
  * ) => void} callback
12954
12938
  * @this {IDBCursorFull}
@@ -13023,8 +13007,8 @@
13023
13007
 
13024
13008
  /**
13025
13009
  *
13026
- * @param {import('./Key.js').Key} key
13027
- * @param {import('./Key.js').Key} primaryKey
13010
+ * @param {import('./Key.js').Key|undefined} key
13011
+ * @param {import('./Key.js').Key|undefined} primaryKey
13028
13012
  * @param {boolean} advanceState
13029
13013
  * @this {IDBCursorFull}
13030
13014
  * @returns {void}
@@ -13038,9 +13022,9 @@
13038
13022
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
13039
13023
  me.__store.transaction.__pushToQueue(me.__request, function cursorContinue(tx, args, success, error, executeNextRequest) {
13040
13024
  /**
13041
- * @param {import('./Key.js').Key} k
13025
+ * @param {import('./Key.js').Key|undefined} k
13042
13026
  * @param {import('./Key.js').Value} val
13043
- * @param {import('./Key.js').Key} primKey
13027
+ * @param {import('./Key.js').Key|undefined} primKey
13044
13028
  * @returns {void}
13045
13029
  */
13046
13030
  function triggerSuccess(k, val, primKey) {
@@ -13082,7 +13066,7 @@
13082
13066
  // We have pre-loaded data for the cursor
13083
13067
  me.__prefetchedIndex++;
13084
13068
  if (me.__prefetchedIndex < me.__prefetchedData.length) {
13085
- me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13069
+ me.__decode(/** @type {RowItemNonNull} */me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13086
13070
  /**
13087
13071
  * @returns {void}
13088
13072
  */
@@ -13140,8 +13124,8 @@
13140
13124
  me.__find(key, primaryKey, tx, triggerSuccess, /** @type {FindError} */
13141
13125
  function () {
13142
13126
  me.__advanceCount = undefined;
13143
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
13144
- args[_key3] = arguments[_key3];
13127
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13128
+ args[_key] = arguments[_key];
13145
13129
  }
13146
13130
  var t = args[0],
13147
13131
  err = args[1];
@@ -13227,12 +13211,18 @@
13227
13211
  };
13228
13212
 
13229
13213
  /**
13230
- * @typedef {any} AnyValue
13214
+ * The `{query, count, direction}` options shape shared by
13215
+ * `getAll`/`getAllKeys`/`getAllRecords`.
13216
+ * @typedef {{
13217
+ * query?: import('./IDBIndex.js').Query|null,
13218
+ * count?: Integer,
13219
+ * direction?: IDBCursorDirection
13220
+ * }} GetAllOptions
13231
13221
  */
13232
13222
 
13233
13223
  /**
13234
13224
  *
13235
- * @param {AnyValue} valueToUpdate
13225
+ * @param {import('./Key.js').Value} valueToUpdate
13236
13226
  * @this {IDBCursorFull}
13237
13227
  * @returns {IDBRequest}
13238
13228
  */
@@ -13358,25 +13348,22 @@
13358
13348
  var IDBCursorWithValueAlias = IDBCursorWithValue;
13359
13349
  /**
13360
13350
  *
13361
- * @param {...any} args
13351
+ * @param {IDBKeyRange} query
13352
+ * @param {string} direction
13353
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
13354
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
13355
+ * import('./IDBIndex.js').IDBIndexFull} source
13356
+ * @param {string} keyColumnName
13357
+ * @param {string} valueColumnName
13358
+ * @param {boolean} [count]
13362
13359
  * @returns {IDBCursorWithValueFull}
13363
13360
  */
13364
- IDBCursorWithValue.__createInstance = function () {
13365
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
13366
- args[_key4] = arguments[_key4];
13367
- }
13361
+ IDBCursorWithValue.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
13368
13362
  /**
13369
13363
  * @class
13370
13364
  * @this {IDBCursorWithValueFull}
13371
13365
  */
13372
13366
  function IDBCursorWithValue() {
13373
- var query = args[0],
13374
- direction = args[1],
13375
- store = args[2],
13376
- source = args[3],
13377
- keyColumnName = args[4],
13378
- valueColumnName = args[5],
13379
- count = args[6];
13380
13367
  IDBCursor.__super.call(this, query, direction, store, source, keyColumnName, valueColumnName, count);
13381
13368
  // @ts-expect-error It's ok
13382
13369
  this[Symbol.toStringTag] = 'IDBCursorWithValue';
@@ -13399,12 +13386,16 @@
13399
13386
  /**
13400
13387
  * Validates `direction` and fills in defaults for the `{query, count,
13401
13388
  * direction}` shape shared by `getAll`/`getAllKeys`/`getAllRecords`.
13402
- * @param {AnyValue} options
13389
+ * @param {unknown} options
13403
13390
  * @throws {TypeError}
13404
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13391
+ * @returns {{
13392
+ * query: import('./IDBIndex.js').Query|null|undefined,
13393
+ * count: Integer|undefined,
13394
+ * direction: string
13395
+ * }}
13405
13396
  */
13406
13397
  function normalizeGetAllOptions(options) {
13407
- var _ref = /** @type {AnyValue} */options !== null && options !== void 0 ? options : {},
13398
+ var _ref = /** @type {GetAllOptions} */options !== null && options !== void 0 ? options : {},
13408
13399
  query = _ref.query,
13409
13400
  count = _ref.count,
13410
13401
  _ref$direction = _ref.direction,
@@ -13433,7 +13424,11 @@
13433
13424
  * first argument wins regardless of how many arguments were actually passed.
13434
13425
  * @param {IArguments} args
13435
13426
  * @throws {TypeError}
13436
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13427
+ * @returns {{
13428
+ * query: import('./IDBIndex.js').Query|null|undefined,
13429
+ * count: Integer|undefined,
13430
+ * direction: string
13431
+ * }}
13437
13432
  */
13438
13433
  function parseGetAllArgs(args) {
13439
13434
  var arg0 = args[0];
@@ -13456,7 +13451,11 @@
13456
13451
  * form to disambiguate against.
13457
13452
  * @param {IArguments} args
13458
13453
  * @throws {TypeError}
13459
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13454
+ * @returns {{
13455
+ * query: import('./IDBIndex.js').Query|null|undefined,
13456
+ * count: Integer|undefined,
13457
+ * direction: string
13458
+ * }}
13460
13459
  */
13461
13460
  function parseGetAllRecordsArgs(args) {
13462
13461
  return normalizeGetAllOptions(args[0]);
@@ -13563,7 +13562,7 @@
13563
13562
  value: direction
13564
13563
  });
13565
13564
  return tx.__addToTransactionQueue(function collectAllOp(sqlTx, args, success, error) {
13566
- /** @type {AnyValue[]} */
13565
+ /** @type {unknown[]} */
13567
13566
  var results = [];
13568
13567
  var recordsToLoad = count || CFG.cursorPreloadPackSize || 100;
13569
13568
 
@@ -13603,7 +13602,7 @@
13603
13602
  if (state.__prefetchedData) {
13604
13603
  state.__prefetchedIndex++;
13605
13604
  if (state.__prefetchedIndex < state.__prefetchedData.length) {
13606
- IDBCursor.prototype.__decode.call(state, state.__prefetchedData.item(state.__prefetchedIndex),
13605
+ IDBCursor.prototype.__decode.call(state, /** @type {RowItemNonNull} */state.__prefetchedData.item(state.__prefetchedIndex),
13607
13606
  /**
13608
13607
  * @param {import('./Key.js').Key} k
13609
13608
  * @param {import('./Key.js').Value} val
@@ -13633,15 +13632,11 @@
13633
13632
  }, undefined, source);
13634
13633
  }
13635
13634
 
13636
- /**
13637
- * @typedef {any} AnyValue
13638
- */
13639
-
13640
13635
  /**
13641
13636
  * @callback SetConfig
13642
13637
  * @param {import('./CFG.js').KeyofConfigValues|
13643
13638
  * Partial<import('./CFG.js').ConfigValues>} prop
13644
- * @param {AnyValue} [val]
13639
+ * @param {import('./CFG.js').ConfigValue} [val]
13645
13640
  * @throws {Error}
13646
13641
  * @returns {void}
13647
13642
  */
@@ -13726,18 +13721,9 @@
13726
13721
  function setGlobalVars(idb, initialConfig) {
13727
13722
  var IDB = /** @type {ShimmedObject & {[key: string]: unknown}} */
13728
13723
  /** @type {unknown} */globalThis || {};
13729
- /**
13730
- * @typedef {any} AnyClass
13731
- */
13732
- /**
13733
- * @typedef {any} AnyValue
13734
- */
13735
- /**
13736
- * @typedef {Function} AnyFunction
13737
- */
13738
13724
  /**
13739
13725
  * @param {string} name
13740
- * @param {AnyClass} value
13726
+ * @param {unknown} value
13741
13727
  * @param {PropertyDescriptor & {
13742
13728
  * shimNS?: object
13743
13729
  * }|undefined} [propDesc]
@@ -13765,7 +13751,7 @@
13765
13751
  }
13766
13752
  } else {
13767
13753
  var o = _defineAccessor("get", {}, name, function () {
13768
- return /** @type {AnyFunction} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13754
+ return /** @type {() => unknown} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13769
13755
  });
13770
13756
  desc = /** @type {PropertyDescriptor} */
13771
13757
  Object.getOwnPropertyDescriptor(o, name);
@@ -13839,7 +13825,7 @@
13839
13825
  return shimIndexedDB$1;
13840
13826
  }
13841
13827
  });
13842
- /** @type {[string, any][]} */
13828
+ /** @type {[string, unknown][]} */
13843
13829
  [['IDBFactory', shimIDBFactory], ['IDBDatabase', IDBDatabase], ['IDBObjectStore', IDBObjectStore], ['IDBIndex', IDBIndex], ['IDBTransaction', IDBTransaction], ['IDBCursor', IDBCursor], ['IDBCursorWithValue', IDBCursorWithValue], ['IDBRecord', IDBRecord], ['IDBKeyRange', IDBKeyRange], ['IDBRequest', IDBRequest], ['IDBOpenDBRequest', IDBOpenDBRequest], ['IDBVersionChangeEvent', IDBVersionChangeEvent]].forEach(function (_ref3) {
13844
13830
  var _ref4 = _slicedToArray(_ref3, 2),
13845
13831
  prop = _ref4[0],
@@ -13928,7 +13914,7 @@
13928
13914
  IDB.shimIndexedDB = /** @type {ShimIndexedDB} */{};
13929
13915
  /** @type {const} */
13930
13916
  ['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach(function (prop) {
13931
- /** @type {ShimIndexedDB} */IDB.shimIndexedDB[prop] = /** @type {() => any} */function () {
13917
+ /** @type {{[key: string]: () => void}} */(/** @type {unknown} */IDB.shimIndexedDB)[prop] = function () {
13932
13918
  console.warn('This browser does not have WebSQL to shim.');
13933
13919
  };
13934
13920
  });