indexeddbshim 12.0.0 → 13.0.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.
Files changed (101) hide show
  1. package/README.md +1 -1
  2. package/badges/licenses-badge-dev.svg +1 -1
  3. package/dist/CFG.d.ts +80 -0
  4. package/dist/CFG.d.ts.map +1 -0
  5. package/dist/DOMException.d.ts +71 -0
  6. package/dist/DOMException.d.ts.map +1 -0
  7. package/dist/DOMStringList.d.ts +20 -0
  8. package/dist/DOMStringList.d.ts.map +1 -0
  9. package/dist/Event.d.ts +21 -0
  10. package/dist/Event.d.ts.map +1 -0
  11. package/dist/IDBCursor.d.ts +288 -0
  12. package/dist/IDBCursor.d.ts.map +1 -0
  13. package/dist/IDBDatabase.d.ts +143 -0
  14. package/dist/IDBDatabase.d.ts.map +1 -0
  15. package/dist/IDBFactory.d.ts +96 -0
  16. package/dist/IDBFactory.d.ts.map +1 -0
  17. package/dist/IDBIndex.d.ts +243 -0
  18. package/dist/IDBIndex.d.ts.map +1 -0
  19. package/dist/IDBKeyRange.d.ts +79 -0
  20. package/dist/IDBKeyRange.d.ts.map +1 -0
  21. package/dist/IDBObjectStore.d.ts +273 -0
  22. package/dist/IDBObjectStore.d.ts.map +1 -0
  23. package/dist/IDBRequest.d.ts +88 -0
  24. package/dist/IDBRequest.d.ts.map +1 -0
  25. package/dist/IDBTransaction.d.ts +270 -0
  26. package/dist/IDBTransaction.d.ts.map +1 -0
  27. package/dist/IDBVersionChangeEvent.d.ts +22 -0
  28. package/dist/IDBVersionChangeEvent.d.ts.map +1 -0
  29. package/dist/Key.d.ts +214 -0
  30. package/dist/Key.d.ts.map +1 -0
  31. package/dist/Sca.d.ts +31 -0
  32. package/dist/Sca.d.ts.map +1 -0
  33. package/dist/UnicodeIdentifiers.d.ts +3 -0
  34. package/dist/UnicodeIdentifiers.d.ts.map +1 -0
  35. package/dist/browser-UnicodeIdentifiers.d.ts +2 -0
  36. package/dist/browser-UnicodeIdentifiers.d.ts.map +1 -0
  37. package/dist/browser-noninvasive.d.ts +3 -0
  38. package/dist/browser-noninvasive.d.ts.map +1 -0
  39. package/dist/browser.d.ts +2 -0
  40. package/dist/browser.d.ts.map +1 -0
  41. package/dist/cmp.d.ts +9 -0
  42. package/dist/cmp.d.ts.map +1 -0
  43. package/dist/indexeddbshim-Key.js +553 -252
  44. package/dist/indexeddbshim-Key.js.map +1 -1
  45. package/dist/indexeddbshim-Key.min.js +2 -2
  46. package/dist/indexeddbshim-Key.min.js.map +1 -1
  47. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +17560 -1302
  48. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  49. package/dist/indexeddbshim-UnicodeIdentifiers.js +4367 -1604
  50. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  51. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
  52. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  53. package/dist/indexeddbshim-node.cjs +17556 -1302
  54. package/dist/indexeddbshim-node.cjs.map +1 -1
  55. package/dist/indexeddbshim-noninvasive.js +4362 -1604
  56. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  57. package/dist/indexeddbshim-noninvasive.min.js +2 -2
  58. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  59. package/dist/indexeddbshim.js +4362 -1604
  60. package/dist/indexeddbshim.js.map +1 -1
  61. package/dist/indexeddbshim.min.js +2 -2
  62. package/dist/indexeddbshim.min.js.map +1 -1
  63. package/dist/node-UnicodeIdentifiers.d.ts +8 -0
  64. package/dist/node-UnicodeIdentifiers.d.ts.map +1 -0
  65. package/dist/node.d.ts +8 -0
  66. package/dist/node.d.ts.map +1 -0
  67. package/dist/nodeWebSQL.d.ts +3 -0
  68. package/dist/nodeWebSQL.d.ts.map +1 -0
  69. package/dist/setGlobalVars.d.ts +79 -0
  70. package/dist/setGlobalVars.d.ts.map +1 -0
  71. package/dist/unicode-regex.d.ts +3 -0
  72. package/dist/unicode-regex.d.ts.map +1 -0
  73. package/dist/util.d.ts +174 -0
  74. package/dist/util.d.ts.map +1 -0
  75. package/index.html +1 -1
  76. package/package.json +51 -37
  77. package/src/CFG.js +89 -11
  78. package/src/DOMException.js +117 -31
  79. package/src/DOMStringList.js +93 -3
  80. package/src/Event.js +19 -4
  81. package/src/IDBCursor.js +350 -76
  82. package/src/IDBDatabase.js +88 -10
  83. package/src/IDBFactory.js +331 -61
  84. package/src/IDBIndex.js +393 -110
  85. package/src/IDBKeyRange.js +90 -17
  86. package/src/IDBObjectStore.js +347 -86
  87. package/src/IDBRequest.js +59 -1
  88. package/src/IDBTransaction.js +254 -46
  89. package/src/IDBVersionChangeEvent.js +28 -3
  90. package/src/Key.d.ts +1 -0
  91. package/src/Key.js +272 -162
  92. package/src/Sca.js +29 -4
  93. package/src/browser-UnicodeIdentifiers.js +5 -1
  94. package/src/cmp.js +5 -5
  95. package/src/node-UnicodeIdentifiers.js +9 -0
  96. package/src/node.js +5 -0
  97. package/src/nodeWebSQL.js +11 -5
  98. package/src/setGlobalVars.js +159 -22
  99. package/src/unicode-regex.js +2 -0
  100. package/src/util.js +229 -40
  101. package/typings/shimIndexedDB.d.ts +9 -0
@@ -1,4 +1,4 @@
1
- import SyncPromise from 'sync-promise';
1
+ import SyncPromise from 'sync-promise-expanded';
2
2
  import {createDOMException} from './DOMException.js';
3
3
  import {IDBCursor, IDBCursorWithValue} from './IDBCursor.js';
4
4
  import {setSQLForKeyRange, convertValueToKeyRange} from './IDBKeyRange.js';
@@ -12,22 +12,63 @@ import CFG from './CFG.js';
12
12
 
13
13
  const readonlyProperties = ['keyPath', 'indexNames', 'transaction', 'autoIncrement'];
14
14
 
15
- /* eslint-disable jsdoc/check-param-names */
15
+ /**
16
+ * @typedef {number} Integer
17
+ */
18
+
16
19
  /**
17
20
  * IndexedDB Object Store.
18
21
  * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore
19
- * @param {IDBObjectStoreProperties} storeProperties
20
- * @param {IDBTransaction} transaction
21
22
  * @class
22
23
  */
23
24
  function IDBObjectStore () {
24
- /* eslint-enable jsdoc/check-param-names */
25
25
  throw new TypeError('Illegal constructor');
26
26
  }
27
27
  const IDBObjectStoreAlias = IDBObjectStore;
28
+
29
+ /**
30
+ * @typedef {IDBObjectStore & {
31
+ * name: string,
32
+ * keyPath: import('./Key.js').KeyPath,
33
+ * transaction?: import('./IDBTransaction.js').IDBTransactionFull,
34
+ * indexNames: import('./DOMStringList.js').DOMStringListFull,
35
+ * autoIncrement: boolean,
36
+ * __autoIncrement: boolean,
37
+ * __indexes: {[key: string]: import('./IDBIndex.js').IDBIndexFull},
38
+ * __indexHandles: {[key: string]: import('./IDBIndex.js').IDBIndexFull},
39
+ * __indexNames: import('./DOMStringList.js').DOMStringListFull,
40
+ * __oldIndexNames: import('./DOMStringList.js').DOMStringListFull,
41
+ * __transaction?: import('./IDBTransaction.js').IDBTransactionFull,
42
+ * __name: string,
43
+ * __keyPath: import('./Key.js').KeyPath,
44
+ * __originalName: string,
45
+ * __currentName: string,
46
+ * __pendingName?: string,
47
+ * __pendingDelete?: boolean,
48
+ * __pendingCreate?: boolean,
49
+ * __deleted?: boolean,
50
+ * __cursors: (
51
+ * import('./IDBCursor.js').IDBCursorFull|
52
+ * import('./IDBCursor.js').IDBCursorWithValueFull
53
+ * )[],
54
+ * __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
55
+ * }} IDBObjectStoreFull
56
+ */
57
+
58
+ /**
59
+ *
60
+ * @param {import('./IDBDatabase.js').IDBObjectStoreProperties} storeProperties
61
+ * @param {import('./IDBTransaction.js').IDBTransactionFull} [transaction]
62
+ * @returns {IDBObjectStoreFull}
63
+ */
28
64
  IDBObjectStore.__createInstance = function (storeProperties, transaction) {
65
+ /**
66
+ * @class
67
+ * @this {IDBObjectStoreFull}
68
+ */
29
69
  function IDBObjectStore () {
30
70
  const me = this;
71
+ // @ts-expect-error It's ok
31
72
  me[Symbol.toStringTag] = 'IDBObjectStore';
32
73
  util.defineReadonlyProperties(this, readonlyProperties);
33
74
  me.__name = me.__originalName = storeProperties.name;
@@ -44,7 +85,7 @@ IDBObjectStore.__createInstance = function (storeProperties, transaction) {
44
85
  me.__indexNames = DOMStringList.__createInstance();
45
86
  const {indexList} = storeProperties;
46
87
  for (const indexName in indexList) {
47
- if (util.hasOwn(indexList, indexName)) {
88
+ if (Object.hasOwn(indexList, indexName)) {
48
89
  const index = IDBIndex.__createInstance(me, indexList[indexName]);
49
90
  me.__indexes[index.name] = index;
50
91
  if (!index.__deleted) {
@@ -61,9 +102,18 @@ IDBObjectStore.__createInstance = function (storeProperties, transaction) {
61
102
  Object.defineProperty(this, 'name', {
62
103
  enumerable: false,
63
104
  configurable: false,
105
+ /**
106
+ * @this {IDBObjectStoreFull}
107
+ * @returns {string}
108
+ */
64
109
  get () {
65
110
  return this.__name;
66
111
  },
112
+ /**
113
+ * @param {string} name
114
+ * @this {IDBObjectStoreFull}
115
+ * @returns {void}
116
+ */
67
117
  set (name) {
68
118
  const me = this;
69
119
  name = util.convertToDOMString(name);
@@ -87,41 +137,51 @@ IDBObjectStore.__createInstance = function (storeProperties, transaction) {
87
137
 
88
138
  me.__idbdb.objectStoreNames.splice(me.__idbdb.objectStoreNames.indexOf(oldName), 1, name);
89
139
 
90
- const oldHandle = me.transaction.__storeHandles[oldName];
140
+ const oldHandle = /** @type {IDBObjectStoreFull} */ (
141
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
142
+ me.transaction
143
+ ).__storeHandles[oldName]
144
+ );
91
145
  oldHandle.__name = name; // Fix old references
92
- me.transaction.__storeHandles[name] = oldHandle; // Ensure new reference accessible
146
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
147
+ me.transaction
148
+ ).__storeHandles[name] = oldHandle; // Ensure new reference accessible
93
149
 
94
150
  me.__pendingName = oldName;
95
151
 
96
152
  const sql = 'UPDATE __sys__ SET "name" = ? WHERE "name" = ?';
97
153
  const sqlValues = [util.escapeSQLiteStatement(name), util.escapeSQLiteStatement(oldName)];
98
- CFG.DEBUG && console.log(sql, sqlValues);
99
- me.transaction.__addNonRequestToTransactionQueue(function objectStoreClear (tx, args, success, error) {
100
- tx.executeSql(sql, sqlValues, function (tx, data) {
154
+ if (CFG.DEBUG) { console.log(sql, sqlValues); }
155
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
156
+ me.transaction
157
+ ).__addNonRequestToTransactionQueue(function objectStoreClear (tx, args, success, error) {
158
+ tx.executeSql(sql, sqlValues, function (tx) {
101
159
  // This SQL preserves indexes per https://www.sqlite.org/lang_altertable.html
102
160
  const sql = 'ALTER TABLE ' + util.escapeStoreNameForSQL(oldName) + ' RENAME TO ' + util.escapeStoreNameForSQL(name);
103
- CFG.DEBUG && console.log(sql);
104
- tx.executeSql(sql, [], function (tx, data) {
161
+ if (CFG.DEBUG) { console.log(sql); }
162
+ tx.executeSql(sql, [], function () {
105
163
  delete me.__pendingName;
106
164
  success();
107
165
  });
108
166
  }, function (tx, err) {
109
167
  error(err);
168
+ return false;
110
169
  });
111
170
  });
112
171
  }
113
172
  });
114
173
  }
115
174
  IDBObjectStore.prototype = IDBObjectStoreAlias.prototype;
175
+
176
+ // @ts-expect-error It's ok
116
177
  return new IDBObjectStore();
117
178
  };
118
179
 
119
180
  /**
120
181
  * Clones an IDBObjectStore instance for a different IDBTransaction instance.
121
- * @param {IDBObjectStore} store
122
- * @param {IDBTransaction} transaction
123
- * @protected
124
- * @returns {IDBObjectStore}
182
+ * @param {IDBObjectStoreFull} store
183
+ * @param {import('./IDBTransaction.js').IDBTransactionFull} transaction
184
+ * @returns {IDBObjectStoreFull}
125
185
  */
126
186
  IDBObjectStore.__clone = function (store, transaction) {
127
187
  const newStore = IDBObjectStore.__createInstance({
@@ -133,23 +193,37 @@ IDBObjectStore.__clone = function (store, transaction) {
133
193
  cursors: store.__cursors
134
194
  }, transaction);
135
195
 
136
- ['__indexes', '__indexNames', '__oldIndexNames', '__deleted', '__pendingDelete', '__pendingCreate', '__originalName'].forEach((p) => {
196
+ /** @type {const} */ ([
197
+ '__indexes', '__indexNames', '__oldIndexNames',
198
+ '__deleted', '__pendingDelete', '__pendingCreate', '__originalName'
199
+ ]).forEach((p) => {
200
+ // @ts-expect-error It's ok
137
201
  newStore[p] = store[p];
138
202
  });
139
203
  return newStore;
140
204
  };
141
205
 
206
+ /**
207
+ *
208
+ * @param {IDBObjectStoreFull|import('./IDBIndex.js').IDBIndexFull} store
209
+ * @param {string} [msg]
210
+ * @throws {DOMException}
211
+ * @returns {void}
212
+ */
142
213
  IDBObjectStore.__invalidStateIfDeleted = function (store, msg) {
143
- if (store.__deleted || store.__pendingDelete || (store.__pendingCreate && (store.transaction && store.transaction.__errored))) {
214
+ if (
215
+ store.__deleted || store.__pendingDelete || (store.__pendingCreate && (
216
+ 'transaction' in store && store.transaction && store.transaction.__errored
217
+ ))
218
+ ) {
144
219
  throw createDOMException('InvalidStateError', msg || 'This store has been deleted');
145
220
  }
146
221
  };
147
222
 
148
223
  /**
149
224
  * Creates a new object store in the database.
150
- * @param {IDBDatabase} db
151
- * @param {IDBObjectStore} store
152
- * @protected
225
+ * @param {import('./IDBDatabase.js').IDBDatabaseFull} db
226
+ * @param {IDBObjectStoreFull} store
153
227
  * @returns {IDBObjectStore}
154
228
  */
155
229
  IDBObjectStore.__createObjectStore = function (db, store) {
@@ -160,7 +234,9 @@ IDBObjectStore.__createObjectStore = function (db, store) {
160
234
  db.objectStoreNames.push(storeName);
161
235
 
162
236
  // Add the object store to WebSQL
163
- const transaction = db.__versionTransaction;
237
+ const transaction =/** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
238
+ db.__versionTransaction
239
+ );
164
240
 
165
241
  const storeHandles = transaction.__storeHandles;
166
242
  if (!storeHandles[storeName] ||
@@ -172,16 +248,25 @@ IDBObjectStore.__createObjectStore = function (db, store) {
172
248
  }
173
249
 
174
250
  transaction.__addNonRequestToTransactionQueue(function createObjectStore (tx, args, success, failure) {
251
+ /**
252
+ * @param {SQLTransaction} tx
253
+ * @param {SQLError} [err]
254
+ * @returns {boolean}
255
+ */
175
256
  function error (tx, err) {
176
- CFG.DEBUG && console.log(err);
257
+ if (CFG.DEBUG) { console.log(err); }
177
258
  failure(createDOMException('UnknownError', 'Could not create object store "' + storeName + '"', err));
259
+ return false;
178
260
  }
179
261
 
180
262
  const escapedStoreNameSQL = util.escapeStoreNameForSQL(storeName);
181
263
  // key INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE
182
264
  const sql = ['CREATE TABLE', escapedStoreNameSQL, '(key BLOB', store.autoIncrement ? 'UNIQUE, inc INTEGER PRIMARY KEY AUTOINCREMENT' : 'PRIMARY KEY', ', value BLOB)'].join(' ');
183
- CFG.DEBUG && console.log(sql);
184
- tx.executeSql(sql, [], function (tx, data) {
265
+ if (CFG.DEBUG) { console.log(sql); }
266
+ tx.executeSql(sql, [], function (tx) {
267
+ /**
268
+ * @returns {void}
269
+ */
185
270
  function insertStoreInfo () {
186
271
  const encodedKeyPath = JSON.stringify(store.keyPath);
187
272
  tx.executeSql('INSERT INTO __sys__ VALUES (?,?,?,?,?)', [
@@ -213,9 +298,8 @@ IDBObjectStore.__createObjectStore = function (db, store) {
213
298
 
214
299
  /**
215
300
  * Deletes an object store from the database.
216
- * @param {IDBDatabase} db
217
- * @param {IDBObjectStore} store
218
- * @protected
301
+ * @param {import('./IDBDatabase.js').IDBDatabaseFull} db
302
+ * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
219
303
  * @returns {void}
220
304
  */
221
305
  IDBObjectStore.__deleteObjectStore = function (db, store) {
@@ -233,11 +317,19 @@ IDBObjectStore.__deleteObjectStore = function (db, store) {
233
317
  }
234
318
 
235
319
  // Remove the object store from WebSQL
236
- const transaction = db.__versionTransaction;
320
+ const transaction = /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
321
+ db.__versionTransaction
322
+ );
237
323
  transaction.__addNonRequestToTransactionQueue(function deleteObjectStore (tx, args, success, failure) {
324
+ /**
325
+ * @param {SQLTransaction} tx
326
+ * @param {SQLError} [err]
327
+ * @returns {boolean}
328
+ */
238
329
  function error (tx, err) {
239
- CFG.DEBUG && console.log(err);
330
+ if (CFG.DEBUG) { console.log(err); }
240
331
  failure(createDOMException('UnknownError', 'Could not delete ObjectStore', err));
332
+ return false;
241
333
  }
242
334
 
243
335
  tx.executeSql('SELECT "name" FROM __sys__ WHERE "name" = ?', [util.escapeSQLiteStatement(store.__currentName)], function (tx, data) {
@@ -259,10 +351,8 @@ IDBObjectStore.__deleteObjectStore = function (db, store) {
259
351
  };
260
352
 
261
353
  /**
262
- * @typedef {GenericArray} KeyValueArray
263
- * @property {module:Key.Key} 0
264
- * @property {*} 1
265
- */
354
+ * @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
355
+ */
266
356
 
267
357
  // Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
268
358
  // and we'll want to ensure the queue starts up synchronously, we nevertheless do the cloning
@@ -275,18 +365,18 @@ IDBObjectStore.__deleteObjectStore = function (db, store) {
275
365
  /**
276
366
  * Determines whether the given inline or out-of-line key is valid,
277
367
  * according to the object store's schema.
278
- * @param {*} value Used for inline keys
279
- * @param {*} key Used for out-of-line keys
368
+ * @param {import('./Key.js').Value} value Used for inline keys
369
+ * @param {import('./Key.js').Key} key Used for out-of-line keys
280
370
  * @param {boolean} cursorUpdate
281
371
  * @throws {DOMException}
372
+ * @this {IDBObjectStoreFull}
282
373
  * @returns {KeyValueArray}
283
- * @private
284
374
  */
285
375
  IDBObjectStore.prototype.__validateKeyAndValueAndCloneValue = function (value, key, cursorUpdate) {
286
376
  const me = this;
287
377
  if (me.keyPath !== null) {
288
378
  if (key !== undefined) {
289
- throw createDOMException('DataError', 'The object store uses in-line keys and the key parameter was provided', me);
379
+ throw createDOMException('DataError', 'The object store uses in-line keys and the key parameter was provided');
290
380
  }
291
381
  // Todo Binary: Avoid blobs loading async to ensure cloning (and errors therein)
292
382
  // occurs sync; then can make cloning and this method without callbacks (except where ok
@@ -301,7 +391,8 @@ IDBObjectStore.prototype.__validateKeyAndValueAndCloneValue = function (value, k
301
391
  if (!me.autoIncrement) {
302
392
  throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
303
393
  }
304
- if (!Key.checkKeyCouldBeInjectedIntoValue(clonedValue, me.keyPath)) {
394
+ // Todo: Could the keyPath not be an array?
395
+ if (!Key.checkKeyCouldBeInjectedIntoValue(clonedValue, /** @type {string} */ (me.keyPath))) {
305
396
  throw createDOMException('DataError', 'A key could not be injected into a value');
306
397
  }
307
398
  // A key will be generated
@@ -314,7 +405,7 @@ IDBObjectStore.prototype.__validateKeyAndValueAndCloneValue = function (value, k
314
405
  }
315
406
  if (key === undefined) {
316
407
  if (!me.autoIncrement) {
317
- throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.', me);
408
+ throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
318
409
  }
319
410
  // A key will be generated
320
411
  key = undefined;
@@ -330,17 +421,22 @@ IDBObjectStore.prototype.__validateKeyAndValueAndCloneValue = function (value, k
330
421
  * the object store
331
422
  * If the table has auto increment, get the current number (unless it has
332
423
  * a keyPath leading to a valid but non-numeric or < 1 key).
333
- * @param {Object} tx
334
- * @param {Object} value
335
- * @param {Object} key
336
- * @param {function} success
337
- * @param {function} failCb
424
+ * @param {SQLTransaction} tx
425
+ * @param {import('./Key.js').Value} value
426
+ * @param {import('./Key.js').Key} key
427
+ * @param {(key: import('./Key.js').Key, cn?: Integer) => void} success
428
+ * @param {import('./Key.js').SQLFailureCallback} failCb
429
+ * @this {IDBObjectStoreFull}
338
430
  * @returns {void}
339
431
  */
340
432
  IDBObjectStore.prototype.__deriveKey = function (tx, value, key, success, failCb) {
341
433
  const me = this;
342
434
 
343
435
  // Only run if cloning is needed
436
+ /**
437
+ * @param {Integer} [oldCn]
438
+ * @returns {void}
439
+ */
344
440
  function keyCloneThenSuccess (oldCn) { // We want to return the original key, so we don't need to accept an argument here
345
441
  Sca.encode(key, function (key) {
346
442
  key = Sca.decode(key);
@@ -351,6 +447,7 @@ IDBObjectStore.prototype.__deriveKey = function (tx, value, key, success, failCb
351
447
  if (me.autoIncrement) {
352
448
  // If auto-increment and no valid primaryKey found on the keyPath, get and set the new value, and use
353
449
  if (key === undefined) {
450
+ // @ts-expect-error Due to re-exporting `Key.d.ts` file (needed for `node_modules` imports)
354
451
  Key.generateKeyForStore(tx, me, function (failure, key, oldCn) {
355
452
  if (failure) {
356
453
  failCb(createDOMException('ConstraintError', 'The key generator\'s current number has reached the maximum safe integer limit'));
@@ -358,11 +455,15 @@ IDBObjectStore.prototype.__deriveKey = function (tx, value, key, success, failCb
358
455
  }
359
456
  if (me.keyPath !== null) {
360
457
  // Should not throw now as checked earlier
361
- Key.injectKeyIntoValueUsingKeyPath(value, key, me.keyPath);
458
+ // Todo: Could this not be an array here?
459
+ Key.injectKeyIntoValueUsingKeyPath(
460
+ value, key, /** @type {string} */ (me.keyPath)
461
+ );
362
462
  }
363
463
  success(key, oldCn);
364
464
  }, failCb);
365
465
  } else {
466
+ // @ts-expect-error Due to re-exporting `Key.d.ts` file (needed for `node_modules` imports)
366
467
  Key.possiblyUpdateKeyGenerator(tx, me, key, keyCloneThenSuccess, failCb);
367
468
  }
368
469
  // Not auto-increment
@@ -371,10 +472,25 @@ IDBObjectStore.prototype.__deriveKey = function (tx, value, key, success, failCb
371
472
  }
372
473
  };
373
474
 
475
+ /**
476
+ *
477
+ * @param {SQLTransaction} tx
478
+ * @param {string} encoded
479
+ * @param {import('./Key.js').Value} value
480
+ * @param {import('./Key.js').Key|Integer} clonedKeyOrCurrentNumber
481
+ * @param {Integer|undefined} oldCn
482
+ * @param {(
483
+ * clonedKeyOrCurrentNumber: import('./Key.js').Key|Integer
484
+ * ) => void} success
485
+ * @param {(err: Error|DOMException) => void} error
486
+ * @this {IDBObjectStoreFull}
487
+ * @returns {SyncPromise}
488
+ */
374
489
  IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, success, error) {
375
490
  const me = this;
376
491
  // The `ConstraintError` to occur for `add` upon a duplicate will occur naturally in attempting an insert
377
492
  // We process the index information first as it will stored in the same table as the store
493
+ /** @type {{[key: string]: string}} */
378
494
  const paramMap = {};
379
495
  const indexPromises = Object.keys(
380
496
  // We do not iterate `indexNames` as those can be modified synchronously (e.g.,
@@ -403,25 +519,38 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
403
519
  // after this add), we avoid checks
404
520
  index.__deleted
405
521
  ) {
406
- resolve();
522
+ resolve(undefined);
407
523
  return;
408
524
  }
525
+ /**
526
+ * @type {import('./Key.js').KeyValueObject|
527
+ * import('./Key.js').KeyPathEvaluateValue}
528
+ */
409
529
  let indexKey;
410
530
  try {
411
531
  indexKey = Key.extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Add as necessary to this and skip past this index if exceptions here)
412
- if (indexKey.invalid || indexKey.failure) {
532
+ if (
533
+ ('invalid' in indexKey && indexKey.invalid) ||
534
+ ('failure' in indexKey && indexKey.failure)
535
+ ) {
413
536
  throw new Error('Go to catch');
414
537
  }
415
538
  } catch (err) {
416
- resolve();
539
+ resolve(undefined);
417
540
  return;
418
541
  }
419
542
  indexKey = indexKey.value;
543
+ /**
544
+ * @param {import('./IDBIndex.js').IDBIndexFull} index
545
+ * @returns {void}
546
+ */
420
547
  function setIndexInfo (index) {
421
548
  if (indexKey === undefined) {
422
549
  return;
423
550
  }
424
- paramMap[index.__currentName] = Key.encode(indexKey, index.multiEntry);
551
+ paramMap[index.__currentName] = /** @type {string} */ (
552
+ Key.encode(indexKey, index.multiEntry)
553
+ );
425
554
  }
426
555
  if (index.unique) {
427
556
  const multiCheck = index.multiEntry && Array.isArray(indexKey);
@@ -429,7 +558,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
429
558
  executeFetchIndexData(null, ...fetchArgs, tx, null, function success (key) {
430
559
  if (key === undefined) {
431
560
  setIndexInfo(index);
432
- resolve();
561
+ resolve(undefined);
433
562
  return;
434
563
  }
435
564
  reject(createDOMException(
@@ -441,7 +570,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
441
570
  }, reject);
442
571
  } else {
443
572
  setIndexInfo(index);
444
- resolve();
573
+ resolve(undefined);
445
574
  }
446
575
  });
447
576
  });
@@ -455,7 +584,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
455
584
  sqlEnd.push('?,');
456
585
  insertSqlValues.push(
457
586
  util.escapeSQLiteStatement(
458
- Key.encode(clonedKeyOrCurrentNumber)
587
+ /** @type {string} */ (Key.encode(clonedKeyOrCurrentNumber))
459
588
  )
460
589
  );
461
590
  }
@@ -470,29 +599,43 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
470
599
  insertSqlValues.push(util.escapeSQLiteStatement(encoded));
471
600
 
472
601
  const insertSql = sqlStart.join(' ') + sqlEnd.join(' ');
473
- CFG.DEBUG && console.log('SQL for adding', insertSql, insertSqlValues);
602
+ if (CFG.DEBUG) { console.log('SQL for adding', insertSql, insertSqlValues); }
474
603
 
475
- tx.executeSql(insertSql, insertSqlValues, function (tx, data) {
604
+ tx.executeSql(insertSql, insertSqlValues, function () {
476
605
  success(clonedKeyOrCurrentNumber);
477
606
  }, function (tx, err) {
478
607
  // Should occur for `add` operation
479
- error(createDOMException('ConstraintError', err.message, err));
608
+ error(createDOMException(
609
+ 'ConstraintError', /** @type {string} */ (err.message), err
610
+ ));
611
+ return false;
480
612
  });
481
613
  return undefined;
482
614
  }).catch(function (err) {
615
+ /**
616
+ * @returns {void}
617
+ */
483
618
  function fail () {
484
619
  // Todo: Add a different error object here if `assignCurrentNumber`
485
620
  // fails in reverting?
486
621
  error(err);
487
622
  }
488
623
  if (typeof oldCn === 'number') {
624
+ // @ts-expect-error Due to re-exporting `Key.d.ts` file (needed for `node_modules` imports)
489
625
  Key.assignCurrentNumber(tx, me, oldCn, fail, fail);
490
- return;
626
+ return null;
491
627
  }
492
628
  fail();
629
+ return null;
493
630
  });
494
631
  };
495
632
 
633
+ /**
634
+ *
635
+ * @param {import('./Key.js').Value} value
636
+ * @this {IDBObjectStoreFull}
637
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
638
+ */
496
639
  IDBObjectStore.prototype.add = function (value /* , key */) {
497
640
  const me = this;
498
641
  // eslint-disable-next-line prefer-rest-params
@@ -505,15 +648,26 @@ IDBObjectStore.prototype.add = function (value /* , key */) {
505
648
  }
506
649
  IDBObjectStore.__invalidStateIfDeleted(me);
507
650
  IDBTransaction.__assertActive(me.transaction);
508
- me.transaction.__assertWritable();
651
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
652
+ me.transaction
653
+ ).__assertWritable();
509
654
 
510
- const request = me.transaction.__createRequest(me);
655
+ const request = /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
656
+ me.transaction
657
+ ).__createRequest(me);
511
658
  const [ky, clonedValue] = me.__validateKeyAndValueAndCloneValue(value, key, false);
512
659
  IDBObjectStore.__storingRecordObjectStore(request, me, true, clonedValue, true, ky);
513
660
  return request;
514
661
  };
515
662
 
516
- IDBObjectStore.prototype.put = function (value /*, key */) {
663
+ /**
664
+ *
665
+ * @param {import('./Key.js').Value} value
666
+ * @throws {TypeError}
667
+ * @this {IDBObjectStoreFull}
668
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
669
+ */
670
+ IDBObjectStore.prototype.put = function (value /* , key */) {
517
671
  const me = this;
518
672
  // eslint-disable-next-line prefer-rest-params
519
673
  const key = arguments[1];
@@ -525,34 +679,63 @@ IDBObjectStore.prototype.put = function (value /*, key */) {
525
679
  }
526
680
  IDBObjectStore.__invalidStateIfDeleted(me);
527
681
  IDBTransaction.__assertActive(me.transaction);
528
- me.transaction.__assertWritable();
682
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
683
+ me.transaction
684
+ ).__assertWritable();
529
685
 
530
- const request = me.transaction.__createRequest(me);
686
+ const request = /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
687
+ me.transaction
688
+ ).__createRequest(me);
531
689
  const [ky, clonedValue] = me.__validateKeyAndValueAndCloneValue(value, key, false);
532
690
  IDBObjectStore.__storingRecordObjectStore(request, me, true, clonedValue, false, ky);
533
691
  return request;
534
692
  };
535
693
 
694
+ /**
695
+ *
696
+ * @param {SQLTransaction} tx
697
+ * @param {import('./Key.js').Key} key
698
+ * @param {(tx: SQLTransaction) => void} cb
699
+ * @param {(err: SQLError) => void} error
700
+ * @this {IDBObjectStoreFull}
701
+ * @returns {void}
702
+ */
536
703
  IDBObjectStore.prototype.__overwrite = function (tx, key, cb, error) {
537
704
  const me = this;
538
705
  // First try to delete if the record exists
539
706
  // Key.convertValueToKey(key); // Already run
540
707
  const sql = 'DELETE FROM ' + util.escapeStoreNameForSQL(me.__currentName) + ' WHERE "key" = ?';
541
- const encodedKey = Key.encode(key);
708
+ const encodedKey = /** @type {string} */ (Key.encode(key));
542
709
  tx.executeSql(sql, [util.escapeSQLiteStatement(encodedKey)], function (tx, data) {
543
- CFG.DEBUG && console.log('Did the row with the', key, 'exist?', data.rowsAffected);
710
+ if (CFG.DEBUG) { console.log('Did the row with the', key, 'exist?', data.rowsAffected); }
544
711
  cb(tx);
545
712
  }, function (tx, err) {
546
713
  error(err);
714
+ return false;
547
715
  });
548
716
  };
549
717
 
718
+ /**
719
+ *
720
+ * @param {import('./IDBRequest.js').IDBRequestFull} request
721
+ * @param {IDBObjectStoreFull} store
722
+ * @param {boolean} invalidateCache
723
+ * @param {import('./Key.js').Value} value
724
+ * @param {boolean} noOverwrite
725
+ * @returns {void}
726
+ */
550
727
  IDBObjectStore.__storingRecordObjectStore = function (request, store, invalidateCache, value, noOverwrite /* , key */) {
551
728
  // eslint-disable-next-line prefer-rest-params
552
729
  const key = arguments[5];
553
- store.transaction.__pushToQueue(request, function (tx, args, success, error) {
730
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
731
+ store.transaction
732
+ ).__pushToQueue(request, function (tx, args, success, error) {
554
733
  store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
555
734
  Sca.encode(value, function (encoded) {
735
+ /**
736
+ * @param {SQLTransaction} tx
737
+ * @returns {void}
738
+ */
556
739
  function insert (tx) {
557
740
  store.__insertData(tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, function (...args) {
558
741
  if (invalidateCache) {
@@ -573,6 +756,15 @@ IDBObjectStore.__storingRecordObjectStore = function (request, store, invalidate
573
756
  });
574
757
  };
575
758
 
759
+ /**
760
+ *
761
+ * @param {import('./Key.js').Value} query
762
+ * @param {boolean} [getKey]
763
+ * @param {boolean} [getAll]
764
+ * @param {Integer} [count]
765
+ * @this {IDBObjectStoreFull}
766
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
767
+ */
576
768
  IDBObjectStore.prototype.__get = function (query, getKey, getAll, count) {
577
769
  const me = this;
578
770
  if (count !== undefined) {
@@ -584,7 +776,8 @@ IDBObjectStore.prototype.__get = function (query, getKey, getAll, count) {
584
776
  const range = convertValueToKeyRange(query, !getAll);
585
777
 
586
778
  const col = getKey ? 'key' : 'value';
587
- let sql = ['SELECT', util.sqlQuote(col), 'FROM', util.escapeStoreNameForSQL(me.__currentName)];
779
+ const sql = ['SELECT', util.sqlQuote(col), 'FROM', util.escapeStoreNameForSQL(me.__currentName)];
780
+ /** @type {string[]} */
588
781
  const sqlValues = [];
589
782
  if (range !== undefined) {
590
783
  sql.push('WHERE');
@@ -597,13 +790,15 @@ IDBObjectStore.prototype.__get = function (query, getKey, getAll, count) {
597
790
  if (!Number.isFinite(count)) {
598
791
  throw new TypeError('The count parameter must be a finite number');
599
792
  }
600
- sql.push('LIMIT', count);
793
+ sql.push('LIMIT', String(count));
601
794
  }
602
- sql = sql.join(' ');
603
- return me.transaction.__addToTransactionQueue(function objectStoreGet (tx, args, success, error) {
604
- CFG.DEBUG && console.log('Fetching', me.__currentName, sqlValues);
605
- tx.executeSql(sql, sqlValues, function (tx, data) {
606
- CFG.DEBUG && console.log('Fetched data', data);
795
+ const sqlStr = sql.join(' ');
796
+ return /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
797
+ me.transaction
798
+ ).__addToTransactionQueue(function objectStoreGet (tx, args, success, error) {
799
+ if (CFG.DEBUG) { console.log('Fetching', me.__currentName, sqlValues); }
800
+ tx.executeSql(sqlStr, sqlValues, function (tx, data) {
801
+ if (CFG.DEBUG) { console.log('Fetched data', data); }
607
802
  let ret;
608
803
  try {
609
804
  // Opera can't deal with the try-catch here.
@@ -635,15 +830,23 @@ IDBObjectStore.prototype.__get = function (query, getKey, getAll, count) {
635
830
  }
636
831
  } catch (e) {
637
832
  // If no result is returned, or error occurs when parsing JSON
638
- CFG.DEBUG && console.log(e);
833
+ if (CFG.DEBUG) { console.log(e); }
639
834
  }
640
835
  success(ret);
641
836
  }, function (tx, err) {
642
837
  error(err);
838
+ return false;
643
839
  });
644
840
  }, undefined, me);
645
841
  };
646
842
 
843
+ /**
844
+ *
845
+ * @param {import('./Key.js').Value} query
846
+ * @throws {TypeError}
847
+ * @this {IDBObjectStoreFull}
848
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
849
+ */
647
850
  IDBObjectStore.prototype.get = function (query) {
648
851
  if (!arguments.length) {
649
852
  throw new TypeError('A parameter was missing for `IDBObjectStore.get`.');
@@ -651,6 +854,12 @@ IDBObjectStore.prototype.get = function (query) {
651
854
  return this.__get(query);
652
855
  };
653
856
 
857
+ /**
858
+ *
859
+ * @param {import('./Key.js').Value} query
860
+ * @this {IDBObjectStoreFull}
861
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
862
+ */
654
863
  IDBObjectStore.prototype.getKey = function (query) {
655
864
  if (!arguments.length) {
656
865
  throw new TypeError('A parameter was missing for `IDBObjectStore.getKey`.');
@@ -658,18 +867,33 @@ IDBObjectStore.prototype.getKey = function (query) {
658
867
  return this.__get(query, true);
659
868
  };
660
869
 
870
+ /**
871
+ * @this {IDBObjectStoreFull}
872
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
873
+ */
661
874
  IDBObjectStore.prototype.getAll = function (/* query, count */) {
662
875
  // eslint-disable-next-line prefer-rest-params
663
876
  const [query, count] = arguments;
664
877
  return this.__get(query, false, true, count);
665
878
  };
666
879
 
880
+ /**
881
+ * @this {IDBObjectStoreFull}
882
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
883
+ */
667
884
  IDBObjectStore.prototype.getAllKeys = function (/* query, count */) {
668
885
  // eslint-disable-next-line prefer-rest-params
669
886
  const [query, count] = arguments;
670
887
  return this.__get(query, true, true, count);
671
888
  };
672
889
 
890
+ /**
891
+ *
892
+ * @param {import('./Key.js').Value} query
893
+ * @throws {TypeError}
894
+ * @this {IDBObjectStoreFull}
895
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
896
+ */
673
897
  IDBObjectStore.prototype.delete = function (query) {
674
898
  const me = this;
675
899
  if (!(this instanceof IDBObjectStore)) {
@@ -681,29 +905,39 @@ IDBObjectStore.prototype.delete = function (query) {
681
905
 
682
906
  IDBObjectStore.__invalidStateIfDeleted(me);
683
907
  IDBTransaction.__assertActive(me.transaction);
684
- me.transaction.__assertWritable();
908
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
909
+ me.transaction
910
+ ).__assertWritable();
685
911
 
686
912
  const range = convertValueToKeyRange(query, true);
687
913
 
688
914
  const sqlArr = ['DELETE FROM', util.escapeStoreNameForSQL(me.__currentName), 'WHERE'];
915
+ /** @type {string[]} */
689
916
  const sqlValues = [];
690
917
  setSQLForKeyRange(range, util.sqlQuote('key'), sqlArr, sqlValues);
691
918
  const sql = sqlArr.join(' ');
692
919
 
693
- return me.transaction.__addToTransactionQueue(function objectStoreDelete (tx, args, success, error) {
694
- CFG.DEBUG && console.log('Deleting', me.__currentName, sqlValues);
920
+ return /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
921
+ me.transaction
922
+ ).__addToTransactionQueue(function objectStoreDelete (tx, args, success, error) {
923
+ if (CFG.DEBUG) { console.log('Deleting', me.__currentName, sqlValues); }
695
924
  tx.executeSql(sql, sqlValues, function (tx, data) {
696
- CFG.DEBUG && console.log('Deleted from database', data.rowsAffected);
925
+ if (CFG.DEBUG) { console.log('Deleted from database', data.rowsAffected); }
697
926
  me.__cursors.forEach((cursor) => {
698
927
  cursor.__invalidateCache(); // Delete
699
928
  });
700
929
  success();
701
930
  }, function (tx, err) {
702
931
  error(err);
932
+ return false;
703
933
  });
704
934
  }, undefined, me);
705
935
  };
706
936
 
937
+ /**
938
+ * @this {IDBObjectStoreFull}
939
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
940
+ */
707
941
  IDBObjectStore.prototype.clear = function () {
708
942
  const me = this;
709
943
  if (!(this instanceof IDBObjectStore)) {
@@ -711,21 +945,30 @@ IDBObjectStore.prototype.clear = function () {
711
945
  }
712
946
  IDBObjectStore.__invalidStateIfDeleted(me);
713
947
  IDBTransaction.__assertActive(me.transaction);
714
- me.transaction.__assertWritable();
948
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
949
+ me.transaction
950
+ ).__assertWritable();
715
951
 
716
- return me.transaction.__addToTransactionQueue(function objectStoreClear (tx, args, success, error) {
952
+ return /** @type {import('./IDBTransaction.js').IDBTransactionFull} */ (
953
+ me.transaction
954
+ ).__addToTransactionQueue(function objectStoreClear (tx, args, success, error) {
717
955
  tx.executeSql('DELETE FROM ' + util.escapeStoreNameForSQL(me.__currentName), [], function (tx, data) {
718
- CFG.DEBUG && console.log('Cleared all records from database', data.rowsAffected);
956
+ if (CFG.DEBUG) { console.log('Cleared all records from database', data.rowsAffected); }
719
957
  me.__cursors.forEach((cursor) => {
720
958
  cursor.__invalidateCache(); // Clear
721
959
  });
722
960
  success();
723
961
  }, function (tx, err) {
724
962
  error(err);
963
+ return false;
725
964
  });
726
965
  }, undefined, me);
727
966
  };
728
967
 
968
+ /**
969
+ * @this {IDBObjectStoreFull}
970
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
971
+ */
729
972
  IDBObjectStore.prototype.count = function (/* query */) {
730
973
  const me = this;
731
974
  // eslint-disable-next-line prefer-rest-params
@@ -740,6 +983,10 @@ IDBObjectStore.prototype.count = function (/* query */) {
740
983
  return IDBCursorWithValue.__createInstance(query, 'next', me, me, 'key', 'value', true).__request;
741
984
  };
742
985
 
986
+ /**
987
+ * @this {IDBObjectStoreFull}
988
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
989
+ */
743
990
  IDBObjectStore.prototype.openCursor = function (/* query, direction */) {
744
991
  const me = this;
745
992
  // eslint-disable-next-line prefer-rest-params
@@ -753,6 +1000,10 @@ IDBObjectStore.prototype.openCursor = function (/* query, direction */) {
753
1000
  return cursor.__request;
754
1001
  };
755
1002
 
1003
+ /**
1004
+ * @this {IDBObjectStoreFull}
1005
+ * @returns {import('./IDBRequest.js').IDBRequestFull}
1006
+ */
756
1007
  IDBObjectStore.prototype.openKeyCursor = function (/* query, direction */) {
757
1008
  const me = this;
758
1009
  if (!(me instanceof IDBObjectStore)) {
@@ -766,6 +1017,12 @@ IDBObjectStore.prototype.openKeyCursor = function (/* query, direction */) {
766
1017
  return cursor.__request;
767
1018
  };
768
1019
 
1020
+ /**
1021
+ *
1022
+ * @param {string} indexName
1023
+ * @this {IDBObjectStoreFull}
1024
+ * @returns {import('./IDBIndex.js').IDBIndexFull}
1025
+ */
769
1026
  IDBObjectStore.prototype.index = function (indexName) {
770
1027
  const me = this;
771
1028
  if (!(me instanceof IDBObjectStore)) {
@@ -790,16 +1047,14 @@ IDBObjectStore.prototype.index = function (indexName) {
790
1047
  return me.__indexHandles[indexName];
791
1048
  };
792
1049
 
793
- /* eslint-disable jsdoc/check-param-names */
794
1050
  /**
795
1051
  * Creates a new index on the object store.
796
1052
  * @param {string} indexName
797
- * @param {string} keyPath
798
- * @param {object} optionalParameters
1053
+ * @param {string|string[]} keyPath
1054
+ * @this {IDBObjectStoreFull}
799
1055
  * @returns {IDBIndex}
800
1056
  */
801
1057
  IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optionalParameters */) {
802
- /* eslint-enable jsdoc/check-param-names */
803
1058
  const me = this;
804
1059
  // eslint-disable-next-line prefer-rest-params
805
1060
  let optionalParameters = arguments[2];
@@ -829,7 +1084,7 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optiona
829
1084
  }
830
1085
 
831
1086
  optionalParameters = optionalParameters || {};
832
- /** @name IDBIndexProperties */
1087
+ /** @type {import('./IDBIndex.js').IDBIndexProperties} */
833
1088
  const indexProperties = {
834
1089
  columnName: indexName,
835
1090
  keyPath,
@@ -843,6 +1098,12 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optiona
843
1098
  return index;
844
1099
  };
845
1100
 
1101
+ /**
1102
+ *
1103
+ * @param {string} name
1104
+ * @this {IDBObjectStoreFull}
1105
+ * @returns {void}
1106
+ */
846
1107
  IDBObjectStore.prototype.deleteIndex = function (name) {
847
1108
  const me = this;
848
1109
  if (!(me instanceof IDBObjectStore)) {