stream-chat 10.0.0-rc.21 → 10.0.0-rc.23
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 +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
userResponseToMentionEntity,
|
|
19
19
|
} from './middleware/textComposer/mentionUtils';
|
|
20
20
|
import type { MessageComposer } from './messageComposer';
|
|
21
|
-
import type { Command, DraftMessage,
|
|
21
|
+
import type { Command, DraftMessage, LocalMessage, UserResponse } from '../types';
|
|
22
22
|
|
|
23
23
|
export type TextComposerOptions = {
|
|
24
24
|
composer: MessageComposer;
|
|
@@ -86,9 +86,7 @@ const getInitialMentions = (message?: DraftMessage | LocalMessage): MentionEntit
|
|
|
86
86
|
})),
|
|
87
87
|
);
|
|
88
88
|
} else if (message.mentioned_group_ids?.length) {
|
|
89
|
-
//
|
|
90
|
-
// group mentions are represented only by ids even though response/render paths use
|
|
91
|
-
// `mentioned_groups` for presentation metadata.
|
|
89
|
+
// Request-shaped drafts carry group mentions as IDs only.
|
|
92
90
|
mentions.push(
|
|
93
91
|
...message.mentioned_group_ids.map((groupId) => ({
|
|
94
92
|
id: groupId,
|
|
@@ -120,7 +118,6 @@ const initState = ({
|
|
|
120
118
|
mentionedUsers: [],
|
|
121
119
|
mentions: [],
|
|
122
120
|
text,
|
|
123
|
-
typing: {},
|
|
124
121
|
selection: { start: text.length, end: text.length },
|
|
125
122
|
};
|
|
126
123
|
}
|
|
@@ -134,7 +131,6 @@ const initState = ({
|
|
|
134
131
|
mentionedUsers,
|
|
135
132
|
mentions,
|
|
136
133
|
text,
|
|
137
|
-
typing: {},
|
|
138
134
|
selection: { start: text.length, end: text.length },
|
|
139
135
|
};
|
|
140
136
|
};
|
|
@@ -163,11 +159,6 @@ export class TextComposer {
|
|
|
163
159
|
}
|
|
164
160
|
|
|
165
161
|
set enabled(enabled: boolean) {
|
|
166
|
-
// No early return on "same value". The guard that used to be here compared against the *effective*
|
|
167
|
-
// value, while the write it skipped records the *requested* one — so asking for a value the server
|
|
168
|
-
// was currently masking recorded nothing, and the earlier request stayed in the patch layer to be
|
|
169
|
-
// honoured the moment the server relented. `ConfigController.write` already skips a publish when the
|
|
170
|
-
// resolved value does not move, which is the same guard applied to the right value.
|
|
171
162
|
this.composer.updateConfig({ text: { enabled } });
|
|
172
163
|
}
|
|
173
164
|
|
|
@@ -185,11 +176,8 @@ export class TextComposer {
|
|
|
185
176
|
}
|
|
186
177
|
|
|
187
178
|
set maxLengthOnEdit(maxLengthOnEdit: number | undefined) {
|
|
188
|
-
// No early return
|
|
189
|
-
//
|
|
190
|
-
// was currently masking recorded nothing, and the earlier request stayed in the patch layer to be
|
|
191
|
-
// honoured the moment the server relented. `ConfigController.write` already skips a publish when the
|
|
192
|
-
// resolved value does not move, which is the same guard applied to the right value.
|
|
179
|
+
// No same-value early return: the getter reads the effective value, and a request the server
|
|
180
|
+
// masks must still be recorded.
|
|
193
181
|
this.composer.updateConfig({ text: { maxLengthOnEdit } });
|
|
194
182
|
}
|
|
195
183
|
|
|
@@ -198,11 +186,8 @@ export class TextComposer {
|
|
|
198
186
|
}
|
|
199
187
|
|
|
200
188
|
set maxLengthOnSend(maxLengthOnSend: number | undefined) {
|
|
201
|
-
// No early return
|
|
202
|
-
//
|
|
203
|
-
// was currently masking recorded nothing, and the earlier request stayed in the patch layer to be
|
|
204
|
-
// honoured the moment the server relented. `ConfigController.write` already skips a publish when the
|
|
205
|
-
// resolved value does not move, which is the same guard applied to the right value.
|
|
189
|
+
// No same-value early return: the getter reads the effective value, and a request the server
|
|
190
|
+
// masks must still be recorded.
|
|
206
191
|
this.composer.updateConfig({ text: { maxLengthOnSend } });
|
|
207
192
|
}
|
|
208
193
|
|
|
@@ -215,8 +200,6 @@ export class TextComposer {
|
|
|
215
200
|
this.composer.updateConfig({ text: { publishTypingEvents } });
|
|
216
201
|
}
|
|
217
202
|
|
|
218
|
-
// --- START STATE API ---
|
|
219
|
-
|
|
220
203
|
get command() {
|
|
221
204
|
return this.state.getLatestValue().command;
|
|
222
205
|
}
|
|
@@ -241,29 +224,6 @@ export class TextComposer {
|
|
|
241
224
|
return this.state.getLatestValue().text;
|
|
242
225
|
}
|
|
243
226
|
|
|
244
|
-
get typing() {
|
|
245
|
-
return this.state.getLatestValue().typing;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
set typing(typing: Record<string, Event>) {
|
|
249
|
-
this.state.partialNext({ typing });
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
setTyping = (typing: Record<string, Event>) => {
|
|
253
|
-
this.typing = typing;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
setTypingEvent = (userId: string, event: Event) => {
|
|
257
|
-
this.typing = { ...this.typing, [userId]: event };
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
removeTypingEvent = (userId: string) => {
|
|
261
|
-
if (!this.typing[userId]) return;
|
|
262
|
-
const typing = { ...this.typing };
|
|
263
|
-
delete typing[userId];
|
|
264
|
-
this.typing = typing;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
227
|
get textIsEmpty() {
|
|
268
228
|
return textIsEmpty(this.text);
|
|
269
229
|
}
|
|
@@ -273,9 +233,8 @@ export class TextComposer {
|
|
|
273
233
|
};
|
|
274
234
|
|
|
275
235
|
/**
|
|
276
|
-
* Takes over `source`'s text
|
|
277
|
-
*
|
|
278
|
-
* `source`'s channel.
|
|
236
|
+
* Takes over `source`'s text, selection, mentions and command, not its suggestions (they belong to
|
|
237
|
+
* `source`'s open search).
|
|
279
238
|
*
|
|
280
239
|
* @internal
|
|
281
240
|
*/
|
|
@@ -444,12 +403,7 @@ export class TextComposer {
|
|
|
444
403
|
selection?: TextSelection;
|
|
445
404
|
}) => {
|
|
446
405
|
if (!this.enabled) return;
|
|
447
|
-
|
|
448
|
-
* Windows inserts \r\n; macOS inserts \n.
|
|
449
|
-
* The caret can fall inside a CRLF pair during repeated pastes on Windows.
|
|
450
|
-
* That corrupts newline alignment (a\nb\na\nba\nb\n\n).
|
|
451
|
-
* Normalize the text to prevent it.
|
|
452
|
-
*/
|
|
406
|
+
// Normalize CRLF: a caret inside a CRLF pair during repeated pastes (Windows) corrupts newlines.
|
|
453
407
|
const normalizedText = text.replace(/\r\n/g, '\n');
|
|
454
408
|
const finalSelection: TextSelection = selection ?? this.selection;
|
|
455
409
|
const { maxLengthOnEdit } = this.composer.config.text ?? {};
|
|
@@ -509,7 +463,6 @@ export class TextComposer {
|
|
|
509
463
|
if (!suggestions) return;
|
|
510
464
|
this.state.partialNext({ suggestions: undefined });
|
|
511
465
|
};
|
|
512
|
-
// --- END STATE API ---
|
|
513
466
|
|
|
514
467
|
private commitState = (state: TextComposerMiddlewareExecutorState) => {
|
|
515
468
|
const { change, effects, ...nextState } = state;
|
|
@@ -519,8 +472,6 @@ export class TextComposer {
|
|
|
519
472
|
this.composer.applyEffects(effects);
|
|
520
473
|
};
|
|
521
474
|
|
|
522
|
-
// --- START TEXT PROCESSING ----
|
|
523
|
-
|
|
524
475
|
handleChange = async ({
|
|
525
476
|
text,
|
|
526
477
|
selection,
|
|
@@ -563,5 +514,4 @@ export class TextComposer {
|
|
|
563
514
|
if (output?.status === 'discard') return;
|
|
564
515
|
this.commitState(output.state);
|
|
565
516
|
};
|
|
566
|
-
// --- END TEXT PROCESSING ----
|
|
567
517
|
}
|
|
@@ -91,25 +91,22 @@ export type BaseLocalAttachmentMetadata = {
|
|
|
91
91
|
|
|
92
92
|
export type LocalAttachmentUploadMetadata = {
|
|
93
93
|
file: File | FileReference;
|
|
94
|
-
/**
|
|
95
|
-
* Local preview URI, typically a Blob URL from `URL.createObjectURL(file)`
|
|
96
|
-
* or (for React Native `FileReference`) the provided `uri`.
|
|
97
|
-
*/
|
|
94
|
+
/** Local preview URI: a Blob URL for a `File`, or the `uri` of a React Native `FileReference`. */
|
|
98
95
|
previewUri?: string;
|
|
99
96
|
uploadState: AttachmentLoadingState;
|
|
100
97
|
/**
|
|
101
|
-
* Mirrors {@link UploadRecord.uploadConfirmationPending}: every byte
|
|
102
|
-
*
|
|
98
|
+
* Mirrors {@link UploadRecord.uploadConfirmationPending}: every byte is sent but the server has not
|
|
99
|
+
* confirmed. Render an indeterminate indicator rather than a full bar.
|
|
103
100
|
*/
|
|
104
101
|
uploadConfirmationPending?: boolean;
|
|
105
|
-
uploadPermissionCheck?: UploadPermissionCheckResult;
|
|
106
|
-
/** 0
|
|
102
|
+
uploadPermissionCheck?: UploadPermissionCheckResult;
|
|
103
|
+
/** 0 to 100 while uploading with progress tracking on; `undefined` otherwise or when indeterminate. */
|
|
107
104
|
uploadProgress?: number;
|
|
108
105
|
};
|
|
109
106
|
|
|
110
107
|
export type LocalImageAttachmentUploadMetadata = LocalAttachmentUploadMetadata & {
|
|
111
108
|
/**
|
|
112
|
-
* @deprecated `previewUri`
|
|
109
|
+
* @deprecated Use `LocalAttachmentUploadMetadata.previewUri` instead.
|
|
113
110
|
*/
|
|
114
111
|
previewUri?: string;
|
|
115
112
|
};
|
|
@@ -137,14 +134,14 @@ export type FileLike = File | Blob;
|
|
|
137
134
|
// todo: make sure that RN SDK passes MIME type in the type field
|
|
138
135
|
export type FileReference = FileReferenceBase &
|
|
139
136
|
Pick<File, 'name' | 'size'> & {
|
|
140
|
-
//
|
|
137
|
+
// Images
|
|
141
138
|
height?: number;
|
|
142
139
|
width?: number;
|
|
143
140
|
|
|
144
|
-
//
|
|
141
|
+
// Voice recordings
|
|
145
142
|
duration?: number;
|
|
146
143
|
waveform_data?: number[];
|
|
147
144
|
|
|
148
|
-
//
|
|
145
|
+
// Needed for video in the camera roll
|
|
149
146
|
thumb_url?: string;
|
|
150
147
|
};
|
|
@@ -18,19 +18,19 @@ import { throttle } from '../utils';
|
|
|
18
18
|
import { isAPIError, isErrorRetryable } from '../errors';
|
|
19
19
|
|
|
20
20
|
export type MessageDeliveryReporterConfig = {
|
|
21
|
-
/** How long delivery reports are buffered before being sent as one batch
|
|
21
|
+
/** How long delivery reports are buffered before being sent as one batch. Defaults to 1000ms. */
|
|
22
22
|
markAsDeliveredBufferTimeoutMs: number;
|
|
23
23
|
/**
|
|
24
|
-
* Minimum gap between automatic `markRead` calls
|
|
25
|
-
*
|
|
26
|
-
* Read once, when the throttle is built — assigning it later does nothing, which is why
|
|
27
|
-
* {@link MessageDeliveryReporter.setMarkAsReadThrottleOptions} exists and why the declarative path
|
|
28
|
-
* routes through it.
|
|
24
|
+
* Minimum gap between automatic `markRead` calls for the same channel or thread. Changes rebuild
|
|
25
|
+
* the throttles. Defaults to 1000ms.
|
|
29
26
|
*/
|
|
30
27
|
markAsReadThrottleTimeoutMs: number;
|
|
31
|
-
/** Most delivery receipts sent in
|
|
28
|
+
/** Most delivery receipts sent in one request; the rest go in the next. Defaults to 100. */
|
|
32
29
|
maxDeliveredMessageCountInPayload: number;
|
|
33
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Most times consecutive retryable failures double the buffer window. A success resets it.
|
|
32
|
+
* Defaults to 3.
|
|
33
|
+
*/
|
|
34
34
|
retryCountLimitForTimeoutIncrease: number;
|
|
35
35
|
};
|
|
36
36
|
|
|
@@ -70,15 +70,10 @@ export class MessageDeliveryReporter {
|
|
|
70
70
|
|
|
71
71
|
protected requestTimeoutMs: number =
|
|
72
72
|
DEFAULT_MESSAGE_DELIVERY_REPORTER_CONFIG.markAsDeliveredBufferTimeoutMs;
|
|
73
|
-
//
|
|
73
|
+
// Capped at `config.retryCountLimitForTimeoutIncrease`.
|
|
74
74
|
protected requestRetryCount: number = 0;
|
|
75
75
|
|
|
76
|
-
/** The shared configuration machinery — see {@link ConfigController}. */
|
|
77
76
|
private readonly configController: ConfigController<MessageDeliveryReporterConfig>;
|
|
78
|
-
/**
|
|
79
|
-
* Resolved configuration, as a store — the shape every configurable class exposes
|
|
80
|
-
* (`configState` / `config` / `updateConfig`).
|
|
81
|
-
*/
|
|
82
77
|
get configState(): StateStore<MessageDeliveryReporterConfig> {
|
|
83
78
|
return this.configController.state;
|
|
84
79
|
}
|
|
@@ -87,9 +82,7 @@ export class MessageDeliveryReporter {
|
|
|
87
82
|
this.client = client;
|
|
88
83
|
this.configController = new ConfigController<MessageDeliveryReporterConfig>({
|
|
89
84
|
defaults: DEFAULT_MESSAGE_DELIVERY_REPORTER_CONFIG,
|
|
90
|
-
// The
|
|
91
|
-
// it has to be rebuilt. Doing that here rather than in `updateConfig` is what makes the pairing
|
|
92
|
-
// hold for *every* route, including a declarative change.
|
|
85
|
+
// The throttle captures its interval, so it is rebuilt whenever the interval changes.
|
|
93
86
|
onChanged: (next, previous) => {
|
|
94
87
|
if (next.markAsReadThrottleTimeoutMs === previous.markAsReadThrottleTimeoutMs)
|
|
95
88
|
return;
|
|
@@ -100,49 +93,32 @@ export class MessageDeliveryReporter {
|
|
|
100
93
|
});
|
|
101
94
|
}
|
|
102
95
|
|
|
103
|
-
/** The current resolved configuration. `Readonly` — change it through {@link updateConfig}. */
|
|
104
96
|
get config(): Readonly<MessageDeliveryReporterConfig> {
|
|
105
97
|
return this.configState.getLatestValue();
|
|
106
98
|
}
|
|
107
99
|
|
|
108
100
|
/**
|
|
109
|
-
* Merges a partial configuration
|
|
110
|
-
*
|
|
101
|
+
* Merges a partial configuration into the resolved config.
|
|
102
|
+
*
|
|
103
|
+
* @param config - Fields to merge into the resolved config.
|
|
111
104
|
*/
|
|
112
105
|
updateConfig(config: Partial<MessageDeliveryReporterConfig>) {
|
|
113
106
|
this.configController.patch(config);
|
|
114
107
|
}
|
|
115
108
|
|
|
116
109
|
/**
|
|
117
|
-
*
|
|
110
|
+
* Re-derives the configuration from the declarative slice.
|
|
118
111
|
*
|
|
119
|
-
*
|
|
120
|
-
* knows nothing about MessageDeliveryReporter's defaults or merge semantics. This logic used to live in the owner,
|
|
121
|
-
* which is how `reset()` became a no-op for the client key (F4) and how a registered
|
|
122
|
-
* `notifications.sortComparator` became unremovable (G8) — an owner writing another object's
|
|
123
|
-
* derivation gets that object's rules wrong sooner or later.
|
|
124
|
-
*
|
|
125
|
-
* Routed through {@link updateConfig} rather than replacing the store, which is exact here because
|
|
126
|
-
* every field of `MessageDeliveryReporterConfig` is required and present in the defaults, so a patch naming all of
|
|
127
|
-
* them amounts to a replacement. `NotificationManager` cannot do this — its `sortComparator` is
|
|
128
|
-
* optional with no default, so a patch can never remove one — which is why it replaces outright.
|
|
112
|
+
* @param config - The declarative slice. Leave it out to rebuild from the defaults.
|
|
129
113
|
*/
|
|
130
114
|
initializeConfig(config?: Partial<MessageDeliveryReporterConfig>) {
|
|
131
115
|
this.configController.initialize(config);
|
|
132
116
|
}
|
|
133
117
|
|
|
134
|
-
/**
|
|
135
|
-
* Rebuilds the `markRead` throttle for a new interval.
|
|
136
|
-
*
|
|
137
|
-
* Needed because the throttle is created as a field initializer — before any declarative
|
|
138
|
-
* configuration has been applied — so the interval is captured once. Assigning the config value
|
|
139
|
-
* alone would leave the original throttle in place, silently.
|
|
140
|
-
*/
|
|
118
|
+
/** Sets `markAsReadThrottleTimeoutMs`, which rebuilds the `markRead` throttle. */
|
|
141
119
|
setMarkAsReadThrottleOptions = ({
|
|
142
120
|
markAsReadThrottleTimeoutMs,
|
|
143
121
|
}: Pick<MessageDeliveryReporterConfig, 'markAsReadThrottleTimeoutMs'>) => {
|
|
144
|
-
// Kept as released surface, but it no longer has to pair the write with the rebuild — the
|
|
145
|
-
// controller's `onChanged` does that for whichever route the value arrives by.
|
|
146
122
|
this.updateConfig({ markAsReadThrottleTimeoutMs });
|
|
147
123
|
};
|
|
148
124
|
|
|
@@ -178,13 +154,7 @@ export class MessageDeliveryReporter {
|
|
|
178
154
|
this.requestRetryCount = 0;
|
|
179
155
|
}
|
|
180
156
|
|
|
181
|
-
/**
|
|
182
|
-
* Builds the `latest_delivered_messages` payload from an arbitrary buffer
|
|
183
|
-
* (`deliveryReportCandidates` or `nextDeliveryReportCandidates`).
|
|
184
|
-
*
|
|
185
|
-
* @param map - The buffer mapping channel/thread composite IDs to the latest delivered message ID.
|
|
186
|
-
* @returns The payload entries ready to be sent to the server.
|
|
187
|
-
*/
|
|
157
|
+
/** Builds the `latest_delivered_messages` payload from a candidates buffer. */
|
|
188
158
|
private confirmationsFrom(map: Map<ChannelThreadCompositeId, MessageId>) {
|
|
189
159
|
return Array.from(map.entries()).map(([key, messageId]) => {
|
|
190
160
|
const [type, id, parent_id] = key.split(':');
|
|
@@ -206,12 +176,7 @@ export class MessageDeliveryReporter {
|
|
|
206
176
|
return { latest_delivered_messages: this.confirmationsFrom(sendBuffer), sendBuffer };
|
|
207
177
|
}
|
|
208
178
|
|
|
209
|
-
/**
|
|
210
|
-
* Generates a candidate key for storing in the candidates buffer.
|
|
211
|
-
*
|
|
212
|
-
* @param collection - The channel or thread to derive a candidate key for.
|
|
213
|
-
* @returns The composite identifier, or `undefined` when the collection is neither a Channel nor a Thread.
|
|
214
|
-
*/
|
|
179
|
+
/** The buffer key: the channel `cid`, or `cid:threadId` for a thread. */
|
|
215
180
|
private candidateKeyFor(
|
|
216
181
|
collection: Channel | Thread,
|
|
217
182
|
): ChannelThreadCompositeId | undefined {
|
|
@@ -219,13 +184,7 @@ export class MessageDeliveryReporter {
|
|
|
219
184
|
if (isThread(collection)) return `${collection.channel.cid}:${collection.id}`;
|
|
220
185
|
}
|
|
221
186
|
|
|
222
|
-
/**
|
|
223
|
-
* Retrieves a reference to the latest message in the state that is neither read nor reported as
|
|
224
|
-
* delivered.
|
|
225
|
-
*
|
|
226
|
-
* @param collection - The channel or thread to inspect.
|
|
227
|
-
* @returns The next candidate to report as delivered, or `undefined` when none applies.
|
|
228
|
-
*/
|
|
187
|
+
/** The latest message that is neither read nor reported as delivered (`id: null` when none). */
|
|
229
188
|
private getNextDeliveryReportCandidate = (
|
|
230
189
|
collection: Channel | Thread,
|
|
231
190
|
): { key: ChannelThreadCompositeId; id: MessageId | null } | undefined => {
|
|
@@ -233,7 +192,7 @@ export class MessageDeliveryReporter {
|
|
|
233
192
|
if (!ownUserId) return;
|
|
234
193
|
|
|
235
194
|
let latestMessages: LocalMessage[] = [];
|
|
236
|
-
//
|
|
195
|
+
// Unix nanoseconds, comparable with a message's `created_at`.
|
|
237
196
|
let lastDeliveredAt: TimestampNS | undefined;
|
|
238
197
|
let lastReadAt: TimestampNS | undefined;
|
|
239
198
|
let key: string | undefined = undefined;
|
|
@@ -246,9 +205,7 @@ export class MessageDeliveryReporter {
|
|
|
246
205
|
lastDeliveredAt = ownReadState?.last_delivered_at;
|
|
247
206
|
key = collection.cid;
|
|
248
207
|
} else if (isThread(collection)) {
|
|
249
|
-
//
|
|
250
|
-
// below inspects the newest message, which the active interval only reflects when scrolled to
|
|
251
|
-
// the head. Mirrors the channel branch above.
|
|
208
|
+
// The head window, as for channels: the active interval may be scrolled away from the newest.
|
|
252
209
|
latestMessages = collection.messagePaginator.headItems;
|
|
253
210
|
const ownReadState =
|
|
254
211
|
collection.state.getLatestValue().read[ownUserId] ?? ({} as ThreadUserReadState);
|
|
@@ -276,11 +233,7 @@ export class MessageDeliveryReporter {
|
|
|
276
233
|
return { key, id: latestMessage.id || null };
|
|
277
234
|
};
|
|
278
235
|
|
|
279
|
-
|
|
280
|
-
* Updates the delivery candidates buffer with the latest delivery candidates.
|
|
281
|
-
*
|
|
282
|
-
* @param collection - The channel or thread whose latest delivery candidate to track.
|
|
283
|
-
*/
|
|
236
|
+
// Candidates found while a request is in flight wait in the next buffer.
|
|
284
237
|
private trackDeliveredCandidate(collection: Channel | Thread) {
|
|
285
238
|
if (!MessageDeliveryReporter.hasPermissionToReportDeliveryFor(collection)) return;
|
|
286
239
|
const candidate = this.getNextDeliveryReportCandidate(collection);
|
|
@@ -292,11 +245,6 @@ export class MessageDeliveryReporter {
|
|
|
292
245
|
else buffer.set(candidate.key, candidate.id);
|
|
293
246
|
}
|
|
294
247
|
|
|
295
|
-
/**
|
|
296
|
-
* Removes a candidate from the delivery report buffer.
|
|
297
|
-
*
|
|
298
|
-
* @param collection - The channel or thread whose candidate should be removed.
|
|
299
|
-
*/
|
|
300
248
|
private removeCandidateFor(collection: Channel | Thread) {
|
|
301
249
|
const candidateKey = this.candidateKeyFor(collection);
|
|
302
250
|
if (!candidateKey) return;
|
|
@@ -305,9 +253,8 @@ export class MessageDeliveryReporter {
|
|
|
305
253
|
}
|
|
306
254
|
|
|
307
255
|
/**
|
|
308
|
-
* Records
|
|
309
|
-
*
|
|
310
|
-
* (`message.new`) as well as for ingesting HTTP channel query results.
|
|
256
|
+
* Records each collection's latest undelivered message and schedules a report if none is
|
|
257
|
+
* pending. For WS handling (`message.new`) and for ingesting channel query results.
|
|
311
258
|
*
|
|
312
259
|
* @param collections - The channels or threads whose candidates should be synced.
|
|
313
260
|
*/
|
|
@@ -318,9 +265,9 @@ export class MessageDeliveryReporter {
|
|
|
318
265
|
}
|
|
319
266
|
|
|
320
267
|
/**
|
|
321
|
-
*
|
|
268
|
+
* Sends the buffered report immediately, at most `maxDeliveredMessageCountInPayload` entries.
|
|
322
269
|
*
|
|
323
|
-
* @param options - Flags forwarded to `client.markDelivered
|
|
270
|
+
* @param options - Flags forwarded to `client.markDelivered`.
|
|
324
271
|
*/
|
|
325
272
|
public announceDelivery = (options?: AnnounceDeliveryOptions) => {
|
|
326
273
|
if (!this.canExecuteRequest) return;
|
|
@@ -336,14 +283,14 @@ export class MessageDeliveryReporter {
|
|
|
336
283
|
}: { preventSchedulingRetry?: boolean } = {}) => {
|
|
337
284
|
this.markDeliveredRequestPromise = null;
|
|
338
285
|
|
|
339
|
-
//
|
|
286
|
+
// Promote candidates that arrived during the request.
|
|
340
287
|
for (const [k, v] of this.nextDeliveryReportCandidates.entries()) {
|
|
341
288
|
this.deliveryReportCandidates.set(k, v);
|
|
342
289
|
}
|
|
343
290
|
this.nextDeliveryReportCandidates = new Map();
|
|
344
291
|
|
|
345
292
|
if (preventSchedulingRetry) return;
|
|
346
|
-
//
|
|
293
|
+
// Checks internally whether there are candidates to announce.
|
|
347
294
|
this.announceDeliveryBuffered(options);
|
|
348
295
|
};
|
|
349
296
|
|
|
@@ -353,8 +300,7 @@ export class MessageDeliveryReporter {
|
|
|
353
300
|
};
|
|
354
301
|
|
|
355
302
|
const handleError = (error: StreamAPIError | Error) => {
|
|
356
|
-
//
|
|
357
|
-
// but make sure to keep the items that failed to be reported the first next time
|
|
303
|
+
// Requeue the failed batch ahead of the remaining candidates, so it is retried first.
|
|
358
304
|
const newDeliveryReportCandidates = new Map(sendBuffer);
|
|
359
305
|
for (const [k, v] of this.deliveryReportCandidates.entries()) {
|
|
360
306
|
newDeliveryReportCandidates.set(k, v);
|
|
@@ -388,11 +334,11 @@ export class MessageDeliveryReporter {
|
|
|
388
334
|
};
|
|
389
335
|
|
|
390
336
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
337
|
+
* Marks the channel or thread read. A channel with read events disabled is marked read locally when
|
|
338
|
+
* `localUnreadCountEnabled` is set.
|
|
393
339
|
*
|
|
394
340
|
* @param collection - The channel or thread to mark as read.
|
|
395
|
-
* @param options - Flags forwarded to the underlying `markRead` call
|
|
341
|
+
* @param options - Flags forwarded to the underlying `markRead` call.
|
|
396
342
|
* @returns The server response, or `null` when no request went out.
|
|
397
343
|
*/
|
|
398
344
|
public markRead = async (collection: Channel | Thread, options?: MarkReadRequest) => {
|
|
@@ -416,11 +362,8 @@ export class MessageDeliveryReporter {
|
|
|
416
362
|
} else {
|
|
417
363
|
const { readEvents, requestHandlers } = channel.configState.getLatestValue();
|
|
418
364
|
const markReadRequestHandler = requestHandlers?.markReadRequest;
|
|
419
|
-
// Without read events
|
|
420
|
-
//
|
|
421
|
-
// reset has to come from somewhere: `markReadLocally` clears it through the same read
|
|
422
|
-
// handling a `message.read` would. Threads are deliberately outside this branch - their read
|
|
423
|
-
// state is their own, and resetting the channel is not what a thread read means.
|
|
365
|
+
// Without read events `channel.markRead()` throws, so reset unread locally (threads have their own
|
|
366
|
+
// read state and are not affected).
|
|
424
367
|
if (markReadRequestHandler) {
|
|
425
368
|
result =
|
|
426
369
|
(await markReadRequestHandler({ channel, options: requestOptions })) ?? null;
|
|
@@ -431,32 +374,36 @@ export class MessageDeliveryReporter {
|
|
|
431
374
|
}
|
|
432
375
|
}
|
|
433
376
|
|
|
434
|
-
// A read implies delivery, so the candidate is only
|
|
435
|
-
//
|
|
436
|
-
// survive for the next delivery report.
|
|
377
|
+
// A read implies delivery, so the candidate is dropped only if a request went out (a declining
|
|
378
|
+
// `markReadRequest` handler returns nothing).
|
|
437
379
|
if (result) this.removeCandidateFor(collection);
|
|
438
380
|
return result;
|
|
439
381
|
};
|
|
440
382
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
383
|
+
// Fire-and-forget: no caller awaits an automatic mark-read, so rejections are swallowed (the next
|
|
384
|
+
// trigger retries; explicit `markRead()` callers still get the error). One throttle per collection:
|
|
385
|
+
// a shared one keeps only the latest call for its trailing edge and would drop another
|
|
386
|
+
// collection's pending mark-read.
|
|
387
|
+
private buildThrottledMarkRead = (intervalMs: number) => {
|
|
388
|
+
const throttled = new WeakMap<
|
|
389
|
+
Channel | Thread,
|
|
390
|
+
(options?: MarkReadRequest) => void
|
|
391
|
+
>();
|
|
392
|
+
return (collection: Channel | Thread, options?: MarkReadRequest) => {
|
|
393
|
+
let markRead = throttled.get(collection);
|
|
394
|
+
if (!markRead) {
|
|
395
|
+
markRead = throttle(
|
|
396
|
+
(markReadOptions?: MarkReadRequest) => {
|
|
397
|
+
void this.markRead(collection, markReadOptions).catch(() => undefined);
|
|
398
|
+
},
|
|
399
|
+
intervalMs,
|
|
400
|
+
{ leading: true, trailing: true },
|
|
401
|
+
).throttledFn;
|
|
402
|
+
throttled.set(collection, markRead);
|
|
403
|
+
}
|
|
404
|
+
markRead(options);
|
|
405
|
+
};
|
|
406
|
+
};
|
|
460
407
|
|
|
461
408
|
public throttledMarkRead = this.buildThrottledMarkRead(
|
|
462
409
|
DEFAULT_MESSAGE_DELIVERY_REPORTER_CONFIG.markAsReadThrottleTimeoutMs,
|