dexie 4.0.5 → 4.0.8
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 +14 -10
- package/dist/dexie.js +37 -31
- 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 +37 -31
- 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 +37 -31
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +2 -2
package/dist/dexie.mjs
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.8, Wed Jul 10 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -1144,7 +1144,7 @@ function tempTransaction(db, mode, storeNames, fn) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
|
-
var DEXIE_VERSION = '4.0.
|
|
1147
|
+
var DEXIE_VERSION = '4.0.8';
|
|
1148
1148
|
var maxString = String.fromCharCode(65535);
|
|
1149
1149
|
var minKey = -Infinity;
|
|
1150
1150
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -2148,6 +2148,12 @@ var Collection = (function () {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
};
|
|
2150
2150
|
return _this.clone().primaryKeys().then(function (keys) {
|
|
2151
|
+
var criteria = isPlainKeyRange(ctx) &&
|
|
2152
|
+
ctx.limit === Infinity &&
|
|
2153
|
+
(typeof changes !== 'function' || changes === deleteCallback) && {
|
|
2154
|
+
index: ctx.index,
|
|
2155
|
+
range: ctx.range
|
|
2156
|
+
};
|
|
2151
2157
|
var nextChunk = function (offset) {
|
|
2152
2158
|
var count = Math.min(limit, keys.length - offset);
|
|
2153
2159
|
return coreTable.getMany({
|
|
@@ -2180,12 +2186,6 @@ var Collection = (function () {
|
|
|
2180
2186
|
}
|
|
2181
2187
|
}
|
|
2182
2188
|
}
|
|
2183
|
-
var criteria = isPlainKeyRange(ctx) &&
|
|
2184
|
-
ctx.limit === Infinity &&
|
|
2185
|
-
(typeof changes !== 'function' || changes === deleteCallback) && {
|
|
2186
|
-
index: ctx.index,
|
|
2187
|
-
range: ctx.range
|
|
2188
|
-
};
|
|
2189
2189
|
return Promise.resolve(addValues.length > 0 &&
|
|
2190
2190
|
coreTable.mutate({ trans: trans, type: 'add', values: addValues })
|
|
2191
2191
|
.then(function (res) {
|
|
@@ -2201,13 +2201,15 @@ var Collection = (function () {
|
|
|
2201
2201
|
values: putValues,
|
|
2202
2202
|
criteria: criteria,
|
|
2203
2203
|
changeSpec: typeof changes !== 'function'
|
|
2204
|
-
&& changes
|
|
2204
|
+
&& changes,
|
|
2205
|
+
isAdditionalChunk: offset > 0
|
|
2205
2206
|
}).then(function (res) { return applyMutateResult(putValues.length, res); }); }).then(function () { return (deleteKeys.length > 0 || (criteria && changes === deleteCallback)) &&
|
|
2206
2207
|
coreTable.mutate({
|
|
2207
2208
|
trans: trans,
|
|
2208
2209
|
type: 'delete',
|
|
2209
2210
|
keys: deleteKeys,
|
|
2210
|
-
criteria: criteria
|
|
2211
|
+
criteria: criteria,
|
|
2212
|
+
isAdditionalChunk: offset > 0
|
|
2211
2213
|
}).then(function (res) { return applyMutateResult(deleteKeys.length, res); }); }).then(function () {
|
|
2212
2214
|
return keys.length > offset + count && nextChunk(offset + limit);
|
|
2213
2215
|
});
|
|
@@ -3791,6 +3793,10 @@ props(RangeSet.prototype, (_a = {
|
|
|
3791
3793
|
var _this = this;
|
|
3792
3794
|
keys.forEach(function (key) { return addRange(_this, key, key); });
|
|
3793
3795
|
return this;
|
|
3796
|
+
},
|
|
3797
|
+
hasKey: function (key) {
|
|
3798
|
+
var node = getRangeSetIterator(this).next(key).value;
|
|
3799
|
+
return node && cmp(node.from, key) <= 0 && cmp(node.to, key) >= 0;
|
|
3794
3800
|
}
|
|
3795
3801
|
},
|
|
3796
3802
|
_a[iteratorSymbol] = function () {
|
|
@@ -4852,19 +4858,23 @@ function applyOptimisticOps(result, req, ops, table, cacheEntry, immutable) {
|
|
|
4852
4858
|
var extractLowLevelIndex = (index.lowLevelIndex || index).extractKey;
|
|
4853
4859
|
var finalResult = ops.reduce(function (result, op) {
|
|
4854
4860
|
var modifedResult = result;
|
|
4855
|
-
var includedValues =
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4861
|
+
var includedValues = [];
|
|
4862
|
+
if (op.type === 'add' || op.type === 'put') {
|
|
4863
|
+
var includedPKs = new RangeSet();
|
|
4864
|
+
for (var i = op.values.length - 1; i >= 0; --i) {
|
|
4865
|
+
var value = op.values[i];
|
|
4866
|
+
var pk = extractPrimKey(value);
|
|
4867
|
+
if (includedPKs.hasKey(pk))
|
|
4868
|
+
continue;
|
|
4869
|
+
var key = extractIndex(value);
|
|
4870
|
+
if (multiEntry && isArray(key)
|
|
4859
4871
|
? key.some(function (k) { return isWithinRange(k, queryRange); })
|
|
4860
|
-
: isWithinRange(key, queryRange)
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
})
|
|
4867
|
-
: [];
|
|
4872
|
+
: isWithinRange(key, queryRange)) {
|
|
4873
|
+
includedPKs.addKey(pk);
|
|
4874
|
+
includedValues.push(value);
|
|
4875
|
+
}
|
|
4876
|
+
}
|
|
4877
|
+
}
|
|
4868
4878
|
switch (op.type) {
|
|
4869
4879
|
case 'add':
|
|
4870
4880
|
modifedResult = result.concat(req.values
|
|
@@ -4874,20 +4884,16 @@ function applyOptimisticOps(result, req, ops, table, cacheEntry, immutable) {
|
|
|
4874
4884
|
case 'put':
|
|
4875
4885
|
var keySet_1 = new RangeSet().addKeys(op.values.map(function (v) { return extractPrimKey(v); }));
|
|
4876
4886
|
modifedResult = result
|
|
4877
|
-
.filter(
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
.concat(req.values
|
|
4887
|
+
.filter(
|
|
4888
|
+
function (item) { return !keySet_1.hasKey(req.values ? extractPrimKey(item) : item); })
|
|
4889
|
+
.concat(
|
|
4890
|
+
req.values
|
|
4882
4891
|
? includedValues
|
|
4883
4892
|
: includedValues.map(function (v) { return extractPrimKey(v); }));
|
|
4884
4893
|
break;
|
|
4885
4894
|
case 'delete':
|
|
4886
4895
|
var keysToDelete_1 = new RangeSet().addKeys(op.keys);
|
|
4887
|
-
modifedResult = result.filter(function (item) {
|
|
4888
|
-
var key = req.values ? extractPrimKey(item) : item;
|
|
4889
|
-
return !rangesOverlap(new RangeSet(key), keysToDelete_1);
|
|
4890
|
-
});
|
|
4896
|
+
modifedResult = result.filter(function (item) { return !keysToDelete_1.hasKey(req.values ? extractPrimKey(item) : item); });
|
|
4891
4897
|
break;
|
|
4892
4898
|
case 'deleteRange':
|
|
4893
4899
|
var range_1 = op.range;
|