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
package/dist/indexeddbshim.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v15.0.0 - 8/3/2024 */
|
|
2
2
|
|
|
3
3
|
(function (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
function _createForOfIteratorHelper(r, e) {
|
|
66
66
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
67
67
|
if (!t) {
|
|
68
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e
|
|
68
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) {
|
|
69
69
|
t && (r = t);
|
|
70
70
|
var n = 0,
|
|
71
71
|
F = function () {};
|
|
@@ -3192,6 +3192,14 @@
|
|
|
3192
3192
|
* @typedef {any} AnyValue
|
|
3193
3193
|
*/
|
|
3194
3194
|
|
|
3195
|
+
/**
|
|
3196
|
+
* @type {{
|
|
3197
|
+
* [key: string]: {
|
|
3198
|
+
* encode: (param: any, inArray?: boolean) => string,
|
|
3199
|
+
* decode: (param: string, inArray?: boolean) => any
|
|
3200
|
+
* }
|
|
3201
|
+
* }}
|
|
3202
|
+
*/
|
|
3195
3203
|
var types = {
|
|
3196
3204
|
invalid: {
|
|
3197
3205
|
/**
|
|
@@ -4102,7 +4110,6 @@
|
|
|
4102
4110
|
return null;
|
|
4103
4111
|
}
|
|
4104
4112
|
// array, date, number, string, binary (should already have detected "invalid")
|
|
4105
|
-
// @ts-expect-error Argument may be ignored
|
|
4106
4113
|
return types[getKeyType(key)].encode(key, inArray);
|
|
4107
4114
|
}
|
|
4108
4115
|
|
|
@@ -5657,7 +5664,7 @@
|
|
|
5657
5664
|
if ("object" != _typeof$2(e) || null === e) return e;
|
|
5658
5665
|
var r = e[Symbol.toPrimitive];
|
|
5659
5666
|
if (void 0 !== r) {
|
|
5660
|
-
var n = r.call(e, t
|
|
5667
|
+
var n = r.call(e, t);
|
|
5661
5668
|
if ("object" != _typeof$2(n)) return n;
|
|
5662
5669
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5663
5670
|
}
|
|
@@ -5713,7 +5720,7 @@
|
|
|
5713
5720
|
var t = Object.hasOwn,
|
|
5714
5721
|
r = Object.getPrototypeOf;
|
|
5715
5722
|
function isThenable(e, t) {
|
|
5716
|
-
return isObject(e) && "function" == typeof e.then && (!t
|
|
5723
|
+
return isObject(e) && "function" == typeof e.then && (!t);
|
|
5717
5724
|
}
|
|
5718
5725
|
function toStringTag(e) {
|
|
5719
5726
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -5868,8 +5875,8 @@
|
|
|
5868
5875
|
p = [],
|
|
5869
5876
|
d = [],
|
|
5870
5877
|
v = !("cyclic" in u) || u.cyclic,
|
|
5871
|
-
|
|
5872
|
-
|
|
5878
|
+
b = u.encapsulateObserver,
|
|
5879
|
+
h = function finish(e) {
|
|
5873
5880
|
var t = Object.values(f);
|
|
5874
5881
|
if (u.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
5875
5882
|
if (t.length) {
|
|
@@ -5894,7 +5901,7 @@
|
|
|
5894
5901
|
});
|
|
5895
5902
|
return !u.returnTypeNames && e;
|
|
5896
5903
|
},
|
|
5897
|
-
|
|
5904
|
+
m = _async(function (t, r) {
|
|
5898
5905
|
return _await(Promise.all(r.map(function (e) {
|
|
5899
5906
|
return e[1].p;
|
|
5900
5907
|
})), function (n) {
|
|
@@ -5917,11 +5924,11 @@
|
|
|
5917
5924
|
}(function () {
|
|
5918
5925
|
if (s && v) return _await(d.p, function (e) {
|
|
5919
5926
|
f[y] = e;
|
|
5920
|
-
var r =
|
|
5927
|
+
var r = m(t, o);
|
|
5921
5928
|
return a = !0, r;
|
|
5922
5929
|
});
|
|
5923
5930
|
}, function (e) {
|
|
5924
|
-
return a ? e : (s ? f[y] = d : t = v ? d.p : d,
|
|
5931
|
+
return a ? e : (s ? f[y] = d : t = v ? d.p : d, m(t, o));
|
|
5925
5932
|
});
|
|
5926
5933
|
}))), function () {
|
|
5927
5934
|
return t;
|
|
@@ -5939,13 +5946,13 @@
|
|
|
5939
5946
|
});
|
|
5940
5947
|
},
|
|
5941
5948
|
O = function _encapsulate(t, r, i, c, l, d, v) {
|
|
5942
|
-
var
|
|
5943
|
-
|
|
5949
|
+
var h,
|
|
5950
|
+
m = {},
|
|
5944
5951
|
O = _typeof(r),
|
|
5945
|
-
_ =
|
|
5952
|
+
_ = b ? function (n) {
|
|
5946
5953
|
var a,
|
|
5947
5954
|
o = null !== (a = null != v ? v : c.type) && void 0 !== a ? a : getJSONType(r);
|
|
5948
|
-
|
|
5955
|
+
b(Object.assign(null != n ? n : m, {
|
|
5949
5956
|
keypath: t,
|
|
5950
5957
|
value: r,
|
|
5951
5958
|
cyclic: i,
|
|
@@ -5957,9 +5964,9 @@
|
|
|
5957
5964
|
type: o
|
|
5958
5965
|
}));
|
|
5959
5966
|
} : null;
|
|
5960
|
-
if (["string", "boolean", "number", "undefined"].includes(O)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (
|
|
5961
|
-
replaced:
|
|
5962
|
-
}) :
|
|
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 ? (h = c.replaced ? r : w(t, r, c, l, !1, d, _)) !== r && (m = {
|
|
5968
|
+
replaced: h
|
|
5969
|
+
}) : h = r, _ && _(), h;
|
|
5963
5970
|
if (null === r) return _ && _(), r;
|
|
5964
5971
|
if (i && !c.iterateIn && !c.iterateUnsetNumeric && r && "object" === _typeof(r)) {
|
|
5965
5972
|
var A = y.indexOf(r);
|
|
@@ -5973,14 +5980,14 @@
|
|
|
5973
5980
|
T = isPlainObject(r),
|
|
5974
5981
|
I = o(r),
|
|
5975
5982
|
N = (T || I) && (!s.plainObjectReplacers.length || c.replaced) || c.iterateIn ? r : w(t, r, c, l, T || I, null, _);
|
|
5976
|
-
if (N !== r ? (
|
|
5983
|
+
if (N !== r ? (h = N, m = {
|
|
5977
5984
|
replaced: N
|
|
5978
|
-
}) : "" === t && hasConstructorOf(r, e) ? (l.push([t, r, i, c, void 0, void 0, c.type]),
|
|
5985
|
+
}) : "" === 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 = {
|
|
5979
5986
|
clone: S
|
|
5980
|
-
}) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !T && "object" !== c.iterateIn ?
|
|
5987
|
+
}) : (["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 = {
|
|
5981
5988
|
clone: S
|
|
5982
|
-
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j :
|
|
5983
|
-
if (!S) return
|
|
5989
|
+
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j : h;
|
|
5990
|
+
if (!S) return h;
|
|
5984
5991
|
if (c.iterateIn) {
|
|
5985
5992
|
var P = function _loop(n) {
|
|
5986
5993
|
var o = {
|
|
@@ -6046,12 +6053,12 @@
|
|
|
6046
6053
|
i && i({
|
|
6047
6054
|
replacing: !0
|
|
6048
6055
|
});
|
|
6049
|
-
var
|
|
6056
|
+
var b = void 0;
|
|
6050
6057
|
if (l || !y.replaceAsync) {
|
|
6051
6058
|
if (void 0 === y.replace) throw new TypeError("Missing replacer");
|
|
6052
|
-
|
|
6053
|
-
} else
|
|
6054
|
-
return O(e,
|
|
6059
|
+
b = y.replace(t, r);
|
|
6060
|
+
} else b = y.replaceAsync(t, r);
|
|
6061
|
+
return O(e, b, v && "readonly", r, n, o, p);
|
|
6055
6062
|
}
|
|
6056
6063
|
}
|
|
6057
6064
|
return t;
|
|
@@ -6059,9 +6066,9 @@
|
|
|
6059
6066
|
_ = O("", t, v, null != r ? r : {}, d);
|
|
6060
6067
|
if (d.length) return l && u.throwOnBadSyncType ? function () {
|
|
6061
6068
|
throw new TypeError("Sync method requested but async result obtained");
|
|
6062
|
-
}() : Promise.resolve(
|
|
6069
|
+
}() : Promise.resolve(m(_, d)).then(h);
|
|
6063
6070
|
if (!l && u.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
6064
|
-
return u.stringification && l ? [
|
|
6071
|
+
return u.stringification && l ? [h(_)] : l ? h(_) : Promise.resolve(h(_));
|
|
6065
6072
|
}
|
|
6066
6073
|
}, {
|
|
6067
6074
|
key: "encapsulateSync",
|
|
@@ -6116,7 +6123,7 @@
|
|
|
6116
6123
|
return hasConstructorOf(e, s) ? void 0 : e;
|
|
6117
6124
|
}
|
|
6118
6125
|
var v,
|
|
6119
|
-
|
|
6126
|
+
b = function revivePlainObjects() {
|
|
6120
6127
|
var r = [];
|
|
6121
6128
|
if (!u) throw new Error("Found bad `types`");
|
|
6122
6129
|
if (Object.entries(u).forEach(function (e) {
|
|
@@ -6148,29 +6155,29 @@
|
|
|
6148
6155
|
c === i && (t = c);
|
|
6149
6156
|
}, void 0);
|
|
6150
6157
|
}();
|
|
6151
|
-
return hasConstructorOf(
|
|
6158
|
+
return hasConstructorOf(b, e) ? v = b.then(function () {
|
|
6152
6159
|
return t;
|
|
6153
6160
|
}) : (v = function _revive(t, r, a, i, c) {
|
|
6154
6161
|
if (!y || "$types" !== t) {
|
|
6155
6162
|
var f = u[t],
|
|
6156
6163
|
v = o(r);
|
|
6157
6164
|
if (v || isPlainObject(r)) {
|
|
6158
|
-
var
|
|
6165
|
+
var b = v ? new Array(r.length) : {};
|
|
6159
6166
|
for (n(r).forEach(function (n) {
|
|
6160
|
-
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a :
|
|
6167
|
+
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a : b, b, n),
|
|
6161
6168
|
i = function set(e) {
|
|
6162
|
-
return hasConstructorOf(e, s) ?
|
|
6169
|
+
return hasConstructorOf(e, s) ? b[n] = void 0 : void 0 !== e && (b[n] = e), e;
|
|
6163
6170
|
};
|
|
6164
6171
|
hasConstructorOf(o, e) ? d.push(o.then(function (e) {
|
|
6165
6172
|
return i(e);
|
|
6166
6173
|
})) : i(o);
|
|
6167
|
-
}), r =
|
|
6168
|
-
var
|
|
6169
|
-
|
|
6170
|
-
g =
|
|
6171
|
-
O =
|
|
6172
|
-
w =
|
|
6173
|
-
_ = getByKeyPath(
|
|
6174
|
+
}), r = b; l.length;) {
|
|
6175
|
+
var h = _slicedToArray(l[0], 4),
|
|
6176
|
+
m = h[0],
|
|
6177
|
+
g = h[1],
|
|
6178
|
+
O = h[2],
|
|
6179
|
+
w = h[3],
|
|
6180
|
+
_ = getByKeyPath(m, g);
|
|
6174
6181
|
if (void 0 === _) break;
|
|
6175
6182
|
O[w] = _, l.splice(0, 1);
|
|
6176
6183
|
}
|
|
@@ -6324,7 +6331,7 @@
|
|
|
6324
6331
|
}
|
|
6325
6332
|
}
|
|
6326
6333
|
},
|
|
6327
|
-
|
|
6334
|
+
b = {
|
|
6328
6335
|
bigintObject: {
|
|
6329
6336
|
test: function test(e) {
|
|
6330
6337
|
return "object" == _typeof$2(e) && hasConstructorOf(e, BigInt);
|
|
@@ -6335,7 +6342,7 @@
|
|
|
6335
6342
|
}
|
|
6336
6343
|
}
|
|
6337
6344
|
},
|
|
6338
|
-
|
|
6345
|
+
h = {
|
|
6339
6346
|
bigint: {
|
|
6340
6347
|
test: function test(e) {
|
|
6341
6348
|
return "bigint" == typeof e;
|
|
@@ -6346,12 +6353,17 @@
|
|
|
6346
6353
|
}
|
|
6347
6354
|
}
|
|
6348
6355
|
};
|
|
6356
|
+
function arraybuffer2string(e) {
|
|
6357
|
+
return new Uint8Array(e).reduce(function (e, t) {
|
|
6358
|
+
return e + String.fromCodePoint(t);
|
|
6359
|
+
}, "");
|
|
6360
|
+
}
|
|
6349
6361
|
function string2arraybuffer(e) {
|
|
6350
6362
|
var t = new Uint8Array(e.length);
|
|
6351
6363
|
for (var _r = 0; _r < e.length; _r++) t[_r] = e.charCodeAt(_r);
|
|
6352
6364
|
return t.buffer;
|
|
6353
6365
|
}
|
|
6354
|
-
var
|
|
6366
|
+
var m = {
|
|
6355
6367
|
blob: {
|
|
6356
6368
|
test: function test(e) {
|
|
6357
6369
|
return "Blob" === toStringTag(e);
|
|
@@ -6377,11 +6389,11 @@
|
|
|
6377
6389
|
n.addEventListener("load", function () {
|
|
6378
6390
|
e({
|
|
6379
6391
|
type: t.type,
|
|
6380
|
-
stringContents: n.result
|
|
6392
|
+
stringContents: arraybuffer2string(n.result)
|
|
6381
6393
|
});
|
|
6382
6394
|
}), n.addEventListener("error", function () {
|
|
6383
6395
|
r(n.error);
|
|
6384
|
-
}), n.
|
|
6396
|
+
}), n.readAsArrayBuffer(t);
|
|
6385
6397
|
});
|
|
6386
6398
|
}
|
|
6387
6399
|
}
|
|
@@ -6706,13 +6718,13 @@
|
|
|
6706
6718
|
n.addEventListener("load", function () {
|
|
6707
6719
|
e({
|
|
6708
6720
|
type: t.type,
|
|
6709
|
-
stringContents: n.result,
|
|
6721
|
+
stringContents: arraybuffer2string(n.result),
|
|
6710
6722
|
name: t.name,
|
|
6711
6723
|
lastModified: t.lastModified
|
|
6712
6724
|
});
|
|
6713
6725
|
}), n.addEventListener("error", function () {
|
|
6714
6726
|
r(n.error);
|
|
6715
|
-
}), n.
|
|
6727
|
+
}), n.readAsArrayBuffer(t);
|
|
6716
6728
|
});
|
|
6717
6729
|
}
|
|
6718
6730
|
}
|
|
@@ -7067,7 +7079,7 @@
|
|
|
7067
7079
|
}
|
|
7068
7080
|
}],
|
|
7069
7081
|
ee = [K, U, F, $],
|
|
7070
|
-
oe = [X, Q, Z, V, ee, A, q, k, B, E, C,
|
|
7082
|
+
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 : []),
|
|
7071
7083
|
ie = oe.concat({
|
|
7072
7084
|
checkDataCloneException: {
|
|
7073
7085
|
test: function test(e) {
|
|
@@ -9330,6 +9342,8 @@
|
|
|
9330
9342
|
function IDBDatabase() {
|
|
9331
9343
|
this.__versionTransaction = null;
|
|
9332
9344
|
this.__objectStores = null;
|
|
9345
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
9346
|
+
this.__transactions = [];
|
|
9333
9347
|
throw new TypeError('Illegal constructor');
|
|
9334
9348
|
}
|
|
9335
9349
|
var IDBDatabaseAlias = IDBDatabase;
|
|
@@ -9393,6 +9407,8 @@
|
|
|
9393
9407
|
this.__setOptions({
|
|
9394
9408
|
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
|
|
9395
9409
|
});
|
|
9410
|
+
|
|
9411
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
9396
9412
|
this.__transactions = [];
|
|
9397
9413
|
|
|
9398
9414
|
/** @type {{[key: string]: IDBObjectStore}} */
|
|
@@ -9522,6 +9538,7 @@
|
|
|
9522
9538
|
if (this.__unblocking) {
|
|
9523
9539
|
this.__unblocking.check();
|
|
9524
9540
|
}
|
|
9541
|
+
this.__transactions = [];
|
|
9525
9542
|
};
|
|
9526
9543
|
|
|
9527
9544
|
/**
|
|
@@ -9620,6 +9637,7 @@
|
|
|
9620
9637
|
};
|
|
9621
9638
|
trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
|
|
9622
9639
|
});
|
|
9640
|
+
me.__transactions = [];
|
|
9623
9641
|
};
|
|
9624
9642
|
defineOuterInterface(IDBDatabase.prototype, listeners);
|
|
9625
9643
|
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
|
|
@@ -10227,6 +10245,10 @@
|
|
|
10227
10245
|
|
|
10228
10246
|
// eslint-disable-next-line camelcase -- Clear API
|
|
10229
10247
|
req.transaction.on__complete = function () {
|
|
10248
|
+
var pos = connection.__transactions.indexOf(req.transaction);
|
|
10249
|
+
if (pos > -1) {
|
|
10250
|
+
connection.__transactions.splice(pos, 1);
|
|
10251
|
+
}
|
|
10230
10252
|
if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
|
|
10231
10253
|
req.__transaction = null;
|
|
10232
10254
|
var err = createDOMException('AbortError', 'The connection has been closed.');
|
|
@@ -10609,9 +10631,10 @@
|
|
|
10609
10631
|
conn.__forceClose(msg);
|
|
10610
10632
|
}
|
|
10611
10633
|
if (isNullish(dbName)) {
|
|
10612
|
-
Object.values(me.__connections).forEach(function (
|
|
10613
|
-
|
|
10614
|
-
|
|
10634
|
+
Object.values(me.__connections).forEach(function (connections) {
|
|
10635
|
+
connections.forEach(function (connection) {
|
|
10636
|
+
forceClose(connection);
|
|
10637
|
+
});
|
|
10615
10638
|
});
|
|
10616
10639
|
} else if (!me.__connections[dbName]) {
|
|
10617
10640
|
console.log('No database connections with that name to force close');
|
|
@@ -10620,7 +10643,7 @@
|
|
|
10620
10643
|
forceClose(conn);
|
|
10621
10644
|
});
|
|
10622
10645
|
} else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
|
|
10623
|
-
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to
|
|
10646
|
+
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
|
|
10624
10647
|
} else {
|
|
10625
10648
|
forceClose(me.__connections[dbName][connIdx]);
|
|
10626
10649
|
}
|