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.
@@ -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
  *
@@ -1096,7 +1096,7 @@ function tempTransaction(db, mode, storeNames, fn) {
1096
1096
  }
1097
1097
  }
1098
1098
 
1099
- const DEXIE_VERSION = '4.0.9';
1099
+ const DEXIE_VERSION = '4.0.11';
1100
1100
  const maxString = String.fromCharCode(65535);
1101
1101
  const minKey = -Infinity;
1102
1102
  const INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -1718,11 +1718,11 @@ function iterate(cursorPromise, filter, fn, valueMapper) {
1718
1718
  });
1719
1719
  }
1720
1720
 
1721
- const PropModSymbol = Symbol();
1722
1721
  class PropModification {
1723
1722
  execute(value) {
1724
- if (this.add !== undefined) {
1725
- const term = this.add;
1723
+ const spec = this["@@propmod"];
1724
+ if (spec.add !== undefined) {
1725
+ const term = spec.add;
1726
1726
  if (isArray(term)) {
1727
1727
  return [...(isArray(value) ? value : []), ...term].sort();
1728
1728
  }
@@ -1738,8 +1738,8 @@ class PropModification {
1738
1738
  }
1739
1739
  throw new TypeError(`Invalid term ${term}`);
1740
1740
  }
1741
- if (this.remove !== undefined) {
1742
- const subtrahend = this.remove;
1741
+ if (spec.remove !== undefined) {
1742
+ const subtrahend = spec.remove;
1743
1743
  if (isArray(subtrahend)) {
1744
1744
  return isArray(value) ? value.filter(item => !subtrahend.includes(item)).sort() : [];
1745
1745
  }
@@ -1755,14 +1755,14 @@ class PropModification {
1755
1755
  }
1756
1756
  throw new TypeError(`Invalid subtrahend ${subtrahend}`);
1757
1757
  }
1758
- const prefixToReplace = this.replacePrefix?.[0];
1758
+ const prefixToReplace = spec.replacePrefix?.[0];
1759
1759
  if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
1760
- return this.replacePrefix[1] + value.substring(prefixToReplace.length);
1760
+ return spec.replacePrefix[1] + value.substring(prefixToReplace.length);
1761
1761
  }
1762
1762
  return value;
1763
1763
  }
1764
1764
  constructor(spec) {
1765
- Object.assign(this, spec);
1765
+ this["@@propmod"] = spec;
1766
1766
  }
1767
1767
  }
1768
1768
 
@@ -2043,7 +2043,16 @@ class Collection {
2043
2043
  }
2044
2044
  const coreTable = ctx.table.core;
2045
2045
  const { outbound, extractKey } = coreTable.schema.primaryKey;
2046
- const limit = this.db._options.modifyChunkSize || 200;
2046
+ let limit = 200;
2047
+ const modifyChunkSize = this.db._options.modifyChunkSize;
2048
+ if (modifyChunkSize) {
2049
+ if (typeof modifyChunkSize == 'object') {
2050
+ limit = modifyChunkSize[coreTable.name] || modifyChunkSize['*'] || 200;
2051
+ }
2052
+ else {
2053
+ limit = modifyChunkSize;
2054
+ }
2055
+ }
2047
2056
  const totalFailures = [];
2048
2057
  let successCount = 0;
2049
2058
  const failedKeys = [];
@@ -4562,7 +4571,9 @@ const observabilityMiddleware = {
4562
4571
  indexesWithAutoIncPK.forEach(idx => {
4563
4572
  const idxVals = req.values.map(v => idx.extractKey(v));
4564
4573
  const pkPos = idx.keyPath.findIndex(prop => prop === primaryKey.keyPath);
4565
- res.results.forEach(pk => idxVals[pkPos] = pk);
4574
+ for (let i = 0, len = res.results.length; i < len; ++i) {
4575
+ idxVals[i][pkPos] = res.results[i];
4576
+ }
4566
4577
  getRangeSet(idx.name).addKeys(idxVals);
4567
4578
  });
4568
4579
  }
@@ -5791,5 +5802,5 @@ function replacePrefix(a, b) {
5791
5802
  DexiePromise.rejectionMapper = mapError;
5792
5803
  setDebug(debug);
5793
5804
 
5794
- export { Dexie$1 as Dexie, Entity, PropModSymbol, PropModification, RangeSet, add, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, remove, replacePrefix };
5805
+ export { Dexie$1 as Dexie, Entity, PropModification, RangeSet, add, cmp, Dexie$1 as default, liveQuery, mergeRanges, rangesOverlap, remove, replacePrefix };
5795
5806
  //# sourceMappingURL=dexie.mjs.map