indexeddbshim 19.0.3 → 19.0.4
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.
- package/README.md +1 -6
- package/badges/coverage-badge.svg +1 -1
- package/badges/tests-badge.svg +1 -1
- package/dist/IDBTransaction.d.ts +15 -0
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +2 -2
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +80 -20
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +78 -19
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +3 -3
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +78 -19
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +78 -19
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +2 -2
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +78 -19
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/setGlobalVars.d.ts.map +1 -1
- package/dist/util.d.ts +0 -6
- package/dist/util.d.ts.map +1 -1
- package/package.json +22 -18
- package/src/CFG.js +1 -1
- package/src/IDBTransaction.js +76 -18
- package/src/node-UnicodeIdentifiers.js +2 -1
- package/src/setGlobalVars.js +2 -1
- package/src/util.js +1 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim - v19.0.
|
|
1
|
+
/*! indexeddbshim - v19.0.4 - 9/17/2026 */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -1814,7 +1814,7 @@
|
|
|
1814
1814
|
'UnicodeIDStart',
|
|
1815
1815
|
// In the non-Unicode builds, defaults to /[$0-9A-Z_a-z]/
|
|
1816
1816
|
'UnicodeIDContinue',
|
|
1817
|
-
// Used by
|
|
1817
|
+
// Used by Sca.js for optional restructuring of typeson-registry
|
|
1818
1818
|
// Structured Cloning Algorithm; should only be needed for ensuring data
|
|
1819
1819
|
// created in 3.* versions of IndexedDBShim continue to work; see the
|
|
1820
1820
|
// library `typeson-registry-sca-reverter` to get a function to do this
|
|
@@ -5378,6 +5378,7 @@
|
|
|
5378
5378
|
* __requestsFinished: boolean,
|
|
5379
5379
|
* __transFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
|
|
5380
5380
|
* __callTransFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
|
|
5381
|
+
* __usesStandardDriver: () => boolean,
|
|
5381
5382
|
* __transactionEndCallback: (() => void)|undefined,
|
|
5382
5383
|
* __transactionFinished: boolean,
|
|
5383
5384
|
* __completed: boolean,
|
|
@@ -5517,6 +5518,27 @@
|
|
|
5517
5518
|
cb(Boolean(err));
|
|
5518
5519
|
};
|
|
5519
5520
|
|
|
5521
|
+
/**
|
|
5522
|
+
* A standard (3-argument) `transaction()`/`readTransaction()` implementation
|
|
5523
|
+
* (browser WebSQL, `cordova-plugin-sqlite-2`, etc.) never invokes the
|
|
5524
|
+
* non-standard 4th callback that installs the real `__transFinishedCb`,
|
|
5525
|
+
* and finalizes its own underlying SQL transaction synchronously, as soon
|
|
5526
|
+
* as it sees no further `executeSql` call already in flight or queued --
|
|
5527
|
+
* with no way for it to know a JS-level continuation (e.g. an
|
|
5528
|
+
* `await`-deferred follow-up request) is still coming. Detected via
|
|
5529
|
+
* arity, checking whichever of the two methods this transaction's own
|
|
5530
|
+
* mode actually uses.
|
|
5531
|
+
* @this {IDBTransactionFull}
|
|
5532
|
+
* @returns {boolean}
|
|
5533
|
+
*/
|
|
5534
|
+
IDBTransaction.prototype.__usesStandardDriver = function () {
|
|
5535
|
+
var me = this;
|
|
5536
|
+
var dbConn = me.db && me.db.__db;
|
|
5537
|
+
var dbMethodName = me.mode === 'readonly' ? 'readTransaction' : 'transaction';
|
|
5538
|
+
var supportsNonstandardTransCb = Boolean(dbConn && typeof dbConn[dbMethodName] === 'function' && dbConn[dbMethodName].length >= 4);
|
|
5539
|
+
return !supportsNonstandardTransCb;
|
|
5540
|
+
};
|
|
5541
|
+
|
|
5520
5542
|
/**
|
|
5521
5543
|
* In Node, the real (SQL-commit-capable) `__transFinishedCb` is only
|
|
5522
5544
|
* installed once the underlying WebSQL driver's own SQL-queue-idle check
|
|
@@ -5551,17 +5573,11 @@
|
|
|
5551
5573
|
return;
|
|
5552
5574
|
}
|
|
5553
5575
|
if (me.__transFinishedCb === IDBTransaction.prototype.__transFinishedCb) {
|
|
5554
|
-
//
|
|
5555
|
-
//
|
|
5556
|
-
//
|
|
5557
|
-
//
|
|
5558
|
-
|
|
5559
|
-
// actually uses -- see `__executeRequests`) and, if it's not supported,
|
|
5560
|
-
// just call the default (the driver auto-commits on its own).
|
|
5561
|
-
var dbConn = me.db && me.db.__db;
|
|
5562
|
-
var dbMethodName = me.mode === 'readonly' ? 'readTransaction' : 'transaction';
|
|
5563
|
-
var supportsNonstandardTransCb = Boolean(dbConn && typeof dbConn[dbMethodName] === 'function' && dbConn[dbMethodName].length >= 4);
|
|
5564
|
-
if (!supportsNonstandardTransCb) {
|
|
5576
|
+
// Waiting here for the non-standard 4th callback to install the real
|
|
5577
|
+
// `__transFinishedCb` would defer forever on a standard driver, which
|
|
5578
|
+
// never invokes it -- call the default instead (the driver auto-commits
|
|
5579
|
+
// on its own).
|
|
5580
|
+
if (me.__usesStandardDriver()) {
|
|
5565
5581
|
me.__transFinishedCbFired = true;
|
|
5566
5582
|
me.__transFinishedCb(err, cb);
|
|
5567
5583
|
return;
|
|
@@ -5600,10 +5616,52 @@
|
|
|
5600
5616
|
// `readTransaction` is optimized, at least in `node-websql`
|
|
5601
5617
|
function executeRequests(tx) {
|
|
5602
5618
|
me.__tx = tx;
|
|
5619
|
+
var isStandardDriver = me.__usesStandardDriver();
|
|
5603
5620
|
/** @type {RequestInfo} */
|
|
5604
5621
|
var q,
|
|
5605
5622
|
i = -1;
|
|
5606
5623
|
|
|
5624
|
+
/**
|
|
5625
|
+
* A continuation that must still be able to observe the
|
|
5626
|
+
* transaction as safe to extend (e.g., re-checking whether an
|
|
5627
|
+
* `await`-based follow-up request has arrived yet, or giving a
|
|
5628
|
+
* same-tick microtask scheduled from a handler a chance to run
|
|
5629
|
+
* first) can normally just be deferred via `queueMicrotask`.
|
|
5630
|
+
* That alone isn't safe on a standard (3-argument) driver,
|
|
5631
|
+
* though: it finalizes its own underlying SQL transaction
|
|
5632
|
+
* synchronously, as soon as it sees no further `executeSql`
|
|
5633
|
+
* call already in flight or queued, and a microtask hop by
|
|
5634
|
+
* itself never issues one -- so the driver already considers
|
|
5635
|
+
* the transaction done by the time the deferred continuation
|
|
5636
|
+
* runs, silently dropping whatever it tries to do next. Issuing
|
|
5637
|
+
* a harmless `SELECT 1` instead keeps the driver's own queue
|
|
5638
|
+
* non-empty across that same gap, at the cost of a real SQL
|
|
5639
|
+
* round trip; Node's driver doesn't need this since its real
|
|
5640
|
+
* commit/rollback is already deferred separately, via
|
|
5641
|
+
* `nonstandardTransCb`.
|
|
5642
|
+
* @param {() => void} cb
|
|
5643
|
+
* @returns {void}
|
|
5644
|
+
*/
|
|
5645
|
+
function keepAliveAndWait(cb) {
|
|
5646
|
+
if (!isStandardDriver) {
|
|
5647
|
+
queueMicrotask(cb);
|
|
5648
|
+
return;
|
|
5649
|
+
}
|
|
5650
|
+
try {
|
|
5651
|
+
tx.executeSql('SELECT 1', [], function () {
|
|
5652
|
+
cb();
|
|
5653
|
+
}, function () {
|
|
5654
|
+
cb();
|
|
5655
|
+
return false; // Don't roll back the transaction over a keep-alive no-op
|
|
5656
|
+
});
|
|
5657
|
+
} catch (err) {
|
|
5658
|
+
// The driver has already finalized the transaction (or otherwise
|
|
5659
|
+
// rejected the call) -- nothing left to hold open, so fall back
|
|
5660
|
+
// to a plain microtask hop for the continuation itself.
|
|
5661
|
+
queueMicrotask(cb);
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
|
|
5607
5665
|
/**
|
|
5608
5666
|
* @typedef {unknown} IDBRequestResult
|
|
5609
5667
|
*/
|
|
@@ -5797,9 +5855,9 @@
|
|
|
5797
5855
|
* from a microtask -- so if the JS-level queue is merely found
|
|
5798
5856
|
* empty here, that doesn't yet mean no more work is coming, only
|
|
5799
5857
|
* that none has been queued *yet*. Re-check across a small, bounded
|
|
5800
|
-
* number of further
|
|
5801
|
-
* chain like `await store.put(...); await store.get(...)`
|
|
5802
|
-
* up) before finally concluding the transaction is genuinely done.
|
|
5858
|
+
* number of further turns (see `keepAliveAndWait`, letting a typical
|
|
5859
|
+
* `await` chain like `await store.put(...); await store.get(...)`
|
|
5860
|
+
* catch up) before finally concluding the transaction is genuinely done.
|
|
5803
5861
|
* Applies to `readonly` transactions too, not just `readwrite`/
|
|
5804
5862
|
* `versionchange`: a `readonly` transaction's `complete` event
|
|
5805
5863
|
* can otherwise fire synchronously, immediately after its last
|
|
@@ -5829,7 +5887,7 @@
|
|
|
5829
5887
|
}
|
|
5830
5888
|
return;
|
|
5831
5889
|
}
|
|
5832
|
-
|
|
5890
|
+
keepAliveAndWait(function () {
|
|
5833
5891
|
checkQueueEntry(attemptsLeft - 1);
|
|
5834
5892
|
});
|
|
5835
5893
|
}
|
|
@@ -5884,7 +5942,7 @@
|
|
|
5884
5942
|
checkQueueEntry(10);
|
|
5885
5943
|
return;
|
|
5886
5944
|
}
|
|
5887
|
-
|
|
5945
|
+
keepAliveAndWait(function () {
|
|
5888
5946
|
if (me.__errored || me.__requestsFinished) {
|
|
5889
5947
|
return;
|
|
5890
5948
|
}
|
|
@@ -13890,10 +13948,11 @@
|
|
|
13890
13948
|
setNonIDBGlobals();
|
|
13891
13949
|
}
|
|
13892
13950
|
}
|
|
13893
|
-
/*
|
|
13951
|
+
/* c8 ignore start -- TS guard */
|
|
13894
13952
|
if (!IDB.shimIndexedDB) {
|
|
13895
13953
|
return;
|
|
13896
13954
|
}
|
|
13955
|
+
/* c8 ignore stop -- TS guard */
|
|
13897
13956
|
IDB.shimIndexedDB.__setConnectionQueueOrigin();
|
|
13898
13957
|
}
|
|
13899
13958
|
};
|