indexeddbshim 17.7.0 → 19.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.
- package/README.md +13 -3
- package/dist/DOMException.d.ts +5 -9
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/DOMStringList.d.ts +1 -2
- package/dist/DOMStringList.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +106 -52
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts +8 -7
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts +3 -3
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBObjectStore.d.ts +12 -12
- package/dist/IDBObjectStore.d.ts.map +1 -1
- package/dist/IDBRequest.d.ts +2 -2
- package/dist/IDBRequest.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +13 -13
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/Key.d.ts +14 -15
- package/dist/Key.d.ts.map +1 -1
- package/dist/Sca.d.ts +2 -2
- package/dist/Sca.d.ts.map +1 -1
- package/dist/cmp.d.ts +3 -3
- package/dist/cmp.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +37 -46
- 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 +254 -215
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +251 -450
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +3 -3
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +254 -215
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +251 -450
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +3 -3
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +251 -450
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +3 -3
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/nodeWebSQL.d.ts +2 -2
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/dist/setGlobalVars.d.ts +1 -2
- package/dist/setGlobalVars.d.ts.map +1 -1
- package/dist/util.d.ts +35 -22
- package/dist/util.d.ts.map +1 -1
- package/package.json +1 -4
- package/src/CFG.js +1 -1
- package/src/DOMException.js +9 -11
- package/src/DOMStringList.js +6 -11
- package/src/Event.js +1 -4
- package/src/IDBCursor.js +98 -47
- package/src/IDBFactory.js +12 -11
- package/src/IDBIndex.js +10 -12
- package/src/IDBKeyRange.js +6 -5
- package/src/IDBObjectStore.js +32 -27
- package/src/IDBRequest.js +1 -1
- package/src/IDBTransaction.js +11 -11
- package/src/IDBVersionChangeEvent.js +1 -4
- package/src/Key.js +32 -31
- package/src/Sca.js +1 -1
- package/src/cmp.js +2 -2
- package/src/nodeWebSQL.js +5 -2
- package/src/setGlobalVars.js +8 -19
- package/src/util.js +42 -17
package/src/util.js
CHANGED
|
@@ -230,8 +230,32 @@ function sqlLIKEEscape (str) {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
233
|
+
* Minimal replacement for `path.join(base, name)` covering our only use case:
|
|
234
|
+
* `name` is always a bare file name (no separators and no `.`/`..`), and
|
|
235
|
+
* `base` is a directory path expected to be absolute and normalized (an
|
|
236
|
+
* empty string means the current working directory). Unlike `path.join`,
|
|
237
|
+
* this performs no `.`/`..` resolution. It reuses the separator style of
|
|
238
|
+
* `base` (backslash only when `base` uses backslashes and no forward
|
|
239
|
+
* slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
|
|
240
|
+
* `websql-configurable` accept either separator on Windows regardless.
|
|
241
|
+
* Avoiding `node:path` keeps browser bundles free of a path polyfill.
|
|
242
|
+
* @param {string} base
|
|
243
|
+
* @param {string} name
|
|
244
|
+
* @returns {string}
|
|
245
|
+
*/
|
|
246
|
+
function joinPath (base, name) {
|
|
247
|
+
if (!base) {
|
|
248
|
+
return name;
|
|
249
|
+
}
|
|
250
|
+
const sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
|
|
251
|
+
return base.replace(/[/\\]+$/u, '') + sep + name;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* eslint-disable jsdoc/valid-types -- Bug */
|
|
255
|
+
/**
|
|
256
|
+
* @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
|
|
234
257
|
*/
|
|
258
|
+
/* eslint-enable jsdoc/valid-types -- Bug */
|
|
235
259
|
|
|
236
260
|
// Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
|
|
237
261
|
/**
|
|
@@ -255,7 +279,7 @@ function isObj (obj) {
|
|
|
255
279
|
|
|
256
280
|
/**
|
|
257
281
|
*
|
|
258
|
-
* @param {
|
|
282
|
+
* @param {AnyValue} obj
|
|
259
283
|
* @returns {boolean}
|
|
260
284
|
*/
|
|
261
285
|
function isDate (obj) {
|
|
@@ -264,7 +288,7 @@ function isDate (obj) {
|
|
|
264
288
|
|
|
265
289
|
/**
|
|
266
290
|
*
|
|
267
|
-
* @param {
|
|
291
|
+
* @param {AnyValue} obj
|
|
268
292
|
* @returns {boolean}
|
|
269
293
|
*/
|
|
270
294
|
function isBlob (obj) {
|
|
@@ -274,7 +298,7 @@ function isBlob (obj) {
|
|
|
274
298
|
|
|
275
299
|
/**
|
|
276
300
|
*
|
|
277
|
-
* @param {
|
|
301
|
+
* @param {AnyValue} obj
|
|
278
302
|
* @returns {boolean}
|
|
279
303
|
*/
|
|
280
304
|
function isRegExp (obj) {
|
|
@@ -284,7 +308,7 @@ function isRegExp (obj) {
|
|
|
284
308
|
|
|
285
309
|
/**
|
|
286
310
|
*
|
|
287
|
-
* @param {
|
|
311
|
+
* @param {AnyValue} obj
|
|
288
312
|
* @returns {boolean}
|
|
289
313
|
*/
|
|
290
314
|
function isFile (obj) {
|
|
@@ -307,7 +331,7 @@ function isBinary (obj) {
|
|
|
307
331
|
/**
|
|
308
332
|
*
|
|
309
333
|
* @param {AnyValue} obj
|
|
310
|
-
* @returns {
|
|
334
|
+
* @returns {obj is Iterable<unknown>}
|
|
311
335
|
*/
|
|
312
336
|
function isIterable (obj) {
|
|
313
337
|
return isObj(obj) &&
|
|
@@ -362,9 +386,7 @@ function defineReadonlyOuterInterface (obj, props) {
|
|
|
362
386
|
|
|
363
387
|
/**
|
|
364
388
|
*
|
|
365
|
-
* @param {object
|
|
366
|
-
* [key: string]: any
|
|
367
|
-
* }} obj
|
|
389
|
+
* @param {object} obj
|
|
368
390
|
* @param {string[]} listeners
|
|
369
391
|
* @returns {void}
|
|
370
392
|
*/
|
|
@@ -373,13 +395,13 @@ function defineListenerProperties (obj, listeners) {
|
|
|
373
395
|
listeners.forEach((listener) => {
|
|
374
396
|
const o = {
|
|
375
397
|
get [listener] () {
|
|
376
|
-
return obj
|
|
398
|
+
return Reflect.get(obj, '__' + listener);
|
|
377
399
|
},
|
|
378
400
|
/**
|
|
379
401
|
* @param {AnyValue} val
|
|
380
402
|
*/
|
|
381
403
|
set [listener] (val) {
|
|
382
|
-
obj
|
|
404
|
+
Reflect.set(obj, '__' + listener, val);
|
|
383
405
|
}
|
|
384
406
|
};
|
|
385
407
|
const desc = /** @type {PropertyDescriptor} */ (
|
|
@@ -390,7 +412,7 @@ function defineListenerProperties (obj, listeners) {
|
|
|
390
412
|
Object.defineProperty(obj, listener, desc);
|
|
391
413
|
});
|
|
392
414
|
listeners.forEach((l) => {
|
|
393
|
-
obj
|
|
415
|
+
Reflect.set(obj, l, null);
|
|
394
416
|
});
|
|
395
417
|
}
|
|
396
418
|
|
|
@@ -399,7 +421,7 @@ function defineListenerProperties (obj, listeners) {
|
|
|
399
421
|
* @param {object} obj
|
|
400
422
|
* @param {string|string[]} props
|
|
401
423
|
* @param {null|{
|
|
402
|
-
* [key: string]:
|
|
424
|
+
* [key: string]: unknown
|
|
403
425
|
* }} getter
|
|
404
426
|
* @returns {void}
|
|
405
427
|
*/
|
|
@@ -539,7 +561,7 @@ function enforceRange (number, type) {
|
|
|
539
561
|
}
|
|
540
562
|
|
|
541
563
|
/**
|
|
542
|
-
* @typedef {
|
|
564
|
+
* @typedef {unknown} AnyValue
|
|
543
565
|
*/
|
|
544
566
|
|
|
545
567
|
/**
|
|
@@ -556,8 +578,11 @@ function convertToDOMString (v, treatNullAs) {
|
|
|
556
578
|
* @returns {string}
|
|
557
579
|
*/
|
|
558
580
|
function ToString (o) { // Todo: See `es-abstract/es7`
|
|
559
|
-
// `String()` will not throw with Symbols
|
|
560
|
-
|
|
581
|
+
// `String()` will not throw with Symbols, but the unchecked `+ ''`
|
|
582
|
+
// coercion deliberately does (Web IDL requires converting a symbol
|
|
583
|
+
// to `DOMString` to throw a `TypeError`); the assertion only tells
|
|
584
|
+
// the compiler to allow the coercion it cannot model.
|
|
585
|
+
return '' + /** @type {string} */ (o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
|
|
561
586
|
}
|
|
562
587
|
|
|
563
588
|
/**
|
|
@@ -637,7 +662,7 @@ function runContinuationSafely (fn) {
|
|
|
637
662
|
export {escapeSQLiteStatement, unescapeSQLiteResponse,
|
|
638
663
|
escapeDatabaseNameForSQLAndFiles, unescapeDatabaseNameForSQLAndFiles,
|
|
639
664
|
escapeStoreNameForSQL, escapeIndexNameForSQL, escapeIndexNameForSQLKeyColumn,
|
|
640
|
-
sqlLIKEEscape, sqlQuote,
|
|
665
|
+
sqlLIKEEscape, sqlQuote, joinPath,
|
|
641
666
|
instanceOf,
|
|
642
667
|
isObj, isDate, isBlob, isRegExp, isFile, isBinary, isIterable,
|
|
643
668
|
defineOuterInterface, defineReadonlyOuterInterface,
|