indexeddbshim 14.0.0 → 15.0.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/badges/licenses-badge-dev.svg +1 -1
- package/dist/indexeddbshim-Key.js +10 -3
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +72 -51
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +75 -52
- 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 +72 -51
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +75 -52
- 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 +75 -52
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/package.json +80 -81
- package/src/IDBDatabase.js +5 -0
- package/src/IDBFactory.js +10 -4
- package/src/Key.js +8 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v15.0.0 - 8/3/2024 */
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -2679,6 +2679,14 @@ const signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPo
|
|
|
2679
2679
|
* @typedef {any} AnyValue
|
|
2680
2680
|
*/
|
|
2681
2681
|
|
|
2682
|
+
/**
|
|
2683
|
+
* @type {{
|
|
2684
|
+
* [key: string]: {
|
|
2685
|
+
* encode: (param: any, inArray?: boolean) => string,
|
|
2686
|
+
* decode: (param: string, inArray?: boolean) => any
|
|
2687
|
+
* }
|
|
2688
|
+
* }}
|
|
2689
|
+
*/
|
|
2682
2690
|
const types$1 = {
|
|
2683
2691
|
invalid: {
|
|
2684
2692
|
/**
|
|
@@ -3534,7 +3542,6 @@ function encode$1(key, inArray) {
|
|
|
3534
3542
|
return null;
|
|
3535
3543
|
}
|
|
3536
3544
|
// array, date, number, string, binary (should already have detected "invalid")
|
|
3537
|
-
// @ts-expect-error Argument may be ignored
|
|
3538
3545
|
return types$1[getKeyType(key)].encode(key, inArray);
|
|
3539
3546
|
}
|
|
3540
3547
|
|
|
@@ -5077,7 +5084,7 @@ function _toPropertyKey(e) {
|
|
|
5077
5084
|
if ("object" != typeof e || null === e) return e;
|
|
5078
5085
|
var r = e[Symbol.toPrimitive];
|
|
5079
5086
|
if (void 0 !== r) {
|
|
5080
|
-
var n = r.call(e, t
|
|
5087
|
+
var n = r.call(e, t);
|
|
5081
5088
|
if ("object" != typeof n) return n;
|
|
5082
5089
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5083
5090
|
}
|
|
@@ -5133,7 +5140,7 @@ e.__typeson__type__ = "TypesonPromise", "undefined" != typeof Symbol && Object.d
|
|
|
5133
5140
|
var t = Object.hasOwn,
|
|
5134
5141
|
r = Object.getPrototypeOf;
|
|
5135
5142
|
function isThenable(e, t) {
|
|
5136
|
-
return isObject(e) && "function" == typeof e.then && (!t
|
|
5143
|
+
return isObject(e) && "function" == typeof e.then && (!t);
|
|
5137
5144
|
}
|
|
5138
5145
|
function toStringTag(e) {
|
|
5139
5146
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -5288,8 +5295,8 @@ var c = function () {
|
|
|
5288
5295
|
p = [],
|
|
5289
5296
|
d = [],
|
|
5290
5297
|
v = !("cyclic" in u) || u.cyclic,
|
|
5291
|
-
|
|
5292
|
-
|
|
5298
|
+
b = u.encapsulateObserver,
|
|
5299
|
+
h = function finish(e) {
|
|
5293
5300
|
var t = Object.values(f);
|
|
5294
5301
|
if (u.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
5295
5302
|
if (t.length) {
|
|
@@ -5314,7 +5321,7 @@ var c = function () {
|
|
|
5314
5321
|
});
|
|
5315
5322
|
return !u.returnTypeNames && e;
|
|
5316
5323
|
},
|
|
5317
|
-
|
|
5324
|
+
m = _async(function (t, r) {
|
|
5318
5325
|
return _await(Promise.all(r.map(function (e) {
|
|
5319
5326
|
return e[1].p;
|
|
5320
5327
|
})), function (n) {
|
|
@@ -5337,11 +5344,11 @@ var c = function () {
|
|
|
5337
5344
|
}(function () {
|
|
5338
5345
|
if (s && v) return _await(d.p, function (e) {
|
|
5339
5346
|
f[y] = e;
|
|
5340
|
-
var r =
|
|
5347
|
+
var r = m(t, o);
|
|
5341
5348
|
return a = !0, r;
|
|
5342
5349
|
});
|
|
5343
5350
|
}, function (e) {
|
|
5344
|
-
return a ? e : (s ? f[y] = d : t = v ? d.p : d,
|
|
5351
|
+
return a ? e : (s ? f[y] = d : t = v ? d.p : d, m(t, o));
|
|
5345
5352
|
});
|
|
5346
5353
|
}))), function () {
|
|
5347
5354
|
return t;
|
|
@@ -5359,13 +5366,13 @@ var c = function () {
|
|
|
5359
5366
|
});
|
|
5360
5367
|
},
|
|
5361
5368
|
O = function _encapsulate(t, r, i, c, l, d, v) {
|
|
5362
|
-
var
|
|
5363
|
-
|
|
5369
|
+
var h,
|
|
5370
|
+
m = {},
|
|
5364
5371
|
O = _typeof(r),
|
|
5365
|
-
_ =
|
|
5372
|
+
_ = b ? function (n) {
|
|
5366
5373
|
var a,
|
|
5367
5374
|
o = null !== (a = null != v ? v : c.type) && void 0 !== a ? a : getJSONType(r);
|
|
5368
|
-
|
|
5375
|
+
b(Object.assign(null != n ? n : m, {
|
|
5369
5376
|
keypath: t,
|
|
5370
5377
|
value: r,
|
|
5371
5378
|
cyclic: i,
|
|
@@ -5377,9 +5384,9 @@ var c = function () {
|
|
|
5377
5384
|
type: o
|
|
5378
5385
|
}));
|
|
5379
5386
|
} : null;
|
|
5380
|
-
if (["string", "boolean", "number", "undefined"].includes(O)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (
|
|
5381
|
-
replaced:
|
|
5382
|
-
}) :
|
|
5387
|
+
if (["string", "boolean", "number", "undefined"].includes(O)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (h = c.replaced ? r : w(t, r, c, l, !1, d, _)) !== r && (m = {
|
|
5388
|
+
replaced: h
|
|
5389
|
+
}) : h = r, _ && _(), h;
|
|
5383
5390
|
if (null === r) return _ && _(), r;
|
|
5384
5391
|
if (i && !c.iterateIn && !c.iterateUnsetNumeric && r && "object" === _typeof(r)) {
|
|
5385
5392
|
var A = y.indexOf(r);
|
|
@@ -5393,14 +5400,14 @@ var c = function () {
|
|
|
5393
5400
|
T = isPlainObject(r),
|
|
5394
5401
|
I = o(r),
|
|
5395
5402
|
N = (T || I) && (!s.plainObjectReplacers.length || c.replaced) || c.iterateIn ? r : w(t, r, c, l, T || I, null, _);
|
|
5396
|
-
if (N !== r ? (
|
|
5403
|
+
if (N !== r ? (h = N, m = {
|
|
5397
5404
|
replaced: N
|
|
5398
|
-
}) : "" === t && hasConstructorOf(r, e) ? (l.push([t, r, i, c, void 0, void 0, c.type]),
|
|
5405
|
+
}) : "" === t && hasConstructorOf(r, e) ? (l.push([t, r, i, c, void 0, void 0, c.type]), h = r) : I && "object" !== c.iterateIn || "array" === c.iterateIn ? (S = new Array(r.length), m = {
|
|
5399
5406
|
clone: S
|
|
5400
|
-
}) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !T && "object" !== c.iterateIn ?
|
|
5407
|
+
}) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !T && "object" !== c.iterateIn ? h = r : (S = {}, c.addLength && (S.length = r.length), m = {
|
|
5401
5408
|
clone: S
|
|
5402
|
-
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j :
|
|
5403
|
-
if (!S) return
|
|
5409
|
+
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j : h;
|
|
5410
|
+
if (!S) return h;
|
|
5404
5411
|
if (c.iterateIn) {
|
|
5405
5412
|
var P = function _loop(n) {
|
|
5406
5413
|
var o = {
|
|
@@ -5466,12 +5473,12 @@ var c = function () {
|
|
|
5466
5473
|
i && i({
|
|
5467
5474
|
replacing: !0
|
|
5468
5475
|
});
|
|
5469
|
-
var
|
|
5476
|
+
var b = void 0;
|
|
5470
5477
|
if (l || !y.replaceAsync) {
|
|
5471
5478
|
if (void 0 === y.replace) throw new TypeError("Missing replacer");
|
|
5472
|
-
|
|
5473
|
-
} else
|
|
5474
|
-
return O(e,
|
|
5479
|
+
b = y.replace(t, r);
|
|
5480
|
+
} else b = y.replaceAsync(t, r);
|
|
5481
|
+
return O(e, b, v && "readonly", r, n, o, p);
|
|
5475
5482
|
}
|
|
5476
5483
|
}
|
|
5477
5484
|
return t;
|
|
@@ -5479,9 +5486,9 @@ var c = function () {
|
|
|
5479
5486
|
_ = O("", t, v, null != r ? r : {}, d);
|
|
5480
5487
|
if (d.length) return l && u.throwOnBadSyncType ? function () {
|
|
5481
5488
|
throw new TypeError("Sync method requested but async result obtained");
|
|
5482
|
-
}() : Promise.resolve(
|
|
5489
|
+
}() : Promise.resolve(m(_, d)).then(h);
|
|
5483
5490
|
if (!l && u.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
5484
|
-
return u.stringification && l ? [
|
|
5491
|
+
return u.stringification && l ? [h(_)] : l ? h(_) : Promise.resolve(h(_));
|
|
5485
5492
|
}
|
|
5486
5493
|
}, {
|
|
5487
5494
|
key: "encapsulateSync",
|
|
@@ -5536,7 +5543,7 @@ var c = function () {
|
|
|
5536
5543
|
return hasConstructorOf(e, s) ? void 0 : e;
|
|
5537
5544
|
}
|
|
5538
5545
|
var v,
|
|
5539
|
-
|
|
5546
|
+
b = function revivePlainObjects() {
|
|
5540
5547
|
var r = [];
|
|
5541
5548
|
if (!u) throw new Error("Found bad `types`");
|
|
5542
5549
|
if (Object.entries(u).forEach(function (e) {
|
|
@@ -5568,29 +5575,29 @@ var c = function () {
|
|
|
5568
5575
|
c === i && (t = c);
|
|
5569
5576
|
}, void 0);
|
|
5570
5577
|
}();
|
|
5571
|
-
return hasConstructorOf(
|
|
5578
|
+
return hasConstructorOf(b, e) ? v = b.then(function () {
|
|
5572
5579
|
return t;
|
|
5573
5580
|
}) : (v = function _revive(t, r, a, i, c) {
|
|
5574
5581
|
if (!y || "$types" !== t) {
|
|
5575
5582
|
var f = u[t],
|
|
5576
5583
|
v = o(r);
|
|
5577
5584
|
if (v || isPlainObject(r)) {
|
|
5578
|
-
var
|
|
5585
|
+
var b = v ? new Array(r.length) : {};
|
|
5579
5586
|
for (n(r).forEach(function (n) {
|
|
5580
|
-
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a :
|
|
5587
|
+
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a : b, b, n),
|
|
5581
5588
|
i = function set(e) {
|
|
5582
|
-
return hasConstructorOf(e, s) ?
|
|
5589
|
+
return hasConstructorOf(e, s) ? b[n] = void 0 : void 0 !== e && (b[n] = e), e;
|
|
5583
5590
|
};
|
|
5584
5591
|
hasConstructorOf(o, e) ? d.push(o.then(function (e) {
|
|
5585
5592
|
return i(e);
|
|
5586
5593
|
})) : i(o);
|
|
5587
|
-
}), r =
|
|
5588
|
-
var
|
|
5589
|
-
|
|
5590
|
-
g =
|
|
5591
|
-
O =
|
|
5592
|
-
w =
|
|
5593
|
-
_ = getByKeyPath(
|
|
5594
|
+
}), r = b; l.length;) {
|
|
5595
|
+
var h = _slicedToArray(l[0], 4),
|
|
5596
|
+
m = h[0],
|
|
5597
|
+
g = h[1],
|
|
5598
|
+
O = h[2],
|
|
5599
|
+
w = h[3],
|
|
5600
|
+
_ = getByKeyPath(m, g);
|
|
5594
5601
|
if (void 0 === _) break;
|
|
5595
5602
|
O[w] = _, l.splice(0, 1);
|
|
5596
5603
|
}
|
|
@@ -5742,26 +5749,29 @@ const v = {
|
|
|
5742
5749
|
}
|
|
5743
5750
|
}
|
|
5744
5751
|
},
|
|
5745
|
-
|
|
5752
|
+
b = {
|
|
5746
5753
|
bigintObject: {
|
|
5747
5754
|
test: e => "object" == typeof e && hasConstructorOf(e, BigInt),
|
|
5748
5755
|
replace: String,
|
|
5749
5756
|
revive: e => new Object(BigInt(e))
|
|
5750
5757
|
}
|
|
5751
5758
|
},
|
|
5752
|
-
|
|
5759
|
+
h = {
|
|
5753
5760
|
bigint: {
|
|
5754
5761
|
test: e => "bigint" == typeof e,
|
|
5755
5762
|
replace: String,
|
|
5756
5763
|
revive: e => BigInt(e)
|
|
5757
5764
|
}
|
|
5758
5765
|
};
|
|
5766
|
+
function arraybuffer2string(e) {
|
|
5767
|
+
return new Uint8Array(e).reduce((e, t) => e + String.fromCodePoint(t), "");
|
|
5768
|
+
}
|
|
5759
5769
|
function string2arraybuffer(e) {
|
|
5760
5770
|
const t = new Uint8Array(e.length);
|
|
5761
5771
|
for (let r = 0; r < e.length; r++) t[r] = e.charCodeAt(r);
|
|
5762
5772
|
return t.buffer;
|
|
5763
5773
|
}
|
|
5764
|
-
const
|
|
5774
|
+
const m = {
|
|
5765
5775
|
blob: {
|
|
5766
5776
|
test: e => "Blob" === toStringTag(e),
|
|
5767
5777
|
replace(e) {
|
|
@@ -5786,11 +5796,11 @@ const h = {
|
|
|
5786
5796
|
n.addEventListener("load", () => {
|
|
5787
5797
|
e({
|
|
5788
5798
|
type: t.type,
|
|
5789
|
-
stringContents: n.result
|
|
5799
|
+
stringContents: arraybuffer2string(n.result)
|
|
5790
5800
|
});
|
|
5791
5801
|
}), n.addEventListener("error", () => {
|
|
5792
5802
|
r(n.error);
|
|
5793
|
-
}), n.
|
|
5803
|
+
}), n.readAsArrayBuffer(t);
|
|
5794
5804
|
})
|
|
5795
5805
|
}
|
|
5796
5806
|
};
|
|
@@ -6051,13 +6061,13 @@ const E = {
|
|
|
6051
6061
|
n.addEventListener("load", function () {
|
|
6052
6062
|
e({
|
|
6053
6063
|
type: t.type,
|
|
6054
|
-
stringContents: n.result,
|
|
6064
|
+
stringContents: arraybuffer2string(n.result),
|
|
6055
6065
|
name: t.name,
|
|
6056
6066
|
lastModified: t.lastModified
|
|
6057
6067
|
});
|
|
6058
6068
|
}), n.addEventListener("error", function () {
|
|
6059
6069
|
r(n.error);
|
|
6060
|
-
}), n.
|
|
6070
|
+
}), n.readAsArrayBuffer(t);
|
|
6061
6071
|
})
|
|
6062
6072
|
}
|
|
6063
6073
|
},
|
|
@@ -6289,7 +6299,7 @@ const Q = {
|
|
|
6289
6299
|
}
|
|
6290
6300
|
}],
|
|
6291
6301
|
ee = [K, U, F, $],
|
|
6292
|
-
oe = [X, Q, Z, V, ee, A, q, k, B, E, C,
|
|
6302
|
+
oe = [X, Q, Z, V, ee, A, q, k, B, E, C, m, P, x].concat("function" == typeof Map ? D : [], "function" == typeof Set ? G : [], "function" == typeof ArrayBuffer ? v : [], "function" == typeof Uint8Array ? z : [], "function" == typeof DataView ? _ : [], "undefined" != typeof crypto ? w : [], "undefined" != typeof BigInt ? [h, b] : [], "undefined" != typeof DOMException ? S : [], "undefined" != typeof DOMRect ? N : [], "undefined" != typeof DOMPoint ? T : [], "undefined" != typeof DOMQuad ? I : [], "undefined" != typeof DOMMatrix ? j : []),
|
|
6293
6303
|
ie = oe.concat({
|
|
6294
6304
|
checkDataCloneException: {
|
|
6295
6305
|
test(e) {
|
|
@@ -8307,6 +8317,8 @@ const readonlyProperties = ['name', 'version', 'objectStoreNames'];
|
|
|
8307
8317
|
function IDBDatabase() {
|
|
8308
8318
|
this.__versionTransaction = null;
|
|
8309
8319
|
this.__objectStores = null;
|
|
8320
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
8321
|
+
this.__transactions = [];
|
|
8310
8322
|
throw new TypeError('Illegal constructor');
|
|
8311
8323
|
}
|
|
8312
8324
|
const IDBDatabaseAlias = IDBDatabase;
|
|
@@ -8369,6 +8381,8 @@ IDBDatabase.__createInstance = function (db, name, oldVersion, version, storePro
|
|
|
8369
8381
|
this.__setOptions({
|
|
8370
8382
|
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
|
|
8371
8383
|
});
|
|
8384
|
+
|
|
8385
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
8372
8386
|
this.__transactions = [];
|
|
8373
8387
|
|
|
8374
8388
|
/** @type {{[key: string]: IDBObjectStore}} */
|
|
@@ -8498,6 +8512,7 @@ IDBDatabase.prototype.close = function () {
|
|
|
8498
8512
|
if (this.__unblocking) {
|
|
8499
8513
|
this.__unblocking.check();
|
|
8500
8514
|
}
|
|
8515
|
+
this.__transactions = [];
|
|
8501
8516
|
};
|
|
8502
8517
|
|
|
8503
8518
|
/**
|
|
@@ -8595,6 +8610,7 @@ IDBDatabase.prototype.__forceClose = function (msg) {
|
|
|
8595
8610
|
};
|
|
8596
8611
|
trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
|
|
8597
8612
|
});
|
|
8613
|
+
me.__transactions = [];
|
|
8598
8614
|
};
|
|
8599
8615
|
defineOuterInterface(IDBDatabase.prototype, listeners);
|
|
8600
8616
|
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
|
|
@@ -9194,6 +9210,10 @@ IDBFactory.prototype.open = function (name /* , version */) {
|
|
|
9194
9210
|
|
|
9195
9211
|
// eslint-disable-next-line camelcase -- Clear API
|
|
9196
9212
|
req.transaction.on__complete = function () {
|
|
9213
|
+
const pos = connection.__transactions.indexOf(req.transaction);
|
|
9214
|
+
if (pos > -1) {
|
|
9215
|
+
connection.__transactions.splice(pos, 1);
|
|
9216
|
+
}
|
|
9197
9217
|
if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
|
|
9198
9218
|
req.__transaction = null;
|
|
9199
9219
|
const err = createDOMException('AbortError', 'The connection has been closed.');
|
|
@@ -9578,9 +9598,10 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
|
|
|
9578
9598
|
conn.__forceClose(msg);
|
|
9579
9599
|
}
|
|
9580
9600
|
if (isNullish(dbName)) {
|
|
9581
|
-
Object.values(me.__connections).forEach(
|
|
9582
|
-
|
|
9583
|
-
|
|
9601
|
+
Object.values(me.__connections).forEach(connections => {
|
|
9602
|
+
connections.forEach(connection => {
|
|
9603
|
+
forceClose(connection);
|
|
9604
|
+
});
|
|
9584
9605
|
});
|
|
9585
9606
|
} else if (!me.__connections[dbName]) {
|
|
9586
9607
|
console.log('No database connections with that name to force close');
|
|
@@ -9589,7 +9610,7 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
|
|
|
9589
9610
|
forceClose(conn);
|
|
9590
9611
|
});
|
|
9591
9612
|
} else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
|
|
9592
|
-
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to
|
|
9613
|
+
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
|
|
9593
9614
|
} else {
|
|
9594
9615
|
forceClose(me.__connections[dbName][connIdx]);
|
|
9595
9616
|
}
|