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/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.4, Wed Apr 10 2024
7
+ * Version 4.0.5, Sat May 25 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.4';
1147
+ var DEXIE_VERSION = '4.0.5';
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>.";
@@ -1804,6 +1804,40 @@ var PropModification = (function () {
1804
1804
  }
1805
1805
  PropModification.prototype.execute = function (value) {
1806
1806
  var _a;
1807
+ if (this.add !== undefined) {
1808
+ var term = this.add;
1809
+ if (isArray(term)) {
1810
+ return __spreadArray(__spreadArray([], (isArray(value) ? value : []), true), term, true).sort();
1811
+ }
1812
+ if (typeof term === 'number')
1813
+ return (Number(value) || 0) + term;
1814
+ if (typeof term === 'bigint') {
1815
+ try {
1816
+ return BigInt(value) + term;
1817
+ }
1818
+ catch (_b) {
1819
+ return BigInt(0) + term;
1820
+ }
1821
+ }
1822
+ throw new TypeError("Invalid term ".concat(term));
1823
+ }
1824
+ if (this.remove !== undefined) {
1825
+ var subtrahend_1 = this.remove;
1826
+ if (isArray(subtrahend_1)) {
1827
+ return isArray(value) ? value.filter(function (item) { return !subtrahend_1.includes(item); }).sort() : [];
1828
+ }
1829
+ if (typeof subtrahend_1 === 'number')
1830
+ return Number(value) - subtrahend_1;
1831
+ if (typeof subtrahend_1 === 'bigint') {
1832
+ try {
1833
+ return BigInt(value) - subtrahend_1;
1834
+ }
1835
+ catch (_c) {
1836
+ return BigInt(0) - subtrahend_1;
1837
+ }
1838
+ }
1839
+ throw new TypeError("Invalid subtrahend ".concat(subtrahend_1));
1840
+ }
1807
1841
  var prefixToReplace = (_a = this.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
1808
1842
  if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
1809
1843
  return this.replacePrefix[1] + value.substring(prefixToReplace.length);
@@ -5816,6 +5850,14 @@ if (typeof addEventListener !== 'undefined') {
5816
5850
  });
5817
5851
  }
5818
5852
 
5853
+ function add(value) {
5854
+ return new PropModification({ add: value });
5855
+ }
5856
+
5857
+ function remove(value) {
5858
+ return new PropModification({ remove: value });
5859
+ }
5860
+
5819
5861
  function replacePrefix(a, b) {
5820
5862
  return new PropModification({ replacePrefix: [a, b] });
5821
5863
  }
@@ -5823,5 +5865,5 @@ function replacePrefix(a, b) {
5823
5865
  DexiePromise.rejectionMapper = mapError;
5824
5866
  setDebug(debug);
5825
5867
 
5826
- export { Dexie$1 as Dexie, Entity, PropModSymbol, PropModification, RangeSet, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, replacePrefix };
5868
+ export { Dexie$1 as Dexie, Entity, PropModSymbol, PropModification, RangeSet, add, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, remove, replacePrefix };
5827
5869
  //# sourceMappingURL=dexie.mjs.map