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.
@@ -50,7 +50,7 @@ export interface DexieCloudOptions {
50
50
  * Best for apps with large media that may not all be needed offline.
51
51
  */
52
52
  blobMode?: 'eager' | 'lazy';
53
- /** Maximum string length (in characters) before offloading to blob storage during sync.
53
+ /** String length threshold (in characters) for offloading to blob storage during sync.
54
54
  *
55
55
  * Strings longer than this threshold are uploaded as blobs during sync,
56
56
  * reducing sync payload size. The original string is kept intact in IndexedDB.
@@ -61,5 +61,9 @@ export interface DexieCloudOptions {
61
61
  *
62
62
  * @default 32768
63
63
  */
64
+ largeStringThreshold?: number;
65
+ /**
66
+ * @deprecated Use `largeStringThreshold` instead.
67
+ */
64
68
  maxStringLength?: number;
65
69
  }
@@ -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
  *
@@ -4638,7 +4638,7 @@ function _sync(db_1, options_1, schema_1) {
4638
4638
  return __awaiter(this, arguments, void 0, function* (db, options, schema, { isInitialSync, cancelToken, justCheckIfNeeded, purpose } = {
4639
4639
  isInitialSync: false,
4640
4640
  }) {
4641
- var _a, _b, _c;
4641
+ var _a, _b, _c, _d, _e;
4642
4642
  if (!justCheckIfNeeded) {
4643
4643
  console.debug('SYNC STARTED', { isInitialSync, purpose });
4644
4644
  }
@@ -4712,7 +4712,7 @@ function _sync(db_1, options_1, schema_1) {
4712
4712
  // Offload large blobs to blob storage before sync
4713
4713
  //
4714
4714
  let processedChangeSet = clientChangeSet;
4715
- const maxStringLength = (_c = (_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.maxStringLength) !== null && _c !== void 0 ? _c : 32768;
4715
+ 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;
4716
4716
  const hasLargeBlobs = hasLargeBlobsInOperations(clientChangeSet, maxStringLength);
4717
4717
  if (hasLargeBlobs) {
4718
4718
  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,
@@ -8500,7 +8512,7 @@ function dexieCloud(dexie) {
8500
8512
  const downloading$ = createDownloadingState();
8501
8513
  dexie.cloud = {
8502
8514
  // @ts-ignore
8503
- version: "4.4.8",
8515
+ version: "4.4.10",
8504
8516
  options: Object.assign({}, DEFAULT_OPTIONS),
8505
8517
  schema: null,
8506
8518
  get currentUserId() {
@@ -8528,18 +8540,27 @@ function dexieCloud(dexie) {
8528
8540
  invites: getInvitesObservable(dexie),
8529
8541
  roles: getGlobalRolesObservable(dexie),
8530
8542
  configure(options) {
8531
- // Validate maxStringLength Infinity disables offloading, otherwise must be
8532
- // a finite number between 100 and the server limit (32768).
8543
+ // Validate largeStringThreshold (preferred) or maxStringLength (deprecated)
8544
+ // Infinity disables offloading, otherwise must be a finite number between 100
8545
+ // and the server limit (32768).
8533
8546
  // Minimum 100 prevents accidental offloading of primary keys and short strings
8534
8547
  // that would break sync.
8535
8548
  const MIN_STRING_LENGTH = 100;
8536
8549
  const MAX_SERVER_STRING_LENGTH = 32768;
8537
- if (options.maxStringLength !== undefined &&
8538
- options.maxStringLength !== Infinity &&
8539
- (!Number.isFinite(options.maxStringLength) ||
8540
- options.maxStringLength < MIN_STRING_LENGTH ||
8541
- options.maxStringLength > MAX_SERVER_STRING_LENGTH)) {
8542
- throw new Error(`maxStringLength must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${options.maxStringLength}`);
8550
+ if (options.maxStringLength !== undefined) {
8551
+ console.warn('maxStringLength is deprecated, use largeStringThreshold instead');
8552
+ // If largeStringThreshold is not explicitly set, migrate to new name
8553
+ if (options.largeStringThreshold === undefined) {
8554
+ options = Object.assign(Object.assign({}, options), { largeStringThreshold: options.maxStringLength });
8555
+ }
8556
+ }
8557
+ const thresholdValue = options.largeStringThreshold;
8558
+ if (thresholdValue !== undefined &&
8559
+ thresholdValue !== Infinity &&
8560
+ (!Number.isFinite(thresholdValue) ||
8561
+ thresholdValue < MIN_STRING_LENGTH ||
8562
+ thresholdValue > MAX_SERVER_STRING_LENGTH)) {
8563
+ throw new Error(`largeStringThreshold must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${thresholdValue}`);
8543
8564
  }
8544
8565
  options = dexie.cloud.options = Object.assign(Object.assign({}, dexie.cloud.options), options);
8545
8566
  configuredProgramatically = true;
@@ -8936,7 +8957,7 @@ function dexieCloud(dexie) {
8936
8957
  }
8937
8958
  }
8938
8959
  // @ts-ignore
8939
- dexieCloud.version = "4.4.8";
8960
+ dexieCloud.version = "4.4.10";
8940
8961
  Dexie.Cloud = dexieCloud;
8941
8962
 
8942
8963
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };