indexeddbshim 17.2.2 → 17.3.1
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 +8 -5
- package/dist/CFG.d.ts +1 -1
- package/dist/CFG.d.ts.map +1 -1
- package/dist/DOMException.d.ts +21 -7
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/DOMStringList.d.ts.map +1 -1
- package/dist/Event.d.ts +12 -6
- package/dist/Event.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +125 -7
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBDatabase.d.ts +17 -10
- package/dist/IDBDatabase.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts +5 -0
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts +43 -13
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts +6 -2
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBObjectStore.d.ts +66 -17
- package/dist/IDBObjectStore.d.ts.map +1 -1
- package/dist/IDBRecord.d.ts +44 -0
- package/dist/IDBRecord.d.ts.map +1 -0
- package/dist/IDBRequest.d.ts +2 -2
- package/dist/IDBRequest.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +43 -15
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/IDBVersionChangeEvent.d.ts +23 -12
- package/dist/IDBVersionChangeEvent.d.ts.map +1 -1
- package/dist/Key.d.ts +7 -6
- package/dist/Key.d.ts.map +1 -1
- package/dist/Sca.d.ts +15 -0
- package/dist/Sca.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +59 -23
- 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 +3090 -1168
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +2660 -988
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +4 -4
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +3090 -1168
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +2660 -988
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +4 -4
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +2660 -988
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +4 -4
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts +2 -2
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/nodeSQLiteDatabase.d.ts +13 -14
- package/dist/nodeSQLiteDatabase.d.ts.map +1 -1
- package/dist/nodeWebSQL.d.ts +17 -1
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/dist/setGlobalVars.d.ts +2 -2
- package/dist/setGlobalVars.d.ts.map +1 -1
- package/dist/util.d.ts +15 -0
- package/dist/util.d.ts.map +1 -1
- package/examples/IDBKeyUtils.html +0 -1
- package/package.json +27 -21
- package/src/CFG.js +2 -1
- package/src/DOMException.js +38 -12
- package/src/DOMStringList.js +21 -2
- package/src/Event.js +9 -4
- package/src/IDBCursor.js +346 -18
- package/src/IDBDatabase.js +33 -16
- package/src/IDBFactory.js +118 -56
- package/src/IDBIndex.js +78 -45
- package/src/IDBKeyRange.js +8 -2
- package/src/IDBObjectStore.js +89 -65
- package/src/IDBRecord.js +96 -0
- package/src/IDBRequest.js +7 -7
- package/src/IDBTransaction.js +335 -67
- package/src/IDBVersionChangeEvent.js +37 -30
- package/src/Key.js +36 -18
- package/src/Sca.js +22 -1
- package/src/browser-UnicodeIdentifiers.js +3 -1
- package/src/browser-noninvasive.js +3 -1
- package/src/browser.js +3 -1
- package/src/node-UnicodeIdentifiers.js +1 -1
- package/src/node.js +1 -1
- package/src/nodeSQLiteDatabase.js +67 -2
- package/src/nodeWebSQL.js +22 -2
- package/src/setGlobalVars.js +23 -7
- package/src/util.js +29 -1
- package/typings/shimIndexedDB.d.ts +1 -1
package/src/IDBIndex.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SyncPromise from 'sync-promise-expanded';
|
|
2
2
|
import {createDOMException} from './DOMException.js';
|
|
3
|
-
import {IDBCursor, IDBCursorWithValue} from './IDBCursor.js';
|
|
3
|
+
import {IDBCursor, IDBCursorWithValue, parseGetAllArgs, parseGetAllRecordsArgs, collectAll} from './IDBCursor.js';
|
|
4
4
|
import * as util from './util.js';
|
|
5
5
|
import * as Key from './Key.js';
|
|
6
6
|
import {setSQLForKeyRange, IDBKeyRange, convertValueToKeyRange} from './IDBKeyRange.js';
|
|
@@ -15,6 +15,14 @@ const readonlyProperties = ['objectStore', 'keyPath', 'multiEntry', 'unique'];
|
|
|
15
15
|
* @typedef {number} Integer
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} WebSQLTransaction
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {import('websql-configurable/lib/websql/WebSQLTransaction.js').SqlErrorCallback} SqlErrorCallback
|
|
24
|
+
*/
|
|
25
|
+
|
|
18
26
|
/**
|
|
19
27
|
* @typedef {{
|
|
20
28
|
* columnName: string,
|
|
@@ -58,7 +66,23 @@ const IDBIndexAlias = IDBIndex;
|
|
|
58
66
|
* __unique: boolean,
|
|
59
67
|
* __objectStore: import('./IDBObjectStore.js').IDBObjectStoreFull,
|
|
60
68
|
* __keyPath: import('./Key.js').KeyPath,
|
|
61
|
-
* __recreated?: boolean
|
|
69
|
+
* __recreated?: boolean,
|
|
70
|
+
* __fetchIndexData: (
|
|
71
|
+
* range: any,
|
|
72
|
+
* opType: "value"|"key"|"count",
|
|
73
|
+
* nullDisallowed: boolean,
|
|
74
|
+
* count?: number
|
|
75
|
+
* ) => import('./IDBRequest.js').IDBRequestFull,
|
|
76
|
+
* __renameIndex: (
|
|
77
|
+
* store: import('./IDBObjectStore.js').IDBObjectStoreFull,
|
|
78
|
+
* oldName: string,
|
|
79
|
+
* newName: string,
|
|
80
|
+
* colInfoToPreserveArr?: string[][],
|
|
81
|
+
* cb?: null|((
|
|
82
|
+
* tx: WebSQLTransaction,
|
|
83
|
+
* success: ((store: IDBObjectStore) => void)
|
|
84
|
+
* ) => void)
|
|
85
|
+
* ) => void
|
|
62
86
|
* }} IDBIndexFull
|
|
63
87
|
*/
|
|
64
88
|
|
|
@@ -149,7 +173,7 @@ IDBIndex.__createInstance = function (store, indexProperties) {
|
|
|
149
173
|
['key', 'BLOB ' + (objectStore.autoIncrement ? 'UNIQUE, inc INTEGER PRIMARY KEY AUTOINCREMENT' : 'PRIMARY KEY')],
|
|
150
174
|
['value', 'BLOB']
|
|
151
175
|
].concat(
|
|
152
|
-
// @ts-
|
|
176
|
+
// @ts-ignore Has numeric indexes instead of iterator; needed under some TS versions
|
|
153
177
|
[...objectStore.indexNames]
|
|
154
178
|
.filter((indexName) => indexName !== newName)
|
|
155
179
|
.map((indexName) => [util.escapeIndexNameForSQL(indexName), 'BLOB'])
|
|
@@ -252,8 +276,8 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
252
276
|
let indexValues = {};
|
|
253
277
|
|
|
254
278
|
/**
|
|
255
|
-
* @param {
|
|
256
|
-
* @param {
|
|
279
|
+
* @param {WebSQLTransaction} tx
|
|
280
|
+
* @param {(Error & {code?: number})} err
|
|
257
281
|
* @returns {void}
|
|
258
282
|
*/
|
|
259
283
|
function error (tx, err) {
|
|
@@ -261,7 +285,7 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
261
285
|
}
|
|
262
286
|
|
|
263
287
|
/**
|
|
264
|
-
* @param {
|
|
288
|
+
* @param {WebSQLTransaction} tx
|
|
265
289
|
* @returns {void}
|
|
266
290
|
*/
|
|
267
291
|
function applyIndex (tx) {
|
|
@@ -279,7 +303,8 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
279
303
|
function addIndexEntry (i) {
|
|
280
304
|
if (i < data.rows.length) {
|
|
281
305
|
try {
|
|
282
|
-
const
|
|
306
|
+
const row = /** @type {{key: string, value: string}} */ (data.rows.item(i));
|
|
307
|
+
const value = Sca.decode(util.unescapeSQLiteResponse(row.value));
|
|
283
308
|
const indexKey = Key.extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Todo: Do we need this stricter error checking?
|
|
284
309
|
if (
|
|
285
310
|
('invalid' in indexKey && indexKey.invalid) ||
|
|
@@ -305,11 +330,11 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
305
330
|
tx.executeSql(
|
|
306
331
|
'UPDATE ' + util.escapeStoreNameForSQL(storeName) + ' SET ' +
|
|
307
332
|
util.escapeIndexNameForSQL(indexName) + ' = ? WHERE "key" = ?',
|
|
308
|
-
[util.escapeSQLiteStatement(indexKeyStr),
|
|
333
|
+
[util.escapeSQLiteStatement(indexKeyStr), row.key],
|
|
309
334
|
function () {
|
|
310
335
|
addIndexEntry(i + 1);
|
|
311
336
|
},
|
|
312
|
-
/** @type {
|
|
337
|
+
/** @type {SqlErrorCallback} */ (error)
|
|
313
338
|
);
|
|
314
339
|
} catch (err) {
|
|
315
340
|
// Not a valid value to insert into index, so just continue
|
|
@@ -328,15 +353,15 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
328
353
|
success(store);
|
|
329
354
|
}
|
|
330
355
|
}
|
|
331
|
-
}, /** @type {
|
|
332
|
-
}, /** @type {
|
|
356
|
+
}, /** @type {SqlErrorCallback} */ (error));
|
|
357
|
+
}, /** @type {SqlErrorCallback} */ (error));
|
|
333
358
|
}
|
|
334
359
|
|
|
335
360
|
const escapedStoreNameSQL = util.escapeStoreNameForSQL(storeName);
|
|
336
361
|
const escapedIndexNameSQL = util.escapeIndexNameForSQL(index.name);
|
|
337
362
|
|
|
338
363
|
/**
|
|
339
|
-
* @param {
|
|
364
|
+
* @param {WebSQLTransaction} tx
|
|
340
365
|
* @returns {void}
|
|
341
366
|
*/
|
|
342
367
|
function addIndexSQL (tx) {
|
|
@@ -354,7 +379,7 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
354
379
|
'" ON ' + escapedStoreNameSQL + '(' + escapedIndexNameSQL + ')',
|
|
355
380
|
[],
|
|
356
381
|
applyIndex,
|
|
357
|
-
/** @type {
|
|
382
|
+
/** @type {SqlErrorCallback} */ (error)
|
|
358
383
|
);
|
|
359
384
|
}
|
|
360
385
|
|
|
@@ -367,7 +392,7 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
367
392
|
const sql = ['ALTER TABLE', escapedStoreNameSQL, 'ADD', escapedIndexNameSQL, 'BLOB'].join(' ');
|
|
368
393
|
if (CFG.DEBUG) { console.log(sql); }
|
|
369
394
|
tx.executeSql(
|
|
370
|
-
sql, [], addIndexSQL, /** @type {
|
|
395
|
+
sql, [], addIndexSQL, /** @type {SqlErrorCallback} */ (error)
|
|
371
396
|
);
|
|
372
397
|
}
|
|
373
398
|
});
|
|
@@ -395,8 +420,8 @@ IDBIndex.__deleteIndex = function (store, index) {
|
|
|
395
420
|
transaction
|
|
396
421
|
).__addNonRequestToTransactionQueue(function deleteIndex (tx, args, success, failure) {
|
|
397
422
|
/**
|
|
398
|
-
* @param {
|
|
399
|
-
* @param {
|
|
423
|
+
* @param {WebSQLTransaction} tx
|
|
424
|
+
* @param {(Error & {code?: number})} err
|
|
400
425
|
* @returns {void}
|
|
401
426
|
*/
|
|
402
427
|
function error (tx, err) {
|
|
@@ -417,7 +442,7 @@ IDBIndex.__deleteIndex = function (store, index) {
|
|
|
417
442
|
delete indexHandle.__pendingDelete;
|
|
418
443
|
}
|
|
419
444
|
success(store);
|
|
420
|
-
}, /** @type {
|
|
445
|
+
}, /** @type {SqlErrorCallback} */ (error));
|
|
421
446
|
}
|
|
422
447
|
|
|
423
448
|
if (!CFG.useSQLiteIndexes) {
|
|
@@ -432,7 +457,7 @@ IDBIndex.__deleteIndex = function (store, index) {
|
|
|
432
457
|
),
|
|
433
458
|
[],
|
|
434
459
|
finishDeleteIndex,
|
|
435
|
-
/** @type {
|
|
460
|
+
/** @type {SqlErrorCallback} */ (error)
|
|
436
461
|
);
|
|
437
462
|
});
|
|
438
463
|
};
|
|
@@ -444,12 +469,9 @@ IDBIndex.__deleteIndex = function (store, index) {
|
|
|
444
469
|
/**
|
|
445
470
|
* Updates index list for the given object store.
|
|
446
471
|
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
447
|
-
* @param {
|
|
472
|
+
* @param {WebSQLTransaction} tx
|
|
448
473
|
* @param {(store: IDBObjectStore) => void} success
|
|
449
|
-
* @param {
|
|
450
|
-
* tx: SQLTransaction,
|
|
451
|
-
* err: SQLError
|
|
452
|
-
* ) => boolean} [failure]
|
|
474
|
+
* @param {SqlErrorCallback} [failure]
|
|
453
475
|
* @returns {void}
|
|
454
476
|
*/
|
|
455
477
|
IDBIndex.__updateIndexList = function (store, tx, success, failure) {
|
|
@@ -471,7 +493,7 @@ IDBIndex.__updateIndexList = function (store, tx, success, failure) {
|
|
|
471
493
|
if (CFG.DEBUG) { console.log('Updating the index list for ' + store.__currentName, indexList); }
|
|
472
494
|
tx.executeSql('UPDATE __sys__ SET "indexList" = ? WHERE "name" = ?', [JSON.stringify(indexList), util.escapeSQLiteStatement(store.__currentName)], function () {
|
|
473
495
|
success(store);
|
|
474
|
-
}, /** @type {
|
|
496
|
+
}, /** @type {SqlErrorCallback} */ (failure));
|
|
475
497
|
};
|
|
476
498
|
|
|
477
499
|
/**
|
|
@@ -577,20 +599,30 @@ IDBIndex.prototype.getKey = function (query) {
|
|
|
577
599
|
* @this {IDBIndexFull}
|
|
578
600
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
579
601
|
*/
|
|
580
|
-
IDBIndex.prototype.getAll = function (/*
|
|
602
|
+
IDBIndex.prototype.getAll = function (/* queryOrOptions, count */) {
|
|
603
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
604
|
+
const {query, count, direction} = parseGetAllArgs(arguments);
|
|
605
|
+
return collectAll(this, query, count, direction, 'value');
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* @this {IDBIndexFull}
|
|
610
|
+
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
611
|
+
*/
|
|
612
|
+
IDBIndex.prototype.getAllKeys = function (/* queryOrOptions, count */) {
|
|
581
613
|
// eslint-disable-next-line prefer-rest-params -- API
|
|
582
|
-
const
|
|
583
|
-
return this
|
|
614
|
+
const {query, count, direction} = parseGetAllArgs(arguments);
|
|
615
|
+
return collectAll(this, query, count, direction, 'key');
|
|
584
616
|
};
|
|
585
617
|
|
|
586
618
|
/**
|
|
587
619
|
* @this {IDBIndexFull}
|
|
588
620
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
589
621
|
*/
|
|
590
|
-
IDBIndex.prototype.
|
|
622
|
+
IDBIndex.prototype.getAllRecords = function (/* options */) {
|
|
591
623
|
// eslint-disable-next-line prefer-rest-params -- API
|
|
592
|
-
const
|
|
593
|
-
return this
|
|
624
|
+
const {query, count, direction} = parseGetAllRecordsArgs(arguments);
|
|
625
|
+
return collectAll(this, query, count, direction, 'record');
|
|
594
626
|
};
|
|
595
627
|
|
|
596
628
|
/**
|
|
@@ -620,7 +652,7 @@ IDBIndex.prototype.count = function (/* query */) {
|
|
|
620
652
|
* @param {string} newName
|
|
621
653
|
* @param {string[][]} colInfoToPreserveArr
|
|
622
654
|
* @param {null|((
|
|
623
|
-
* tx:
|
|
655
|
+
* tx: WebSQLTransaction,
|
|
624
656
|
* success: ((store: IDBObjectStore) => void)
|
|
625
657
|
* ) => void)} cb
|
|
626
658
|
* @this {IDBIndexFull}
|
|
@@ -643,8 +675,8 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
|
|
|
643
675
|
store.transaction
|
|
644
676
|
).__addNonRequestToTransactionQueue(function renameIndex (tx, args, success, error) {
|
|
645
677
|
/**
|
|
646
|
-
* @param {
|
|
647
|
-
* @param {
|
|
678
|
+
* @param {WebSQLTransaction} tx
|
|
679
|
+
* @param {(Error & {code?: number})} err
|
|
648
680
|
* @returns {void}
|
|
649
681
|
*/
|
|
650
682
|
function sqlError (tx, err) {
|
|
@@ -698,7 +730,7 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
|
|
|
698
730
|
sql,
|
|
699
731
|
[],
|
|
700
732
|
resolve,
|
|
701
|
-
/** @type {
|
|
733
|
+
/** @type {SqlErrorCallback} */
|
|
702
734
|
(function (tx, err) {
|
|
703
735
|
reject(err);
|
|
704
736
|
})
|
|
@@ -720,13 +752,13 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
|
|
|
720
752
|
if (CFG.DEBUG) { console.log(sql); }
|
|
721
753
|
tx.executeSql(
|
|
722
754
|
sql, [], resolve,
|
|
723
|
-
/** @type {
|
|
755
|
+
/** @type {SqlErrorCallback} */
|
|
724
756
|
(function (tx, err) {
|
|
725
757
|
reject(err);
|
|
726
758
|
})
|
|
727
759
|
);
|
|
728
760
|
},
|
|
729
|
-
/** @type {
|
|
761
|
+
/** @type {SqlErrorCallback} */
|
|
730
762
|
(function (tx, err) {
|
|
731
763
|
reject(err);
|
|
732
764
|
})
|
|
@@ -740,10 +772,10 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
|
|
|
740
772
|
console.log('Index rename error');
|
|
741
773
|
throw err;
|
|
742
774
|
});
|
|
743
|
-
}, /** @type {
|
|
744
|
-
}, /** @type {
|
|
745
|
-
}, /** @type {
|
|
746
|
-
}, /** @type {
|
|
775
|
+
}, /** @type {SqlErrorCallback} */ (sqlError));
|
|
776
|
+
}, /** @type {SqlErrorCallback} */ (sqlError));
|
|
777
|
+
}, /** @type {SqlErrorCallback} */ (sqlError));
|
|
778
|
+
}, /** @type {SqlErrorCallback} */ (sqlError));
|
|
747
779
|
});
|
|
748
780
|
};
|
|
749
781
|
|
|
@@ -766,6 +798,7 @@ Object.defineProperty(IDBIndex, Symbol.hasInstance, {
|
|
|
766
798
|
|
|
767
799
|
util.defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties);
|
|
768
800
|
util.defineOuterInterface(IDBIndex.prototype, ['name']);
|
|
801
|
+
util.setOperationNames(IDBIndex.prototype);
|
|
769
802
|
|
|
770
803
|
IDBIndex.prototype[Symbol.toStringTag] = 'IDBIndexPrototype';
|
|
771
804
|
|
|
@@ -784,10 +817,10 @@ Object.defineProperty(IDBIndex, 'prototype', {
|
|
|
784
817
|
* @param {boolean} multiChecks
|
|
785
818
|
* @param {string[]} sql
|
|
786
819
|
* @param {string[]} sqlValues
|
|
787
|
-
* @param {
|
|
820
|
+
* @param {WebSQLTransaction} tx
|
|
788
821
|
* @param {null|undefined} args
|
|
789
822
|
* @param {(result: number|undefined|[]|AnyValue|AnyValue[]) => void} success
|
|
790
|
-
* @param {(tx:
|
|
823
|
+
* @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
|
|
791
824
|
* @returns {void}
|
|
792
825
|
*/
|
|
793
826
|
function executeFetchIndexData (
|
|
@@ -835,7 +868,7 @@ function executeFetchIndexData (
|
|
|
835
868
|
const escapedIndexNameForKeyCol = util.escapeIndexNameForSQLKeyColumn(index.name);
|
|
836
869
|
const encodedKey = Key.encode(range, index.multiEntry);
|
|
837
870
|
for (let i = 0; i < data.rows.length; i++) {
|
|
838
|
-
const row = data.rows.item(i);
|
|
871
|
+
const row = /** @type {{key: string, value: string, [k: string]: string}} */ (data.rows.item(i));
|
|
839
872
|
const rowKey = /** @type {import('./Key.js').ValueTypeArray} */ (
|
|
840
873
|
Key.decode(row[escapedIndexNameForKeyCol])
|
|
841
874
|
);
|
|
@@ -873,7 +906,7 @@ function executeFetchIndexData (
|
|
|
873
906
|
}
|
|
874
907
|
} else {
|
|
875
908
|
for (let i = 0; i < data.rows.length; i++) {
|
|
876
|
-
const record = data.rows.item(i);
|
|
909
|
+
const record = /** @type {{key: string, value: string}} */ (data.rows.item(i));
|
|
877
910
|
if (record) {
|
|
878
911
|
records.push(decode(record));
|
|
879
912
|
}
|
|
@@ -887,7 +920,7 @@ function executeFetchIndexData (
|
|
|
887
920
|
} else {
|
|
888
921
|
success(unboundedDisallowed ? records[0] : records);
|
|
889
922
|
}
|
|
890
|
-
}, /** @type {
|
|
923
|
+
}, /** @type {SqlErrorCallback} */ (error));
|
|
891
924
|
}
|
|
892
925
|
|
|
893
926
|
/**
|
package/src/IDBKeyRange.js
CHANGED
|
@@ -6,9 +6,12 @@ const readonlyProperties = /** @type {const} */ (['lower', 'upper', 'lowerOpen',
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {globalThis.IDBKeyRange & {
|
|
9
|
+
* __lower: import('./Key.js').Key|undefined,
|
|
10
|
+
* __upper: import('./Key.js').Key|undefined,
|
|
9
11
|
* __lowerCached: string|null|false,
|
|
10
12
|
* __upperCached: string|null|false,
|
|
11
13
|
* __lowerOpen: boolean,
|
|
14
|
+
* __upperOpen: boolean,
|
|
12
15
|
* }} IDBKeyRangeFull
|
|
13
16
|
*/
|
|
14
17
|
|
|
@@ -19,8 +22,6 @@ const readonlyProperties = /** @type {const} */ (['lower', 'upper', 'lowerOpen',
|
|
|
19
22
|
* @class
|
|
20
23
|
*/
|
|
21
24
|
function IDBKeyRange () {
|
|
22
|
-
this.__lowerOpen = false;
|
|
23
|
-
this.__upperOpen = false;
|
|
24
25
|
throw new TypeError('Illegal constructor');
|
|
25
26
|
}
|
|
26
27
|
const IDBKeyRangeAlias = IDBKeyRange;
|
|
@@ -35,9 +36,11 @@ const IDBKeyRangeAlias = IDBKeyRange;
|
|
|
35
36
|
IDBKeyRange.__createInstance = function (lower, upper, lowerOpen, upperOpen) {
|
|
36
37
|
/**
|
|
37
38
|
* @class
|
|
39
|
+
* @this {IDBKeyRangeFull}
|
|
38
40
|
* @throws {DOMException|Error}
|
|
39
41
|
*/
|
|
40
42
|
function IDBKeyRange () {
|
|
43
|
+
// @ts-expect-error Should be ok
|
|
41
44
|
this[Symbol.toStringTag] = 'IDBKeyRange';
|
|
42
45
|
if (lower === undefined && upper === undefined) {
|
|
43
46
|
throw createDOMException('DataError', 'Both arguments to the key range method cannot be undefined');
|
|
@@ -138,6 +141,9 @@ IDBKeyRange.bound = function (lower, upper /* , lowerOpen, upperOpen */) {
|
|
|
138
141
|
IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';
|
|
139
142
|
|
|
140
143
|
/* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
|
|
144
|
+
util.setOperationNames(IDBKeyRange.prototype);
|
|
145
|
+
util.setOperationNames(IDBKeyRange);
|
|
146
|
+
|
|
141
147
|
readonlyProperties.forEach((prop) => {
|
|
142
148
|
Object.defineProperty(IDBKeyRange.prototype, '__' + prop, {
|
|
143
149
|
enumerable: false,
|