indexeddbshim 17.7.0 → 19.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.
Files changed (69) hide show
  1. package/README.md +13 -3
  2. package/dist/DOMException.d.ts +5 -9
  3. package/dist/DOMException.d.ts.map +1 -1
  4. package/dist/DOMStringList.d.ts +1 -2
  5. package/dist/DOMStringList.d.ts.map +1 -1
  6. package/dist/IDBCursor.d.ts +106 -52
  7. package/dist/IDBCursor.d.ts.map +1 -1
  8. package/dist/IDBFactory.d.ts.map +1 -1
  9. package/dist/IDBIndex.d.ts +8 -7
  10. package/dist/IDBIndex.d.ts.map +1 -1
  11. package/dist/IDBKeyRange.d.ts +3 -3
  12. package/dist/IDBKeyRange.d.ts.map +1 -1
  13. package/dist/IDBObjectStore.d.ts +12 -12
  14. package/dist/IDBObjectStore.d.ts.map +1 -1
  15. package/dist/IDBRequest.d.ts +2 -2
  16. package/dist/IDBRequest.d.ts.map +1 -1
  17. package/dist/IDBTransaction.d.ts +13 -13
  18. package/dist/IDBTransaction.d.ts.map +1 -1
  19. package/dist/Key.d.ts +14 -15
  20. package/dist/Key.d.ts.map +1 -1
  21. package/dist/Sca.d.ts +2 -2
  22. package/dist/Sca.d.ts.map +1 -1
  23. package/dist/cmp.d.ts +3 -3
  24. package/dist/cmp.d.ts.map +1 -1
  25. package/dist/indexeddbshim-Key.js +37 -46
  26. package/dist/indexeddbshim-Key.js.map +1 -1
  27. package/dist/indexeddbshim-Key.min.js +2 -2
  28. package/dist/indexeddbshim-Key.min.js.map +1 -1
  29. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +254 -215
  30. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  31. package/dist/indexeddbshim-UnicodeIdentifiers.js +251 -450
  32. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  33. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +3 -3
  34. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  35. package/dist/indexeddbshim-node.cjs +254 -215
  36. package/dist/indexeddbshim-node.cjs.map +1 -1
  37. package/dist/indexeddbshim-noninvasive.js +251 -450
  38. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  39. package/dist/indexeddbshim-noninvasive.min.js +3 -3
  40. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  41. package/dist/indexeddbshim.js +251 -450
  42. package/dist/indexeddbshim.js.map +1 -1
  43. package/dist/indexeddbshim.min.js +3 -3
  44. package/dist/indexeddbshim.min.js.map +1 -1
  45. package/dist/nodeWebSQL.d.ts +2 -2
  46. package/dist/nodeWebSQL.d.ts.map +1 -1
  47. package/dist/setGlobalVars.d.ts +1 -2
  48. package/dist/setGlobalVars.d.ts.map +1 -1
  49. package/dist/util.d.ts +35 -22
  50. package/dist/util.d.ts.map +1 -1
  51. package/package.json +1 -4
  52. package/src/CFG.js +1 -1
  53. package/src/DOMException.js +9 -11
  54. package/src/DOMStringList.js +6 -11
  55. package/src/Event.js +1 -4
  56. package/src/IDBCursor.js +98 -47
  57. package/src/IDBFactory.js +12 -11
  58. package/src/IDBIndex.js +10 -12
  59. package/src/IDBKeyRange.js +6 -5
  60. package/src/IDBObjectStore.js +32 -27
  61. package/src/IDBRequest.js +1 -1
  62. package/src/IDBTransaction.js +11 -11
  63. package/src/IDBVersionChangeEvent.js +1 -4
  64. package/src/Key.js +32 -31
  65. package/src/Sca.js +1 -1
  66. package/src/cmp.js +2 -2
  67. package/src/nodeWebSQL.js +5 -2
  68. package/src/setGlobalVars.js +8 -19
  69. package/src/util.js +42 -17
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v17.7.0 - 9/2/2026 */
1
+ /*! indexeddbshim - v19.0.0 - 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];
@@ -1912,7 +1905,7 @@
1912
1905
  // Callback not used by default
1913
1906
  // Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
1914
1907
  'escapeNULForSQLiteStatements', 'sqlMemoryQuota', 'createIndexes'].forEach(function (prop) {
1915
- /** @type {(val: any) => void} */
1908
+ /** @type {(val: ConfigValue) => void} */
1916
1909
  var validator;
1917
1910
  if (Array.isArray(prop)) {
1918
1911
  var _prop = prop;
@@ -2112,8 +2105,32 @@
2112
2105
  }
2113
2106
 
2114
2107
  /**
2115
- * @typedef {Function} AnyClass
2108
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
2109
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
2110
+ * `base` is a directory path expected to be absolute and normalized (an
2111
+ * empty string means the current working directory). Unlike `path.join`,
2112
+ * this performs no `.`/`..` resolution. It reuses the separator style of
2113
+ * `base` (backslash only when `base` uses backslashes and no forward
2114
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
2115
+ * `websql-configurable` accept either separator on Windows regardless.
2116
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
2117
+ * @param {string} base
2118
+ * @param {string} name
2119
+ * @returns {string}
2120
+ */
2121
+ function joinPath(base, name) {
2122
+ if (!base) {
2123
+ return name;
2124
+ }
2125
+ var sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
2126
+ return base.replace(/[\/\\]+$/, '') + sep + name;
2127
+ }
2128
+
2129
+ /* eslint-disable jsdoc/valid-types -- Bug */
2130
+ /**
2131
+ * @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
2116
2132
  */
2133
+ /* eslint-enable jsdoc/valid-types -- Bug */
2117
2134
 
2118
2135
  // Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
2119
2136
  /**
@@ -2137,7 +2154,7 @@
2137
2154
 
2138
2155
  /**
2139
2156
  *
2140
- * @param {object} obj
2157
+ * @param {AnyValue} obj
2141
2158
  * @returns {boolean}
2142
2159
  */
2143
2160
  function isDate(obj) {
@@ -2146,7 +2163,7 @@
2146
2163
 
2147
2164
  /**
2148
2165
  *
2149
- * @param {object} obj
2166
+ * @param {AnyValue} obj
2150
2167
  * @returns {boolean}
2151
2168
  */
2152
2169
  function isBlob(obj) {
@@ -2155,7 +2172,7 @@
2155
2172
 
2156
2173
  /**
2157
2174
  *
2158
- * @param {object} obj
2175
+ * @param {AnyValue} obj
2159
2176
  * @returns {boolean}
2160
2177
  */
2161
2178
  function isFile(obj) {
@@ -2177,7 +2194,7 @@
2177
2194
  /**
2178
2195
  *
2179
2196
  * @param {AnyValue} obj
2180
- * @returns {boolean}
2197
+ * @returns {obj is Iterable<unknown>}
2181
2198
  */
2182
2199
  function isIterable(obj) {
2183
2200
  return isObj(obj) &&
@@ -2223,9 +2240,7 @@
2223
2240
 
2224
2241
  /**
2225
2242
  *
2226
- * @param {object & {
2227
- * [key: string]: any
2228
- * }} obj
2243
+ * @param {object} obj
2229
2244
  * @param {string[]} listeners
2230
2245
  * @returns {void}
2231
2246
  */
@@ -2233,9 +2248,9 @@
2233
2248
  listeners = typeof listeners === 'string' ? [listeners] : listeners;
2234
2249
  listeners.forEach(function (listener) {
2235
2250
  var o = _defineAccessor("set", _defineAccessor("get", {}, listener, function () {
2236
- return obj['__' + listener];
2251
+ return Reflect.get(obj, '__' + listener);
2237
2252
  }), listener, function (val) {
2238
- obj['__' + listener] = val;
2253
+ Reflect.set(obj, '__' + listener, val);
2239
2254
  });
2240
2255
  var desc = /** @type {PropertyDescriptor} */
2241
2256
  Object.getOwnPropertyDescriptor(o, listener);
@@ -2244,7 +2259,7 @@
2244
2259
  Object.defineProperty(obj, listener, desc);
2245
2260
  });
2246
2261
  listeners.forEach(function (l) {
2247
- obj[l] = null;
2262
+ Reflect.set(obj, l, null);
2248
2263
  });
2249
2264
  }
2250
2265
 
@@ -2253,7 +2268,7 @@
2253
2268
  * @param {object} obj
2254
2269
  * @param {string|string[]} props
2255
2270
  * @param {null|{
2256
- * [key: string]: any
2271
+ * [key: string]: unknown
2257
2272
  * }} getter
2258
2273
  * @returns {void}
2259
2274
  */
@@ -2389,7 +2404,7 @@
2389
2404
  }
2390
2405
 
2391
2406
  /**
2392
- * @typedef {any} AnyValue
2407
+ * @typedef {unknown} AnyValue
2393
2408
  */
2394
2409
 
2395
2410
  /**
@@ -2407,8 +2422,11 @@
2407
2422
  */
2408
2423
  function ToString(o) {
2409
2424
  // Todo: See `es-abstract/es7`
2410
- // `String()` will not throw with Symbols
2411
- return '' + o; // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2425
+ // `String()` will not throw with Symbols, but the unchecked `+ ''`
2426
+ // coercion deliberately does (Web IDL requires converting a symbol
2427
+ // to `DOMString` to throw a `TypeError`); the assertion only tells
2428
+ // the compiler to allow the coercion it cannot model.
2429
+ return '' + (/** @type {string} */o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2412
2430
  }
2413
2431
 
2414
2432
  /**
@@ -2515,12 +2533,9 @@
2515
2533
  // We don't add within polyfill repo as might not always be the desired implementation
2516
2534
  Object.defineProperty(ShimEvent, Symbol.hasInstance, {
2517
2535
  /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2518
- /**
2519
- * @typedef {any} AnyValue
2520
- */
2521
2536
  value:
2522
2537
  /**
2523
- * @param {AnyValue} obj
2538
+ * @param {unknown} obj
2524
2539
  * @returns {boolean}
2525
2540
  */
2526
2541
  function value(obj) {
@@ -2591,12 +2606,9 @@
2591
2606
  Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);
2592
2607
  });
2593
2608
  Object.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {
2594
- /**
2595
- * @typedef {any} AnyValue
2596
- */
2597
2609
  value:
2598
2610
  /**
2599
- * @param {AnyValue} obj
2611
+ * @param {unknown} obj
2600
2612
  * @returns {boolean}
2601
2613
  */
2602
2614
  function value(obj) {
@@ -2854,7 +2866,7 @@
2854
2866
 
2855
2867
  /**
2856
2868
  * @typedef {{
2857
- * message: string|DOMString
2869
+ * message: string
2858
2870
  * }} ErrorLike
2859
2871
  */
2860
2872
 
@@ -2878,25 +2890,20 @@
2878
2890
  }
2879
2891
 
2880
2892
  /**
2881
- * @typedef {any} ArbitraryValue
2882
- */
2883
-
2884
- /**
2885
- * @param {ArbitraryValue} obj
2893
+ * @param {unknown} obj
2886
2894
  * @returns {boolean}
2887
2895
  */
2888
2896
  function isErrorOrDOMErrorOrDOMException(obj) {
2889
- return obj && _typeof(obj) === 'object' &&
2890
2897
  // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
2891
- typeof obj.name === 'string';
2898
+ return _typeof(obj) === 'object' && obj !== null && 'name' in obj && typeof obj.name === 'string';
2892
2899
  }
2893
2900
 
2894
2901
  /**
2895
2902
  * Finds the error argument. This is useful because some WebSQL callbacks
2896
2903
  * pass the error as the first argument, and some pass it as the second
2897
2904
  * argument.
2898
- * @param {(Error|{message?: string, name?: string}|any)[]} args
2899
- * @returns {Error|DOMException|undefined}
2905
+ * @param {unknown[]} args
2906
+ * @returns {unknown}
2900
2907
  */
2901
2908
  function findError(args) {
2902
2909
  var err;
@@ -2912,7 +2919,7 @@
2912
2919
  if (isErrorOrDOMErrorOrDOMException(arg)) {
2913
2920
  return arg;
2914
2921
  }
2915
- if (arg && typeof arg.message === 'string') {
2922
+ if (_typeof(arg) === 'object' && arg !== null && 'message' in arg && typeof arg.message === 'string') {
2916
2923
  err = arg;
2917
2924
  }
2918
2925
  }
@@ -3037,7 +3044,7 @@
3037
3044
  * @typedef {IDBRequest & EventTarget & import('eventtargeter').EventTargetInstance & {
3038
3045
  * transaction: import('./IDBTransaction.js').IDBTransactionFull,
3039
3046
  * __done: boolean,
3040
- * __result: import('./IDBDatabase.js').IDBDatabaseFull|undefined,
3047
+ * __result: unknown,
3041
3048
  * __error: null|DOMException|Error,
3042
3049
  * __source: null|import('./IDBDatabase.js').IDBDatabaseFull|
3043
3050
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
@@ -3507,8 +3514,8 @@
3507
3514
 
3508
3515
  /**
3509
3516
  * Compares two keys.
3510
- * @param {import('./Key.js').Key} first
3511
- * @param {import('./Key.js').Key} second
3517
+ * @param {import('./Key.js').Key|null|undefined} first
3518
+ * @param {import('./Key.js').Key|null|undefined} second
3512
3519
  * @returns {0|1|-1}
3513
3520
  */
3514
3521
  function cmp(first, second) {
@@ -3585,12 +3592,11 @@
3585
3592
  */
3586
3593
 
3587
3594
  /**
3588
- * @typedef {any} Value
3595
+ * @typedef {unknown} Value
3589
3596
  */
3590
3597
 
3591
3598
  /**
3592
- * @typedef {any} Key
3593
- * @todo Specify possible value more precisely
3599
+ * @typedef {IDBValidKey} Key
3594
3600
  */
3595
3601
 
3596
3602
  /**
@@ -3657,15 +3663,11 @@
3657
3663
  */
3658
3664
  var signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
3659
3665
 
3660
- /**
3661
- * @typedef {any} AnyValue
3662
- */
3663
-
3664
3666
  /**
3665
3667
  * @type {{
3666
3668
  * [key: string]: {
3667
- * encode: (param: any, inArray?: boolean) => string,
3668
- * decode: (param: string, inArray?: boolean) => any
3669
+ * encode(param: unknown, inArray?: boolean): string,
3670
+ * decode(param: string, inArray?: boolean): ValueType|undefined
3669
3671
  * }
3670
3672
  * }}
3671
3673
  */
@@ -4020,7 +4022,7 @@
4020
4022
  }
4021
4023
 
4022
4024
  /**
4023
- * @param {Key} key
4025
+ * @param {Value} key
4024
4026
  * @returns {KeyType|"invalid"}
4025
4027
  */
4026
4028
  function getKeyType(key) {
@@ -4164,7 +4166,7 @@
4164
4166
  case 'array':
4165
4167
  {
4166
4168
  // May throw (from binary)
4167
- var arr = /** @type {Array<any>} */input;
4169
+ var arr = /** @type {unknown[]} */input;
4168
4170
  var len = arr.length;
4169
4171
  safePush(seen, input);
4170
4172
 
@@ -4197,9 +4199,9 @@
4197
4199
  };
4198
4200
  }
4199
4201
  if (!multiEntry || !fullKeys && keys.every(function (k) {
4200
- return cmp(k, key.value) !== 0;
4202
+ return cmp(/** @type {Key} */k, /** @type {Key} */key.value) !== 0;
4201
4203
  }) || fullKeys && keys.every(function (k) {
4202
- return cmp(k, key) !== 0;
4204
+ return cmp(/** @type {Key} */k, /** @type {Key} */ /** @type {unknown} */key) !== 0;
4203
4205
  })) {
4204
4206
  safePush(keys, fullKeys ? key : key.value);
4205
4207
  }
@@ -4256,7 +4258,7 @@
4256
4258
 
4257
4259
  /**
4258
4260
  *
4259
- * @param {Key} key
4261
+ * @param {Value} key
4260
4262
  * @param {boolean} [fullKeys]
4261
4263
  * @returns {KeyValueObject}
4262
4264
  * @todo Document other allowable `key`?
@@ -4371,7 +4373,7 @@
4371
4373
  }
4372
4374
  if (keyPath === '') {
4373
4375
  return {
4374
- value: value
4376
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4375
4377
  };
4376
4378
  }
4377
4379
  var identifiers = keyPath.split('.');
@@ -4405,13 +4407,13 @@
4405
4407
  }) ? {
4406
4408
  failure: true
4407
4409
  } : {
4408
- value: value
4410
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4409
4411
  };
4410
4412
  }
4411
4413
 
4412
4414
  /**
4413
4415
  * Sets the inline key value.
4414
- * @param {{[key: string]: AnyValue}} value
4416
+ * @param {{[key: string]: Value}} value
4415
4417
  * @param {Key} key
4416
4418
  * @param {string} keyPath
4417
4419
  * @returns {void}
@@ -4429,7 +4431,7 @@
4429
4431
  configurable: true
4430
4432
  });
4431
4433
  }
4432
- value = value[identifier];
4434
+ value = /** @type {{[key: string]: Value}} */value[identifier];
4433
4435
  });
4434
4436
  Object.defineProperty(value, /** @type {string} */last, {
4435
4437
  value: key,
@@ -4514,7 +4516,7 @@
4514
4516
  * @returns {Key[]}
4515
4517
  */
4516
4518
  function findMultiEntryMatches(keyEntry, range) {
4517
- /** @type {unknown[]} */
4519
+ /** @type {Key[]} */
4518
4520
  var matches = [];
4519
4521
  if (Array.isArray(keyEntry)) {
4520
4522
  var _iterator4 = _createForOfIteratorHelper(keyEntry),
@@ -4553,7 +4555,7 @@
4553
4555
 
4554
4556
  /**
4555
4557
  * Not currently in use but keeping for spec parity.
4556
- * @param {Key} key
4558
+ * @param {KeyValueObject} key
4557
4559
  * @throws {Error} Upon a "bad key"
4558
4560
  * @returns {ValueType}
4559
4561
  */
@@ -4564,16 +4566,17 @@
4564
4566
  case 'number':
4565
4567
  case 'string':
4566
4568
  {
4567
- return value;
4569
+ return /** @type {number|string} */value;
4568
4570
  }
4569
4571
  case 'array':
4570
4572
  {
4571
4573
  /** @type {ValueType[]} */
4572
4574
  var array = [];
4573
- var len = value.length;
4575
+ var arrValue = /** @type {KeyValueObject[]} */value;
4576
+ var len = arrValue.length;
4574
4577
  var index = 0;
4575
4578
  while (index < len) {
4576
- var entry = convertKeyToValue(value[index]);
4579
+ var entry = convertKeyToValue(arrValue[index]);
4577
4580
  setArrayValue(array, index, entry);
4578
4581
  index++;
4579
4582
  }
@@ -4581,18 +4584,18 @@
4581
4584
  }
4582
4585
  case 'date':
4583
4586
  {
4584
- return new Date(value);
4587
+ return new Date(/** @type {number} */value);
4585
4588
  }
4586
4589
  case 'binary':
4587
4590
  {
4588
- var _len = value.length;
4591
+ var binValue = /** @type {Uint8Array} */value;
4592
+ var _len = binValue.length;
4589
4593
  var buffer = new ArrayBuffer(_len);
4590
4594
  // Set the entries in buffer's [[ArrayBufferData]] to those in `value`
4591
- var uint8 = new Uint8Array(buffer, value.byteOffset || 0, value.byteLength);
4592
- uint8.set(value);
4595
+ var uint8 = new Uint8Array(buffer, binValue.byteOffset || 0, binValue.byteLength);
4596
+ uint8.set(binValue);
4593
4597
  return buffer;
4594
4598
  }
4595
- case 'invalid':
4596
4599
  default:
4597
4600
  throw new Error('Bad key');
4598
4601
  }
@@ -4600,7 +4603,7 @@
4600
4603
 
4601
4604
  /**
4602
4605
  *
4603
- * @param {Key} key
4606
+ * @param {Value} key
4604
4607
  * @param {boolean} [inArray]
4605
4608
  * @returns {string|null}
4606
4609
  */
@@ -4615,7 +4618,7 @@
4615
4618
 
4616
4619
  /**
4617
4620
  *
4618
- * @param {Key} key
4621
+ * @param {string|null} key
4619
4622
  * @param {boolean} [inArray]
4620
4623
  * @throws {Error} Invalid number
4621
4624
  * @returns {undefined|ValueType}
@@ -4629,7 +4632,7 @@
4629
4632
 
4630
4633
  /**
4631
4634
  *
4632
- * @param {Key} key
4635
+ * @param {Value} key
4633
4636
  * @param {boolean} [inArray]
4634
4637
  * @returns {undefined|ValueType}
4635
4638
  */
@@ -4847,8 +4850,8 @@
4847
4850
  var IDBKeyRangeAlias = IDBKeyRange;
4848
4851
 
4849
4852
  /**
4850
- * @param {import('./Key.js').Key|null} lower
4851
- * @param {import('./Key.js').Key|null} upper
4853
+ * @param {import('./Key.js').Value} lower
4854
+ * @param {import('./Key.js').Value} upper
4852
4855
  * @param {boolean} lowerOpen
4853
4856
  * @param {boolean} upperOpen
4854
4857
  * @returns {import('./IDBKeyRange.js').IDBKeyRangeFull}
@@ -5045,10 +5048,11 @@
5045
5048
  function convertValueToKeyRange(value, nullDisallowed) {
5046
5049
  if (instanceOf(value, IDBKeyRange)) {
5047
5050
  // We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)
5048
- if (value.toString() !== '[object IDBKeyRange]') {
5049
- return IDBKeyRange.__createInstance(value.lower, value.upper, value.lowerOpen, value.upperOpen);
5051
+ var range = /** @type {IDBKeyRangeFull} */value;
5052
+ if (range.toString() !== '[object IDBKeyRange]') {
5053
+ return IDBKeyRange.__createInstance(range.lower, range.upper, range.lowerOpen, range.upperOpen);
5050
5054
  }
5051
- return value;
5055
+ return range;
5052
5056
  }
5053
5057
  if (isNullish(value)) {
5054
5058
  if (nullDisallowed) {
@@ -5075,7 +5079,7 @@
5075
5079
  * clone: () => DOMStringListFull,
5076
5080
  * contains: (str: string) => boolean,
5077
5081
  * indexOf: (str: string) => Integer,
5078
- * splice: (index: Integer, howmany: Integer, ...args: any) => void
5082
+ * splice: (index: Integer, howmany: Integer, ...args: string[]) => void
5079
5083
  * length: Integer
5080
5084
  * }} DOMStringListFull
5081
5085
  */
@@ -5191,9 +5195,10 @@
5191
5195
  },
5192
5196
  /**
5193
5197
  * @this {DOMStringListFull}
5194
- * @param {(value: string, i: Integer, arr: string[]) => any[]} cb
5198
+ * @template T
5199
+ * @param {(value: string, i: Integer, arr: string[]) => T} cb
5195
5200
  * @param {object} thisArg
5196
- * @returns {any[]}
5201
+ * @returns {T[]}
5197
5202
  */
5198
5203
  map: function map(cb, thisArg) {
5199
5204
  // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
@@ -5218,10 +5223,7 @@
5218
5223
  this.sortList();
5219
5224
  },
5220
5225
  /**
5221
- * @typedef {any} AnyArgs
5222
- */
5223
- /**
5224
- * @param {[index: Integer, howmany: Integer, ...args: any]} args
5226
+ * @param {[index: Integer, howmany: Integer, ...args: string[]]} args
5225
5227
  * @this {DOMStringListFull}
5226
5228
  * @returns {void}
5227
5229
  */
@@ -5259,12 +5261,9 @@
5259
5261
  }));
5260
5262
 
5261
5263
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
5262
- /**
5263
- * @typedef {any} AnyValue
5264
- */
5265
5264
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
5266
5265
  /**
5267
- * @param {AnyValue} obj
5266
+ * @param {unknown} obj
5268
5267
  * @returns {boolean}
5269
5268
  */
5270
5269
  value: function value(obj) {
@@ -5345,7 +5344,7 @@
5345
5344
  /**
5346
5345
  * @typedef {{
5347
5346
  * op: SQLCallback,
5348
- * args: ObjectArray,
5347
+ * args: unknown[],
5349
5348
  * req: import('./IDBRequest.js').IDBRequestFull|null
5350
5349
  * }} RequestInfo
5351
5350
  */
@@ -5397,17 +5396,17 @@
5397
5396
  * __pushToQueue: (
5398
5397
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5399
5398
  * callback: SQLCallback,
5400
- * args?: ObjectArray
5399
+ * args?: unknown[]
5401
5400
  * ) => void,
5402
5401
  * __assertActive: () => void,
5403
5402
  * commit: () => void,
5404
5403
  * __addNonRequestToTransactionQueue: (
5405
5404
  * callback: SQLCallback,
5406
- * args?: ObjectArray
5405
+ * args?: unknown[]
5407
5406
  * ) => void
5408
5407
  * __addToTransactionQueue: (
5409
5408
  * callback: SQLCallback,
5410
- * args: ObjectArray|undefined,
5409
+ * args: unknown[]|undefined,
5411
5410
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5412
5411
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5413
5412
  * import('./IDBIndex.js').IDBIndexFull|
@@ -5609,7 +5608,7 @@
5609
5608
  i = -1;
5610
5609
 
5611
5610
  /**
5612
- * @typedef {any} IDBRequestResult
5611
+ * @typedef {unknown} IDBRequestResult
5613
5612
  */
5614
5613
 
5615
5614
  /**
@@ -6045,8 +6044,8 @@
6045
6044
  /**
6046
6045
  * @typedef {(
6047
6046
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6048
- * args: ObjectArray,
6049
- * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6047
+ * args: unknown[],
6048
+ * success: (result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6050
6049
  * error: (
6051
6050
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
6052
6051
  * err?: Error & {code?: number}
@@ -6058,7 +6057,7 @@
6058
6057
  /**
6059
6058
  * Adds a callback function to the transaction queue.
6060
6059
  * @param {SQLCallback} callback
6061
- * @param {ObjectArray} args
6060
+ * @param {unknown[]} args
6062
6061
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6063
6062
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6064
6063
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6075,7 +6074,7 @@
6075
6074
  * Adds a callback function to the transaction queue without generating a
6076
6075
  * request.
6077
6076
  * @param {SQLCallback} callback
6078
- * @param {ObjectArray} args
6077
+ * @param {unknown[]} args
6079
6078
  * @this {IDBTransactionFull}
6080
6079
  * @returns {void}
6081
6080
  */
@@ -6087,7 +6086,7 @@
6087
6086
  * Adds an IDBRequest to the transaction queue.
6088
6087
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6089
6088
  * @param {SQLCallback} callback
6090
- * @param {ObjectArray} args
6089
+ * @param {unknown[]} args
6091
6090
  * @this {IDBTransactionFull}
6092
6091
  * @returns {void}
6093
6092
  */
@@ -6258,7 +6257,7 @@
6258
6257
  bubbles: true,
6259
6258
  cancelable: true
6260
6259
  });
6261
- return new SyncPromise(/** @type {(resolve: (value?: any) => void) => void} */
6260
+ return new SyncPromise(/** @type {(resolve: (value?: unknown) => void) => void} */
6262
6261
  function (resolve) {
6263
6262
  setTimeout(function () {
6264
6263
  if (!q.req) {
@@ -8421,7 +8420,7 @@
8421
8420
  }
8422
8421
 
8423
8422
  /**
8424
- * @typedef {any} AnyValue
8423
+ * @typedef {import('./Key.js').Value} AnyValue
8425
8424
  */
8426
8425
 
8427
8426
  /**
@@ -8531,7 +8530,7 @@
8531
8530
  * __keyPath: import('./Key.js').KeyPath,
8532
8531
  * __recreated?: boolean,
8533
8532
  * __fetchIndexData: (
8534
- * range: any,
8533
+ * range: Query,
8535
8534
  * opType: "value"|"key"|"count",
8536
8535
  * nullDisallowed: boolean,
8537
8536
  * count?: number
@@ -8903,7 +8902,7 @@
8903
8902
  };
8904
8903
 
8905
8904
  /**
8906
- * @typedef {any|IDBKeyRange} Query
8905
+ * @typedef {import('./Key.js').Value|IDBKeyRange} Query
8907
8906
  */
8908
8907
 
8909
8908
  /**
@@ -9186,7 +9185,7 @@
9186
9185
  reject(err);
9187
9186
  });
9188
9187
  }));
9189
- SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: any) => PromiseLike<never>} */
9188
+ SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: unknown) => PromiseLike<never>} */
9190
9189
  error).catch(function (err) {
9191
9190
  console.log('Index rename error');
9192
9191
  throw err;
@@ -9198,14 +9197,10 @@
9198
9197
  });
9199
9198
  };
9200
9199
 
9201
- /**
9202
- * @typedef {any} AnyValue
9203
- */
9204
-
9205
9200
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
9206
9201
  Object.defineProperty(IDBIndex, Symbol.hasInstance, {
9207
9202
  /**
9208
- * @param {AnyValue} obj
9203
+ * @param {unknown} obj
9209
9204
  * @returns {boolean}
9210
9205
  */
9211
9206
  value: function value(obj) {
@@ -9233,7 +9228,9 @@
9233
9228
  * @param {string[]} sqlValues
9234
9229
  * @param {WebSQLTransaction} tx
9235
9230
  * @param {null|undefined} args
9236
- * @param {(result: number|undefined|[]|AnyValue|AnyValue[]) => void} success
9231
+ * @param {(
9232
+ * result: number|undefined|[]|import('./Key.js').Value|import('./Key.js').Value[]
9233
+ * ) => void} success
9237
9234
  * @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
9238
9235
  * @returns {void}
9239
9236
  */
@@ -9270,7 +9267,7 @@
9270
9267
  * @param {{
9271
9268
  * value: string
9272
9269
  * }} record
9273
- * @returns {AnyValue}
9270
+ * @returns {import('./Key.js').Value}
9274
9271
  */
9275
9272
  function (record) {
9276
9273
  // when opType is value
@@ -9284,9 +9281,9 @@
9284
9281
  var rowKey = /** @type {import('./Key.js').ValueTypeArray} */
9285
9282
  _decode(row[escapedIndexNameForKeyCol]);
9286
9283
  var record;
9287
- if (hasKey && (multiChecks && range.some(
9284
+ if (hasKey && (multiChecks && /** @type {import('./Key.js').ValueType[]} */range.some(
9288
9285
  /**
9289
- * @param {string} check
9286
+ * @param {import('./Key.js').ValueType} check
9290
9287
  * @returns {boolean}
9291
9288
  */
9292
9289
  function (check) {
@@ -9437,14 +9434,14 @@
9437
9434
  * __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
9438
9435
  * __validateKeyAndValueAndCloneValue: (
9439
9436
  * value: import('./Key.js').Value,
9440
- * key: import('./Key.js').Key,
9437
+ * key: import('./Key.js').Key|undefined,
9441
9438
  * cursorUpdate: boolean
9442
9439
  * ) => KeyValueArray,
9443
9440
  * __deriveKey: (
9444
9441
  * tx: WebSQLTransaction,
9445
9442
  * value: import('./Key.js').Value,
9446
- * key: import('./Key.js').Key,
9447
- * success: (key: import('./Key.js').Key, cn?: Integer) => void,
9443
+ * key: import('./Key.js').Key|undefined,
9444
+ * success: (key: import('./Key.js').Value, cn?: Integer) => void,
9448
9445
  * failCb: import('./Key.js').SQLFailureCallback
9449
9446
  * ) => void,
9450
9447
  * __checkIndexConstraints: (
@@ -9753,7 +9750,7 @@
9753
9750
  };
9754
9751
 
9755
9752
  /**
9756
- * @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
9753
+ * @typedef {[import('./Key.js').Key|undefined, import('./Key.js').Value]} KeyValueArray
9757
9754
  */
9758
9755
 
9759
9756
  // Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
@@ -9768,7 +9765,7 @@
9768
9765
  * Determines whether the given inline or out-of-line key is valid,
9769
9766
  * according to the object store's schema.
9770
9767
  * @param {import('./Key.js').Value} value Used for inline keys
9771
- * @param {import('./Key.js').Key} key Used for out-of-line keys
9768
+ * @param {import('./Key.js').Key|undefined} key Used for out-of-line keys
9772
9769
  * @param {boolean} cursorUpdate
9773
9770
  * @throws {DOMException}
9774
9771
  * @this {IDBObjectStoreFull}
@@ -9784,11 +9781,11 @@
9784
9781
  // occurs sync; then can make cloning and this method without callbacks (except where ok
9785
9782
  // to be async)
9786
9783
  var _clonedValue = cloneWithInactiveTransaction(/** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction, value);
9787
- key = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9788
- if (key.invalid) {
9784
+ var extractedKey = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9785
+ if ('invalid' in extractedKey && extractedKey.invalid) {
9789
9786
  throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');
9790
9787
  }
9791
- if (key.failure) {
9788
+ if ('failure' in extractedKey && extractedKey.failure) {
9792
9789
  if (!cursorUpdate) {
9793
9790
  if (!me.autoIncrement) {
9794
9791
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
@@ -9803,14 +9800,13 @@
9803
9800
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath');
9804
9801
  }
9805
9802
  // An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key
9806
- return [key.value, _clonedValue];
9803
+ return [(/** @type {import('./Key.js').Key} */extractedKey.value), _clonedValue];
9807
9804
  }
9808
9805
  if (key === undefined) {
9809
9806
  if (!me.autoIncrement) {
9810
9807
  throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
9811
9808
  }
9812
9809
  // A key will be generated
9813
- key = undefined;
9814
9810
  } else {
9815
9811
  convertValueToKeyRethrowingAndIfInvalid(key);
9816
9812
  }
@@ -9825,8 +9821,8 @@
9825
9821
  * a keyPath leading to a valid but non-numeric or < 1 key).
9826
9822
  * @param {WebSQLTransaction} tx
9827
9823
  * @param {import('./Key.js').Value} value
9828
- * @param {import('./Key.js').Key} key
9829
- * @param {(key: import('./Key.js').Key, cn?: Integer) => void} success
9824
+ * @param {import('./Key.js').Key|undefined} key
9825
+ * @param {(key: import('./Key.js').Value, cn?: Integer) => void} success
9830
9826
  * @param {import('./Key.js').SQLFailureCallback} failCb
9831
9827
  * @this {IDBObjectStoreFull}
9832
9828
  * @returns {void}
@@ -9841,9 +9837,8 @@
9841
9837
  */
9842
9838
  function keyCloneThenSuccess(oldCn) {
9843
9839
  // We want to return the original key, so we don't need to accept an argument here
9844
- encode(key, function (key) {
9845
- key = decode(key);
9846
- success(key, oldCn);
9840
+ encode(key, function (encodedKey) {
9841
+ success(decode(encodedKey), oldCn);
9847
9842
  });
9848
9843
  }
9849
9844
  if (me.autoIncrement) {
@@ -9857,7 +9852,7 @@
9857
9852
  if (me.keyPath !== null) {
9858
9853
  // Should not throw now as checked earlier
9859
9854
  // Todo: Could this not be an array here?
9860
- injectKeyIntoValueUsingKeyPath(value, key, /** @type {string} */me.keyPath);
9855
+ injectKeyIntoValueUsingKeyPath(/** @type {{[key: string]: import('./Key.js').Value}} */value, /** @type {import('./Key.js').Key} */key, /** @type {string} */me.keyPath);
9861
9856
  }
9862
9857
  success(key, oldCn);
9863
9858
  }, failCb);
@@ -9914,15 +9909,15 @@
9914
9909
  resolve(undefined);
9915
9910
  return;
9916
9911
  }
9917
- indexKey = indexKey.value;
9918
- if (indexKey === undefined) {
9912
+ var indexKeyValue = indexKey.value;
9913
+ if (indexKeyValue === undefined) {
9919
9914
  resolve(undefined);
9920
9915
  return;
9921
9916
  }
9922
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
9923
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
9917
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
9918
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
9924
9919
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
9925
- if (key === undefined || excludeKey !== undefined && cmp(key, excludeKey) === 0) {
9920
+ if (key === undefined || excludeKey !== undefined && cmp(/** @type {import('./Key.js').Key} */key, excludeKey) === 0) {
9926
9921
  resolve(undefined);
9927
9922
  return;
9928
9923
  }
@@ -9995,21 +9990,21 @@
9995
9990
  resolve(undefined);
9996
9991
  return;
9997
9992
  }
9998
- indexKey = indexKey.value;
9993
+ var indexKeyValue = indexKey.value;
9999
9994
  /**
10000
9995
  * @param {import('./IDBIndex.js').IDBIndexFull} index
10001
9996
  * @returns {void}
10002
9997
  */
10003
9998
  function setIndexInfo(index) {
10004
- if (indexKey === undefined) {
9999
+ if (indexKeyValue === undefined) {
10005
10000
  return;
10006
10001
  }
10007
10002
  paramMap[index.__currentName] = /** @type {string} */
10008
- _encode(indexKey, index.multiEntry);
10003
+ _encode(indexKeyValue, index.multiEntry);
10009
10004
  }
10010
10005
  if (index.unique) {
10011
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
10012
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
10006
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
10007
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
10013
10008
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
10014
10009
  if (key === undefined) {
10015
10010
  setIndexInfo(index);
@@ -10177,7 +10172,9 @@
10177
10172
  var key = arguments[5];
10178
10173
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
10179
10174
  store.transaction.__pushToQueue(request, function (tx, args, success, error) {
10180
- store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
10175
+ store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumberRaw, oldCn) {
10176
+ var clonedKeyOrCurrentNumber = /** @type {import('./Key.js').Key|Integer} */
10177
+ clonedKeyOrCurrentNumberRaw;
10181
10178
  encode(value, function (encoded) {
10182
10179
  /**
10183
10180
  * @param {WebSQLTransaction} tx
@@ -10589,216 +10586,6 @@
10589
10586
  writable: false
10590
10587
  });
10591
10588
 
10592
- // Copyright Joyent, Inc. and other Node contributors.
10593
- //
10594
- // Permission is hereby granted, free of charge, to any person obtaining a
10595
- // copy of this software and associated documentation files (the
10596
- // "Software"), to deal in the Software without restriction, including
10597
- // without limitation the rights to use, copy, modify, merge, publish,
10598
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10599
- // persons to whom the Software is furnished to do so, subject to the
10600
- // following conditions:
10601
- //
10602
- // The above copyright notice and this permission notice shall be included
10603
- // in all copies or substantial portions of the Software.
10604
- //
10605
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10606
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10607
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10608
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10609
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10610
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10611
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
10612
-
10613
- // resolves . and .. elements in a path array with directory names there
10614
- // must be no slashes, empty elements, or device names (c:\) in the array
10615
- // (so also no leading and trailing slashes - it does not distinguish
10616
- // relative and absolute paths)
10617
- function normalizeArray(parts, allowAboveRoot) {
10618
- // if the path tries to go above the root, `up` ends up > 0
10619
- var up = 0;
10620
- for (var i = parts.length - 1; i >= 0; i--) {
10621
- var last = parts[i];
10622
- if (last === '.') {
10623
- parts.splice(i, 1);
10624
- } else if (last === '..') {
10625
- parts.splice(i, 1);
10626
- up++;
10627
- } else if (up) {
10628
- parts.splice(i, 1);
10629
- up--;
10630
- }
10631
- }
10632
-
10633
- // if the path is allowed to go above the root, restore leading ..s
10634
- if (allowAboveRoot) {
10635
- for (; up--; up) {
10636
- parts.unshift('..');
10637
- }
10638
- }
10639
- return parts;
10640
- }
10641
-
10642
- // Split a filename into [root, dir, basename, ext], unix version
10643
- // 'root' is just a slash, or nothing.
10644
- var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
10645
- var splitPath = function splitPath(filename) {
10646
- return splitPathRe.exec(filename).slice(1);
10647
- };
10648
-
10649
- // path.resolve([from ...], to)
10650
- // posix version
10651
- function resolve() {
10652
- var resolvedPath = '',
10653
- resolvedAbsolute = false;
10654
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
10655
- var path = i >= 0 ? arguments[i] : '/';
10656
-
10657
- // Skip empty and invalid entries
10658
- if (typeof path !== 'string') {
10659
- throw new TypeError('Arguments to path.resolve must be strings');
10660
- } else if (!path) {
10661
- continue;
10662
- }
10663
- resolvedPath = path + '/' + resolvedPath;
10664
- resolvedAbsolute = path.charAt(0) === '/';
10665
- }
10666
-
10667
- // At this point the path should be resolved to a full absolute path, but
10668
- // handle relative paths to be safe (might happen when process.cwd() fails)
10669
-
10670
- // Normalize the path
10671
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
10672
- return !!p;
10673
- }), !resolvedAbsolute).join('/');
10674
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
10675
- }
10676
-
10677
- // path.normalize(path)
10678
- // posix version
10679
- function normalize(path) {
10680
- var isPathAbsolute = isAbsolute(path),
10681
- trailingSlash = substr(path, -1) === '/';
10682
-
10683
- // Normalize the path
10684
- path = normalizeArray(filter(path.split('/'), function (p) {
10685
- return !!p;
10686
- }), !isPathAbsolute).join('/');
10687
- if (!path && !isPathAbsolute) {
10688
- path = '.';
10689
- }
10690
- if (path && trailingSlash) {
10691
- path += '/';
10692
- }
10693
- return (isPathAbsolute ? '/' : '') + path;
10694
- }
10695
-
10696
- // posix version
10697
- function isAbsolute(path) {
10698
- return path.charAt(0) === '/';
10699
- }
10700
-
10701
- // posix version
10702
- function join() {
10703
- var paths = Array.prototype.slice.call(arguments, 0);
10704
- return normalize(filter(paths, function (p, index) {
10705
- if (typeof p !== 'string') {
10706
- throw new TypeError('Arguments to path.join must be strings');
10707
- }
10708
- return p;
10709
- }).join('/'));
10710
- }
10711
-
10712
- // path.relative(from, to)
10713
- // posix version
10714
- function relative(from, to) {
10715
- from = resolve(from).substr(1);
10716
- to = resolve(to).substr(1);
10717
- function trim(arr) {
10718
- var start = 0;
10719
- for (; start < arr.length; start++) {
10720
- if (arr[start] !== '') break;
10721
- }
10722
- var end = arr.length - 1;
10723
- for (; end >= 0; end--) {
10724
- if (arr[end] !== '') break;
10725
- }
10726
- if (start > end) return [];
10727
- return arr.slice(start, end - start + 1);
10728
- }
10729
- var fromParts = trim(from.split('/'));
10730
- var toParts = trim(to.split('/'));
10731
- var length = Math.min(fromParts.length, toParts.length);
10732
- var samePartsLength = length;
10733
- for (var i = 0; i < length; i++) {
10734
- if (fromParts[i] !== toParts[i]) {
10735
- samePartsLength = i;
10736
- break;
10737
- }
10738
- }
10739
- var outputParts = [];
10740
- for (var i = samePartsLength; i < fromParts.length; i++) {
10741
- outputParts.push('..');
10742
- }
10743
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
10744
- return outputParts.join('/');
10745
- }
10746
- var sep = '/';
10747
- var delimiter = ':';
10748
- function dirname(path) {
10749
- var result = splitPath(path),
10750
- root = result[0],
10751
- dir = result[1];
10752
- if (!root && !dir) {
10753
- // No dirname whatsoever
10754
- return '.';
10755
- }
10756
- if (dir) {
10757
- // It has a dirname, strip trailing slash
10758
- dir = dir.substr(0, dir.length - 1);
10759
- }
10760
- return root + dir;
10761
- }
10762
- function basename(path, ext) {
10763
- var f = splitPath(path)[2];
10764
- // TODO: make this comparison case-insensitive on windows?
10765
- if (ext && f.substr(-1 * ext.length) === ext) {
10766
- f = f.substr(0, f.length - ext.length);
10767
- }
10768
- return f;
10769
- }
10770
- function extname(path) {
10771
- return splitPath(path)[3];
10772
- }
10773
- var path = {
10774
- extname: extname,
10775
- basename: basename,
10776
- dirname: dirname,
10777
- sep: sep,
10778
- delimiter: delimiter,
10779
- relative: relative,
10780
- join: join,
10781
- isAbsolute: isAbsolute,
10782
- normalize: normalize,
10783
- resolve: resolve
10784
- };
10785
- function filter(xs, f) {
10786
- if (xs.filter) return xs.filter(f);
10787
- var res = [];
10788
- for (var i = 0; i < xs.length; i++) {
10789
- if (f(xs[i], i, xs)) res.push(xs[i]);
10790
- }
10791
- return res;
10792
- }
10793
-
10794
- // String.prototype.substr - negative index don't work in IE8
10795
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
10796
- return str.substr(start, len);
10797
- } : function (str, start, len) {
10798
- if (start < 0) start = str.length + start;
10799
- return str.substr(start, len);
10800
- };
10801
-
10802
10589
  var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
10803
10590
  var readonlyProperties$1 = ['name', 'version', 'objectStoreNames'];
10804
10591
 
@@ -11518,7 +11305,7 @@
11518
11305
  }
11519
11306
  if (fs && CFG.deleteDatabaseFiles !== false) {
11520
11307
  closeCachedWebSQLConnections(name, function () {
11521
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11308
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11522
11309
  if (err && err.code !== 'ENOENT') {
11523
11310
  // Ignore if file is already deleted
11524
11311
  var removalError = /** @type {Error & {code?: number}} */
@@ -11532,7 +11319,7 @@
11532
11319
  });
11533
11320
  return;
11534
11321
  }
11535
- var sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11322
+ var sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11536
11323
  sqliteDB.transaction(function (tx) {
11537
11324
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
11538
11325
  var tables = data.rows;
@@ -11593,7 +11380,7 @@
11593
11380
  success();
11594
11381
  } else {
11595
11382
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
11596
- sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : path.join(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), '1', 'System Database', CFG.DEFAULT_DB_SIZE);
11383
+ sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : joinPath(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), '1', 'System Database', CFG.DEFAULT_DB_SIZE);
11597
11384
  sysdb.transaction(function (systx) {
11598
11385
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
11599
11386
  if (!CFG.useSQLiteIndexes) {
@@ -11773,7 +11560,7 @@
11773
11560
  var sysdbFinishedCb = function sysdbFinishedCb(systx, err, cb) {
11774
11561
  if (err) {
11775
11562
  /**
11776
- * @param {any} [errorToShow]
11563
+ * @param {unknown} [errorToShow]
11777
11564
  * @returns {void}
11778
11565
  */
11779
11566
  var manualRevert = function manualRevert(errorToShow) {
@@ -11797,7 +11584,9 @@
11797
11584
  cb(sqlErr); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11798
11585
  }, function () {
11799
11586
  isRevertingSysdb = false;
11800
- cb(errorToShow || reportError); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11587
+ // eslint-disable-next-line promise/no-callback-in-promise -- Convenient
11588
+ cb(/** @type {(Error & {code?: number})|undefined} */
11589
+ errorToShow || reportError);
11801
11590
  });
11802
11591
  };
11803
11592
  try {
@@ -11830,13 +11619,13 @@
11830
11619
  newVersion: version
11831
11620
  });
11832
11621
  req.__result = connection;
11833
- connection.__upgradeTransaction = req.__transaction = req.__result.__versionTransaction = IDBTransaction.__createInstance(req.__result, req.__result.objectStoreNames, 'versionchange');
11622
+ connection.__upgradeTransaction = req.__transaction = connection.__versionTransaction = IDBTransaction.__createInstance(connection, connection.objectStoreNames, 'versionchange');
11834
11623
  req.__done = true;
11835
11624
  req.transaction.__addNonRequestToTransactionQueue(
11836
11625
  /**
11837
11626
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11838
- * @param {ObjectArray} args
11839
- * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11627
+ * @param {unknown[]} args
11628
+ * @param {(result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11840
11629
  * @returns {void}
11841
11630
  */
11842
11631
  function onupgradeneeded(tx, args, finished /* , error */) {
@@ -12049,7 +11838,7 @@
12049
11838
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
12050
11839
  db = websqlDBCache[name][version];
12051
11840
  } else {
12052
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11841
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
12053
11842
  if (useDatabaseCache) {
12054
11843
  if (!Object.hasOwn(websqlDBCache, name)) {
12055
11844
  websqlDBCache[name] = {};
@@ -12537,16 +12326,16 @@
12537
12326
 
12538
12327
  /**
12539
12328
  * @typedef {IDBCursor & {
12540
- * primaryKey: import('./Key.js').Key,
12541
- * key: import('./Key.js').Key,
12329
+ * primaryKey: import('./Key.js').Key|null|undefined,
12330
+ * key: import('./Key.js').Key|null|undefined,
12542
12331
  * direction: string,
12543
12332
  * source: import('./IDBObjectStore.js').IDBObjectStoreFull|
12544
12333
  * import('./IDBIndex.js').IDBIndexFull,
12545
12334
  * __request: import('./IDBRequest.js').IDBRequestFull,
12546
12335
  * __advanceCount: Integer|undefined,
12547
12336
  * __indexSource: boolean,
12548
- * __key: import('./Key.js').Key,
12549
- * __primaryKey: import('./Key.js').Key,
12337
+ * __key: import('./Key.js').Key|null|undefined,
12338
+ * __primaryKey: import('./Key.js').Key|null|undefined,
12550
12339
  * __value: import('./Key.js').Value,
12551
12340
  * __store: import('./IDBObjectStore.js').IDBObjectStoreFull,
12552
12341
  * __range: import('./IDBKeyRange.js').IDBKeyRangeFull|undefined,
@@ -12554,11 +12343,14 @@
12554
12343
  * __valueColumnName: string,
12555
12344
  * __keyOnly: boolean,
12556
12345
  * __valueDecoder: {
12557
- * decode: (str: string) => any,
12346
+ * decode: (str: string) => import('./Key.js').Value,
12558
12347
  * },
12559
12348
  * __count: boolean,
12560
12349
  * __prefetchedIndex: Integer,
12561
- * __prefetchedData: null|SQLResultSetRowList|{
12350
+ * __prefetchedData: null|{
12351
+ * length: number;
12352
+ * item(index: number): unknown;
12353
+ * }|{
12562
12354
  * data: RowItemNonNull[],
12563
12355
  * length: Integer,
12564
12356
  * item: (index: Integer) => RowItemNonNull
@@ -12572,7 +12364,14 @@
12572
12364
  * __multiEntryExhausted: boolean,
12573
12365
  * __invalidateCache: () => void,
12574
12366
  * __gotValue: boolean,
12575
- * __find: (...args: any[]) => void,
12367
+ * __find: (
12368
+ * key: import('./Key.js').Key|undefined,
12369
+ * primaryKey: import('./Key.js').Key|undefined,
12370
+ * tx: WebSQLTransaction,
12371
+ * success: KeySuccess,
12372
+ * error: FindError,
12373
+ * recordsToLoad?: Integer
12374
+ * ) => void,
12576
12375
  * __findBasic: (
12577
12376
  * key: import('./Key.js').Key|undefined,
12578
12377
  * primaryKey: import('./Key.js').Key|undefined,
@@ -12593,17 +12392,17 @@
12593
12392
  * __decode: (
12594
12393
  * rowItem: RowItemNonNull,
12595
12394
  * callback: (
12596
- * key: import('./Key.js').Key,
12395
+ * key: import('./Key.js').Key|undefined,
12597
12396
  * val: import('./Key.js').Value,
12598
- * primaryKey: import('./Key.js').Key,
12397
+ * primaryKey: import('./Key.js').Key|undefined,
12599
12398
  * encKey?: string
12600
12399
  * ) => void
12601
12400
  * ) => void,
12602
12401
  * __sourceOrEffectiveObjStoreDeleted: () => void,
12603
12402
  * __continue: (key?: import('./Key.js').Key, advanceContinue?: boolean) => void,
12604
12403
  * __continueFinish: (
12605
- * key: import('./Key.js').Key,
12606
- * primaryKey: import('./Key.js').Key,
12404
+ * key: import('./Key.js').Key|undefined,
12405
+ * primaryKey: import('./Key.js').Key|undefined,
12607
12406
  * advanceState: boolean
12608
12407
  * ) => void
12609
12408
  * }} IDBCursorFull
@@ -12636,7 +12435,7 @@
12636
12435
  * import('./IDBIndex.js').IDBIndexFull} source
12637
12436
  * @param {string} keyColumnName
12638
12437
  * @param {string} valueColumnName
12639
- * @param {boolean} count
12438
+ * @param {boolean} [count]
12640
12439
  * @this {IDBCursorFull}
12641
12440
  * @returns {void}
12642
12441
  */
@@ -12677,7 +12476,7 @@
12677
12476
  this.__valueColumnName = valueColumnName;
12678
12477
  this.__keyOnly = valueColumnName === 'key';
12679
12478
  this.__valueDecoder = this.__keyOnly ? Key : Sca;
12680
- this.__count = count;
12479
+ this.__count = Boolean(count);
12681
12480
  this.__prefetchedIndex = -1;
12682
12481
  this.__continuationKey = undefined;
12683
12482
  this.__continuationPrimaryKey = undefined;
@@ -12696,36 +12495,36 @@
12696
12495
 
12697
12496
  /**
12698
12497
  *
12699
- * @param {...any} args
12498
+ * @param {IDBKeyRange} query
12499
+ * @param {string} direction
12500
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
12501
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
12502
+ * import('./IDBIndex.js').IDBIndexFull} source
12503
+ * @param {string} keyColumnName
12504
+ * @param {string} valueColumnName
12505
+ * @param {boolean} [count]
12700
12506
  * @returns {IDBCursorFull}
12701
12507
  */
12702
- IDBCursor.__createInstance = function () {
12508
+ IDBCursor.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
12703
12509
  var IDBCursor = IDBCursorAlias.__super;
12704
12510
  IDBCursor.prototype = IDBCursorAlias.prototype;
12705
12511
 
12706
12512
  // @ts-expect-error It's ok
12707
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12708
- args[_key] = arguments[_key];
12709
- }
12710
- return _construct(IDBCursor, args);
12513
+ return new IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count);
12711
12514
  };
12712
12515
 
12713
12516
  /**
12714
12517
  *
12715
- * @param {...any} args
12518
+ * @param {import('./Key.js').Key|undefined} key
12519
+ * @param {import('./Key.js').Key|undefined} primaryKey
12520
+ * @param {WebSQLTransaction} tx
12521
+ * @param {KeySuccess} success
12522
+ * @param {FindError} error
12523
+ * @param {Integer} [recordsToLoad]
12716
12524
  * @this {IDBCursorFull}
12717
12525
  * @returns {void}
12718
12526
  */
12719
- IDBCursor.prototype.__find = function () {
12720
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12721
- args[_key2] = arguments[_key2];
12722
- }
12723
- var key = args[0],
12724
- primaryKey = args[1],
12725
- tx = args[2],
12726
- success = args[3],
12727
- error = args[4],
12728
- recordsToLoad = args[5];
12527
+ IDBCursor.prototype.__find = function (key, primaryKey, tx, success, error, recordsToLoad) {
12729
12528
  if (this.__multiEntryIndex) {
12730
12529
  this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
12731
12530
  } else {
@@ -12735,9 +12534,9 @@
12735
12534
 
12736
12535
  /**
12737
12536
  * @typedef {(
12738
- * k: import('./Key.js').Key,
12537
+ * k: import('./Key.js').Key|undefined,
12739
12538
  * val: import('./Key.js').Value,
12740
- * primKey: import('./Key.js').Key
12539
+ * primKey: import('./Key.js').Key|undefined
12741
12540
  * ) => void} KeySuccess
12742
12541
  */
12743
12542
 
@@ -12834,7 +12633,7 @@
12834
12633
  me.__prefetchedIndex = 0;
12835
12634
  me.__prefetchedData = data.rows;
12836
12635
  if (CFG.DEBUG) {
12837
- console.log('Preloaded ' + me.__prefetchedData.length + ' records for cursor');
12636
+ console.log('Preloaded ' + data.rows.length + ' records for cursor');
12838
12637
  }
12839
12638
  me.__decode(/** @type {RowItemNonNull} */data.rows.item(0), success);
12840
12639
  } else if (data.rows.length === 1) {
@@ -12959,7 +12758,7 @@
12959
12758
  for (var i = 0; i < data.rows.length; i++) {
12960
12759
  var rowItem = /** @type {RowItemNonNull} */data.rows.item(i);
12961
12760
  var rowKey = _decode(rowItem[me.__keyColumnName], true);
12962
- var matches = findMultiEntryMatches(rowKey, me.__range);
12761
+ var matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */rowKey, me.__range);
12963
12762
  ct += matches.length;
12964
12763
  }
12965
12764
  success(undefined, ct, undefined);
@@ -12979,7 +12778,7 @@
12979
12778
  for (var _i = 0; _i < data.rows.length; _i++) {
12980
12779
  var _rowItem = /** @type {RowItemNonNull} */data.rows.item(_i);
12981
12780
  var _rowKey = _decode(_rowItem[me.__keyColumnName], true);
12982
- var _matches = findMultiEntryMatches(_rowKey, me.__range);
12781
+ var _matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */_rowKey, me.__range);
12983
12782
  var _iterator = _createForOfIteratorHelper(_matches),
12984
12783
  _step;
12985
12784
  try {
@@ -13060,11 +12859,11 @@
13060
12859
  };
13061
12860
 
13062
12861
  /**
13063
- * @typedef {any} StructuredCloneValue
12862
+ * @typedef {import('./Key.js').Value} StructuredCloneValue
13064
12863
  */
13065
12864
 
13066
12865
  /**
13067
- * @typedef {any} IndexedDBKey
12866
+ * @typedef {import('./Key.js').Key} IndexedDBKey
13068
12867
  */
13069
12868
 
13070
12869
  /**
@@ -13076,9 +12875,9 @@
13076
12875
 
13077
12876
  /**
13078
12877
  * @callback SuccessCallback
13079
- * @param {IndexedDBKey} key
12878
+ * @param {IndexedDBKey|undefined} key
13080
12879
  * @param {StructuredCloneValue} value
13081
- * @param {IndexedDBKey} primaryKey
12880
+ * @param {IndexedDBKey|undefined} primaryKey
13082
12881
  * @returns {void}
13083
12882
  */
13084
12883
 
@@ -13118,9 +12917,9 @@
13118
12917
  *
13119
12918
  * @param {RowItemNonNull} rowItem
13120
12919
  * @param {(
13121
- * key: import('./Key.js').Key,
12920
+ * key: import('./Key.js').Key|undefined,
13122
12921
  * val: import('./Key.js').Value,
13123
- * primaryKey: import('./Key.js').Key,
12922
+ * primaryKey: import('./Key.js').Key|undefined,
13124
12923
  * encKey?: string
13125
12924
  * ) => void} callback
13126
12925
  * @this {IDBCursorFull}
@@ -13195,8 +12994,8 @@
13195
12994
 
13196
12995
  /**
13197
12996
  *
13198
- * @param {import('./Key.js').Key} key
13199
- * @param {import('./Key.js').Key} primaryKey
12997
+ * @param {import('./Key.js').Key|undefined} key
12998
+ * @param {import('./Key.js').Key|undefined} primaryKey
13200
12999
  * @param {boolean} advanceState
13201
13000
  * @this {IDBCursorFull}
13202
13001
  * @returns {void}
@@ -13210,9 +13009,9 @@
13210
13009
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
13211
13010
  me.__store.transaction.__pushToQueue(me.__request, function cursorContinue(tx, args, success, error, executeNextRequest) {
13212
13011
  /**
13213
- * @param {import('./Key.js').Key} k
13012
+ * @param {import('./Key.js').Key|undefined} k
13214
13013
  * @param {import('./Key.js').Value} val
13215
- * @param {import('./Key.js').Key} primKey
13014
+ * @param {import('./Key.js').Key|undefined} primKey
13216
13015
  * @returns {void}
13217
13016
  */
13218
13017
  function triggerSuccess(k, val, primKey) {
@@ -13254,7 +13053,7 @@
13254
13053
  // We have pre-loaded data for the cursor
13255
13054
  me.__prefetchedIndex++;
13256
13055
  if (me.__prefetchedIndex < me.__prefetchedData.length) {
13257
- me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13056
+ me.__decode(/** @type {RowItemNonNull} */me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13258
13057
  /**
13259
13058
  * @returns {void}
13260
13059
  */
@@ -13312,8 +13111,8 @@
13312
13111
  me.__find(key, primaryKey, tx, triggerSuccess, /** @type {FindError} */
13313
13112
  function () {
13314
13113
  me.__advanceCount = undefined;
13315
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
13316
- args[_key3] = arguments[_key3];
13114
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13115
+ args[_key] = arguments[_key];
13317
13116
  }
13318
13117
  var t = args[0],
13319
13118
  err = args[1];
@@ -13399,12 +13198,18 @@
13399
13198
  };
13400
13199
 
13401
13200
  /**
13402
- * @typedef {any} AnyValue
13201
+ * The `{query, count, direction}` options shape shared by
13202
+ * `getAll`/`getAllKeys`/`getAllRecords`.
13203
+ * @typedef {{
13204
+ * query?: import('./Key.js').Value,
13205
+ * count?: Integer,
13206
+ * direction?: string
13207
+ * }} GetAllOptions
13403
13208
  */
13404
13209
 
13405
13210
  /**
13406
13211
  *
13407
- * @param {AnyValue} valueToUpdate
13212
+ * @param {import('./Key.js').Value} valueToUpdate
13408
13213
  * @this {IDBCursorFull}
13409
13214
  * @returns {IDBRequest}
13410
13215
  */
@@ -13530,25 +13335,22 @@
13530
13335
  var IDBCursorWithValueAlias = IDBCursorWithValue;
13531
13336
  /**
13532
13337
  *
13533
- * @param {...any} args
13338
+ * @param {IDBKeyRange} query
13339
+ * @param {string} direction
13340
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
13341
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
13342
+ * import('./IDBIndex.js').IDBIndexFull} source
13343
+ * @param {string} keyColumnName
13344
+ * @param {string} valueColumnName
13345
+ * @param {boolean} [count]
13534
13346
  * @returns {IDBCursorWithValueFull}
13535
13347
  */
13536
- IDBCursorWithValue.__createInstance = function () {
13537
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
13538
- args[_key4] = arguments[_key4];
13539
- }
13348
+ IDBCursorWithValue.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
13540
13349
  /**
13541
13350
  * @class
13542
13351
  * @this {IDBCursorWithValueFull}
13543
13352
  */
13544
13353
  function IDBCursorWithValue() {
13545
- var query = args[0],
13546
- direction = args[1],
13547
- store = args[2],
13548
- source = args[3],
13549
- keyColumnName = args[4],
13550
- valueColumnName = args[5],
13551
- count = args[6];
13552
13354
  IDBCursor.__super.call(this, query, direction, store, source, keyColumnName, valueColumnName, count);
13553
13355
  // @ts-expect-error It's ok
13554
13356
  this[Symbol.toStringTag] = 'IDBCursorWithValue';
@@ -13571,12 +13373,16 @@
13571
13373
  /**
13572
13374
  * Validates `direction` and fills in defaults for the `{query, count,
13573
13375
  * direction}` shape shared by `getAll`/`getAllKeys`/`getAllRecords`.
13574
- * @param {AnyValue} options
13376
+ * @param {unknown} options
13575
13377
  * @throws {TypeError}
13576
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13378
+ * @returns {{
13379
+ * query: import('./Key.js').Value|undefined,
13380
+ * count: Integer|undefined,
13381
+ * direction: string
13382
+ * }}
13577
13383
  */
13578
13384
  function normalizeGetAllOptions(options) {
13579
- var _ref = /** @type {AnyValue} */options !== null && options !== void 0 ? options : {},
13385
+ var _ref = /** @type {GetAllOptions} */options !== null && options !== void 0 ? options : {},
13580
13386
  query = _ref.query,
13581
13387
  count = _ref.count,
13582
13388
  _ref$direction = _ref.direction,
@@ -13605,7 +13411,11 @@
13605
13411
  * first argument wins regardless of how many arguments were actually passed.
13606
13412
  * @param {IArguments} args
13607
13413
  * @throws {TypeError}
13608
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13414
+ * @returns {{
13415
+ * query: import('./Key.js').Value|undefined,
13416
+ * count: Integer|undefined,
13417
+ * direction: string
13418
+ * }}
13609
13419
  */
13610
13420
  function parseGetAllArgs(args) {
13611
13421
  var arg0 = args[0];
@@ -13628,7 +13438,11 @@
13628
13438
  * form to disambiguate against.
13629
13439
  * @param {IArguments} args
13630
13440
  * @throws {TypeError}
13631
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13441
+ * @returns {{
13442
+ * query: import('./Key.js').Value|undefined,
13443
+ * count: Integer|undefined,
13444
+ * direction: string
13445
+ * }}
13632
13446
  */
13633
13447
  function parseGetAllRecordsArgs(args) {
13634
13448
  return normalizeGetAllOptions(args[0]);
@@ -13735,7 +13549,7 @@
13735
13549
  value: direction
13736
13550
  });
13737
13551
  return tx.__addToTransactionQueue(function collectAllOp(sqlTx, args, success, error) {
13738
- /** @type {AnyValue[]} */
13552
+ /** @type {unknown[]} */
13739
13553
  var results = [];
13740
13554
  var recordsToLoad = count || CFG.cursorPreloadPackSize || 100;
13741
13555
 
@@ -13775,7 +13589,7 @@
13775
13589
  if (state.__prefetchedData) {
13776
13590
  state.__prefetchedIndex++;
13777
13591
  if (state.__prefetchedIndex < state.__prefetchedData.length) {
13778
- IDBCursor.prototype.__decode.call(state, state.__prefetchedData.item(state.__prefetchedIndex),
13592
+ IDBCursor.prototype.__decode.call(state, /** @type {RowItemNonNull} */state.__prefetchedData.item(state.__prefetchedIndex),
13779
13593
  /**
13780
13594
  * @param {import('./Key.js').Key} k
13781
13595
  * @param {import('./Key.js').Value} val
@@ -13805,15 +13619,11 @@
13805
13619
  }, undefined, source);
13806
13620
  }
13807
13621
 
13808
- /**
13809
- * @typedef {any} AnyValue
13810
- */
13811
-
13812
13622
  /**
13813
13623
  * @callback SetConfig
13814
13624
  * @param {import('./CFG.js').KeyofConfigValues|
13815
13625
  * Partial<import('./CFG.js').ConfigValues>} prop
13816
- * @param {AnyValue} [val]
13626
+ * @param {import('./CFG.js').ConfigValue} [val]
13817
13627
  * @throws {Error}
13818
13628
  * @returns {void}
13819
13629
  */
@@ -13898,18 +13708,9 @@
13898
13708
  function setGlobalVars(idb, initialConfig) {
13899
13709
  var IDB = /** @type {ShimmedObject & {[key: string]: unknown}} */
13900
13710
  /** @type {unknown} */globalThis || {};
13901
- /**
13902
- * @typedef {any} AnyClass
13903
- */
13904
- /**
13905
- * @typedef {any} AnyValue
13906
- */
13907
- /**
13908
- * @typedef {Function} AnyFunction
13909
- */
13910
13711
  /**
13911
13712
  * @param {string} name
13912
- * @param {AnyClass} value
13713
+ * @param {unknown} value
13913
13714
  * @param {PropertyDescriptor & {
13914
13715
  * shimNS?: object
13915
13716
  * }|undefined} [propDesc]
@@ -13937,7 +13738,7 @@
13937
13738
  }
13938
13739
  } else {
13939
13740
  var o = _defineAccessor("get", {}, name, function () {
13940
- return /** @type {AnyFunction} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13741
+ return /** @type {() => unknown} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13941
13742
  });
13942
13743
  desc = /** @type {PropertyDescriptor} */
13943
13744
  Object.getOwnPropertyDescriptor(o, name);
@@ -14011,7 +13812,7 @@
14011
13812
  return shimIndexedDB;
14012
13813
  }
14013
13814
  });
14014
- /** @type {[string, any][]} */
13815
+ /** @type {[string, unknown][]} */
14015
13816
  [['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) {
14016
13817
  var _ref4 = _slicedToArray(_ref3, 2),
14017
13818
  prop = _ref4[0],
@@ -14100,7 +13901,7 @@
14100
13901
  IDB.shimIndexedDB = /** @type {ShimIndexedDB} */{};
14101
13902
  /** @type {const} */
14102
13903
  ['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach(function (prop) {
14103
- /** @type {ShimIndexedDB} */IDB.shimIndexedDB[prop] = /** @type {() => any} */function () {
13904
+ /** @type {{[key: string]: () => void}} */(/** @type {unknown} */IDB.shimIndexedDB)[prop] = function () {
14104
13905
  console.warn('This browser does not have WebSQL to shim.');
14105
13906
  };
14106
13907
  });