dexie 4.4.5 → 4.4.7

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.4.5, Fri Aug 14 2026
7
+ * Version 4.4.7, Mon Oct 19 2026
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -483,8 +483,9 @@ function hookDeletingChain(f1, f2) {
483
483
  function hookUpdatingChain(f1, f2) {
484
484
  if (f1 === nop)
485
485
  return f2;
486
- return function (modifications) {
486
+ return function () {
487
487
  var res = f1.apply(this, arguments);
488
+ var modifications = arguments[0];
488
489
  extend(modifications, res);
489
490
  var onsuccess = this.onsuccess,
490
491
  onerror = this.onerror;
@@ -1169,7 +1170,7 @@ function tempTransaction(db, mode, storeNames, fn) {
1169
1170
  }
1170
1171
  }
1171
1172
 
1172
- const DEXIE_VERSION = '4.4.5';
1173
+ const DEXIE_VERSION = '4.4.7';
1173
1174
  const maxString = String.fromCharCode(65535);
1174
1175
  const minKey = -Infinity;
1175
1176
  const INVALID_KEY_ARGUMENT = 'Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.';
@@ -1707,27 +1708,23 @@ class Table {
1707
1708
  });
1708
1709
  }
1709
1710
  bulkUpdate(keysAndChanges) {
1710
- const coreTable = this.core;
1711
1711
  const keys = keysAndChanges.map((entry) => entry.key);
1712
1712
  const changeSpecs = keysAndChanges.map((entry) => entry.changes);
1713
1713
  const offsetMap = [];
1714
1714
  return this._trans('readwrite', (trans) => {
1715
+ const coreTable = this.core;
1715
1716
  return coreTable.getMany({ trans, keys, cache: 'clone' }).then((objs) => {
1717
+ const { outbound, extractKey } = coreTable.schema.primaryKey;
1716
1718
  const resultKeys = [];
1717
1719
  const resultObjs = [];
1718
1720
  keysAndChanges.forEach(({ key, changes }, idx) => {
1719
1721
  const obj = objs[idx];
1720
1722
  if (obj) {
1721
1723
  for (const keyPath of Object.keys(changes)) {
1722
- const value = changes[keyPath];
1723
- if (keyPath === this.schema.primKey.keyPath) {
1724
- if (cmp(value, key) !== 0) {
1725
- throw new exceptions.Constraint(`Cannot update primary key in bulkUpdate()`);
1726
- }
1727
- }
1728
- else {
1729
- setByKeyPath(obj, keyPath, value);
1730
- }
1724
+ setByKeyPath(obj, keyPath, changes[keyPath]);
1725
+ }
1726
+ if (!outbound && cmp(extractKey(obj), key) !== 0) {
1727
+ throw new exceptions.Constraint(`Cannot update primary key in bulkUpdate()`);
1731
1728
  }
1732
1729
  offsetMap.push(idx);
1733
1730
  resultKeys.push(key);
@@ -2437,7 +2434,9 @@ function fail(collectionOrWhereClause, err, T) {
2437
2434
  return collection;
2438
2435
  }
2439
2436
  function emptyCollection(whereClause) {
2440
- return new whereClause.Collection(whereClause, () => rangeEqual('')).limit(0);
2437
+ const collection = new whereClause.Collection(whereClause, () => rangeEqual(''));
2438
+ collection._addAlgorithm(() => false);
2439
+ return collection;
2441
2440
  }
2442
2441
  function upperFactory(dir) {
2443
2442
  return dir === 'next'
@@ -4384,11 +4383,12 @@ function dexieOpen(db) {
4384
4383
  }
4385
4384
  return DexiePromise.reject(err);
4386
4385
  });
4386
+ const useSafari14Workaround = typeof navigator !== 'undefined' &&
4387
+ !!indexedDB &&
4388
+ indexedDB === _global.indexedDB;
4387
4389
  return DexiePromise.race([
4388
4390
  openCanceller,
4389
- (typeof navigator === 'undefined'
4390
- ? DexiePromise.resolve()
4391
- : idbReady()).then(tryOpenDB),
4391
+ (useSafari14Workaround ? idbReady() : DexiePromise.resolve()).then(tryOpenDB),
4392
4392
  ])
4393
4393
  .then(() => {
4394
4394
  throwIfCancelled();
@@ -5009,7 +5009,7 @@ const observabilityMiddleware = {
5009
5009
  ? [req.keys]
5010
5010
  : req.values.length < 50
5011
5011
  ? [
5012
- getEffectiveKeys(primaryKey, req).filter((id) => id),
5012
+ getEffectiveKeys(primaryKey, req).filter((id) => id != null),
5013
5013
  req.values,
5014
5014
  ]
5015
5015
  : [];
@@ -5922,7 +5922,7 @@ let Dexie$1 = class Dexie {
5922
5922
  }
5923
5923
  hasBeenClosed() {
5924
5924
  const dbOpenError = this._state.dbOpenError;
5925
- return dbOpenError && dbOpenError.name === 'DatabaseClosed';
5925
+ return dbOpenError && dbOpenError.name === 'DatabaseClosedError';
5926
5926
  }
5927
5927
  hasFailed() {
5928
5928
  return this._state.dbOpenError !== null;
@@ -6132,6 +6132,9 @@ function liveQuery(querier) {
6132
6132
  }
6133
6133
  }
6134
6134
  }, (err) => {
6135
+ if (closed || ctx.signal.aborted) {
6136
+ return;
6137
+ }
6135
6138
  hasValue = false;
6136
6139
  if (!['DatabaseClosedError', 'AbortError'].includes(err?.name)) {
6137
6140
  if (!closed)