dexie-cloud-addon 4.4.7 → 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.
- package/dist/modern/DexieCloudOptions.d.ts +5 -1
- package/dist/modern/dexie-cloud-addon.js +42 -21
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +42 -21
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/modern/sync/BlobDownloadTracker.d.ts +5 -2
- package/dist/umd/dexie-cloud-addon.js +43 -22
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +43 -22
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.4.
|
|
11
|
+
* Version 4.4.9, Tue Mar 31 2026
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -13623,7 +13623,7 @@
|
|
|
13623
13623
|
*
|
|
13624
13624
|
* ==========================================================================
|
|
13625
13625
|
*
|
|
13626
|
-
* Version 4.4.0,
|
|
13626
|
+
* Version 4.4.0, Tue Mar 31 2026
|
|
13627
13627
|
*
|
|
13628
13628
|
* https://dexie.org
|
|
13629
13629
|
*
|
|
@@ -14667,6 +14667,14 @@
|
|
|
14667
14667
|
});
|
|
14668
14668
|
return Promise.resolve(currentUser.accessToken);
|
|
14669
14669
|
}
|
|
14670
|
+
// If the current user is not logged in (no isLoggedIn flag), there's no
|
|
14671
|
+
// token to load from the database — skip the Dexie.ignoreTransaction() call.
|
|
14672
|
+
// This avoids a crash in service worker context where Dexie's Promise zone
|
|
14673
|
+
// (PSD.transless.env) may be undefined when called from within an active
|
|
14674
|
+
// rw transaction (e.g. during applyServerChanges).
|
|
14675
|
+
if (!(currentUser === null || currentUser === void 0 ? void 0 : currentUser.isLoggedIn)) {
|
|
14676
|
+
return Promise.resolve(null);
|
|
14677
|
+
}
|
|
14670
14678
|
return Dexie.ignoreTransaction(() => loadAccessToken(db).then((user) => {
|
|
14671
14679
|
var _a, _b;
|
|
14672
14680
|
if (user === null || user === void 0 ? void 0 : user.accessToken) {
|
|
@@ -14728,7 +14736,7 @@
|
|
|
14728
14736
|
return __awaiter(this, arguments, void 0, function* (db, options, schema, { isInitialSync, cancelToken, justCheckIfNeeded, purpose } = {
|
|
14729
14737
|
isInitialSync: false,
|
|
14730
14738
|
}) {
|
|
14731
|
-
var _a, _b, _c;
|
|
14739
|
+
var _a, _b, _c, _d, _e;
|
|
14732
14740
|
if (!justCheckIfNeeded) {
|
|
14733
14741
|
console.debug('SYNC STARTED', { isInitialSync, purpose });
|
|
14734
14742
|
}
|
|
@@ -14802,7 +14810,7 @@
|
|
|
14802
14810
|
// Offload large blobs to blob storage before sync
|
|
14803
14811
|
//
|
|
14804
14812
|
let processedChangeSet = clientChangeSet;
|
|
14805
|
-
const maxStringLength = (_c = (_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.
|
|
14813
|
+
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;
|
|
14806
14814
|
const hasLargeBlobs = hasLargeBlobsInOperations(clientChangeSet, maxStringLength);
|
|
14807
14815
|
if (hasLargeBlobs) {
|
|
14808
14816
|
processedChangeSet = yield offloadBlobsInOperations(clientChangeSet, databaseUrl, () => loadCachedAccessToken(db), maxStringLength);
|
|
@@ -15248,8 +15256,9 @@
|
|
|
15248
15256
|
if (!promise) {
|
|
15249
15257
|
promise = loadCachedAccessToken(this.db)
|
|
15250
15258
|
.then((accessToken) => {
|
|
15251
|
-
|
|
15252
|
-
|
|
15259
|
+
// accessToken may be null for anonymous/unauthenticated users.
|
|
15260
|
+
// Public realm blobs (rlm-public) are accessible without auth.
|
|
15261
|
+
// downloadBlob will omit the Authorization header when token is null.
|
|
15253
15262
|
return downloadBlob(blobRef, dbUrl, accessToken);
|
|
15254
15263
|
})
|
|
15255
15264
|
.finally(() => this.inFlight.delete(blobRef.ref));
|
|
@@ -15262,19 +15271,22 @@
|
|
|
15262
15271
|
/**
|
|
15263
15272
|
* Download blob data from server via proxy endpoint.
|
|
15264
15273
|
* Uses auth header for authentication (same as sync).
|
|
15274
|
+
* When accessToken is null, the request is made without Authorization header —
|
|
15275
|
+
* this allows downloading blobs from public realms (rlm-public) for
|
|
15276
|
+
* unauthenticated users.
|
|
15265
15277
|
*
|
|
15266
15278
|
* @param blobRef - The BlobRef to download
|
|
15267
15279
|
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
15268
|
-
* @param accessToken - Access token for authentication
|
|
15280
|
+
* @param accessToken - Access token for authentication, or null for anonymous access
|
|
15269
15281
|
*/
|
|
15270
15282
|
function downloadBlob(blobRef, dbUrl, accessToken) {
|
|
15271
15283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15272
15284
|
const downloadUrl = `${dbUrl}/blob/${blobRef.ref}`;
|
|
15273
|
-
const
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
});
|
|
15285
|
+
const headers = {};
|
|
15286
|
+
if (accessToken) {
|
|
15287
|
+
headers['Authorization'] = `Bearer ${accessToken}`;
|
|
15288
|
+
}
|
|
15289
|
+
const response = yield fetch(downloadUrl, { headers });
|
|
15278
15290
|
if (!response.ok) {
|
|
15279
15291
|
throw new Error(`Failed to download blob ${blobRef.ref}: ${response.status} ${response.statusText}`);
|
|
15280
15292
|
}
|
|
@@ -19547,7 +19559,7 @@
|
|
|
19547
19559
|
const downloading$ = createDownloadingState();
|
|
19548
19560
|
dexie.cloud = {
|
|
19549
19561
|
// @ts-ignore
|
|
19550
|
-
version: "4.4.
|
|
19562
|
+
version: "4.4.9",
|
|
19551
19563
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
19552
19564
|
schema: null,
|
|
19553
19565
|
get currentUserId() {
|
|
@@ -19575,18 +19587,27 @@
|
|
|
19575
19587
|
invites: getInvitesObservable(dexie),
|
|
19576
19588
|
roles: getGlobalRolesObservable(dexie),
|
|
19577
19589
|
configure(options) {
|
|
19578
|
-
// Validate
|
|
19579
|
-
// a finite number between 100
|
|
19590
|
+
// Validate largeStringThreshold (preferred) or maxStringLength (deprecated) —
|
|
19591
|
+
// Infinity disables offloading, otherwise must be a finite number between 100
|
|
19592
|
+
// and the server limit (32768).
|
|
19580
19593
|
// Minimum 100 prevents accidental offloading of primary keys and short strings
|
|
19581
19594
|
// that would break sync.
|
|
19582
19595
|
const MIN_STRING_LENGTH = 100;
|
|
19583
19596
|
const MAX_SERVER_STRING_LENGTH = 32768;
|
|
19584
|
-
if (options.maxStringLength !== undefined
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
options.
|
|
19589
|
-
|
|
19597
|
+
if (options.maxStringLength !== undefined) {
|
|
19598
|
+
console.warn('maxStringLength is deprecated, use largeStringThreshold instead');
|
|
19599
|
+
// If largeStringThreshold is not explicitly set, migrate to new name
|
|
19600
|
+
if (options.largeStringThreshold === undefined) {
|
|
19601
|
+
options = Object.assign(Object.assign({}, options), { largeStringThreshold: options.maxStringLength });
|
|
19602
|
+
}
|
|
19603
|
+
}
|
|
19604
|
+
const thresholdValue = options.largeStringThreshold;
|
|
19605
|
+
if (thresholdValue !== undefined &&
|
|
19606
|
+
thresholdValue !== Infinity &&
|
|
19607
|
+
(!Number.isFinite(thresholdValue) ||
|
|
19608
|
+
thresholdValue < MIN_STRING_LENGTH ||
|
|
19609
|
+
thresholdValue > MAX_SERVER_STRING_LENGTH)) {
|
|
19610
|
+
throw new Error(`largeStringThreshold must be Infinity or a finite number in [${MIN_STRING_LENGTH}, ${MAX_SERVER_STRING_LENGTH}]. Got: ${thresholdValue}`);
|
|
19590
19611
|
}
|
|
19591
19612
|
options = dexie.cloud.options = Object.assign(Object.assign({}, dexie.cloud.options), options);
|
|
19592
19613
|
configuredProgramatically = true;
|
|
@@ -19983,7 +20004,7 @@
|
|
|
19983
20004
|
}
|
|
19984
20005
|
}
|
|
19985
20006
|
// @ts-ignore
|
|
19986
|
-
dexieCloud.version = "4.4.
|
|
20007
|
+
dexieCloud.version = "4.4.9";
|
|
19987
20008
|
Dexie.Cloud = dexieCloud;
|
|
19988
20009
|
|
|
19989
20010
|
// In case the SW lives for a while, let it reuse already opened connections:
|