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
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
function _createForOfIteratorHelper(r, e) {
|
|
73
73
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
74
74
|
if (!t) {
|
|
75
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e
|
|
75
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) {
|
|
76
76
|
t && (r = t);
|
|
77
77
|
var n = 0,
|
|
78
78
|
F = function () {};
|
|
@@ -3199,6 +3199,14 @@
|
|
|
3199
3199
|
* @typedef {any} AnyValue
|
|
3200
3200
|
*/
|
|
3201
3201
|
|
|
3202
|
+
/**
|
|
3203
|
+
* @type {{
|
|
3204
|
+
* [key: string]: {
|
|
3205
|
+
* encode: (param: any, inArray?: boolean) => string,
|
|
3206
|
+
* decode: (param: string, inArray?: boolean) => any
|
|
3207
|
+
* }
|
|
3208
|
+
* }}
|
|
3209
|
+
*/
|
|
3202
3210
|
var types = {
|
|
3203
3211
|
invalid: {
|
|
3204
3212
|
/**
|
|
@@ -4109,7 +4117,6 @@
|
|
|
4109
4117
|
return null;
|
|
4110
4118
|
}
|
|
4111
4119
|
// array, date, number, string, binary (should already have detected "invalid")
|
|
4112
|
-
// @ts-expect-error Argument may be ignored
|
|
4113
4120
|
return types[getKeyType(key)].encode(key, inArray);
|
|
4114
4121
|
}
|
|
4115
4122
|
|
|
@@ -5664,7 +5671,7 @@
|
|
|
5664
5671
|
if ("object" != _typeof$2(e) || null === e) return e;
|
|
5665
5672
|
var r = e[Symbol.toPrimitive];
|
|
5666
5673
|
if (void 0 !== r) {
|
|
5667
|
-
var n = r.call(e, t
|
|
5674
|
+
var n = r.call(e, t);
|
|
5668
5675
|
if ("object" != _typeof$2(n)) return n;
|
|
5669
5676
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5670
5677
|
}
|
|
@@ -5720,7 +5727,7 @@
|
|
|
5720
5727
|
var t = Object.hasOwn,
|
|
5721
5728
|
r = Object.getPrototypeOf;
|
|
5722
5729
|
function isThenable(e, t) {
|
|
5723
|
-
return isObject(e) && "function" == typeof e.then && (!t
|
|
5730
|
+
return isObject(e) && "function" == typeof e.then && (!t);
|
|
5724
5731
|
}
|
|
5725
5732
|
function toStringTag(e) {
|
|
5726
5733
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -5875,8 +5882,8 @@
|
|
|
5875
5882
|
p = [],
|
|
5876
5883
|
d = [],
|
|
5877
5884
|
v = !("cyclic" in u) || u.cyclic,
|
|
5878
|
-
|
|
5879
|
-
|
|
5885
|
+
b = u.encapsulateObserver,
|
|
5886
|
+
h = function finish(e) {
|
|
5880
5887
|
var t = Object.values(f);
|
|
5881
5888
|
if (u.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
5882
5889
|
if (t.length) {
|
|
@@ -5901,7 +5908,7 @@
|
|
|
5901
5908
|
});
|
|
5902
5909
|
return !u.returnTypeNames && e;
|
|
5903
5910
|
},
|
|
5904
|
-
|
|
5911
|
+
m = _async(function (t, r) {
|
|
5905
5912
|
return _await(Promise.all(r.map(function (e) {
|
|
5906
5913
|
return e[1].p;
|
|
5907
5914
|
})), function (n) {
|
|
@@ -5924,11 +5931,11 @@
|
|
|
5924
5931
|
}(function () {
|
|
5925
5932
|
if (s && v) return _await(d.p, function (e) {
|
|
5926
5933
|
f[y] = e;
|
|
5927
|
-
var r =
|
|
5934
|
+
var r = m(t, o);
|
|
5928
5935
|
return a = !0, r;
|
|
5929
5936
|
});
|
|
5930
5937
|
}, function (e) {
|
|
5931
|
-
return a ? e : (s ? f[y] = d : t = v ? d.p : d,
|
|
5938
|
+
return a ? e : (s ? f[y] = d : t = v ? d.p : d, m(t, o));
|
|
5932
5939
|
});
|
|
5933
5940
|
}))), function () {
|
|
5934
5941
|
return t;
|
|
@@ -5946,13 +5953,13 @@
|
|
|
5946
5953
|
});
|
|
5947
5954
|
},
|
|
5948
5955
|
O = function _encapsulate(t, r, i, c, l, d, v) {
|
|
5949
|
-
var
|
|
5950
|
-
|
|
5956
|
+
var h,
|
|
5957
|
+
m = {},
|
|
5951
5958
|
O = _typeof(r),
|
|
5952
|
-
_ =
|
|
5959
|
+
_ = b ? function (n) {
|
|
5953
5960
|
var a,
|
|
5954
5961
|
o = null !== (a = null != v ? v : c.type) && void 0 !== a ? a : getJSONType(r);
|
|
5955
|
-
|
|
5962
|
+
b(Object.assign(null != n ? n : m, {
|
|
5956
5963
|
keypath: t,
|
|
5957
5964
|
value: r,
|
|
5958
5965
|
cyclic: i,
|
|
@@ -5964,9 +5971,9 @@
|
|
|
5964
5971
|
type: o
|
|
5965
5972
|
}));
|
|
5966
5973
|
} : null;
|
|
5967
|
-
if (["string", "boolean", "number", "undefined"].includes(O)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (
|
|
5968
|
-
replaced:
|
|
5969
|
-
}) :
|
|
5974
|
+
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 = {
|
|
5975
|
+
replaced: h
|
|
5976
|
+
}) : h = r, _ && _(), h;
|
|
5970
5977
|
if (null === r) return _ && _(), r;
|
|
5971
5978
|
if (i && !c.iterateIn && !c.iterateUnsetNumeric && r && "object" === _typeof(r)) {
|
|
5972
5979
|
var A = y.indexOf(r);
|
|
@@ -5980,14 +5987,14 @@
|
|
|
5980
5987
|
T = isPlainObject(r),
|
|
5981
5988
|
I = o(r),
|
|
5982
5989
|
N = (T || I) && (!s.plainObjectReplacers.length || c.replaced) || c.iterateIn ? r : w(t, r, c, l, T || I, null, _);
|
|
5983
|
-
if (N !== r ? (
|
|
5990
|
+
if (N !== r ? (h = N, m = {
|
|
5984
5991
|
replaced: N
|
|
5985
|
-
}) : "" === t && hasConstructorOf(r, e) ? (l.push([t, r, i, c, void 0, void 0, c.type]),
|
|
5992
|
+
}) : "" === 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 = {
|
|
5986
5993
|
clone: S
|
|
5987
|
-
}) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !T && "object" !== c.iterateIn ?
|
|
5994
|
+
}) : (["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 = {
|
|
5988
5995
|
clone: S
|
|
5989
|
-
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j :
|
|
5990
|
-
if (!S) return
|
|
5996
|
+
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j : h;
|
|
5997
|
+
if (!S) return h;
|
|
5991
5998
|
if (c.iterateIn) {
|
|
5992
5999
|
var P = function _loop(n) {
|
|
5993
6000
|
var o = {
|
|
@@ -6053,12 +6060,12 @@
|
|
|
6053
6060
|
i && i({
|
|
6054
6061
|
replacing: !0
|
|
6055
6062
|
});
|
|
6056
|
-
var
|
|
6063
|
+
var b = void 0;
|
|
6057
6064
|
if (l || !y.replaceAsync) {
|
|
6058
6065
|
if (void 0 === y.replace) throw new TypeError("Missing replacer");
|
|
6059
|
-
|
|
6060
|
-
} else
|
|
6061
|
-
return O(e,
|
|
6066
|
+
b = y.replace(t, r);
|
|
6067
|
+
} else b = y.replaceAsync(t, r);
|
|
6068
|
+
return O(e, b, v && "readonly", r, n, o, p);
|
|
6062
6069
|
}
|
|
6063
6070
|
}
|
|
6064
6071
|
return t;
|
|
@@ -6066,9 +6073,9 @@
|
|
|
6066
6073
|
_ = O("", t, v, null != r ? r : {}, d);
|
|
6067
6074
|
if (d.length) return l && u.throwOnBadSyncType ? function () {
|
|
6068
6075
|
throw new TypeError("Sync method requested but async result obtained");
|
|
6069
|
-
}() : Promise.resolve(
|
|
6076
|
+
}() : Promise.resolve(m(_, d)).then(h);
|
|
6070
6077
|
if (!l && u.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
6071
|
-
return u.stringification && l ? [
|
|
6078
|
+
return u.stringification && l ? [h(_)] : l ? h(_) : Promise.resolve(h(_));
|
|
6072
6079
|
}
|
|
6073
6080
|
}, {
|
|
6074
6081
|
key: "encapsulateSync",
|
|
@@ -6123,7 +6130,7 @@
|
|
|
6123
6130
|
return hasConstructorOf(e, s) ? void 0 : e;
|
|
6124
6131
|
}
|
|
6125
6132
|
var v,
|
|
6126
|
-
|
|
6133
|
+
b = function revivePlainObjects() {
|
|
6127
6134
|
var r = [];
|
|
6128
6135
|
if (!u) throw new Error("Found bad `types`");
|
|
6129
6136
|
if (Object.entries(u).forEach(function (e) {
|
|
@@ -6155,29 +6162,29 @@
|
|
|
6155
6162
|
c === i && (t = c);
|
|
6156
6163
|
}, void 0);
|
|
6157
6164
|
}();
|
|
6158
|
-
return hasConstructorOf(
|
|
6165
|
+
return hasConstructorOf(b, e) ? v = b.then(function () {
|
|
6159
6166
|
return t;
|
|
6160
6167
|
}) : (v = function _revive(t, r, a, i, c) {
|
|
6161
6168
|
if (!y || "$types" !== t) {
|
|
6162
6169
|
var f = u[t],
|
|
6163
6170
|
v = o(r);
|
|
6164
6171
|
if (v || isPlainObject(r)) {
|
|
6165
|
-
var
|
|
6172
|
+
var b = v ? new Array(r.length) : {};
|
|
6166
6173
|
for (n(r).forEach(function (n) {
|
|
6167
|
-
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a :
|
|
6174
|
+
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a : b, b, n),
|
|
6168
6175
|
i = function set(e) {
|
|
6169
|
-
return hasConstructorOf(e, s) ?
|
|
6176
|
+
return hasConstructorOf(e, s) ? b[n] = void 0 : void 0 !== e && (b[n] = e), e;
|
|
6170
6177
|
};
|
|
6171
6178
|
hasConstructorOf(o, e) ? d.push(o.then(function (e) {
|
|
6172
6179
|
return i(e);
|
|
6173
6180
|
})) : i(o);
|
|
6174
|
-
}), r =
|
|
6175
|
-
var
|
|
6176
|
-
|
|
6177
|
-
g =
|
|
6178
|
-
O =
|
|
6179
|
-
w =
|
|
6180
|
-
_ = getByKeyPath(
|
|
6181
|
+
}), r = b; l.length;) {
|
|
6182
|
+
var h = _slicedToArray(l[0], 4),
|
|
6183
|
+
m = h[0],
|
|
6184
|
+
g = h[1],
|
|
6185
|
+
O = h[2],
|
|
6186
|
+
w = h[3],
|
|
6187
|
+
_ = getByKeyPath(m, g);
|
|
6181
6188
|
if (void 0 === _) break;
|
|
6182
6189
|
O[w] = _, l.splice(0, 1);
|
|
6183
6190
|
}
|
|
@@ -6331,7 +6338,7 @@
|
|
|
6331
6338
|
}
|
|
6332
6339
|
}
|
|
6333
6340
|
},
|
|
6334
|
-
|
|
6341
|
+
b = {
|
|
6335
6342
|
bigintObject: {
|
|
6336
6343
|
test: function test(e) {
|
|
6337
6344
|
return "object" == _typeof$2(e) && hasConstructorOf(e, BigInt);
|
|
@@ -6342,7 +6349,7 @@
|
|
|
6342
6349
|
}
|
|
6343
6350
|
}
|
|
6344
6351
|
},
|
|
6345
|
-
|
|
6352
|
+
h = {
|
|
6346
6353
|
bigint: {
|
|
6347
6354
|
test: function test(e) {
|
|
6348
6355
|
return "bigint" == typeof e;
|
|
@@ -6353,12 +6360,17 @@
|
|
|
6353
6360
|
}
|
|
6354
6361
|
}
|
|
6355
6362
|
};
|
|
6363
|
+
function arraybuffer2string(e) {
|
|
6364
|
+
return new Uint8Array(e).reduce(function (e, t) {
|
|
6365
|
+
return e + String.fromCodePoint(t);
|
|
6366
|
+
}, "");
|
|
6367
|
+
}
|
|
6356
6368
|
function string2arraybuffer(e) {
|
|
6357
6369
|
var t = new Uint8Array(e.length);
|
|
6358
6370
|
for (var _r = 0; _r < e.length; _r++) t[_r] = e.charCodeAt(_r);
|
|
6359
6371
|
return t.buffer;
|
|
6360
6372
|
}
|
|
6361
|
-
var
|
|
6373
|
+
var m = {
|
|
6362
6374
|
blob: {
|
|
6363
6375
|
test: function test(e) {
|
|
6364
6376
|
return "Blob" === toStringTag(e);
|
|
@@ -6384,11 +6396,11 @@
|
|
|
6384
6396
|
n.addEventListener("load", function () {
|
|
6385
6397
|
e({
|
|
6386
6398
|
type: t.type,
|
|
6387
|
-
stringContents: n.result
|
|
6399
|
+
stringContents: arraybuffer2string(n.result)
|
|
6388
6400
|
});
|
|
6389
6401
|
}), n.addEventListener("error", function () {
|
|
6390
6402
|
r(n.error);
|
|
6391
|
-
}), n.
|
|
6403
|
+
}), n.readAsArrayBuffer(t);
|
|
6392
6404
|
});
|
|
6393
6405
|
}
|
|
6394
6406
|
}
|
|
@@ -6713,13 +6725,13 @@
|
|
|
6713
6725
|
n.addEventListener("load", function () {
|
|
6714
6726
|
e({
|
|
6715
6727
|
type: t.type,
|
|
6716
|
-
stringContents: n.result,
|
|
6728
|
+
stringContents: arraybuffer2string(n.result),
|
|
6717
6729
|
name: t.name,
|
|
6718
6730
|
lastModified: t.lastModified
|
|
6719
6731
|
});
|
|
6720
6732
|
}), n.addEventListener("error", function () {
|
|
6721
6733
|
r(n.error);
|
|
6722
|
-
}), n.
|
|
6734
|
+
}), n.readAsArrayBuffer(t);
|
|
6723
6735
|
});
|
|
6724
6736
|
}
|
|
6725
6737
|
}
|
|
@@ -7074,7 +7086,7 @@
|
|
|
7074
7086
|
}
|
|
7075
7087
|
}],
|
|
7076
7088
|
ee = [K, U, F, $],
|
|
7077
|
-
oe = [X, Q, Z, V, ee, A, q, k, B, E, C,
|
|
7089
|
+
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 : []),
|
|
7078
7090
|
ie = oe.concat({
|
|
7079
7091
|
checkDataCloneException: {
|
|
7080
7092
|
test: function test(e) {
|
|
@@ -9337,6 +9349,8 @@
|
|
|
9337
9349
|
function IDBDatabase() {
|
|
9338
9350
|
this.__versionTransaction = null;
|
|
9339
9351
|
this.__objectStores = null;
|
|
9352
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
9353
|
+
this.__transactions = [];
|
|
9340
9354
|
throw new TypeError('Illegal constructor');
|
|
9341
9355
|
}
|
|
9342
9356
|
var IDBDatabaseAlias = IDBDatabase;
|
|
@@ -9400,6 +9414,8 @@
|
|
|
9400
9414
|
this.__setOptions({
|
|
9401
9415
|
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
|
|
9402
9416
|
});
|
|
9417
|
+
|
|
9418
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
9403
9419
|
this.__transactions = [];
|
|
9404
9420
|
|
|
9405
9421
|
/** @type {{[key: string]: IDBObjectStore}} */
|
|
@@ -9529,6 +9545,7 @@
|
|
|
9529
9545
|
if (this.__unblocking) {
|
|
9530
9546
|
this.__unblocking.check();
|
|
9531
9547
|
}
|
|
9548
|
+
this.__transactions = [];
|
|
9532
9549
|
};
|
|
9533
9550
|
|
|
9534
9551
|
/**
|
|
@@ -9627,6 +9644,7 @@
|
|
|
9627
9644
|
};
|
|
9628
9645
|
trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
|
|
9629
9646
|
});
|
|
9647
|
+
me.__transactions = [];
|
|
9630
9648
|
};
|
|
9631
9649
|
defineOuterInterface(IDBDatabase.prototype, listeners);
|
|
9632
9650
|
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
|
|
@@ -10234,6 +10252,10 @@
|
|
|
10234
10252
|
|
|
10235
10253
|
// eslint-disable-next-line camelcase -- Clear API
|
|
10236
10254
|
req.transaction.on__complete = function () {
|
|
10255
|
+
var pos = connection.__transactions.indexOf(req.transaction);
|
|
10256
|
+
if (pos > -1) {
|
|
10257
|
+
connection.__transactions.splice(pos, 1);
|
|
10258
|
+
}
|
|
10237
10259
|
if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
|
|
10238
10260
|
req.__transaction = null;
|
|
10239
10261
|
var err = createDOMException('AbortError', 'The connection has been closed.');
|
|
@@ -10616,9 +10638,10 @@
|
|
|
10616
10638
|
conn.__forceClose(msg);
|
|
10617
10639
|
}
|
|
10618
10640
|
if (isNullish(dbName)) {
|
|
10619
|
-
Object.values(me.__connections).forEach(function (
|
|
10620
|
-
|
|
10621
|
-
|
|
10641
|
+
Object.values(me.__connections).forEach(function (connections) {
|
|
10642
|
+
connections.forEach(function (connection) {
|
|
10643
|
+
forceClose(connection);
|
|
10644
|
+
});
|
|
10622
10645
|
});
|
|
10623
10646
|
} else if (!me.__connections[dbName]) {
|
|
10624
10647
|
console.log('No database connections with that name to force close');
|
|
@@ -10627,7 +10650,7 @@
|
|
|
10627
10650
|
forceClose(conn);
|
|
10628
10651
|
});
|
|
10629
10652
|
} else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
|
|
10630
|
-
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to
|
|
10653
|
+
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
|
|
10631
10654
|
} else {
|
|
10632
10655
|
forceClose(me.__connections[dbName][connIdx]);
|
|
10633
10656
|
}
|