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.
Files changed (269) hide show
  1. package/dist/cjs/index.browser.js +2196 -3902
  2. package/dist/cjs/index.browser.js.map +3 -3
  3. package/dist/cjs/index.node.js +2197 -3902
  4. package/dist/cjs/index.node.js.map +3 -3
  5. package/dist/esm/index.mjs +2199 -3905
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelManager.d.ts +120 -233
  8. package/dist/types/CooldownTimer.d.ts +8 -23
  9. package/dist/types/EventHandlerPipeline.d.ts +17 -37
  10. package/dist/types/LiveLocationManager.d.ts +22 -50
  11. package/dist/types/api-client.d.ts +9 -14
  12. package/dist/types/channel.d.ts +253 -448
  13. package/dist/types/channel_state.d.ts +48 -95
  14. package/dist/types/client.d.ts +245 -370
  15. package/dist/types/client_state.d.ts +1 -3
  16. package/dist/types/configuration/ConfigController.d.ts +30 -124
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
  18. package/dist/types/configuration/keys.d.ts +5 -19
  19. package/dist/types/configuration/shape.d.ts +12 -29
  20. package/dist/types/configuration/types.d.ts +59 -87
  21. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
  22. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  23. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  24. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  25. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  26. package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
  27. package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
  28. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
  29. package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
  30. package/dist/types/connection/networkConnection/types.d.ts +12 -27
  31. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
  32. package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
  33. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
  34. package/dist/types/connection/wsConnection/config.d.ts +8 -28
  35. package/dist/types/connection/wsConnection/types.d.ts +17 -70
  36. package/dist/types/entityStore/EntityStore.d.ts +153 -113
  37. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
  38. package/dist/types/errors.d.ts +7 -19
  39. package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
  40. package/dist/types/gen/chat/ChatApi.d.ts +28 -14
  41. package/dist/types/gen/models/index.d.ts +769 -86
  42. package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
  43. package/dist/types/index.d.ts +2 -4
  44. package/dist/types/languageNames.d.ts +9 -24
  45. package/dist/types/logger.d.ts +1 -3
  46. package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
  47. package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
  48. package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
  49. package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
  50. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  51. package/dist/types/messageComposer/configuration/types.d.ts +29 -56
  52. package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
  53. package/dist/types/messageComposer/messageComposer.d.ts +30 -164
  54. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
  55. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
  56. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  57. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  58. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
  59. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
  60. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  61. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  62. package/dist/types/messageComposer/pollComposer.d.ts +8 -4
  63. package/dist/types/messageComposer/textComposer.d.ts +3 -9
  64. package/dist/types/messageComposer/types.d.ts +5 -8
  65. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
  66. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
  67. package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
  68. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
  69. package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
  70. package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
  71. package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
  72. package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
  73. package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
  74. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
  75. package/dist/types/messageOperations/types.d.ts +15 -30
  76. package/dist/types/middleware.d.ts +7 -5
  77. package/dist/types/moderation.d.ts +21 -14
  78. package/dist/types/notifications/NotificationManager.d.ts +8 -31
  79. package/dist/types/notifications/types.d.ts +19 -59
  80. package/dist/types/offline-support/offline_support_api.d.ts +145 -539
  81. package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
  82. package/dist/types/offline-support/queueableOperations.d.ts +24 -52
  83. package/dist/types/offline-support/types.d.ts +24 -187
  84. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  85. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  86. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
  87. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
  88. package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
  89. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
  90. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
  91. package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
  92. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
  93. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
  94. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
  95. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
  96. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  97. package/dist/types/pagination/utility.normalization.d.ts +5 -23
  98. package/dist/types/pagination/utility.search.d.ts +3 -8
  99. package/dist/types/poll.d.ts +14 -14
  100. package/dist/types/poll_manager.d.ts +11 -2
  101. package/dist/types/poll_optimistic_votes.d.ts +10 -14
  102. package/dist/types/reminders/Reminder.d.ts +4 -4
  103. package/dist/types/reminders/ReminderManager.d.ts +7 -20
  104. package/dist/types/search/BaseSearchSource.d.ts +7 -12
  105. package/dist/types/search/ChannelSearchSource.d.ts +7 -7
  106. package/dist/types/search/MessageSearchSource.d.ts +7 -9
  107. package/dist/types/search/SearchController.d.ts +17 -22
  108. package/dist/types/search/types.d.ts +6 -10
  109. package/dist/types/signing.d.ts +12 -3
  110. package/dist/types/thread.d.ts +23 -71
  111. package/dist/types/thread_manager.d.ts +45 -70
  112. package/dist/types/token_manager.d.ts +8 -13
  113. package/dist/types/types.d.ts +64 -125
  114. package/dist/types/types.utility.d.ts +3 -3
  115. package/dist/types/upload-utils.d.ts +5 -10
  116. package/dist/types/uploadManager.d.ts +17 -45
  117. package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
  118. package/dist/types/utils/WithSubscriptions.d.ts +5 -15
  119. package/dist/types/utils/concurrency.d.ts +11 -19
  120. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  121. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  122. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  123. package/dist/types/utils/objectPath.d.ts +6 -41
  124. package/dist/types/utils/retryable.d.ts +8 -12
  125. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  126. package/dist/types/utils/time.d.ts +24 -64
  127. package/dist/types/utils.d.ts +40 -86
  128. package/package.json +7 -2
  129. package/src/ChannelManager.ts +159 -300
  130. package/src/CooldownTimer.ts +11 -29
  131. package/src/EventHandlerPipeline.ts +21 -44
  132. package/src/LiveLocationManager.ts +35 -74
  133. package/src/api-client.ts +43 -61
  134. package/src/campaign.ts +1 -1
  135. package/src/channel.ts +396 -749
  136. package/src/channel_batch_updater.ts +1 -1
  137. package/src/channel_state.ts +50 -105
  138. package/src/client.ts +360 -588
  139. package/src/client_state.ts +1 -6
  140. package/src/configuration/ConfigController.ts +41 -157
  141. package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
  142. package/src/configuration/index.ts +1 -1
  143. package/src/configuration/keys.ts +13 -32
  144. package/src/configuration/shape.ts +67 -70
  145. package/src/configuration/types.ts +60 -100
  146. package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
  147. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  148. package/src/configuration/utils/declarativeSlices.ts +9 -39
  149. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  150. package/src/configuration/utils/index.ts +2 -4
  151. package/src/configuration/utils/serverAuthority.ts +20 -68
  152. package/src/connection/ConnectionIdManager.ts +20 -49
  153. package/src/connection/ConnectionRecoveryManager.ts +51 -178
  154. package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
  155. package/src/connection/networkConnection/reporters.ts +9 -36
  156. package/src/connection/networkConnection/types.ts +12 -27
  157. package/src/connection/wsConnection/StableWSConnection.ts +73 -193
  158. package/src/connection/wsConnection/WSConnection.ts +56 -131
  159. package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
  160. package/src/connection/wsConnection/config.ts +13 -48
  161. package/src/connection/wsConnection/types.ts +17 -70
  162. package/src/constants.ts +4 -4
  163. package/src/entityStore/EntityStore.ts +162 -167
  164. package/src/entityStore/StoreBackedItemIndex.ts +14 -47
  165. package/src/errors.ts +7 -19
  166. package/src/formatMessageMemo.ts +3 -9
  167. package/src/gen/chat/ChannelApi.ts +19 -0
  168. package/src/gen/chat/ChatApi.ts +87 -13
  169. package/src/gen/models/index.ts +793 -71
  170. package/src/gen/moderation/ModerationApi.ts +0 -4
  171. package/src/index.ts +10 -14
  172. package/src/languageNames.ts +9 -24
  173. package/src/logger.ts +1 -3
  174. package/src/messageComposer/LocationComposer.ts +7 -23
  175. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  176. package/src/messageComposer/attachmentIdentity.ts +2 -13
  177. package/src/messageComposer/attachmentManager.ts +17 -63
  178. package/src/messageComposer/attachmentUtils.ts +3 -17
  179. package/src/messageComposer/configuration/configuration.ts +5 -8
  180. package/src/messageComposer/configuration/types.ts +29 -56
  181. package/src/messageComposer/fileUtils.ts +1 -1
  182. package/src/messageComposer/linkPreviewsManager.ts +8 -20
  183. package/src/messageComposer/messageComposer.ts +54 -222
  184. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
  185. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
  186. package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
  187. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
  188. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  189. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
  190. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  191. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  192. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  193. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
  194. package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
  195. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  196. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  197. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  198. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  199. package/src/messageComposer/pollComposer.ts +11 -8
  200. package/src/messageComposer/textComposer.ts +9 -59
  201. package/src/messageComposer/types.ts +9 -12
  202. package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
  203. package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
  204. package/src/messageOperations/FailedSendCache.ts +4 -9
  205. package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
  206. package/src/messageOperations/MessageOperations.ts +33 -62
  207. package/src/messageOperations/applyReactionLocally.ts +9 -28
  208. package/src/messageOperations/createMessageOperations.ts +17 -33
  209. package/src/messageOperations/reflectReactionEvent.ts +5 -13
  210. package/src/messageOperations/sendOrdering.ts +4 -7
  211. package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
  212. package/src/messageOperations/types.ts +15 -30
  213. package/src/middleware.ts +7 -10
  214. package/src/moderation.ts +25 -21
  215. package/src/notifications/NotificationManager.ts +11 -35
  216. package/src/notifications/types.ts +19 -59
  217. package/src/offline-support/offline_support_api.ts +178 -608
  218. package/src/offline-support/offline_sync_manager.ts +25 -69
  219. package/src/offline-support/queueableOperations.ts +31 -84
  220. package/src/offline-support/types.ts +25 -188
  221. package/src/pagination/ItemIndex.ts +4 -12
  222. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  223. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
  224. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  225. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
  226. package/src/pagination/filterCompiler.ts +11 -25
  227. package/src/pagination/paginators/BasePaginator.ts +422 -976
  228. package/src/pagination/paginators/ChannelPaginator.ts +130 -190
  229. package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
  230. package/src/pagination/paginators/MessagePaginator.ts +135 -175
  231. package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
  232. package/src/pagination/paginators/ReminderPaginator.ts +12 -15
  233. package/src/pagination/paginators/ThreadPaginator.ts +16 -26
  234. package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
  235. package/src/pagination/paginators/stateThrottling.ts +5 -10
  236. package/src/pagination/sortCompiler.ts +23 -50
  237. package/src/pagination/utility.normalization.ts +8 -30
  238. package/src/pagination/utility.search.ts +4 -11
  239. package/src/poll.ts +19 -19
  240. package/src/poll_manager.ts +16 -20
  241. package/src/poll_optimistic_votes.ts +17 -22
  242. package/src/reminders/Reminder.ts +5 -6
  243. package/src/reminders/ReminderManager.ts +9 -34
  244. package/src/reminders/ReminderTimer.ts +1 -2
  245. package/src/search/BaseSearchSource.ts +14 -29
  246. package/src/search/ChannelSearchSource.ts +8 -8
  247. package/src/search/MessageSearchSource.ts +19 -25
  248. package/src/search/SearchController.ts +18 -24
  249. package/src/search/types.ts +6 -10
  250. package/src/segment.ts +1 -1
  251. package/src/signing.ts +23 -3
  252. package/src/thread.ts +72 -173
  253. package/src/thread_manager.ts +59 -76
  254. package/src/token_manager.ts +11 -21
  255. package/src/types.ts +78 -126
  256. package/src/types.utility.ts +3 -3
  257. package/src/upload-utils.ts +5 -10
  258. package/src/uploadManager.ts +22 -54
  259. package/src/utils/FixedSizeQueueCache.ts +13 -21
  260. package/src/utils/WithSubscriptions.ts +5 -15
  261. package/src/utils/concurrency.ts +16 -55
  262. package/src/utils/mergeWith/mergeWith.ts +10 -13
  263. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  264. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  265. package/src/utils/objectPath.ts +6 -41
  266. package/src/utils/retryable.ts +10 -14
  267. package/src/utils/throttling/throttle.ts +9 -25
  268. package/src/utils/time.ts +26 -66
  269. package/src/utils.ts +72 -128
@@ -4,19 +4,19 @@ import { Channel } from '../channel';
4
4
  import { Thread } from '../thread';
5
5
  import type { MarkDeliveredRequest, MarkReadRequest, MarkReadResponse, StreamResponse } from '../types';
6
6
  export type MessageDeliveryReporterConfig = {
7
- /** How long delivery reports are buffered before being sent as one batch (defaults to 1000ms). */
7
+ /** How long delivery reports are buffered before being sent as one batch. Defaults to 1000ms. */
8
8
  markAsDeliveredBufferTimeoutMs: number;
9
9
  /**
10
- * Minimum gap between automatic `markRead` calls (defaults to 1000ms).
11
- *
12
- * Read once, when the throttle is built — assigning it later does nothing, which is why
13
- * {@link MessageDeliveryReporter.setMarkAsReadThrottleOptions} exists and why the declarative path
14
- * routes through it.
10
+ * Minimum gap between automatic `markRead` calls for the same channel or thread. Changes rebuild
11
+ * the throttles. Defaults to 1000ms.
15
12
  */
16
13
  markAsReadThrottleTimeoutMs: number;
17
- /** Most delivery receipts sent in a single request; the remainder is carried to the next (100). */
14
+ /** Most delivery receipts sent in one request; the rest go in the next. Defaults to 100. */
18
15
  maxDeliveredMessageCountInPayload: number;
19
- /** Consecutive timeouts before the buffer window is widened (defaults to 3). */
16
+ /**
17
+ * Most times consecutive retryable failures double the buffer window. A success resets it.
18
+ * Defaults to 3.
19
+ */
20
20
  retryCountLimitForTimeoutIncrease: number;
21
21
  };
22
22
  export declare const DEFAULT_MESSAGE_DELIVERY_REPORTER_CONFIG: MessageDeliveryReporterConfig;
@@ -34,43 +34,23 @@ export declare class MessageDeliveryReporter {
34
34
  protected markDeliveredTimeout: ReturnType<typeof setTimeout> | null;
35
35
  protected requestTimeoutMs: number;
36
36
  protected requestRetryCount: number;
37
- /** The shared configuration machinery — see {@link ConfigController}. */
38
37
  private readonly configController;
39
- /**
40
- * Resolved configuration, as a store — the shape every configurable class exposes
41
- * (`configState` / `config` / `updateConfig`).
42
- */
43
38
  get configState(): StateStore<MessageDeliveryReporterConfig>;
44
39
  constructor({ client }: MessageDeliveryReporterOptions);
45
- /** The current resolved configuration. `Readonly` — change it through {@link updateConfig}. */
46
40
  get config(): Readonly<MessageDeliveryReporterConfig>;
47
41
  /**
48
- * Merges a partial configuration in. `markAsReadThrottleTimeoutMs` is routed through its rebuild
49
- * setter, because the throttle captured the old interval in a closure and would otherwise ignore it.
42
+ * Merges a partial configuration into the resolved config.
43
+ *
44
+ * @param config - Fields to merge into the resolved config.
50
45
  */
51
46
  updateConfig(config: Partial<MessageDeliveryReporterConfig>): void;
52
47
  /**
53
- * Rebuilds the resolved configuration from package defaults plus the declarative slice.
54
- *
55
- * The derivation entry point every configurable entity exposes, so the owner routes a slice here and
56
- * knows nothing about MessageDeliveryReporter's defaults or merge semantics. This logic used to live in the owner,
57
- * which is how `reset()` became a no-op for the client key (F4) and how a registered
58
- * `notifications.sortComparator` became unremovable (G8) — an owner writing another object's
59
- * derivation gets that object's rules wrong sooner or later.
48
+ * Re-derives the configuration from the declarative slice.
60
49
  *
61
- * Routed through {@link updateConfig} rather than replacing the store, which is exact here because
62
- * every field of `MessageDeliveryReporterConfig` is required and present in the defaults, so a patch naming all of
63
- * them amounts to a replacement. `NotificationManager` cannot do this — its `sortComparator` is
64
- * optional with no default, so a patch can never remove one — which is why it replaces outright.
50
+ * @param config - The declarative slice. Leave it out to rebuild from the defaults.
65
51
  */
66
52
  initializeConfig(config?: Partial<MessageDeliveryReporterConfig>): void;
67
- /**
68
- * Rebuilds the `markRead` throttle for a new interval.
69
- *
70
- * Needed because the throttle is created as a field initializer — before any declarative
71
- * configuration has been applied — so the interval is captured once. Assigning the config value
72
- * alone would leave the original throttle in place, silently.
73
- */
53
+ /** Sets `markAsReadThrottleTimeoutMs`, which rebuilds the `markRead` throttle. */
74
54
  setMarkAsReadThrottleOptions: ({ markAsReadThrottleTimeoutMs, }: Pick<MessageDeliveryReporterConfig, "markAsReadThrottleTimeoutMs">) => void;
75
55
  private get markDeliveredRequestInFlight();
76
56
  private get hasTimer();
@@ -79,73 +59,39 @@ export declare class MessageDeliveryReporter {
79
59
  private static hasPermissionToReportDeliveryFor;
80
60
  private increaseBackOff;
81
61
  private resetBackOff;
82
- /**
83
- * Builds the `latest_delivered_messages` payload from an arbitrary buffer
84
- * (`deliveryReportCandidates` or `nextDeliveryReportCandidates`).
85
- *
86
- * @param map - The buffer mapping channel/thread composite IDs to the latest delivered message ID.
87
- * @returns The payload entries ready to be sent to the server.
88
- */
62
+ /** Builds the `latest_delivered_messages` payload from a candidates buffer. */
89
63
  private confirmationsFrom;
90
64
  private confirmationsFromDeliveryReportCandidates;
91
- /**
92
- * Generates a candidate key for storing in the candidates buffer.
93
- *
94
- * @param collection - The channel or thread to derive a candidate key for.
95
- * @returns The composite identifier, or `undefined` when the collection is neither a Channel nor a Thread.
96
- */
65
+ /** The buffer key: the channel `cid`, or `cid:threadId` for a thread. */
97
66
  private candidateKeyFor;
98
- /**
99
- * Retrieves a reference to the latest message in the state that is neither read nor reported as
100
- * delivered.
101
- *
102
- * @param collection - The channel or thread to inspect.
103
- * @returns The next candidate to report as delivered, or `undefined` when none applies.
104
- */
67
+ /** The latest message that is neither read nor reported as delivered (`id: null` when none). */
105
68
  private getNextDeliveryReportCandidate;
106
- /**
107
- * Updates the delivery candidates buffer with the latest delivery candidates.
108
- *
109
- * @param collection - The channel or thread whose latest delivery candidate to track.
110
- */
111
69
  private trackDeliveredCandidate;
112
- /**
113
- * Removes a candidate from the delivery report buffer.
114
- *
115
- * @param collection - The channel or thread whose candidate should be removed.
116
- */
117
70
  private removeCandidateFor;
118
71
  /**
119
- * Records the latest message delivered for Channel or Thread instances and schedules the next
120
- * report if not already scheduled and candidates exist. Should be used for WS handling
121
- * (`message.new`) as well as for ingesting HTTP channel query results.
72
+ * Records each collection's latest undelivered message and schedules a report if none is
73
+ * pending. For WS handling (`message.new`) and for ingesting channel query results.
122
74
  *
123
75
  * @param collections - The channels or threads whose candidates should be synced.
124
76
  */
125
77
  syncDeliveredCandidates(collections: (Channel | Thread)[]): void;
126
78
  /**
127
- * Fires a delivery announcement request followed by an immediate delivery candidate buffer reset.
79
+ * Sends the buffered report immediately, at most `maxDeliveredMessageCountInPayload` entries.
128
80
  *
129
- * @param options - Flags forwarded to `client.markDelivered` (optional).
81
+ * @param options - Flags forwarded to `client.markDelivered`.
130
82
  */
131
83
  announceDelivery: (options?: AnnounceDeliveryOptions) => void;
132
84
  announceDeliveryBuffered: (options?: AnnounceDeliveryOptions) => void;
133
85
  /**
134
- * Delegates the mark-read call to the Channel or Thread instance. A channel whose read events are
135
- * disabled is marked read locally instead, when the client opted into counting unread itself.
86
+ * Marks the channel or thread read. A channel with read events disabled is marked read locally when
87
+ * `localUnreadCountEnabled` is set.
136
88
  *
137
89
  * @param collection - The channel or thread to mark as read.
138
- * @param options - Flags forwarded to the underlying `markRead` call (optional).
90
+ * @param options - Flags forwarded to the underlying `markRead` call.
139
91
  * @returns The server response, or `null` when no request went out.
140
92
  */
141
93
  markRead: (collection: Channel | Thread, options?: MarkReadRequest) => Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
142
- /**
143
- * Builds the throttled `markRead`. A factory rather than an inline `throttle(...)` so the interval can
144
- * be swapped later — see {@link setMarkAsReadThrottleOptions}.
145
- *
146
- * @param intervalMs - minimum gap between automatic `markRead` calls
147
- */
148
94
  private buildThrottledMarkRead;
149
- throttledMarkRead: (collection: Channel | Thread, options?: MarkReadRequest | undefined) => void;
95
+ throttledMarkRead: (collection: Channel | Thread, options?: MarkReadRequest) => void;
150
96
  }
151
97
  export {};
@@ -16,24 +16,13 @@ export type UserProgress = {
16
16
  export type MessageReceiptsSnapshot = {
17
17
  revision: number;
18
18
  /**
19
- * Which users' read cursor sits *on* each message - not which messages have been read. A reader
20
- * appears once, at the message they stopped on.
21
- *
22
- * This is the compact form: one entry per user, not per message. "Who has read message X" is
23
- * every user at or past it, which {@link MessageReceiptsTracker.readersForMessage} answers, and
24
- * which a consumer rendering a range can accumulate from these buckets in one pass.
19
+ * Users whose read cursor sits on each message: one entry per user, not everyone who has read it.
20
+ * For "who has read X" use {@link MessageReceiptsTracker.readersForMessage}.
25
21
  */
26
22
  readersByMessageId: Record<MessageId, UserResponse[]>;
27
23
  /** As {@link readersByMessageId}, for delivery. */
28
24
  deliveredByMessageId: Record<MessageId, UserResponse[]>;
29
- /**
30
- * How far the furthest *other* member has got, or `null` when nobody has got anywhere.
31
- *
32
- * Delivery and read only move forward, so one ref answers every message: at or before it means
33
- * delivered/read, after it means not yet. A per-message map cannot express that - it marks only
34
- * the message each cursor happens to land on, leaving every earlier message looking less far
35
- * along than a later one, which is a state that cannot occur.
36
- */
25
+ /** Furthest delivered ref of any other member, or `null`. A message at or before it is delivered. */
37
26
  lastDeliveredRefByOthers: MsgRef | null;
38
27
  /** As {@link lastDeliveredRefByOthers}, for reads. */
39
28
  lastReadRefByOthers: MsgRef | null;
@@ -56,62 +45,13 @@ export type OwnMessageReceiptsTrackerOptions = {
56
45
  locateMessage?: OwnMessageReceiptsTrackerMessageLocator;
57
46
  };
58
47
  /**
59
- * MessageReceiptsTracker
60
- * --------------------------------
61
- * Tracks **other participants’** delivery/read progress toward **own (outgoing) messages**
62
- * within a **single timeline** (one channel/thread).
63
- *
64
- * How it works
65
- * ------------
66
- * - Each user has a compact progress record:
67
- * - `lastReadRef`: latest message they have **read**
68
- * - `lastDeliveredRef`: latest message they have **received** (always `>= lastReadRef`)
69
- * - Internally keeps two arrays sorted **ascending by timestamp**:
70
- * - `readSorted` (by `lastReadRef`)
71
- * - `deliveredSorted` (by `lastDeliveredRef`)
72
- * - Queries like “who read message M?” become a **binary search + suffix slice**.
73
- *
74
- * Construction
75
- * ------------
76
- * `new MessageReceiptsTracker({ channel, locateMessage? })`
77
- * - By default, message references are read through `channel.state.findMessageByTimestamp`.
78
- * - `locateMessage` can override this lookup strategy.
79
- * If a message cannot be resolved locally, the event is ignored.
48
+ * Tracks other participants' delivery and read progress toward own messages in one timeline
49
+ * (channel or thread). Per user it keeps `lastReadRef` and `lastDeliveredRef` (always
50
+ * `>= lastReadRef`) in two arrays sorted by timestamp, so "who read message M?" is a binary search
51
+ * plus a suffix slice.
80
52
  *
81
- * Event ingestion
82
- * ---------------
83
- * - `ingestInitial(rows: ReadStateResponse[])`: Builds initial state from server snapshot.
84
- * If a user’s `last_read` is ahead of `last_delivered_at`, the tracker enforces
85
- * the invariant `lastDeliveredRef >= lastReadRef`.
86
- * - `onMessageRead(user, readAt)`:
87
- * Advances the user’s read; also bumps delivered to match if needed.
88
- * - `onMessageDelivered(user, deliveredAt)`:
89
- * Advances the user’s delivered to `max(currentRead, deliveredAt)`.
90
- *
91
- * Queries
92
- * -------
93
- * - `readersForMessage(msgRef) : UserResponse[]` → users with `lastReadRef >= msgRef`
94
- * - `deliveredForMessage(msgRef) : UserResponse[]` → users with `lastDeliveredRef >= msgRef`
95
- * - `deliveredNotReadForMessage(msgRef): UserResponse[]` → delivered but `lastReadRef < msgRef`
96
- * - `usersWhoseLastReadIs : UserResponse[]` → users for whom `msgRef` is their *last read* (exact match)
97
- * - `usersWhoseLastDeliveredIs : UserResponse[]` → users for whom `msgRef` is their *last delivered* (exact match)
98
- * - `groupUsersByLastReadMessage : Record<MsgId, UserResponse[]> → mapping of messages to their readers
99
- * - `groupUsersByLastDeliveredMessage : Record<MsgId, UserResponse[]> → mapping of messages to their receivers
100
- * - `hasUserRead(msgRef, userId) : boolean`
101
- * - `hasUserDelivered(msgRef, userId) : boolean`
102
- *
103
- * Complexity
104
- * ----------
105
- * - Update on read/delivered: **O(log U)** (binary search + one splice) per event, where U is count of users stored by tracker.
106
- * - Query lists: **O(log U + K)** where `K` is the number of returned users (suffix length).
107
- * - Memory: **O(U)** - tracker’s memory grows linearly with the number of users in the channel/thread and does not depend on the number of messages.
108
- *
109
- * Scope & notes
110
- * -------------
111
- * - One tracker instance is **scoped to a single timeline**. Instantiate per channel/thread.
112
- * - Ordering is by **ascending timestamp**; ties are kept stable by inserting at the end of the
113
- * equal-timestamp plateau (upper-bound insertion), preserving intuitive arrival order.
114
- * - This tracker models **others’ progress toward own messages**;
53
+ * Messages resolve through `channel.messagePaginator.findItemByTimestamp` unless `locateMessage` is
54
+ * passed. Events for messages that cannot be resolved are ignored.
115
55
  */
116
56
  export declare class MessageReceiptsTracker extends WithSubscriptions {
117
57
  private byUser;
@@ -132,28 +72,23 @@ export declare class MessageReceiptsTracker extends WithSubscriptions {
132
72
  nextReadState: Record<string, ReadStoreUserState>;
133
73
  meta?: ReadStoreReconcileMeta;
134
74
  }): void;
135
- /** Build initial state from server snapshots (single pass + sort). */
75
+ /** Replaces the tracker's state with the given server read states. */
136
76
  ingestInitial(responses: ReadStateResponse[]): void;
137
- /** message.delivered — user device confirmed delivery up to and including messageId. */
77
+ /** `message.delivered`: delivery confirmed up to and including the message. */
138
78
  onMessageDelivered({ user, deliveredAt, lastDeliveredMessageId, }: {
139
79
  user: UserResponse;
140
80
  /** Unix nanoseconds, as the API sends it. */
141
81
  deliveredAt: TimestampNS;
142
82
  lastDeliveredMessageId?: string;
143
83
  }): void;
144
- /** message.read — user read up to and including messageId. */
84
+ /** `message.read`: read up to and including the message. */
145
85
  onMessageRead({ user, readAt, lastReadMessageId, }: {
146
86
  user: UserResponse;
147
87
  /** Unix nanoseconds, as the API sends it. */
148
88
  readAt: TimestampNS;
149
89
  lastReadMessageId?: string;
150
90
  }): void;
151
- /** notification.mark_unread — user marked messages unread starting at `first_unread_message_id`.
152
- * Sets lastReadRef to the event’s last_read_* values. Delivery never moves backward.
153
- * The event is sent only to the user that triggered the action (own user), so we will never adjust read ref
154
- * for other users - we will not see changes in the UI for other users. However, this implementation does not
155
- * take into consideration this fact and is ready to handle the mark-unread event for any user.
156
- */
91
+ /** `notification.mark_unread`: sets `lastReadRef` from `last_read_*`; delivery never moves back. */
157
92
  onNotificationMarkUnread({ user, lastReadAt, lastReadMessageId, }: {
158
93
  user: UserResponse;
159
94
  /** Unix nanoseconds, as the API sends it. */
@@ -165,10 +100,8 @@ export declare class MessageReceiptsTracker extends WithSubscriptions {
165
100
  /** All users who have it DELIVERED (includes readers). */
166
101
  deliveredForMessage(msgRef: MsgRef): UserResponse[];
167
102
  /**
168
- * Whether at least one other member has this message delivered.
169
- *
170
- * Reads the single furthest cursor rather than asking who is past this message, so the answer is
171
- * monotonic by construction: an older message can never report less than a newer one.
103
+ * Whether any other member has this message delivered. Uses the furthest cursor, so it is monotonic
104
+ * across messages.
172
105
  */
173
106
  isDeliveredToOthers(msgRef: MsgRef): boolean;
174
107
  /** As {@link isDeliveredToOthers}, for reads. */
@@ -7,9 +7,9 @@ type FailedSendCacheEntry = {
7
7
  cachedAt: number;
8
8
  };
9
9
  /**
10
- * The payloads of sends that failed, kept so a retry sends exactly what failed. An entry expires after
11
- * `failedSendCacheTtlMs`, and past `failedSendCacheMaxSize` the oldest one is dropped. Both limits are
12
- * read from the owner's current configuration on every call, so a config change applies at once.
10
+ * Payloads of failed sends, kept so a retry sends exactly what failed. Entries expire after
11
+ * `failedSendCacheTtlMs`, and past `failedSendCacheMaxSize` the oldest is dropped. Both limits are read
12
+ * from the owner's config on every call.
13
13
  */
14
14
  export declare class FailedSendCache {
15
15
  private readonly getConfig;
@@ -22,12 +22,7 @@ export declare class FailedSendCache {
22
22
  }): void;
23
23
  get(messageId: string): FailedSendCacheEntry | undefined;
24
24
  clear(messageId: string): void;
25
- /**
26
- * Folds an edit into the payload cached for this message's failed send, so a retry resends what the
27
- * message contains now rather than what it contained when the send failed.
28
- *
29
- * This exists so a retry while offline for example is also persisted, rather than just disappearing.
30
- */
25
+ /** Folds an edit into the cached payload, so a retry resends the message as it is now. */
31
26
  rewriteWithEdit(localMessage: LocalMessage): void;
32
27
  private pruneExpired;
33
28
  }
@@ -11,36 +11,26 @@ export type MessageOperationStatePolicyContext = {
11
11
  };
12
12
  /**
13
13
  * What {@link MessageOperationStatePolicy.optimistic} wrote, handed back to
14
- * {@link MessageOperationStatePolicy.failure} so it can decide whether to revert and to what.
14
+ * {@link MessageOperationStatePolicy.failure} so it can decide whether and what to revert.
15
15
  */
16
16
  export type OptimisticOutcome = {
17
17
  /**
18
- * The exact object the optimistic step wrote. Used as a concurrency guard rather than a value:
19
- * `EntityStore.upsert` REPLACES the canonical copy, so `get(id) === applied` is a sound "nothing
20
- * else has written since" check, and anything else means a fresher truth (a WS event, another
21
- * operation) landed and must not be clobbered by a revert.
18
+ * The exact object the optimistic step wrote, used as a concurrency guard: `EntityStore.upsert`
19
+ * replaces the canonical copy, so `get(id) === applied` means nothing wrote since. Anything else is a
20
+ * fresher truth (a WS event, another operation) that a revert must not clobber.
22
21
  */
23
22
  applied?: LocalMessage;
24
23
  /** The copy that was there beforehand, i.e. what a revert restores. */
25
24
  previous?: LocalMessage;
26
25
  };
27
26
  /**
28
- * The local-state half of every message operation: what to show before the request resolves, what to
29
- * do with the server's answer, and what to do when it fails.
27
+ * The local-state half of every message operation: what to show before the request resolves, and what
28
+ * to do with the answer or the failure.
30
29
  *
31
- * Per-operation rather than uniform, because the three kinds want genuinely different things:
32
- *
33
- * - **send / retry** — optimistically `sending`, `failed` on failure, and a pessimistic write-ahead to
34
- * the offline DB so a process death between compose and server-ack leaves a message that hydrates as
35
- * failed-and-retryable instead of vanishing.
36
- * - **update** — optimistically applied and persisted, and **never reverted**: rolling back would
37
- * destroy text the user typed. A definitive rejection surfaces as a failed/error state on the message
38
- * while keeping the edit; a queued (offline) failure surfaces as nothing at all, because the edit is
39
- * pending, not failed.
40
- * - **delete** — optimistically marked `deleted` (or removed outright, for a hard delete), and
41
- * **reverted** on a definitive rejection: unlike an edit there is no user input to lose, and leaving a
42
- * "Message deleted" placeholder on a message that still exists server-side is a lie that only
43
- * self-corrects on the next query.
30
+ * - send / retry: `sending`, then `failed` on failure, with a `failed` write-ahead to the offline DB.
31
+ * - update: applied and persisted, never reverted (that would destroy the user's text). A definitive
32
+ * rejection marks the message `failed` and keeps the edit; a queued failure is pending, not failed.
33
+ * - delete: marked `deleted` (removed for a hard delete), reverted on a definitive rejection.
44
34
  */
45
35
  export declare class MessageOperationStatePolicy {
46
36
  private ctx;
@@ -9,11 +9,9 @@ export type MessageOperationsConfig = {
9
9
  };
10
10
  export declare const DEFAULT_MESSAGE_OPERATIONS_CONFIG: MessageOperationsConfig;
11
11
  /**
12
- * Every optimistic operation on a message, each one method reading top to bottom.
13
- *
14
- * Send, retry, update and delete are message REQUESTS with a status lifecycle, so they share
15
- * {@link run} and {@link MessageOperationStatePolicy}. Anything else (reactions, and whatever comes
16
- * next) applies its change, sends its request, and on failure calls {@link rollbackUnlessQueued}.
12
+ * Every optimistic operation on a message. Send, retry, update and delete have a status lifecycle and
13
+ * share {@link run} and {@link MessageOperationStatePolicy}. Reactions apply their change, send their
14
+ * request, and on failure call {@link rollbackUnlessQueued}.
17
15
  */
18
16
  export declare class MessageOperations {
19
17
  private ctx;
@@ -21,31 +19,20 @@ export declare class MessageOperations {
21
19
  private readonly failedSendCache;
22
20
  private readonly normalizeOutgoingMessage;
23
21
  private readonly sequenceRequests;
24
- /** The shared configuration machinery — see {@link ConfigController}. */
25
22
  private readonly configController;
26
23
  constructor(ctx: MessageOperationsContext);
27
- /**
28
- * Resolved configuration, as a store — the shape every configurable class exposes
29
- * (`configState` / `config` / `updateConfig`).
30
- */
31
24
  get configState(): StateStore<MessageOperationsConfig>;
32
- /** The current resolved configuration. `Readonly` — change it through {@link updateConfig}. */
33
25
  get config(): Readonly<MessageOperationsConfig>;
34
- /** Merges a partial configuration into the resolved config and notifies subscribers. */
35
- updateConfig(config: Partial<MessageOperationsConfig>): void;
36
26
  /**
37
- * Rebuilds the resolved configuration from package defaults plus the declarative slice.
27
+ * Merges a partial configuration into the resolved config.
38
28
  *
39
- * The derivation entry point every configurable entity exposes, so the owner routes a slice here and
40
- * knows nothing about MessageOperations's defaults or merge semantics. This logic used to live in the owner,
41
- * which is how `reset()` became a no-op for the client key (F4) and how a registered
42
- * `notifications.sortComparator` became unremovable (G8) — an owner writing another object's
43
- * derivation gets that object's rules wrong sooner or later.
29
+ * @param config - Fields to merge into the resolved config.
30
+ */
31
+ updateConfig(config: Partial<MessageOperationsConfig>): void;
32
+ /**
33
+ * Re-derives the configuration from the declarative slice.
44
34
  *
45
- * Routed through {@link updateConfig} rather than replacing the store, which is exact here because
46
- * every field of `MessageOperationsConfig` is required and present in the defaults, so a patch naming all of
47
- * them amounts to a replacement. `NotificationManager` cannot do this — its `sortComparator` is
48
- * optional with no default, so a patch can never remove one — which is why it replaces outright.
35
+ * @param config - The declarative slice. Leave it out to rebuild from the defaults.
49
36
  */
50
37
  initializeConfig(config?: Partial<MessageOperationsConfig>): void;
51
38
  /**
@@ -54,10 +41,8 @@ export declare class MessageOperations {
54
41
  */
55
42
  private withSettledUploads;
56
43
  /**
57
- * The shared lifecycle: apply the optimistic state, settle any attachment upload still in flight,
58
- * fire the request, then reconcile or record the failure. `kind` is threaded through because the
59
- * three operations want materially different state transitions — see
60
- * {@link MessageOperationStatePolicy}.
44
+ * The shared lifecycle: apply the optimistic state, settle uploads still in flight, fire the request,
45
+ * then reconcile or record the failure. The per-kind rules are in {@link MessageOperationStatePolicy}.
61
46
  */
62
47
  private run;
63
48
  private resolveRequest;
@@ -69,12 +54,10 @@ export declare class MessageOperations {
69
54
  update(params: OperationParams<'update'>): Promise<void>;
70
55
  delete(params: OperationParams<'delete'>): Promise<void>;
71
56
  /**
72
- * Adds a reaction with an optimistic local state update: the reaction is applied to the cached
73
- * message immediately, then the request is sent through the offline queue. The server-authoritative counts reconcile on the response; the reaction is
74
- * rolled back on a definitive failure, and left alone when the request was queued for replay.
75
- *
76
- * The request routes through the channel because reactions are channel-level, while the local write
77
- * is addressed by message id and so reaches a pure thread reply that no channel collection holds.
57
+ * Adds a reaction optimistically: it is applied to the cached message at once, then sent through the
58
+ * offline queue. The response's counts reconcile; a definitive failure rolls it back, a request queued
59
+ * for replay does not. The local write is by message ID, so it also reaches a thread reply that no
60
+ * channel collection holds.
78
61
  */
79
62
  addReaction({ messageId, options, reaction, }: {
80
63
  messageId: string;
@@ -87,14 +70,11 @@ export declare class MessageOperations {
87
70
  type: string;
88
71
  }): Promise<void>;
89
72
  /**
90
- * The failure rule every operation outside {@link run} shares: a request queued for replay is
91
- * pending, not failed, so its optimistic change stays. Name the operation's OWN task types — every
92
- * task carries the same `messageId`, so "anything queued" would let an unrelated task answer.
73
+ * The failure rule for operations outside {@link run}: a request queued for replay is pending, so its
74
+ * optimistic change stays. Pass the operation's own task types, as every task carries the same
75
+ * `messageId`.
93
76
  */
94
77
  private rollbackUnlessQueued;
95
- /**
96
- * Reconciles the server-authoritative copy, but only if we still hold it — a bare upsert of an unheld
97
- * id would orphan it (the store's refcount GC only reclaims held ids).
98
- */
78
+ /** Reconciles the server copy only if still held: a bare upsert of an unheld ID would orphan it. */
99
79
  private reconcileHeldMessage;
100
80
  }
@@ -1,31 +1,14 @@
1
1
  import type { StreamChat } from '../client';
2
2
  import type { ReactionResponse } from '../types';
3
3
  /**
4
- * Applies a reaction to the single canonical copy of a message in the client-global
5
- * {@link EntityStore} (`client.messageStore`), addressed purely by id — NOT through any paginator's
6
- * membership. It reads the
7
- * current message POJO (`store.get`), produces a new POJO with the reaction folded into its
8
- * `reaction_groups` / `latest_reactions` (shared count helpers) and `own_reactions`
9
- * ({@link computeOwnReactions}), and writes it back (`store.upsert`). The store then notifies every
10
- * collection currently holding that id — the main-list / thread-reply paginators, a thread's
11
- * subscribed parent, any future consumer — and each re-projects. The message stays a plain object;
12
- * the store's per-id registry is the reactivity.
13
- *
14
- * Because it is keyed by id rather than by a paginator's `getItem`, it reaches a message held by ANY
15
- * collection, including the thread parent that lives in no paginator — with no per-home wiring.
16
- *
17
- * Writes memory (synchronous) + the offline DB (fire-and-forget), and returns an `undo()` reversing
18
- * both on the current state (inverse deltas, concurrency-safe), or `undefined` when the user isn't
19
- * connected or the message isn't in the store.
4
+ * Applies a reaction to the canonical copy of a message in `client.messageStore`, by ID, and mirrors it
5
+ * to the offline DB (fire-and-forget). The store notifies every collection holding the message. Returns
6
+ * an `undo()` reversing both on the current state, or `undefined` when the user is not connected or the
7
+ * message is not in the store.
20
8
  */
21
9
  export declare const applyReactionLocally: (client: StreamChat, { enforceUnique, messageId, reaction, removed, }: {
22
10
  messageId: string;
23
- /**
24
- * A response-shaped partial the caller already holds — a captured reaction being re-applied by
25
- * `undo()`, or a freshly composed one. Response-shaped rather than `ReactionRequest` because its
26
- * timestamps are the wire's numbers and it flows straight into the message store and the offline
27
- * DB, both of which speak `ReactionResponse`.
28
- */
11
+ /** A response-shaped partial the caller holds, such as a captured reaction re-applied by `undo()`. */
29
12
  reaction: Partial<ReactionResponse> & Pick<ReactionResponse, "type">;
30
13
  enforceUnique?: boolean;
31
14
  removed?: boolean;
@@ -2,10 +2,8 @@ import { MessageOperations } from './MessageOperations';
2
2
  import type { Channel } from '../channel';
3
3
  import type { Thread } from '../thread';
4
4
  /**
5
- * Builds the `MessageOperations` a message collection owns, shared by `Channel` and `Thread` so the
6
- * two cannot drift.
7
- *
8
- * Everything it needs is derivable from the collection: a `Thread` sends against its parent channel
9
- * and stamps its own id as `parent_id`, a `Channel` against itself with no stamp.
5
+ * Builds the `MessageOperations` a message collection owns, shared by `Channel` and `Thread`. A
6
+ * `Thread` sends against its parent channel and stamps its own ID as `parent_id`; a `Channel` sends
7
+ * against itself.
10
8
  */
11
9
  export declare const createMessageOperations: (collection: Channel | Thread) => MessageOperations;
@@ -1,20 +1,12 @@
1
1
  import type { StreamChat } from '../client';
2
2
  import type { LocalMessage, MessageResponse, ReactionResponse } from '../types';
3
3
  /**
4
- * Applies a `reaction.new` / `reaction.updated` / `reaction.deleted` event to the canonical copy of
5
- * the message, addressed by id — the server-event counterpart of `applyReactionLocally`.
4
+ * Applies a `reaction.new` / `reaction.updated` / `reaction.deleted` event to the canonical copy of the
5
+ * message, by ID. The event's counts are taken as they are; `own_reactions` is derived from what the
6
+ * store holds, because the event omits the current user's reactions or reports another user's.
6
7
  *
7
- * The event carries the server's updated counts, so those are taken as they are; only `own_reactions`
8
- * is derived, because the event either omits the current user's reactions or reports another user's.
9
- * The base for that derivation is whatever the store already holds, so a reaction by someone else
10
- * cannot wipe yours.
11
- *
12
- * One write reaches every collection holding the message — main list, pinned list, thread replies,
13
- * and a thread's subscribed parent, which lives in no paginator at all. Calling it once per
14
- * collection instead is what produced 9 publishes for a single reaction: each call minted a fresh
15
- * object, so the store's reference bail never fired and every write re-projected the others.
16
- *
17
- * No-op when nothing holds the message — there is no view to update.
8
+ * One write reaches every collection holding the message (main list, pinned list, thread replies, a
9
+ * thread's parent). No-op when nothing holds the message.
18
10
  */
19
11
  export declare const reflectReactionEvent: (client: StreamChat, { enforceUnique, message, reaction, removed, }: {
20
12
  message: MessageResponse | LocalMessage;
@@ -1,15 +1,12 @@
1
1
  import type { MessageComposer } from '../messageComposer/messageComposer';
2
2
  import type { OperationKind } from './types';
3
3
  /**
4
- * The ordering policy `Channel` and `Thread` both install as
5
- * {@link MessageOperationsContext.sequenceRequests}.
6
- *
7
- * Sends and retries wait for each other while the composer may hand over still-uploading files,
8
- * so a short text sent after a photo is not dated first. Edits and deletes never wait. Shared so
9
- * both owners keep the same rule; the tag differs, a thread reply being tagged by its channel.
4
+ * The {@link MessageOperationsContext.sequenceRequests} policy of `Channel` and `Thread`. Sends and
5
+ * retries wait for each other while the composer may hand over still-uploading files, so a short text
6
+ * sent after a photo is not dated first. Edits and deletes never wait.
10
7
  */
11
8
  export declare const keepSendOrderWhilePendingUploadsAllowed: <T>({ channelCid, composer, kind, request, }: {
12
- /** Scope of the ordering — a thread passes its channel's cid. */
9
+ /** Scope of the ordering: a thread passes its channel's cid. */
13
10
  channelCid: string;
14
11
  composer: MessageComposer;
15
12
  kind: OperationKind;
@@ -1,22 +1,14 @@
1
1
  import type { StreamChat } from '../client';
2
2
  import type { LocalMessage } from '../types';
3
3
  /**
4
- * Settles the uploads of any attachment that is still in flight, and reports the outcome.
4
+ * Settles the uploads of attachments still in flight and reports the outcome. Unresolved attachments
5
+ * only reach the send path when {@link AttachmentManagerConfig.pendingUploadsEnabled} is on.
6
+ * {@link UploadManager.upload} is idempotent by `localMetadata.id`, so this awaits the composer's
7
+ * request rather than starting a second one; an upload that never started (a retry, an offline replay)
8
+ * starts here. A `failed` upload is retried, while `blocked` is left alone since no retry can settle it.
5
9
  *
6
- * A message only ever reaches the send path with an unresolved attachment when
7
- * {@link AttachmentManagerConfig.pendingUploadsEnabled} is on — otherwise the composition
8
- * middleware discards such a composition instead. {@link UploadManager.upload} is idempotent by
9
- * `localMetadata.id`, so this awaits the request the composer already started rather than
10
- * starting a second one; an attachment whose upload never started (a retry, an offline replay)
11
- * is uploaded here for the first time.
12
- *
13
- * An upload that already `failed` is retried here rather than dropped — offline is the case that
14
- * needs it, where the first attempt could not have succeeded. `blocked` is left alone: the
15
- * server's upload configuration refused it, so no retry can settle it.
16
- *
17
- * Resolved attachments come back carrying their URL and **without** `localMetadata`, and their
18
- * local preview is revoked. Failed ones are returned untouched, `localMetadata` and all, so a
19
- * retry re-uploads only what is still missing.
10
+ * Resolved attachments come back with their URL, without `localMetadata`, and with their local preview
11
+ * revoked. Failed ones come back untouched, so a retry re-uploads only what is missing.
20
12
  */
21
13
  export declare const settlePendingAttachmentUploads: ({ attachments, channelCid, client, }: {
22
14
  attachments: NonNullable<LocalMessage["attachments"]>;