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 (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
function _createForOfIteratorHelper(r, e) {
|
|
78
78
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
79
79
|
if (!t) {
|
|
80
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e
|
|
80
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) {
|
|
81
81
|
t && (r = t);
|
|
82
82
|
var n = 0,
|
|
83
83
|
F = function () {};
|
|
@@ -3204,6 +3204,14 @@
|
|
|
3204
3204
|
* @typedef {any} AnyValue
|
|
3205
3205
|
*/
|
|
3206
3206
|
|
|
3207
|
+
/**
|
|
3208
|
+
* @type {{
|
|
3209
|
+
* [key: string]: {
|
|
3210
|
+
* encode: (param: any, inArray?: boolean) => string,
|
|
3211
|
+
* decode: (param: string, inArray?: boolean) => any
|
|
3212
|
+
* }
|
|
3213
|
+
* }}
|
|
3214
|
+
*/
|
|
3207
3215
|
var types = {
|
|
3208
3216
|
invalid: {
|
|
3209
3217
|
/**
|
|
@@ -4114,7 +4122,6 @@
|
|
|
4114
4122
|
return null;
|
|
4115
4123
|
}
|
|
4116
4124
|
// array, date, number, string, binary (should already have detected "invalid")
|
|
4117
|
-
// @ts-expect-error Argument may be ignored
|
|
4118
4125
|
return types[getKeyType(key)].encode(key, inArray);
|
|
4119
4126
|
}
|
|
4120
4127
|
|
|
@@ -5669,7 +5676,7 @@
|
|
|
5669
5676
|
if ("object" != _typeof$2(e) || null === e) return e;
|
|
5670
5677
|
var r = e[Symbol.toPrimitive];
|
|
5671
5678
|
if (void 0 !== r) {
|
|
5672
|
-
var n = r.call(e, t
|
|
5679
|
+
var n = r.call(e, t);
|
|
5673
5680
|
if ("object" != _typeof$2(n)) return n;
|
|
5674
5681
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5675
5682
|
}
|
|
@@ -5725,7 +5732,7 @@
|
|
|
5725
5732
|
var t = Object.hasOwn,
|
|
5726
5733
|
r = Object.getPrototypeOf;
|
|
5727
5734
|
function isThenable(e, t) {
|
|
5728
|
-
return isObject(e) && "function" == typeof e.then && (!t
|
|
5735
|
+
return isObject(e) && "function" == typeof e.then && (!t);
|
|
5729
5736
|
}
|
|
5730
5737
|
function toStringTag(e) {
|
|
5731
5738
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -5880,8 +5887,8 @@
|
|
|
5880
5887
|
p = [],
|
|
5881
5888
|
d = [],
|
|
5882
5889
|
v = !("cyclic" in u) || u.cyclic,
|
|
5883
|
-
|
|
5884
|
-
|
|
5890
|
+
b = u.encapsulateObserver,
|
|
5891
|
+
h = function finish(e) {
|
|
5885
5892
|
var t = Object.values(f);
|
|
5886
5893
|
if (u.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
5887
5894
|
if (t.length) {
|
|
@@ -5906,7 +5913,7 @@
|
|
|
5906
5913
|
});
|
|
5907
5914
|
return !u.returnTypeNames && e;
|
|
5908
5915
|
},
|
|
5909
|
-
|
|
5916
|
+
m = _async(function (t, r) {
|
|
5910
5917
|
return _await(Promise.all(r.map(function (e) {
|
|
5911
5918
|
return e[1].p;
|
|
5912
5919
|
})), function (n) {
|
|
@@ -5929,11 +5936,11 @@
|
|
|
5929
5936
|
}(function () {
|
|
5930
5937
|
if (s && v) return _await(d.p, function (e) {
|
|
5931
5938
|
f[y] = e;
|
|
5932
|
-
var r =
|
|
5939
|
+
var r = m(t, o);
|
|
5933
5940
|
return a = !0, r;
|
|
5934
5941
|
});
|
|
5935
5942
|
}, function (e) {
|
|
5936
|
-
return a ? e : (s ? f[y] = d : t = v ? d.p : d,
|
|
5943
|
+
return a ? e : (s ? f[y] = d : t = v ? d.p : d, m(t, o));
|
|
5937
5944
|
});
|
|
5938
5945
|
}))), function () {
|
|
5939
5946
|
return t;
|
|
@@ -5951,13 +5958,13 @@
|
|
|
5951
5958
|
});
|
|
5952
5959
|
},
|
|
5953
5960
|
O = function _encapsulate(t, r, i, c, l, d, v) {
|
|
5954
|
-
var
|
|
5955
|
-
|
|
5961
|
+
var h,
|
|
5962
|
+
m = {},
|
|
5956
5963
|
O = _typeof(r),
|
|
5957
|
-
_ =
|
|
5964
|
+
_ = b ? function (n) {
|
|
5958
5965
|
var a,
|
|
5959
5966
|
o = null !== (a = null != v ? v : c.type) && void 0 !== a ? a : getJSONType(r);
|
|
5960
|
-
|
|
5967
|
+
b(Object.assign(null != n ? n : m, {
|
|
5961
5968
|
keypath: t,
|
|
5962
5969
|
value: r,
|
|
5963
5970
|
cyclic: i,
|
|
@@ -5969,9 +5976,9 @@
|
|
|
5969
5976
|
type: o
|
|
5970
5977
|
}));
|
|
5971
5978
|
} : null;
|
|
5972
|
-
if (["string", "boolean", "number", "undefined"].includes(O)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (
|
|
5973
|
-
replaced:
|
|
5974
|
-
}) :
|
|
5979
|
+
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 = {
|
|
5980
|
+
replaced: h
|
|
5981
|
+
}) : h = r, _ && _(), h;
|
|
5975
5982
|
if (null === r) return _ && _(), r;
|
|
5976
5983
|
if (i && !c.iterateIn && !c.iterateUnsetNumeric && r && "object" === _typeof(r)) {
|
|
5977
5984
|
var A = y.indexOf(r);
|
|
@@ -5985,14 +5992,14 @@
|
|
|
5985
5992
|
T = isPlainObject(r),
|
|
5986
5993
|
I = o(r),
|
|
5987
5994
|
N = (T || I) && (!s.plainObjectReplacers.length || c.replaced) || c.iterateIn ? r : w(t, r, c, l, T || I, null, _);
|
|
5988
|
-
if (N !== r ? (
|
|
5995
|
+
if (N !== r ? (h = N, m = {
|
|
5989
5996
|
replaced: N
|
|
5990
|
-
}) : "" === t && hasConstructorOf(r, e) ? (l.push([t, r, i, c, void 0, void 0, c.type]),
|
|
5997
|
+
}) : "" === 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 = {
|
|
5991
5998
|
clone: S
|
|
5992
|
-
}) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !T && "object" !== c.iterateIn ?
|
|
5999
|
+
}) : (["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 = {
|
|
5993
6000
|
clone: S
|
|
5994
|
-
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j :
|
|
5995
|
-
if (!S) return
|
|
6001
|
+
}), _ && _(), u.iterateNone) return null !== (j = S) && void 0 !== j ? j : h;
|
|
6002
|
+
if (!S) return h;
|
|
5996
6003
|
if (c.iterateIn) {
|
|
5997
6004
|
var P = function _loop(n) {
|
|
5998
6005
|
var o = {
|
|
@@ -6058,12 +6065,12 @@
|
|
|
6058
6065
|
i && i({
|
|
6059
6066
|
replacing: !0
|
|
6060
6067
|
});
|
|
6061
|
-
var
|
|
6068
|
+
var b = void 0;
|
|
6062
6069
|
if (l || !y.replaceAsync) {
|
|
6063
6070
|
if (void 0 === y.replace) throw new TypeError("Missing replacer");
|
|
6064
|
-
|
|
6065
|
-
} else
|
|
6066
|
-
return O(e,
|
|
6071
|
+
b = y.replace(t, r);
|
|
6072
|
+
} else b = y.replaceAsync(t, r);
|
|
6073
|
+
return O(e, b, v && "readonly", r, n, o, p);
|
|
6067
6074
|
}
|
|
6068
6075
|
}
|
|
6069
6076
|
return t;
|
|
@@ -6071,9 +6078,9 @@
|
|
|
6071
6078
|
_ = O("", t, v, null != r ? r : {}, d);
|
|
6072
6079
|
if (d.length) return l && u.throwOnBadSyncType ? function () {
|
|
6073
6080
|
throw new TypeError("Sync method requested but async result obtained");
|
|
6074
|
-
}() : Promise.resolve(
|
|
6081
|
+
}() : Promise.resolve(m(_, d)).then(h);
|
|
6075
6082
|
if (!l && u.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
6076
|
-
return u.stringification && l ? [
|
|
6083
|
+
return u.stringification && l ? [h(_)] : l ? h(_) : Promise.resolve(h(_));
|
|
6077
6084
|
}
|
|
6078
6085
|
}, {
|
|
6079
6086
|
key: "encapsulateSync",
|
|
@@ -6128,7 +6135,7 @@
|
|
|
6128
6135
|
return hasConstructorOf(e, s) ? void 0 : e;
|
|
6129
6136
|
}
|
|
6130
6137
|
var v,
|
|
6131
|
-
|
|
6138
|
+
b = function revivePlainObjects() {
|
|
6132
6139
|
var r = [];
|
|
6133
6140
|
if (!u) throw new Error("Found bad `types`");
|
|
6134
6141
|
if (Object.entries(u).forEach(function (e) {
|
|
@@ -6160,29 +6167,29 @@
|
|
|
6160
6167
|
c === i && (t = c);
|
|
6161
6168
|
}, void 0);
|
|
6162
6169
|
}();
|
|
6163
|
-
return hasConstructorOf(
|
|
6170
|
+
return hasConstructorOf(b, e) ? v = b.then(function () {
|
|
6164
6171
|
return t;
|
|
6165
6172
|
}) : (v = function _revive(t, r, a, i, c) {
|
|
6166
6173
|
if (!y || "$types" !== t) {
|
|
6167
6174
|
var f = u[t],
|
|
6168
6175
|
v = o(r);
|
|
6169
6176
|
if (v || isPlainObject(r)) {
|
|
6170
|
-
var
|
|
6177
|
+
var b = v ? new Array(r.length) : {};
|
|
6171
6178
|
for (n(r).forEach(function (n) {
|
|
6172
|
-
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a :
|
|
6179
|
+
var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a : b, b, n),
|
|
6173
6180
|
i = function set(e) {
|
|
6174
|
-
return hasConstructorOf(e, s) ?
|
|
6181
|
+
return hasConstructorOf(e, s) ? b[n] = void 0 : void 0 !== e && (b[n] = e), e;
|
|
6175
6182
|
};
|
|
6176
6183
|
hasConstructorOf(o, e) ? d.push(o.then(function (e) {
|
|
6177
6184
|
return i(e);
|
|
6178
6185
|
})) : i(o);
|
|
6179
|
-
}), r =
|
|
6180
|
-
var
|
|
6181
|
-
|
|
6182
|
-
g =
|
|
6183
|
-
O =
|
|
6184
|
-
w =
|
|
6185
|
-
_ = getByKeyPath(
|
|
6186
|
+
}), r = b; l.length;) {
|
|
6187
|
+
var h = _slicedToArray(l[0], 4),
|
|
6188
|
+
m = h[0],
|
|
6189
|
+
g = h[1],
|
|
6190
|
+
O = h[2],
|
|
6191
|
+
w = h[3],
|
|
6192
|
+
_ = getByKeyPath(m, g);
|
|
6186
6193
|
if (void 0 === _) break;
|
|
6187
6194
|
O[w] = _, l.splice(0, 1);
|
|
6188
6195
|
}
|
|
@@ -6336,7 +6343,7 @@
|
|
|
6336
6343
|
}
|
|
6337
6344
|
}
|
|
6338
6345
|
},
|
|
6339
|
-
|
|
6346
|
+
b = {
|
|
6340
6347
|
bigintObject: {
|
|
6341
6348
|
test: function test(e) {
|
|
6342
6349
|
return "object" == _typeof$2(e) && hasConstructorOf(e, BigInt);
|
|
@@ -6347,7 +6354,7 @@
|
|
|
6347
6354
|
}
|
|
6348
6355
|
}
|
|
6349
6356
|
},
|
|
6350
|
-
|
|
6357
|
+
h = {
|
|
6351
6358
|
bigint: {
|
|
6352
6359
|
test: function test(e) {
|
|
6353
6360
|
return "bigint" == typeof e;
|
|
@@ -6358,12 +6365,17 @@
|
|
|
6358
6365
|
}
|
|
6359
6366
|
}
|
|
6360
6367
|
};
|
|
6368
|
+
function arraybuffer2string(e) {
|
|
6369
|
+
return new Uint8Array(e).reduce(function (e, t) {
|
|
6370
|
+
return e + String.fromCodePoint(t);
|
|
6371
|
+
}, "");
|
|
6372
|
+
}
|
|
6361
6373
|
function string2arraybuffer(e) {
|
|
6362
6374
|
var t = new Uint8Array(e.length);
|
|
6363
6375
|
for (var _r = 0; _r < e.length; _r++) t[_r] = e.charCodeAt(_r);
|
|
6364
6376
|
return t.buffer;
|
|
6365
6377
|
}
|
|
6366
|
-
var
|
|
6378
|
+
var m = {
|
|
6367
6379
|
blob: {
|
|
6368
6380
|
test: function test(e) {
|
|
6369
6381
|
return "Blob" === toStringTag(e);
|
|
@@ -6389,11 +6401,11 @@
|
|
|
6389
6401
|
n.addEventListener("load", function () {
|
|
6390
6402
|
e({
|
|
6391
6403
|
type: t.type,
|
|
6392
|
-
stringContents: n.result
|
|
6404
|
+
stringContents: arraybuffer2string(n.result)
|
|
6393
6405
|
});
|
|
6394
6406
|
}), n.addEventListener("error", function () {
|
|
6395
6407
|
r(n.error);
|
|
6396
|
-
}), n.
|
|
6408
|
+
}), n.readAsArrayBuffer(t);
|
|
6397
6409
|
});
|
|
6398
6410
|
}
|
|
6399
6411
|
}
|
|
@@ -6718,13 +6730,13 @@
|
|
|
6718
6730
|
n.addEventListener("load", function () {
|
|
6719
6731
|
e({
|
|
6720
6732
|
type: t.type,
|
|
6721
|
-
stringContents: n.result,
|
|
6733
|
+
stringContents: arraybuffer2string(n.result),
|
|
6722
6734
|
name: t.name,
|
|
6723
6735
|
lastModified: t.lastModified
|
|
6724
6736
|
});
|
|
6725
6737
|
}), n.addEventListener("error", function () {
|
|
6726
6738
|
r(n.error);
|
|
6727
|
-
}), n.
|
|
6739
|
+
}), n.readAsArrayBuffer(t);
|
|
6728
6740
|
});
|
|
6729
6741
|
}
|
|
6730
6742
|
}
|
|
@@ -7079,7 +7091,7 @@
|
|
|
7079
7091
|
}
|
|
7080
7092
|
}],
|
|
7081
7093
|
ee = [K, U, F, $],
|
|
7082
|
-
oe = [X, Q, Z, V, ee, A, q, k, B, E, C,
|
|
7094
|
+
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 : []),
|
|
7083
7095
|
ie = oe.concat({
|
|
7084
7096
|
checkDataCloneException: {
|
|
7085
7097
|
test: function test(e) {
|
|
@@ -9342,6 +9354,8 @@
|
|
|
9342
9354
|
function IDBDatabase() {
|
|
9343
9355
|
this.__versionTransaction = null;
|
|
9344
9356
|
this.__objectStores = null;
|
|
9357
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
9358
|
+
this.__transactions = [];
|
|
9345
9359
|
throw new TypeError('Illegal constructor');
|
|
9346
9360
|
}
|
|
9347
9361
|
var IDBDatabaseAlias = IDBDatabase;
|
|
@@ -9405,6 +9419,8 @@
|
|
|
9405
9419
|
this.__setOptions({
|
|
9406
9420
|
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
|
|
9407
9421
|
});
|
|
9422
|
+
|
|
9423
|
+
/** @type {import('./IDBTransaction.js').IDBTransactionFull[]} */
|
|
9408
9424
|
this.__transactions = [];
|
|
9409
9425
|
|
|
9410
9426
|
/** @type {{[key: string]: IDBObjectStore}} */
|
|
@@ -9534,6 +9550,7 @@
|
|
|
9534
9550
|
if (this.__unblocking) {
|
|
9535
9551
|
this.__unblocking.check();
|
|
9536
9552
|
}
|
|
9553
|
+
this.__transactions = [];
|
|
9537
9554
|
};
|
|
9538
9555
|
|
|
9539
9556
|
/**
|
|
@@ -9632,6 +9649,7 @@
|
|
|
9632
9649
|
};
|
|
9633
9650
|
trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
|
|
9634
9651
|
});
|
|
9652
|
+
me.__transactions = [];
|
|
9635
9653
|
};
|
|
9636
9654
|
defineOuterInterface(IDBDatabase.prototype, listeners);
|
|
9637
9655
|
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
|
|
@@ -10239,6 +10257,10 @@
|
|
|
10239
10257
|
|
|
10240
10258
|
// eslint-disable-next-line camelcase -- Clear API
|
|
10241
10259
|
req.transaction.on__complete = function () {
|
|
10260
|
+
var pos = connection.__transactions.indexOf(req.transaction);
|
|
10261
|
+
if (pos > -1) {
|
|
10262
|
+
connection.__transactions.splice(pos, 1);
|
|
10263
|
+
}
|
|
10242
10264
|
if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
|
|
10243
10265
|
req.__transaction = null;
|
|
10244
10266
|
var err = createDOMException('AbortError', 'The connection has been closed.');
|
|
@@ -10621,9 +10643,10 @@
|
|
|
10621
10643
|
conn.__forceClose(msg);
|
|
10622
10644
|
}
|
|
10623
10645
|
if (isNullish(dbName)) {
|
|
10624
|
-
Object.values(me.__connections).forEach(function (
|
|
10625
|
-
|
|
10626
|
-
|
|
10646
|
+
Object.values(me.__connections).forEach(function (connections) {
|
|
10647
|
+
connections.forEach(function (connection) {
|
|
10648
|
+
forceClose(connection);
|
|
10649
|
+
});
|
|
10627
10650
|
});
|
|
10628
10651
|
} else if (!me.__connections[dbName]) {
|
|
10629
10652
|
console.log('No database connections with that name to force close');
|
|
@@ -10632,7 +10655,7 @@
|
|
|
10632
10655
|
forceClose(conn);
|
|
10633
10656
|
});
|
|
10634
10657
|
} else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
|
|
10635
|
-
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to
|
|
10658
|
+
throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
|
|
10636
10659
|
} else {
|
|
10637
10660
|
forceClose(me.__connections[dbName][connIdx]);
|
|
10638
10661
|
}
|