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 (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -1819,7 +1819,7 @@
|
|
|
1819
1819
|
'UnicodeIDStart',
|
|
1820
1820
|
// In the non-Unicode builds, defaults to /[$0-9A-Z_a-z]/
|
|
1821
1821
|
'UnicodeIDContinue',
|
|
1822
|
-
// Used by
|
|
1822
|
+
// Used by Sca.js for optional restructuring of typeson-registry
|
|
1823
1823
|
// Structured Cloning Algorithm; should only be needed for ensuring data
|
|
1824
1824
|
// created in 3.* versions of IndexedDBShim continue to work; see the
|
|
1825
1825
|
// library `typeson-registry-sca-reverter` to get a function to do this
|
|
@@ -5383,6 +5383,7 @@
|
|
|
5383
5383
|
* __requestsFinished: boolean,
|
|
5384
5384
|
* __transFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
|
|
5385
5385
|
* __callTransFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
|
|
5386
|
+
* __usesStandardDriver: () => boolean,
|
|
5386
5387
|
* __transactionEndCallback: (() => void)|undefined,
|
|
5387
5388
|
* __transactionFinished: boolean,
|
|
5388
5389
|
* __completed: boolean,
|
|
@@ -5522,6 +5523,27 @@
|
|
|
5522
5523
|
cb(Boolean(err));
|
|
5523
5524
|
};
|
|
5524
5525
|
|
|
5526
|
+
/**
|
|
5527
|
+
* A standard (3-argument) `transaction()`/`readTransaction()` implementation
|
|
5528
|
+
* (browser WebSQL, `cordova-plugin-sqlite-2`, etc.) never invokes the
|
|
5529
|
+
* non-standard 4th callback that installs the real `__transFinishedCb`,
|
|
5530
|
+
* and finalizes its own underlying SQL transaction synchronously, as soon
|
|
5531
|
+
* as it sees no further `executeSql` call already in flight or queued --
|
|
5532
|
+
* with no way for it to know a JS-level continuation (e.g. an
|
|
5533
|
+
* `await`-deferred follow-up request) is still coming. Detected via
|
|
5534
|
+
* arity, checking whichever of the two methods this transaction's own
|
|
5535
|
+
* mode actually uses.
|
|
5536
|
+
* @this {IDBTransactionFull}
|
|
5537
|
+
* @returns {boolean}
|
|
5538
|
+
*/
|
|
5539
|
+
IDBTransaction.prototype.__usesStandardDriver = function () {
|
|
5540
|
+
var me = this;
|
|
5541
|
+
var dbConn = me.db && me.db.__db;
|
|
5542
|
+
var dbMethodName = me.mode === 'readonly' ? 'readTransaction' : 'transaction';
|
|
5543
|
+
var supportsNonstandardTransCb = Boolean(dbConn && typeof dbConn[dbMethodName] === 'function' && dbConn[dbMethodName].length >= 4);
|
|
5544
|
+
return !supportsNonstandardTransCb;
|
|
5545
|
+
};
|
|
5546
|
+
|
|
5525
5547
|
/**
|
|
5526
5548
|
* In Node, the real (SQL-commit-capable) `__transFinishedCb` is only
|
|
5527
5549
|
* installed once the underlying WebSQL driver's own SQL-queue-idle check
|
|
@@ -5556,17 +5578,11 @@
|
|
|
5556
5578
|
return;
|
|
5557
5579
|
}
|
|
5558
5580
|
if (me.__transFinishedCb === IDBTransaction.prototype.__transFinishedCb) {
|
|
5559
|
-
//
|
|
5560
|
-
//
|
|
5561
|
-
//
|
|
5562
|
-
//
|
|
5563
|
-
|
|
5564
|
-
// actually uses -- see `__executeRequests`) and, if it's not supported,
|
|
5565
|
-
// just call the default (the driver auto-commits on its own).
|
|
5566
|
-
var dbConn = me.db && me.db.__db;
|
|
5567
|
-
var dbMethodName = me.mode === 'readonly' ? 'readTransaction' : 'transaction';
|
|
5568
|
-
var supportsNonstandardTransCb = Boolean(dbConn && typeof dbConn[dbMethodName] === 'function' && dbConn[dbMethodName].length >= 4);
|
|
5569
|
-
if (!supportsNonstandardTransCb) {
|
|
5581
|
+
// Waiting here for the non-standard 4th callback to install the real
|
|
5582
|
+
// `__transFinishedCb` would defer forever on a standard driver, which
|
|
5583
|
+
// never invokes it -- call the default instead (the driver auto-commits
|
|
5584
|
+
// on its own).
|
|
5585
|
+
if (me.__usesStandardDriver()) {
|
|
5570
5586
|
me.__transFinishedCbFired = true;
|
|
5571
5587
|
me.__transFinishedCb(err, cb);
|
|
5572
5588
|
return;
|
|
@@ -5605,10 +5621,52 @@
|
|
|
5605
5621
|
// `readTransaction` is optimized, at least in `node-websql`
|
|
5606
5622
|
function executeRequests(tx) {
|
|
5607
5623
|
me.__tx = tx;
|
|
5624
|
+
var isStandardDriver = me.__usesStandardDriver();
|
|
5608
5625
|
/** @type {RequestInfo} */
|
|
5609
5626
|
var q,
|
|
5610
5627
|
i = -1;
|
|
5611
5628
|
|
|
5629
|
+
/**
|
|
5630
|
+
* A continuation that must still be able to observe the
|
|
5631
|
+
* transaction as safe to extend (e.g., re-checking whether an
|
|
5632
|
+
* `await`-based follow-up request has arrived yet, or giving a
|
|
5633
|
+
* same-tick microtask scheduled from a handler a chance to run
|
|
5634
|
+
* first) can normally just be deferred via `queueMicrotask`.
|
|
5635
|
+
* That alone isn't safe on a standard (3-argument) driver,
|
|
5636
|
+
* though: it finalizes its own underlying SQL transaction
|
|
5637
|
+
* synchronously, as soon as it sees no further `executeSql`
|
|
5638
|
+
* call already in flight or queued, and a microtask hop by
|
|
5639
|
+
* itself never issues one -- so the driver already considers
|
|
5640
|
+
* the transaction done by the time the deferred continuation
|
|
5641
|
+
* runs, silently dropping whatever it tries to do next. Issuing
|
|
5642
|
+
* a harmless `SELECT 1` instead keeps the driver's own queue
|
|
5643
|
+
* non-empty across that same gap, at the cost of a real SQL
|
|
5644
|
+
* round trip; Node's driver doesn't need this since its real
|
|
5645
|
+
* commit/rollback is already deferred separately, via
|
|
5646
|
+
* `nonstandardTransCb`.
|
|
5647
|
+
* @param {() => void} cb
|
|
5648
|
+
* @returns {void}
|
|
5649
|
+
*/
|
|
5650
|
+
function keepAliveAndWait(cb) {
|
|
5651
|
+
if (!isStandardDriver) {
|
|
5652
|
+
queueMicrotask(cb);
|
|
5653
|
+
return;
|
|
5654
|
+
}
|
|
5655
|
+
try {
|
|
5656
|
+
tx.executeSql('SELECT 1', [], function () {
|
|
5657
|
+
cb();
|
|
5658
|
+
}, function () {
|
|
5659
|
+
cb();
|
|
5660
|
+
return false; // Don't roll back the transaction over a keep-alive no-op
|
|
5661
|
+
});
|
|
5662
|
+
} catch (err) {
|
|
5663
|
+
// The driver has already finalized the transaction (or otherwise
|
|
5664
|
+
// rejected the call) -- nothing left to hold open, so fall back
|
|
5665
|
+
// to a plain microtask hop for the continuation itself.
|
|
5666
|
+
queueMicrotask(cb);
|
|
5667
|
+
}
|
|
5668
|
+
}
|
|
5669
|
+
|
|
5612
5670
|
/**
|
|
5613
5671
|
* @typedef {unknown} IDBRequestResult
|
|
5614
5672
|
*/
|
|
@@ -5802,9 +5860,9 @@
|
|
|
5802
5860
|
* from a microtask -- so if the JS-level queue is merely found
|
|
5803
5861
|
* empty here, that doesn't yet mean no more work is coming, only
|
|
5804
5862
|
* that none has been queued *yet*. Re-check across a small, bounded
|
|
5805
|
-
* number of further
|
|
5806
|
-
* chain like `await store.put(...); await store.get(...)`
|
|
5807
|
-
* up) before finally concluding the transaction is genuinely done.
|
|
5863
|
+
* number of further turns (see `keepAliveAndWait`, letting a typical
|
|
5864
|
+
* `await` chain like `await store.put(...); await store.get(...)`
|
|
5865
|
+
* catch up) before finally concluding the transaction is genuinely done.
|
|
5808
5866
|
* Applies to `readonly` transactions too, not just `readwrite`/
|
|
5809
5867
|
* `versionchange`: a `readonly` transaction's `complete` event
|
|
5810
5868
|
* can otherwise fire synchronously, immediately after its last
|
|
@@ -5834,7 +5892,7 @@
|
|
|
5834
5892
|
}
|
|
5835
5893
|
return;
|
|
5836
5894
|
}
|
|
5837
|
-
|
|
5895
|
+
keepAliveAndWait(function () {
|
|
5838
5896
|
checkQueueEntry(attemptsLeft - 1);
|
|
5839
5897
|
});
|
|
5840
5898
|
}
|
|
@@ -5889,7 +5947,7 @@
|
|
|
5889
5947
|
checkQueueEntry(10);
|
|
5890
5948
|
return;
|
|
5891
5949
|
}
|
|
5892
|
-
|
|
5950
|
+
keepAliveAndWait(function () {
|
|
5893
5951
|
if (me.__errored || me.__requestsFinished) {
|
|
5894
5952
|
return;
|
|
5895
5953
|
}
|
|
@@ -13892,10 +13950,11 @@
|
|
|
13892
13950
|
setNonIDBGlobals();
|
|
13893
13951
|
}
|
|
13894
13952
|
}
|
|
13895
|
-
/*
|
|
13953
|
+
/* c8 ignore start -- TS guard */
|
|
13896
13954
|
if (!IDB.shimIndexedDB) {
|
|
13897
13955
|
return;
|
|
13898
13956
|
}
|
|
13957
|
+
/* c8 ignore stop -- TS guard */
|
|
13899
13958
|
IDB.shimIndexedDB.__setConnectionQueueOrigin();
|
|
13900
13959
|
}
|
|
13901
13960
|
};
|