indexeddbshim 11.0.0 → 12.0.0-pre.0
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/licenses-badge.svg +1 -1
- package/dist/CFG.d.ts +80 -0
- package/dist/CFG.d.ts.map +1 -0
- package/dist/DOMException.d.ts +71 -0
- package/dist/DOMException.d.ts.map +1 -0
- package/dist/DOMStringList.d.ts +20 -0
- package/dist/DOMStringList.d.ts.map +1 -0
- package/dist/Event.d.ts +21 -0
- package/dist/Event.d.ts.map +1 -0
- package/dist/IDBCursor.d.ts +289 -0
- package/dist/IDBCursor.d.ts.map +1 -0
- package/dist/IDBDatabase.d.ts +144 -0
- package/dist/IDBDatabase.d.ts.map +1 -0
- package/dist/IDBFactory.d.ts +96 -0
- package/dist/IDBFactory.d.ts.map +1 -0
- package/dist/IDBIndex.d.ts +243 -0
- package/dist/IDBIndex.d.ts.map +1 -0
- package/dist/IDBKeyRange.d.ts +79 -0
- package/dist/IDBKeyRange.d.ts.map +1 -0
- package/dist/IDBObjectStore.d.ts +273 -0
- package/dist/IDBObjectStore.d.ts.map +1 -0
- package/dist/IDBRequest.d.ts +90 -0
- package/dist/IDBRequest.d.ts.map +1 -0
- package/dist/IDBTransaction.d.ts +271 -0
- package/dist/IDBTransaction.d.ts.map +1 -0
- package/dist/IDBVersionChangeEvent.d.ts +23 -0
- package/dist/IDBVersionChangeEvent.d.ts.map +1 -0
- package/dist/Key.d.ts +214 -0
- package/dist/Key.d.ts.map +1 -0
- package/dist/Sca.d.ts +31 -0
- package/dist/Sca.d.ts.map +1 -0
- package/dist/UnicodeIdentifiers.d.ts +3 -0
- package/dist/UnicodeIdentifiers.d.ts.map +1 -0
- package/dist/browser-UnicodeIdentifiers.d.ts +2 -0
- package/dist/browser-UnicodeIdentifiers.d.ts.map +1 -0
- package/dist/browser-noninvasive.d.ts +3 -0
- package/dist/browser-noninvasive.d.ts.map +1 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/cmp.d.ts +9 -0
- package/dist/cmp.d.ts.map +1 -0
- package/dist/indexeddbshim-Key.js +491 -189
- 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 +17263 -1396
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +3892 -1271
- 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 +17259 -1396
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +3887 -1271
- 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 +3887 -1271
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts +8 -0
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/nodeWebSQL.d.ts +3 -0
- package/dist/nodeWebSQL.d.ts.map +1 -0
- package/dist/setGlobalVars.d.ts +79 -0
- package/dist/setGlobalVars.d.ts.map +1 -0
- package/dist/unicode-regex.d.ts +3 -0
- package/dist/unicode-regex.d.ts.map +1 -0
- package/dist/util.d.ts +174 -0
- package/dist/util.d.ts.map +1 -0
- package/package.json +40 -27
- package/src/CFG.js +89 -11
- package/src/DOMException.js +116 -29
- package/src/DOMStringList.js +92 -2
- package/src/Event.js +19 -4
- package/src/IDBCursor.js +339 -67
- package/src/IDBDatabase.js +87 -10
- package/src/IDBFactory.js +319 -56
- package/src/IDBIndex.js +385 -96
- package/src/IDBKeyRange.js +86 -13
- package/src/IDBObjectStore.js +326 -68
- package/src/IDBRequest.js +59 -1
- package/src/IDBTransaction.js +247 -38
- package/src/IDBVersionChangeEvent.js +28 -3
- package/src/Key.js +273 -156
- package/src/Sca.js +29 -4
- package/src/browser-UnicodeIdentifiers.js +5 -1
- package/src/cmp.js +5 -5
- package/src/node-UnicodeIdentifiers.js +9 -0
- package/src/node.js +5 -0
- package/src/nodeWebSQL.js +11 -5
- package/src/setGlobalVars.js +156 -21
- package/src/unicode-regex.js +9 -1
- package/src/util.js +228 -40
- package/typings/shimIndexedDB.d.ts +9 -0
package/src/Key.js
CHANGED
|
@@ -4,12 +4,57 @@ import cmp from './cmp.js';
|
|
|
4
4
|
import CFG from './CFG.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @typedef {NodeJS.TypedArray|DataView} ArrayBufferView
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {ArrayBufferView|ArrayBuffer} BufferSource
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {"number"|"date"|"string"|"binary"|"array"} KeyType
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {any} Value
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {any} Key
|
|
24
|
+
* @todo Specify possible value more precisely
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {KeyPath[]} KeyPathArray
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {string|KeyPathArray} KeyPath
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {object} KeyValueObject
|
|
36
|
+
* @property {KeyType|"NaN"|"null"|"undefined"|"boolean"|"object"|"symbol"|
|
|
37
|
+
* "function"|"bigint"} type If not `KeyType`, indicates invalid value
|
|
38
|
+
* @property {Value} [value]
|
|
39
|
+
* @property {boolean} [invalid]
|
|
40
|
+
* @property {string} [message]
|
|
41
|
+
* @todo Specify acceptable `value` more precisely
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {number|string|Date|ArrayBuffer} ValueTypePrimitive
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {ValueType[]} ValueTypeArray
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {ValueTypePrimitive|ValueTypeArray} ValueType
|
|
8
52
|
*/
|
|
9
53
|
|
|
10
54
|
/**
|
|
11
55
|
* Encodes the keys based on their types. This is required to maintain collations
|
|
12
56
|
* We leave space for future keys.
|
|
57
|
+
* @type {{[key: string]: Integer|string}}
|
|
13
58
|
*/
|
|
14
59
|
const keyTypeToEncodedChar = {
|
|
15
60
|
invalid: 100,
|
|
@@ -19,15 +64,17 @@ const keyTypeToEncodedChar = {
|
|
|
19
64
|
binary: 500,
|
|
20
65
|
array: 600
|
|
21
66
|
};
|
|
22
|
-
const keyTypes = Object.keys(keyTypeToEncodedChar);
|
|
67
|
+
const keyTypes = /** @type {(KeyType|"invalid")[]} */ (Object.keys(keyTypeToEncodedChar));
|
|
23
68
|
keyTypes.forEach((k) => {
|
|
24
|
-
keyTypeToEncodedChar[k] = String.fromCodePoint(
|
|
69
|
+
keyTypeToEncodedChar[k] = String.fromCodePoint(
|
|
70
|
+
/** @type {number} */ (keyTypeToEncodedChar[k])
|
|
71
|
+
);
|
|
25
72
|
});
|
|
26
73
|
|
|
27
74
|
const encodedCharToKeyType = keyTypes.reduce((o, k) => {
|
|
28
75
|
o[keyTypeToEncodedChar[k]] = k;
|
|
29
76
|
return o;
|
|
30
|
-
}, {});
|
|
77
|
+
}, /** @type {{[key: string]: KeyType|"invalid"}} */ ({}));
|
|
31
78
|
|
|
32
79
|
/**
|
|
33
80
|
* The sign values for numbers, ordered from least to greatest.
|
|
@@ -40,12 +87,24 @@ const encodedCharToKeyType = keyTypes.reduce((o, k) => {
|
|
|
40
87
|
*/
|
|
41
88
|
const signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
|
|
42
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @typedef {any} AnyValue
|
|
92
|
+
*/
|
|
93
|
+
|
|
43
94
|
const types = {
|
|
44
95
|
invalid: {
|
|
45
|
-
|
|
96
|
+
/**
|
|
97
|
+
* @param {AnyValue} _key
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
encode (_key) {
|
|
46
101
|
return keyTypeToEncodedChar.invalid + '-';
|
|
47
102
|
},
|
|
48
|
-
|
|
103
|
+
/**
|
|
104
|
+
* @param {string} _key
|
|
105
|
+
* @returns {undefined}
|
|
106
|
+
*/
|
|
107
|
+
decode (_key) {
|
|
49
108
|
return undefined;
|
|
50
109
|
}
|
|
51
110
|
},
|
|
@@ -63,6 +122,10 @@ const types = {
|
|
|
63
122
|
number: {
|
|
64
123
|
// The encode step checks for six numeric cases and generates 14-digit encoded
|
|
65
124
|
// sign-exponent-mantissa strings.
|
|
125
|
+
/**
|
|
126
|
+
* @param {number} key
|
|
127
|
+
* @returns {string}
|
|
128
|
+
*/
|
|
66
129
|
encode (key) {
|
|
67
130
|
let key32 = key === Number.MIN_VALUE
|
|
68
131
|
// Mocha test `IDBFactory/cmp-spec.js` exposed problem for some
|
|
@@ -128,6 +191,10 @@ const types = {
|
|
|
128
191
|
// The decode step must interpret the sign, reflip values encoded as the 32's complements,
|
|
129
192
|
// apply signs to the exponent and mantissa, do the base-32 power operation, and return
|
|
130
193
|
// the original JavaScript number values.
|
|
194
|
+
/**
|
|
195
|
+
* @param {string} key
|
|
196
|
+
* @returns {number}
|
|
197
|
+
*/
|
|
131
198
|
decode (key) {
|
|
132
199
|
const sign = Number(key.slice(2, 3));
|
|
133
200
|
let exponent = key.slice(3, 5);
|
|
@@ -166,18 +233,28 @@ const types = {
|
|
|
166
233
|
// This effectively doubles the size of every string, but it ensures that when two arrays of strings are compared,
|
|
167
234
|
// the indexes of each string's characters line up with each other.
|
|
168
235
|
string: {
|
|
236
|
+
/**
|
|
237
|
+
* @param {string} key
|
|
238
|
+
* @param {boolean} [inArray]
|
|
239
|
+
* @returns {string}
|
|
240
|
+
*/
|
|
169
241
|
encode (key, inArray) {
|
|
170
242
|
if (inArray) {
|
|
171
243
|
// prepend each character with a dash, and append a space to the end
|
|
172
|
-
key = key.
|
|
244
|
+
key = key.replaceAll(/(.)/gu, '-$1') + ' ';
|
|
173
245
|
}
|
|
174
246
|
return keyTypeToEncodedChar.string + '-' + key;
|
|
175
247
|
},
|
|
248
|
+
/**
|
|
249
|
+
* @param {string} key
|
|
250
|
+
* @param {boolean} [inArray]
|
|
251
|
+
* @returns {string}
|
|
252
|
+
*/
|
|
176
253
|
decode (key, inArray) {
|
|
177
254
|
key = key.slice(2);
|
|
178
255
|
if (inArray) {
|
|
179
256
|
// remove the space at the end, and the dash before each character
|
|
180
|
-
key = key.slice(0, -1).
|
|
257
|
+
key = key.slice(0, -1).replaceAll(/-(.)/gu, '$1');
|
|
181
258
|
}
|
|
182
259
|
return key;
|
|
183
260
|
}
|
|
@@ -187,6 +264,10 @@ const types = {
|
|
|
187
264
|
// An extra, value is added to each array during encoding to make
|
|
188
265
|
// empty arrays sort correctly.
|
|
189
266
|
array: {
|
|
267
|
+
/**
|
|
268
|
+
* @param {ValueTypeArray} key
|
|
269
|
+
* @returns {string}
|
|
270
|
+
*/
|
|
190
271
|
encode (key) {
|
|
191
272
|
const encoded = [];
|
|
192
273
|
for (const [i, item] of key.entries()) {
|
|
@@ -196,6 +277,10 @@ const types = {
|
|
|
196
277
|
encoded.push(keyTypeToEncodedChar.invalid + '-'); // append an extra item, so empty arrays sort correctly
|
|
197
278
|
return keyTypeToEncodedChar.array + '-' + JSON.stringify(encoded);
|
|
198
279
|
},
|
|
280
|
+
/**
|
|
281
|
+
* @param {string} key
|
|
282
|
+
* @returns {ValueTypeArray}
|
|
283
|
+
*/
|
|
199
284
|
decode (key) {
|
|
200
285
|
const decoded = JSON.parse(key.slice(2));
|
|
201
286
|
decoded.pop(); // remove the extra item
|
|
@@ -210,15 +295,27 @@ const types = {
|
|
|
210
295
|
|
|
211
296
|
// Dates are encoded as ISO 8601 strings, in UTC time zone.
|
|
212
297
|
date: {
|
|
298
|
+
/**
|
|
299
|
+
* @param {Date} key
|
|
300
|
+
* @returns {string}
|
|
301
|
+
*/
|
|
213
302
|
encode (key) {
|
|
214
303
|
return keyTypeToEncodedChar.date + '-' + key.toJSON();
|
|
215
304
|
},
|
|
305
|
+
/**
|
|
306
|
+
* @param {string} key
|
|
307
|
+
* @returns {Date}
|
|
308
|
+
*/
|
|
216
309
|
decode (key) {
|
|
217
310
|
return new Date(key.slice(2));
|
|
218
311
|
}
|
|
219
312
|
},
|
|
220
313
|
binary: {
|
|
221
314
|
// `ArrayBuffer`/Views on buffers (`TypedArray` or `DataView`)
|
|
315
|
+
/**
|
|
316
|
+
* @param {BufferSource} key
|
|
317
|
+
* @returns {string}
|
|
318
|
+
*/
|
|
222
319
|
encode (key) {
|
|
223
320
|
return keyTypeToEncodedChar.binary + '-' + (key.byteLength
|
|
224
321
|
? [...getCopyBytesHeldByBufferSource(key)].map(
|
|
@@ -226,6 +323,10 @@ const types = {
|
|
|
226
323
|
) // e.g., '255,005,254,000,001,033'
|
|
227
324
|
: '');
|
|
228
325
|
},
|
|
326
|
+
/**
|
|
327
|
+
* @param {string} key
|
|
328
|
+
* @returns {ArrayBuffer}
|
|
329
|
+
*/
|
|
229
330
|
decode (key) {
|
|
230
331
|
// Set the entries in buffer's [[ArrayBufferData]] to those in `value`
|
|
231
332
|
const k = key.slice(2);
|
|
@@ -244,8 +345,8 @@ const types = {
|
|
|
244
345
|
* @returns {string}
|
|
245
346
|
*/
|
|
246
347
|
function padBase32Exponent (n) {
|
|
247
|
-
|
|
248
|
-
return (
|
|
348
|
+
const exp = n.toString(32);
|
|
349
|
+
return (exp.length === 1) ? '0' + exp : exp;
|
|
249
350
|
}
|
|
250
351
|
|
|
251
352
|
/**
|
|
@@ -283,26 +384,30 @@ function flipBase32 (encoded) {
|
|
|
283
384
|
* @returns {number}
|
|
284
385
|
*/
|
|
285
386
|
function pow32 (mantissa, exponent) {
|
|
286
|
-
|
|
287
|
-
if (
|
|
387
|
+
const exp = Number.parseInt(exponent, 32);
|
|
388
|
+
if (exp < 0) {
|
|
288
389
|
return roundToPrecision(
|
|
289
|
-
Number.parseInt(mantissa, 32) * (32 ** (
|
|
390
|
+
Number.parseInt(mantissa, 32) * (32 ** (exp - 10))
|
|
290
391
|
);
|
|
291
392
|
}
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
return roundToPrecision(
|
|
393
|
+
if (exp < 11) {
|
|
394
|
+
const whole = mantissa.slice(0, exp);
|
|
395
|
+
const wholeNum = Number.parseInt(whole, 32);
|
|
396
|
+
const fraction = mantissa.slice(exp);
|
|
397
|
+
const fractionNum = Number.parseInt(fraction, 32) * (32 ** (exp - 11));
|
|
398
|
+
return roundToPrecision(wholeNum + fractionNum);
|
|
298
399
|
}
|
|
299
|
-
const expansion = mantissa + zeros(
|
|
400
|
+
const expansion = mantissa + zeros(exp - 11);
|
|
300
401
|
return Number.parseInt(expansion, 32);
|
|
301
402
|
}
|
|
302
403
|
|
|
404
|
+
/**
|
|
405
|
+
* @typedef {number} Float
|
|
406
|
+
*/
|
|
407
|
+
|
|
303
408
|
/**
|
|
304
409
|
* @param {Float} num
|
|
305
|
-
* @param {Float} [precision
|
|
410
|
+
* @param {Float} [precision]
|
|
306
411
|
* @returns {Float}
|
|
307
412
|
*/
|
|
308
413
|
function roundToPrecision (num, precision = 16) {
|
|
@@ -328,27 +433,25 @@ function negate (s) {
|
|
|
328
433
|
}
|
|
329
434
|
|
|
330
435
|
/**
|
|
331
|
-
* @
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* @param key
|
|
336
|
-
* @returns {module:Key.KeyType}
|
|
436
|
+
* @param {Key} key
|
|
437
|
+
* @returns {KeyType|"invalid"}
|
|
337
438
|
*/
|
|
338
439
|
function getKeyType (key) {
|
|
339
440
|
if (Array.isArray(key)) return 'array';
|
|
340
441
|
if (util.isDate(key)) return 'date';
|
|
341
442
|
if (util.isBinary(key)) return 'binary';
|
|
342
443
|
const keyType = typeof key;
|
|
343
|
-
return ['string', 'number'].includes(keyType)
|
|
444
|
+
return ['string', 'number'].includes(keyType)
|
|
445
|
+
? /** @type {"string"|"number"} */ (keyType)
|
|
446
|
+
: 'invalid';
|
|
344
447
|
}
|
|
345
448
|
|
|
346
449
|
/**
|
|
347
450
|
* Keys must be strings, numbers (besides `NaN`), Dates (if value is not
|
|
348
451
|
* `NaN`), binary objects or Arrays.
|
|
349
|
-
* @param input The key input
|
|
350
|
-
* @param {
|
|
351
|
-
* @returns {
|
|
452
|
+
* @param {Value} input The key input
|
|
453
|
+
* @param {Value[]|null|undefined} [seen] An array of already seen keys
|
|
454
|
+
* @returns {KeyValueObject}
|
|
352
455
|
*/
|
|
353
456
|
function convertValueToKey (input, seen) {
|
|
354
457
|
return convertValueToKeyValueDecoded(input, seen, false, true);
|
|
@@ -356,8 +459,8 @@ function convertValueToKey (input, seen) {
|
|
|
356
459
|
|
|
357
460
|
/**
|
|
358
461
|
* Currently not in use.
|
|
359
|
-
* @param input
|
|
360
|
-
* @returns {
|
|
462
|
+
* @param {Value} input
|
|
463
|
+
* @returns {KeyValueObject}
|
|
361
464
|
*/
|
|
362
465
|
function convertValueToMultiEntryKey (input) {
|
|
363
466
|
return convertValueToKeyValueDecoded(input, null, true, true);
|
|
@@ -365,7 +468,7 @@ function convertValueToMultiEntryKey (input) {
|
|
|
365
468
|
|
|
366
469
|
/**
|
|
367
470
|
*
|
|
368
|
-
* @param O
|
|
471
|
+
* @param {BufferSource} O
|
|
369
472
|
* @throws {TypeError}
|
|
370
473
|
* @see https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2
|
|
371
474
|
* @returns {Uint8Array}
|
|
@@ -387,29 +490,26 @@ function getCopyBytesHeldByBufferSource (O) {
|
|
|
387
490
|
}
|
|
388
491
|
// const octets = new Uint8Array(input);
|
|
389
492
|
// const octets = types.binary.decode(types.binary.encode(input));
|
|
390
|
-
return new Uint8Array(
|
|
493
|
+
return new Uint8Array(
|
|
494
|
+
// Should allow DataView
|
|
495
|
+
/** @type {ArrayBuffer} */
|
|
496
|
+
(('buffer' in O && O.buffer) || O),
|
|
497
|
+
offset,
|
|
498
|
+
length
|
|
499
|
+
);
|
|
391
500
|
}
|
|
392
501
|
|
|
393
|
-
/**
|
|
394
|
-
* @typedef {PlainObject} module:Key.keyValueObject
|
|
395
|
-
* @property {module:Key.KeyType|"NaN"} type
|
|
396
|
-
* @property {*} [value]
|
|
397
|
-
* @property {boolean} [invalid]
|
|
398
|
-
* @property {string} [message]
|
|
399
|
-
* @todo Specify acceptable `value` more precisely
|
|
400
|
-
*/
|
|
401
|
-
|
|
402
502
|
/**
|
|
403
503
|
* Shortcut utility to avoid returning full keys from `convertValueToKey`
|
|
404
504
|
* and subsequent need to process in calling code unless `fullKeys` is
|
|
405
505
|
* set; may throw.
|
|
406
|
-
* @param {
|
|
407
|
-
* @param {
|
|
506
|
+
* @param {Value} input
|
|
507
|
+
* @param {Value[]|null} [seen]
|
|
408
508
|
* @param {boolean} [multiEntry]
|
|
409
509
|
* @param {boolean} [fullKeys]
|
|
410
510
|
* @throws {TypeError} See `getCopyBytesHeldByBufferSource`
|
|
411
511
|
* @todo Document other allowable `input`
|
|
412
|
-
* @returns {
|
|
512
|
+
* @returns {KeyValueObject}
|
|
413
513
|
*/
|
|
414
514
|
function convertValueToKeyValueDecoded (input, seen, multiEntry, fullKeys) {
|
|
415
515
|
seen = seen || [];
|
|
@@ -428,24 +528,35 @@ function convertValueToKeyValueDecoded (input, seen, multiEntry, fullKeys) {
|
|
|
428
528
|
// List as 'NaN' type for convenience of consumers in reporting errors
|
|
429
529
|
return {type: 'NaN', invalid: true};
|
|
430
530
|
}
|
|
431
|
-
|
|
531
|
+
|
|
532
|
+
// https://github.com/w3c/IndexedDB/issues/375
|
|
533
|
+
// https://github.com/w3c/IndexedDB/pull/386
|
|
534
|
+
if (Object.is(input, -0)) {
|
|
535
|
+
return {type, value: 0};
|
|
536
|
+
}
|
|
537
|
+
return /** @type {{type: KeyType; value: Value}} */ (ret);
|
|
432
538
|
} case 'string': {
|
|
433
|
-
return ret;
|
|
539
|
+
return /** @type {{type: KeyType; value: Value}} */ (ret);
|
|
434
540
|
} case 'binary': { // May throw (if detached)
|
|
435
541
|
// Get a copy of the bytes held by the buffer source
|
|
436
542
|
// https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2
|
|
437
|
-
const octets = getCopyBytesHeldByBufferSource(
|
|
543
|
+
const octets = getCopyBytesHeldByBufferSource(
|
|
544
|
+
/** @type {BufferSource} */ (input)
|
|
545
|
+
);
|
|
438
546
|
return {type: 'binary', value: octets};
|
|
439
547
|
} case 'array': { // May throw (from binary)
|
|
440
|
-
const
|
|
548
|
+
const arr = /** @type {Array<any>} */ (input);
|
|
549
|
+
const len = arr.length;
|
|
441
550
|
seen.push(input);
|
|
551
|
+
|
|
552
|
+
/** @type {(KeyValueObject|Value)[]} */
|
|
442
553
|
const keys = [];
|
|
443
554
|
for (let i = 0; i < len; i++) { // We cannot iterate here with array extras as we must ensure sparse arrays are invalidated
|
|
444
|
-
if (!multiEntry && !Object.
|
|
555
|
+
if (!multiEntry && !Object.hasOwn(arr, i)) {
|
|
445
556
|
return {type, invalid: true, message: 'Does not have own index property'};
|
|
446
557
|
}
|
|
447
558
|
try {
|
|
448
|
-
const entry =
|
|
559
|
+
const entry = arr[i];
|
|
449
560
|
const key = convertValueToKeyValueDecoded(entry, seen, false, fullKeys); // Though steps do not list rethrowing, the next is returnifabrupt when not multiEntry
|
|
450
561
|
if (key.invalid) {
|
|
451
562
|
if (multiEntry) {
|
|
@@ -467,32 +578,28 @@ function convertValueToKeyValueDecoded (input, seen, multiEntry, fullKeys) {
|
|
|
467
578
|
}
|
|
468
579
|
return {type, value: keys};
|
|
469
580
|
} case 'date': {
|
|
470
|
-
|
|
581
|
+
const date = /** @type {Date} */ (input);
|
|
582
|
+
if (!Number.isNaN(date.getTime())) {
|
|
471
583
|
return fullKeys
|
|
472
|
-
? {type, value:
|
|
473
|
-
: {type, value: new Date(
|
|
584
|
+
? {type, value: date.getTime()}
|
|
585
|
+
: {type, value: new Date(date.getTime())};
|
|
474
586
|
}
|
|
475
587
|
return {type, invalid: true, message: 'Not a valid date'};
|
|
476
588
|
// Falls through
|
|
477
589
|
} case 'invalid': default: {
|
|
478
590
|
// Other `typeof` types which are not valid keys:
|
|
479
|
-
// 'undefined', 'boolean', 'object' (including `null`), 'symbol', 'function
|
|
591
|
+
// 'undefined', 'boolean', 'object' (including `null`), 'symbol', 'function'
|
|
480
592
|
const type = input === null ? 'null' : typeof input; // Convert `null` for convenience of consumers in reporting errors
|
|
481
593
|
return {type, invalid: true, message: 'Not a valid key; type ' + type};
|
|
482
594
|
}
|
|
483
595
|
}
|
|
484
596
|
}
|
|
485
597
|
|
|
486
|
-
/**
|
|
487
|
-
* @typedef {*} module:Key.Key
|
|
488
|
-
* @todo Specify possible value more precisely
|
|
489
|
-
*/
|
|
490
|
-
|
|
491
598
|
/**
|
|
492
599
|
*
|
|
493
|
-
* @param {
|
|
494
|
-
* @param {boolean} fullKeys
|
|
495
|
-
* @returns {
|
|
600
|
+
* @param {Key} key
|
|
601
|
+
* @param {boolean} [fullKeys]
|
|
602
|
+
* @returns {KeyValueObject}
|
|
496
603
|
* @todo Document other allowable `key`?
|
|
497
604
|
*/
|
|
498
605
|
function convertValueToMultiEntryKeyDecoded (key, fullKeys) {
|
|
@@ -501,10 +608,10 @@ function convertValueToMultiEntryKeyDecoded (key, fullKeys) {
|
|
|
501
608
|
|
|
502
609
|
/**
|
|
503
610
|
* An internal utility.
|
|
504
|
-
* @param input
|
|
505
|
-
* @param {
|
|
611
|
+
* @param {Value} input
|
|
612
|
+
* @param {Value[]|null|undefined} [seen]
|
|
506
613
|
* @throws {DOMException} `DataError`
|
|
507
|
-
* @returns {
|
|
614
|
+
* @returns {KeyValueObject}
|
|
508
615
|
*/
|
|
509
616
|
function convertValueToKeyRethrowingAndIfInvalid (input, seen) {
|
|
510
617
|
const key = convertValueToKey(input, seen);
|
|
@@ -516,10 +623,10 @@ function convertValueToKeyRethrowingAndIfInvalid (input, seen) {
|
|
|
516
623
|
|
|
517
624
|
/**
|
|
518
625
|
*
|
|
519
|
-
* @param value
|
|
520
|
-
* @param keyPath
|
|
626
|
+
* @param {Value} value
|
|
627
|
+
* @param {KeyPath} keyPath
|
|
521
628
|
* @param {boolean} multiEntry
|
|
522
|
-
* @returns {
|
|
629
|
+
* @returns {KeyValueObject|KeyPathEvaluateValue}
|
|
523
630
|
* @todo Document other possible return?
|
|
524
631
|
*/
|
|
525
632
|
function extractKeyFromValueUsingKeyPath (value, keyPath, multiEntry) {
|
|
@@ -527,10 +634,10 @@ function extractKeyFromValueUsingKeyPath (value, keyPath, multiEntry) {
|
|
|
527
634
|
}
|
|
528
635
|
/**
|
|
529
636
|
* Not currently in use.
|
|
530
|
-
* @param value
|
|
531
|
-
* @param keyPath
|
|
637
|
+
* @param {Value} value
|
|
638
|
+
* @param {KeyPath} keyPath
|
|
532
639
|
* @param {boolean} multiEntry
|
|
533
|
-
* @returns {
|
|
640
|
+
* @returns {KeyPathEvaluateValue}
|
|
534
641
|
*/
|
|
535
642
|
function evaluateKeyPathOnValue (value, keyPath, multiEntry) {
|
|
536
643
|
return evaluateKeyPathOnValueToDecodedValue(value, keyPath, multiEntry, true);
|
|
@@ -539,11 +646,11 @@ function evaluateKeyPathOnValue (value, keyPath, multiEntry) {
|
|
|
539
646
|
/**
|
|
540
647
|
* May throw, return `{failure: true}` (e.g., non-object on keyPath resolution)
|
|
541
648
|
* or `{invalid: true}` (e.g., `NaN`).
|
|
542
|
-
* @param value
|
|
543
|
-
* @param keyPath
|
|
544
|
-
* @param {boolean} multiEntry
|
|
545
|
-
* @param {boolean} fullKeys
|
|
546
|
-
* @returns {
|
|
649
|
+
* @param {Value} value
|
|
650
|
+
* @param {KeyPath} keyPath
|
|
651
|
+
* @param {boolean} [multiEntry]
|
|
652
|
+
* @param {boolean} [fullKeys]
|
|
653
|
+
* @returns {KeyValueObject|KeyPathEvaluateValue}
|
|
547
654
|
* @todo Document other possible return?
|
|
548
655
|
*/
|
|
549
656
|
function extractKeyValueDecodedFromValueUsingKeyPath (value, keyPath, multiEntry, fullKeys) {
|
|
@@ -558,26 +665,37 @@ function extractKeyValueDecodedFromValueUsingKeyPath (value, keyPath, multiEntry
|
|
|
558
665
|
}
|
|
559
666
|
|
|
560
667
|
/**
|
|
561
|
-
*
|
|
562
|
-
* @
|
|
563
|
-
|
|
668
|
+
* Unused?
|
|
669
|
+
* @typedef {object} KeyPathEvaluateFailure
|
|
670
|
+
* @property {boolean} failure
|
|
671
|
+
*/
|
|
564
672
|
|
|
565
673
|
/**
|
|
566
|
-
* @typedef {
|
|
567
|
-
|
|
568
|
-
|
|
674
|
+
* @typedef {KeyPathEvaluateValueValue[]} KeyPathEvaluateValueValueArray
|
|
675
|
+
*/
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* @typedef {undefined|number|string|Date|object|KeyPathEvaluateValueValueArray} KeyPathEvaluateValueValue
|
|
679
|
+
*/
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* @typedef {object} KeyPathEvaluateValue
|
|
683
|
+
* @property {KeyPathEvaluateValueValue} [value]
|
|
684
|
+
* @property {boolean} [failure]
|
|
685
|
+
*/
|
|
569
686
|
|
|
570
687
|
/**
|
|
571
688
|
* Returns the value of an inline key based on a key path (wrapped in an
|
|
572
689
|
* object with key `value`) or `{failure: true}`
|
|
573
|
-
* @param {
|
|
574
|
-
* @param {
|
|
575
|
-
* @param {boolean} multiEntry
|
|
690
|
+
* @param {Value} value
|
|
691
|
+
* @param {KeyPath} keyPath
|
|
692
|
+
* @param {boolean} [multiEntry]
|
|
576
693
|
* @param {boolean} [fullKeys]
|
|
577
|
-
* @returns {
|
|
694
|
+
* @returns {KeyPathEvaluateValue}
|
|
578
695
|
*/
|
|
579
696
|
function evaluateKeyPathOnValueToDecodedValue (value, keyPath, multiEntry, fullKeys) {
|
|
580
697
|
if (Array.isArray(keyPath)) {
|
|
698
|
+
/** @type {KeyPathEvaluateValueValueArray} */
|
|
581
699
|
const result = [];
|
|
582
700
|
return keyPath.some((item) => {
|
|
583
701
|
const key = evaluateKeyPathOnValueToDecodedValue(value, item, multiEntry, fullKeys);
|
|
@@ -602,22 +720,24 @@ function evaluateKeyPathOnValueToDecodedValue (value, keyPath, multiEntry, fullK
|
|
|
602
720
|
} else if (util.isBlob(value)) {
|
|
603
721
|
switch (idntfr) {
|
|
604
722
|
case 'size': case 'type':
|
|
605
|
-
value = value[idntfr];
|
|
723
|
+
value = /** @type {Blob} */ (value)[idntfr];
|
|
606
724
|
break;
|
|
607
725
|
}
|
|
608
726
|
} else if (util.isFile(value)) {
|
|
609
727
|
switch (idntfr) {
|
|
610
728
|
case 'name': case 'lastModified':
|
|
611
|
-
value = value[idntfr];
|
|
729
|
+
value = /** @type {File} */ (value)[idntfr];
|
|
612
730
|
break;
|
|
613
731
|
case 'lastModifiedDate':
|
|
614
|
-
value = new Date(value.lastModified);
|
|
732
|
+
value = new Date(/** @type {File} */ (value).lastModified);
|
|
615
733
|
break;
|
|
616
734
|
}
|
|
617
|
-
} else if (!util.isObj(value) || !Object.
|
|
735
|
+
} else if (!util.isObj(value) || !Object.hasOwn(value, idntfr)) {
|
|
618
736
|
return true;
|
|
619
737
|
} else {
|
|
620
|
-
value =
|
|
738
|
+
value = /** @type {{[key: string]: KeyPathEvaluateValueValue}} */ (
|
|
739
|
+
value
|
|
740
|
+
)[idntfr];
|
|
621
741
|
return value === undefined;
|
|
622
742
|
}
|
|
623
743
|
return false;
|
|
@@ -628,8 +748,8 @@ function evaluateKeyPathOnValueToDecodedValue (value, keyPath, multiEntry, fullK
|
|
|
628
748
|
|
|
629
749
|
/**
|
|
630
750
|
* Sets the inline key value.
|
|
631
|
-
* @param {
|
|
632
|
-
* @param {
|
|
751
|
+
* @param {{[key: string]: AnyValue}} value
|
|
752
|
+
* @param {Key} key
|
|
633
753
|
* @param {string} keyPath
|
|
634
754
|
* @returns {void}
|
|
635
755
|
*/
|
|
@@ -637,19 +757,19 @@ function injectKeyIntoValueUsingKeyPath (value, key, keyPath) {
|
|
|
637
757
|
const identifiers = keyPath.split('.');
|
|
638
758
|
const last = identifiers.pop();
|
|
639
759
|
identifiers.forEach((identifier) => {
|
|
640
|
-
const hop = Object.
|
|
760
|
+
const hop = Object.hasOwn(value, identifier);
|
|
641
761
|
if (!hop) {
|
|
642
762
|
value[identifier] = {};
|
|
643
763
|
}
|
|
644
764
|
value = value[identifier];
|
|
645
765
|
});
|
|
646
|
-
value[last] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
766
|
+
value[/** @type {string} */ (last)] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
647
767
|
}
|
|
648
768
|
|
|
649
769
|
/**
|
|
650
770
|
*
|
|
651
|
-
* @param value
|
|
652
|
-
* @param keyPath
|
|
771
|
+
* @param {Value} value
|
|
772
|
+
* @param {string} keyPath
|
|
653
773
|
* @see https://github.com/w3c/IndexedDB/pull/146
|
|
654
774
|
* @returns {boolean}
|
|
655
775
|
*/
|
|
@@ -660,20 +780,20 @@ function checkKeyCouldBeInjectedIntoValue (value, keyPath) {
|
|
|
660
780
|
if (!util.isObj(value)) {
|
|
661
781
|
return false;
|
|
662
782
|
}
|
|
663
|
-
const hop = Object.
|
|
783
|
+
const hop = Object.hasOwn(value, identifier);
|
|
664
784
|
if (!hop) {
|
|
665
785
|
return true;
|
|
666
786
|
}
|
|
667
|
-
value = value[identifier];
|
|
787
|
+
value = /** @type {{[key: string]: Value}} */ (value)[identifier];
|
|
668
788
|
}
|
|
669
789
|
return util.isObj(value);
|
|
670
790
|
}
|
|
671
791
|
|
|
672
792
|
/**
|
|
673
793
|
*
|
|
674
|
-
* @param {
|
|
675
|
-
* @param {IDBKeyRange} range
|
|
676
|
-
* @param {boolean} checkCached
|
|
794
|
+
* @param {Key} key
|
|
795
|
+
* @param {import('./IDBKeyRange.js').IDBKeyRangeFull} range
|
|
796
|
+
* @param {boolean} [checkCached]
|
|
677
797
|
* @returns {boolean}
|
|
678
798
|
*/
|
|
679
799
|
function isKeyInRange (key, range, checkCached) {
|
|
@@ -683,21 +803,25 @@ function isKeyInRange (key, range, checkCached) {
|
|
|
683
803
|
const lower = checkCached ? range.__lowerCached : encode(range.lower, true);
|
|
684
804
|
const upper = checkCached ? range.__upperCached : encode(range.upper, true);
|
|
685
805
|
|
|
686
|
-
if (
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
806
|
+
if (!lowerMatch && (
|
|
807
|
+
(range.lowerOpen &&
|
|
808
|
+
encodedKey !== null && lower !== null && encodedKey > lower) ||
|
|
809
|
+
(!range.lowerOpen && (
|
|
810
|
+
(!encodedKey && !lower) ||
|
|
811
|
+
(encodedKey !== null && lower !== null && encodedKey >= lower))
|
|
812
|
+
)
|
|
813
|
+
)) {
|
|
814
|
+
lowerMatch = true;
|
|
693
815
|
}
|
|
694
|
-
if (
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
816
|
+
if (!upperMatch && (
|
|
817
|
+
(range.upperOpen &&
|
|
818
|
+
encodedKey !== null && upper !== null && encodedKey < upper) ||
|
|
819
|
+
(!range.upperOpen && (
|
|
820
|
+
(!encodedKey && !upper) ||
|
|
821
|
+
(encodedKey !== null && upper !== null && encodedKey <= upper))
|
|
822
|
+
)
|
|
823
|
+
)) {
|
|
824
|
+
upperMatch = true;
|
|
701
825
|
}
|
|
702
826
|
|
|
703
827
|
return lowerMatch && upperMatch;
|
|
@@ -720,9 +844,9 @@ function isMultiEntryMatch (encodedEntry, encodedKey) {
|
|
|
720
844
|
|
|
721
845
|
/**
|
|
722
846
|
*
|
|
723
|
-
* @param {
|
|
724
|
-
* @param {IDBKeyRange} range
|
|
725
|
-
* @returns {
|
|
847
|
+
* @param {Key} keyEntry
|
|
848
|
+
* @param {import('./IDBKeyRange.js').IDBKeyRangeFull|undefined} range
|
|
849
|
+
* @returns {Key[]}
|
|
726
850
|
*/
|
|
727
851
|
function findMultiEntryMatches (keyEntry, range) {
|
|
728
852
|
const matches = [];
|
|
@@ -754,15 +878,11 @@ function findMultiEntryMatches (keyEntry, range) {
|
|
|
754
878
|
return matches;
|
|
755
879
|
}
|
|
756
880
|
|
|
757
|
-
/**
|
|
758
|
-
* @typedef {number|string|Date|ArrayBuffer|module:Key.ValueTypes[]} module:Key.ValueTypes
|
|
759
|
-
*/
|
|
760
|
-
|
|
761
881
|
/**
|
|
762
882
|
* Not currently in use but keeping for spec parity.
|
|
763
|
-
* @param {
|
|
883
|
+
* @param {Key} key
|
|
764
884
|
* @throws {Error} Upon a "bad key"
|
|
765
|
-
* @returns {
|
|
885
|
+
* @returns {ValueType}
|
|
766
886
|
*/
|
|
767
887
|
function convertKeyToValue (key) {
|
|
768
888
|
const {type, value} = key;
|
|
@@ -795,8 +915,8 @@ function convertKeyToValue (key) {
|
|
|
795
915
|
|
|
796
916
|
/**
|
|
797
917
|
*
|
|
798
|
-
* @param {
|
|
799
|
-
* @param {boolean} inArray
|
|
918
|
+
* @param {Key} key
|
|
919
|
+
* @param {boolean} [inArray]
|
|
800
920
|
* @returns {string|null}
|
|
801
921
|
*/
|
|
802
922
|
function encode (key, inArray) {
|
|
@@ -810,10 +930,10 @@ function encode (key, inArray) {
|
|
|
810
930
|
|
|
811
931
|
/**
|
|
812
932
|
*
|
|
813
|
-
* @param {
|
|
814
|
-
* @param {boolean} inArray
|
|
933
|
+
* @param {Key} key
|
|
934
|
+
* @param {boolean} [inArray]
|
|
815
935
|
* @throws {Error} Invalid number
|
|
816
|
-
* @returns {undefined|
|
|
936
|
+
* @returns {undefined|ValueType}
|
|
817
937
|
*/
|
|
818
938
|
function decode (key, inArray) {
|
|
819
939
|
if (typeof key !== 'string') {
|
|
@@ -824,9 +944,9 @@ function decode (key, inArray) {
|
|
|
824
944
|
|
|
825
945
|
/**
|
|
826
946
|
*
|
|
827
|
-
* @param {
|
|
828
|
-
* @param {boolean} inArray
|
|
829
|
-
* @returns {undefined|
|
|
947
|
+
* @param {Key} key
|
|
948
|
+
* @param {boolean} [inArray]
|
|
949
|
+
* @returns {undefined|ValueType}
|
|
830
950
|
*/
|
|
831
951
|
function roundTrip (key, inArray) {
|
|
832
952
|
return decode(encode(key, inArray), inArray);
|
|
@@ -835,30 +955,25 @@ function roundTrip (key, inArray) {
|
|
|
835
955
|
const MAX_ALLOWED_CURRENT_NUMBER = 9007199254740992; // 2 ^ 53 (Also equal to `Number.MAX_SAFE_INTEGER + 1`)
|
|
836
956
|
|
|
837
957
|
/**
|
|
838
|
-
* @
|
|
958
|
+
* @typedef {number} Integer
|
|
839
959
|
*/
|
|
840
960
|
|
|
841
|
-
/**
|
|
842
|
-
* @typedef {IDBObjectStore} IDBObjectStoreWithCurrentName
|
|
843
|
-
* @property {string} __currentName
|
|
844
|
-
*/
|
|
845
|
-
|
|
846
961
|
/**
|
|
847
962
|
* @callback CurrentNumberCallback
|
|
848
|
-
* @param {Integer} The current number
|
|
963
|
+
* @param {Integer} cn The current number
|
|
849
964
|
* @returns {void}
|
|
850
965
|
*/
|
|
851
966
|
|
|
852
967
|
/**
|
|
853
968
|
* @callback SQLFailureCallback
|
|
854
|
-
* @param {DOMException} exception
|
|
969
|
+
* @param {DOMException|Error} exception
|
|
855
970
|
* @returns {void}
|
|
856
971
|
*/
|
|
857
972
|
|
|
858
973
|
/**
|
|
859
974
|
*
|
|
860
|
-
* @param {
|
|
861
|
-
* @param {
|
|
975
|
+
* @param {SQLTransaction} tx
|
|
976
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
862
977
|
* @param {CurrentNumberCallback} func
|
|
863
978
|
* @param {SQLFailureCallback} sqlFailCb
|
|
864
979
|
* @returns {void}
|
|
@@ -878,13 +993,14 @@ function getCurrentNumber (tx, store, func, sqlFailCb) {
|
|
|
878
993
|
'Could not get the auto increment value for key',
|
|
879
994
|
error
|
|
880
995
|
));
|
|
996
|
+
return true;
|
|
881
997
|
});
|
|
882
998
|
}
|
|
883
999
|
|
|
884
1000
|
/**
|
|
885
1001
|
*
|
|
886
|
-
* @param {
|
|
887
|
-
* @param {
|
|
1002
|
+
* @param {SQLTransaction} tx
|
|
1003
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
888
1004
|
* @param {Integer} num
|
|
889
1005
|
* @param {CurrentNumberCallback} successCb
|
|
890
1006
|
* @param {SQLFailureCallback} failCb
|
|
@@ -898,6 +1014,7 @@ function assignCurrentNumber (tx, store, num, successCb, failCb) {
|
|
|
898
1014
|
successCb(num);
|
|
899
1015
|
}, function (tx, err) {
|
|
900
1016
|
failCb(createDOMException('UnknownError', 'Could not set the auto increment value for key', err));
|
|
1017
|
+
return true;
|
|
901
1018
|
});
|
|
902
1019
|
}
|
|
903
1020
|
|
|
@@ -905,8 +1022,8 @@ function assignCurrentNumber (tx, store, num, successCb, failCb) {
|
|
|
905
1022
|
* Bump up the auto-inc counter if the key path-resolved value is valid
|
|
906
1023
|
* (greater than old value and >=1) OR if a manually passed in key is
|
|
907
1024
|
* valid (numeric and >= 1) and >= any primaryKey.
|
|
908
|
-
* @param {
|
|
909
|
-
* @param {
|
|
1025
|
+
* @param {SQLTransaction} tx
|
|
1026
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
910
1027
|
* @param {Integer} num
|
|
911
1028
|
* @param {CurrentNumberCallback} successCb
|
|
912
1029
|
* @param {SQLFailureCallback} failCb
|
|
@@ -929,8 +1046,8 @@ function setCurrentNumber (tx, store, num, successCb, failCb) {
|
|
|
929
1046
|
|
|
930
1047
|
/**
|
|
931
1048
|
*
|
|
932
|
-
* @param {
|
|
933
|
-
* @param {
|
|
1049
|
+
* @param {SQLTransaction} tx
|
|
1050
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
934
1051
|
* @param {KeyForStoreCallback} cb
|
|
935
1052
|
* @param {SQLFailureCallback} sqlFailCb
|
|
936
1053
|
* @returns {void}
|
|
@@ -959,10 +1076,10 @@ function generateKeyForStore (tx, store, cb, sqlFailCb) {
|
|
|
959
1076
|
// so we do not return a key
|
|
960
1077
|
/**
|
|
961
1078
|
*
|
|
962
|
-
* @param {
|
|
963
|
-
* @param {
|
|
964
|
-
* @param {
|
|
965
|
-
* @param {
|
|
1079
|
+
* @param {SQLTransaction} tx
|
|
1080
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
1081
|
+
* @param {import('./Key.js').Key} key
|
|
1082
|
+
* @param {(num?: Integer) => void} successCb
|
|
966
1083
|
* @param {SQLFailureCallback} sqlFailCb
|
|
967
1084
|
* @returns {void}
|
|
968
1085
|
*/
|