stream-chat 9.50.1 → 9.50.3
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/cjs/index.browser.js +41 -7
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +41 -7
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +41 -7
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +2 -0
- package/dist/types/offline-support/offline_sync_manager.d.ts +7 -0
- package/dist/types/types.d.ts +8 -0
- package/package.json +1 -1
- package/src/messageComposer/attachmentManager.ts +15 -2
- package/src/offline-support/offline_sync_manager.ts +37 -6
- package/src/types.ts +8 -0
package/dist/cjs/index.node.js
CHANGED
|
@@ -3637,7 +3637,8 @@ var _AttachmentManager = class _AttachmentManager {
|
|
|
3637
3637
|
return attachment;
|
|
3638
3638
|
};
|
|
3639
3639
|
this.uploadFiles = async (files) => {
|
|
3640
|
-
if (!this.isUploadEnabled)
|
|
3640
|
+
if (this.hasCustomDoUploadRequest && !this.hasAvailableUploadSlots || !this.hasCustomDoUploadRequest && !this.isUploadEnabled)
|
|
3641
|
+
return;
|
|
3641
3642
|
const iterableFiles = isFileList(files) ? Array.from(files) : files;
|
|
3642
3643
|
return await Promise.all(
|
|
3643
3644
|
iterableFiles.slice(0, this.availableUploadSlots).map(this.uploadFile)
|
|
@@ -3706,8 +3707,14 @@ var _AttachmentManager = class _AttachmentManager {
|
|
|
3706
3707
|
get hasUploadPermission() {
|
|
3707
3708
|
return !!this.channel.data?.own_capabilities?.includes("upload-file");
|
|
3708
3709
|
}
|
|
3710
|
+
get hasCustomDoUploadRequest() {
|
|
3711
|
+
return typeof this.config.doUploadRequest === "function";
|
|
3712
|
+
}
|
|
3713
|
+
get hasAvailableUploadSlots() {
|
|
3714
|
+
return this.availableUploadSlots > 0;
|
|
3715
|
+
}
|
|
3709
3716
|
get isUploadEnabled() {
|
|
3710
|
-
return this.hasUploadPermission && this.
|
|
3717
|
+
return this.hasUploadPermission && this.hasAvailableUploadSlots;
|
|
3711
3718
|
}
|
|
3712
3719
|
get successfulUploads() {
|
|
3713
3720
|
return this.getUploadsByState("finished");
|
|
@@ -14843,7 +14850,7 @@ var StreamChat = class _StreamChat {
|
|
|
14843
14850
|
return this.userAgent;
|
|
14844
14851
|
}
|
|
14845
14852
|
if (!this.cachedUserAgent) {
|
|
14846
|
-
const version = "9.50.
|
|
14853
|
+
const version = "9.50.3";
|
|
14847
14854
|
const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
|
|
14848
14855
|
const { name: appName, version: appVersion } = this.appIdentifier ?? {};
|
|
14849
14856
|
const { os, model: deviceModel } = this.deviceIdentifier ?? {};
|
|
@@ -18427,10 +18434,22 @@ var OfflineDBSyncManager = class {
|
|
|
18427
18434
|
*/
|
|
18428
18435
|
this.invokeSyncStatusListeners = async (status) => {
|
|
18429
18436
|
this.syncStatus = status;
|
|
18430
|
-
this.syncStatusListeners.forEach((l) =>
|
|
18437
|
+
this.syncStatusListeners.forEach((l) => {
|
|
18438
|
+
try {
|
|
18439
|
+
l(status);
|
|
18440
|
+
} catch (error) {
|
|
18441
|
+
console.log("Error in a sync status listener.", error);
|
|
18442
|
+
}
|
|
18443
|
+
});
|
|
18431
18444
|
if (status) {
|
|
18432
18445
|
const promises = Array.from(this.scheduledSyncStatusCallbacks.values()).map(
|
|
18433
|
-
(cb) =>
|
|
18446
|
+
async (cb) => {
|
|
18447
|
+
try {
|
|
18448
|
+
await cb();
|
|
18449
|
+
} catch (error) {
|
|
18450
|
+
console.log("Error executing a scheduled sync status callback.", error);
|
|
18451
|
+
}
|
|
18452
|
+
}
|
|
18434
18453
|
);
|
|
18435
18454
|
await Promise.all(promises);
|
|
18436
18455
|
this.scheduledSyncStatusCallbacks.clear();
|
|
@@ -18492,10 +18511,25 @@ var OfflineDBSyncManager = class {
|
|
|
18492
18511
|
};
|
|
18493
18512
|
/**
|
|
18494
18513
|
* Executes any tasks that were queued while offline and then performs a sync.
|
|
18514
|
+
*
|
|
18515
|
+
* Each step is isolated so a failure in one does not prevent the other, and
|
|
18516
|
+
* neither can escape to the callers (init + the connection.changed handler).
|
|
18517
|
+
* This guarantees the subsequent invokeSyncStatusListeners(true) always runs,
|
|
18518
|
+
* so syncStatus recovers to true and gated channel queries are unblocked.
|
|
18519
|
+
* Failed syncs degrade to "possibly stale data until the next query" rather
|
|
18520
|
+
* than freezing all future queries. See issue #1816.
|
|
18495
18521
|
*/
|
|
18496
18522
|
this.syncAndExecutePendingTasks = async () => {
|
|
18497
|
-
|
|
18498
|
-
|
|
18523
|
+
try {
|
|
18524
|
+
await this.offlineDb.executePendingTasks();
|
|
18525
|
+
} catch (error) {
|
|
18526
|
+
console.log("Error executing pending tasks during sync.", error);
|
|
18527
|
+
}
|
|
18528
|
+
try {
|
|
18529
|
+
await this.sync();
|
|
18530
|
+
} catch (error) {
|
|
18531
|
+
console.log("Error while syncing the DB.", error);
|
|
18532
|
+
}
|
|
18499
18533
|
};
|
|
18500
18534
|
this.client = client;
|
|
18501
18535
|
this.offlineDb = offlineDb;
|