indexeddbshim 17.2.1 → 17.3.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 (92) hide show
  1. package/README.md +8 -5
  2. package/dist/CFG.d.ts +1 -1
  3. package/dist/CFG.d.ts.map +1 -1
  4. package/dist/DOMException.d.ts +21 -7
  5. package/dist/DOMException.d.ts.map +1 -1
  6. package/dist/DOMStringList.d.ts.map +1 -1
  7. package/dist/Event.d.ts +12 -6
  8. package/dist/Event.d.ts.map +1 -1
  9. package/dist/IDBCursor.d.ts +125 -7
  10. package/dist/IDBCursor.d.ts.map +1 -1
  11. package/dist/IDBDatabase.d.ts +17 -10
  12. package/dist/IDBDatabase.d.ts.map +1 -1
  13. package/dist/IDBFactory.d.ts +5 -0
  14. package/dist/IDBFactory.d.ts.map +1 -1
  15. package/dist/IDBIndex.d.ts +43 -13
  16. package/dist/IDBIndex.d.ts.map +1 -1
  17. package/dist/IDBKeyRange.d.ts +6 -2
  18. package/dist/IDBKeyRange.d.ts.map +1 -1
  19. package/dist/IDBObjectStore.d.ts +66 -17
  20. package/dist/IDBObjectStore.d.ts.map +1 -1
  21. package/dist/IDBRecord.d.ts +44 -0
  22. package/dist/IDBRecord.d.ts.map +1 -0
  23. package/dist/IDBRequest.d.ts +2 -2
  24. package/dist/IDBRequest.d.ts.map +1 -1
  25. package/dist/IDBTransaction.d.ts +43 -15
  26. package/dist/IDBTransaction.d.ts.map +1 -1
  27. package/dist/IDBVersionChangeEvent.d.ts +23 -12
  28. package/dist/IDBVersionChangeEvent.d.ts.map +1 -1
  29. package/dist/Key.d.ts +7 -6
  30. package/dist/Key.d.ts.map +1 -1
  31. package/dist/Sca.d.ts +15 -0
  32. package/dist/Sca.d.ts.map +1 -1
  33. package/dist/indexeddbshim-Key.js +59 -23
  34. package/dist/indexeddbshim-Key.js.map +1 -1
  35. package/dist/indexeddbshim-Key.min.js +2 -2
  36. package/dist/indexeddbshim-Key.min.js.map +1 -1
  37. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +3123 -1169
  38. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  39. package/dist/indexeddbshim-UnicodeIdentifiers.js +2683 -979
  40. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  41. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +4 -4
  42. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  43. package/dist/indexeddbshim-node.cjs +3123 -1169
  44. package/dist/indexeddbshim-node.cjs.map +1 -1
  45. package/dist/indexeddbshim-noninvasive.js +2683 -979
  46. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  47. package/dist/indexeddbshim-noninvasive.min.js +4 -4
  48. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  49. package/dist/indexeddbshim.js +2683 -979
  50. package/dist/indexeddbshim.js.map +1 -1
  51. package/dist/indexeddbshim.min.js +4 -4
  52. package/dist/indexeddbshim.min.js.map +1 -1
  53. package/dist/node-UnicodeIdentifiers.d.ts +2 -2
  54. package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
  55. package/dist/node.d.ts +2 -2
  56. package/dist/node.d.ts.map +1 -1
  57. package/dist/nodeSQLiteDatabase.d.ts +13 -14
  58. package/dist/nodeSQLiteDatabase.d.ts.map +1 -1
  59. package/dist/nodeWebSQL.d.ts +17 -1
  60. package/dist/nodeWebSQL.d.ts.map +1 -1
  61. package/dist/setGlobalVars.d.ts +2 -2
  62. package/dist/setGlobalVars.d.ts.map +1 -1
  63. package/dist/util.d.ts +15 -0
  64. package/dist/util.d.ts.map +1 -1
  65. package/examples/IDBKeyUtils.html +0 -1
  66. package/package.json +28 -21
  67. package/src/CFG.js +2 -1
  68. package/src/DOMException.js +38 -12
  69. package/src/DOMStringList.js +21 -2
  70. package/src/Event.js +9 -4
  71. package/src/IDBCursor.js +346 -18
  72. package/src/IDBDatabase.js +33 -16
  73. package/src/IDBFactory.js +162 -62
  74. package/src/IDBIndex.js +78 -45
  75. package/src/IDBKeyRange.js +8 -2
  76. package/src/IDBObjectStore.js +89 -65
  77. package/src/IDBRecord.js +96 -0
  78. package/src/IDBRequest.js +7 -7
  79. package/src/IDBTransaction.js +342 -61
  80. package/src/IDBVersionChangeEvent.js +37 -30
  81. package/src/Key.js +36 -18
  82. package/src/Sca.js +22 -1
  83. package/src/browser-UnicodeIdentifiers.js +3 -1
  84. package/src/browser-noninvasive.js +3 -1
  85. package/src/browser.js +3 -1
  86. package/src/node-UnicodeIdentifiers.js +1 -1
  87. package/src/node.js +1 -1
  88. package/src/nodeSQLiteDatabase.js +67 -2
  89. package/src/nodeWebSQL.js +22 -2
  90. package/src/setGlobalVars.js +5 -5
  91. package/src/util.js +29 -1
  92. package/typings/shimIndexedDB.d.ts +1 -1
package/dist/Key.d.ts CHANGED
@@ -18,6 +18,7 @@ export type KeyForStoreCallback = (arg1: "failure" | null, arg2?: number | undef
18
18
  export type ArrayBufferView = NodeJS.TypedArray | DataView;
19
19
  export type BufferSource = ArrayBufferView | ArrayBuffer;
20
20
  export type KeyType = "number" | "date" | "string" | "binary" | "array";
21
+ export type WebSQLTransaction = import("websql-configurable/lib/websql/WebSQLTransaction.js").default;
21
22
  export type Value = any;
22
23
  export type Key = any;
23
24
  export type KeyPathArray = KeyPath[];
@@ -177,14 +178,14 @@ export function isKeyInRange(key: Key, range: import("./IDBKeyRange.js").IDBKeyR
177
178
  export function findMultiEntryMatches(keyEntry: Key, range: import("./IDBKeyRange.js").IDBKeyRangeFull | undefined): Key[];
178
179
  /**
179
180
  *
180
- * @param {SQLTransaction} tx
181
+ * @param {WebSQLTransaction} tx
181
182
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
182
183
  * @param {Integer} num
183
184
  * @param {CurrentNumberCallback} successCb
184
185
  * @param {SQLFailureCallback} failCb
185
186
  * @returns {void}
186
187
  */
187
- export function assignCurrentNumber(tx: SQLTransaction, store: import("./IDBObjectStore.js").IDBObjectStoreFull, num: Integer, successCb: CurrentNumberCallback, failCb: SQLFailureCallback): void;
188
+ export function assignCurrentNumber(tx: WebSQLTransaction, store: import("./IDBObjectStore.js").IDBObjectStoreFull, num: Integer, successCb: CurrentNumberCallback, failCb: SQLFailureCallback): void;
188
189
  /**
189
190
  * @callback KeyForStoreCallback
190
191
  * @param {"failure"|null} arg1
@@ -194,21 +195,21 @@ export function assignCurrentNumber(tx: SQLTransaction, store: import("./IDBObje
194
195
  */
195
196
  /**
196
197
  *
197
- * @param {SQLTransaction} tx
198
+ * @param {WebSQLTransaction} tx
198
199
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
199
200
  * @param {KeyForStoreCallback} cb
200
201
  * @param {SQLFailureCallback} sqlFailCb
201
202
  * @returns {void}
202
203
  */
203
- export function generateKeyForStore(tx: SQLTransaction, store: import("./IDBObjectStore.js").IDBObjectStoreFull, cb: KeyForStoreCallback, sqlFailCb: SQLFailureCallback): void;
204
+ export function generateKeyForStore(tx: WebSQLTransaction, store: import("./IDBObjectStore.js").IDBObjectStoreFull, cb: KeyForStoreCallback, sqlFailCb: SQLFailureCallback): void;
204
205
  /**
205
206
  *
206
- * @param {SQLTransaction} tx
207
+ * @param {WebSQLTransaction} tx
207
208
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
208
209
  * @param {Key} key
209
210
  * @param {(num?: Integer) => void} successCb
210
211
  * @param {SQLFailureCallback} sqlFailCb
211
212
  * @returns {void}
212
213
  */
213
- export function possiblyUpdateKeyGenerator(tx: SQLTransaction, store: import("./IDBObjectStore.js").IDBObjectStoreFull, key: Key, successCb: (num?: Integer) => void, sqlFailCb: SQLFailureCallback): void;
214
+ export function possiblyUpdateKeyGenerator(tx: WebSQLTransaction, store: import("./IDBObjectStore.js").IDBObjectStoreFull, key: Key, successCb: (num?: Integer) => void, sqlFailCb: SQLFailureCallback): void;
214
215
  //# sourceMappingURL=Key.d.ts.map
package/dist/Key.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version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;GAQG;AACH,wCAPW,iBAAiB,SACjB,OAAO,qBAAqB,EAAE,kBAAkB,OAChD,OAAO,aACP,qBAAqB,UACrB,kBAAkB,GAChB,IAAI,CAYhB;AA6BD;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,wCANW,iBAAiB,SACjB,OAAO,qBAAqB,EAAE,kBAAkB,MAChD,mBAAmB,aACnB,kBAAkB,GAChB,IAAI,CAmBhB;AAKD;;;;;;;;GAQG;AACH,+CAPW,iBAAiB,SACjB,OAAO,qBAAqB,EAAE,kBAAkB,OAChD,GAAG,aACH,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,aACvB,kBAAkB,GAChB,IAAI,CA6BhB"}
package/dist/Sca.d.ts CHANGED
@@ -22,6 +22,21 @@ export function decode(obj: string): AnyValue;
22
22
  * @returns {AnyValue}
23
23
  */
24
24
  export function clone(val: AnyValue): AnyValue;
25
+ /**
26
+ * Per spec, a transaction must appear inactive to any code that runs
27
+ * reentrantly *during* the structured clone of a value passed to
28
+ * `add()`/`put()`/`IDBCursor#update()` (e.g. a getter on the value being
29
+ * stored) -- even though the transaction is otherwise active for the
30
+ * duration of that same call. `__active` is restored in a `finally` so a
31
+ * `DataCloneError` (or any other throw from `clone()`) can't leave the
32
+ * transaction permanently stuck inactive.
33
+ * @param {{__active: boolean}} transaction
34
+ * @param {AnyValue} val
35
+ * @returns {AnyValue}
36
+ */
37
+ export function cloneWithInactiveTransaction(transaction: {
38
+ __active: boolean;
39
+ }, val: AnyValue): AnyValue;
25
40
  /**
26
41
  * @param {(preset: import('typeson-registry').Preset) =>
27
42
  * import('typeson-registry').Preset} func
package/dist/Sca.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Sca.d.ts","sourceRoot":"","sources":["../src/Sca.js"],"names":[],"mappings":"uBAsDa,GAAG;AAlChB;;;;;;;;GAQG;AACH,4BALW,QAAQ,SACR,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAEnB,MAAM,CAwBlB;AAED;;GAEG;AAEH;;;GAGG;AACH,4BAHW,MAAM,GACJ,QAAQ,CAIpB;AAED;;;GAGG;AACH,2BAHW,QAAQ,GACN,QAAQ,CAMpB;AA/DD;;;;GAIG;AACH,+BAJW,CAAC,MAAM,EAAE,OAAO,kBAAkB,EAAE,MAAM,KACpD,OAAW,kBAAkB,EAAE,MAAM,GACzB,IAAI,CAKhB"}
1
+ {"version":3,"file":"Sca.d.ts","sourceRoot":"","sources":["../src/Sca.js"],"names":[],"mappings":"uBAsDa,GAAG;AAlChB;;;;;;;;GAQG;AACH,4BALW,QAAQ,SACR,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAEnB,MAAM,CAwBlB;AAED;;GAEG;AAEH;;;GAGG;AACH,4BAHW,MAAM,GACJ,QAAQ,CAIpB;AAED;;;GAGG;AACH,2BAHW,QAAQ,GACN,QAAQ,CAMpB;AAED;;;;;;;;;;;GAWG;AACH,0DAJW;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,OACnB,QAAQ,GACN,QAAQ,CASpB;AApFD;;;;GAIG;AACH,+BAJW,CAAC,MAAM,EAAE,OAAO,kBAAkB,EAAE,MAAM,KACpD,OAAW,kBAAkB,EAAE,MAAM,GACzB,IAAI,CAKhB"}
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v17.2.1 - 8/18/2026 */
1
+ /*! indexeddbshim - v17.3.0 - 8/24/2026 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -152,7 +152,8 @@
152
152
  * ) => import('typeson').Preset,
153
153
  * avoidAutoShim: boolean,
154
154
  * win: {
155
- * openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) => import('websql-configurable').default
155
+ * openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) =>
156
+ * import('websql-configurable/lib/websql/WebSQLDatabase.js').default
156
157
  * },
157
158
  * DEFAULT_DB_SIZE: number,
158
159
  * useSQLiteIndexes: boolean,
@@ -450,18 +451,29 @@
450
451
  DATA_CLONE_ERR: 25
451
452
  };
452
453
 
454
+ /**
455
+ * @typedef {globalThis.DOMException & {
456
+ * _code: number,
457
+ * _name: string|Code|LegacyCode,
458
+ * _message: string
459
+ * }} DOMExceptionFull
460
+ */
461
+
453
462
  /**
454
463
  *
455
464
  * @returns {typeof DOMException}
456
465
  */
457
466
  function createNonNativeDOMExceptionClass() {
458
467
  /**
468
+ * @class
459
469
  * @param {string|undefined} message
460
470
  * @param {Code|LegacyCode} name
471
+ * @this {DOMExceptionFull}
461
472
  * @returns {void}
462
473
  */
463
474
  function DOMException(message, name) {
464
475
  // const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message
476
+ // @ts-expect-error It's ok
465
477
  this[Symbol.toStringTag] = 'DOMException';
466
478
  this._code = Object.hasOwn(codes, name) ? codes[(/** @type {Code} */name)] : legacyCodes[(/** @type {LegacyCode} */name)] || 0;
467
479
  this._name = name || 'Error';
@@ -511,13 +523,14 @@
511
523
  */
512
524
  get: function get() {
513
525
  if (!(this instanceof DOMException ||
514
- // @ts-expect-error Just checking
526
+ // @ts-ignore Just checking; needed under some TS versions
515
527
  this instanceof DummyDOMException ||
516
- // @ts-expect-error Just checking
528
+ // @ts-ignore Just checking; needed under some TS versions
517
529
  this instanceof Error)) {
518
530
  throw new TypeError('Illegal invocation');
519
531
  }
520
- return this[prop === 'name' ? '_name' : '_message'];
532
+ var me = /** @type {DOMExceptionFull} */ /** @type {unknown} */this;
533
+ return me[prop === 'name' ? '_name' : '_message'];
521
534
  }
522
535
  });
523
536
  });
@@ -537,7 +550,7 @@
537
550
  });
538
551
  var keys = Object.keys(codes);
539
552
 
540
- /** @type {(keyof codes)[]} */
553
+ /** @type {(keyof typeof codes)[]} */
541
554
  keys.forEach(function (codeName) {
542
555
  Object.defineProperty(DOMException.prototype, codeName, {
543
556
  enumerable: true,
@@ -550,7 +563,7 @@
550
563
  value: codes[codeName]
551
564
  });
552
565
  });
553
- /** @type {(keyof legacyCodes)[]} */
566
+ /** @type {(keyof typeof legacyCodes)[]} */
554
567
  Object.keys(legacyCodes).forEach(function (codeName) {
555
568
  Object.defineProperty(DOMException.prototype, codeName, {
556
569
  enumerable: true,
@@ -570,7 +583,7 @@
570
583
  value: DOMException
571
584
  });
572
585
 
573
- // @ts-expect-error We don't need all its properties
586
+ // @ts-ignore We don't need all its properties; needed under some TS versions
574
587
  return DOMException;
575
588
  }
576
589
  var ShimNonNativeDOMException = createNonNativeDOMExceptionClass();
@@ -582,6 +595,7 @@
582
595
  * @returns {Error}
583
596
  */
584
597
  function createNonNativeDOMException(name, message) {
598
+ // @ts-ignore It's ok; needed under some TS versions
585
599
  return new ShimNonNativeDOMException(message, name);
586
600
  }
587
601
 
@@ -795,6 +809,10 @@
795
809
  * @typedef {"number"|"date"|"string"|"binary"|"array"} KeyType
796
810
  */
797
811
 
812
+ /**
813
+ * @typedef {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} WebSQLTransaction
814
+ */
815
+
798
816
  /**
799
817
  * @typedef {any} Value
800
818
  */
@@ -1349,10 +1367,23 @@
1349
1367
  }
1350
1368
  case 'binary':
1351
1369
  {
1352
- // May throw (if detached)
1353
1370
  // Get a copy of the bytes held by the buffer source
1354
1371
  // https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2
1355
- var octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
1372
+ // A detached buffer/view can't be read -- the engine itself throws
1373
+ // (e.g. "Cannot perform Construct on a detached ArrayBuffer")
1374
+ // rather than us being able to detect this up front, so treat any
1375
+ // such failure the same as any other invalid key rather than
1376
+ // letting that native error escape uncaught.
1377
+ var octets;
1378
+ try {
1379
+ octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
1380
+ } catch (_unused) {
1381
+ return {
1382
+ type: type,
1383
+ invalid: true,
1384
+ message: 'Could not read the buffer source (it may be detached)'
1385
+ };
1386
+ }
1356
1387
  return {
1357
1388
  type: 'binary',
1358
1389
  value: octets
@@ -1841,7 +1872,7 @@
1841
1872
 
1842
1873
  /**
1843
1874
  *
1844
- * @param {SQLTransaction} tx
1875
+ * @param {WebSQLTransaction} tx
1845
1876
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
1846
1877
  * @param {CurrentNumberCallback} func
1847
1878
  * @param {SQLFailureCallback} sqlFailCb
@@ -1852,7 +1883,7 @@
1852
1883
  if (data.rows.length !== 1) {
1853
1884
  func(1);
1854
1885
  } else {
1855
- func(data.rows.item(0).currNum);
1886
+ func(/** @type {{currNum: number}} */data.rows.item(0).currNum);
1856
1887
  }
1857
1888
  }, function (tx, error) {
1858
1889
  sqlFailCb(createDOMException('DataError', 'Could not get the auto increment value for key', error));
@@ -1862,7 +1893,7 @@
1862
1893
 
1863
1894
  /**
1864
1895
  *
1865
- * @param {SQLTransaction} tx
1896
+ * @param {WebSQLTransaction} tx
1866
1897
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
1867
1898
  * @param {Integer} num
1868
1899
  * @param {CurrentNumberCallback} successCb
@@ -1887,7 +1918,7 @@
1887
1918
  * Bump up the auto-inc counter if the key path-resolved value is valid
1888
1919
  * (greater than old value and >=1) OR if a manually passed in key is
1889
1920
  * valid (numeric and >= 1) and >= any primaryKey.
1890
- * @param {SQLTransaction} tx
1921
+ * @param {WebSQLTransaction} tx
1891
1922
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
1892
1923
  * @param {Integer} num
1893
1924
  * @param {CurrentNumberCallback} successCb
@@ -1895,13 +1926,18 @@
1895
1926
  * @returns {void}
1896
1927
  */
1897
1928
  function setCurrentNumber(tx, store, num, successCb, failCb) {
1898
- num = 1 + (num === MAX_ALLOWED_CURRENT_NUMBER
1899
- // Since incrementing by one will have no effect in JavaScript on this
1900
- // unsafe max, we represent the max as a number incremented by two.
1901
- // The getting of the current number is never returned to the user and
1902
- // is only used in safe comparisons, so it is safe for us to represent
1903
- // it in this manner
1904
- ? num + 1 : num);
1929
+ // Since incrementing by one has no effect in JavaScript on this unsafe
1930
+ // max (`MAX_ALLOWED_CURRENT_NUMBER + 1 === MAX_ALLOWED_CURRENT_NUMBER`
1931
+ // in IEEE 754 double precision), we represent the max as a number
1932
+ // incremented by two instead -- computed as a single `+ 2` rather
1933
+ // than two chained `+ 1`s, as the latter *also* rounds back to the
1934
+ // original value (each addition independently hits the same
1935
+ // unrepresentable `+ 1` and rounds down, so the two `+ 1`s don't
1936
+ // compose into a `+ 2`).
1937
+ // The getting of the current number is never returned to the user and
1938
+ // is only used in safe comparisons, so it is safe for us to represent
1939
+ // it in this manner
1940
+ num += num === MAX_ALLOWED_CURRENT_NUMBER ? 2 : 1;
1905
1941
  return assignCurrentNumber(tx, store, num, successCb, failCb);
1906
1942
  }
1907
1943
 
@@ -1915,7 +1951,7 @@
1915
1951
 
1916
1952
  /**
1917
1953
  *
1918
- * @param {SQLTransaction} tx
1954
+ * @param {WebSQLTransaction} tx
1919
1955
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
1920
1956
  * @param {KeyForStoreCallback} cb
1921
1957
  * @param {SQLFailureCallback} sqlFailCb
@@ -1942,7 +1978,7 @@
1942
1978
  // so we do not return a key
1943
1979
  /**
1944
1980
  *
1945
- * @param {SQLTransaction} tx
1981
+ * @param {WebSQLTransaction} tx
1946
1982
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
1947
1983
  * @param {Key} key
1948
1984
  * @param {(num?: Integer) => void} successCb