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 (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -52,13 +52,6 @@
52
52
  function _classCallCheck(a, n) {
53
53
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
54
54
  }
55
- function _construct(t, e, r) {
56
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
57
- var o = [null];
58
- o.push.apply(o, e);
59
- var p = new (t.bind.apply(t, o))();
60
- return p;
61
- }
62
55
  function _defineProperties(e, r) {
63
56
  for (var t = 0; t < r.length; t++) {
64
57
  var o = r[t];
@@ -1920,7 +1913,7 @@
1920
1913
  // Callback not used by default
1921
1914
  // Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
1922
1915
  'escapeNULForSQLiteStatements', 'sqlMemoryQuota', 'createIndexes'].forEach(function (prop) {
1923
- /** @type {(val: any) => void} */
1916
+ /** @type {(val: ConfigValue) => void} */
1924
1917
  var validator;
1925
1918
  if (Array.isArray(prop)) {
1926
1919
  var _prop = prop;
@@ -2120,8 +2113,32 @@
2120
2113
  }
2121
2114
 
2122
2115
  /**
2123
- * @typedef {Function} AnyClass
2116
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
2117
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
2118
+ * `base` is a directory path expected to be absolute and normalized (an
2119
+ * empty string means the current working directory). Unlike `path.join`,
2120
+ * this performs no `.`/`..` resolution. It reuses the separator style of
2121
+ * `base` (backslash only when `base` uses backslashes and no forward
2122
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
2123
+ * `websql-configurable` accept either separator on Windows regardless.
2124
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
2125
+ * @param {string} base
2126
+ * @param {string} name
2127
+ * @returns {string}
2128
+ */
2129
+ function joinPath(base, name) {
2130
+ if (!base) {
2131
+ return name;
2132
+ }
2133
+ var sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
2134
+ return base.replace(/[\/\\]+$/, '') + sep + name;
2135
+ }
2136
+
2137
+ /* eslint-disable jsdoc/valid-types -- Bug */
2138
+ /**
2139
+ * @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
2124
2140
  */
2141
+ /* eslint-enable jsdoc/valid-types -- Bug */
2125
2142
 
2126
2143
  // Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
2127
2144
  /**
@@ -2145,7 +2162,7 @@
2145
2162
 
2146
2163
  /**
2147
2164
  *
2148
- * @param {object} obj
2165
+ * @param {AnyValue} obj
2149
2166
  * @returns {boolean}
2150
2167
  */
2151
2168
  function isDate(obj) {
@@ -2154,7 +2171,7 @@
2154
2171
 
2155
2172
  /**
2156
2173
  *
2157
- * @param {object} obj
2174
+ * @param {AnyValue} obj
2158
2175
  * @returns {boolean}
2159
2176
  */
2160
2177
  function isBlob(obj) {
@@ -2163,7 +2180,7 @@
2163
2180
 
2164
2181
  /**
2165
2182
  *
2166
- * @param {object} obj
2183
+ * @param {AnyValue} obj
2167
2184
  * @returns {boolean}
2168
2185
  */
2169
2186
  function isFile(obj) {
@@ -2185,7 +2202,7 @@
2185
2202
  /**
2186
2203
  *
2187
2204
  * @param {AnyValue} obj
2188
- * @returns {boolean}
2205
+ * @returns {obj is Iterable<unknown>}
2189
2206
  */
2190
2207
  function isIterable(obj) {
2191
2208
  return isObj(obj) &&
@@ -2231,9 +2248,7 @@
2231
2248
 
2232
2249
  /**
2233
2250
  *
2234
- * @param {object & {
2235
- * [key: string]: any
2236
- * }} obj
2251
+ * @param {object} obj
2237
2252
  * @param {string[]} listeners
2238
2253
  * @returns {void}
2239
2254
  */
@@ -2241,9 +2256,9 @@
2241
2256
  listeners = typeof listeners === 'string' ? [listeners] : listeners;
2242
2257
  listeners.forEach(function (listener) {
2243
2258
  var o = _defineAccessor("set", _defineAccessor("get", {}, listener, function () {
2244
- return obj['__' + listener];
2259
+ return Reflect.get(obj, '__' + listener);
2245
2260
  }), listener, function (val) {
2246
- obj['__' + listener] = val;
2261
+ Reflect.set(obj, '__' + listener, val);
2247
2262
  });
2248
2263
  var desc = /** @type {PropertyDescriptor} */
2249
2264
  Object.getOwnPropertyDescriptor(o, listener);
@@ -2252,7 +2267,7 @@
2252
2267
  Object.defineProperty(obj, listener, desc);
2253
2268
  });
2254
2269
  listeners.forEach(function (l) {
2255
- obj[l] = null;
2270
+ Reflect.set(obj, l, null);
2256
2271
  });
2257
2272
  }
2258
2273
 
@@ -2261,7 +2276,7 @@
2261
2276
  * @param {object} obj
2262
2277
  * @param {string|string[]} props
2263
2278
  * @param {null|{
2264
- * [key: string]: any
2279
+ * [key: string]: unknown
2265
2280
  * }} getter
2266
2281
  * @returns {void}
2267
2282
  */
@@ -2397,7 +2412,7 @@
2397
2412
  }
2398
2413
 
2399
2414
  /**
2400
- * @typedef {any} AnyValue
2415
+ * @typedef {unknown} AnyValue
2401
2416
  */
2402
2417
 
2403
2418
  /**
@@ -2415,8 +2430,11 @@
2415
2430
  */
2416
2431
  function ToString(o) {
2417
2432
  // Todo: See `es-abstract/es7`
2418
- // `String()` will not throw with Symbols
2419
- return '' + o; // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2433
+ // `String()` will not throw with Symbols, but the unchecked `+ ''`
2434
+ // coercion deliberately does (Web IDL requires converting a symbol
2435
+ // to `DOMString` to throw a `TypeError`); the assertion only tells
2436
+ // the compiler to allow the coercion it cannot model.
2437
+ return '' + (/** @type {string} */o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2420
2438
  }
2421
2439
 
2422
2440
  /**
@@ -2523,12 +2541,9 @@
2523
2541
  // We don't add within polyfill repo as might not always be the desired implementation
2524
2542
  Object.defineProperty(ShimEvent, Symbol.hasInstance, {
2525
2543
  /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2526
- /**
2527
- * @typedef {any} AnyValue
2528
- */
2529
2544
  value:
2530
2545
  /**
2531
- * @param {AnyValue} obj
2546
+ * @param {unknown} obj
2532
2547
  * @returns {boolean}
2533
2548
  */
2534
2549
  function value(obj) {
@@ -2599,12 +2614,9 @@
2599
2614
  Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);
2600
2615
  });
2601
2616
  Object.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {
2602
- /**
2603
- * @typedef {any} AnyValue
2604
- */
2605
2617
  value:
2606
2618
  /**
2607
- * @param {AnyValue} obj
2619
+ * @param {unknown} obj
2608
2620
  * @returns {boolean}
2609
2621
  */
2610
2622
  function value(obj) {
@@ -2862,7 +2874,7 @@
2862
2874
 
2863
2875
  /**
2864
2876
  * @typedef {{
2865
- * message: string|DOMString
2877
+ * message: string
2866
2878
  * }} ErrorLike
2867
2879
  */
2868
2880
 
@@ -2886,25 +2898,20 @@
2886
2898
  }
2887
2899
 
2888
2900
  /**
2889
- * @typedef {any} ArbitraryValue
2890
- */
2891
-
2892
- /**
2893
- * @param {ArbitraryValue} obj
2901
+ * @param {unknown} obj
2894
2902
  * @returns {boolean}
2895
2903
  */
2896
2904
  function isErrorOrDOMErrorOrDOMException(obj) {
2897
- return obj && _typeof(obj) === 'object' &&
2898
2905
  // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
2899
- typeof obj.name === 'string';
2906
+ return _typeof(obj) === 'object' && obj !== null && 'name' in obj && typeof obj.name === 'string';
2900
2907
  }
2901
2908
 
2902
2909
  /**
2903
2910
  * Finds the error argument. This is useful because some WebSQL callbacks
2904
2911
  * pass the error as the first argument, and some pass it as the second
2905
2912
  * argument.
2906
- * @param {(Error|{message?: string, name?: string}|any)[]} args
2907
- * @returns {Error|DOMException|undefined}
2913
+ * @param {unknown[]} args
2914
+ * @returns {unknown}
2908
2915
  */
2909
2916
  function findError(args) {
2910
2917
  var err;
@@ -2920,7 +2927,7 @@
2920
2927
  if (isErrorOrDOMErrorOrDOMException(arg)) {
2921
2928
  return arg;
2922
2929
  }
2923
- if (arg && typeof arg.message === 'string') {
2930
+ if (_typeof(arg) === 'object' && arg !== null && 'message' in arg && typeof arg.message === 'string') {
2924
2931
  err = arg;
2925
2932
  }
2926
2933
  }
@@ -3045,7 +3052,7 @@
3045
3052
  * @typedef {IDBRequest & EventTarget & import('eventtargeter').EventTargetInstance & {
3046
3053
  * transaction: import('./IDBTransaction.js').IDBTransactionFull,
3047
3054
  * __done: boolean,
3048
- * __result: import('./IDBDatabase.js').IDBDatabaseFull|undefined,
3055
+ * __result: unknown,
3049
3056
  * __error: null|DOMException|Error,
3050
3057
  * __source: null|import('./IDBDatabase.js').IDBDatabaseFull|
3051
3058
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
@@ -3515,8 +3522,8 @@
3515
3522
 
3516
3523
  /**
3517
3524
  * Compares two keys.
3518
- * @param {import('./Key.js').Key} first
3519
- * @param {import('./Key.js').Key} second
3525
+ * @param {import('./Key.js').Key|null|undefined} first
3526
+ * @param {import('./Key.js').Key|null|undefined} second
3520
3527
  * @returns {0|1|-1}
3521
3528
  */
3522
3529
  function cmp(first, second) {
@@ -3593,12 +3600,11 @@
3593
3600
  */
3594
3601
 
3595
3602
  /**
3596
- * @typedef {any} Value
3603
+ * @typedef {unknown} Value
3597
3604
  */
3598
3605
 
3599
3606
  /**
3600
- * @typedef {any} Key
3601
- * @todo Specify possible value more precisely
3607
+ * @typedef {IDBValidKey} Key
3602
3608
  */
3603
3609
 
3604
3610
  /**
@@ -3665,15 +3671,11 @@
3665
3671
  */
3666
3672
  var signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
3667
3673
 
3668
- /**
3669
- * @typedef {any} AnyValue
3670
- */
3671
-
3672
3674
  /**
3673
3675
  * @type {{
3674
3676
  * [key: string]: {
3675
- * encode: (param: any, inArray?: boolean) => string,
3676
- * decode: (param: string, inArray?: boolean) => any
3677
+ * encode(param: unknown, inArray?: boolean): string,
3678
+ * decode(param: string, inArray?: boolean): ValueType|undefined
3677
3679
  * }
3678
3680
  * }}
3679
3681
  */
@@ -4028,7 +4030,7 @@
4028
4030
  }
4029
4031
 
4030
4032
  /**
4031
- * @param {Key} key
4033
+ * @param {Value} key
4032
4034
  * @returns {KeyType|"invalid"}
4033
4035
  */
4034
4036
  function getKeyType(key) {
@@ -4172,7 +4174,7 @@
4172
4174
  case 'array':
4173
4175
  {
4174
4176
  // May throw (from binary)
4175
- var arr = /** @type {Array<any>} */input;
4177
+ var arr = /** @type {unknown[]} */input;
4176
4178
  var len = arr.length;
4177
4179
  safePush(seen, input);
4178
4180
 
@@ -4205,9 +4207,9 @@
4205
4207
  };
4206
4208
  }
4207
4209
  if (!multiEntry || !fullKeys && keys.every(function (k) {
4208
- return cmp(k, key.value) !== 0;
4210
+ return cmp(/** @type {Key} */k, /** @type {Key} */key.value) !== 0;
4209
4211
  }) || fullKeys && keys.every(function (k) {
4210
- return cmp(k, key) !== 0;
4212
+ return cmp(/** @type {Key} */k, /** @type {Key} */ /** @type {unknown} */key) !== 0;
4211
4213
  })) {
4212
4214
  safePush(keys, fullKeys ? key : key.value);
4213
4215
  }
@@ -4264,7 +4266,7 @@
4264
4266
 
4265
4267
  /**
4266
4268
  *
4267
- * @param {Key} key
4269
+ * @param {Value} key
4268
4270
  * @param {boolean} [fullKeys]
4269
4271
  * @returns {KeyValueObject}
4270
4272
  * @todo Document other allowable `key`?
@@ -4379,7 +4381,7 @@
4379
4381
  }
4380
4382
  if (keyPath === '') {
4381
4383
  return {
4382
- value: value
4384
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4383
4385
  };
4384
4386
  }
4385
4387
  var identifiers = keyPath.split('.');
@@ -4413,13 +4415,13 @@
4413
4415
  }) ? {
4414
4416
  failure: true
4415
4417
  } : {
4416
- value: value
4418
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4417
4419
  };
4418
4420
  }
4419
4421
 
4420
4422
  /**
4421
4423
  * Sets the inline key value.
4422
- * @param {{[key: string]: AnyValue}} value
4424
+ * @param {{[key: string]: Value}} value
4423
4425
  * @param {Key} key
4424
4426
  * @param {string} keyPath
4425
4427
  * @returns {void}
@@ -4437,7 +4439,7 @@
4437
4439
  configurable: true
4438
4440
  });
4439
4441
  }
4440
- value = value[identifier];
4442
+ value = /** @type {{[key: string]: Value}} */value[identifier];
4441
4443
  });
4442
4444
  Object.defineProperty(value, /** @type {string} */last, {
4443
4445
  value: key,
@@ -4522,7 +4524,7 @@
4522
4524
  * @returns {Key[]}
4523
4525
  */
4524
4526
  function findMultiEntryMatches(keyEntry, range) {
4525
- /** @type {unknown[]} */
4527
+ /** @type {Key[]} */
4526
4528
  var matches = [];
4527
4529
  if (Array.isArray(keyEntry)) {
4528
4530
  var _iterator4 = _createForOfIteratorHelper(keyEntry),
@@ -4561,7 +4563,7 @@
4561
4563
 
4562
4564
  /**
4563
4565
  * Not currently in use but keeping for spec parity.
4564
- * @param {Key} key
4566
+ * @param {KeyValueObject} key
4565
4567
  * @throws {Error} Upon a "bad key"
4566
4568
  * @returns {ValueType}
4567
4569
  */
@@ -4572,16 +4574,17 @@
4572
4574
  case 'number':
4573
4575
  case 'string':
4574
4576
  {
4575
- return value;
4577
+ return /** @type {number|string} */value;
4576
4578
  }
4577
4579
  case 'array':
4578
4580
  {
4579
4581
  /** @type {ValueType[]} */
4580
4582
  var array = [];
4581
- var len = value.length;
4583
+ var arrValue = /** @type {KeyValueObject[]} */value;
4584
+ var len = arrValue.length;
4582
4585
  var index = 0;
4583
4586
  while (index < len) {
4584
- var entry = convertKeyToValue(value[index]);
4587
+ var entry = convertKeyToValue(arrValue[index]);
4585
4588
  setArrayValue(array, index, entry);
4586
4589
  index++;
4587
4590
  }
@@ -4589,18 +4592,18 @@
4589
4592
  }
4590
4593
  case 'date':
4591
4594
  {
4592
- return new Date(value);
4595
+ return new Date(/** @type {number} */value);
4593
4596
  }
4594
4597
  case 'binary':
4595
4598
  {
4596
- var _len = value.length;
4599
+ var binValue = /** @type {Uint8Array} */value;
4600
+ var _len = binValue.length;
4597
4601
  var buffer = new ArrayBuffer(_len);
4598
4602
  // Set the entries in buffer's [[ArrayBufferData]] to those in `value`
4599
- var uint8 = new Uint8Array(buffer, value.byteOffset || 0, value.byteLength);
4600
- uint8.set(value);
4603
+ var uint8 = new Uint8Array(buffer, binValue.byteOffset || 0, binValue.byteLength);
4604
+ uint8.set(binValue);
4601
4605
  return buffer;
4602
4606
  }
4603
- case 'invalid':
4604
4607
  default:
4605
4608
  throw new Error('Bad key');
4606
4609
  }
@@ -4608,7 +4611,7 @@
4608
4611
 
4609
4612
  /**
4610
4613
  *
4611
- * @param {Key} key
4614
+ * @param {Value} key
4612
4615
  * @param {boolean} [inArray]
4613
4616
  * @returns {string|null}
4614
4617
  */
@@ -4623,7 +4626,7 @@
4623
4626
 
4624
4627
  /**
4625
4628
  *
4626
- * @param {Key} key
4629
+ * @param {string|null} key
4627
4630
  * @param {boolean} [inArray]
4628
4631
  * @throws {Error} Invalid number
4629
4632
  * @returns {undefined|ValueType}
@@ -4637,7 +4640,7 @@
4637
4640
 
4638
4641
  /**
4639
4642
  *
4640
- * @param {Key} key
4643
+ * @param {Value} key
4641
4644
  * @param {boolean} [inArray]
4642
4645
  * @returns {undefined|ValueType}
4643
4646
  */
@@ -4855,8 +4858,8 @@
4855
4858
  var IDBKeyRangeAlias = IDBKeyRange;
4856
4859
 
4857
4860
  /**
4858
- * @param {import('./Key.js').Key|null} lower
4859
- * @param {import('./Key.js').Key|null} upper
4861
+ * @param {import('./Key.js').Value} lower
4862
+ * @param {import('./Key.js').Value} upper
4860
4863
  * @param {boolean} lowerOpen
4861
4864
  * @param {boolean} upperOpen
4862
4865
  * @returns {import('./IDBKeyRange.js').IDBKeyRangeFull}
@@ -5053,10 +5056,11 @@
5053
5056
  function convertValueToKeyRange(value, nullDisallowed) {
5054
5057
  if (instanceOf(value, IDBKeyRange)) {
5055
5058
  // We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)
5056
- if (value.toString() !== '[object IDBKeyRange]') {
5057
- return IDBKeyRange.__createInstance(value.lower, value.upper, value.lowerOpen, value.upperOpen);
5059
+ var range = /** @type {IDBKeyRangeFull} */value;
5060
+ if (range.toString() !== '[object IDBKeyRange]') {
5061
+ return IDBKeyRange.__createInstance(range.lower, range.upper, range.lowerOpen, range.upperOpen);
5058
5062
  }
5059
- return value;
5063
+ return range;
5060
5064
  }
5061
5065
  if (isNullish(value)) {
5062
5066
  if (nullDisallowed) {
@@ -5083,7 +5087,7 @@
5083
5087
  * clone: () => DOMStringListFull,
5084
5088
  * contains: (str: string) => boolean,
5085
5089
  * indexOf: (str: string) => Integer,
5086
- * splice: (index: Integer, howmany: Integer, ...args: any) => void
5090
+ * splice: (index: Integer, howmany: Integer, ...args: string[]) => void
5087
5091
  * length: Integer
5088
5092
  * }} DOMStringListFull
5089
5093
  */
@@ -5199,9 +5203,10 @@
5199
5203
  },
5200
5204
  /**
5201
5205
  * @this {DOMStringListFull}
5202
- * @param {(value: string, i: Integer, arr: string[]) => any[]} cb
5206
+ * @template T
5207
+ * @param {(value: string, i: Integer, arr: string[]) => T} cb
5203
5208
  * @param {object} thisArg
5204
- * @returns {any[]}
5209
+ * @returns {T[]}
5205
5210
  */
5206
5211
  map: function map(cb, thisArg) {
5207
5212
  // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
@@ -5226,10 +5231,7 @@
5226
5231
  this.sortList();
5227
5232
  },
5228
5233
  /**
5229
- * @typedef {any} AnyArgs
5230
- */
5231
- /**
5232
- * @param {[index: Integer, howmany: Integer, ...args: any]} args
5234
+ * @param {[index: Integer, howmany: Integer, ...args: string[]]} args
5233
5235
  * @this {DOMStringListFull}
5234
5236
  * @returns {void}
5235
5237
  */
@@ -5267,12 +5269,9 @@
5267
5269
  }));
5268
5270
 
5269
5271
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
5270
- /**
5271
- * @typedef {any} AnyValue
5272
- */
5273
5272
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
5274
5273
  /**
5275
- * @param {AnyValue} obj
5274
+ * @param {unknown} obj
5276
5275
  * @returns {boolean}
5277
5276
  */
5278
5277
  value: function value(obj) {
@@ -5353,7 +5352,7 @@
5353
5352
  /**
5354
5353
  * @typedef {{
5355
5354
  * op: SQLCallback,
5356
- * args: ObjectArray,
5355
+ * args: unknown[],
5357
5356
  * req: import('./IDBRequest.js').IDBRequestFull|null
5358
5357
  * }} RequestInfo
5359
5358
  */
@@ -5405,17 +5404,17 @@
5405
5404
  * __pushToQueue: (
5406
5405
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5407
5406
  * callback: SQLCallback,
5408
- * args?: ObjectArray
5407
+ * args?: unknown[]
5409
5408
  * ) => void,
5410
5409
  * __assertActive: () => void,
5411
5410
  * commit: () => void,
5412
5411
  * __addNonRequestToTransactionQueue: (
5413
5412
  * callback: SQLCallback,
5414
- * args?: ObjectArray
5413
+ * args?: unknown[]
5415
5414
  * ) => void
5416
5415
  * __addToTransactionQueue: (
5417
5416
  * callback: SQLCallback,
5418
- * args: ObjectArray|undefined,
5417
+ * args: unknown[]|undefined,
5419
5418
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5420
5419
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5421
5420
  * import('./IDBIndex.js').IDBIndexFull|
@@ -5617,7 +5616,7 @@
5617
5616
  i = -1;
5618
5617
 
5619
5618
  /**
5620
- * @typedef {any} IDBRequestResult
5619
+ * @typedef {unknown} IDBRequestResult
5621
5620
  */
5622
5621
 
5623
5622
  /**
@@ -6053,8 +6052,8 @@
6053
6052
  /**
6054
6053
  * @typedef {(
6055
6054
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6056
- * args: ObjectArray,
6057
- * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6055
+ * args: unknown[],
6056
+ * success: (result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6058
6057
  * error: (
6059
6058
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
6060
6059
  * err?: Error & {code?: number}
@@ -6066,7 +6065,7 @@
6066
6065
  /**
6067
6066
  * Adds a callback function to the transaction queue.
6068
6067
  * @param {SQLCallback} callback
6069
- * @param {ObjectArray} args
6068
+ * @param {unknown[]} args
6070
6069
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6071
6070
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6072
6071
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6083,7 +6082,7 @@
6083
6082
  * Adds a callback function to the transaction queue without generating a
6084
6083
  * request.
6085
6084
  * @param {SQLCallback} callback
6086
- * @param {ObjectArray} args
6085
+ * @param {unknown[]} args
6087
6086
  * @this {IDBTransactionFull}
6088
6087
  * @returns {void}
6089
6088
  */
@@ -6095,7 +6094,7 @@
6095
6094
  * Adds an IDBRequest to the transaction queue.
6096
6095
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6097
6096
  * @param {SQLCallback} callback
6098
- * @param {ObjectArray} args
6097
+ * @param {unknown[]} args
6099
6098
  * @this {IDBTransactionFull}
6100
6099
  * @returns {void}
6101
6100
  */
@@ -6266,7 +6265,7 @@
6266
6265
  bubbles: true,
6267
6266
  cancelable: true
6268
6267
  });
6269
- return new SyncPromise(/** @type {(resolve: (value?: any) => void) => void} */
6268
+ return new SyncPromise(/** @type {(resolve: (value?: unknown) => void) => void} */
6270
6269
  function (resolve) {
6271
6270
  setTimeout(function () {
6272
6271
  if (!q.req) {
@@ -8429,7 +8428,7 @@
8429
8428
  }
8430
8429
 
8431
8430
  /**
8432
- * @typedef {any} AnyValue
8431
+ * @typedef {import('./Key.js').Value} AnyValue
8433
8432
  */
8434
8433
 
8435
8434
  /**
@@ -8539,7 +8538,7 @@
8539
8538
  * __keyPath: import('./Key.js').KeyPath,
8540
8539
  * __recreated?: boolean,
8541
8540
  * __fetchIndexData: (
8542
- * range: any,
8541
+ * range: Query,
8543
8542
  * opType: "value"|"key"|"count",
8544
8543
  * nullDisallowed: boolean,
8545
8544
  * count?: number
@@ -8911,7 +8910,7 @@
8911
8910
  };
8912
8911
 
8913
8912
  /**
8914
- * @typedef {any|IDBKeyRange} Query
8913
+ * @typedef {import('./Key.js').Value|IDBKeyRange} Query
8915
8914
  */
8916
8915
 
8917
8916
  /**
@@ -9194,7 +9193,7 @@
9194
9193
  reject(err);
9195
9194
  });
9196
9195
  }));
9197
- SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: any) => PromiseLike<never>} */
9196
+ SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: unknown) => PromiseLike<never>} */
9198
9197
  error).catch(function (err) {
9199
9198
  console.log('Index rename error');
9200
9199
  throw err;
@@ -9206,14 +9205,10 @@
9206
9205
  });
9207
9206
  };
9208
9207
 
9209
- /**
9210
- * @typedef {any} AnyValue
9211
- */
9212
-
9213
9208
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
9214
9209
  Object.defineProperty(IDBIndex, Symbol.hasInstance, {
9215
9210
  /**
9216
- * @param {AnyValue} obj
9211
+ * @param {unknown} obj
9217
9212
  * @returns {boolean}
9218
9213
  */
9219
9214
  value: function value(obj) {
@@ -9241,7 +9236,9 @@
9241
9236
  * @param {string[]} sqlValues
9242
9237
  * @param {WebSQLTransaction} tx
9243
9238
  * @param {null|undefined} args
9244
- * @param {(result: number|undefined|[]|AnyValue|AnyValue[]) => void} success
9239
+ * @param {(
9240
+ * result: number|undefined|[]|import('./Key.js').Value|import('./Key.js').Value[]
9241
+ * ) => void} success
9245
9242
  * @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
9246
9243
  * @returns {void}
9247
9244
  */
@@ -9278,7 +9275,7 @@
9278
9275
  * @param {{
9279
9276
  * value: string
9280
9277
  * }} record
9281
- * @returns {AnyValue}
9278
+ * @returns {import('./Key.js').Value}
9282
9279
  */
9283
9280
  function (record) {
9284
9281
  // when opType is value
@@ -9292,9 +9289,9 @@
9292
9289
  var rowKey = /** @type {import('./Key.js').ValueTypeArray} */
9293
9290
  _decode(row[escapedIndexNameForKeyCol]);
9294
9291
  var record;
9295
- if (hasKey && (multiChecks && range.some(
9292
+ if (hasKey && (multiChecks && /** @type {import('./Key.js').ValueType[]} */range.some(
9296
9293
  /**
9297
- * @param {string} check
9294
+ * @param {import('./Key.js').ValueType} check
9298
9295
  * @returns {boolean}
9299
9296
  */
9300
9297
  function (check) {
@@ -9445,14 +9442,14 @@
9445
9442
  * __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
9446
9443
  * __validateKeyAndValueAndCloneValue: (
9447
9444
  * value: import('./Key.js').Value,
9448
- * key: import('./Key.js').Key,
9445
+ * key: import('./Key.js').Key|undefined,
9449
9446
  * cursorUpdate: boolean
9450
9447
  * ) => KeyValueArray,
9451
9448
  * __deriveKey: (
9452
9449
  * tx: WebSQLTransaction,
9453
9450
  * value: import('./Key.js').Value,
9454
- * key: import('./Key.js').Key,
9455
- * success: (key: import('./Key.js').Key, cn?: Integer) => void,
9451
+ * key: import('./Key.js').Key|undefined,
9452
+ * success: (key: import('./Key.js').Value, cn?: Integer) => void,
9456
9453
  * failCb: import('./Key.js').SQLFailureCallback
9457
9454
  * ) => void,
9458
9455
  * __checkIndexConstraints: (
@@ -9761,7 +9758,7 @@
9761
9758
  };
9762
9759
 
9763
9760
  /**
9764
- * @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
9761
+ * @typedef {[import('./Key.js').Key|undefined, import('./Key.js').Value]} KeyValueArray
9765
9762
  */
9766
9763
 
9767
9764
  // Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
@@ -9776,7 +9773,7 @@
9776
9773
  * Determines whether the given inline or out-of-line key is valid,
9777
9774
  * according to the object store's schema.
9778
9775
  * @param {import('./Key.js').Value} value Used for inline keys
9779
- * @param {import('./Key.js').Key} key Used for out-of-line keys
9776
+ * @param {import('./Key.js').Key|undefined} key Used for out-of-line keys
9780
9777
  * @param {boolean} cursorUpdate
9781
9778
  * @throws {DOMException}
9782
9779
  * @this {IDBObjectStoreFull}
@@ -9792,11 +9789,11 @@
9792
9789
  // occurs sync; then can make cloning and this method without callbacks (except where ok
9793
9790
  // to be async)
9794
9791
  var _clonedValue = cloneWithInactiveTransaction(/** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction, value);
9795
- key = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9796
- if (key.invalid) {
9792
+ var extractedKey = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9793
+ if ('invalid' in extractedKey && extractedKey.invalid) {
9797
9794
  throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');
9798
9795
  }
9799
- if (key.failure) {
9796
+ if ('failure' in extractedKey && extractedKey.failure) {
9800
9797
  if (!cursorUpdate) {
9801
9798
  if (!me.autoIncrement) {
9802
9799
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
@@ -9811,14 +9808,13 @@
9811
9808
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath');
9812
9809
  }
9813
9810
  // An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key
9814
- return [key.value, _clonedValue];
9811
+ return [(/** @type {import('./Key.js').Key} */extractedKey.value), _clonedValue];
9815
9812
  }
9816
9813
  if (key === undefined) {
9817
9814
  if (!me.autoIncrement) {
9818
9815
  throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
9819
9816
  }
9820
9817
  // A key will be generated
9821
- key = undefined;
9822
9818
  } else {
9823
9819
  convertValueToKeyRethrowingAndIfInvalid(key);
9824
9820
  }
@@ -9833,8 +9829,8 @@
9833
9829
  * a keyPath leading to a valid but non-numeric or < 1 key).
9834
9830
  * @param {WebSQLTransaction} tx
9835
9831
  * @param {import('./Key.js').Value} value
9836
- * @param {import('./Key.js').Key} key
9837
- * @param {(key: import('./Key.js').Key, cn?: Integer) => void} success
9832
+ * @param {import('./Key.js').Key|undefined} key
9833
+ * @param {(key: import('./Key.js').Value, cn?: Integer) => void} success
9838
9834
  * @param {import('./Key.js').SQLFailureCallback} failCb
9839
9835
  * @this {IDBObjectStoreFull}
9840
9836
  * @returns {void}
@@ -9849,9 +9845,8 @@
9849
9845
  */
9850
9846
  function keyCloneThenSuccess(oldCn) {
9851
9847
  // We want to return the original key, so we don't need to accept an argument here
9852
- encode(key, function (key) {
9853
- key = decode(key);
9854
- success(key, oldCn);
9848
+ encode(key, function (encodedKey) {
9849
+ success(decode(encodedKey), oldCn);
9855
9850
  });
9856
9851
  }
9857
9852
  if (me.autoIncrement) {
@@ -9865,7 +9860,7 @@
9865
9860
  if (me.keyPath !== null) {
9866
9861
  // Should not throw now as checked earlier
9867
9862
  // Todo: Could this not be an array here?
9868
- injectKeyIntoValueUsingKeyPath(value, key, /** @type {string} */me.keyPath);
9863
+ injectKeyIntoValueUsingKeyPath(/** @type {{[key: string]: import('./Key.js').Value}} */value, /** @type {import('./Key.js').Key} */key, /** @type {string} */me.keyPath);
9869
9864
  }
9870
9865
  success(key, oldCn);
9871
9866
  }, failCb);
@@ -9922,15 +9917,15 @@
9922
9917
  resolve(undefined);
9923
9918
  return;
9924
9919
  }
9925
- indexKey = indexKey.value;
9926
- if (indexKey === undefined) {
9920
+ var indexKeyValue = indexKey.value;
9921
+ if (indexKeyValue === undefined) {
9927
9922
  resolve(undefined);
9928
9923
  return;
9929
9924
  }
9930
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
9931
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
9925
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
9926
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
9932
9927
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
9933
- if (key === undefined || excludeKey !== undefined && cmp(key, excludeKey) === 0) {
9928
+ if (key === undefined || excludeKey !== undefined && cmp(/** @type {import('./Key.js').Key} */key, excludeKey) === 0) {
9934
9929
  resolve(undefined);
9935
9930
  return;
9936
9931
  }
@@ -10003,21 +9998,21 @@
10003
9998
  resolve(undefined);
10004
9999
  return;
10005
10000
  }
10006
- indexKey = indexKey.value;
10001
+ var indexKeyValue = indexKey.value;
10007
10002
  /**
10008
10003
  * @param {import('./IDBIndex.js').IDBIndexFull} index
10009
10004
  * @returns {void}
10010
10005
  */
10011
10006
  function setIndexInfo(index) {
10012
- if (indexKey === undefined) {
10007
+ if (indexKeyValue === undefined) {
10013
10008
  return;
10014
10009
  }
10015
10010
  paramMap[index.__currentName] = /** @type {string} */
10016
- _encode(indexKey, index.multiEntry);
10011
+ _encode(indexKeyValue, index.multiEntry);
10017
10012
  }
10018
10013
  if (index.unique) {
10019
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
10020
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
10014
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
10015
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
10021
10016
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
10022
10017
  if (key === undefined) {
10023
10018
  setIndexInfo(index);
@@ -10185,7 +10180,9 @@
10185
10180
  var key = arguments[5];
10186
10181
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
10187
10182
  store.transaction.__pushToQueue(request, function (tx, args, success, error) {
10188
- store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
10183
+ store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumberRaw, oldCn) {
10184
+ var clonedKeyOrCurrentNumber = /** @type {import('./Key.js').Key|Integer} */
10185
+ clonedKeyOrCurrentNumberRaw;
10189
10186
  encode(value, function (encoded) {
10190
10187
  /**
10191
10188
  * @param {WebSQLTransaction} tx
@@ -10597,216 +10594,6 @@
10597
10594
  writable: false
10598
10595
  });
10599
10596
 
10600
- // Copyright Joyent, Inc. and other Node contributors.
10601
- //
10602
- // Permission is hereby granted, free of charge, to any person obtaining a
10603
- // copy of this software and associated documentation files (the
10604
- // "Software"), to deal in the Software without restriction, including
10605
- // without limitation the rights to use, copy, modify, merge, publish,
10606
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10607
- // persons to whom the Software is furnished to do so, subject to the
10608
- // following conditions:
10609
- //
10610
- // The above copyright notice and this permission notice shall be included
10611
- // in all copies or substantial portions of the Software.
10612
- //
10613
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10614
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10615
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10616
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10617
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10618
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10619
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
10620
-
10621
- // resolves . and .. elements in a path array with directory names there
10622
- // must be no slashes, empty elements, or device names (c:\) in the array
10623
- // (so also no leading and trailing slashes - it does not distinguish
10624
- // relative and absolute paths)
10625
- function normalizeArray(parts, allowAboveRoot) {
10626
- // if the path tries to go above the root, `up` ends up > 0
10627
- var up = 0;
10628
- for (var i = parts.length - 1; i >= 0; i--) {
10629
- var last = parts[i];
10630
- if (last === '.') {
10631
- parts.splice(i, 1);
10632
- } else if (last === '..') {
10633
- parts.splice(i, 1);
10634
- up++;
10635
- } else if (up) {
10636
- parts.splice(i, 1);
10637
- up--;
10638
- }
10639
- }
10640
-
10641
- // if the path is allowed to go above the root, restore leading ..s
10642
- if (allowAboveRoot) {
10643
- for (; up--; up) {
10644
- parts.unshift('..');
10645
- }
10646
- }
10647
- return parts;
10648
- }
10649
-
10650
- // Split a filename into [root, dir, basename, ext], unix version
10651
- // 'root' is just a slash, or nothing.
10652
- var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
10653
- var splitPath = function splitPath(filename) {
10654
- return splitPathRe.exec(filename).slice(1);
10655
- };
10656
-
10657
- // path.resolve([from ...], to)
10658
- // posix version
10659
- function resolve() {
10660
- var resolvedPath = '',
10661
- resolvedAbsolute = false;
10662
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
10663
- var path = i >= 0 ? arguments[i] : '/';
10664
-
10665
- // Skip empty and invalid entries
10666
- if (typeof path !== 'string') {
10667
- throw new TypeError('Arguments to path.resolve must be strings');
10668
- } else if (!path) {
10669
- continue;
10670
- }
10671
- resolvedPath = path + '/' + resolvedPath;
10672
- resolvedAbsolute = path.charAt(0) === '/';
10673
- }
10674
-
10675
- // At this point the path should be resolved to a full absolute path, but
10676
- // handle relative paths to be safe (might happen when process.cwd() fails)
10677
-
10678
- // Normalize the path
10679
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
10680
- return !!p;
10681
- }), !resolvedAbsolute).join('/');
10682
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
10683
- }
10684
-
10685
- // path.normalize(path)
10686
- // posix version
10687
- function normalize(path) {
10688
- var isPathAbsolute = isAbsolute(path),
10689
- trailingSlash = substr(path, -1) === '/';
10690
-
10691
- // Normalize the path
10692
- path = normalizeArray(filter(path.split('/'), function (p) {
10693
- return !!p;
10694
- }), !isPathAbsolute).join('/');
10695
- if (!path && !isPathAbsolute) {
10696
- path = '.';
10697
- }
10698
- if (path && trailingSlash) {
10699
- path += '/';
10700
- }
10701
- return (isPathAbsolute ? '/' : '') + path;
10702
- }
10703
-
10704
- // posix version
10705
- function isAbsolute(path) {
10706
- return path.charAt(0) === '/';
10707
- }
10708
-
10709
- // posix version
10710
- function join() {
10711
- var paths = Array.prototype.slice.call(arguments, 0);
10712
- return normalize(filter(paths, function (p, index) {
10713
- if (typeof p !== 'string') {
10714
- throw new TypeError('Arguments to path.join must be strings');
10715
- }
10716
- return p;
10717
- }).join('/'));
10718
- }
10719
-
10720
- // path.relative(from, to)
10721
- // posix version
10722
- function relative(from, to) {
10723
- from = resolve(from).substr(1);
10724
- to = resolve(to).substr(1);
10725
- function trim(arr) {
10726
- var start = 0;
10727
- for (; start < arr.length; start++) {
10728
- if (arr[start] !== '') break;
10729
- }
10730
- var end = arr.length - 1;
10731
- for (; end >= 0; end--) {
10732
- if (arr[end] !== '') break;
10733
- }
10734
- if (start > end) return [];
10735
- return arr.slice(start, end - start + 1);
10736
- }
10737
- var fromParts = trim(from.split('/'));
10738
- var toParts = trim(to.split('/'));
10739
- var length = Math.min(fromParts.length, toParts.length);
10740
- var samePartsLength = length;
10741
- for (var i = 0; i < length; i++) {
10742
- if (fromParts[i] !== toParts[i]) {
10743
- samePartsLength = i;
10744
- break;
10745
- }
10746
- }
10747
- var outputParts = [];
10748
- for (var i = samePartsLength; i < fromParts.length; i++) {
10749
- outputParts.push('..');
10750
- }
10751
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
10752
- return outputParts.join('/');
10753
- }
10754
- var sep = '/';
10755
- var delimiter = ':';
10756
- function dirname(path) {
10757
- var result = splitPath(path),
10758
- root = result[0],
10759
- dir = result[1];
10760
- if (!root && !dir) {
10761
- // No dirname whatsoever
10762
- return '.';
10763
- }
10764
- if (dir) {
10765
- // It has a dirname, strip trailing slash
10766
- dir = dir.substr(0, dir.length - 1);
10767
- }
10768
- return root + dir;
10769
- }
10770
- function basename(path, ext) {
10771
- var f = splitPath(path)[2];
10772
- // TODO: make this comparison case-insensitive on windows?
10773
- if (ext && f.substr(-1 * ext.length) === ext) {
10774
- f = f.substr(0, f.length - ext.length);
10775
- }
10776
- return f;
10777
- }
10778
- function extname(path) {
10779
- return splitPath(path)[3];
10780
- }
10781
- var path = {
10782
- extname: extname,
10783
- basename: basename,
10784
- dirname: dirname,
10785
- sep: sep,
10786
- delimiter: delimiter,
10787
- relative: relative,
10788
- join: join,
10789
- isAbsolute: isAbsolute,
10790
- normalize: normalize,
10791
- resolve: resolve
10792
- };
10793
- function filter(xs, f) {
10794
- if (xs.filter) return xs.filter(f);
10795
- var res = [];
10796
- for (var i = 0; i < xs.length; i++) {
10797
- if (f(xs[i], i, xs)) res.push(xs[i]);
10798
- }
10799
- return res;
10800
- }
10801
-
10802
- // String.prototype.substr - negative index don't work in IE8
10803
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
10804
- return str.substr(start, len);
10805
- } : function (str, start, len) {
10806
- if (start < 0) start = str.length + start;
10807
- return str.substr(start, len);
10808
- };
10809
-
10810
10597
  var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
10811
10598
  var readonlyProperties$1 = ['name', 'version', 'objectStoreNames'];
10812
10599
 
@@ -11526,7 +11313,7 @@
11526
11313
  }
11527
11314
  if (fs && CFG.deleteDatabaseFiles !== false) {
11528
11315
  closeCachedWebSQLConnections(name, function () {
11529
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11316
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11530
11317
  if (err && err.code !== 'ENOENT') {
11531
11318
  // Ignore if file is already deleted
11532
11319
  var removalError = /** @type {Error & {code?: number}} */
@@ -11540,7 +11327,7 @@
11540
11327
  });
11541
11328
  return;
11542
11329
  }
11543
- var sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11330
+ var sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11544
11331
  sqliteDB.transaction(function (tx) {
11545
11332
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
11546
11333
  var tables = data.rows;
@@ -11601,7 +11388,7 @@
11601
11388
  success();
11602
11389
  } else {
11603
11390
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
11604
- 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);
11391
+ 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);
11605
11392
  sysdb.transaction(function (systx) {
11606
11393
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
11607
11394
  if (!CFG.useSQLiteIndexes) {
@@ -11781,7 +11568,7 @@
11781
11568
  var sysdbFinishedCb = function sysdbFinishedCb(systx, err, cb) {
11782
11569
  if (err) {
11783
11570
  /**
11784
- * @param {any} [errorToShow]
11571
+ * @param {unknown} [errorToShow]
11785
11572
  * @returns {void}
11786
11573
  */
11787
11574
  var manualRevert = function manualRevert(errorToShow) {
@@ -11805,7 +11592,9 @@
11805
11592
  cb(sqlErr); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11806
11593
  }, function () {
11807
11594
  isRevertingSysdb = false;
11808
- cb(errorToShow || reportError); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11595
+ // eslint-disable-next-line promise/no-callback-in-promise -- Convenient
11596
+ cb(/** @type {(Error & {code?: number})|undefined} */
11597
+ errorToShow || reportError);
11809
11598
  });
11810
11599
  };
11811
11600
  try {
@@ -11838,13 +11627,13 @@
11838
11627
  newVersion: version
11839
11628
  });
11840
11629
  req.__result = connection;
11841
- connection.__upgradeTransaction = req.__transaction = req.__result.__versionTransaction = IDBTransaction.__createInstance(req.__result, req.__result.objectStoreNames, 'versionchange');
11630
+ connection.__upgradeTransaction = req.__transaction = connection.__versionTransaction = IDBTransaction.__createInstance(connection, connection.objectStoreNames, 'versionchange');
11842
11631
  req.__done = true;
11843
11632
  req.transaction.__addNonRequestToTransactionQueue(
11844
11633
  /**
11845
11634
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11846
- * @param {ObjectArray} args
11847
- * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11635
+ * @param {unknown[]} args
11636
+ * @param {(result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11848
11637
  * @returns {void}
11849
11638
  */
11850
11639
  function onupgradeneeded(tx, args, finished /* , error */) {
@@ -12057,7 +11846,7 @@
12057
11846
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
12058
11847
  db = websqlDBCache[name][version];
12059
11848
  } else {
12060
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11849
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
12061
11850
  if (useDatabaseCache) {
12062
11851
  if (!Object.hasOwn(websqlDBCache, name)) {
12063
11852
  websqlDBCache[name] = {};
@@ -12545,16 +12334,16 @@
12545
12334
 
12546
12335
  /**
12547
12336
  * @typedef {IDBCursor & {
12548
- * primaryKey: import('./Key.js').Key,
12549
- * key: import('./Key.js').Key,
12337
+ * primaryKey: import('./Key.js').Key|null|undefined,
12338
+ * key: import('./Key.js').Key|null|undefined,
12550
12339
  * direction: string,
12551
12340
  * source: import('./IDBObjectStore.js').IDBObjectStoreFull|
12552
12341
  * import('./IDBIndex.js').IDBIndexFull,
12553
12342
  * __request: import('./IDBRequest.js').IDBRequestFull,
12554
12343
  * __advanceCount: Integer|undefined,
12555
12344
  * __indexSource: boolean,
12556
- * __key: import('./Key.js').Key,
12557
- * __primaryKey: import('./Key.js').Key,
12345
+ * __key: import('./Key.js').Key|null|undefined,
12346
+ * __primaryKey: import('./Key.js').Key|null|undefined,
12558
12347
  * __value: import('./Key.js').Value,
12559
12348
  * __store: import('./IDBObjectStore.js').IDBObjectStoreFull,
12560
12349
  * __range: import('./IDBKeyRange.js').IDBKeyRangeFull|undefined,
@@ -12562,11 +12351,14 @@
12562
12351
  * __valueColumnName: string,
12563
12352
  * __keyOnly: boolean,
12564
12353
  * __valueDecoder: {
12565
- * decode: (str: string) => any,
12354
+ * decode: (str: string) => import('./Key.js').Value,
12566
12355
  * },
12567
12356
  * __count: boolean,
12568
12357
  * __prefetchedIndex: Integer,
12569
- * __prefetchedData: null|SQLResultSetRowList|{
12358
+ * __prefetchedData: null|{
12359
+ * length: number;
12360
+ * item(index: number): unknown;
12361
+ * }|{
12570
12362
  * data: RowItemNonNull[],
12571
12363
  * length: Integer,
12572
12364
  * item: (index: Integer) => RowItemNonNull
@@ -12580,7 +12372,14 @@
12580
12372
  * __multiEntryExhausted: boolean,
12581
12373
  * __invalidateCache: () => void,
12582
12374
  * __gotValue: boolean,
12583
- * __find: (...args: any[]) => void,
12375
+ * __find: (
12376
+ * key: import('./Key.js').Key|undefined,
12377
+ * primaryKey: import('./Key.js').Key|undefined,
12378
+ * tx: WebSQLTransaction,
12379
+ * success: KeySuccess,
12380
+ * error: FindError,
12381
+ * recordsToLoad?: Integer
12382
+ * ) => void,
12584
12383
  * __findBasic: (
12585
12384
  * key: import('./Key.js').Key|undefined,
12586
12385
  * primaryKey: import('./Key.js').Key|undefined,
@@ -12601,17 +12400,17 @@
12601
12400
  * __decode: (
12602
12401
  * rowItem: RowItemNonNull,
12603
12402
  * callback: (
12604
- * key: import('./Key.js').Key,
12403
+ * key: import('./Key.js').Key|undefined,
12605
12404
  * val: import('./Key.js').Value,
12606
- * primaryKey: import('./Key.js').Key,
12405
+ * primaryKey: import('./Key.js').Key|undefined,
12607
12406
  * encKey?: string
12608
12407
  * ) => void
12609
12408
  * ) => void,
12610
12409
  * __sourceOrEffectiveObjStoreDeleted: () => void,
12611
12410
  * __continue: (key?: import('./Key.js').Key, advanceContinue?: boolean) => void,
12612
12411
  * __continueFinish: (
12613
- * key: import('./Key.js').Key,
12614
- * primaryKey: import('./Key.js').Key,
12412
+ * key: import('./Key.js').Key|undefined,
12413
+ * primaryKey: import('./Key.js').Key|undefined,
12615
12414
  * advanceState: boolean
12616
12415
  * ) => void
12617
12416
  * }} IDBCursorFull
@@ -12644,7 +12443,7 @@
12644
12443
  * import('./IDBIndex.js').IDBIndexFull} source
12645
12444
  * @param {string} keyColumnName
12646
12445
  * @param {string} valueColumnName
12647
- * @param {boolean} count
12446
+ * @param {boolean} [count]
12648
12447
  * @this {IDBCursorFull}
12649
12448
  * @returns {void}
12650
12449
  */
@@ -12685,7 +12484,7 @@
12685
12484
  this.__valueColumnName = valueColumnName;
12686
12485
  this.__keyOnly = valueColumnName === 'key';
12687
12486
  this.__valueDecoder = this.__keyOnly ? Key : Sca;
12688
- this.__count = count;
12487
+ this.__count = Boolean(count);
12689
12488
  this.__prefetchedIndex = -1;
12690
12489
  this.__continuationKey = undefined;
12691
12490
  this.__continuationPrimaryKey = undefined;
@@ -12704,36 +12503,36 @@
12704
12503
 
12705
12504
  /**
12706
12505
  *
12707
- * @param {...any} args
12506
+ * @param {IDBKeyRange} query
12507
+ * @param {string} direction
12508
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
12509
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
12510
+ * import('./IDBIndex.js').IDBIndexFull} source
12511
+ * @param {string} keyColumnName
12512
+ * @param {string} valueColumnName
12513
+ * @param {boolean} [count]
12708
12514
  * @returns {IDBCursorFull}
12709
12515
  */
12710
- IDBCursor.__createInstance = function () {
12516
+ IDBCursor.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
12711
12517
  var IDBCursor = IDBCursorAlias.__super;
12712
12518
  IDBCursor.prototype = IDBCursorAlias.prototype;
12713
12519
 
12714
12520
  // @ts-expect-error It's ok
12715
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12716
- args[_key] = arguments[_key];
12717
- }
12718
- return _construct(IDBCursor, args);
12521
+ return new IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count);
12719
12522
  };
12720
12523
 
12721
12524
  /**
12722
12525
  *
12723
- * @param {...any} args
12526
+ * @param {import('./Key.js').Key|undefined} key
12527
+ * @param {import('./Key.js').Key|undefined} primaryKey
12528
+ * @param {WebSQLTransaction} tx
12529
+ * @param {KeySuccess} success
12530
+ * @param {FindError} error
12531
+ * @param {Integer} [recordsToLoad]
12724
12532
  * @this {IDBCursorFull}
12725
12533
  * @returns {void}
12726
12534
  */
12727
- IDBCursor.prototype.__find = function () {
12728
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12729
- args[_key2] = arguments[_key2];
12730
- }
12731
- var key = args[0],
12732
- primaryKey = args[1],
12733
- tx = args[2],
12734
- success = args[3],
12735
- error = args[4],
12736
- recordsToLoad = args[5];
12535
+ IDBCursor.prototype.__find = function (key, primaryKey, tx, success, error, recordsToLoad) {
12737
12536
  if (this.__multiEntryIndex) {
12738
12537
  this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
12739
12538
  } else {
@@ -12743,9 +12542,9 @@
12743
12542
 
12744
12543
  /**
12745
12544
  * @typedef {(
12746
- * k: import('./Key.js').Key,
12545
+ * k: import('./Key.js').Key|undefined,
12747
12546
  * val: import('./Key.js').Value,
12748
- * primKey: import('./Key.js').Key
12547
+ * primKey: import('./Key.js').Key|undefined
12749
12548
  * ) => void} KeySuccess
12750
12549
  */
12751
12550
 
@@ -12842,7 +12641,7 @@
12842
12641
  me.__prefetchedIndex = 0;
12843
12642
  me.__prefetchedData = data.rows;
12844
12643
  if (CFG.DEBUG) {
12845
- console.log('Preloaded ' + me.__prefetchedData.length + ' records for cursor');
12644
+ console.log('Preloaded ' + data.rows.length + ' records for cursor');
12846
12645
  }
12847
12646
  me.__decode(/** @type {RowItemNonNull} */data.rows.item(0), success);
12848
12647
  } else if (data.rows.length === 1) {
@@ -12967,7 +12766,7 @@
12967
12766
  for (var i = 0; i < data.rows.length; i++) {
12968
12767
  var rowItem = /** @type {RowItemNonNull} */data.rows.item(i);
12969
12768
  var rowKey = _decode(rowItem[me.__keyColumnName], true);
12970
- var matches = findMultiEntryMatches(rowKey, me.__range);
12769
+ var matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */rowKey, me.__range);
12971
12770
  ct += matches.length;
12972
12771
  }
12973
12772
  success(undefined, ct, undefined);
@@ -12987,7 +12786,7 @@
12987
12786
  for (var _i = 0; _i < data.rows.length; _i++) {
12988
12787
  var _rowItem = /** @type {RowItemNonNull} */data.rows.item(_i);
12989
12788
  var _rowKey = _decode(_rowItem[me.__keyColumnName], true);
12990
- var _matches = findMultiEntryMatches(_rowKey, me.__range);
12789
+ var _matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */_rowKey, me.__range);
12991
12790
  var _iterator = _createForOfIteratorHelper(_matches),
12992
12791
  _step;
12993
12792
  try {
@@ -13068,11 +12867,11 @@
13068
12867
  };
13069
12868
 
13070
12869
  /**
13071
- * @typedef {any} StructuredCloneValue
12870
+ * @typedef {import('./Key.js').Value} StructuredCloneValue
13072
12871
  */
13073
12872
 
13074
12873
  /**
13075
- * @typedef {any} IndexedDBKey
12874
+ * @typedef {import('./Key.js').Key} IndexedDBKey
13076
12875
  */
13077
12876
 
13078
12877
  /**
@@ -13084,9 +12883,9 @@
13084
12883
 
13085
12884
  /**
13086
12885
  * @callback SuccessCallback
13087
- * @param {IndexedDBKey} key
12886
+ * @param {IndexedDBKey|undefined} key
13088
12887
  * @param {StructuredCloneValue} value
13089
- * @param {IndexedDBKey} primaryKey
12888
+ * @param {IndexedDBKey|undefined} primaryKey
13090
12889
  * @returns {void}
13091
12890
  */
13092
12891
 
@@ -13126,9 +12925,9 @@
13126
12925
  *
13127
12926
  * @param {RowItemNonNull} rowItem
13128
12927
  * @param {(
13129
- * key: import('./Key.js').Key,
12928
+ * key: import('./Key.js').Key|undefined,
13130
12929
  * val: import('./Key.js').Value,
13131
- * primaryKey: import('./Key.js').Key,
12930
+ * primaryKey: import('./Key.js').Key|undefined,
13132
12931
  * encKey?: string
13133
12932
  * ) => void} callback
13134
12933
  * @this {IDBCursorFull}
@@ -13203,8 +13002,8 @@
13203
13002
 
13204
13003
  /**
13205
13004
  *
13206
- * @param {import('./Key.js').Key} key
13207
- * @param {import('./Key.js').Key} primaryKey
13005
+ * @param {import('./Key.js').Key|undefined} key
13006
+ * @param {import('./Key.js').Key|undefined} primaryKey
13208
13007
  * @param {boolean} advanceState
13209
13008
  * @this {IDBCursorFull}
13210
13009
  * @returns {void}
@@ -13218,9 +13017,9 @@
13218
13017
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
13219
13018
  me.__store.transaction.__pushToQueue(me.__request, function cursorContinue(tx, args, success, error, executeNextRequest) {
13220
13019
  /**
13221
- * @param {import('./Key.js').Key} k
13020
+ * @param {import('./Key.js').Key|undefined} k
13222
13021
  * @param {import('./Key.js').Value} val
13223
- * @param {import('./Key.js').Key} primKey
13022
+ * @param {import('./Key.js').Key|undefined} primKey
13224
13023
  * @returns {void}
13225
13024
  */
13226
13025
  function triggerSuccess(k, val, primKey) {
@@ -13262,7 +13061,7 @@
13262
13061
  // We have pre-loaded data for the cursor
13263
13062
  me.__prefetchedIndex++;
13264
13063
  if (me.__prefetchedIndex < me.__prefetchedData.length) {
13265
- me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13064
+ me.__decode(/** @type {RowItemNonNull} */me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13266
13065
  /**
13267
13066
  * @returns {void}
13268
13067
  */
@@ -13320,8 +13119,8 @@
13320
13119
  me.__find(key, primaryKey, tx, triggerSuccess, /** @type {FindError} */
13321
13120
  function () {
13322
13121
  me.__advanceCount = undefined;
13323
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
13324
- args[_key3] = arguments[_key3];
13122
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13123
+ args[_key] = arguments[_key];
13325
13124
  }
13326
13125
  var t = args[0],
13327
13126
  err = args[1];
@@ -13407,12 +13206,18 @@
13407
13206
  };
13408
13207
 
13409
13208
  /**
13410
- * @typedef {any} AnyValue
13209
+ * The `{query, count, direction}` options shape shared by
13210
+ * `getAll`/`getAllKeys`/`getAllRecords`.
13211
+ * @typedef {{
13212
+ * query?: import('./Key.js').Value,
13213
+ * count?: Integer,
13214
+ * direction?: string
13215
+ * }} GetAllOptions
13411
13216
  */
13412
13217
 
13413
13218
  /**
13414
13219
  *
13415
- * @param {AnyValue} valueToUpdate
13220
+ * @param {import('./Key.js').Value} valueToUpdate
13416
13221
  * @this {IDBCursorFull}
13417
13222
  * @returns {IDBRequest}
13418
13223
  */
@@ -13538,25 +13343,22 @@
13538
13343
  var IDBCursorWithValueAlias = IDBCursorWithValue;
13539
13344
  /**
13540
13345
  *
13541
- * @param {...any} args
13346
+ * @param {IDBKeyRange} query
13347
+ * @param {string} direction
13348
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
13349
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
13350
+ * import('./IDBIndex.js').IDBIndexFull} source
13351
+ * @param {string} keyColumnName
13352
+ * @param {string} valueColumnName
13353
+ * @param {boolean} [count]
13542
13354
  * @returns {IDBCursorWithValueFull}
13543
13355
  */
13544
- IDBCursorWithValue.__createInstance = function () {
13545
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
13546
- args[_key4] = arguments[_key4];
13547
- }
13356
+ IDBCursorWithValue.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
13548
13357
  /**
13549
13358
  * @class
13550
13359
  * @this {IDBCursorWithValueFull}
13551
13360
  */
13552
13361
  function IDBCursorWithValue() {
13553
- var query = args[0],
13554
- direction = args[1],
13555
- store = args[2],
13556
- source = args[3],
13557
- keyColumnName = args[4],
13558
- valueColumnName = args[5],
13559
- count = args[6];
13560
13362
  IDBCursor.__super.call(this, query, direction, store, source, keyColumnName, valueColumnName, count);
13561
13363
  // @ts-expect-error It's ok
13562
13364
  this[Symbol.toStringTag] = 'IDBCursorWithValue';
@@ -13579,12 +13381,16 @@
13579
13381
  /**
13580
13382
  * Validates `direction` and fills in defaults for the `{query, count,
13581
13383
  * direction}` shape shared by `getAll`/`getAllKeys`/`getAllRecords`.
13582
- * @param {AnyValue} options
13384
+ * @param {unknown} options
13583
13385
  * @throws {TypeError}
13584
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13386
+ * @returns {{
13387
+ * query: import('./Key.js').Value|undefined,
13388
+ * count: Integer|undefined,
13389
+ * direction: string
13390
+ * }}
13585
13391
  */
13586
13392
  function normalizeGetAllOptions(options) {
13587
- var _ref = /** @type {AnyValue} */options !== null && options !== void 0 ? options : {},
13393
+ var _ref = /** @type {GetAllOptions} */options !== null && options !== void 0 ? options : {},
13588
13394
  query = _ref.query,
13589
13395
  count = _ref.count,
13590
13396
  _ref$direction = _ref.direction,
@@ -13613,7 +13419,11 @@
13613
13419
  * first argument wins regardless of how many arguments were actually passed.
13614
13420
  * @param {IArguments} args
13615
13421
  * @throws {TypeError}
13616
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13422
+ * @returns {{
13423
+ * query: import('./Key.js').Value|undefined,
13424
+ * count: Integer|undefined,
13425
+ * direction: string
13426
+ * }}
13617
13427
  */
13618
13428
  function parseGetAllArgs(args) {
13619
13429
  var arg0 = args[0];
@@ -13636,7 +13446,11 @@
13636
13446
  * form to disambiguate against.
13637
13447
  * @param {IArguments} args
13638
13448
  * @throws {TypeError}
13639
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13449
+ * @returns {{
13450
+ * query: import('./Key.js').Value|undefined,
13451
+ * count: Integer|undefined,
13452
+ * direction: string
13453
+ * }}
13640
13454
  */
13641
13455
  function parseGetAllRecordsArgs(args) {
13642
13456
  return normalizeGetAllOptions(args[0]);
@@ -13743,7 +13557,7 @@
13743
13557
  value: direction
13744
13558
  });
13745
13559
  return tx.__addToTransactionQueue(function collectAllOp(sqlTx, args, success, error) {
13746
- /** @type {AnyValue[]} */
13560
+ /** @type {unknown[]} */
13747
13561
  var results = [];
13748
13562
  var recordsToLoad = count || CFG.cursorPreloadPackSize || 100;
13749
13563
 
@@ -13783,7 +13597,7 @@
13783
13597
  if (state.__prefetchedData) {
13784
13598
  state.__prefetchedIndex++;
13785
13599
  if (state.__prefetchedIndex < state.__prefetchedData.length) {
13786
- IDBCursor.prototype.__decode.call(state, state.__prefetchedData.item(state.__prefetchedIndex),
13600
+ IDBCursor.prototype.__decode.call(state, /** @type {RowItemNonNull} */state.__prefetchedData.item(state.__prefetchedIndex),
13787
13601
  /**
13788
13602
  * @param {import('./Key.js').Key} k
13789
13603
  * @param {import('./Key.js').Value} val
@@ -13813,15 +13627,11 @@
13813
13627
  }, undefined, source);
13814
13628
  }
13815
13629
 
13816
- /**
13817
- * @typedef {any} AnyValue
13818
- */
13819
-
13820
13630
  /**
13821
13631
  * @callback SetConfig
13822
13632
  * @param {import('./CFG.js').KeyofConfigValues|
13823
13633
  * Partial<import('./CFG.js').ConfigValues>} prop
13824
- * @param {AnyValue} [val]
13634
+ * @param {import('./CFG.js').ConfigValue} [val]
13825
13635
  * @throws {Error}
13826
13636
  * @returns {void}
13827
13637
  */
@@ -13909,18 +13719,9 @@
13909
13719
  }
13910
13720
  var IDB = /** @type {ShimmedObject & {[key: string]: unknown}} */
13911
13721
  /** @type {unknown} */idb || globalThis || {};
13912
- /**
13913
- * @typedef {any} AnyClass
13914
- */
13915
- /**
13916
- * @typedef {any} AnyValue
13917
- */
13918
- /**
13919
- * @typedef {Function} AnyFunction
13920
- */
13921
13722
  /**
13922
13723
  * @param {string} name
13923
- * @param {AnyClass} value
13724
+ * @param {unknown} value
13924
13725
  * @param {PropertyDescriptor & {
13925
13726
  * shimNS?: object
13926
13727
  * }|undefined} [propDesc]
@@ -13948,7 +13749,7 @@
13948
13749
  }
13949
13750
  } else {
13950
13751
  var o = _defineAccessor("get", {}, name, function () {
13951
- return /** @type {AnyFunction} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13752
+ return /** @type {() => unknown} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13952
13753
  });
13953
13754
  desc = /** @type {PropertyDescriptor} */
13954
13755
  Object.getOwnPropertyDescriptor(o, name);
@@ -14022,7 +13823,7 @@
14022
13823
  return shimIndexedDB;
14023
13824
  }
14024
13825
  });
14025
- /** @type {[string, any][]} */
13826
+ /** @type {[string, unknown][]} */
14026
13827
  [['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) {
14027
13828
  var _ref4 = _slicedToArray(_ref3, 2),
14028
13829
  prop = _ref4[0],
@@ -14111,7 +13912,7 @@
14111
13912
  IDB.shimIndexedDB = /** @type {ShimIndexedDB} */{};
14112
13913
  /** @type {const} */
14113
13914
  ['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach(function (prop) {
14114
- /** @type {ShimIndexedDB} */IDB.shimIndexedDB[prop] = /** @type {() => any} */function () {
13915
+ /** @type {{[key: string]: () => void}} */(/** @type {unknown} */IDB.shimIndexedDB)[prop] = function () {
14115
13916
  console.warn('This browser does not have WebSQL to shim.');
14116
13917
  };
14117
13918
  });