indexeddbshim 17.2.1 → 17.2.2
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/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +74 -11
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +74 -11
- 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 +74 -11
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +74 -11
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +3 -3
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +74 -11
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +4 -4
- package/dist/indexeddbshim.min.js.map +1 -1
- package/package.json +2 -1
- package/src/IDBFactory.js +62 -9
- package/src/IDBTransaction.js +13 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim - v17.2.
|
|
1
|
+
/*! indexeddbshim - v17.2.2 - 8/18/2026 */
|
|
2
2
|
|
|
3
3
|
(function (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -4930,6 +4930,17 @@
|
|
|
4930
4930
|
IDBTransaction.prototype.__callTransFinishedCb = function (err, cb) {
|
|
4931
4931
|
var me = this;
|
|
4932
4932
|
if (me.__transFinishedCb === IDBTransaction.prototype.__transFinishedCb) {
|
|
4933
|
+
// Standard (3-argument) `transaction()` implementations (browser WebSQL,
|
|
4934
|
+
// `cordova-plugin-sqlite-2`, etc.) never invoke the non-standard 4th
|
|
4935
|
+
// callback that installs the real `__transFinishedCb`, so waiting for
|
|
4936
|
+
// it here would defer forever. Detect that via arity and, if it's not
|
|
4937
|
+
// supported, just call the default (the driver auto-commits on its own).
|
|
4938
|
+
var dbConn = me.db && me.db.__db;
|
|
4939
|
+
var supportsNonstandardTransCb = Boolean(dbConn && typeof dbConn.transaction === 'function' && dbConn.transaction.length >= 4);
|
|
4940
|
+
if (!supportsNonstandardTransCb) {
|
|
4941
|
+
me.__transFinishedCb(err, cb);
|
|
4942
|
+
return;
|
|
4943
|
+
}
|
|
4933
4944
|
setTimeout(function () {
|
|
4934
4945
|
me.__callTransFinishedCb(err, cb);
|
|
4935
4946
|
}, 0);
|
|
@@ -9871,6 +9882,56 @@
|
|
|
9871
9882
|
return websqlDBCache[name] && websqlDBCache[name][getLatestCachedWebSQLVersion(name)];
|
|
9872
9883
|
}
|
|
9873
9884
|
|
|
9885
|
+
/**
|
|
9886
|
+
* A cached WebSQL connection (e.g., from a prior `open()`) can keep the
|
|
9887
|
+
* underlying SQLite file handle open even after `IDBDatabase#close()`
|
|
9888
|
+
* (which only flags the connection for closing without releasing the
|
|
9889
|
+
* handle, to allow instance reuse). On Windows, deleting a file while a
|
|
9890
|
+
* handle to it is still open fails with `EBUSY`, so any cached connections
|
|
9891
|
+
* for `name` must be actually closed (and evicted, since they're no longer
|
|
9892
|
+
* usable) before attempting to remove the file.
|
|
9893
|
+
* @param {string} name
|
|
9894
|
+
* @param {() => void} cb
|
|
9895
|
+
* @returns {void}
|
|
9896
|
+
*/
|
|
9897
|
+
function closeCachedWebSQLConnections(name, cb) {
|
|
9898
|
+
if (!Object.hasOwn(websqlDBCache, name)) {
|
|
9899
|
+
cb();
|
|
9900
|
+
return;
|
|
9901
|
+
}
|
|
9902
|
+
var dbs = Object.values(websqlDBCache[name]);
|
|
9903
|
+
delete websqlDBCache[name];
|
|
9904
|
+
var remaining = dbs.length;
|
|
9905
|
+
if (remaining === 0) {
|
|
9906
|
+
cb();
|
|
9907
|
+
return;
|
|
9908
|
+
}
|
|
9909
|
+
dbs.forEach(function (db) {
|
|
9910
|
+
var sqliteDB = db._db && db._db._db;
|
|
9911
|
+
if (!sqliteDB || !sqliteDB.close) {
|
|
9912
|
+
remaining--;
|
|
9913
|
+
if (remaining === 0) {
|
|
9914
|
+
cb();
|
|
9915
|
+
}
|
|
9916
|
+
return;
|
|
9917
|
+
}
|
|
9918
|
+
sqliteDB.close(
|
|
9919
|
+
/**
|
|
9920
|
+
* @param {Error} err
|
|
9921
|
+
* @returns {void}
|
|
9922
|
+
*/
|
|
9923
|
+
function (err) {
|
|
9924
|
+
if (err) {
|
|
9925
|
+
console.warn('Error closing database connection prior to file removal: ' + err);
|
|
9926
|
+
}
|
|
9927
|
+
remaining--;
|
|
9928
|
+
if (remaining === 0) {
|
|
9929
|
+
cb();
|
|
9930
|
+
}
|
|
9931
|
+
});
|
|
9932
|
+
});
|
|
9933
|
+
}
|
|
9934
|
+
|
|
9874
9935
|
/**
|
|
9875
9936
|
* @param {OpenDatabase} __openDatabase
|
|
9876
9937
|
* @param {string} name
|
|
@@ -9908,16 +9969,18 @@
|
|
|
9908
9969
|
return;
|
|
9909
9970
|
}
|
|
9910
9971
|
if (fs && CFG.deleteDatabaseFiles !== false) {
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9972
|
+
closeCachedWebSQLConnections(name, function () {
|
|
9973
|
+
fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
|
|
9974
|
+
if (err && err.code !== 'ENOENT') {
|
|
9975
|
+
// Ignore if file is already deleted
|
|
9976
|
+
dbError({
|
|
9977
|
+
code: 0,
|
|
9978
|
+
message: 'Error removing database file: ' + escapedDatabaseName + ' ' + err
|
|
9979
|
+
});
|
|
9980
|
+
return;
|
|
9981
|
+
}
|
|
9982
|
+
databaseDeleted();
|
|
9983
|
+
});
|
|
9921
9984
|
});
|
|
9922
9985
|
return;
|
|
9923
9986
|
}
|