indexeddbshim 15.0.1 → 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.
- package/README.md +1 -1
- package/dist/indexeddbshim-Key.js +15 -14
- 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 +117 -107
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +139 -121
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +115 -105
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +133 -115
- 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 +119 -109
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/package.json +13 -29
- package/src/DOMException.js +5 -4
- package/src/DOMStringList.js +4 -3
- package/src/IDBCursor.js +4 -4
- package/src/IDBDatabase.js +2 -2
- package/src/IDBFactory.js +15 -12
- package/src/IDBIndex.js +7 -6
- package/src/IDBKeyRange.js +3 -3
- package/src/IDBObjectStore.js +10 -9
- package/src/IDBTransaction.js +5 -5
- package/src/IDBVersionChangeEvent.js +1 -1
- package/src/Key.js +1 -1
- package/src/Sca.js +0 -1
- package/src/UnicodeIdentifiers.js +2 -2
- package/src/setGlobalVars.js +5 -2
- package/src/util.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "indexeddbshim",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Parashuram <code@nparashuram.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -90,13 +90,12 @@
|
|
|
90
90
|
"eventtargeter": "0.9.0",
|
|
91
91
|
"sync-promise-expanded": "^1.0.0",
|
|
92
92
|
"typeson": "9.0.3",
|
|
93
|
-
"typeson-registry": "11.0.
|
|
93
|
+
"typeson-registry": "11.0.1",
|
|
94
94
|
"websql-configurable": "^3.0.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@
|
|
98
|
-
"@babel/
|
|
99
|
-
"@babel/preset-env": "^7.24.8",
|
|
97
|
+
"@babel/core": "^7.25.2",
|
|
98
|
+
"@babel/preset-env": "^7.25.4",
|
|
100
99
|
"@brettz9/node-static": "^0.1.1",
|
|
101
100
|
"@es-joy/json-file-reporter": "^1.4.0",
|
|
102
101
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -104,9 +103,9 @@
|
|
|
104
103
|
"@rollup/plugin-json": "^6.1.0",
|
|
105
104
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
106
105
|
"@rollup/plugin-terser": "^0.4.4",
|
|
107
|
-
"@types/node": "^
|
|
106
|
+
"@types/node": "^22.5.4",
|
|
108
107
|
"@types/websql": "^0.0.30",
|
|
109
|
-
"@unicode/unicode-
|
|
108
|
+
"@unicode/unicode-15.1.0": "^1.5.2",
|
|
110
109
|
"babel-plugin-add-module-exports": "1.0.4",
|
|
111
110
|
"bson": "^6.8.0",
|
|
112
111
|
"builtin-modules": "^4.0.0",
|
|
@@ -115,40 +114,25 @@
|
|
|
115
114
|
"chokidar-cli": "^3.0.0",
|
|
116
115
|
"colors": "1.4.0",
|
|
117
116
|
"copyfiles": "^2.4.1",
|
|
118
|
-
"core-js-bundle": "^3.
|
|
117
|
+
"core-js-bundle": "^3.38.1",
|
|
119
118
|
"coveradge": "^0.8.2",
|
|
120
119
|
"cyclonejs": "1.1.4",
|
|
121
120
|
"delay-cli": "^2.0.0",
|
|
122
|
-
"eslint": "^
|
|
123
|
-
"eslint-config-ash-nazg": "^
|
|
124
|
-
"eslint-config-standard": "^17.1.0",
|
|
125
|
-
"eslint-plugin-array-func": "^4.0.0",
|
|
126
|
-
"eslint-plugin-compat": "^4.2.0",
|
|
127
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
128
|
-
"eslint-plugin-html": "^7.1.0",
|
|
129
|
-
"eslint-plugin-markdown": "^3.0.1",
|
|
130
|
-
"eslint-plugin-n": "^16.6.2",
|
|
131
|
-
"eslint-plugin-import": "^2.29.1",
|
|
132
|
-
"eslint-plugin-jsdoc": "^48.7.0",
|
|
133
|
-
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
134
|
-
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
|
135
|
-
"eslint-plugin-sonarjs": "^0.23.0",
|
|
136
|
-
"eslint-plugin-promise": "^6.4.0",
|
|
137
|
-
"eslint-plugin-standard": "^4.1.0",
|
|
138
|
-
"eslint-plugin-unicorn": "^51.0.1",
|
|
121
|
+
"eslint": "^9.9.1",
|
|
122
|
+
"eslint-config-ash-nazg": "^36.13.0",
|
|
139
123
|
"got": "^13.0.0",
|
|
140
124
|
"is-date-object": "1.0.5",
|
|
141
125
|
"isomorphic-fetch": "^3.0.0",
|
|
142
|
-
"jsdom": "^
|
|
126
|
+
"jsdom": "^25.0.0",
|
|
143
127
|
"license-badger": "^0.21.1",
|
|
144
128
|
"local-xmlhttprequest": "2.0.0",
|
|
145
|
-
"mocha": "^10.
|
|
129
|
+
"mocha": "^10.7.3",
|
|
146
130
|
"mocha-badge-generator": "^0.11.0",
|
|
147
131
|
"mocha-multi-reporters": "^1.5.1",
|
|
148
132
|
"npm-run-all": "^4.1.5",
|
|
149
133
|
"open-cli": "^8.0.0",
|
|
150
134
|
"rimraf": "^5.0.8",
|
|
151
|
-
"rollup": "^4.
|
|
135
|
+
"rollup": "^4.21.2",
|
|
152
136
|
"rollup-plugin-filesize": "^10.0.0",
|
|
153
137
|
"rollup-plugin-node-globals": "^1.4.0",
|
|
154
138
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
@@ -178,7 +162,7 @@
|
|
|
178
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*",
|
|
179
163
|
"clean-w3cOld": "rimraf D_db.sqlite* D_test* D_database_name* D_idbtransaction*",
|
|
180
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",
|
|
181
|
-
"lint": "eslint
|
|
165
|
+
"lint": "eslint .",
|
|
182
166
|
"eslint": "npm run lint",
|
|
183
167
|
"sqlite-rebuild": "cd node_modules/sqlite3 && npm i",
|
|
184
168
|
"w3c-build-only": "node test-support/node-buildjs",
|
package/src/DOMException.js
CHANGED
|
@@ -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
|
-
|
|
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
|
package/src/DOMStringList.js
CHANGED
|
@@ -28,7 +28,8 @@ if (Object.defineProperty) {
|
|
|
28
28
|
if (testObject.test) {
|
|
29
29
|
cleanInterface = true;
|
|
30
30
|
}
|
|
31
|
-
|
|
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';
|
|
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
|
|
package/src/IDBDatabase.js
CHANGED
|
@@ -145,7 +145,7 @@ IDBDatabase.prototype[Symbol.toStringTag] = 'IDBDatabasePrototype';
|
|
|
145
145
|
* @returns {IDBObjectStore}
|
|
146
146
|
*/
|
|
147
147
|
IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions */) {
|
|
148
|
-
// eslint-disable-next-line prefer-rest-params
|
|
148
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
149
149
|
let createOptions = arguments[1];
|
|
150
150
|
storeName = String(storeName); // W3C test within IDBObjectStore.js seems to accept string conversion
|
|
151
151
|
if (!(this instanceof IDBDatabase)) {
|
|
@@ -238,7 +238,7 @@ IDBDatabase.prototype.transaction = function (storeNames /* , mode */) {
|
|
|
238
238
|
if (arguments.length === 0) {
|
|
239
239
|
throw new TypeError('You must supply a valid `storeNames` to `IDBDatabase.transaction`');
|
|
240
240
|
}
|
|
241
|
-
// eslint-disable-next-line prefer-rest-params
|
|
241
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
242
242
|
let mode = arguments[1];
|
|
243
243
|
storeNames = util.isIterable(storeNames)
|
|
244
244
|
// Creating new array also ensures sequence is passed by value: https://heycam.github.io/webidl/#idl-sequence
|
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
|
-
|
|
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) {
|
|
@@ -810,10 +813,10 @@ IDBFactory.prototype.deleteDatabase = function (name) {
|
|
|
810
813
|
|
|
811
814
|
/** @type {string} */
|
|
812
815
|
let escapedDatabaseName;
|
|
813
|
-
// eslint-disable-next-line no-useless-catch
|
|
816
|
+
// eslint-disable-next-line no-useless-catch -- Possible refactoring
|
|
814
817
|
try {
|
|
815
818
|
escapedDatabaseName = util.escapeDatabaseNameForSQLAndFiles(name);
|
|
816
|
-
// eslint-disable-next-line sonarjs/no-useless-catch
|
|
819
|
+
// eslint-disable-next-line sonarjs/no-useless-catch -- Possible refactoring
|
|
817
820
|
} catch (err) {
|
|
818
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.');
|
|
819
822
|
}
|
|
@@ -898,7 +901,7 @@ IDBFactory.prototype.deleteDatabase = function (name) {
|
|
|
898
901
|
({version} = data.rows.item(0));
|
|
899
902
|
|
|
900
903
|
const openConnections = me.__connections[name] || [];
|
|
901
|
-
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
|
|
902
905
|
// Since we need two databases which can't be in a single transaction, we
|
|
903
906
|
// do this deleting from `dbVersions` first since the `__sys__` deleting
|
|
904
907
|
// only impacts file memory whereas this one is critical for avoiding it
|
|
@@ -970,7 +973,7 @@ IDBFactory.prototype.cmp = function (key1, key2) {
|
|
|
970
973
|
IDBFactory.prototype.databases = function () {
|
|
971
974
|
const me = this;
|
|
972
975
|
let calledDbCreateError = false;
|
|
973
|
-
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
|
|
974
977
|
if (!(me instanceof IDBFactory)) {
|
|
975
978
|
throw new TypeError('Illegal invocation');
|
|
976
979
|
}
|
package/src/IDBIndex.js
CHANGED
|
@@ -308,7 +308,8 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
308
308
|
},
|
|
309
309
|
/** @type {SQLStatementErrorCallback} */ (error)
|
|
310
310
|
);
|
|
311
|
-
|
|
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),
|
package/src/IDBKeyRange.js
CHANGED
|
@@ -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';
|
package/src/IDBObjectStore.js
CHANGED
|
@@ -535,6 +535,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
|
|
|
535
535
|
) {
|
|
536
536
|
throw new Error('Go to catch');
|
|
537
537
|
}
|
|
538
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
538
539
|
} catch (err) {
|
|
539
540
|
resolve(undefined);
|
|
540
541
|
return;
|
|
@@ -638,7 +639,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
|
|
|
638
639
|
*/
|
|
639
640
|
IDBObjectStore.prototype.add = function (value /* , key */) {
|
|
640
641
|
const me = this;
|
|
641
|
-
// eslint-disable-next-line prefer-rest-params
|
|
642
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
642
643
|
const key = arguments[1];
|
|
643
644
|
if (!(me instanceof IDBObjectStore)) {
|
|
644
645
|
throw new TypeError('Illegal invocation');
|
|
@@ -669,7 +670,7 @@ IDBObjectStore.prototype.add = function (value /* , key */) {
|
|
|
669
670
|
*/
|
|
670
671
|
IDBObjectStore.prototype.put = function (value /* , key */) {
|
|
671
672
|
const me = this;
|
|
672
|
-
// eslint-disable-next-line prefer-rest-params
|
|
673
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
673
674
|
const key = arguments[1];
|
|
674
675
|
if (!(me instanceof IDBObjectStore)) {
|
|
675
676
|
throw new TypeError('Illegal invocation');
|
|
@@ -725,7 +726,7 @@ IDBObjectStore.prototype.__overwrite = function (tx, key, cb, error) {
|
|
|
725
726
|
* @returns {void}
|
|
726
727
|
*/
|
|
727
728
|
IDBObjectStore.__storingRecordObjectStore = function (request, store, invalidateCache, value, noOverwrite /* , key */) {
|
|
728
|
-
// eslint-disable-next-line prefer-rest-params
|
|
729
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
729
730
|
const key = arguments[5];
|
|
730
731
|
/** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
|
|
731
732
|
store.transaction
|
|
@@ -872,7 +873,7 @@ IDBObjectStore.prototype.getKey = function (query) {
|
|
|
872
873
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
873
874
|
*/
|
|
874
875
|
IDBObjectStore.prototype.getAll = function (/* query, count */) {
|
|
875
|
-
// eslint-disable-next-line prefer-rest-params
|
|
876
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
876
877
|
const [query, count] = arguments;
|
|
877
878
|
return this.__get(query, false, true, count);
|
|
878
879
|
};
|
|
@@ -882,7 +883,7 @@ IDBObjectStore.prototype.getAll = function (/* query, count */) {
|
|
|
882
883
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
883
884
|
*/
|
|
884
885
|
IDBObjectStore.prototype.getAllKeys = function (/* query, count */) {
|
|
885
|
-
// eslint-disable-next-line prefer-rest-params
|
|
886
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
886
887
|
const [query, count] = arguments;
|
|
887
888
|
return this.__get(query, true, true, count);
|
|
888
889
|
};
|
|
@@ -971,7 +972,7 @@ IDBObjectStore.prototype.clear = function () {
|
|
|
971
972
|
*/
|
|
972
973
|
IDBObjectStore.prototype.count = function (/* query */) {
|
|
973
974
|
const me = this;
|
|
974
|
-
// eslint-disable-next-line prefer-rest-params
|
|
975
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
975
976
|
const query = arguments[0];
|
|
976
977
|
if (!(me instanceof IDBObjectStore)) {
|
|
977
978
|
throw new TypeError('Illegal invocation');
|
|
@@ -989,7 +990,7 @@ IDBObjectStore.prototype.count = function (/* query */) {
|
|
|
989
990
|
*/
|
|
990
991
|
IDBObjectStore.prototype.openCursor = function (/* query, direction */) {
|
|
991
992
|
const me = this;
|
|
992
|
-
// eslint-disable-next-line prefer-rest-params
|
|
993
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
993
994
|
const [query, direction] = arguments;
|
|
994
995
|
if (!(me instanceof IDBObjectStore)) {
|
|
995
996
|
throw new TypeError('Illegal invocation');
|
|
@@ -1010,7 +1011,7 @@ IDBObjectStore.prototype.openKeyCursor = function (/* query, direction */) {
|
|
|
1010
1011
|
throw new TypeError('Illegal invocation');
|
|
1011
1012
|
}
|
|
1012
1013
|
IDBObjectStore.__invalidStateIfDeleted(me);
|
|
1013
|
-
// eslint-disable-next-line prefer-rest-params
|
|
1014
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
1014
1015
|
const [query, direction] = arguments;
|
|
1015
1016
|
const cursor = IDBCursor.__createInstance(query, direction, me, me, 'key', 'key');
|
|
1016
1017
|
me.__cursors.push(cursor);
|
|
@@ -1056,7 +1057,7 @@ IDBObjectStore.prototype.index = function (indexName) {
|
|
|
1056
1057
|
*/
|
|
1057
1058
|
IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optionalParameters */) {
|
|
1058
1059
|
const me = this;
|
|
1059
|
-
// eslint-disable-next-line prefer-rest-params
|
|
1060
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
1060
1061
|
let optionalParameters = arguments[2];
|
|
1061
1062
|
if (!(me instanceof IDBObjectStore)) {
|
|
1062
1063
|
throw new TypeError('Illegal invocation');
|
package/src/IDBTransaction.js
CHANGED
|
@@ -141,7 +141,6 @@ IDBTransaction.__createInstance = function (db, storeNames, mode) {
|
|
|
141
141
|
|
|
142
142
|
// @ts-expect-error It's ok
|
|
143
143
|
IDBTransaction.prototype = EventTargetFactory.createInstance({
|
|
144
|
-
// eslint-disable-next-line n/no-sync -- API
|
|
145
144
|
defaultSync: true,
|
|
146
145
|
// Ensure EventTarget preserves our properties
|
|
147
146
|
extraProperties: ['complete']
|
|
@@ -502,7 +501,7 @@ IDBTransaction.prototype.objectStore = function (objectStoreName) {
|
|
|
502
501
|
throw new TypeError('No object store name was specified');
|
|
503
502
|
}
|
|
504
503
|
IDBTransaction.__assertNotFinished(me);
|
|
505
|
-
if (me.__objectStoreNames.indexOf(objectStoreName) === -1) { // eslint-disable-line unicorn/prefer-includes
|
|
504
|
+
if (me.__objectStoreNames.indexOf(objectStoreName) === -1) { // eslint-disable-line unicorn/prefer-includes -- Not supported
|
|
506
505
|
throw createDOMException('NotFoundError', objectStoreName + ' is not participating in this transaction');
|
|
507
506
|
}
|
|
508
507
|
const store = me.db.__objectStores[objectStoreName];
|
|
@@ -544,7 +543,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
|
|
|
544
543
|
).forEach(function (store) {
|
|
545
544
|
// Store was already created so we restore to name before the rename
|
|
546
545
|
if ('__pendingName' in store &&
|
|
547
|
-
me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
546
|
+
me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes -- Not supported
|
|
548
547
|
) {
|
|
549
548
|
store.__name = store.__originalName;
|
|
550
549
|
}
|
|
@@ -555,7 +554,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
|
|
|
555
554
|
).forEach(function (index) {
|
|
556
555
|
// Index was already created so we restore to name before the rename
|
|
557
556
|
if ('__pendingName' in index &&
|
|
558
|
-
store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
557
|
+
store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes -- Not supported
|
|
559
558
|
) {
|
|
560
559
|
index.__name = index.__originalName;
|
|
561
560
|
}
|
|
@@ -590,7 +589,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
|
|
|
590
589
|
} else if (CFG.DEBUG) { console.log('Rollback succeeded', me); }
|
|
591
590
|
|
|
592
591
|
me.dispatchEvent(createEvent('__preabort'));
|
|
593
|
-
me.__requests.filter(function (q, i, arr) { // eslint-disable-line promise/no-promise-in-callback
|
|
592
|
+
me.__requests.filter(function (q, i, arr) { // eslint-disable-line promise/no-promise-in-callback -- Sync promise
|
|
594
593
|
return q.req && !q.req.__done && [i, -1].includes(
|
|
595
594
|
arr.map((q) => q.req).lastIndexOf(q.req)
|
|
596
595
|
);
|
|
@@ -654,6 +653,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
|
|
|
654
653
|
abort,
|
|
655
654
|
/** @type {SQLStatementErrorCallback} */ (abort)
|
|
656
655
|
); // Not working in some circumstances, even in Node
|
|
656
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
657
657
|
} catch (err) {
|
|
658
658
|
// Browser errs when transaction has ended and since it most likely already erred here,
|
|
659
659
|
// we call to abort
|
|
@@ -16,7 +16,7 @@ function IDBVersionChangeEvent (type /* , eventInitDict */) { // eventInitDict i
|
|
|
16
16
|
this.toString = function () {
|
|
17
17
|
return '[object IDBVersionChangeEvent]';
|
|
18
18
|
};
|
|
19
|
-
// eslint-disable-next-line prefer-rest-params
|
|
19
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
20
20
|
this.__eventInitDict = arguments[1] || {};
|
|
21
21
|
}
|
|
22
22
|
|
package/src/Key.js
CHANGED
|
@@ -1061,7 +1061,7 @@ function setCurrentNumber (tx, store, num, successCb, failCb) {
|
|
|
1061
1061
|
function generateKeyForStore (tx, store, cb, sqlFailCb) {
|
|
1062
1062
|
getCurrentNumber(tx, store, function (key) {
|
|
1063
1063
|
if (key > MAX_ALLOWED_CURRENT_NUMBER) { // 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
|
|
1064
|
-
cb('failure');
|
|
1064
|
+
cb('failure');
|
|
1065
1065
|
return;
|
|
1066
1066
|
}
|
|
1067
1067
|
// Increment current number by 1 (we cannot leverage SQLite's
|
package/src/Sca.js
CHANGED
|
@@ -29,7 +29,6 @@ function register (func) {
|
|
|
29
29
|
function encode (obj, func) {
|
|
30
30
|
let ret;
|
|
31
31
|
try {
|
|
32
|
-
// eslint-disable-next-line n/no-sync
|
|
33
32
|
ret = typeson.stringifySync(obj);
|
|
34
33
|
} catch (err) {
|
|
35
34
|
// SCA in typeson-registry using `DOMException` which is not defined (e.g., in Node)
|