dexie-cloud-addon 4.4.7 → 4.4.8
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/dexie-cloud-addon.js +23 -11
- 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 +23 -11
- 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 +24 -12
- 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 +24 -12
- 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.8, Tue Mar 31 2026
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -3699,6 +3699,14 @@ function loadCachedAccessToken(db) {
|
|
|
3699
3699
|
});
|
|
3700
3700
|
return Promise.resolve(currentUser.accessToken);
|
|
3701
3701
|
}
|
|
3702
|
+
// If the current user is not logged in (no isLoggedIn flag), there's no
|
|
3703
|
+
// token to load from the database — skip the Dexie.ignoreTransaction() call.
|
|
3704
|
+
// This avoids a crash in service worker context where Dexie's Promise zone
|
|
3705
|
+
// (PSD.transless.env) may be undefined when called from within an active
|
|
3706
|
+
// rw transaction (e.g. during applyServerChanges).
|
|
3707
|
+
if (!(currentUser === null || currentUser === void 0 ? void 0 : currentUser.isLoggedIn)) {
|
|
3708
|
+
return Promise.resolve(null);
|
|
3709
|
+
}
|
|
3702
3710
|
return Dexie.ignoreTransaction(() => loadAccessToken(db).then((user) => {
|
|
3703
3711
|
var _a, _b;
|
|
3704
3712
|
if (user === null || user === void 0 ? void 0 : user.accessToken) {
|
|
@@ -4280,8 +4288,9 @@ class BlobDownloadTracker {
|
|
|
4280
4288
|
if (!promise) {
|
|
4281
4289
|
promise = loadCachedAccessToken(this.db)
|
|
4282
4290
|
.then((accessToken) => {
|
|
4283
|
-
|
|
4284
|
-
|
|
4291
|
+
// accessToken may be null for anonymous/unauthenticated users.
|
|
4292
|
+
// Public realm blobs (rlm-public) are accessible without auth.
|
|
4293
|
+
// downloadBlob will omit the Authorization header when token is null.
|
|
4285
4294
|
return downloadBlob(blobRef, dbUrl, accessToken);
|
|
4286
4295
|
})
|
|
4287
4296
|
.finally(() => this.inFlight.delete(blobRef.ref));
|
|
@@ -4294,19 +4303,22 @@ class BlobDownloadTracker {
|
|
|
4294
4303
|
/**
|
|
4295
4304
|
* Download blob data from server via proxy endpoint.
|
|
4296
4305
|
* Uses auth header for authentication (same as sync).
|
|
4306
|
+
* When accessToken is null, the request is made without Authorization header —
|
|
4307
|
+
* this allows downloading blobs from public realms (rlm-public) for
|
|
4308
|
+
* unauthenticated users.
|
|
4297
4309
|
*
|
|
4298
4310
|
* @param blobRef - The BlobRef to download
|
|
4299
4311
|
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
4300
|
-
* @param accessToken - Access token for authentication
|
|
4312
|
+
* @param accessToken - Access token for authentication, or null for anonymous access
|
|
4301
4313
|
*/
|
|
4302
4314
|
function downloadBlob(blobRef, dbUrl, accessToken) {
|
|
4303
4315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4304
4316
|
const downloadUrl = `${dbUrl}/blob/${blobRef.ref}`;
|
|
4305
|
-
const
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
});
|
|
4317
|
+
const headers = {};
|
|
4318
|
+
if (accessToken) {
|
|
4319
|
+
headers['Authorization'] = `Bearer ${accessToken}`;
|
|
4320
|
+
}
|
|
4321
|
+
const response = yield fetch(downloadUrl, { headers });
|
|
4310
4322
|
if (!response.ok) {
|
|
4311
4323
|
throw new Error(`Failed to download blob ${blobRef.ref}: ${response.status} ${response.statusText}`);
|
|
4312
4324
|
}
|
|
@@ -8317,7 +8329,7 @@ function dexieCloud(dexie) {
|
|
|
8317
8329
|
const downloading$ = createDownloadingState();
|
|
8318
8330
|
dexie.cloud = {
|
|
8319
8331
|
// @ts-ignore
|
|
8320
|
-
version: "4.4.
|
|
8332
|
+
version: "4.4.8",
|
|
8321
8333
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
8322
8334
|
schema: null,
|
|
8323
8335
|
get currentUserId() {
|
|
@@ -8753,7 +8765,7 @@ function dexieCloud(dexie) {
|
|
|
8753
8765
|
}
|
|
8754
8766
|
}
|
|
8755
8767
|
// @ts-ignore
|
|
8756
|
-
dexieCloud.version = "4.4.
|
|
8768
|
+
dexieCloud.version = "4.4.8";
|
|
8757
8769
|
Dexie.Cloud = dexieCloud;
|
|
8758
8770
|
|
|
8759
8771
|
// In case the SW lives for a while, let it reuse already opened connections:
|