dexie 4.0.8 → 4.0.9
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/dist/dexie.d.ts +1 -1
- package/dist/dexie.js +40 -14
- 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 +40 -14
- 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 +34 -11
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
7
|
+
* Version 4.0.9, Mon Oct 21 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -776,6 +776,8 @@
|
|
|
776
776
|
}); });
|
|
777
777
|
});
|
|
778
778
|
});
|
|
779
|
+
if (NativePromise.withResolvers)
|
|
780
|
+
DexiePromise.withResolvers = NativePromise.withResolvers;
|
|
779
781
|
}
|
|
780
782
|
function executePromiseTask(promise, fn) {
|
|
781
783
|
try {
|
|
@@ -1150,7 +1152,7 @@
|
|
|
1150
1152
|
}
|
|
1151
1153
|
}
|
|
1152
1154
|
|
|
1153
|
-
var DEXIE_VERSION = '4.0.
|
|
1155
|
+
var DEXIE_VERSION = '4.0.9';
|
|
1154
1156
|
var maxString = String.fromCharCode(65535);
|
|
1155
1157
|
var minKey = -Infinity;
|
|
1156
1158
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1343,9 +1345,8 @@
|
|
|
1343
1345
|
console.warn("The query ".concat(JSON.stringify(indexOrCrit), " on ").concat(this.name, " would benefit from a ") +
|
|
1344
1346
|
"compound index [".concat(keyPaths.join('+'), "]"));
|
|
1345
1347
|
var idxByName = this.schema.idxByName;
|
|
1346
|
-
var idb = this.db._deps.indexedDB;
|
|
1347
1348
|
function equals(a, b) {
|
|
1348
|
-
return
|
|
1349
|
+
return cmp(a, b) === 0;
|
|
1349
1350
|
}
|
|
1350
1351
|
var _a = keyPaths.reduce(function (_a, keyPath) {
|
|
1351
1352
|
var prevIndex = _a[0], prevFilterFn = _a[1];
|
|
@@ -1921,7 +1922,7 @@
|
|
|
1921
1922
|
var order = this._ctx.dir === "next" ? 1 : -1;
|
|
1922
1923
|
function sorter(a, b) {
|
|
1923
1924
|
var aVal = getval(a, lastIndex), bVal = getval(b, lastIndex);
|
|
1924
|
-
return aVal
|
|
1925
|
+
return cmp(aVal, bVal) * order;
|
|
1925
1926
|
}
|
|
1926
1927
|
return this.toArray(function (a) {
|
|
1927
1928
|
return a.sort(sorter);
|
|
@@ -4629,6 +4630,7 @@
|
|
|
4629
4630
|
var extractKey = primaryKey.extractKey, outbound = primaryKey.outbound;
|
|
4630
4631
|
var indexesWithAutoIncPK = primaryKey.autoIncrement && indexes.filter(function (index) { return index.compound && index.keyPath.includes(primaryKey.keyPath); });
|
|
4631
4632
|
var tableClone = __assign(__assign({}, table), { mutate: function (req) {
|
|
4633
|
+
var _a, _b;
|
|
4632
4634
|
var trans = req.trans;
|
|
4633
4635
|
var mutatedParts = req.mutatedParts || (req.mutatedParts = {});
|
|
4634
4636
|
var getRangeSet = function (indexName) {
|
|
@@ -4639,13 +4641,13 @@
|
|
|
4639
4641
|
var pkRangeSet = getRangeSet("");
|
|
4640
4642
|
var delsRangeSet = getRangeSet(":dels");
|
|
4641
4643
|
var type = req.type;
|
|
4642
|
-
var
|
|
4644
|
+
var _c = req.type === "deleteRange"
|
|
4643
4645
|
? [req.range]
|
|
4644
4646
|
: req.type === "delete"
|
|
4645
4647
|
? [req.keys]
|
|
4646
4648
|
: req.values.length < 50
|
|
4647
4649
|
? [getEffectiveKeys(primaryKey, req).filter(function (id) { return id; }), req.values]
|
|
4648
|
-
: [], keys =
|
|
4650
|
+
: [], keys = _c[0], newObjs = _c[1];
|
|
4649
4651
|
var oldCache = req.trans["_cache"];
|
|
4650
4652
|
if (isArray(keys)) {
|
|
4651
4653
|
pkRangeSet.addKeys(keys);
|
|
@@ -4658,7 +4660,10 @@
|
|
|
4658
4660
|
}
|
|
4659
4661
|
}
|
|
4660
4662
|
else if (keys) {
|
|
4661
|
-
var range = {
|
|
4663
|
+
var range = {
|
|
4664
|
+
from: (_a = keys.lower) !== null && _a !== void 0 ? _a : core.MIN_KEY,
|
|
4665
|
+
to: (_b = keys.upper) !== null && _b !== void 0 ? _b : core.MAX_KEY
|
|
4666
|
+
};
|
|
4662
4667
|
delsRangeSet.add(range);
|
|
4663
4668
|
pkRangeSet.add(range);
|
|
4664
4669
|
}
|
|
@@ -4882,12 +4887,27 @@
|
|
|
4882
4887
|
}
|
|
4883
4888
|
}
|
|
4884
4889
|
switch (op.type) {
|
|
4885
|
-
case 'add':
|
|
4890
|
+
case 'add': {
|
|
4891
|
+
var existingKeys_1 = new RangeSet().addKeys(req.values ? result.map(function (v) { return extractPrimKey(v); }) : result);
|
|
4886
4892
|
modifedResult = result.concat(req.values
|
|
4887
|
-
? includedValues
|
|
4888
|
-
|
|
4893
|
+
? includedValues.filter(function (v) {
|
|
4894
|
+
var key = extractPrimKey(v);
|
|
4895
|
+
if (existingKeys_1.hasKey(key))
|
|
4896
|
+
return false;
|
|
4897
|
+
existingKeys_1.addKey(key);
|
|
4898
|
+
return true;
|
|
4899
|
+
})
|
|
4900
|
+
: includedValues
|
|
4901
|
+
.map(function (v) { return extractPrimKey(v); })
|
|
4902
|
+
.filter(function (k) {
|
|
4903
|
+
if (existingKeys_1.hasKey(k))
|
|
4904
|
+
return false;
|
|
4905
|
+
existingKeys_1.addKey(k);
|
|
4906
|
+
return true;
|
|
4907
|
+
}));
|
|
4889
4908
|
break;
|
|
4890
|
-
|
|
4909
|
+
}
|
|
4910
|
+
case 'put': {
|
|
4891
4911
|
var keySet_1 = new RangeSet().addKeys(op.values.map(function (v) { return extractPrimKey(v); }));
|
|
4892
4912
|
modifedResult = result
|
|
4893
4913
|
.filter(
|
|
@@ -4897,9 +4917,12 @@
|
|
|
4897
4917
|
? includedValues
|
|
4898
4918
|
: includedValues.map(function (v) { return extractPrimKey(v); }));
|
|
4899
4919
|
break;
|
|
4920
|
+
}
|
|
4900
4921
|
case 'delete':
|
|
4901
4922
|
var keysToDelete_1 = new RangeSet().addKeys(op.keys);
|
|
4902
|
-
modifedResult = result.filter(function (item) {
|
|
4923
|
+
modifedResult = result.filter(function (item) {
|
|
4924
|
+
return !keysToDelete_1.hasKey(req.values ? extractPrimKey(item) : item);
|
|
4925
|
+
});
|
|
4903
4926
|
break;
|
|
4904
4927
|
case 'deleteRange':
|
|
4905
4928
|
var range_1 = op.range;
|
|
@@ -5113,7 +5136,8 @@
|
|
|
5113
5136
|
var trans = PSD.trans;
|
|
5114
5137
|
if (primKey.outbound ||
|
|
5115
5138
|
trans.db._options.cache === 'disabled' ||
|
|
5116
|
-
trans.explicit
|
|
5139
|
+
trans.explicit ||
|
|
5140
|
+
trans.idbtrans.mode !== 'readwrite'
|
|
5117
5141
|
) {
|
|
5118
5142
|
return downTable.mutate(req);
|
|
5119
5143
|
}
|
|
@@ -5125,6 +5149,8 @@
|
|
|
5125
5149
|
promise.then(function (res) {
|
|
5126
5150
|
var reqWithResolvedKeys = __assign(__assign({}, req), { values: req.values.map(function (value, i) {
|
|
5127
5151
|
var _a;
|
|
5152
|
+
if (res.failures[i])
|
|
5153
|
+
return value;
|
|
5128
5154
|
var valueWithKey = ((_a = primKey.keyPath) === null || _a === void 0 ? void 0 : _a.includes('.'))
|
|
5129
5155
|
? deepClone(value)
|
|
5130
5156
|
: __assign({}, value);
|