dexie-cloud-addon 4.4.8 → 4.4.9

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.9, Tue Mar 31 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);
@@ -8500,7 +8500,7 @@ function dexieCloud(dexie) {
8500
8500
  const downloading$ = createDownloadingState();
8501
8501
  dexie.cloud = {
8502
8502
  // @ts-ignore
8503
- version: "4.4.8",
8503
+ version: "4.4.9",
8504
8504
  options: Object.assign({}, DEFAULT_OPTIONS),
8505
8505
  schema: null,
8506
8506
  get currentUserId() {
@@ -8528,18 +8528,27 @@ function dexieCloud(dexie) {
8528
8528
  invites: getInvitesObservable(dexie),
8529
8529
  roles: getGlobalRolesObservable(dexie),
8530
8530
  configure(options) {
8531
- // Validate maxStringLength Infinity disables offloading, otherwise must be
8532
- // a finite number between 100 and the server limit (32768).
8531
+ // Validate largeStringThreshold (preferred) or maxStringLength (deprecated)
8532
+ // Infinity disables offloading, otherwise must be a finite number between 100
8533
+ // and the server limit (32768).
8533
8534
  // Minimum 100 prevents accidental offloading of primary keys and short strings
8534
8535
  // that would break sync.
8535
8536
  const MIN_STRING_LENGTH = 100;
8536
8537
  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}`);
8538
+ if (options.maxStringLength !== undefined) {
8539
+ console.warn('maxStringLength is deprecated, use largeStringThreshold instead');
8540
+ // If largeStringThreshold is not explicitly set, migrate to new name
8541
+ if (options.largeStringThreshold === undefined) {
8542
+ options = Object.assign(Object.assign({}, options), { largeStringThreshold: options.maxStringLength });
8543
+ }
8544
+ }
8545
+ const thresholdValue = options.largeStringThreshold;
8546
+ if (thresholdValue !== undefined &&
8547
+ thresholdValue !== Infinity &&
8548
+ (!Number.isFinite(thresholdValue) ||
8549
+ thresholdValue < MIN_STRING_LENGTH ||
8550
+ thresholdValue > MAX_SERVER_STRING_LENGTH)) {
8551
+ throw new Error(`largeStringThreshold must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${thresholdValue}`);
8543
8552
  }
8544
8553
  options = dexie.cloud.options = Object.assign(Object.assign({}, dexie.cloud.options), options);
8545
8554
  configuredProgramatically = true;
@@ -8936,7 +8945,7 @@ function dexieCloud(dexie) {
8936
8945
  }
8937
8946
  }
8938
8947
  // @ts-ignore
8939
- dexieCloud.version = "4.4.8";
8948
+ dexieCloud.version = "4.4.9";
8940
8949
  Dexie.Cloud = dexieCloud;
8941
8950
 
8942
8951
  export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };