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
|
*
|
|
@@ -4569,6 +4569,14 @@ function loadCachedAccessToken(db) {
|
|
|
4569
4569
|
});
|
|
4570
4570
|
return Promise.resolve(currentUser.accessToken);
|
|
4571
4571
|
}
|
|
4572
|
+
// If the current user is not logged in (no isLoggedIn flag), there's no
|
|
4573
|
+
// token to load from the database — skip the Dexie.ignoreTransaction() call.
|
|
4574
|
+
// This avoids a crash in service worker context where Dexie's Promise zone
|
|
4575
|
+
// (PSD.transless.env) may be undefined when called from within an active
|
|
4576
|
+
// rw transaction (e.g. during applyServerChanges).
|
|
4577
|
+
if (!(currentUser === null || currentUser === void 0 ? void 0 : currentUser.isLoggedIn)) {
|
|
4578
|
+
return Promise.resolve(null);
|
|
4579
|
+
}
|
|
4572
4580
|
return Dexie.ignoreTransaction(() => loadAccessToken(db).then((user) => {
|
|
4573
4581
|
var _a, _b;
|
|
4574
4582
|
if (user === null || user === void 0 ? void 0 : user.accessToken) {
|
|
@@ -5150,8 +5158,9 @@ class BlobDownloadTracker {
|
|
|
5150
5158
|
if (!promise) {
|
|
5151
5159
|
promise = loadCachedAccessToken(this.db)
|
|
5152
5160
|
.then((accessToken) => {
|
|
5153
|
-
|
|
5154
|
-
|
|
5161
|
+
// accessToken may be null for anonymous/unauthenticated users.
|
|
5162
|
+
// Public realm blobs (rlm-public) are accessible without auth.
|
|
5163
|
+
// downloadBlob will omit the Authorization header when token is null.
|
|
5155
5164
|
return downloadBlob(blobRef, dbUrl, accessToken);
|
|
5156
5165
|
})
|
|
5157
5166
|
.finally(() => this.inFlight.delete(blobRef.ref));
|
|
@@ -5164,19 +5173,22 @@ class BlobDownloadTracker {
|
|
|
5164
5173
|
/**
|
|
5165
5174
|
* Download blob data from server via proxy endpoint.
|
|
5166
5175
|
* Uses auth header for authentication (same as sync).
|
|
5176
|
+
* When accessToken is null, the request is made without Authorization header —
|
|
5177
|
+
* this allows downloading blobs from public realms (rlm-public) for
|
|
5178
|
+
* unauthenticated users.
|
|
5167
5179
|
*
|
|
5168
5180
|
* @param blobRef - The BlobRef to download
|
|
5169
5181
|
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
5170
|
-
* @param accessToken - Access token for authentication
|
|
5182
|
+
* @param accessToken - Access token for authentication, or null for anonymous access
|
|
5171
5183
|
*/
|
|
5172
5184
|
function downloadBlob(blobRef, dbUrl, accessToken) {
|
|
5173
5185
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5174
5186
|
const downloadUrl = `${dbUrl}/blob/${blobRef.ref}`;
|
|
5175
|
-
const
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
});
|
|
5187
|
+
const headers = {};
|
|
5188
|
+
if (accessToken) {
|
|
5189
|
+
headers['Authorization'] = `Bearer ${accessToken}`;
|
|
5190
|
+
}
|
|
5191
|
+
const response = yield fetch(downloadUrl, { headers });
|
|
5180
5192
|
if (!response.ok) {
|
|
5181
5193
|
throw new Error(`Failed to download blob ${blobRef.ref}: ${response.status} ${response.statusText}`);
|
|
5182
5194
|
}
|
|
@@ -8488,7 +8500,7 @@ function dexieCloud(dexie) {
|
|
|
8488
8500
|
const downloading$ = createDownloadingState();
|
|
8489
8501
|
dexie.cloud = {
|
|
8490
8502
|
// @ts-ignore
|
|
8491
|
-
version: "4.4.
|
|
8503
|
+
version: "4.4.8",
|
|
8492
8504
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
8493
8505
|
schema: null,
|
|
8494
8506
|
get currentUserId() {
|
|
@@ -8924,7 +8936,7 @@ function dexieCloud(dexie) {
|
|
|
8924
8936
|
}
|
|
8925
8937
|
}
|
|
8926
8938
|
// @ts-ignore
|
|
8927
|
-
dexieCloud.version = "4.4.
|
|
8939
|
+
dexieCloud.version = "4.4.8";
|
|
8928
8940
|
Dexie.Cloud = dexieCloud;
|
|
8929
8941
|
|
|
8930
8942
|
export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|