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
|
@@ -25,9 +25,12 @@ export declare class BlobDownloadTracker {
|
|
|
25
25
|
/**
|
|
26
26
|
* Download blob data from server via proxy endpoint.
|
|
27
27
|
* Uses auth header for authentication (same as sync).
|
|
28
|
+
* When accessToken is null, the request is made without Authorization header —
|
|
29
|
+
* this allows downloading blobs from public realms (rlm-public) for
|
|
30
|
+
* unauthenticated users.
|
|
28
31
|
*
|
|
29
32
|
* @param blobRef - The BlobRef to download
|
|
30
33
|
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
31
|
-
* @param accessToken - Access token for authentication
|
|
34
|
+
* @param accessToken - Access token for authentication, or null for anonymous access
|
|
32
35
|
*/
|
|
33
|
-
export declare function downloadBlob(blobRef: BlobRef, dbUrl: string, accessToken: string): Promise<Uint8Array>;
|
|
36
|
+
export declare function downloadBlob(blobRef: BlobRef, dbUrl: string, accessToken: string | null): Promise<Uint8Array>;
|
|
@@ -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
|
*
|
|
@@ -14493,7 +14493,7 @@
|
|
|
14493
14493
|
*
|
|
14494
14494
|
* ==========================================================================
|
|
14495
14495
|
*
|
|
14496
|
-
* Version 4.4.0,
|
|
14496
|
+
* Version 4.4.0, Tue Mar 31 2026
|
|
14497
14497
|
*
|
|
14498
14498
|
* https://dexie.org
|
|
14499
14499
|
*
|
|
@@ -15537,6 +15537,14 @@
|
|
|
15537
15537
|
});
|
|
15538
15538
|
return Promise.resolve(currentUser.accessToken);
|
|
15539
15539
|
}
|
|
15540
|
+
// If the current user is not logged in (no isLoggedIn flag), there's no
|
|
15541
|
+
// token to load from the database — skip the Dexie.ignoreTransaction() call.
|
|
15542
|
+
// This avoids a crash in service worker context where Dexie's Promise zone
|
|
15543
|
+
// (PSD.transless.env) may be undefined when called from within an active
|
|
15544
|
+
// rw transaction (e.g. during applyServerChanges).
|
|
15545
|
+
if (!(currentUser === null || currentUser === void 0 ? void 0 : currentUser.isLoggedIn)) {
|
|
15546
|
+
return Promise.resolve(null);
|
|
15547
|
+
}
|
|
15540
15548
|
return Dexie.ignoreTransaction(() => loadAccessToken(db).then((user) => {
|
|
15541
15549
|
var _a, _b;
|
|
15542
15550
|
if (user === null || user === void 0 ? void 0 : user.accessToken) {
|
|
@@ -16118,8 +16126,9 @@
|
|
|
16118
16126
|
if (!promise) {
|
|
16119
16127
|
promise = loadCachedAccessToken(this.db)
|
|
16120
16128
|
.then((accessToken) => {
|
|
16121
|
-
|
|
16122
|
-
|
|
16129
|
+
// accessToken may be null for anonymous/unauthenticated users.
|
|
16130
|
+
// Public realm blobs (rlm-public) are accessible without auth.
|
|
16131
|
+
// downloadBlob will omit the Authorization header when token is null.
|
|
16123
16132
|
return downloadBlob(blobRef, dbUrl, accessToken);
|
|
16124
16133
|
})
|
|
16125
16134
|
.finally(() => this.inFlight.delete(blobRef.ref));
|
|
@@ -16132,19 +16141,22 @@
|
|
|
16132
16141
|
/**
|
|
16133
16142
|
* Download blob data from server via proxy endpoint.
|
|
16134
16143
|
* Uses auth header for authentication (same as sync).
|
|
16144
|
+
* When accessToken is null, the request is made without Authorization header —
|
|
16145
|
+
* this allows downloading blobs from public realms (rlm-public) for
|
|
16146
|
+
* unauthenticated users.
|
|
16135
16147
|
*
|
|
16136
16148
|
* @param blobRef - The BlobRef to download
|
|
16137
16149
|
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
16138
|
-
* @param accessToken - Access token for authentication
|
|
16150
|
+
* @param accessToken - Access token for authentication, or null for anonymous access
|
|
16139
16151
|
*/
|
|
16140
16152
|
function downloadBlob(blobRef, dbUrl, accessToken) {
|
|
16141
16153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16142
16154
|
const downloadUrl = `${dbUrl}/blob/${blobRef.ref}`;
|
|
16143
|
-
const
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
});
|
|
16155
|
+
const headers = {};
|
|
16156
|
+
if (accessToken) {
|
|
16157
|
+
headers['Authorization'] = `Bearer ${accessToken}`;
|
|
16158
|
+
}
|
|
16159
|
+
const response = yield fetch(downloadUrl, { headers });
|
|
16148
16160
|
if (!response.ok) {
|
|
16149
16161
|
throw new Error(`Failed to download blob ${blobRef.ref}: ${response.status} ${response.statusText}`);
|
|
16150
16162
|
}
|
|
@@ -19718,7 +19730,7 @@
|
|
|
19718
19730
|
const downloading$ = createDownloadingState();
|
|
19719
19731
|
dexie.cloud = {
|
|
19720
19732
|
// @ts-ignore
|
|
19721
|
-
version: "4.4.
|
|
19733
|
+
version: "4.4.8",
|
|
19722
19734
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
19723
19735
|
schema: null,
|
|
19724
19736
|
get currentUserId() {
|
|
@@ -20154,7 +20166,7 @@
|
|
|
20154
20166
|
}
|
|
20155
20167
|
}
|
|
20156
20168
|
// @ts-ignore
|
|
20157
|
-
dexieCloud.version = "4.4.
|
|
20169
|
+
dexieCloud.version = "4.4.8";
|
|
20158
20170
|
Dexie.Cloud = dexieCloud;
|
|
20159
20171
|
|
|
20160
20172
|
exports.default = dexieCloud;
|