indexeddbshim 19.0.4 → 19.0.6
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/badges/coverage-badge.svg +1 -1
- package/badges/tests-badge.svg +1 -1
- package/dist/CFG.d.ts +1 -1
- package/dist/CFG.d.ts.map +1 -1
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBDatabase.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts +1 -2
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts +2 -6
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBObjectStore.d.ts.map +1 -1
- package/dist/IDBRecord.d.ts.map +1 -1
- package/dist/IDBRequest.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/Key.d.ts.map +1 -1
- package/dist/Sca.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +40 -28
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +2 -2
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +525 -225
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +553 -252
- 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 +525 -225
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +553 -252
- 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 +553 -252
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +3 -3
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/dist/setGlobalVars.d.ts +1 -1
- package/dist/setGlobalVars.d.ts.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/package.json +22 -17
- package/src/CFG.js +18 -4
- package/src/DOMException.js +6 -0
- package/src/DOMStringList.js +3 -0
- package/src/IDBCursor.js +36 -3
- package/src/IDBDatabase.js +26 -10
- package/src/IDBFactory.js +105 -5
- package/src/IDBIndex.js +49 -32
- package/src/IDBKeyRange.js +8 -7
- package/src/IDBObjectStore.js +25 -2
- package/src/IDBRecord.js +2 -0
- package/src/IDBRequest.js +7 -4
- package/src/IDBTransaction.js +111 -34
- package/src/Key.js +17 -16
- package/src/Sca.js +9 -4
- package/src/nodeWebSQL.js +1 -0
- package/src/setGlobalVars.js +86 -77
- package/src/util.js +5 -6
package/dist/nodeWebSQL.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeWebSQL.d.ts","sourceRoot":"","sources":["../src/nodeWebSQL.js"],"names":[],"mappings":";qCAKa;IACR,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,CAAA,OAAO,cAAc,EAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;CACjD;;;;;;;;;;;wCAYS,KACR,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,kDAAkD,EAAE,qBAAqB,KACpF,sBAAsB;
|
|
1
|
+
{"version":3,"file":"nodeWebSQL.d.ts","sourceRoot":"","sources":["../src/nodeWebSQL.js"],"names":[],"mappings":";qCAKa;IACR,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,CAAA,OAAO,cAAc,EAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;CACjD;;;;;;;;;;;wCAYS,KACR,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,kDAAkD,EAAE,qBAAqB,KACpF,sBAAsB;AAiC9B,qHAAsK;2BAvD3I,kDAAkD"}
|
package/dist/setGlobalVars.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createDOMException };
|
|
2
2
|
export default setGlobalVars;
|
|
3
|
-
export type SetConfig = (prop: import("./CFG.js").KeyofConfigValues | Partial<import("./CFG.js").ConfigValues>, val?: import("./CFG.js").ConfigValue
|
|
3
|
+
export type SetConfig = (prop: import("./CFG.js").KeyofConfigValues | Partial<import("./CFG.js").ConfigValues>, val?: import("./CFG.js").ConfigValue) => any;
|
|
4
4
|
export type GetConfig = (prop: import("./CFG.js").KeyofConfigValues) => import("./CFG.js").ConfigValue;
|
|
5
5
|
export type SetUnicodeIdentifiers = (cfg: {
|
|
6
6
|
UnicodeIDStart: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setGlobalVars.d.ts","sourceRoot":"","sources":["../src/setGlobalVars.js"],"names":[],"mappings":";;+BAmBW,OAAO,UAAU,EAAE,iBAAiB,GAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"setGlobalVars.d.ts","sourceRoot":"","sources":["../src/setGlobalVars.js"],"names":[],"mappings":";;+BAmBW,OAAO,UAAU,EAAE,iBAAiB,GAC1C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,QAClC,OAAO,UAAU,EAAE,WAAW;wBAoC5B,CACR,IAAI,EAAE,OAAO,UAAU,EAAE,iBAAiB,KACvC,OAAO,UAAU,EAAE,WAAW;oCAIzB,CAAC,GAAG,EAAE;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,KAAK,IAAI;4BAIA,CAAC,UAAU,GAAC,MAAM,CAAC,GAAG;IAC5B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAChC,WAAW,EAAE,SAAS,CAAC;IACvB,WAAW,EAAE,SAAS,CAAC;IACvB,uBAAuB,EAAE,qBAAqB,CAAC;IAC/C,0BAA0B,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;sBAIO,MAAM;4BAIN,CAAC,OAAO,UAAU,GAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACtD,SAAS,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAChC,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,WAAW,EAAE,OAAO,WAAW,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;mCA5F+C,mBAAmB;AAoDtE;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;GAKG;AACH,qCAJW,OAAO,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,kBAC3C,OAAO,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,GACtC,aAAa,CAoTzB;2BAtZ8C,iBAAiB"}
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.js"],"names":[],"mappings":"sBAKa,MAAM;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.js"],"names":[],"mappings":"sBAKa,MAAM;uBAyPN;IAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA;CAAC;uBA0SnD,OAAO;AA1fpB;;;;GAIG;AACH,2CAHW,MAAM,GACJ,MAAM,CASlB;AAED;;;GAGG;AACH,4CAHW,MAAM,GACJ,MAAM,CAclB;AAuBD;;;;GAIG;AACH,qDAJW,MAAM,GAEJ,MAAM,CAoClB;AAmBD;;;;GAIG;AACH,uDAHW,MAAM,GACJ,MAAM,CAkClB;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,sDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,mCAHW,MAAM,GACJ,MAAM,CAKlB;AAzID;;;GAGG;AACH,8BAHW,MAAM,GACJ,MAAM,CAIlB;AAqID;;;;;;;;;;;;;GAaG;AACH,+BAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAQlB;AAGD;;GAEG;AAIH;;;;;GAKG;AACH,gCAJW,QAAQ,QACR,QAAQ,GACN,OAAO,CAInB;AAED;;;;GAIG;AACH,2BAHW,QAAQ,GACN,GAAG,IAAI,MAAM,CAIzB;AAED;;;;GAIG;AACH,4BAHW,QAAQ,GACN,OAAO,CAInB;AAED;;;;GAIG;AACH,4BAHW,QAAQ,GACN,OAAO,CAKnB;AAED;;;;GAIG;AACH,4BAHW,QAAQ,GACN,OAAO,CAKnB;AAED;;;;GAIG;AACH,8BAHW,QAAQ,GACN,OAAO,CAOnB;AAED;;;;GAIG;AACH,gCAHW,QAAQ,GACN,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAOpC;AAED;;;;;GAKG;AACH,0CAJW,MAAM,SACN,MAAM,EAAE,GACN,IAAI,CAkBhB;AAED;;;;;GAKG;AACH,kDAJW,MAAM,SACN,MAAM,EAAE,GACN,IAAI,CAchB;AAED;;;;;GAKG;AACH,8CAJW,MAAM,aACN,MAAM,EAAE,GACN,IAAI,CA0BhB;AAED;;;;;;;;GAQG;AACH,8CAPW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,WACf,IAAI,GAAC;IACf,CAAK,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB,GACS,IAAI,CA8BhB;AAED;;;;;;;;;;;;;GAaG;AACH,uCAHW,MAAM,GACJ,IAAI,CAchB;AAgCD;;;;GAIG;AACH,wCAHW,MAAM,GAAC,MAAM,EAAE,GACb,OAAO,CAWnB;AAED;;;;;GAKG;AACH,qCALW,MAAM,QACN,oBAAoB,GAAC,eAAe,GAElC,MAAM,CAyBlB;AAED;;GAEG;AAEH;;;;GAIG;AACH,sCAJW,QAAQ,gBACR,OAAO,GACL,MAAM,CAIlB;AAcD;;;;GAIG;AACH,gDAHW,QAAQ,GACN,MAAM,GAAC,MAAM,EAAE,CAW3B;AAED;;;GAGG;AACH,6BAHW,QAAQ,GACN,CAAC,IAAI,IAAI,GAAC,SAAS,CAI/B;AA6BD;;;GAGG;AACH,0CAHW,MAAM,IAAI,GACR,IAAI,CAmBhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "indexeddbshim",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Parashuram <code@nparashuram.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"json-summary",
|
|
16
16
|
"lcov"
|
|
17
17
|
],
|
|
18
|
+
"check-coverage": true,
|
|
19
|
+
"lines": 100,
|
|
20
|
+
"statements": 100,
|
|
21
|
+
"functions": 100,
|
|
22
|
+
"branches": 100,
|
|
18
23
|
"exclude": [
|
|
19
24
|
"node_modules/**",
|
|
20
25
|
"IndexedDBShim/node_modules/**",
|
|
@@ -45,7 +50,7 @@
|
|
|
45
50
|
"clean": "run-p clean-sysDB clean-mocha clean-fake clean-mock clean-w3c clean-w3cOld",
|
|
46
51
|
"clean-sysDB": "rimraf --glob __sysdb__*",
|
|
47
52
|
"clean-polyfill": "run-p clean-fake clean-mock clean-w3cOld clean-sysDB",
|
|
48
|
-
"clean-mocha": "rimraf --glob D_indexeddbshim_test_database_* D_test.sqlite",
|
|
53
|
+
"clean-mocha": "rimraf --glob D_recreate-index* D_indexeddbshim_test_database_* D_test.sqlite D_delete-* D_update-* D_cont* D_c^* D_dbname* D_sysdb-* file::memory:?* && npm run clean-sysDB",
|
|
49
54
|
"clean-fake": "rimraf --glob D_test0.*",
|
|
50
55
|
"clean-mock": "rimraf --glob D_test_database*",
|
|
51
56
|
"clean-w3c": "rimraf --glob D_opaque* D_inbox* D_output* D_*_bucket_* D_^D^B2* D_db* D_test* D_about* D_^I^D^B* D_blank* D_database_name* D_idbtransaction* D_x D_x.sqlite D_y D_y.sqlite D_webworker* D_http* && npm run clean-sysDB",
|
|
@@ -103,7 +108,7 @@
|
|
|
103
108
|
"test-and-start:w3c": "run-p -r start web-platform-tests delayed-w3c-test",
|
|
104
109
|
"delay": "delay 9",
|
|
105
110
|
"delayed-w3c-test": "run-s delay w3c-build-only test:w3c",
|
|
106
|
-
"w3c-test": "run-s clean-w3c test-and-start:w3c",
|
|
111
|
+
"w3c-test": "run-s clean-w3c test-and-start:w3c clean-w3c",
|
|
107
112
|
"w3c-good-only": "NODE_OPTIONS=--max_old_space_size=16384 node test-support/node-idb-test.js good",
|
|
108
113
|
"w3c-bad-only": "NODE_OPTIONS=--max_old_space_size=16384 node test-support/node-idb-test.js bad",
|
|
109
114
|
"w3c-good-worker-only": "NODE_OPTIONS=--max_old_space_size=16384 node test-support/node-idb-test.js good-worker",
|
|
@@ -170,29 +175,29 @@
|
|
|
170
175
|
"node": "^22.18.0 || >= 24.11.0"
|
|
171
176
|
},
|
|
172
177
|
"dependencies": {
|
|
173
|
-
"@node-static/node-static": "^0.
|
|
178
|
+
"@node-static/node-static": "^0.10.0",
|
|
174
179
|
"canvas": "^3.2.3",
|
|
175
|
-
"eventtargeter": "0.12.
|
|
180
|
+
"eventtargeter": "0.12.1",
|
|
176
181
|
"sync-promise-expanded": "^2.0.0",
|
|
177
182
|
"typeson": "10.3.0",
|
|
178
|
-
"typeson-registry": "
|
|
179
|
-
"websql-configurable": "^4.
|
|
183
|
+
"typeson-registry": "15.0.0",
|
|
184
|
+
"websql-configurable": "^4.1.0"
|
|
180
185
|
},
|
|
181
186
|
"devDependencies": {
|
|
182
187
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
183
|
-
"@babel/core": "^8.0.
|
|
184
|
-
"@babel/preset-env": "^8.0.
|
|
188
|
+
"@babel/core": "^8.0.6",
|
|
189
|
+
"@babel/preset-env": "^8.0.6",
|
|
185
190
|
"@es-joy/json-file-reporter": "^2.0.0",
|
|
186
191
|
"@rollup/plugin-babel": "^7.1.0",
|
|
187
192
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
188
193
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
189
194
|
"@rollup/plugin-terser": "^1.0.0",
|
|
190
|
-
"@types/node": "^26.
|
|
195
|
+
"@types/node": "^26.6.2",
|
|
191
196
|
"@types/websql": "^0.0.30",
|
|
192
197
|
"@unicode/unicode-17.0.0": "^2.0.7",
|
|
193
198
|
"babel-plugin-add-module-exports": "1.0.4",
|
|
194
199
|
"bson": "^7.3.3",
|
|
195
|
-
"builtin-modules": "^5.
|
|
200
|
+
"builtin-modules": "^5.4.0",
|
|
196
201
|
"c8": "^12.0.0",
|
|
197
202
|
"chai": "6.2.2",
|
|
198
203
|
"chokidar-cli": "^3.0.0",
|
|
@@ -200,21 +205,21 @@
|
|
|
200
205
|
"copyfiles": "^2.4.1",
|
|
201
206
|
"coveradge": "^0.9.0",
|
|
202
207
|
"delay-cli": "^3.0.0",
|
|
203
|
-
"eslint": "^10.
|
|
204
|
-
"eslint-config-ash-nazg": "^43.
|
|
208
|
+
"eslint": "^10.11.0",
|
|
209
|
+
"eslint-config-ash-nazg": "^43.2.2",
|
|
205
210
|
"globals": "^17.12.0",
|
|
206
211
|
"is-date-object": "1.1.0",
|
|
207
212
|
"isomorphic-fetch": "^3.0.0",
|
|
208
|
-
"jsdom": "^30.0
|
|
213
|
+
"jsdom": "^30.1.0",
|
|
209
214
|
"license-badger": "^0.23.1",
|
|
210
|
-
"local-xmlhttprequest": "4.0.
|
|
211
|
-
"mocha": "^12.0.
|
|
215
|
+
"local-xmlhttprequest": "4.0.1",
|
|
216
|
+
"mocha": "^12.0.2",
|
|
212
217
|
"mocha-badge-generator": "^0.13.0",
|
|
213
218
|
"mocha-multi-reporters": "1.5.2",
|
|
214
219
|
"npm-run-all": "^4.1.5",
|
|
215
220
|
"open-cli": "^9.0.0",
|
|
216
221
|
"rimraf": "^6.1.3",
|
|
217
|
-
"rollup": "^4.63.
|
|
222
|
+
"rollup": "^4.63.4",
|
|
218
223
|
"rollup-plugin-filesize": "^10.0.0",
|
|
219
224
|
"sinon": "^22.1.0",
|
|
220
225
|
"source-map-support": "0.5.21",
|
package/src/CFG.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* databaseNameLengthLimit: number|false,
|
|
37
37
|
* escapeNFDForDatabaseNames: boolean,
|
|
38
38
|
* addSQLiteExtension: boolean,
|
|
39
|
-
* memoryDatabase: string,
|
|
39
|
+
* memoryDatabase: string|null|undefined,
|
|
40
40
|
* deleteDatabaseFiles: boolean,
|
|
41
41
|
* databaseBasePath: string,
|
|
42
42
|
* sysDatabaseBasePath: string,
|
|
@@ -191,17 +191,31 @@ const CFG = /** @type {ConfigValues} */ ({});
|
|
|
191
191
|
[
|
|
192
192
|
'memoryDatabase',
|
|
193
193
|
/**
|
|
194
|
-
*
|
|
194
|
+
* `null`/`undefined` are accepted (and left unvalidated against the
|
|
195
|
+
* regex below) specifically so this can be reset back to its
|
|
196
|
+
* unset/disabled state after being set: unlike other `CFG`
|
|
197
|
+
* boolean-ish switches (e.g. `sqlMemoryQuota`, which is checked
|
|
198
|
+
* with a falsy `if (CFG.sqlMemoryQuota)`), `memoryDatabase`'s own
|
|
199
|
+
* usage sites check `typeof CFG.memoryDatabase === 'string'`, so
|
|
200
|
+
* even the empty string counts as "on" (it's a distinct, valid
|
|
201
|
+
* in-memory mode of its own -- an unnamed private temporary
|
|
202
|
+
* database -- not an "off" state). Without this, once set to any
|
|
203
|
+
* string there would be no value passable back through this same
|
|
204
|
+
* validator that turns `useMemoryDatabase` false again.
|
|
205
|
+
* @param {string|null|undefined} val
|
|
195
206
|
* @throws {TypeError}
|
|
196
207
|
* @returns {void}
|
|
197
208
|
*/
|
|
198
209
|
(val) => {
|
|
210
|
+
if (val === null || val === undefined) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
199
213
|
if (!(/^(?::memory:|file::memory:(\?[^#]*)?(#.*)?)?$/u).test(
|
|
200
214
|
/** @type {string} */ (val)
|
|
201
215
|
)) {
|
|
202
216
|
throw new TypeError(
|
|
203
|
-
'`memoryDatabase` must be the empty string,
|
|
204
|
-
'"file::memory:[?queryString][#hash] URL".'
|
|
217
|
+
'`memoryDatabase` must be `null`/`undefined` (to reset it to disabled), the empty string, ' +
|
|
218
|
+
'":memory:", or a "file::memory:[?queryString][#hash] URL".'
|
|
205
219
|
);
|
|
206
220
|
}
|
|
207
221
|
}
|
package/src/DOMException.js
CHANGED
|
@@ -11,6 +11,7 @@ function createNativeDOMException (name, message) {
|
|
|
11
11
|
// eslint-disable-next-line new-cap -- Ok
|
|
12
12
|
return new DOMException.prototype.constructor(
|
|
13
13
|
message,
|
|
14
|
+
/* c8 ignore next -- Defensive fallback; every call site in this codebase always supplies a `name` */
|
|
14
15
|
name || 'DOMException'
|
|
15
16
|
);
|
|
16
17
|
}
|
|
@@ -178,8 +179,10 @@ function createNonNativeDOMExceptionClass () {
|
|
|
178
179
|
*/
|
|
179
180
|
get () {
|
|
180
181
|
if (!(this instanceof DOMException ||
|
|
182
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
181
183
|
// @ts-ignore Just checking; needed under some TS versions
|
|
182
184
|
this instanceof DummyDOMException ||
|
|
185
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
183
186
|
// @ts-ignore Just checking; needed under some TS versions
|
|
184
187
|
this instanceof Error)) {
|
|
185
188
|
throw new TypeError('Illegal invocation');
|
|
@@ -242,6 +245,7 @@ function createNonNativeDOMExceptionClass () {
|
|
|
242
245
|
value: DOMException
|
|
243
246
|
});
|
|
244
247
|
|
|
248
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
245
249
|
// @ts-ignore We don't need all its properties; needed under some TS versions
|
|
246
250
|
return DOMException;
|
|
247
251
|
}
|
|
@@ -255,6 +259,7 @@ const ShimNonNativeDOMException = createNonNativeDOMExceptionClass();
|
|
|
255
259
|
* @returns {Error}
|
|
256
260
|
*/
|
|
257
261
|
function createNonNativeDOMException (name, message) {
|
|
262
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
258
263
|
// @ts-ignore It's ok; needed under some TS versions
|
|
259
264
|
return new ShimNonNativeDOMException(message, name);
|
|
260
265
|
}
|
|
@@ -281,6 +286,7 @@ function logError (name, message, error) {
|
|
|
281
286
|
? error.message
|
|
282
287
|
: /** @type {string} */ (error);
|
|
283
288
|
|
|
289
|
+
/* c8 ignore next -- Defensive fallback for an environment lacking `console.error` */
|
|
284
290
|
const method = typeof (console.error) === 'function' ? 'error' : 'log';
|
|
285
291
|
console[method](name + ': ' + message + '. ' + (msg || ''));
|
|
286
292
|
if (console.trace) { console.trace(); }
|
package/src/DOMStringList.js
CHANGED
|
@@ -28,9 +28,11 @@ if (Object.defineProperty) {
|
|
|
28
28
|
if (testObject.test) {
|
|
29
29
|
cleanInterface = true;
|
|
30
30
|
}
|
|
31
|
+
/* c8 ignore start -- Defensive fallback for an engine with a broken `Object.defineProperty` */
|
|
31
32
|
} catch (err) {
|
|
32
33
|
// Object.defineProperty does not work as intended.
|
|
33
34
|
}
|
|
35
|
+
/* c8 ignore stop -- Defensive fallback for an engine with a broken `Object.defineProperty` */
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -230,6 +232,7 @@ Object.defineProperty(DOMStringList, '__createInstance', {
|
|
|
230
232
|
this._length = 0;
|
|
231
233
|
};
|
|
232
234
|
DOMStringList.prototype = DOMStringListAlias.prototype;
|
|
235
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
233
236
|
// @ts-ignore It's ok; needed under some TS versions
|
|
234
237
|
return /** @type {DOMStringListFull} */ (new DOMStringList());
|
|
235
238
|
}
|
package/src/IDBCursor.js
CHANGED
|
@@ -351,6 +351,7 @@ IDBCursor.prototype.__findBasic = function (key, primaryKey, tx, success, error,
|
|
|
351
351
|
success(undefined, undefined, undefined);
|
|
352
352
|
}
|
|
353
353
|
}, function (tx, err) {
|
|
354
|
+
/* c8 ignore next -- Debug-only log; no test sets `CFG.DEBUG`. */
|
|
354
355
|
if (CFG.DEBUG) { console.log('Could not execute Cursor.continue', sqlStr, sqlValues); }
|
|
355
356
|
error(err);
|
|
356
357
|
return false;
|
|
@@ -540,7 +541,16 @@ IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, e
|
|
|
540
541
|
if (a.key > b.key) {
|
|
541
542
|
return me.direction === 'prev' ? -1 : 1;
|
|
542
543
|
}
|
|
544
|
+
/* c8 ignore start -- Defensive: only reachable if two matches
|
|
545
|
+
in the same batch shared both the same `matchingKey` and
|
|
546
|
+
the same primary `key`, which would require the same
|
|
547
|
+
record's multi-entry array to contain a duplicate value.
|
|
548
|
+
`Key.js`'s array-to-key conversion already drops duplicate
|
|
549
|
+
values when a multi-entry index entry is built, so this
|
|
550
|
+
can never happen in practice; kept only to satisfy the
|
|
551
|
+
`Array.prototype.sort` comparator contract. */
|
|
543
552
|
return 0;
|
|
553
|
+
/* c8 ignore stop -- see comment above */
|
|
544
554
|
});
|
|
545
555
|
|
|
546
556
|
me.__prefetchedIndex = 0;
|
|
@@ -558,11 +568,15 @@ IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, e
|
|
|
558
568
|
};
|
|
559
569
|
if (CFG.DEBUG) { console.log('[multiEntry] Preloaded ' + me.__prefetchedData.length + ' records for multiEntry cursor'); }
|
|
560
570
|
me.__decode(rows[0], success);
|
|
561
|
-
},
|
|
571
|
+
}, /* c8 ignore start -- Defensive: guards against an unexpected SQLite
|
|
572
|
+
execution error (e.g. I/O error, corruption) while querying for
|
|
573
|
+
multi-entry cursor matches; not reliably reproducible without
|
|
574
|
+
mocking the SQL layer. */ function (tx, err) {
|
|
562
575
|
if (CFG.DEBUG) { console.log('[multiEntry] Could not execute Cursor.continue', sqlStr, sqlValues); }
|
|
563
576
|
error(err);
|
|
564
577
|
return false;
|
|
565
578
|
});
|
|
579
|
+
/* c8 ignore stop -- see comment above */
|
|
566
580
|
}
|
|
567
581
|
|
|
568
582
|
runQuery();
|
|
@@ -683,6 +697,7 @@ IDBCursor.prototype.__sourceOrEffectiveObjStoreDeleted = function () {
|
|
|
683
697
|
* @returns {void}
|
|
684
698
|
*/
|
|
685
699
|
IDBCursor.prototype.__invalidateCache = function () {
|
|
700
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
686
701
|
// @ts-ignore Why is this not being found?; needed under some TS versions
|
|
687
702
|
this.__prefetchedData = null;
|
|
688
703
|
this.__multiEntryExhausted = false;
|
|
@@ -710,7 +725,7 @@ IDBCursor.prototype.__continue = function (key, advanceContinue) {
|
|
|
710
725
|
(me.direction.includes('next') && cmpResult === -1) ||
|
|
711
726
|
(me.direction.includes('prev') && cmpResult === 1)
|
|
712
727
|
) {
|
|
713
|
-
throw createDOMException('DataError', 'Cannot
|
|
728
|
+
throw createDOMException('DataError', 'Cannot continue the cursor in an unexpected direction');
|
|
714
729
|
}
|
|
715
730
|
}
|
|
716
731
|
this.__continueFinish(key, undefined, advanceState);
|
|
@@ -976,6 +991,7 @@ IDBCursor.prototype.update = function (valueToUpdate) {
|
|
|
976
991
|
// continuation logic in `__findBasic` to see this update's
|
|
977
992
|
// effect on ordering (see "Modify records during cursor
|
|
978
993
|
// iteration" in idbcursor_update_index.any.js).
|
|
994
|
+
// eslint-disable-next-line jsdoc/ts-ban-ts-comment -- TS 6/7
|
|
979
995
|
// @ts-ignore -- API (not erring in TS 6)
|
|
980
996
|
IDBObjectStore.__storingRecordObjectStore(request, me.__store, true, clonedValue, false, key);
|
|
981
997
|
}
|
|
@@ -1030,14 +1046,31 @@ IDBCursor.prototype.delete = function () {
|
|
|
1030
1046
|
// We don't invalidate the cache (as we don't access it anymore
|
|
1031
1047
|
// and it will set the index off)
|
|
1032
1048
|
success(undefined);
|
|
1049
|
+
/* c8 ignore start -- Defensive: `__find` (invoked just above) has
|
|
1050
|
+
already confirmed a row exists for this primary key within the
|
|
1051
|
+
same transaction queue, so `rowsAffected` should always be 1 in
|
|
1052
|
+
normal usage. This branch would only be reached if the underlying
|
|
1053
|
+
row were removed by another request queued in the same
|
|
1054
|
+
transaction between `__find`'s check and this DELETE actually
|
|
1055
|
+
running (e.g. deleting the same record directly via the object
|
|
1056
|
+
store while a cursor over it is mid-iteration); attempts to
|
|
1057
|
+
construct such a scenario instead trigger a transaction abort
|
|
1058
|
+
(`AbortError`) before this callback ever runs, since the default
|
|
1059
|
+
action of an unhandled request error is to abort the
|
|
1060
|
+
transaction. */
|
|
1033
1061
|
} else {
|
|
1034
1062
|
// @ts-expect-error Apparently ok
|
|
1035
1063
|
error('No rows with key found' + key);
|
|
1036
1064
|
}
|
|
1037
|
-
|
|
1065
|
+
/* c8 ignore stop -- see comment above */
|
|
1066
|
+
}, /* c8 ignore start -- Defensive: guards against an unexpected SQLite
|
|
1067
|
+
execution error (e.g. I/O error, corruption) while deleting the
|
|
1068
|
+
current row; not reliably reproducible without mocking the SQL
|
|
1069
|
+
layer. */ function (tx, data) {
|
|
1038
1070
|
error(data);
|
|
1039
1071
|
return false;
|
|
1040
1072
|
});
|
|
1073
|
+
/* c8 ignore stop -- see comment above */
|
|
1041
1074
|
}, error
|
|
1042
1075
|
);
|
|
1043
1076
|
}, undefined, me);
|
package/src/IDBDatabase.js
CHANGED
|
@@ -167,7 +167,7 @@ IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions
|
|
|
167
167
|
throw createDOMException('SyntaxError', 'The keyPath argument contains an invalid key path.');
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
if (Object.hasOwn(this.__objectStores, storeName) && !this.__objectStores[storeName].__pendingDelete) {
|
|
170
|
+
if (Object.hasOwn(this.__objectStores, storeName) && !this.__objectStores[storeName].__pendingDelete && !this.__objectStores[storeName].__deleted) {
|
|
171
171
|
throw createDOMException('ConstraintError', 'Object store "' + storeName + '" already exists in ' + this.name);
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -319,7 +319,6 @@ IDBDatabase.prototype.throwIfUpgradeTransactionNull = function () {
|
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
|
|
322
|
-
// Todo __forceClose: Add tests for `__forceClose`
|
|
323
322
|
/**
|
|
324
323
|
*
|
|
325
324
|
* @param {string} msg
|
|
@@ -328,26 +327,43 @@ IDBDatabase.prototype.throwIfUpgradeTransactionNull = function () {
|
|
|
328
327
|
*/
|
|
329
328
|
IDBDatabase.prototype.__forceClose = function (msg) {
|
|
330
329
|
const me = this;
|
|
330
|
+
// `close()` (below) resets `me.__transactions` to `[]`, so the
|
|
331
|
+
// transactions to abort -- and the total count the completion check
|
|
332
|
+
// below needs -- must be captured before calling it, not read back off
|
|
333
|
+
// `me.__transactions` afterward.
|
|
334
|
+
const transactions = me.__transactions;
|
|
331
335
|
me.close();
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @returns {void}
|
|
339
|
+
*/
|
|
340
|
+
function dispatchClose () {
|
|
341
|
+
// Todo __forceClose: unblock any pending `upgradeneeded` or `deleteDatabase` calls
|
|
342
|
+
const evt = createEvent('close');
|
|
343
|
+
setTimeout(() => {
|
|
344
|
+
me.dispatchEvent(evt);
|
|
345
|
+
}, 0);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (!transactions.length) {
|
|
349
|
+
dispatchClose();
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
332
352
|
let ct = 0;
|
|
333
|
-
|
|
353
|
+
transactions.forEach(function (trans) {
|
|
334
354
|
// eslint-disable-next-line camelcase -- Clear API
|
|
335
355
|
trans.on__abort = function () {
|
|
336
356
|
ct++;
|
|
337
|
-
if (ct
|
|
338
|
-
|
|
339
|
-
const evt = createEvent('close');
|
|
340
|
-
setTimeout(() => {
|
|
341
|
-
me.dispatchEvent(evt);
|
|
342
|
-
}, 0);
|
|
357
|
+
if (ct !== transactions.length) {
|
|
358
|
+
return;
|
|
343
359
|
}
|
|
360
|
+
dispatchClose();
|
|
344
361
|
};
|
|
345
362
|
trans.__abortTransaction(createDOMException(
|
|
346
363
|
'AbortError',
|
|
347
364
|
'The connection was force-closed: ' + (msg || '')
|
|
348
365
|
));
|
|
349
366
|
});
|
|
350
|
-
me.__transactions = [];
|
|
351
367
|
};
|
|
352
368
|
/* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
|
|
353
369
|
util.defineOuterInterface(IDBDatabase.prototype, listeners);
|