dexie 4.0.1-beta.1 → 4.0.1-beta.2
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/browserstack.err +1 -0
- package/dist/dexie.d.ts +1 -1
- package/dist/dexie.js +121 -70
- package/dist/dexie.js.map +1 -1
- package/dist/dexie.min.js +1 -1
- package/dist/dexie.min.js.map +1 -1
- package/dist/dexie.mjs +121 -70
- package/dist/dexie.mjs.map +1 -1
- package/dist/modern/dexie.min.mjs +1 -1
- package/dist/modern/dexie.min.mjs.map +1 -1
- package/dist/modern/dexie.mjs +122 -71
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +1 -1
package/browserstack.err
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[object Object]
|
package/dist/dexie.d.ts
CHANGED
package/dist/dexie.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* By David Fahlander, david.fahlander@gmail.com
|
|
6
6
|
*
|
|
7
|
-
* Version 4.0.1-beta.
|
|
7
|
+
* Version 4.0.1-beta.2, Wed Nov 29 2023
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -711,11 +711,9 @@
|
|
|
711
711
|
},
|
|
712
712
|
finally: function (onFinally) {
|
|
713
713
|
return this.then(function (value) {
|
|
714
|
-
onFinally();
|
|
715
|
-
return value;
|
|
714
|
+
return DexiePromise.resolve(onFinally()).then(function () { return value; });
|
|
716
715
|
}, function (err) {
|
|
717
|
-
onFinally();
|
|
718
|
-
return PromiseReject(err);
|
|
716
|
+
return DexiePromise.resolve(onFinally()).then(function () { return PromiseReject(err); });
|
|
719
717
|
});
|
|
720
718
|
},
|
|
721
719
|
stack: {
|
|
@@ -1271,7 +1269,7 @@
|
|
|
1271
1269
|
}
|
|
1272
1270
|
}
|
|
1273
1271
|
|
|
1274
|
-
var DEXIE_VERSION = '4.0.1-beta.
|
|
1272
|
+
var DEXIE_VERSION = '4.0.1-beta.2';
|
|
1275
1273
|
var maxString = String.fromCharCode(65535);
|
|
1276
1274
|
var minKey = -Infinity;
|
|
1277
1275
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -4017,69 +4015,82 @@
|
|
|
4017
4015
|
}
|
|
4018
4016
|
var resolveDbReady = state.dbReadyResolve,
|
|
4019
4017
|
upgradeTransaction = null, wasCreated = false;
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
}
|
|
4018
|
+
var tryOpenDB = function () { return new DexiePromise(function (resolve, reject) {
|
|
4019
|
+
throwIfCancelled();
|
|
4020
|
+
if (!indexedDB)
|
|
4021
|
+
throw new exceptions.MissingAPI();
|
|
4022
|
+
var dbName = db.name;
|
|
4023
|
+
var req = state.autoSchema ?
|
|
4024
|
+
indexedDB.open(dbName) :
|
|
4025
|
+
indexedDB.open(dbName, Math.round(db.verno * 10));
|
|
4026
|
+
if (!req)
|
|
4027
|
+
throw new exceptions.MissingAPI();
|
|
4028
|
+
req.onerror = eventRejectHandler(reject);
|
|
4029
|
+
req.onblocked = wrap(db._fireOnBlocked);
|
|
4030
|
+
req.onupgradeneeded = wrap(function (e) {
|
|
4031
|
+
upgradeTransaction = req.transaction;
|
|
4032
|
+
if (state.autoSchema && !db._options.allowEmptyDB) {
|
|
4033
|
+
req.onerror = preventDefault;
|
|
4034
|
+
upgradeTransaction.abort();
|
|
4035
|
+
req.result.close();
|
|
4036
|
+
var delreq = indexedDB.deleteDatabase(dbName);
|
|
4037
|
+
delreq.onsuccess = delreq.onerror = wrap(function () {
|
|
4038
|
+
reject(new exceptions.NoSuchDatabase("Database ".concat(dbName, " doesnt exist")));
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
else {
|
|
4042
|
+
upgradeTransaction.onerror = eventRejectHandler(reject);
|
|
4043
|
+
var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;
|
|
4044
|
+
wasCreated = oldVer < 1;
|
|
4045
|
+
db.idbdb = req.result;
|
|
4046
|
+
runUpgraders(db, oldVer / 10, upgradeTransaction, reject);
|
|
4047
|
+
}
|
|
4048
|
+
}, reject);
|
|
4049
|
+
req.onsuccess = wrap(function () {
|
|
4050
|
+
upgradeTransaction = null;
|
|
4051
|
+
var idbdb = db.idbdb = req.result;
|
|
4052
|
+
var objectStoreNames = slice(idbdb.objectStoreNames);
|
|
4053
|
+
if (objectStoreNames.length > 0)
|
|
4054
|
+
try {
|
|
4055
|
+
var tmpTrans = idbdb.transaction(safariMultiStoreFix(objectStoreNames), 'readonly');
|
|
4056
|
+
if (state.autoSchema)
|
|
4057
|
+
readGlobalSchema(db, idbdb, tmpTrans);
|
|
4058
|
+
else {
|
|
4059
|
+
adjustToExistingIndexNames(db, db._dbSchema, tmpTrans);
|
|
4060
|
+
if (!verifyInstalledSchema(db, tmpTrans)) {
|
|
4061
|
+
console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.");
|
|
4065
4062
|
}
|
|
4066
|
-
generateMiddlewareStacks(db, tmpTrans);
|
|
4067
4063
|
}
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4064
|
+
generateMiddlewareStacks(db, tmpTrans);
|
|
4065
|
+
}
|
|
4066
|
+
catch (e) {
|
|
4067
|
+
}
|
|
4068
|
+
connections.push(db);
|
|
4069
|
+
idbdb.onversionchange = wrap(function (ev) {
|
|
4070
|
+
state.vcFired = true;
|
|
4071
|
+
db.on("versionchange").fire(ev);
|
|
4072
|
+
});
|
|
4073
|
+
idbdb.onclose = wrap(function (ev) {
|
|
4074
|
+
db.on("close").fire(ev);
|
|
4075
|
+
});
|
|
4076
|
+
if (wasCreated)
|
|
4077
|
+
_onDatabaseCreated(db._deps, dbName);
|
|
4078
|
+
resolve();
|
|
4079
|
+
}, reject);
|
|
4080
|
+
}).catch(function (err) {
|
|
4081
|
+
if (err && err.name === 'UnknownError' && state.PR1398_maxLoop > 0) {
|
|
4082
|
+
state.PR1398_maxLoop--;
|
|
4083
|
+
console.warn('Dexie: Workaround for Chrome UnknownError on open()');
|
|
4084
|
+
return tryOpenDB();
|
|
4085
|
+
}
|
|
4086
|
+
else {
|
|
4087
|
+
return DexiePromise.reject(err);
|
|
4088
|
+
}
|
|
4089
|
+
}); };
|
|
4090
|
+
return DexiePromise.race([
|
|
4091
|
+
openCanceller,
|
|
4092
|
+
(typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(tryOpenDB)
|
|
4093
|
+
]).then(function () {
|
|
4083
4094
|
throwIfCancelled();
|
|
4084
4095
|
state.onReadyBeingFired = [];
|
|
4085
4096
|
return DexiePromise.resolve(vip(function () { return db.on.ready.fire(db.vip); })).then(function fireRemainders() {
|
|
@@ -4752,6 +4763,30 @@
|
|
|
4752
4763
|
schema.indexes.forEach(addAffectedIndex);
|
|
4753
4764
|
}
|
|
4754
4765
|
|
|
4766
|
+
function adjustOptimisticFromFailures(tblCache, req, res) {
|
|
4767
|
+
if (res.numFailures === 0)
|
|
4768
|
+
return req;
|
|
4769
|
+
if (req.type === 'deleteRange') {
|
|
4770
|
+
return null;
|
|
4771
|
+
}
|
|
4772
|
+
var numBulkOps = req.keys
|
|
4773
|
+
? req.keys.length
|
|
4774
|
+
: 'values' in req && req.values
|
|
4775
|
+
? req.values.length
|
|
4776
|
+
: 1;
|
|
4777
|
+
if (res.numFailures === numBulkOps) {
|
|
4778
|
+
return null;
|
|
4779
|
+
}
|
|
4780
|
+
var clone = __assign({}, req);
|
|
4781
|
+
if (isArray(clone.keys)) {
|
|
4782
|
+
clone.keys = clone.keys.filter(function (_, i) { return !(i in res.failures); });
|
|
4783
|
+
}
|
|
4784
|
+
if ('values' in clone && isArray(clone.values)) {
|
|
4785
|
+
clone.values = clone.values.filter(function (_, i) { return !(i in res.failures); });
|
|
4786
|
+
}
|
|
4787
|
+
return clone;
|
|
4788
|
+
}
|
|
4789
|
+
|
|
4755
4790
|
function isAboveLower(key, range) {
|
|
4756
4791
|
return range.lower === undefined
|
|
4757
4792
|
? true
|
|
@@ -5029,13 +5064,24 @@
|
|
|
5029
5064
|
setByKeyPath(valueWithKey, primKey.keyPath, res.results[i]);
|
|
5030
5065
|
return valueWithKey;
|
|
5031
5066
|
}) });
|
|
5032
|
-
tblCache
|
|
5067
|
+
var adjustedReq = adjustOptimisticFromFailures(tblCache, reqWithResolvedKeys, res);
|
|
5068
|
+
tblCache.optimisticOps.push(adjustedReq);
|
|
5033
5069
|
queueMicrotask(function () { return signalSubscribersLazily(req.mutatedParts); });
|
|
5034
5070
|
});
|
|
5035
5071
|
}
|
|
5036
5072
|
else {
|
|
5037
5073
|
tblCache.optimisticOps.push(req);
|
|
5038
5074
|
signalSubscribersLazily(req.mutatedParts);
|
|
5075
|
+
promise.then(function (res) {
|
|
5076
|
+
if (res.numFailures > 0) {
|
|
5077
|
+
delArrayItem(tblCache.optimisticOps, req);
|
|
5078
|
+
var adjustedReq = adjustOptimisticFromFailures(tblCache, req, res);
|
|
5079
|
+
if (adjustedReq) {
|
|
5080
|
+
tblCache.optimisticOps.push(adjustedReq);
|
|
5081
|
+
}
|
|
5082
|
+
signalSubscribersLazily(req.mutatedParts);
|
|
5083
|
+
}
|
|
5084
|
+
});
|
|
5039
5085
|
promise.catch(function () {
|
|
5040
5086
|
delArrayItem(tblCache.optimisticOps, req);
|
|
5041
5087
|
signalSubscribersLazily(req.mutatedParts);
|
|
@@ -5490,9 +5536,14 @@
|
|
|
5490
5536
|
}
|
|
5491
5537
|
var rv = newScope(querier, ctx);
|
|
5492
5538
|
if (scopeFuncIsAsync) {
|
|
5493
|
-
rv.finally(decrementExpectedAwaits);
|
|
5539
|
+
rv = rv.finally(decrementExpectedAwaits);
|
|
5494
5540
|
}
|
|
5495
|
-
return rv
|
|
5541
|
+
return Promise.resolve(rv).finally(function () {
|
|
5542
|
+
if (PSD.subscr === ctx.subscr) {
|
|
5543
|
+
console.warn("Dexie liveQuery()'s querier callback did'nt await all of its spawned promises. Querier source: ".concat(querier));
|
|
5544
|
+
return new NativePromise(function (resolve) { return setTimeout(resolve, 0); });
|
|
5545
|
+
}
|
|
5546
|
+
});
|
|
5496
5547
|
}
|
|
5497
5548
|
finally {
|
|
5498
5549
|
wasRootExec && endMicroTickScope();
|