dexie 4.0.4 → 4.0.5
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/README.md +157 -123
- package/dist/dexie.d.ts +10 -2
- package/dist/dexie.js +46 -2
- 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 +45 -3
- 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 +45 -3
- package/dist/modern/dexie.mjs.map +1 -1
- package/import-wrapper-prod.mjs +5 -2
- package/import-wrapper.mjs +4 -2
- package/package.json +3 -2
package/dist/modern/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.5, Sat May 25 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -1094,7 +1094,7 @@ function tempTransaction(db, mode, storeNames, fn) {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
1097
|
-
const DEXIE_VERSION = '4.0.
|
|
1097
|
+
const DEXIE_VERSION = '4.0.5';
|
|
1098
1098
|
const maxString = String.fromCharCode(65535);
|
|
1099
1099
|
const minKey = -Infinity;
|
|
1100
1100
|
const INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1720,6 +1720,40 @@ function iterate(cursorPromise, filter, fn, valueMapper) {
|
|
|
1720
1720
|
const PropModSymbol = Symbol();
|
|
1721
1721
|
class PropModification {
|
|
1722
1722
|
execute(value) {
|
|
1723
|
+
if (this.add !== undefined) {
|
|
1724
|
+
const term = this.add;
|
|
1725
|
+
if (isArray(term)) {
|
|
1726
|
+
return [...(isArray(value) ? value : []), ...term].sort();
|
|
1727
|
+
}
|
|
1728
|
+
if (typeof term === 'number')
|
|
1729
|
+
return (Number(value) || 0) + term;
|
|
1730
|
+
if (typeof term === 'bigint') {
|
|
1731
|
+
try {
|
|
1732
|
+
return BigInt(value) + term;
|
|
1733
|
+
}
|
|
1734
|
+
catch {
|
|
1735
|
+
return BigInt(0) + term;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
throw new TypeError(`Invalid term ${term}`);
|
|
1739
|
+
}
|
|
1740
|
+
if (this.remove !== undefined) {
|
|
1741
|
+
const subtrahend = this.remove;
|
|
1742
|
+
if (isArray(subtrahend)) {
|
|
1743
|
+
return isArray(value) ? value.filter(item => !subtrahend.includes(item)).sort() : [];
|
|
1744
|
+
}
|
|
1745
|
+
if (typeof subtrahend === 'number')
|
|
1746
|
+
return Number(value) - subtrahend;
|
|
1747
|
+
if (typeof subtrahend === 'bigint') {
|
|
1748
|
+
try {
|
|
1749
|
+
return BigInt(value) - subtrahend;
|
|
1750
|
+
}
|
|
1751
|
+
catch {
|
|
1752
|
+
return BigInt(0) - subtrahend;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
throw new TypeError(`Invalid subtrahend ${subtrahend}`);
|
|
1756
|
+
}
|
|
1723
1757
|
const prefixToReplace = this.replacePrefix?.[0];
|
|
1724
1758
|
if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
|
|
1725
1759
|
return this.replacePrefix[1] + value.substring(prefixToReplace.length);
|
|
@@ -5713,6 +5747,14 @@ if (typeof addEventListener !== 'undefined') {
|
|
|
5713
5747
|
});
|
|
5714
5748
|
}
|
|
5715
5749
|
|
|
5750
|
+
function add(value) {
|
|
5751
|
+
return new PropModification({ add: value });
|
|
5752
|
+
}
|
|
5753
|
+
|
|
5754
|
+
function remove(value) {
|
|
5755
|
+
return new PropModification({ remove: value });
|
|
5756
|
+
}
|
|
5757
|
+
|
|
5716
5758
|
function replacePrefix(a, b) {
|
|
5717
5759
|
return new PropModification({ replacePrefix: [a, b] });
|
|
5718
5760
|
}
|
|
@@ -5720,5 +5762,5 @@ function replacePrefix(a, b) {
|
|
|
5720
5762
|
DexiePromise.rejectionMapper = mapError;
|
|
5721
5763
|
setDebug(debug);
|
|
5722
5764
|
|
|
5723
|
-
export { Dexie$1 as Dexie, Entity, PropModSymbol, PropModification, RangeSet, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, replacePrefix };
|
|
5765
|
+
export { Dexie$1 as Dexie, Entity, PropModSymbol, PropModification, RangeSet, add, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, remove, replacePrefix };
|
|
5724
5766
|
//# sourceMappingURL=dexie.mjs.map
|