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];
@@ -1925,7 +1918,7 @@
1925
1918
  // Callback not used by default
1926
1919
  // Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
1927
1920
  'escapeNULForSQLiteStatements', 'sqlMemoryQuota', 'createIndexes'].forEach(function (prop) {
1928
- /** @type {(val: any) => void} */
1921
+ /** @type {(val: ConfigValue) => void} */
1929
1922
  var validator;
1930
1923
  if (Array.isArray(prop)) {
1931
1924
  var _prop = prop;
@@ -2125,8 +2118,32 @@
2125
2118
  }
2126
2119
 
2127
2120
  /**
2128
- * @typedef {Function} AnyClass
2121
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
2122
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
2123
+ * `base` is a directory path expected to be absolute and normalized (an
2124
+ * empty string means the current working directory). Unlike `path.join`,
2125
+ * this performs no `.`/`..` resolution. It reuses the separator style of
2126
+ * `base` (backslash only when `base` uses backslashes and no forward
2127
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
2128
+ * `websql-configurable` accept either separator on Windows regardless.
2129
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
2130
+ * @param {string} base
2131
+ * @param {string} name
2132
+ * @returns {string}
2133
+ */
2134
+ function joinPath(base, name) {
2135
+ if (!base) {
2136
+ return name;
2137
+ }
2138
+ var sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
2139
+ return base.replace(/[\/\\]+$/, '') + sep + name;
2140
+ }
2141
+
2142
+ /* eslint-disable jsdoc/valid-types -- Bug */
2143
+ /**
2144
+ * @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
2129
2145
  */
2146
+ /* eslint-enable jsdoc/valid-types -- Bug */
2130
2147
 
2131
2148
  // Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
2132
2149
  /**
@@ -2150,7 +2167,7 @@
2150
2167
 
2151
2168
  /**
2152
2169
  *
2153
- * @param {object} obj
2170
+ * @param {AnyValue} obj
2154
2171
  * @returns {boolean}
2155
2172
  */
2156
2173
  function isDate(obj) {
@@ -2159,7 +2176,7 @@
2159
2176
 
2160
2177
  /**
2161
2178
  *
2162
- * @param {object} obj
2179
+ * @param {AnyValue} obj
2163
2180
  * @returns {boolean}
2164
2181
  */
2165
2182
  function isBlob(obj) {
@@ -2168,7 +2185,7 @@
2168
2185
 
2169
2186
  /**
2170
2187
  *
2171
- * @param {object} obj
2188
+ * @param {AnyValue} obj
2172
2189
  * @returns {boolean}
2173
2190
  */
2174
2191
  function isFile(obj) {
@@ -2190,7 +2207,7 @@
2190
2207
  /**
2191
2208
  *
2192
2209
  * @param {AnyValue} obj
2193
- * @returns {boolean}
2210
+ * @returns {obj is Iterable<unknown>}
2194
2211
  */
2195
2212
  function isIterable(obj) {
2196
2213
  return isObj(obj) &&
@@ -2236,9 +2253,7 @@
2236
2253
 
2237
2254
  /**
2238
2255
  *
2239
- * @param {object & {
2240
- * [key: string]: any
2241
- * }} obj
2256
+ * @param {object} obj
2242
2257
  * @param {string[]} listeners
2243
2258
  * @returns {void}
2244
2259
  */
@@ -2246,9 +2261,9 @@
2246
2261
  listeners = typeof listeners === 'string' ? [listeners] : listeners;
2247
2262
  listeners.forEach(function (listener) {
2248
2263
  var o = _defineAccessor("set", _defineAccessor("get", {}, listener, function () {
2249
- return obj['__' + listener];
2264
+ return Reflect.get(obj, '__' + listener);
2250
2265
  }), listener, function (val) {
2251
- obj['__' + listener] = val;
2266
+ Reflect.set(obj, '__' + listener, val);
2252
2267
  });
2253
2268
  var desc = /** @type {PropertyDescriptor} */
2254
2269
  Object.getOwnPropertyDescriptor(o, listener);
@@ -2257,7 +2272,7 @@
2257
2272
  Object.defineProperty(obj, listener, desc);
2258
2273
  });
2259
2274
  listeners.forEach(function (l) {
2260
- obj[l] = null;
2275
+ Reflect.set(obj, l, null);
2261
2276
  });
2262
2277
  }
2263
2278
 
@@ -2266,7 +2281,7 @@
2266
2281
  * @param {object} obj
2267
2282
  * @param {string|string[]} props
2268
2283
  * @param {null|{
2269
- * [key: string]: any
2284
+ * [key: string]: unknown
2270
2285
  * }} getter
2271
2286
  * @returns {void}
2272
2287
  */
@@ -2402,7 +2417,7 @@
2402
2417
  }
2403
2418
 
2404
2419
  /**
2405
- * @typedef {any} AnyValue
2420
+ * @typedef {unknown} AnyValue
2406
2421
  */
2407
2422
 
2408
2423
  /**
@@ -2420,8 +2435,11 @@
2420
2435
  */
2421
2436
  function ToString(o) {
2422
2437
  // Todo: See `es-abstract/es7`
2423
- // `String()` will not throw with Symbols
2424
- return '' + o; // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2438
+ // `String()` will not throw with Symbols, but the unchecked `+ ''`
2439
+ // coercion deliberately does (Web IDL requires converting a symbol
2440
+ // to `DOMString` to throw a `TypeError`); the assertion only tells
2441
+ // the compiler to allow the coercion it cannot model.
2442
+ return '' + (/** @type {string} */o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
2425
2443
  }
2426
2444
 
2427
2445
  /**
@@ -2528,12 +2546,9 @@
2528
2546
  // We don't add within polyfill repo as might not always be the desired implementation
2529
2547
  Object.defineProperty(ShimEvent, Symbol.hasInstance, {
2530
2548
  /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2531
- /**
2532
- * @typedef {any} AnyValue
2533
- */
2534
2549
  value:
2535
2550
  /**
2536
- * @param {AnyValue} obj
2551
+ * @param {unknown} obj
2537
2552
  * @returns {boolean}
2538
2553
  */
2539
2554
  function value(obj) {
@@ -2604,12 +2619,9 @@
2604
2619
  Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);
2605
2620
  });
2606
2621
  Object.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {
2607
- /**
2608
- * @typedef {any} AnyValue
2609
- */
2610
2622
  value:
2611
2623
  /**
2612
- * @param {AnyValue} obj
2624
+ * @param {unknown} obj
2613
2625
  * @returns {boolean}
2614
2626
  */
2615
2627
  function value(obj) {
@@ -2867,7 +2879,7 @@
2867
2879
 
2868
2880
  /**
2869
2881
  * @typedef {{
2870
- * message: string|DOMString
2882
+ * message: string
2871
2883
  * }} ErrorLike
2872
2884
  */
2873
2885
 
@@ -2891,25 +2903,20 @@
2891
2903
  }
2892
2904
 
2893
2905
  /**
2894
- * @typedef {any} ArbitraryValue
2895
- */
2896
-
2897
- /**
2898
- * @param {ArbitraryValue} obj
2906
+ * @param {unknown} obj
2899
2907
  * @returns {boolean}
2900
2908
  */
2901
2909
  function isErrorOrDOMErrorOrDOMException(obj) {
2902
- return obj && _typeof(obj) === 'object' &&
2903
2910
  // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
2904
- typeof obj.name === 'string';
2911
+ return _typeof(obj) === 'object' && obj !== null && 'name' in obj && typeof obj.name === 'string';
2905
2912
  }
2906
2913
 
2907
2914
  /**
2908
2915
  * Finds the error argument. This is useful because some WebSQL callbacks
2909
2916
  * pass the error as the first argument, and some pass it as the second
2910
2917
  * argument.
2911
- * @param {(Error|{message?: string, name?: string}|any)[]} args
2912
- * @returns {Error|DOMException|undefined}
2918
+ * @param {unknown[]} args
2919
+ * @returns {unknown}
2913
2920
  */
2914
2921
  function findError(args) {
2915
2922
  var err;
@@ -2925,7 +2932,7 @@
2925
2932
  if (isErrorOrDOMErrorOrDOMException(arg)) {
2926
2933
  return arg;
2927
2934
  }
2928
- if (arg && typeof arg.message === 'string') {
2935
+ if (_typeof(arg) === 'object' && arg !== null && 'message' in arg && typeof arg.message === 'string') {
2929
2936
  err = arg;
2930
2937
  }
2931
2938
  }
@@ -3050,7 +3057,7 @@
3050
3057
  * @typedef {IDBRequest & EventTarget & import('eventtargeter').EventTargetInstance & {
3051
3058
  * transaction: import('./IDBTransaction.js').IDBTransactionFull,
3052
3059
  * __done: boolean,
3053
- * __result: import('./IDBDatabase.js').IDBDatabaseFull|undefined,
3060
+ * __result: unknown,
3054
3061
  * __error: null|DOMException|Error,
3055
3062
  * __source: null|import('./IDBDatabase.js').IDBDatabaseFull|
3056
3063
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
@@ -3520,8 +3527,8 @@
3520
3527
 
3521
3528
  /**
3522
3529
  * Compares two keys.
3523
- * @param {import('./Key.js').Key} first
3524
- * @param {import('./Key.js').Key} second
3530
+ * @param {import('./Key.js').Key|null|undefined} first
3531
+ * @param {import('./Key.js').Key|null|undefined} second
3525
3532
  * @returns {0|1|-1}
3526
3533
  */
3527
3534
  function cmp(first, second) {
@@ -3598,12 +3605,11 @@
3598
3605
  */
3599
3606
 
3600
3607
  /**
3601
- * @typedef {any} Value
3608
+ * @typedef {unknown} Value
3602
3609
  */
3603
3610
 
3604
3611
  /**
3605
- * @typedef {any} Key
3606
- * @todo Specify possible value more precisely
3612
+ * @typedef {IDBValidKey} Key
3607
3613
  */
3608
3614
 
3609
3615
  /**
@@ -3670,15 +3676,11 @@
3670
3676
  */
3671
3677
  var signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
3672
3678
 
3673
- /**
3674
- * @typedef {any} AnyValue
3675
- */
3676
-
3677
3679
  /**
3678
3680
  * @type {{
3679
3681
  * [key: string]: {
3680
- * encode: (param: any, inArray?: boolean) => string,
3681
- * decode: (param: string, inArray?: boolean) => any
3682
+ * encode(param: unknown, inArray?: boolean): string,
3683
+ * decode(param: string, inArray?: boolean): ValueType|undefined
3682
3684
  * }
3683
3685
  * }}
3684
3686
  */
@@ -4033,7 +4035,7 @@
4033
4035
  }
4034
4036
 
4035
4037
  /**
4036
- * @param {Key} key
4038
+ * @param {Value} key
4037
4039
  * @returns {KeyType|"invalid"}
4038
4040
  */
4039
4041
  function getKeyType(key) {
@@ -4177,7 +4179,7 @@
4177
4179
  case 'array':
4178
4180
  {
4179
4181
  // May throw (from binary)
4180
- var arr = /** @type {Array<any>} */input;
4182
+ var arr = /** @type {unknown[]} */input;
4181
4183
  var len = arr.length;
4182
4184
  safePush(seen, input);
4183
4185
 
@@ -4210,9 +4212,9 @@
4210
4212
  };
4211
4213
  }
4212
4214
  if (!multiEntry || !fullKeys && keys.every(function (k) {
4213
- return cmp(k, key.value) !== 0;
4215
+ return cmp(/** @type {Key} */k, /** @type {Key} */key.value) !== 0;
4214
4216
  }) || fullKeys && keys.every(function (k) {
4215
- return cmp(k, key) !== 0;
4217
+ return cmp(/** @type {Key} */k, /** @type {Key} */ /** @type {unknown} */key) !== 0;
4216
4218
  })) {
4217
4219
  safePush(keys, fullKeys ? key : key.value);
4218
4220
  }
@@ -4269,7 +4271,7 @@
4269
4271
 
4270
4272
  /**
4271
4273
  *
4272
- * @param {Key} key
4274
+ * @param {Value} key
4273
4275
  * @param {boolean} [fullKeys]
4274
4276
  * @returns {KeyValueObject}
4275
4277
  * @todo Document other allowable `key`?
@@ -4384,7 +4386,7 @@
4384
4386
  }
4385
4387
  if (keyPath === '') {
4386
4388
  return {
4387
- value: value
4389
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4388
4390
  };
4389
4391
  }
4390
4392
  var identifiers = keyPath.split('.');
@@ -4418,13 +4420,13 @@
4418
4420
  }) ? {
4419
4421
  failure: true
4420
4422
  } : {
4421
- value: value
4423
+ value: (/** @type {KeyPathEvaluateValueValue} */value)
4422
4424
  };
4423
4425
  }
4424
4426
 
4425
4427
  /**
4426
4428
  * Sets the inline key value.
4427
- * @param {{[key: string]: AnyValue}} value
4429
+ * @param {{[key: string]: Value}} value
4428
4430
  * @param {Key} key
4429
4431
  * @param {string} keyPath
4430
4432
  * @returns {void}
@@ -4442,7 +4444,7 @@
4442
4444
  configurable: true
4443
4445
  });
4444
4446
  }
4445
- value = value[identifier];
4447
+ value = /** @type {{[key: string]: Value}} */value[identifier];
4446
4448
  });
4447
4449
  Object.defineProperty(value, /** @type {string} */last, {
4448
4450
  value: key,
@@ -4527,7 +4529,7 @@
4527
4529
  * @returns {Key[]}
4528
4530
  */
4529
4531
  function findMultiEntryMatches(keyEntry, range) {
4530
- /** @type {unknown[]} */
4532
+ /** @type {Key[]} */
4531
4533
  var matches = [];
4532
4534
  if (Array.isArray(keyEntry)) {
4533
4535
  var _iterator4 = _createForOfIteratorHelper(keyEntry),
@@ -4566,7 +4568,7 @@
4566
4568
 
4567
4569
  /**
4568
4570
  * Not currently in use but keeping for spec parity.
4569
- * @param {Key} key
4571
+ * @param {KeyValueObject} key
4570
4572
  * @throws {Error} Upon a "bad key"
4571
4573
  * @returns {ValueType}
4572
4574
  */
@@ -4577,16 +4579,17 @@
4577
4579
  case 'number':
4578
4580
  case 'string':
4579
4581
  {
4580
- return value;
4582
+ return /** @type {number|string} */value;
4581
4583
  }
4582
4584
  case 'array':
4583
4585
  {
4584
4586
  /** @type {ValueType[]} */
4585
4587
  var array = [];
4586
- var len = value.length;
4588
+ var arrValue = /** @type {KeyValueObject[]} */value;
4589
+ var len = arrValue.length;
4587
4590
  var index = 0;
4588
4591
  while (index < len) {
4589
- var entry = convertKeyToValue(value[index]);
4592
+ var entry = convertKeyToValue(arrValue[index]);
4590
4593
  setArrayValue(array, index, entry);
4591
4594
  index++;
4592
4595
  }
@@ -4594,18 +4597,18 @@
4594
4597
  }
4595
4598
  case 'date':
4596
4599
  {
4597
- return new Date(value);
4600
+ return new Date(/** @type {number} */value);
4598
4601
  }
4599
4602
  case 'binary':
4600
4603
  {
4601
- var _len = value.length;
4604
+ var binValue = /** @type {Uint8Array} */value;
4605
+ var _len = binValue.length;
4602
4606
  var buffer = new ArrayBuffer(_len);
4603
4607
  // Set the entries in buffer's [[ArrayBufferData]] to those in `value`
4604
- var uint8 = new Uint8Array(buffer, value.byteOffset || 0, value.byteLength);
4605
- uint8.set(value);
4608
+ var uint8 = new Uint8Array(buffer, binValue.byteOffset || 0, binValue.byteLength);
4609
+ uint8.set(binValue);
4606
4610
  return buffer;
4607
4611
  }
4608
- case 'invalid':
4609
4612
  default:
4610
4613
  throw new Error('Bad key');
4611
4614
  }
@@ -4613,7 +4616,7 @@
4613
4616
 
4614
4617
  /**
4615
4618
  *
4616
- * @param {Key} key
4619
+ * @param {Value} key
4617
4620
  * @param {boolean} [inArray]
4618
4621
  * @returns {string|null}
4619
4622
  */
@@ -4628,7 +4631,7 @@
4628
4631
 
4629
4632
  /**
4630
4633
  *
4631
- * @param {Key} key
4634
+ * @param {string|null} key
4632
4635
  * @param {boolean} [inArray]
4633
4636
  * @throws {Error} Invalid number
4634
4637
  * @returns {undefined|ValueType}
@@ -4642,7 +4645,7 @@
4642
4645
 
4643
4646
  /**
4644
4647
  *
4645
- * @param {Key} key
4648
+ * @param {Value} key
4646
4649
  * @param {boolean} [inArray]
4647
4650
  * @returns {undefined|ValueType}
4648
4651
  */
@@ -4860,8 +4863,8 @@
4860
4863
  var IDBKeyRangeAlias = IDBKeyRange;
4861
4864
 
4862
4865
  /**
4863
- * @param {import('./Key.js').Key|null} lower
4864
- * @param {import('./Key.js').Key|null} upper
4866
+ * @param {import('./Key.js').Value} lower
4867
+ * @param {import('./Key.js').Value} upper
4865
4868
  * @param {boolean} lowerOpen
4866
4869
  * @param {boolean} upperOpen
4867
4870
  * @returns {import('./IDBKeyRange.js').IDBKeyRangeFull}
@@ -5058,10 +5061,11 @@
5058
5061
  function convertValueToKeyRange(value, nullDisallowed) {
5059
5062
  if (instanceOf(value, IDBKeyRange)) {
5060
5063
  // We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)
5061
- if (value.toString() !== '[object IDBKeyRange]') {
5062
- return IDBKeyRange.__createInstance(value.lower, value.upper, value.lowerOpen, value.upperOpen);
5064
+ var range = /** @type {IDBKeyRangeFull} */value;
5065
+ if (range.toString() !== '[object IDBKeyRange]') {
5066
+ return IDBKeyRange.__createInstance(range.lower, range.upper, range.lowerOpen, range.upperOpen);
5063
5067
  }
5064
- return value;
5068
+ return range;
5065
5069
  }
5066
5070
  if (isNullish(value)) {
5067
5071
  if (nullDisallowed) {
@@ -5088,7 +5092,7 @@
5088
5092
  * clone: () => DOMStringListFull,
5089
5093
  * contains: (str: string) => boolean,
5090
5094
  * indexOf: (str: string) => Integer,
5091
- * splice: (index: Integer, howmany: Integer, ...args: any) => void
5095
+ * splice: (index: Integer, howmany: Integer, ...args: string[]) => void
5092
5096
  * length: Integer
5093
5097
  * }} DOMStringListFull
5094
5098
  */
@@ -5204,9 +5208,10 @@
5204
5208
  },
5205
5209
  /**
5206
5210
  * @this {DOMStringListFull}
5207
- * @param {(value: string, i: Integer, arr: string[]) => any[]} cb
5211
+ * @template T
5212
+ * @param {(value: string, i: Integer, arr: string[]) => T} cb
5208
5213
  * @param {object} thisArg
5209
- * @returns {any[]}
5214
+ * @returns {T[]}
5210
5215
  */
5211
5216
  map: function map(cb, thisArg) {
5212
5217
  // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
@@ -5231,10 +5236,7 @@
5231
5236
  this.sortList();
5232
5237
  },
5233
5238
  /**
5234
- * @typedef {any} AnyArgs
5235
- */
5236
- /**
5237
- * @param {[index: Integer, howmany: Integer, ...args: any]} args
5239
+ * @param {[index: Integer, howmany: Integer, ...args: string[]]} args
5238
5240
  * @this {DOMStringListFull}
5239
5241
  * @returns {void}
5240
5242
  */
@@ -5272,12 +5274,9 @@
5272
5274
  }));
5273
5275
 
5274
5276
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
5275
- /**
5276
- * @typedef {any} AnyValue
5277
- */
5278
5277
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
5279
5278
  /**
5280
- * @param {AnyValue} obj
5279
+ * @param {unknown} obj
5281
5280
  * @returns {boolean}
5282
5281
  */
5283
5282
  value: function value(obj) {
@@ -5358,7 +5357,7 @@
5358
5357
  /**
5359
5358
  * @typedef {{
5360
5359
  * op: SQLCallback,
5361
- * args: ObjectArray,
5360
+ * args: unknown[],
5362
5361
  * req: import('./IDBRequest.js').IDBRequestFull|null
5363
5362
  * }} RequestInfo
5364
5363
  */
@@ -5410,17 +5409,17 @@
5410
5409
  * __pushToQueue: (
5411
5410
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5412
5411
  * callback: SQLCallback,
5413
- * args?: ObjectArray
5412
+ * args?: unknown[]
5414
5413
  * ) => void,
5415
5414
  * __assertActive: () => void,
5416
5415
  * commit: () => void,
5417
5416
  * __addNonRequestToTransactionQueue: (
5418
5417
  * callback: SQLCallback,
5419
- * args?: ObjectArray
5418
+ * args?: unknown[]
5420
5419
  * ) => void
5421
5420
  * __addToTransactionQueue: (
5422
5421
  * callback: SQLCallback,
5423
- * args: ObjectArray|undefined,
5422
+ * args: unknown[]|undefined,
5424
5423
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5425
5424
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5426
5425
  * import('./IDBIndex.js').IDBIndexFull|
@@ -5622,7 +5621,7 @@
5622
5621
  i = -1;
5623
5622
 
5624
5623
  /**
5625
- * @typedef {any} IDBRequestResult
5624
+ * @typedef {unknown} IDBRequestResult
5626
5625
  */
5627
5626
 
5628
5627
  /**
@@ -6058,8 +6057,8 @@
6058
6057
  /**
6059
6058
  * @typedef {(
6060
6059
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6061
- * args: ObjectArray,
6062
- * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6060
+ * args: unknown[],
6061
+ * success: (result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6063
6062
  * error: (
6064
6063
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
6065
6064
  * err?: Error & {code?: number}
@@ -6071,7 +6070,7 @@
6071
6070
  /**
6072
6071
  * Adds a callback function to the transaction queue.
6073
6072
  * @param {SQLCallback} callback
6074
- * @param {ObjectArray} args
6073
+ * @param {unknown[]} args
6075
6074
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6076
6075
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6077
6076
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6088,7 +6087,7 @@
6088
6087
  * Adds a callback function to the transaction queue without generating a
6089
6088
  * request.
6090
6089
  * @param {SQLCallback} callback
6091
- * @param {ObjectArray} args
6090
+ * @param {unknown[]} args
6092
6091
  * @this {IDBTransactionFull}
6093
6092
  * @returns {void}
6094
6093
  */
@@ -6100,7 +6099,7 @@
6100
6099
  * Adds an IDBRequest to the transaction queue.
6101
6100
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6102
6101
  * @param {SQLCallback} callback
6103
- * @param {ObjectArray} args
6102
+ * @param {unknown[]} args
6104
6103
  * @this {IDBTransactionFull}
6105
6104
  * @returns {void}
6106
6105
  */
@@ -6271,7 +6270,7 @@
6271
6270
  bubbles: true,
6272
6271
  cancelable: true
6273
6272
  });
6274
- return new SyncPromise(/** @type {(resolve: (value?: any) => void) => void} */
6273
+ return new SyncPromise(/** @type {(resolve: (value?: unknown) => void) => void} */
6275
6274
  function (resolve) {
6276
6275
  setTimeout(function () {
6277
6276
  if (!q.req) {
@@ -8434,7 +8433,7 @@
8434
8433
  }
8435
8434
 
8436
8435
  /**
8437
- * @typedef {any} AnyValue
8436
+ * @typedef {import('./Key.js').Value} AnyValue
8438
8437
  */
8439
8438
 
8440
8439
  /**
@@ -8544,7 +8543,7 @@
8544
8543
  * __keyPath: import('./Key.js').KeyPath,
8545
8544
  * __recreated?: boolean,
8546
8545
  * __fetchIndexData: (
8547
- * range: any,
8546
+ * range: Query,
8548
8547
  * opType: "value"|"key"|"count",
8549
8548
  * nullDisallowed: boolean,
8550
8549
  * count?: number
@@ -8916,7 +8915,7 @@
8916
8915
  };
8917
8916
 
8918
8917
  /**
8919
- * @typedef {any|IDBKeyRange} Query
8918
+ * @typedef {import('./Key.js').Value|IDBKeyRange} Query
8920
8919
  */
8921
8920
 
8922
8921
  /**
@@ -9199,7 +9198,7 @@
9199
9198
  reject(err);
9200
9199
  });
9201
9200
  }));
9202
- SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: any) => PromiseLike<never>} */
9201
+ SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: unknown) => PromiseLike<never>} */
9203
9202
  error).catch(function (err) {
9204
9203
  console.log('Index rename error');
9205
9204
  throw err;
@@ -9211,14 +9210,10 @@
9211
9210
  });
9212
9211
  };
9213
9212
 
9214
- /**
9215
- * @typedef {any} AnyValue
9216
- */
9217
-
9218
9213
  /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
9219
9214
  Object.defineProperty(IDBIndex, Symbol.hasInstance, {
9220
9215
  /**
9221
- * @param {AnyValue} obj
9216
+ * @param {unknown} obj
9222
9217
  * @returns {boolean}
9223
9218
  */
9224
9219
  value: function value(obj) {
@@ -9246,7 +9241,9 @@
9246
9241
  * @param {string[]} sqlValues
9247
9242
  * @param {WebSQLTransaction} tx
9248
9243
  * @param {null|undefined} args
9249
- * @param {(result: number|undefined|[]|AnyValue|AnyValue[]) => void} success
9244
+ * @param {(
9245
+ * result: number|undefined|[]|import('./Key.js').Value|import('./Key.js').Value[]
9246
+ * ) => void} success
9250
9247
  * @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
9251
9248
  * @returns {void}
9252
9249
  */
@@ -9283,7 +9280,7 @@
9283
9280
  * @param {{
9284
9281
  * value: string
9285
9282
  * }} record
9286
- * @returns {AnyValue}
9283
+ * @returns {import('./Key.js').Value}
9287
9284
  */
9288
9285
  function (record) {
9289
9286
  // when opType is value
@@ -9297,9 +9294,9 @@
9297
9294
  var rowKey = /** @type {import('./Key.js').ValueTypeArray} */
9298
9295
  _decode(row[escapedIndexNameForKeyCol]);
9299
9296
  var record;
9300
- if (hasKey && (multiChecks && range.some(
9297
+ if (hasKey && (multiChecks && /** @type {import('./Key.js').ValueType[]} */range.some(
9301
9298
  /**
9302
- * @param {string} check
9299
+ * @param {import('./Key.js').ValueType} check
9303
9300
  * @returns {boolean}
9304
9301
  */
9305
9302
  function (check) {
@@ -9450,14 +9447,14 @@
9450
9447
  * __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
9451
9448
  * __validateKeyAndValueAndCloneValue: (
9452
9449
  * value: import('./Key.js').Value,
9453
- * key: import('./Key.js').Key,
9450
+ * key: import('./Key.js').Key|undefined,
9454
9451
  * cursorUpdate: boolean
9455
9452
  * ) => KeyValueArray,
9456
9453
  * __deriveKey: (
9457
9454
  * tx: WebSQLTransaction,
9458
9455
  * value: import('./Key.js').Value,
9459
- * key: import('./Key.js').Key,
9460
- * success: (key: import('./Key.js').Key, cn?: Integer) => void,
9456
+ * key: import('./Key.js').Key|undefined,
9457
+ * success: (key: import('./Key.js').Value, cn?: Integer) => void,
9461
9458
  * failCb: import('./Key.js').SQLFailureCallback
9462
9459
  * ) => void,
9463
9460
  * __checkIndexConstraints: (
@@ -9766,7 +9763,7 @@
9766
9763
  };
9767
9764
 
9768
9765
  /**
9769
- * @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
9766
+ * @typedef {[import('./Key.js').Key|undefined, import('./Key.js').Value]} KeyValueArray
9770
9767
  */
9771
9768
 
9772
9769
  // Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
@@ -9781,7 +9778,7 @@
9781
9778
  * Determines whether the given inline or out-of-line key is valid,
9782
9779
  * according to the object store's schema.
9783
9780
  * @param {import('./Key.js').Value} value Used for inline keys
9784
- * @param {import('./Key.js').Key} key Used for out-of-line keys
9781
+ * @param {import('./Key.js').Key|undefined} key Used for out-of-line keys
9785
9782
  * @param {boolean} cursorUpdate
9786
9783
  * @throws {DOMException}
9787
9784
  * @this {IDBObjectStoreFull}
@@ -9797,11 +9794,11 @@
9797
9794
  // occurs sync; then can make cloning and this method without callbacks (except where ok
9798
9795
  // to be async)
9799
9796
  var _clonedValue = cloneWithInactiveTransaction(/** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction, value);
9800
- key = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9801
- if (key.invalid) {
9797
+ var extractedKey = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
9798
+ if ('invalid' in extractedKey && extractedKey.invalid) {
9802
9799
  throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');
9803
9800
  }
9804
- if (key.failure) {
9801
+ if ('failure' in extractedKey && extractedKey.failure) {
9805
9802
  if (!cursorUpdate) {
9806
9803
  if (!me.autoIncrement) {
9807
9804
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
@@ -9816,14 +9813,13 @@
9816
9813
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath');
9817
9814
  }
9818
9815
  // An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key
9819
- return [key.value, _clonedValue];
9816
+ return [(/** @type {import('./Key.js').Key} */extractedKey.value), _clonedValue];
9820
9817
  }
9821
9818
  if (key === undefined) {
9822
9819
  if (!me.autoIncrement) {
9823
9820
  throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
9824
9821
  }
9825
9822
  // A key will be generated
9826
- key = undefined;
9827
9823
  } else {
9828
9824
  convertValueToKeyRethrowingAndIfInvalid(key);
9829
9825
  }
@@ -9838,8 +9834,8 @@
9838
9834
  * a keyPath leading to a valid but non-numeric or < 1 key).
9839
9835
  * @param {WebSQLTransaction} tx
9840
9836
  * @param {import('./Key.js').Value} value
9841
- * @param {import('./Key.js').Key} key
9842
- * @param {(key: import('./Key.js').Key, cn?: Integer) => void} success
9837
+ * @param {import('./Key.js').Key|undefined} key
9838
+ * @param {(key: import('./Key.js').Value, cn?: Integer) => void} success
9843
9839
  * @param {import('./Key.js').SQLFailureCallback} failCb
9844
9840
  * @this {IDBObjectStoreFull}
9845
9841
  * @returns {void}
@@ -9854,9 +9850,8 @@
9854
9850
  */
9855
9851
  function keyCloneThenSuccess(oldCn) {
9856
9852
  // We want to return the original key, so we don't need to accept an argument here
9857
- encode(key, function (key) {
9858
- key = decode(key);
9859
- success(key, oldCn);
9853
+ encode(key, function (encodedKey) {
9854
+ success(decode(encodedKey), oldCn);
9860
9855
  });
9861
9856
  }
9862
9857
  if (me.autoIncrement) {
@@ -9870,7 +9865,7 @@
9870
9865
  if (me.keyPath !== null) {
9871
9866
  // Should not throw now as checked earlier
9872
9867
  // Todo: Could this not be an array here?
9873
- injectKeyIntoValueUsingKeyPath(value, key, /** @type {string} */me.keyPath);
9868
+ injectKeyIntoValueUsingKeyPath(/** @type {{[key: string]: import('./Key.js').Value}} */value, /** @type {import('./Key.js').Key} */key, /** @type {string} */me.keyPath);
9874
9869
  }
9875
9870
  success(key, oldCn);
9876
9871
  }, failCb);
@@ -9927,15 +9922,15 @@
9927
9922
  resolve(undefined);
9928
9923
  return;
9929
9924
  }
9930
- indexKey = indexKey.value;
9931
- if (indexKey === undefined) {
9925
+ var indexKeyValue = indexKey.value;
9926
+ if (indexKeyValue === undefined) {
9932
9927
  resolve(undefined);
9933
9928
  return;
9934
9929
  }
9935
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
9936
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
9930
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
9931
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
9937
9932
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
9938
- if (key === undefined || excludeKey !== undefined && cmp(key, excludeKey) === 0) {
9933
+ if (key === undefined || excludeKey !== undefined && cmp(/** @type {import('./Key.js').Key} */key, excludeKey) === 0) {
9939
9934
  resolve(undefined);
9940
9935
  return;
9941
9936
  }
@@ -10008,21 +10003,21 @@
10008
10003
  resolve(undefined);
10009
10004
  return;
10010
10005
  }
10011
- indexKey = indexKey.value;
10006
+ var indexKeyValue = indexKey.value;
10012
10007
  /**
10013
10008
  * @param {import('./IDBIndex.js').IDBIndexFull} index
10014
10009
  * @returns {void}
10015
10010
  */
10016
10011
  function setIndexInfo(index) {
10017
- if (indexKey === undefined) {
10012
+ if (indexKeyValue === undefined) {
10018
10013
  return;
10019
10014
  }
10020
10015
  paramMap[index.__currentName] = /** @type {string} */
10021
- _encode(indexKey, index.multiEntry);
10016
+ _encode(indexKeyValue, index.multiEntry);
10022
10017
  }
10023
10018
  if (index.unique) {
10024
- var multiCheck = index.multiEntry && Array.isArray(indexKey);
10025
- var fetchArgs = buildFetchIndexDataSQL(true, index, indexKey, 'key', multiCheck);
10019
+ var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
10020
+ var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
10026
10021
  executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
10027
10022
  if (key === undefined) {
10028
10023
  setIndexInfo(index);
@@ -10190,7 +10185,9 @@
10190
10185
  var key = arguments[5];
10191
10186
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
10192
10187
  store.transaction.__pushToQueue(request, function (tx, args, success, error) {
10193
- store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
10188
+ store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumberRaw, oldCn) {
10189
+ var clonedKeyOrCurrentNumber = /** @type {import('./Key.js').Key|Integer} */
10190
+ clonedKeyOrCurrentNumberRaw;
10194
10191
  encode(value, function (encoded) {
10195
10192
  /**
10196
10193
  * @param {WebSQLTransaction} tx
@@ -10602,216 +10599,6 @@
10602
10599
  writable: false
10603
10600
  });
10604
10601
 
10605
- // Copyright Joyent, Inc. and other Node contributors.
10606
- //
10607
- // Permission is hereby granted, free of charge, to any person obtaining a
10608
- // copy of this software and associated documentation files (the
10609
- // "Software"), to deal in the Software without restriction, including
10610
- // without limitation the rights to use, copy, modify, merge, publish,
10611
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10612
- // persons to whom the Software is furnished to do so, subject to the
10613
- // following conditions:
10614
- //
10615
- // The above copyright notice and this permission notice shall be included
10616
- // in all copies or substantial portions of the Software.
10617
- //
10618
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10619
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10620
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10621
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10622
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10623
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10624
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
10625
-
10626
- // resolves . and .. elements in a path array with directory names there
10627
- // must be no slashes, empty elements, or device names (c:\) in the array
10628
- // (so also no leading and trailing slashes - it does not distinguish
10629
- // relative and absolute paths)
10630
- function normalizeArray(parts, allowAboveRoot) {
10631
- // if the path tries to go above the root, `up` ends up > 0
10632
- var up = 0;
10633
- for (var i = parts.length - 1; i >= 0; i--) {
10634
- var last = parts[i];
10635
- if (last === '.') {
10636
- parts.splice(i, 1);
10637
- } else if (last === '..') {
10638
- parts.splice(i, 1);
10639
- up++;
10640
- } else if (up) {
10641
- parts.splice(i, 1);
10642
- up--;
10643
- }
10644
- }
10645
-
10646
- // if the path is allowed to go above the root, restore leading ..s
10647
- if (allowAboveRoot) {
10648
- for (; up--; up) {
10649
- parts.unshift('..');
10650
- }
10651
- }
10652
- return parts;
10653
- }
10654
-
10655
- // Split a filename into [root, dir, basename, ext], unix version
10656
- // 'root' is just a slash, or nothing.
10657
- var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
10658
- var splitPath = function splitPath(filename) {
10659
- return splitPathRe.exec(filename).slice(1);
10660
- };
10661
-
10662
- // path.resolve([from ...], to)
10663
- // posix version
10664
- function resolve() {
10665
- var resolvedPath = '',
10666
- resolvedAbsolute = false;
10667
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
10668
- var path = i >= 0 ? arguments[i] : '/';
10669
-
10670
- // Skip empty and invalid entries
10671
- if (typeof path !== 'string') {
10672
- throw new TypeError('Arguments to path.resolve must be strings');
10673
- } else if (!path) {
10674
- continue;
10675
- }
10676
- resolvedPath = path + '/' + resolvedPath;
10677
- resolvedAbsolute = path.charAt(0) === '/';
10678
- }
10679
-
10680
- // At this point the path should be resolved to a full absolute path, but
10681
- // handle relative paths to be safe (might happen when process.cwd() fails)
10682
-
10683
- // Normalize the path
10684
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
10685
- return !!p;
10686
- }), !resolvedAbsolute).join('/');
10687
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
10688
- }
10689
-
10690
- // path.normalize(path)
10691
- // posix version
10692
- function normalize(path) {
10693
- var isPathAbsolute = isAbsolute(path),
10694
- trailingSlash = substr(path, -1) === '/';
10695
-
10696
- // Normalize the path
10697
- path = normalizeArray(filter(path.split('/'), function (p) {
10698
- return !!p;
10699
- }), !isPathAbsolute).join('/');
10700
- if (!path && !isPathAbsolute) {
10701
- path = '.';
10702
- }
10703
- if (path && trailingSlash) {
10704
- path += '/';
10705
- }
10706
- return (isPathAbsolute ? '/' : '') + path;
10707
- }
10708
-
10709
- // posix version
10710
- function isAbsolute(path) {
10711
- return path.charAt(0) === '/';
10712
- }
10713
-
10714
- // posix version
10715
- function join() {
10716
- var paths = Array.prototype.slice.call(arguments, 0);
10717
- return normalize(filter(paths, function (p, index) {
10718
- if (typeof p !== 'string') {
10719
- throw new TypeError('Arguments to path.join must be strings');
10720
- }
10721
- return p;
10722
- }).join('/'));
10723
- }
10724
-
10725
- // path.relative(from, to)
10726
- // posix version
10727
- function relative(from, to) {
10728
- from = resolve(from).substr(1);
10729
- to = resolve(to).substr(1);
10730
- function trim(arr) {
10731
- var start = 0;
10732
- for (; start < arr.length; start++) {
10733
- if (arr[start] !== '') break;
10734
- }
10735
- var end = arr.length - 1;
10736
- for (; end >= 0; end--) {
10737
- if (arr[end] !== '') break;
10738
- }
10739
- if (start > end) return [];
10740
- return arr.slice(start, end - start + 1);
10741
- }
10742
- var fromParts = trim(from.split('/'));
10743
- var toParts = trim(to.split('/'));
10744
- var length = Math.min(fromParts.length, toParts.length);
10745
- var samePartsLength = length;
10746
- for (var i = 0; i < length; i++) {
10747
- if (fromParts[i] !== toParts[i]) {
10748
- samePartsLength = i;
10749
- break;
10750
- }
10751
- }
10752
- var outputParts = [];
10753
- for (var i = samePartsLength; i < fromParts.length; i++) {
10754
- outputParts.push('..');
10755
- }
10756
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
10757
- return outputParts.join('/');
10758
- }
10759
- var sep = '/';
10760
- var delimiter = ':';
10761
- function dirname(path) {
10762
- var result = splitPath(path),
10763
- root = result[0],
10764
- dir = result[1];
10765
- if (!root && !dir) {
10766
- // No dirname whatsoever
10767
- return '.';
10768
- }
10769
- if (dir) {
10770
- // It has a dirname, strip trailing slash
10771
- dir = dir.substr(0, dir.length - 1);
10772
- }
10773
- return root + dir;
10774
- }
10775
- function basename(path, ext) {
10776
- var f = splitPath(path)[2];
10777
- // TODO: make this comparison case-insensitive on windows?
10778
- if (ext && f.substr(-1 * ext.length) === ext) {
10779
- f = f.substr(0, f.length - ext.length);
10780
- }
10781
- return f;
10782
- }
10783
- function extname(path) {
10784
- return splitPath(path)[3];
10785
- }
10786
- var path = {
10787
- extname: extname,
10788
- basename: basename,
10789
- dirname: dirname,
10790
- sep: sep,
10791
- delimiter: delimiter,
10792
- relative: relative,
10793
- join: join,
10794
- isAbsolute: isAbsolute,
10795
- normalize: normalize,
10796
- resolve: resolve
10797
- };
10798
- function filter(xs, f) {
10799
- if (xs.filter) return xs.filter(f);
10800
- var res = [];
10801
- for (var i = 0; i < xs.length; i++) {
10802
- if (f(xs[i], i, xs)) res.push(xs[i]);
10803
- }
10804
- return res;
10805
- }
10806
-
10807
- // String.prototype.substr - negative index don't work in IE8
10808
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
10809
- return str.substr(start, len);
10810
- } : function (str, start, len) {
10811
- if (start < 0) start = str.length + start;
10812
- return str.substr(start, len);
10813
- };
10814
-
10815
10602
  var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
10816
10603
  var readonlyProperties$1 = ['name', 'version', 'objectStoreNames'];
10817
10604
 
@@ -11531,7 +11318,7 @@
11531
11318
  }
11532
11319
  if (fs && CFG.deleteDatabaseFiles !== false) {
11533
11320
  closeCachedWebSQLConnections(name, function () {
11534
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11321
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11535
11322
  if (err && err.code !== 'ENOENT') {
11536
11323
  // Ignore if file is already deleted
11537
11324
  var removalError = /** @type {Error & {code?: number}} */
@@ -11545,7 +11332,7 @@
11545
11332
  });
11546
11333
  return;
11547
11334
  }
11548
- var sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11335
+ var sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11549
11336
  sqliteDB.transaction(function (tx) {
11550
11337
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
11551
11338
  var tables = data.rows;
@@ -11606,7 +11393,7 @@
11606
11393
  success();
11607
11394
  } else {
11608
11395
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
11609
- 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);
11396
+ 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);
11610
11397
  sysdb.transaction(function (systx) {
11611
11398
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
11612
11399
  if (!CFG.useSQLiteIndexes) {
@@ -11786,7 +11573,7 @@
11786
11573
  var sysdbFinishedCb = function sysdbFinishedCb(systx, err, cb) {
11787
11574
  if (err) {
11788
11575
  /**
11789
- * @param {any} [errorToShow]
11576
+ * @param {unknown} [errorToShow]
11790
11577
  * @returns {void}
11791
11578
  */
11792
11579
  var manualRevert = function manualRevert(errorToShow) {
@@ -11810,7 +11597,9 @@
11810
11597
  cb(sqlErr); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11811
11598
  }, function () {
11812
11599
  isRevertingSysdb = false;
11813
- cb(errorToShow || reportError); // eslint-disable-line promise/no-callback-in-promise -- Convenient
11600
+ // eslint-disable-next-line promise/no-callback-in-promise -- Convenient
11601
+ cb(/** @type {(Error & {code?: number})|undefined} */
11602
+ errorToShow || reportError);
11814
11603
  });
11815
11604
  };
11816
11605
  try {
@@ -11843,13 +11632,13 @@
11843
11632
  newVersion: version
11844
11633
  });
11845
11634
  req.__result = connection;
11846
- connection.__upgradeTransaction = req.__transaction = req.__result.__versionTransaction = IDBTransaction.__createInstance(req.__result, req.__result.objectStoreNames, 'versionchange');
11635
+ connection.__upgradeTransaction = req.__transaction = connection.__versionTransaction = IDBTransaction.__createInstance(connection, connection.objectStoreNames, 'versionchange');
11847
11636
  req.__done = true;
11848
11637
  req.transaction.__addNonRequestToTransactionQueue(
11849
11638
  /**
11850
11639
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11851
- * @param {ObjectArray} args
11852
- * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11640
+ * @param {unknown[]} args
11641
+ * @param {(result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11853
11642
  * @returns {void}
11854
11643
  */
11855
11644
  function onupgradeneeded(tx, args, finished /* , error */) {
@@ -12062,7 +11851,7 @@
12062
11851
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
12063
11852
  db = websqlDBCache[name][version];
12064
11853
  } else {
12065
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11854
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
12066
11855
  if (useDatabaseCache) {
12067
11856
  if (!Object.hasOwn(websqlDBCache, name)) {
12068
11857
  websqlDBCache[name] = {};
@@ -12550,16 +12339,16 @@
12550
12339
 
12551
12340
  /**
12552
12341
  * @typedef {IDBCursor & {
12553
- * primaryKey: import('./Key.js').Key,
12554
- * key: import('./Key.js').Key,
12342
+ * primaryKey: import('./Key.js').Key|null|undefined,
12343
+ * key: import('./Key.js').Key|null|undefined,
12555
12344
  * direction: string,
12556
12345
  * source: import('./IDBObjectStore.js').IDBObjectStoreFull|
12557
12346
  * import('./IDBIndex.js').IDBIndexFull,
12558
12347
  * __request: import('./IDBRequest.js').IDBRequestFull,
12559
12348
  * __advanceCount: Integer|undefined,
12560
12349
  * __indexSource: boolean,
12561
- * __key: import('./Key.js').Key,
12562
- * __primaryKey: import('./Key.js').Key,
12350
+ * __key: import('./Key.js').Key|null|undefined,
12351
+ * __primaryKey: import('./Key.js').Key|null|undefined,
12563
12352
  * __value: import('./Key.js').Value,
12564
12353
  * __store: import('./IDBObjectStore.js').IDBObjectStoreFull,
12565
12354
  * __range: import('./IDBKeyRange.js').IDBKeyRangeFull|undefined,
@@ -12567,11 +12356,14 @@
12567
12356
  * __valueColumnName: string,
12568
12357
  * __keyOnly: boolean,
12569
12358
  * __valueDecoder: {
12570
- * decode: (str: string) => any,
12359
+ * decode: (str: string) => import('./Key.js').Value,
12571
12360
  * },
12572
12361
  * __count: boolean,
12573
12362
  * __prefetchedIndex: Integer,
12574
- * __prefetchedData: null|SQLResultSetRowList|{
12363
+ * __prefetchedData: null|{
12364
+ * length: number;
12365
+ * item(index: number): unknown;
12366
+ * }|{
12575
12367
  * data: RowItemNonNull[],
12576
12368
  * length: Integer,
12577
12369
  * item: (index: Integer) => RowItemNonNull
@@ -12585,7 +12377,14 @@
12585
12377
  * __multiEntryExhausted: boolean,
12586
12378
  * __invalidateCache: () => void,
12587
12379
  * __gotValue: boolean,
12588
- * __find: (...args: any[]) => void,
12380
+ * __find: (
12381
+ * key: import('./Key.js').Key|undefined,
12382
+ * primaryKey: import('./Key.js').Key|undefined,
12383
+ * tx: WebSQLTransaction,
12384
+ * success: KeySuccess,
12385
+ * error: FindError,
12386
+ * recordsToLoad?: Integer
12387
+ * ) => void,
12589
12388
  * __findBasic: (
12590
12389
  * key: import('./Key.js').Key|undefined,
12591
12390
  * primaryKey: import('./Key.js').Key|undefined,
@@ -12606,17 +12405,17 @@
12606
12405
  * __decode: (
12607
12406
  * rowItem: RowItemNonNull,
12608
12407
  * callback: (
12609
- * key: import('./Key.js').Key,
12408
+ * key: import('./Key.js').Key|undefined,
12610
12409
  * val: import('./Key.js').Value,
12611
- * primaryKey: import('./Key.js').Key,
12410
+ * primaryKey: import('./Key.js').Key|undefined,
12612
12411
  * encKey?: string
12613
12412
  * ) => void
12614
12413
  * ) => void,
12615
12414
  * __sourceOrEffectiveObjStoreDeleted: () => void,
12616
12415
  * __continue: (key?: import('./Key.js').Key, advanceContinue?: boolean) => void,
12617
12416
  * __continueFinish: (
12618
- * key: import('./Key.js').Key,
12619
- * primaryKey: import('./Key.js').Key,
12417
+ * key: import('./Key.js').Key|undefined,
12418
+ * primaryKey: import('./Key.js').Key|undefined,
12620
12419
  * advanceState: boolean
12621
12420
  * ) => void
12622
12421
  * }} IDBCursorFull
@@ -12649,7 +12448,7 @@
12649
12448
  * import('./IDBIndex.js').IDBIndexFull} source
12650
12449
  * @param {string} keyColumnName
12651
12450
  * @param {string} valueColumnName
12652
- * @param {boolean} count
12451
+ * @param {boolean} [count]
12653
12452
  * @this {IDBCursorFull}
12654
12453
  * @returns {void}
12655
12454
  */
@@ -12690,7 +12489,7 @@
12690
12489
  this.__valueColumnName = valueColumnName;
12691
12490
  this.__keyOnly = valueColumnName === 'key';
12692
12491
  this.__valueDecoder = this.__keyOnly ? Key : Sca;
12693
- this.__count = count;
12492
+ this.__count = Boolean(count);
12694
12493
  this.__prefetchedIndex = -1;
12695
12494
  this.__continuationKey = undefined;
12696
12495
  this.__continuationPrimaryKey = undefined;
@@ -12709,36 +12508,36 @@
12709
12508
 
12710
12509
  /**
12711
12510
  *
12712
- * @param {...any} args
12511
+ * @param {IDBKeyRange} query
12512
+ * @param {string} direction
12513
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
12514
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
12515
+ * import('./IDBIndex.js').IDBIndexFull} source
12516
+ * @param {string} keyColumnName
12517
+ * @param {string} valueColumnName
12518
+ * @param {boolean} [count]
12713
12519
  * @returns {IDBCursorFull}
12714
12520
  */
12715
- IDBCursor.__createInstance = function () {
12521
+ IDBCursor.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
12716
12522
  var IDBCursor = IDBCursorAlias.__super;
12717
12523
  IDBCursor.prototype = IDBCursorAlias.prototype;
12718
12524
 
12719
12525
  // @ts-expect-error It's ok
12720
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12721
- args[_key] = arguments[_key];
12722
- }
12723
- return _construct(IDBCursor, args);
12526
+ return new IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count);
12724
12527
  };
12725
12528
 
12726
12529
  /**
12727
12530
  *
12728
- * @param {...any} args
12531
+ * @param {import('./Key.js').Key|undefined} key
12532
+ * @param {import('./Key.js').Key|undefined} primaryKey
12533
+ * @param {WebSQLTransaction} tx
12534
+ * @param {KeySuccess} success
12535
+ * @param {FindError} error
12536
+ * @param {Integer} [recordsToLoad]
12729
12537
  * @this {IDBCursorFull}
12730
12538
  * @returns {void}
12731
12539
  */
12732
- IDBCursor.prototype.__find = function () {
12733
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
12734
- args[_key2] = arguments[_key2];
12735
- }
12736
- var key = args[0],
12737
- primaryKey = args[1],
12738
- tx = args[2],
12739
- success = args[3],
12740
- error = args[4],
12741
- recordsToLoad = args[5];
12540
+ IDBCursor.prototype.__find = function (key, primaryKey, tx, success, error, recordsToLoad) {
12742
12541
  if (this.__multiEntryIndex) {
12743
12542
  this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
12744
12543
  } else {
@@ -12748,9 +12547,9 @@
12748
12547
 
12749
12548
  /**
12750
12549
  * @typedef {(
12751
- * k: import('./Key.js').Key,
12550
+ * k: import('./Key.js').Key|undefined,
12752
12551
  * val: import('./Key.js').Value,
12753
- * primKey: import('./Key.js').Key
12552
+ * primKey: import('./Key.js').Key|undefined
12754
12553
  * ) => void} KeySuccess
12755
12554
  */
12756
12555
 
@@ -12847,7 +12646,7 @@
12847
12646
  me.__prefetchedIndex = 0;
12848
12647
  me.__prefetchedData = data.rows;
12849
12648
  if (CFG.DEBUG) {
12850
- console.log('Preloaded ' + me.__prefetchedData.length + ' records for cursor');
12649
+ console.log('Preloaded ' + data.rows.length + ' records for cursor');
12851
12650
  }
12852
12651
  me.__decode(/** @type {RowItemNonNull} */data.rows.item(0), success);
12853
12652
  } else if (data.rows.length === 1) {
@@ -12972,7 +12771,7 @@
12972
12771
  for (var i = 0; i < data.rows.length; i++) {
12973
12772
  var rowItem = /** @type {RowItemNonNull} */data.rows.item(i);
12974
12773
  var rowKey = _decode(rowItem[me.__keyColumnName], true);
12975
- var matches = findMultiEntryMatches(rowKey, me.__range);
12774
+ var matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */rowKey, me.__range);
12976
12775
  ct += matches.length;
12977
12776
  }
12978
12777
  success(undefined, ct, undefined);
@@ -12992,7 +12791,7 @@
12992
12791
  for (var _i = 0; _i < data.rows.length; _i++) {
12993
12792
  var _rowItem = /** @type {RowItemNonNull} */data.rows.item(_i);
12994
12793
  var _rowKey = _decode(_rowItem[me.__keyColumnName], true);
12995
- var _matches = findMultiEntryMatches(_rowKey, me.__range);
12794
+ var _matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */_rowKey, me.__range);
12996
12795
  var _iterator = _createForOfIteratorHelper(_matches),
12997
12796
  _step;
12998
12797
  try {
@@ -13073,11 +12872,11 @@
13073
12872
  };
13074
12873
 
13075
12874
  /**
13076
- * @typedef {any} StructuredCloneValue
12875
+ * @typedef {import('./Key.js').Value} StructuredCloneValue
13077
12876
  */
13078
12877
 
13079
12878
  /**
13080
- * @typedef {any} IndexedDBKey
12879
+ * @typedef {import('./Key.js').Key} IndexedDBKey
13081
12880
  */
13082
12881
 
13083
12882
  /**
@@ -13089,9 +12888,9 @@
13089
12888
 
13090
12889
  /**
13091
12890
  * @callback SuccessCallback
13092
- * @param {IndexedDBKey} key
12891
+ * @param {IndexedDBKey|undefined} key
13093
12892
  * @param {StructuredCloneValue} value
13094
- * @param {IndexedDBKey} primaryKey
12893
+ * @param {IndexedDBKey|undefined} primaryKey
13095
12894
  * @returns {void}
13096
12895
  */
13097
12896
 
@@ -13131,9 +12930,9 @@
13131
12930
  *
13132
12931
  * @param {RowItemNonNull} rowItem
13133
12932
  * @param {(
13134
- * key: import('./Key.js').Key,
12933
+ * key: import('./Key.js').Key|undefined,
13135
12934
  * val: import('./Key.js').Value,
13136
- * primaryKey: import('./Key.js').Key,
12935
+ * primaryKey: import('./Key.js').Key|undefined,
13137
12936
  * encKey?: string
13138
12937
  * ) => void} callback
13139
12938
  * @this {IDBCursorFull}
@@ -13208,8 +13007,8 @@
13208
13007
 
13209
13008
  /**
13210
13009
  *
13211
- * @param {import('./Key.js').Key} key
13212
- * @param {import('./Key.js').Key} primaryKey
13010
+ * @param {import('./Key.js').Key|undefined} key
13011
+ * @param {import('./Key.js').Key|undefined} primaryKey
13213
13012
  * @param {boolean} advanceState
13214
13013
  * @this {IDBCursorFull}
13215
13014
  * @returns {void}
@@ -13223,9 +13022,9 @@
13223
13022
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
13224
13023
  me.__store.transaction.__pushToQueue(me.__request, function cursorContinue(tx, args, success, error, executeNextRequest) {
13225
13024
  /**
13226
- * @param {import('./Key.js').Key} k
13025
+ * @param {import('./Key.js').Key|undefined} k
13227
13026
  * @param {import('./Key.js').Value} val
13228
- * @param {import('./Key.js').Key} primKey
13027
+ * @param {import('./Key.js').Key|undefined} primKey
13229
13028
  * @returns {void}
13230
13029
  */
13231
13030
  function triggerSuccess(k, val, primKey) {
@@ -13267,7 +13066,7 @@
13267
13066
  // We have pre-loaded data for the cursor
13268
13067
  me.__prefetchedIndex++;
13269
13068
  if (me.__prefetchedIndex < me.__prefetchedData.length) {
13270
- me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13069
+ me.__decode(/** @type {RowItemNonNull} */me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
13271
13070
  /**
13272
13071
  * @returns {void}
13273
13072
  */
@@ -13325,8 +13124,8 @@
13325
13124
  me.__find(key, primaryKey, tx, triggerSuccess, /** @type {FindError} */
13326
13125
  function () {
13327
13126
  me.__advanceCount = undefined;
13328
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
13329
- args[_key3] = arguments[_key3];
13127
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13128
+ args[_key] = arguments[_key];
13330
13129
  }
13331
13130
  var t = args[0],
13332
13131
  err = args[1];
@@ -13412,12 +13211,18 @@
13412
13211
  };
13413
13212
 
13414
13213
  /**
13415
- * @typedef {any} AnyValue
13214
+ * The `{query, count, direction}` options shape shared by
13215
+ * `getAll`/`getAllKeys`/`getAllRecords`.
13216
+ * @typedef {{
13217
+ * query?: import('./Key.js').Value,
13218
+ * count?: Integer,
13219
+ * direction?: string
13220
+ * }} GetAllOptions
13416
13221
  */
13417
13222
 
13418
13223
  /**
13419
13224
  *
13420
- * @param {AnyValue} valueToUpdate
13225
+ * @param {import('./Key.js').Value} valueToUpdate
13421
13226
  * @this {IDBCursorFull}
13422
13227
  * @returns {IDBRequest}
13423
13228
  */
@@ -13543,25 +13348,22 @@
13543
13348
  var IDBCursorWithValueAlias = IDBCursorWithValue;
13544
13349
  /**
13545
13350
  *
13546
- * @param {...any} args
13351
+ * @param {IDBKeyRange} query
13352
+ * @param {string} direction
13353
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
13354
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
13355
+ * import('./IDBIndex.js').IDBIndexFull} source
13356
+ * @param {string} keyColumnName
13357
+ * @param {string} valueColumnName
13358
+ * @param {boolean} [count]
13547
13359
  * @returns {IDBCursorWithValueFull}
13548
13360
  */
13549
- IDBCursorWithValue.__createInstance = function () {
13550
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
13551
- args[_key4] = arguments[_key4];
13552
- }
13361
+ IDBCursorWithValue.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
13553
13362
  /**
13554
13363
  * @class
13555
13364
  * @this {IDBCursorWithValueFull}
13556
13365
  */
13557
13366
  function IDBCursorWithValue() {
13558
- var query = args[0],
13559
- direction = args[1],
13560
- store = args[2],
13561
- source = args[3],
13562
- keyColumnName = args[4],
13563
- valueColumnName = args[5],
13564
- count = args[6];
13565
13367
  IDBCursor.__super.call(this, query, direction, store, source, keyColumnName, valueColumnName, count);
13566
13368
  // @ts-expect-error It's ok
13567
13369
  this[Symbol.toStringTag] = 'IDBCursorWithValue';
@@ -13584,12 +13386,16 @@
13584
13386
  /**
13585
13387
  * Validates `direction` and fills in defaults for the `{query, count,
13586
13388
  * direction}` shape shared by `getAll`/`getAllKeys`/`getAllRecords`.
13587
- * @param {AnyValue} options
13389
+ * @param {unknown} options
13588
13390
  * @throws {TypeError}
13589
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13391
+ * @returns {{
13392
+ * query: import('./Key.js').Value|undefined,
13393
+ * count: Integer|undefined,
13394
+ * direction: string
13395
+ * }}
13590
13396
  */
13591
13397
  function normalizeGetAllOptions(options) {
13592
- var _ref = /** @type {AnyValue} */options !== null && options !== void 0 ? options : {},
13398
+ var _ref = /** @type {GetAllOptions} */options !== null && options !== void 0 ? options : {},
13593
13399
  query = _ref.query,
13594
13400
  count = _ref.count,
13595
13401
  _ref$direction = _ref.direction,
@@ -13618,7 +13424,11 @@
13618
13424
  * first argument wins regardless of how many arguments were actually passed.
13619
13425
  * @param {IArguments} args
13620
13426
  * @throws {TypeError}
13621
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13427
+ * @returns {{
13428
+ * query: import('./Key.js').Value|undefined,
13429
+ * count: Integer|undefined,
13430
+ * direction: string
13431
+ * }}
13622
13432
  */
13623
13433
  function parseGetAllArgs(args) {
13624
13434
  var arg0 = args[0];
@@ -13641,7 +13451,11 @@
13641
13451
  * form to disambiguate against.
13642
13452
  * @param {IArguments} args
13643
13453
  * @throws {TypeError}
13644
- * @returns {{query: AnyValue, count: Integer|undefined, direction: string}}
13454
+ * @returns {{
13455
+ * query: import('./Key.js').Value|undefined,
13456
+ * count: Integer|undefined,
13457
+ * direction: string
13458
+ * }}
13645
13459
  */
13646
13460
  function parseGetAllRecordsArgs(args) {
13647
13461
  return normalizeGetAllOptions(args[0]);
@@ -13748,7 +13562,7 @@
13748
13562
  value: direction
13749
13563
  });
13750
13564
  return tx.__addToTransactionQueue(function collectAllOp(sqlTx, args, success, error) {
13751
- /** @type {AnyValue[]} */
13565
+ /** @type {unknown[]} */
13752
13566
  var results = [];
13753
13567
  var recordsToLoad = count || CFG.cursorPreloadPackSize || 100;
13754
13568
 
@@ -13788,7 +13602,7 @@
13788
13602
  if (state.__prefetchedData) {
13789
13603
  state.__prefetchedIndex++;
13790
13604
  if (state.__prefetchedIndex < state.__prefetchedData.length) {
13791
- IDBCursor.prototype.__decode.call(state, state.__prefetchedData.item(state.__prefetchedIndex),
13605
+ IDBCursor.prototype.__decode.call(state, /** @type {RowItemNonNull} */state.__prefetchedData.item(state.__prefetchedIndex),
13792
13606
  /**
13793
13607
  * @param {import('./Key.js').Key} k
13794
13608
  * @param {import('./Key.js').Value} val
@@ -13818,15 +13632,11 @@
13818
13632
  }, undefined, source);
13819
13633
  }
13820
13634
 
13821
- /**
13822
- * @typedef {any} AnyValue
13823
- */
13824
-
13825
13635
  /**
13826
13636
  * @callback SetConfig
13827
13637
  * @param {import('./CFG.js').KeyofConfigValues|
13828
13638
  * Partial<import('./CFG.js').ConfigValues>} prop
13829
- * @param {AnyValue} [val]
13639
+ * @param {import('./CFG.js').ConfigValue} [val]
13830
13640
  * @throws {Error}
13831
13641
  * @returns {void}
13832
13642
  */
@@ -13911,18 +13721,9 @@
13911
13721
  function setGlobalVars(idb, initialConfig) {
13912
13722
  var IDB = /** @type {ShimmedObject & {[key: string]: unknown}} */
13913
13723
  /** @type {unknown} */globalThis || {};
13914
- /**
13915
- * @typedef {any} AnyClass
13916
- */
13917
- /**
13918
- * @typedef {any} AnyValue
13919
- */
13920
- /**
13921
- * @typedef {Function} AnyFunction
13922
- */
13923
13724
  /**
13924
13725
  * @param {string} name
13925
- * @param {AnyClass} value
13726
+ * @param {unknown} value
13926
13727
  * @param {PropertyDescriptor & {
13927
13728
  * shimNS?: object
13928
13729
  * }|undefined} [propDesc]
@@ -13950,7 +13751,7 @@
13950
13751
  }
13951
13752
  } else {
13952
13753
  var o = _defineAccessor("get", {}, name, function () {
13953
- return /** @type {AnyFunction} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13754
+ return /** @type {() => unknown} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
13954
13755
  });
13955
13756
  desc = /** @type {PropertyDescriptor} */
13956
13757
  Object.getOwnPropertyDescriptor(o, name);
@@ -14024,7 +13825,7 @@
14024
13825
  return shimIndexedDB$1;
14025
13826
  }
14026
13827
  });
14027
- /** @type {[string, any][]} */
13828
+ /** @type {[string, unknown][]} */
14028
13829
  [['IDBFactory', shimIDBFactory], ['IDBDatabase', IDBDatabase], ['IDBObjectStore', IDBObjectStore], ['IDBIndex', IDBIndex], ['IDBTransaction', IDBTransaction], ['IDBCursor', IDBCursor], ['IDBCursorWithValue', IDBCursorWithValue], ['IDBRecord', IDBRecord], ['IDBKeyRange', IDBKeyRange], ['IDBRequest', IDBRequest], ['IDBOpenDBRequest', IDBOpenDBRequest], ['IDBVersionChangeEvent', IDBVersionChangeEvent]].forEach(function (_ref3) {
14029
13830
  var _ref4 = _slicedToArray(_ref3, 2),
14030
13831
  prop = _ref4[0],
@@ -14113,7 +13914,7 @@
14113
13914
  IDB.shimIndexedDB = /** @type {ShimIndexedDB} */{};
14114
13915
  /** @type {const} */
14115
13916
  ['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach(function (prop) {
14116
- /** @type {ShimIndexedDB} */IDB.shimIndexedDB[prop] = /** @type {() => any} */function () {
13917
+ /** @type {{[key: string]: () => void}} */(/** @type {unknown} */IDB.shimIndexedDB)[prop] = function () {
14117
13918
  console.warn('This browser does not have WebSQL to shim.');
14118
13919
  };
14119
13920
  });