indexeddbshim 15.0.0 → 15.0.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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/badges/licenses-badge-dev.svg +1 -1
  3. package/dist/indexeddbshim-Key.js +24 -16
  4. package/dist/indexeddbshim-Key.js.map +1 -1
  5. package/dist/indexeddbshim-Key.min.js +1 -1
  6. package/dist/indexeddbshim-Key.min.js.map +1 -1
  7. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +142 -114
  8. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  9. package/dist/indexeddbshim-UnicodeIdentifiers.js +165 -129
  10. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  11. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
  12. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  13. package/dist/indexeddbshim-node.cjs +140 -112
  14. package/dist/indexeddbshim-node.cjs.map +1 -1
  15. package/dist/indexeddbshim-noninvasive.js +159 -123
  16. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  17. package/dist/indexeddbshim-noninvasive.min.js +2 -2
  18. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  19. package/dist/indexeddbshim.js +145 -117
  20. package/dist/indexeddbshim.js.map +1 -1
  21. package/dist/indexeddbshim.min.js +2 -2
  22. package/dist/indexeddbshim.min.js.map +1 -1
  23. package/package.json +85 -102
  24. package/src/DOMException.js +5 -4
  25. package/src/DOMStringList.js +4 -3
  26. package/src/IDBCursor.js +4 -4
  27. package/src/IDBDatabase.js +7 -2
  28. package/src/IDBFactory.js +25 -16
  29. package/src/IDBIndex.js +7 -6
  30. package/src/IDBKeyRange.js +3 -3
  31. package/src/IDBObjectStore.js +10 -9
  32. package/src/IDBTransaction.js +5 -5
  33. package/src/IDBVersionChangeEvent.js +1 -1
  34. package/src/Key.js +9 -2
  35. package/src/Sca.js +0 -1
  36. package/src/UnicodeIdentifiers.js +2 -2
  37. package/src/setGlobalVars.js +5 -2
  38. package/src/util.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indexeddbshim",
3
- "version": "15.0.0",
3
+ "version": "15.0.2",
4
4
  "type": "module",
5
5
  "author": "Parashuram <code@nparashuram.com>",
6
6
  "contributors": [
@@ -28,78 +28,6 @@
28
28
  "test-support/**"
29
29
  ]
30
30
  },
31
- "scripts": {
32
- "tsc": "tsc",
33
- "tsc-prod": "tsc -p tsconfig-prod.json",
34
- "build": "npm run rollup && npm run tsc-prod",
35
- "prepublishOnly": "npm run license-badges",
36
- "license-badge": "license-badger --corrections --uncategorizedLicenseTemplate \"\\${license} (\\${name} (\\${version}))\" --filteredTypes=nonempty --textTemplate \"License types\n(project, deps, and bundled devDeps)\" --packageJson --production badges/licenses-badge.svg",
37
- "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
38
- "license-badges": "run-p license-badge license-badge-dev",
39
- "start": "static -p 9999 -H '{\"Access-Control-Allow-Origin\": \"http://web-platform.test:8000\", \"Access-Control-Allow-Methods\": \"GET\", \"Access-Control-Allow-Headers\": \"Content-Type\"}'",
40
- "watch": "chokidar \"src/*\" \"node_modules/eventtarget/EventTarget.js\" \"node_modules/websql/lib/websql/WebSQLTransaction.js\" \"node_modules/websql/lib/websql/WebSQLDatabase.js\" -c \"npm run rollup\"",
41
- "dev": "run-p start watch",
42
- "clean": "run-p clean-sysDB clean-mocha clean-fake clean-mock clean-w3c clean-w3cOld",
43
- "clean-sysDB": "rimraf __sysdb__*",
44
- "clean-polyfill": "run-p clean-fake clean-mock clean-w3cOld clean-sysDB",
45
- "clean-mocha": "rimraf D_indexeddbshim_test_database_* D_test.sqlite",
46
- "clean-fake": "rimraf D_test0.*",
47
- "clean-mock": "rimraf D_test_database*",
48
- "clean-w3c": "rimraf 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*",
49
- "clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
50
- "copy": "copyup node_modules/core-js-bundle/minified.js node_modules/source-map-support/browser-source-map-support.js node_modules/mocha/mocha.css node_modules/mocha/mocha.js node_modules/chai/chai.js node_modules/sinon/pkg/sinon-no-sourcemaps.js test-support",
51
- "lint": "eslint --ext=js,md,html .",
52
- "eslint": "npm run lint",
53
- "sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
54
- "w3c-build-only": "node test-support/node-buildjs",
55
- "w3c-build": "run-s clean-w3c w3c-build-only",
56
- "fake": "run-s clean-fake coverage:fake clean-fake",
57
- "mock": "run-s clean-mock coverage:mock clean-mock",
58
- "w3c-old": "run-s clean-w3cOld coverage:w3cOld clean-w3cOld",
59
- "tests-polyfill": "run-s clean-polyfill coverage:fake coverage:mock coverage:w3cOld",
60
- "mocha": "run-s clean-mocha coverage:mocha clean-mocha",
61
- "rollup": "rollup -c",
62
- "coverage:fake": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+fake --require source-map-support/register tests-polyfill/fakeIndexedDB/test-node.js",
63
- "coverage:mock": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+mock --require source-map-support/register tests-polyfill/indexedDBmock/test-node.js",
64
- "coverage:w3cOld": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+w3c --require source-map-support/register tests-polyfill/w3c/test-node.js",
65
- "coverage:w3c": "NODE_OPTIONS=--max_old_space_size=16384 c8 --silent --no-clean npm run w3c-test-only",
66
- "test:w3c": "NODE_OPTIONS=--max_old_space_size=16384 NODE_OPTIONS=--trace-warnings node test-support/node-idb-test.js",
67
- "w3c-test-only": "node --trace-warnings test-support/node-idb-test.js",
68
- "coverage:mocha": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+mocha --require source-map-support/register tests-mocha/test-node.js",
69
- "coverage-badge": "coveradge badges/coverage-badge",
70
- "coverage:report-only": "c8 report",
71
- "coverage:report": "run-s coverage:report-only",
72
- "remove-cache": "rimraf node_modules/.cache",
73
- "remove-cov": "rimraf .nyc_output ",
74
- "remove-results": "rimraf test-support/results/file*.json",
75
- "coverage:polyfill": "run-s coverage:fake coverage:mock coverage:w3cOld",
76
- "tests-badge": "mbg --fileGlob \"./test-support/results/file*.json\" --badge_output badges/tests-badge.svg",
77
- "coverage": "run-s -c clean remove-cache remove-cov remove-results coverage:fake coverage:mock coverage:mocha coverage:w3c clean tests-badge coverage-badge coverage:report",
78
- "open-coverage-only": "open http://127.0.0.1:9999/coverage/lcov-report/",
79
- "open-coverage": "run-p start open-coverage-only",
80
- "test": "run-s lint coverage",
81
- "submodules-init": "git submodule update --init --recursive",
82
- "submodules-fetch": "git submodule foreach --recursive git fetch",
83
- "submodules-merge": "git submodule foreach git merge origin master",
84
- "submodules": "run-s submodules-init submodules-fetch submodules-merge",
85
- "wpt": "run-p start web-platform-tests",
86
- "web-platform-tests": "cd web-platform-tests && ./wpt serve",
87
- "w3c-find-unused": "node test-support/find-unused.js",
88
- "w3c": "run-s w3c-build w3c-test",
89
- "w3c-add-wrap": "node test-support/wrap-w3c-tests",
90
- "w3c-remove-wrap": "node test-support/wrap-w3c-tests remove",
91
- "w3c-wrap": "node test-support/wrap-w3c-tests",
92
- "test-and-start:w3c": "run-p -r start web-platform-tests delayed-w3c-test",
93
- "delay": "delay 9",
94
- "delayed-w3c-test": "run-s delay test:w3c",
95
- "w3c-test": "run-s clean-w3c test-and-start:w3c",
96
- "w3c-good-only": "node test-support/node-idb-test.js good",
97
- "w3c-bad-only": "node test-support/node-idb-test.js bad",
98
- "w3c-good": "run-s w3c-build w3c-good-only clean-w3c",
99
- "w3c-bad": "run-s w3c-build w3c-bad-only clean-w3c",
100
- "w3c-good-test": "run-s w3c-good-only clean-w3c",
101
- "w3c-bad-test": "run-s w3c-bad-only clean-w3c"
102
- },
103
31
  "repository": {
104
32
  "type": "git",
105
33
  "url": "https://github.com/indexeddbshim/IndexedDBShim"
@@ -162,13 +90,12 @@
162
90
  "eventtargeter": "0.9.0",
163
91
  "sync-promise-expanded": "^1.0.0",
164
92
  "typeson": "9.0.3",
165
- "typeson-registry": "11.0.0",
93
+ "typeson-registry": "11.0.1",
166
94
  "websql-configurable": "^3.0.3"
167
95
  },
168
96
  "devDependencies": {
169
- "@brettz9/eslint-plugin": "^1.0.4",
170
- "@babel/core": "^7.24.9",
171
- "@babel/preset-env": "^7.24.8",
97
+ "@babel/core": "^7.25.2",
98
+ "@babel/preset-env": "^7.25.4",
172
99
  "@brettz9/node-static": "^0.1.1",
173
100
  "@es-joy/json-file-reporter": "^1.4.0",
174
101
  "@rollup/plugin-babel": "^6.0.4",
@@ -176,9 +103,9 @@
176
103
  "@rollup/plugin-json": "^6.1.0",
177
104
  "@rollup/plugin-node-resolve": "^15.2.3",
178
105
  "@rollup/plugin-terser": "^0.4.4",
179
- "@types/node": "^20.14.10",
106
+ "@types/node": "^22.5.4",
180
107
  "@types/websql": "^0.0.30",
181
- "@unicode/unicode-13.0.0": "1.5.2",
108
+ "@unicode/unicode-15.1.0": "^1.5.2",
182
109
  "babel-plugin-add-module-exports": "1.0.4",
183
110
  "bson": "^6.8.0",
184
111
  "builtin-modules": "^4.0.0",
@@ -187,48 +114,104 @@
187
114
  "chokidar-cli": "^3.0.0",
188
115
  "colors": "1.4.0",
189
116
  "copyfiles": "^2.4.1",
190
- "core-js-bundle": "^3.37.1",
117
+ "core-js-bundle": "^3.38.1",
191
118
  "coveradge": "^0.8.2",
192
119
  "cyclonejs": "1.1.4",
193
120
  "delay-cli": "^2.0.0",
194
- "eslint": "^8.57.0",
195
- "eslint-config-ash-nazg": "^35.4.0",
196
- "eslint-config-standard": "^17.1.0",
197
- "eslint-plugin-array-func": "^4.0.0",
198
- "eslint-plugin-compat": "^4.2.0",
199
- "eslint-plugin-eslint-comments": "^3.2.0",
200
- "eslint-plugin-html": "^7.1.0",
201
- "eslint-plugin-markdown": "^3.0.1",
202
- "eslint-plugin-n": "^16.6.2",
203
- "eslint-plugin-import": "^2.29.1",
204
- "eslint-plugin-jsdoc": "^48.7.0",
205
- "eslint-plugin-no-unsanitized": "^4.0.2",
206
- "eslint-plugin-no-use-extend-native": "^0.5.0",
207
- "eslint-plugin-sonarjs": "^0.23.0",
208
- "eslint-plugin-promise": "^6.4.0",
209
- "eslint-plugin-standard": "^4.1.0",
210
- "eslint-plugin-unicorn": "^51.0.1",
121
+ "eslint": "^9.9.1",
122
+ "eslint-config-ash-nazg": "^36.13.0",
211
123
  "got": "^13.0.0",
212
124
  "is-date-object": "1.0.5",
213
125
  "isomorphic-fetch": "^3.0.0",
214
- "jsdom": "^24.1.0",
126
+ "jsdom": "^25.0.0",
215
127
  "license-badger": "^0.21.1",
216
128
  "local-xmlhttprequest": "2.0.0",
217
- "mocha": "^10.6.0",
129
+ "mocha": "^10.7.3",
218
130
  "mocha-badge-generator": "^0.11.0",
219
131
  "mocha-multi-reporters": "^1.5.1",
220
132
  "npm-run-all": "^4.1.5",
221
133
  "open-cli": "^8.0.0",
222
134
  "rimraf": "^5.0.8",
223
- "rollup": "^4.18.1",
135
+ "rollup": "^4.21.2",
224
136
  "rollup-plugin-filesize": "^10.0.0",
225
137
  "rollup-plugin-node-globals": "^1.4.0",
226
138
  "rollup-plugin-node-polyfills": "^0.2.1",
227
139
  "sinon": "^18.0.0",
228
140
  "source-map-support": "0.5.21",
229
141
  "sourcemap-transformer": "git+https://github.com/brettz9/sourcemap-transformer.git",
230
- "typescript": "^5.5.3",
142
+ "typescript": "^5.5.4",
231
143
  "w3c-blob": "0.0.1",
232
144
  "ws": "^8.18.0"
145
+ },
146
+ "scripts": {
147
+ "tsc": "tsc",
148
+ "tsc-prod": "tsc -p tsconfig-prod.json",
149
+ "build": "npm run rollup && npm run tsc-prod",
150
+ "license-badge": "license-badger --corrections --uncategorizedLicenseTemplate \"\\${license} (\\${name} (\\${version}))\" --filteredTypes=nonempty --textTemplate \"License types\n(project, deps, and bundled devDeps)\" --packageJson --production badges/licenses-badge.svg",
151
+ "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg",
152
+ "license-badges": "run-p license-badge license-badge-dev",
153
+ "start": "static -p 9999 -H '{\"Access-Control-Allow-Origin\": \"http://web-platform.test:8000\", \"Access-Control-Allow-Methods\": \"GET\", \"Access-Control-Allow-Headers\": \"Content-Type\"}'",
154
+ "watch": "chokidar \"src/*\" \"node_modules/eventtarget/EventTarget.js\" \"node_modules/websql/lib/websql/WebSQLTransaction.js\" \"node_modules/websql/lib/websql/WebSQLDatabase.js\" -c \"npm run rollup\"",
155
+ "dev": "run-p start watch",
156
+ "clean": "run-p clean-sysDB clean-mocha clean-fake clean-mock clean-w3c clean-w3cOld",
157
+ "clean-sysDB": "rimraf __sysdb__*",
158
+ "clean-polyfill": "run-p clean-fake clean-mock clean-w3cOld clean-sysDB",
159
+ "clean-mocha": "rimraf D_indexeddbshim_test_database_* D_test.sqlite",
160
+ "clean-fake": "rimraf D_test0.*",
161
+ "clean-mock": "rimraf D_test_database*",
162
+ "clean-w3c": "rimraf 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*",
163
+ "clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
164
+ "copy": "copyup node_modules/core-js-bundle/minified.js node_modules/source-map-support/browser-source-map-support.js node_modules/mocha/mocha.css node_modules/mocha/mocha.js node_modules/chai/chai.js node_modules/sinon/pkg/sinon-no-sourcemaps.js test-support",
165
+ "lint": "eslint .",
166
+ "eslint": "npm run lint",
167
+ "sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
168
+ "w3c-build-only": "node test-support/node-buildjs",
169
+ "w3c-build": "run-s clean-w3c w3c-build-only",
170
+ "fake": "run-s clean-fake coverage:fake clean-fake",
171
+ "mock": "run-s clean-mock coverage:mock clean-mock",
172
+ "w3c-old": "run-s clean-w3cOld coverage:w3cOld clean-w3cOld",
173
+ "tests-polyfill": "run-s clean-polyfill coverage:fake coverage:mock coverage:w3cOld",
174
+ "mocha": "run-s clean-mocha coverage:mocha clean-mocha",
175
+ "rollup": "rollup -c",
176
+ "coverage:fake": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+fake --require source-map-support/register tests-polyfill/fakeIndexedDB/test-node.js",
177
+ "coverage:mock": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+mock --require source-map-support/register tests-polyfill/indexedDBmock/test-node.js",
178
+ "coverage:w3cOld": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+w3c --require source-map-support/register tests-polyfill/w3c/test-node.js",
179
+ "coverage:w3c": "NODE_OPTIONS=--max_old_space_size=16384 c8 --silent --no-clean npm run w3c-test-only",
180
+ "test:w3c": "NODE_OPTIONS=--max_old_space_size=16384 NODE_OPTIONS=--trace-warnings node test-support/node-idb-test.js",
181
+ "w3c-test-only": "node --trace-warnings test-support/node-idb-test.js",
182
+ "coverage:mocha": "c8 --silent --no-clean mocha --reporterOptions configFile=mocha-multi-reporters.json,cmrOutput=@es-joy/json-file-reporter+output+mocha --require source-map-support/register tests-mocha/test-node.js",
183
+ "coverage-badge": "coveradge badges/coverage-badge",
184
+ "coverage:report-only": "c8 report",
185
+ "coverage:report": "run-s coverage:report-only",
186
+ "remove-cache": "rimraf node_modules/.cache",
187
+ "remove-cov": "rimraf .nyc_output ",
188
+ "remove-results": "rimraf test-support/results/file*.json",
189
+ "coverage:polyfill": "run-s coverage:fake coverage:mock coverage:w3cOld",
190
+ "tests-badge": "mbg --fileGlob \"./test-support/results/file*.json\" --badge_output badges/tests-badge.svg",
191
+ "coverage": "run-s -c clean remove-cache remove-cov remove-results coverage:fake coverage:mock coverage:mocha coverage:w3c clean tests-badge coverage-badge coverage:report",
192
+ "open-coverage-only": "open http://127.0.0.1:9999/coverage/lcov-report/",
193
+ "open-coverage": "run-p start open-coverage-only",
194
+ "test": "run-s lint coverage",
195
+ "submodules-init": "git submodule update --init --recursive",
196
+ "submodules-fetch": "git submodule foreach --recursive git fetch",
197
+ "submodules-merge": "git submodule foreach git merge origin master",
198
+ "submodules": "run-s submodules-init submodules-fetch submodules-merge",
199
+ "wpt": "run-p start web-platform-tests",
200
+ "web-platform-tests": "cd web-platform-tests && ./wpt serve",
201
+ "w3c-find-unused": "node test-support/find-unused.js",
202
+ "w3c": "run-s w3c-build w3c-test",
203
+ "w3c-add-wrap": "node test-support/wrap-w3c-tests",
204
+ "w3c-remove-wrap": "node test-support/wrap-w3c-tests remove",
205
+ "w3c-wrap": "node test-support/wrap-w3c-tests",
206
+ "test-and-start:w3c": "run-p -r start web-platform-tests delayed-w3c-test",
207
+ "delay": "delay 9",
208
+ "delayed-w3c-test": "run-s delay test:w3c",
209
+ "w3c-test": "run-s clean-w3c test-and-start:w3c",
210
+ "w3c-good-only": "node test-support/node-idb-test.js good",
211
+ "w3c-bad-only": "node test-support/node-idb-test.js bad",
212
+ "w3c-good": "run-s w3c-build w3c-good-only clean-w3c",
213
+ "w3c-bad": "run-s w3c-build w3c-bad-only clean-w3c",
214
+ "w3c-good-test": "run-s w3c-good-only clean-w3c",
215
+ "w3c-bad-test": "run-s w3c-bad-only clean-w3c"
233
216
  }
234
- }
217
+ }
@@ -122,7 +122,7 @@ function createNonNativeDOMExceptionClass () {
122
122
  : (legacyCodes[/** @type {LegacyCode} */ (name)] || 0);
123
123
  this._name = name || 'Error';
124
124
  // We avoid `String()` in this next line as it converts Symbols
125
- this._message = message === undefined ? '' : ('' + message); // eslint-disable-line no-implicit-coercion
125
+ this._message = message === undefined ? '' : ('' + message); // eslint-disable-line no-implicit-coercion -- Don't convert symbols
126
126
  Object.defineProperty(this, 'code', {
127
127
  configurable: true,
128
128
  enumerable: true,
@@ -150,12 +150,12 @@ function createNonNativeDOMExceptionClass () {
150
150
  // Necessary for W3C tests which complains if `DOMException` has properties on its "own" prototype
151
151
 
152
152
  // class DummyDOMException extends Error {}; // Sometimes causing problems in Node
153
- /* eslint-disable func-name-matching */
153
+ /* eslint-disable func-name-matching -- See above */
154
154
  /**
155
155
  * @class
156
156
  */
157
157
  const DummyDOMException = function DOMException () { /* */ };
158
- /* eslint-enable func-name-matching */
158
+ /* eslint-enable func-name-matching -- See above */
159
159
  DummyDOMException.prototype = Object.create(Error.prototype); // Intended for subclassing
160
160
  /** @type {const} */ (['name', 'message']).forEach((prop) => {
161
161
  Object.defineProperty(DummyDOMException.prototype, prop, {
@@ -361,7 +361,8 @@ try {
361
361
  // Native DOMException works as expected
362
362
  useNativeDOMException = true;
363
363
  }
364
- } catch (e) {}
364
+ // eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
365
+ } catch (err) {}
365
366
 
366
367
  const createDOMException = useNativeDOMException
367
368
  // eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
@@ -28,7 +28,8 @@ if (Object.defineProperty) {
28
28
  if (testObject.test) {
29
29
  cleanInterface = true;
30
30
  }
31
- } catch (e) {
31
+ // eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
32
+ } catch (err) {
32
33
  // Object.defineProperty does not work as intended.
33
34
  }
34
35
  }
@@ -113,7 +114,7 @@ DOMStringList.prototype = {
113
114
  * @returns {void}
114
115
  */
115
116
  forEach (cb, thisArg) {
116
- // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
117
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
117
118
  this._items.forEach(cb, thisArg);
118
119
  },
119
120
  /**
@@ -122,7 +123,7 @@ DOMStringList.prototype = {
122
123
  * @returns {any[]}
123
124
  */
124
125
  map (cb, thisArg) {
125
- // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
126
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
126
127
  return this._items.map(cb, thisArg);
127
128
  },
128
129
  /**
package/src/IDBCursor.js CHANGED
@@ -7,7 +7,7 @@ import * as util from './util.js';
7
7
  import IDBTransaction from './IDBTransaction.js';
8
8
  import * as Key from './Key.js';
9
9
  import * as Sca from './Sca.js';
10
- import IDBIndex from './IDBIndex.js'; // eslint-disable-line import/no-named-as-default
10
+ import IDBIndex from './IDBIndex.js';
11
11
  import CFG from './CFG.js';
12
12
 
13
13
  /**
@@ -64,7 +64,7 @@ function IDBCursor () {
64
64
  }
65
65
  const IDBCursorAlias = IDBCursor;
66
66
 
67
- /* eslint-disable func-name-matching */
67
+ /* eslint-disable func-name-matching -- API */
68
68
  /**
69
69
  * The IndexedDB Cursor Object.
70
70
  * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursor
@@ -80,7 +80,7 @@ const IDBCursorAlias = IDBCursor;
80
80
  * @returns {void}
81
81
  */
82
82
  IDBCursor.__super = function IDBCursor (query, direction, store, source, keyColumnName, valueColumnName, count) {
83
- /* eslint-enable func-name-matching */
83
+ /* eslint-enable func-name-matching -- API */
84
84
  // @ts-expect-error Should be ok
85
85
  this[Symbol.toStringTag] = 'IDBCursor';
86
86
  util.defineReadonlyProperties(this, ['key', 'primaryKey', 'request']);
@@ -655,7 +655,7 @@ IDBCursor.prototype.__continueFinish = function (key, primaryKey, advanceState)
655
655
  * @returns {void}
656
656
  */
657
657
  IDBCursor.prototype.continue = function (/* key */) {
658
- // eslint-disable-next-line prefer-rest-params
658
+ // eslint-disable-next-line prefer-rest-params -- API
659
659
  this.__continue(arguments[0]);
660
660
  };
661
661
 
@@ -29,6 +29,8 @@ const readonlyProperties = ['name', 'version', 'objectStoreNames'];
29
29
  function IDBDatabase () {
30
30
  this.__versionTransaction = null;
31
31
  this.__objectStores = null;
32
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
33
+ this.__transactions = [];
32
34
  throw new TypeError('Illegal constructor');
33
35
  }
34
36
  const IDBDatabaseAlias = IDBDatabase;
@@ -92,6 +94,7 @@ IDBDatabase.__createInstance = function (db, name, oldVersion, version, storePro
92
94
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
93
95
  });
94
96
 
97
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
95
98
  this.__transactions = [];
96
99
 
97
100
  /** @type {{[key: string]: IDBObjectStore}} */
@@ -142,7 +145,7 @@ IDBDatabase.prototype[Symbol.toStringTag] = 'IDBDatabasePrototype';
142
145
  * @returns {IDBObjectStore}
143
146
  */
144
147
  IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions */) {
145
- // eslint-disable-next-line prefer-rest-params
148
+ // eslint-disable-next-line prefer-rest-params -- API
146
149
  let createOptions = arguments[1];
147
150
  storeName = String(storeName); // W3C test within IDBObjectStore.js seems to accept string conversion
148
151
  if (!(this instanceof IDBDatabase)) {
@@ -222,6 +225,7 @@ IDBDatabase.prototype.close = function () {
222
225
  if (this.__unblocking) {
223
226
  this.__unblocking.check();
224
227
  }
228
+ this.__transactions = [];
225
229
  };
226
230
 
227
231
  /**
@@ -234,7 +238,7 @@ IDBDatabase.prototype.transaction = function (storeNames /* , mode */) {
234
238
  if (arguments.length === 0) {
235
239
  throw new TypeError('You must supply a valid `storeNames` to `IDBDatabase.transaction`');
236
240
  }
237
- // eslint-disable-next-line prefer-rest-params
241
+ // eslint-disable-next-line prefer-rest-params -- API
238
242
  let mode = arguments[1];
239
243
  storeNames = util.isIterable(storeNames)
240
244
  // Creating new array also ensures sequence is passed by value: https://heycam.github.io/webidl/#idl-sequence
@@ -325,6 +329,7 @@ IDBDatabase.prototype.__forceClose = function (msg) {
325
329
  'The connection was force-closed: ' + (msg || '')
326
330
  ));
327
331
  });
332
+ me.__transactions = [];
328
333
  };
329
334
 
330
335
  util.defineOuterInterface(IDBDatabase.prototype, listeners);
package/src/IDBFactory.js CHANGED
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line no-restricted-imports -- Can be polyfilled
1
2
  import path from 'path';
2
3
  import SyncPromise from 'sync-promise-expanded';
3
4
 
@@ -36,6 +37,7 @@ const setFS = (_fs) => {
36
37
  * @returns {string}
37
38
  */
38
39
  const getOrigin = () => {
40
+ // eslint-disable-next-line no-undef -- If browser/polyfilled
39
41
  return (typeof location !== 'object' || !location) ? 'null' : location.origin;
40
42
  };
41
43
  const hasNullOrigin = () => CFG.checkOrigin !== false && (getOrigin() === 'null');
@@ -80,7 +82,7 @@ function processNextInConnectionQueue (name, origin = getOrigin()) {
80
82
  cb(req);
81
83
  }
82
84
 
83
- /* eslint-disable default-param-last */
85
+ /* eslint-disable default-param-last -- Keep cb at end */
84
86
  /**
85
87
  * @param {import('./IDBRequest.js').IDBOpenDBRequestFull} req
86
88
  * @param {string} name
@@ -89,7 +91,7 @@ function processNextInConnectionQueue (name, origin = getOrigin()) {
89
91
  * @returns {void}
90
92
  */
91
93
  function addRequestToConnectionQueue (req, name, origin = getOrigin(), cb) {
92
- /* eslint-enable default-param-last */
94
+ /* eslint-enable default-param-last -- Keep cb at end */
93
95
  if (!connectionQueue[origin][name]) {
94
96
  connectionQueue[origin][name] = [];
95
97
  }
@@ -415,7 +417,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
415
417
  if (!(me instanceof IDBFactory)) {
416
418
  throw new TypeError('Illegal invocation');
417
419
  }
418
- // eslint-disable-next-line prefer-rest-params
420
+ // eslint-disable-next-line prefer-rest-params -- API
419
421
  let version = arguments[1];
420
422
 
421
423
  if (arguments.length === 0) {
@@ -445,10 +447,10 @@ IDBFactory.prototype.open = function (name /* , version */) {
445
447
 
446
448
  /** @type {string} */
447
449
  let escapedDatabaseName;
448
- // eslint-disable-next-line no-useless-catch
450
+ // eslint-disable-next-line no-useless-catch -- Possible refactoring
449
451
  try {
450
452
  escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);
451
- // eslint-disable-next-line sonarjs/no-useless-catch
453
+ // eslint-disable-next-line sonarjs/no-useless-catch -- Possible refactoring
452
454
  } catch (err) {
453
455
  throw err; // new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
454
456
  }
@@ -511,7 +513,8 @@ IDBFactory.prototype.open = function (name /* , version */) {
511
513
  if (err) {
512
514
  try {
513
515
  systx.executeSql('ROLLBACK', [], cb, cb);
514
- } catch (er) {
516
+ // eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
517
+ } catch (err) {
515
518
  // Browser may fail with expired transaction above so
516
519
  // no choice but to manually revert
517
520
  sysdb.transaction(function (systx) {
@@ -532,7 +535,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
532
535
  [sqlSafeName],
533
536
  function () {
534
537
  // @ts-expect-error Force to work
535
- cb(reportError); // eslint-disable-line promise/no-callback-in-promise
538
+ cb(reportError); // eslint-disable-line promise/no-callback-in-promise -- Convenient
536
539
  },
537
540
  // @ts-expect-error Force to work
538
541
  reportError
@@ -553,7 +556,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
553
556
  return;
554
557
  }
555
558
  // In browser, should auto-commit
556
- cb(); // eslint-disable-line promise/no-callback-in-promise
559
+ cb(); // eslint-disable-line promise/no-callback-in-promise -- Convenient
557
560
  };
558
561
 
559
562
  sysdb.transaction(function (systx) {
@@ -635,6 +638,11 @@ IDBFactory.prototype.open = function (name /* , version */) {
635
638
 
636
639
  // eslint-disable-next-line camelcase -- Clear API
637
640
  req.transaction.on__complete = function () {
641
+ const pos = connection.__transactions.indexOf(req.transaction);
642
+ if (pos > -1) {
643
+ connection.__transactions.splice(pos, 1);
644
+ }
645
+
638
646
  if (/** @type {import('./IDBDatabase.js').IDBDatabaseFull} */ (
639
647
  req.__result
640
648
  ).__closePending) {
@@ -805,10 +813,10 @@ IDBFactory.prototype.deleteDatabase = function (name) {
805
813
 
806
814
  /** @type {string} */
807
815
  let escapedDatabaseName;
808
- // eslint-disable-next-line no-useless-catch
816
+ // eslint-disable-next-line no-useless-catch -- Possible refactoring
809
817
  try {
810
818
  escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);
811
- // eslint-disable-next-line sonarjs/no-useless-catch
819
+ // eslint-disable-next-line sonarjs/no-useless-catch -- Possible refactoring
812
820
  } catch (err) {
813
821
  throw err; // throw new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
814
822
  }
@@ -893,7 +901,7 @@ IDBFactory.prototype.deleteDatabase = function (name) {
893
901
  ({version} = data.rows.item(0));
894
902
 
895
903
  const openConnections = me.__connections[name] || [];
896
- triggerAnyVersionChangeAndBlockedEvents(openConnections, req, version, null).then(function () { // eslint-disable-line promise/catch-or-return
904
+ triggerAnyVersionChangeAndBlockedEvents(openConnections, req, version, null).then(function () { // eslint-disable-line promise/catch-or-return -- Sync promise
897
905
  // Since we need two databases which can't be in a single transaction, we
898
906
  // do this deleting from `dbVersions` first since the `__sys__` deleting
899
907
  // only impacts file memory whereas this one is critical for avoiding it
@@ -965,7 +973,7 @@ IDBFactory.prototype.cmp = function (key1, key2) {
965
973
  IDBFactory.prototype.databases = function () {
966
974
  const me = this;
967
975
  let calledDbCreateError = false;
968
- return new Promise(function (resolve, reject) { // eslint-disable-line promise/avoid-new
976
+ return new Promise(function (resolve, reject) { // eslint-disable-line promise/avoid-new -- Own polyfill
969
977
  if (!(me instanceof IDBFactory)) {
970
978
  throw new TypeError('Illegal invocation');
971
979
  }
@@ -1028,9 +1036,10 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
1028
1036
  conn.__forceClose(msg);
1029
1037
  }
1030
1038
  if (util.isNullish(dbName)) {
1031
- (Object.values(me.__connections)).forEach((conn) => {
1032
- // @ts-expect-error It's ok
1033
- forceClose(conn);
1039
+ (Object.values(me.__connections)).forEach((connections) => {
1040
+ connections.forEach((connection) => {
1041
+ forceClose(connection);
1042
+ });
1034
1043
  });
1035
1044
  } else if (!me.__connections[dbName]) {
1036
1045
  console.log('No database connections with that name to force close');
@@ -1041,7 +1050,7 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
1041
1050
  } else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
1042
1051
  throw new TypeError(
1043
1052
  'If providing an argument, __forceClose must be called with a ' +
1044
- 'numeric index to indicate a specific connection to lose'
1053
+ 'numeric index to indicate a specific connection to close'
1045
1054
  );
1046
1055
  } else {
1047
1056
  forceClose(me.__connections[dbName][connIdx]);
package/src/IDBIndex.js CHANGED
@@ -308,7 +308,8 @@ IDBIndex.__createIndex = function (store, index) {
308
308
  },
309
309
  /** @type {SQLStatementErrorCallback} */ (error)
310
310
  );
311
- } catch (e) {
311
+ // eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
312
+ } catch (err) {
312
313
  // Not a valid value to insert into index, so just continue
313
314
  addIndexEntry(i + 1);
314
315
  }
@@ -521,7 +522,7 @@ IDBIndex.prototype.__fetchIndexData = function (range, opType, nullDisallowed, c
521
522
  */
522
523
  IDBIndex.prototype.openCursor = function (/* query, direction */) {
523
524
  const me = this;
524
- // eslint-disable-next-line prefer-rest-params
525
+ // eslint-disable-next-line prefer-rest-params -- API
525
526
  const [query, direction] = arguments;
526
527
  const cursor = IDBCursorWithValue.__createInstance(query, direction, me.objectStore, me, util.escapeIndexNameForSQLKeyColumn(me.name), 'value');
527
528
  me.__objectStore.__cursors.push(cursor);
@@ -535,7 +536,7 @@ IDBIndex.prototype.openCursor = function (/* query, direction */) {
535
536
  */
536
537
  IDBIndex.prototype.openKeyCursor = function (/* query, direction */) {
537
538
  const me = this;
538
- // eslint-disable-next-line prefer-rest-params
539
+ // eslint-disable-next-line prefer-rest-params -- API
539
540
  const [query, direction] = arguments;
540
541
  const cursor = IDBCursor.__createInstance(query, direction, me.objectStore, me, util.escapeIndexNameForSQLKeyColumn(me.name), 'key');
541
542
  me.__objectStore.__cursors.push(cursor);
@@ -575,7 +576,7 @@ IDBIndex.prototype.getKey = function (query) {
575
576
  * @returns {import('./IDBRequest.js').IDBRequestFull}
576
577
  */
577
578
  IDBIndex.prototype.getAll = function (/* query, count */) {
578
- // eslint-disable-next-line prefer-rest-params
579
+ // eslint-disable-next-line prefer-rest-params -- API
579
580
  const [query, count] = arguments;
580
581
  return this.__fetchIndexData(query, 'value', false, count);
581
582
  };
@@ -585,7 +586,7 @@ IDBIndex.prototype.getAll = function (/* query, count */) {
585
586
  * @returns {import('./IDBRequest.js').IDBRequestFull}
586
587
  */
587
588
  IDBIndex.prototype.getAllKeys = function (/* query, count */) {
588
- // eslint-disable-next-line prefer-rest-params
589
+ // eslint-disable-next-line prefer-rest-params -- API
589
590
  const [query, count] = arguments;
590
591
  return this.__fetchIndexData(query, 'key', false, count);
591
592
  };
@@ -596,7 +597,7 @@ IDBIndex.prototype.getAllKeys = function (/* query, count */) {
596
597
  */
597
598
  IDBIndex.prototype.count = function (/* query */) {
598
599
  const me = this;
599
- // eslint-disable-next-line prefer-rest-params
600
+ // eslint-disable-next-line prefer-rest-params -- API
600
601
  const query = arguments[0];
601
602
  // With the exception of needing to check whether the index has been
602
603
  // deleted, we could, for greater spec parity (if not accuracy),
@@ -106,7 +106,7 @@ IDBKeyRange.lowerBound = function (value /* , open */) {
106
106
  if (!arguments.length) {
107
107
  throw new TypeError('IDBKeyRange.lowerBound requires a value argument');
108
108
  }
109
- // eslint-disable-next-line prefer-rest-params
109
+ // eslint-disable-next-line prefer-rest-params -- API
110
110
  return IDBKeyRange.__createInstance(value, undefined, arguments[1], true);
111
111
  };
112
112
 
@@ -118,7 +118,7 @@ IDBKeyRange.upperBound = function (value /* , open */) {
118
118
  if (!arguments.length) {
119
119
  throw new TypeError('IDBKeyRange.upperBound requires a value argument');
120
120
  }
121
- // eslint-disable-next-line prefer-rest-params
121
+ // eslint-disable-next-line prefer-rest-params -- API
122
122
  return IDBKeyRange.__createInstance(undefined, value, true, arguments[1]);
123
123
  };
124
124
 
@@ -131,7 +131,7 @@ IDBKeyRange.bound = function (lower, upper /* , lowerOpen, upperOpen */) {
131
131
  if (arguments.length <= 1) {
132
132
  throw new TypeError('IDBKeyRange.bound requires lower and upper arguments');
133
133
  }
134
- // eslint-disable-next-line prefer-rest-params
134
+ // eslint-disable-next-line prefer-rest-params -- API
135
135
  return IDBKeyRange.__createInstance(lower, upper, arguments[2], arguments[3]);
136
136
  };
137
137
  IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';