dexie 4.0.9 → 4.0.11

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.9, Mon Oct 21 2024
7
+ * Version 4.0.11, Wed Jan 15 2025
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1146,7 +1146,7 @@ function tempTransaction(db, mode, storeNames, fn) {
1146
1146
  }
1147
1147
  }
1148
1148
 
1149
- var DEXIE_VERSION = '4.0.9';
1149
+ var DEXIE_VERSION = '4.0.11';
1150
1150
  var maxString = String.fromCharCode(65535);
1151
1151
  var minKey = -Infinity;
1152
1152
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -1798,15 +1798,15 @@ function iterate(cursorPromise, filter, fn, valueMapper) {
1798
1798
  });
1799
1799
  }
1800
1800
 
1801
- var PropModSymbol = Symbol();
1802
1801
  var PropModification = (function () {
1803
1802
  function PropModification(spec) {
1804
- Object.assign(this, spec);
1803
+ this["@@propmod"] = spec;
1805
1804
  }
1806
1805
  PropModification.prototype.execute = function (value) {
1807
1806
  var _a;
1808
- if (this.add !== undefined) {
1809
- var term = this.add;
1807
+ var spec = this["@@propmod"];
1808
+ if (spec.add !== undefined) {
1809
+ var term = spec.add;
1810
1810
  if (isArray(term)) {
1811
1811
  return __spreadArray(__spreadArray([], (isArray(value) ? value : []), true), term, true).sort();
1812
1812
  }
@@ -1822,8 +1822,8 @@ var PropModification = (function () {
1822
1822
  }
1823
1823
  throw new TypeError("Invalid term ".concat(term));
1824
1824
  }
1825
- if (this.remove !== undefined) {
1826
- var subtrahend_1 = this.remove;
1825
+ if (spec.remove !== undefined) {
1826
+ var subtrahend_1 = spec.remove;
1827
1827
  if (isArray(subtrahend_1)) {
1828
1828
  return isArray(value) ? value.filter(function (item) { return !subtrahend_1.includes(item); }).sort() : [];
1829
1829
  }
@@ -1839,9 +1839,9 @@ var PropModification = (function () {
1839
1839
  }
1840
1840
  throw new TypeError("Invalid subtrahend ".concat(subtrahend_1));
1841
1841
  }
1842
- var prefixToReplace = (_a = this.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
1842
+ var prefixToReplace = (_a = spec.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
1843
1843
  if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
1844
- return this.replacePrefix[1] + value.substring(prefixToReplace.length);
1844
+ return spec.replacePrefix[1] + value.substring(prefixToReplace.length);
1845
1845
  }
1846
1846
  return value;
1847
1847
  };
@@ -2136,7 +2136,16 @@ var Collection = (function () {
2136
2136
  }
2137
2137
  var coreTable = ctx.table.core;
2138
2138
  var _a = coreTable.schema.primaryKey, outbound = _a.outbound, extractKey = _a.extractKey;
2139
- var limit = _this.db._options.modifyChunkSize || 200;
2139
+ var limit = 200;
2140
+ var modifyChunkSize = _this.db._options.modifyChunkSize;
2141
+ if (modifyChunkSize) {
2142
+ if (typeof modifyChunkSize == 'object') {
2143
+ limit = modifyChunkSize[coreTable.name] || modifyChunkSize['*'] || 200;
2144
+ }
2145
+ else {
2146
+ limit = modifyChunkSize;
2147
+ }
2148
+ }
2140
2149
  var totalFailures = [];
2141
2150
  var successCount = 0;
2142
2151
  var failedKeys = [];
@@ -4673,7 +4682,9 @@ var observabilityMiddleware = {
4673
4682
  indexesWithAutoIncPK.forEach(function (idx) {
4674
4683
  var idxVals = req.values.map(function (v) { return idx.extractKey(v); });
4675
4684
  var pkPos = idx.keyPath.findIndex(function (prop) { return prop === primaryKey.keyPath; });
4676
- res.results.forEach(function (pk) { return idxVals[pkPos] = pk; });
4685
+ for (var i = 0, len = res.results.length; i < len; ++i) {
4686
+ idxVals[i][pkPos] = res.results[i];
4687
+ }
4677
4688
  getRangeSet(idx.name).addKeys(idxVals);
4678
4689
  });
4679
4690
  }
@@ -5897,5 +5908,5 @@ function replacePrefix(a, b) {
5897
5908
  DexiePromise.rejectionMapper = mapError;
5898
5909
  setDebug(debug);
5899
5910
 
5900
- export { Dexie$1 as Dexie, Entity, PropModSymbol, PropModification, RangeSet, add, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, remove, replacePrefix };
5911
+ export { Dexie$1 as Dexie, Entity, PropModification, RangeSet, add, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, remove, replacePrefix };
5901
5912
  //# sourceMappingURL=dexie.mjs.map