dexie 4.0.1-alpha.18 → 4.0.1-alpha.20

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.1-alpha.18, Sun Jun 04 2023
7
+ * Version 4.0.1-alpha.20, Mon Jun 12 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
package/dist/dexie.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.1-alpha.18, Sun Jun 04 2023
7
+ * Version 4.0.1-alpha.20, Mon Jun 12 2023
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1284,7 +1284,7 @@
1284
1284
  }
1285
1285
  }
1286
1286
 
1287
- var DEXIE_VERSION = '4.0.1-alpha.18';
1287
+ var DEXIE_VERSION = '4.0.1-alpha.20';
1288
1288
  var maxString = String.fromCharCode(65535);
1289
1289
  var minKey = -Infinity;
1290
1290
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -1450,14 +1450,22 @@
1450
1450
  .where(keyPaths[0])
1451
1451
  .equals(indexOrCrit[keyPaths[0]]);
1452
1452
  var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(function (ix) {
1453
- return ix.compound &&
1454
- keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; }) &&
1455
- ix.keyPath.every(function (keyPath) { return keyPaths.indexOf(keyPath) >= 0; });
1456
- })[0];
1457
- if (compoundIndex && this.db._maxKey !== maxString)
1453
+ if (ix.compound &&
1454
+ keyPaths.every(function (keyPath) { return ix.keyPath.indexOf(keyPath) >= 0; })) {
1455
+ for (var i = 0; i < keyPaths.length; ++i) {
1456
+ if (keyPaths.indexOf(ix.keyPath[i]) === -1)
1457
+ return false;
1458
+ }
1459
+ return true;
1460
+ }
1461
+ return false;
1462
+ }).sort(function (a, b) { return a.keyPath.length - b.keyPath.length; })[0];
1463
+ if (compoundIndex && this.db._maxKey !== maxString) {
1464
+ var keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);
1458
1465
  return this
1459
- .where(compoundIndex.name)
1460
- .equals(compoundIndex.keyPath.map(function (kp) { return indexOrCrit[kp]; }));
1466
+ .where(keyPathsInValidOrder)
1467
+ .equals(keyPathsInValidOrder.map(function (kp) { return indexOrCrit[kp]; }));
1468
+ }
1461
1469
  if (!compoundIndex && debug)
1462
1470
  console.warn("The query ".concat(JSON.stringify(indexOrCrit), " on ").concat(this.name, " would benefit of a ") +
1463
1471
  "compound index [".concat(keyPaths.join('+'), "]"));
@@ -4562,7 +4570,7 @@
4562
4570
  schema.indexes.forEach(function (idx) { return getRangeSet(idx.name).add(FULL_RANGE); });
4563
4571
  }
4564
4572
  return table.mutate(req).then(function (res) {
4565
- if (keys && primaryKey.autoIncrement && (req.type === 'add' || req.type === 'put')) {
4573
+ if (keys && (req.type === 'add' || req.type === 'put')) {
4566
4574
  pkRangeSet.addKeys(res.results);
4567
4575
  }
4568
4576
  trans.mutatedParts = extendObservabilitySet(trans.mutatedParts || {}, mutatedParts);