dexie-cloud-addon 4.4.8 → 4.4.10

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.4.8, Tue Mar 31 2026
11
+ * Version 4.4.10, Sat Apr 04 2026
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -3768,7 +3768,7 @@ function _sync(db_1, options_1, schema_1) {
3768
3768
  return __awaiter(this, arguments, void 0, function* (db, options, schema, { isInitialSync, cancelToken, justCheckIfNeeded, purpose } = {
3769
3769
  isInitialSync: false,
3770
3770
  }) {
3771
- var _a, _b, _c;
3771
+ var _a, _b, _c, _d, _e;
3772
3772
  if (!justCheckIfNeeded) {
3773
3773
  console.debug('SYNC STARTED', { isInitialSync, purpose });
3774
3774
  }
@@ -3842,7 +3842,7 @@ function _sync(db_1, options_1, schema_1) {
3842
3842
  // Offload large blobs to blob storage before sync
3843
3843
  //
3844
3844
  let processedChangeSet = clientChangeSet;
3845
- const maxStringLength = (_c = (_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.maxStringLength) !== null && _c !== void 0 ? _c : 32768;
3845
+ const maxStringLength = (_e = (_c = (_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.largeStringThreshold) !== null && _c !== void 0 ? _c : (_d = db.cloud.options) === null || _d === void 0 ? void 0 : _d.maxStringLength) !== null && _e !== void 0 ? _e : 32768;
3846
3846
  const hasLargeBlobs = hasLargeBlobsInOperations(clientChangeSet, maxStringLength);
3847
3847
  if (hasLargeBlobs) {
3848
3848
  processedChangeSet = yield offloadBlobsInOperations(clientChangeSet, databaseUrl, () => loadCachedAccessToken(db), maxStringLength);
@@ -6204,8 +6204,20 @@ function createBlobResolveMiddleware(db) {
6204
6204
  * each onNext callback, ensuring cursor.value is always available.
6205
6205
  */
6206
6206
  function createBlobResolvingCursor(cursor, table, blobSavingQueue, db) {
6207
- // Create wrapped cursor using Object.create() - inherits everything
6207
+ // Create wrapped cursor using Object.create() - inherits everything.
6208
+ // Important: .key and .primaryKey must be explicitly overridden with
6209
+ // closure-based getters to prevent native IDBCursorWithValue getters from
6210
+ // being reached through the prototype chain with a wrong `this`, which
6211
+ // throws "Illegal invocation" in Chrome 146+.
6208
6212
  const wrappedCursor = Object.create(cursor, {
6213
+ key: {
6214
+ get() { return cursor.key; },
6215
+ configurable: true,
6216
+ },
6217
+ primaryKey: {
6218
+ get() { return cursor.primaryKey; },
6219
+ configurable: true,
6220
+ },
6209
6221
  value: {
6210
6222
  value: cursor.value,
6211
6223
  enumerable: true,
@@ -8329,7 +8341,7 @@ function dexieCloud(dexie) {
8329
8341
  const downloading$ = createDownloadingState();
8330
8342
  dexie.cloud = {
8331
8343
  // @ts-ignore
8332
- version: "4.4.8",
8344
+ version: "4.4.10",
8333
8345
  options: Object.assign({}, DEFAULT_OPTIONS),
8334
8346
  schema: null,
8335
8347
  get currentUserId() {
@@ -8357,18 +8369,27 @@ function dexieCloud(dexie) {
8357
8369
  invites: getInvitesObservable(dexie),
8358
8370
  roles: getGlobalRolesObservable(dexie),
8359
8371
  configure(options) {
8360
- // Validate maxStringLength Infinity disables offloading, otherwise must be
8361
- // a finite number between 100 and the server limit (32768).
8372
+ // Validate largeStringThreshold (preferred) or maxStringLength (deprecated)
8373
+ // Infinity disables offloading, otherwise must be a finite number between 100
8374
+ // and the server limit (32768).
8362
8375
  // Minimum 100 prevents accidental offloading of primary keys and short strings
8363
8376
  // that would break sync.
8364
8377
  const MIN_STRING_LENGTH = 100;
8365
8378
  const MAX_SERVER_STRING_LENGTH = 32768;
8366
- if (options.maxStringLength !== undefined &&
8367
- options.maxStringLength !== Infinity &&
8368
- (!Number.isFinite(options.maxStringLength) ||
8369
- options.maxStringLength < MIN_STRING_LENGTH ||
8370
- options.maxStringLength > MAX_SERVER_STRING_LENGTH)) {
8371
- throw new Error(`maxStringLength must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${options.maxStringLength}`);
8379
+ if (options.maxStringLength !== undefined) {
8380
+ console.warn('maxStringLength is deprecated, use largeStringThreshold instead');
8381
+ // If largeStringThreshold is not explicitly set, migrate to new name
8382
+ if (options.largeStringThreshold === undefined) {
8383
+ options = Object.assign(Object.assign({}, options), { largeStringThreshold: options.maxStringLength });
8384
+ }
8385
+ }
8386
+ const thresholdValue = options.largeStringThreshold;
8387
+ if (thresholdValue !== undefined &&
8388
+ thresholdValue !== Infinity &&
8389
+ (!Number.isFinite(thresholdValue) ||
8390
+ thresholdValue < MIN_STRING_LENGTH ||
8391
+ thresholdValue > MAX_SERVER_STRING_LENGTH)) {
8392
+ throw new Error(`largeStringThreshold must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${thresholdValue}`);
8372
8393
  }
8373
8394
  options = dexie.cloud.options = Object.assign(Object.assign({}, dexie.cloud.options), options);
8374
8395
  configuredProgramatically = true;
@@ -8765,7 +8786,7 @@ function dexieCloud(dexie) {
8765
8786
  }
8766
8787
  }
8767
8788
  // @ts-ignore
8768
- dexieCloud.version = "4.4.8";
8789
+ dexieCloud.version = "4.4.10";
8769
8790
  Dexie.Cloud = dexieCloud;
8770
8791
 
8771
8792
  // In case the SW lives for a while, let it reuse already opened connections: