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
@@ -14,21 +14,17 @@ export type ChannelManagerEventHandlerContext = {
14
14
  type EventHandlerContext = ChannelManagerEventHandlerContext;
15
15
  type SupportedEventType = EventType | (string & {});
16
16
  /**
17
- * Resolves which paginators should be the "owners" of a channel
18
- * when the channel matches multiple paginator filters.
19
- *
20
- * Return a set of paginator ids that should keep/own the item.
21
- * Returning an empty set means the channel will be removed everywhere.
17
+ * Picks which paginators own a channel that matches several, by returning their IDs. An empty list
18
+ * means every matching paginator keeps it.
22
19
  */
23
20
  export type PaginatorOwnershipResolver = (args: {
24
21
  channel: Channel;
25
22
  matchingPaginators: ChannelPaginator[];
26
23
  }) => string[];
27
24
  /**
28
- * Convenience factory for a priority-based ownership resolver.
29
- * - Provide an ordered list of paginator ids from highest to lowest priority.
30
- * - If two or more paginators match a channel, the one with the highest priority wins.
31
- * - If none of the matching paginator ids are in the priority list, all matches are kept (back-compat).
25
+ * Priority-based ownership resolver. `priority` lists paginator IDs from highest to lowest: of the
26
+ * paginators matching a channel, the highest-priority one owns it. If none of them is listed, all
27
+ * keep it.
32
28
  */
33
29
  export declare const createPriorityOwnershipResolver: (priority?: string[]) => PaginatorOwnershipResolver;
34
30
  export declare const ignoreEventsForUnknownChannels: EventHandlerPipelineHandler<EventHandlerContext>;
@@ -40,25 +36,23 @@ export type ChannelManagerOptions = {
40
36
  client: StreamChat;
41
37
  paginators?: ChannelPaginator[];
42
38
  /**
43
- * The complete set of event handlers to run, replacing the defaults rather than extending them.
44
- * Start from `ChannelManager.getDefaultHandlers()` (a fresh copy) and enrich it, unless the
45
- * intention really is to route events differently from scratch. Note that the manager the client
46
- * instantiates (`client.channelManager`) is constructed without this option — customize that one
47
- * through `addEventHandler` / `setEventHandlers` / `removeEventHandlers`.
39
+ * The complete set of event handlers, replacing the defaults. Start from
40
+ * `ChannelManager.getDefaultHandlers()` (a copy) and enrich it. `client.channelManager` is built
41
+ * without this option: customize it through `addEventHandler` / `setEventHandlers` /
42
+ * `removeEventHandlers`.
48
43
  */
49
44
  eventHandlers?: ChannelManagerEventHandlers;
50
45
  /**
51
- * Decide which paginator(s) should own a channel when multiple match.
52
- * Defaults to keeping the channel in all matching paginators.
53
- * Channels are kept only in the paginators that are listed in the ownershipResolver array.
54
- * Empty ownershipResolver array means that the channel is kept in all matching paginators.
46
+ * Picks which paginator(s) own a channel that matches several. Defaults to all of them. A function
47
+ * returns the owning paginator IDs; an array is a priority list (highest first), so the
48
+ * highest-priority match owns the channel, and if none of them is listed all keep it.
55
49
  */
56
50
  ownershipResolver?: PaginatorOwnershipResolver | string[];
57
51
  };
58
52
  /**
59
- * A stored channel, the key it is stored under, and what keeps it: its own state (`'watched'`,
60
- * `'active'`, `'querying-channel'`) and the names of its holders. None: a call to
61
- * `releaseUnusedChannels()` would remove it.
53
+ * A stored channel, its store key, and what keeps it: its own state (`'watched'`, `'active'`,
54
+ * `'querying-channel'`) and the names of its holders. If none, `releaseUnusedChannels()` removes
55
+ * it.
62
56
  */
63
57
  export type ChannelUsage = {
64
58
  channel: Channel;
@@ -69,13 +63,11 @@ export declare class ChannelManager extends WithSubscriptions {
69
63
  client: StreamChat;
70
64
  state: StateStore<ChannelManagerState>;
71
65
  /**
72
- * Every `Channel` instance, one per cid. A channel created from members, before the server assigns
73
- * its id, is stored under its temporary cid until {@link ChannelManager.changeChannelId} moves it.
74
- * A channel stays until a known end (deleted, or the current user removed from it) or logout removes
75
- * it, or the app calls {@link ChannelManager.releaseUnusedChannels} while it is disconnected, or
76
- * neither watched nor held; each removes it and runs its {@link Channel.disconnect}. A channel
77
- * list holds the channels it shows by linking them, which also tells it about removals and cid
78
- * changes; other users hold theirs through claims.
66
+ * Every `Channel`, one per cid (a channel created from members sits under a temporary cid until
67
+ * {@link ChannelManager.changeChannelId}). A channel stays until it is deleted, the user is
68
+ * removed from it or logs out, or {@link ChannelManager.releaseUnusedChannels} removes it;
69
+ * removal runs {@link Channel.disconnect}. Lists hold the channels they show by linking them,
70
+ * others by claims.
79
71
  *
80
72
  * @internal
81
73
  */
@@ -83,61 +75,52 @@ export declare class ChannelManager extends WithSubscriptions {
83
75
  protected _pipelines: Map<SupportedEventType, EventHandlerPipeline<ChannelManagerEventHandlerContext>>;
84
76
  protected ownershipResolver?: PaginatorOwnershipResolver;
85
77
  /**
86
- * Instances replaced by a stored one ({@link ChannelManager.supersedeChannel}). Not in the store, so
87
- * they are tracked here to be disconnected ({@link Channel.disconnect}) at logout
88
- * ({@link ChannelManager.clearChannels}). Nothing disconnects them earlier, as the app may still hold
89
- * them.
78
+ * Instances replaced by a stored one ({@link ChannelManager.supersedeChannel}). Not in the store,
79
+ * so they are disconnected at logout ({@link ChannelManager.clearChannels}).
90
80
  */
91
81
  private readonly supersededChannels;
92
82
  /**
93
- * The `filterQueryResults` each registered paginator had before this manager wrapped it.
94
- *
95
- * A server query bypasses the manager — the paginator fetches and ingests a page on its own, and
96
- * the backend knows nothing about client-side ownership — so a "Work" (`{ team: 'work' }`) channel
97
- * comes back in a catch-all list's page too and would render in both. `wrapPaginatorFiltering`
98
- * therefore composes the ownership check onto that hook, which every page passes through.
99
- *
100
- * Keys = already wrapped (so re-inserting does not wrap twice); values = what to restore on
101
- * removal, since a detached paginator must stop applying rules resolved against lists it left.
102
- * Weakly keyed so a dropped paginator is not kept alive by this manager.
83
+ * The `filterQueryResults` each registered paginator had before `wrapPaginatorFiltering` wrapped
84
+ * it. Keys mark paginators already wrapped, values are restored on removal. Weakly keyed.
103
85
  */
104
86
  protected filterQueryResultsBeforeWrapping: WeakMap<ChannelPaginator, (items: Channel[]) => Channel[]>;
105
87
  protected static readonly defaultEventHandlers: ChannelManagerEventHandlers;
106
88
  constructor({ client, eventHandlers, paginators, ownershipResolver, }: ChannelManagerOptions);
107
89
  get paginators(): ChannelPaginator[];
108
- /** The stored channel for `cid`, if any. */
90
+ /**
91
+ * Returns the stored channel for a cid.
92
+ *
93
+ * @param cid - The channel's cid.
94
+ * @returns The stored channel, or `undefined` when none is stored.
95
+ */
109
96
  get(cid: string): Channel | undefined;
110
97
  /**
111
98
  * The instance a channel list should show for `channel`: the one that superseded it, else the one
112
- * stored under its cid, else `channel` itself. A list never puts another instance in place of the
113
- * stored one, which would leave the stored one out of the store, unfinished and without events.
114
- * `undefined` when that instance is disconnected (`pendingDisposal`), stored or not: it receives
115
- * no events, and a list that already shows it drops it at the next `releaseUnusedChannels()`.
99
+ * stored under its cid, else `channel` itself, so a list never displaces the stored instance.
100
+ * `undefined` when that instance is disconnected (`pendingDisposal`): it receives no events.
116
101
  *
117
102
  * @internal
118
103
  */
119
104
  resolveListedChannel(channel: Channel): Channel | undefined;
120
- /** Every stored channel. */
105
+ /**
106
+ * Returns every stored channel.
107
+ *
108
+ * @returns The stored channels.
109
+ */
121
110
  values(): Channel[];
122
111
  /**
123
- * Returns the channel for `type` and `id`, creating it if it isn't stored yet. Use this to get a
124
- * channel instead of calling `new Channel()`; there is one instance per cid. A stored channel
125
- * already disconnected (`pendingDisposal`) is replaced by a fresh one.
112
+ * Returns the channel for `type` and `id`, creating it if it is not stored yet (one instance per
113
+ * cid; a stored `pendingDisposal` channel is replaced by a fresh one). Use it instead of
114
+ * `new Channel()`.
126
115
  *
127
- * Leave out `id` and pass `data.members` for a distinct channel between those members (one channel
128
- * per set of members). It is stored under a temporary cid built from the member IDs until
129
- * `watch()`, `query()` or `create()` returns the real one; a stored distinct channel with the same
130
- * loaded members is returned instead. If another instance holds the real cid by then (its members
131
- * weren't loaded, or an event stored it meanwhile), that instance stays stored and this one is
132
- * left unstored. A group with the same members as another needs its own `id` instead.
116
+ * Leave out `id` and pass `data.members` for a distinct channel between those members. It is
117
+ * stored under a temporary cid until `watch()`, `query()` or `create()` returns the real one; a
118
+ * stored distinct channel with the same loaded members is returned instead. If another instance
119
+ * holds the real cid by then, it stays stored and this one is left unstored. A group with the
120
+ * same members as another needs its own `id`.
133
121
  *
134
122
  * A channel created from members is {@link Channel.isProvisional} until its query is answered: it
135
- * has no id yet, so nothing but that query can be sent for it. A channel with an id is not, even one
136
- * whose id the app generated and the server doesn't have yet: requests for it go to the server.
137
- *
138
- * A channel got this way stays stored until it is deleted, the current user is removed from it, or
139
- * the user logs out. The SDK never releases it on its own; an app freeing memory calls
140
- * {@link ChannelManager.releaseUnusedChannels}, which releases it only while nothing uses it.
123
+ * has no ID yet, so nothing but that query can be sent for it.
141
124
  *
142
125
  * ```ts
143
126
  * const general = client.channelManager.ensure({ type: 'messaging', id: 'general' });
@@ -176,25 +159,15 @@ export declare class ChannelManager extends WithSubscriptions {
176
159
  */
177
160
  changeChannelId(oldCid: string, newCid: string): boolean;
178
161
  /**
179
- * `previous`, created without an id, was answered with a cid `successor` already holds (stored by an
180
- * event or a channel list while `previous` waited). `successor` stays the one instance for the cid
181
- * and takes over, without losing anything of its own:
162
+ * `previous`, created without an ID, was answered with a cid `successor` already holds (stored by
163
+ * an event or a list meanwhile). `successor` stays the one instance and takes over: the response
164
+ * is applied to it like a `queryChannels` result (local messages are never removed),
165
+ * `previous`'s local messages (sending or failed) are added by ID (`successor`'s copy wins), and
166
+ * `previous`'s composer moves over when `previous` is open and `successor` is not.
182
167
  *
183
- * - the server's response, as a `queryChannels` result for a stored channel is applied: its data
184
- * and members, and its messages merged into the loaded ones (a local message, such as a failed
185
- * one, is never removed; an open channel's or a scrolled-back one's window isn't re-seeded);
186
- * - `previous`'s local messages (sending or failed), added by id; a message `successor` already has
187
- * keeps `successor`'s copy;
188
- * - `previous`'s composer, when `previous` is open and `successor` isn't: the user is typing in
189
- * `previous`, and nobody in `successor`. When both are open, neither composer is overwritten.
190
- *
191
- * `successor` is marked watched only when the query asked to watch (`watch: true`): the server then
192
- * watches the cid for this connection. A query without a watch leaves its watch status as it was.
193
- *
194
- * `previous`'s own entry (`storedUnder`, its temporary cid) is dropped first, without disconnecting
195
- * it: its query is still being applied to it and it may be on screen. It is marked superseded
196
- * (`state.supersededBy`) so its holders switch over, and tracked here until logout, so the SDK
197
- * never loses track of it.
168
+ * `successor` is marked watched only when the query asked to watch. `previous` is dropped from
169
+ * the store (`storedUnder`) without disconnecting, as it may be on screen, marked superseded
170
+ * (`state.supersededBy`) so its holders switch over, and disconnected at logout.
198
171
  *
199
172
  * @internal
200
173
  */
@@ -203,42 +176,28 @@ export declare class ChannelManager extends WithSubscriptions {
203
176
  watch?: boolean;
204
177
  }): void;
205
178
  /**
206
- * Removes every stored channel the app disconnected ({@link Channel.disconnect}, so
207
- * `pendingDisposal`), whatever still holds or uses it: disconnecting says the app is done with
208
- * it.
209
- * Every list showing it drops it, as the store's removal reaches each list's index. Objects that
210
- * still refer to the instance keep it, finished.
211
- *
212
- * Then removes, and disconnects, every stored channel that is neither watched nor held. A watched
213
- * channel (`watching`,
214
- * or `wasWatching` until its watch is restored) stays, because its events keep it current; so does
215
- * an active one ({@link Channel.activate}), one being loaded (`watch()`, `query()` or `create()` in flight), and
216
- * one a holder holds in {@link ChannelManager.channelStore}: a channel list links each of its
217
- * channels, while threads, the composer cache and an active channel search hold theirs through
218
- * claims ({@link EntityStore.addClaim}).
219
- *
220
- * What remains is an unwatched snapshot nothing shows, which saves no request: using it again
221
- * needs a query, which stores it again.
222
- *
223
- * The SDK never calls this: it can't see the channels an app keeps in its own state, such as a
224
- * stopped watch kept for re-entry or search results held after the search ended. Call it when the
225
- * app is done with what it held, for example after closing a search screen
226
- * (`searchController.dispose()`, then this). A channel your code still uses but that none of the
227
- * above keeps would be released, so keep it with {@link Channel.activate} first.
179
+ * Removes every stored channel the app disconnected (`pendingDisposal`), whatever holds it, then
180
+ * every one that is neither watched nor held; lists drop them. Kept: watched channels
181
+ * (`watching`, or `wasWatching` until restored), active ones ({@link Channel.activate}), ones
182
+ * being loaded, and ones held in {@link ChannelManager.channelStore} (lists link theirs; threads,
183
+ * the composer cache and channel search hold theirs through claims,
184
+ * {@link EntityStore.addClaim}).
185
+ *
186
+ * The SDK never calls this, as it cannot see channels an app keeps in its own state. Call it when
187
+ * the app is done with them (e.g. after `searchController.dispose()`), and keep a channel your
188
+ * code still uses with {@link Channel.activate} first.
228
189
  */
229
190
  releaseUnusedChannels(): void;
230
191
  /**
231
- * Every stored channel with what keeps it, by the same rule as
232
- * {@link ChannelManager.releaseUnusedChannels}: a channel kept by nothing would be released by a
233
- * call to it. For debugging tools.
192
+ * Every stored channel with what keeps it, by the rule of
193
+ * {@link ChannelManager.releaseUnusedChannels}. For debugging tools.
234
194
  *
235
195
  * @internal
236
196
  */
237
197
  getChannelUsage(): ChannelUsage[];
238
198
  /**
239
199
  * Removes the channel stored under `cid` whatever uses it, and disconnects it
240
- * ({@link Channel.disconnect}).
241
- * Every list showing it drops it too, as the store's removal reaches each list's index.
200
+ * ({@link Channel.disconnect}). Every list showing it drops it too.
242
201
  *
243
202
  * @internal
244
203
  */
@@ -251,172 +210,113 @@ export declare class ChannelManager extends WithSubscriptions {
251
210
  */
252
211
  clearChannels(): void;
253
212
  /**
254
- * Fans the client-owned `mutedChannels` out to every stored channel's reactive `state.muteStatus`.
255
- * Each channel republishes only when its own mute status actually changed, so this stays cheap on
256
- * the frequent `health.check` path.
213
+ * Fans the client-owned `mutedChannels` out to every stored channel's `state.muteStatus` (a
214
+ * channel republishes only when its status changed, as this runs on every `health.check`).
257
215
  *
258
216
  * @internal
259
217
  */
260
218
  reflectMutedChannels(): void;
261
219
  /**
262
- * Resets the AI indicator state to `Idle` on every stored channel. Invoked from `closeConnection`
263
- * as it's a deliberate shutdown and will not natively trigger a WS event.
220
+ * Resets the AI indicator state to `Idle` on every stored channel. Invoked from
221
+ * `closeConnection`, a deliberate shutdown that triggers no WS event.
264
222
  *
265
223
  * @internal
266
224
  */
267
225
  resetAIStateOnChannels(): void;
268
226
  /**
269
- * Demotes every actively-watched channel to `WasWatching`. The server keys watches by connection
270
- * ID, so losing the socket ends every watch this client held — a reconnect issues a NEW id and the
271
- * channels have to be re-queried to watch again. `WasWatching` is what records that they should be.
272
- *
273
- * Only `Watching` is demoted: a channel the consumer stopped on purpose, or one already
274
- * disconnected (`disconnect()`), stays `NotWatching` and must not be resurrected by a reconnect.
275
- *
276
- * Invoked from two places on the WebSocket, because neither covers the other:
277
- * `StableWSConnection._setHealth(false)` for an abnormal close/error, and `closeConnection()` for a
278
- * deliberate shutdown (e.g. mobile backgrounding), whose `disconnect()` writes the status through
279
- * `_applyHealth` and so never reaches `_setHealth`. After an `enableWSFallback` switch the
280
- * long-poll calls it too, from `WSConnectionFallback._setState()` whenever going closed or
281
- * disconnected takes the status offline.
227
+ * Demotes every `Watching` channel to `WasWatching`: the server keys watches by connection ID, so
228
+ * a dropped socket ends them all. Channels stopped on purpose or disconnected stay `NotWatching`.
229
+ * Called when the socket goes unhealthy or offline (`StableWSConnection`, `WSConnectionFallback`)
230
+ * and by `closeConnection()`, whose `disconnect()` writes health through `_applyHealth` and never
231
+ * reaches `_setHealth`.
282
232
  *
283
233
  * @internal
284
234
  */
285
235
  markChannelsWatchInterrupted(): void;
286
236
  get pipelines(): Map<SupportedEventType, EventHandlerPipeline<EventHandlerContext>>;
287
237
  private get ctx();
288
- /**
289
- * Returns deep copy of default handlers mapping.
290
- * The defaults can be enriched with custom handlers or the custom handlers can be replaced.
291
- */
238
+ /** Returns a copy of the default handler mapping, to enrich or replace. */
292
239
  static getDefaultHandlers(): ChannelManagerEventHandlers;
293
240
  /**
294
- * Replace the rule deciding which paginator(s) own a channel matched by several of them. Pass an
295
- * ordered array of paginator ids (highest priority first) for the built-in priority resolver, a
296
- * custom resolver function, or `undefined` to go back to the default (a channel is kept in every
297
- * paginator whose filter it matches).
298
- *
299
- * Available as a setter because the manager is constructed by the client, before the app has had
300
- * a chance to create its paginators — their ids are therefore only known later.
241
+ * Sets the rule deciding which paginator(s) own a channel matched by several. Pass paginator IDs
242
+ * (highest priority first) for the built-in priority resolver, a custom resolver, or `undefined`
243
+ * for the default (every matching paginator keeps the channel). A setter because the client
244
+ * builds the manager before the app creates its paginators.
301
245
  */
302
246
  setOwnershipResolver(ownershipResolver?: PaginatorOwnershipResolver | string[]): void;
303
- /**
304
- * Which paginators should own the channel among the ones that matched.
305
- * Default behavior keeps the channel in all matching paginators.
306
- */
247
+ /** Ids of the paginators that own the channel among the matches. Empty: all of them. */
307
248
  resolveOwnership(channel: Channel, matchingPaginators: ChannelPaginator[]): Set<string>;
308
249
  /**
309
- * Route a channel into the paginator(s) that should own it, and remove it from any list it
310
- * no longer belongs to. Ownership is resolved exactly as for live WS updates — the channel is
311
- * ingested into every paginator whose filter it matches (or, when an ownership resolver picks
312
- * winners among several matches, only into the owner(s)).
313
- *
314
- * Use this to surface a channel the app just opened — a search result, a freshly created DM —
315
- * in the list(s) without a full re-query. `ingestItem` dedupes by cid and inserts in sort
316
- * order, so calling this repeatedly is safe. A channel created from members is ignored until its
317
- * first query gives it an id: ingest it once `watch()` (or `ensureWatched()`) resolves.
318
- *
319
- * A channel that matches no paginator is not added anywhere. To have such channels still
320
- * appear, register a catch-all paginator (empty filter) with the lowest ownership priority as
321
- * a local fallback list.
250
+ * Routes a channel into the paginator(s) that own it and removes it from any list it no longer
251
+ * belongs to, as for live WS updates. Use it to surface a channel the app just opened (a search
252
+ * result, a new DM) without a re-query; repeated calls are safe. A channel created from members
253
+ * is ignored until its first query gives it an ID. A channel matching no paginator is added
254
+ * nowhere: register a catch-all paginator (empty filter) with the lowest ownership priority as a
255
+ * fallback.
322
256
  */
323
257
  ingestChannel(input: Channel): void;
324
258
  /**
325
- * Drops a channel from the lists whose filters it no longer matches, adding it nowhere.
326
- *
327
- * For state the client changes without an event naming the channel — zeroing every unread count on a
328
- * global read. Removal-only: the backend rejects `has_unread: false`, so becoming read can never make
329
- * a channel belong to a list, and `ingestChannel` would pull unloaded channels into matching ones.
259
+ * Drops a channel from the lists whose filters it no longer matches, adding it nowhere. For state
260
+ * the client changes without an event naming the channel (e.g. zeroing every unread count on a
261
+ * global read). Removal-only: becoming read cannot make a channel belong to a list (the backend
262
+ * rejects `has_unread: false`).
330
263
  */
331
264
  dropFromUnmatchedLists(channel: Channel): void;
332
- /**
333
- * Filter a page of query results for a specific paginator according to ownership rules.
334
- * If no owners are specified by the resolver, all matching paginators keep the item.
335
- */
265
+ /** Filters a page of query results for `paginator` by ownership (no owners: all matches keep). */
336
266
  protected filterItemsByOwnership({ paginator, items, }: {
337
267
  paginator: ChannelPaginator;
338
268
  items: Channel[];
339
269
  }): Channel[];
340
270
  /**
341
- * Makes a registered paginator apply this manager's ownership rules to the pages it fetches
342
- * itself, by composing `filterItemsByOwnership` onto its `filterQueryResults`.
343
- *
344
- * A channel can enter a list through two doors, and only one of them goes through the manager:
345
- * - **WS events / `ingestChannel`** — the manager routes the channel and consults
346
- * `resolveOwnership` before ingesting, so exclusivity holds by construction.
347
- * - **A server query** — `paginator.next()` (a `ChannelList` scrolling, `reload()`) queries and
348
- * ingests on its own; the manager is not involved. Without this wrapper a page would land in
349
- * every list whose *server-side* filter matched it, so a channel matching both
350
- * `channels:archived` and `channels:default` would show up in both lists until some later event
351
- * re-routed it — the exact duplication the resolver exists to prevent.
352
- *
353
- * Wrapping (rather than subclassing or a constructor hook) is what lets the manager inject this
354
- * into paginators it does not construct: `filterQueryResults` is an instance property, so the
355
- * original is captured here and handed back by `unwrapPaginatorFiltering` when the paginator is
356
- * detached. The paginator's own filtering runs first and stays authoritative — ownership only ever
357
- * removes further items, never adds any back.
358
- *
359
- * Idempotent: the `WeakMap` guard keeps a re-inserted paginator from being wrapped twice, which
360
- * would filter the same page repeatedly and, worse, lose the reference to the true original.
271
+ * Makes a registered paginator apply the ownership rules to the pages it fetches itself (server
272
+ * queries bypass the manager), by composing `filterItemsByOwnership` onto its
273
+ * `filterQueryResults`. Its own filtering runs first. Idempotent: wrapping twice would lose the
274
+ * true original.
361
275
  */
362
276
  protected wrapPaginatorFiltering(paginator: ChannelPaginator): void;
363
277
  /**
364
- * Undo `wrapPaginatorFiltering` — restore the `filterQueryResults` the paginator had before this
365
- * manager wrapped it. A paginator that has left the manager must not keep applying its ownership
366
- * rules: those are resolved against the paginators the manager still holds, so a detached
367
- * paginator would drop channels owned by lists it is no longer part of.
278
+ * Restores the `filterQueryResults` the paginator had before `wrapPaginatorFiltering`: a detached
279
+ * paginator must not keep applying ownership rules resolved against lists it left.
368
280
  */
369
281
  protected unwrapPaginatorFiltering(paginator: ChannelPaginator): void;
370
282
  getPaginatorById(id: string): ChannelPaginator | undefined;
371
283
  /**
372
- * Replace the whole set of lists in a single state update — the primitive `insertPaginator` and
373
- * `removePaginator` build on, and what to use for a wholesale swap instead of publishing an
374
- * intermediate state per step. Paginators dropped from the set are detached exactly as
375
- * `removePaginator` detaches them; a repeated id keeps only its first occurrence.
284
+ * Replaces the whole set of lists in one state update (the primitive `insertPaginator` and
285
+ * `removePaginator` build on). Dropped paginators are detached as `removePaginator` does; a
286
+ * repeated ID keeps only its first occurrence.
376
287
  *
377
288
  * @param paginators - The lists this manager should hold, in render order.
378
289
  */
379
290
  setPaginators(paginators: ChannelPaginator[]): void;
380
291
  /**
381
- * Detach every list at once — the teardown counterpart of `setPaginators`. Each paginator is
382
- * released exactly as `removePaginator` releases it (ownership-filtering wrapper removed,
383
- * scheduled query canceled, loaded items kept), in a single state update.
292
+ * Detaches every list as `removePaginator` does, in one update.
384
293
  *
385
294
  * @returns The paginators the manager held, in the order it held them.
386
295
  */
387
296
  clearPaginators(): ChannelPaginator[];
388
297
  /**
389
- * If paginator already exists → remove old, reinsert at new index.
390
- * If index not provided → append at the end.
391
- * If index provided → insert (or move) at that index.
298
+ * Inserts a paginator. One already held with the same ID is removed first, so this moves it, or
299
+ * replaces it when it is another instance.
392
300
  *
393
- * @param params - The insertion parameters.
394
301
  * @param params.paginator - The paginator to insert or move.
395
- * @param params.index - Target index; when omitted the paginator is appended.
302
+ * @param params.index - Target index, clamped to the list. Defaults to appending.
396
303
  */
397
304
  insertPaginator({ paginator, index }: {
398
305
  paginator: ChannelPaginator;
399
306
  index?: number;
400
307
  }): void;
401
308
  /**
402
- * Remove a paginator from the manager. The paginator stops receiving WS-driven updates and
403
- * disappears from `state.paginators` (so UIs rendering one list per paginator drop its list), and
404
- * gets its own `filterQueryResults` back — from here on it is an independent paginator again.
405
- *
406
- * Its loaded items are left untouched: the paginator can be re-inserted later, or kept and
407
- * queried on its own. Any query scheduled through `nextDebounced` is canceled, so a list that was
408
- * just removed does not fire one more request.
309
+ * Removes a paginator: it leaves `state.paginators`, stops receiving WS-driven updates and gets
310
+ * its own `filterQueryResults` back. Its loaded items stay, and a query scheduled through
311
+ * `nextDebounced` is cancelled.
409
312
  *
410
- * @param paginatorOrId - The paginator to remove, or its id.
313
+ * @param paginatorOrId - The paginator to remove, or its ID.
411
314
  * @returns The removed paginator, or `undefined` when this manager did not hold it.
412
315
  */
413
316
  removePaginator(paginatorOrId: ChannelPaginator | string): ChannelPaginator | undefined;
414
317
  /**
415
- * Discard the loaded data of every registered list, keeping the registrations themselves: which
416
- * lists exist is application configuration, while the channels in them belong to the connected
417
- * user and become invalid on `disconnectUser`. Each paginator returns to "never queried"
418
- * (`items: undefined`) with its debounced query canceled. Deliberately not named `resetState` —
419
- * this manager's own `state` *is* the paginator list, which this must not touch.
318
+ * Discards the loaded data of every registered list but keeps the registrations: each paginator
319
+ * returns to "never queried" (`items: undefined`) with its debounced query cancelled.
420
320
  */
421
321
  resetPaginatorStates(): void;
422
322
  addEventHandler({ eventType, ...payload }: {
@@ -430,31 +330,18 @@ export declare class ChannelManager extends WithSubscriptions {
430
330
  eventType: SupportedEventType;
431
331
  handlers: FindEventHandlerParams<EventHandlerContext>[];
432
332
  }): void;
433
- /** Subscribe to WS (and more buses via attachBus) */
333
+ /** Subscribes to client events. The returned function releases this registration. */
434
334
  registerSubscriptions(): Unsubscribe;
435
335
  ensurePipeline(eventType: SupportedEventType): EventHandlerPipeline<EventHandlerContext>;
436
336
  reload: () => Promise<PromiseSettledResult<void>[]>;
437
337
  /**
438
- * Re-run every loaded list's own first-page query — the channel-list half of connection recovery,
439
- * driven by {@link ConnectionRecoveryManager}.
440
- *
441
- * Each list re-asserts its *own* `filters` / `sort` / `pageSize` rather than some substitute query,
442
- * and because `client.queryChannels` watches by default, that page's channels are re-watched as a
443
- * side effect. Channels below the first page are deliberately not touched — see
444
- * `restoreInterruptedWatch` for how they come back.
445
- *
446
- * `{ keepPreviousItems: true, reset: 'yes' }` is the non-destructive refresh: `reset` restarts the
447
- * window at page 1, while `keepPreviousItems` merges the fetched page into the loaded list instead
448
- * of replacing it and keeps the item index populated — the latter is what stops a concurrent
449
- * offline-replay ingest from rebuilding the list out of a cleared index. Notably NOT `silent`: the
450
- * `isLoading` transition it would suppress is the in-flight guard that keeps a second overlapping
451
- * query from being issued.
452
- *
453
- * Distinct from {@link ChannelManager.reload}, which is a destructive `reset` that blanks each list
454
- * to its loading state.
455
- *
456
- * Paginators that were never queried are skipped: they run their own first query when they mount,
457
- * and querying them here would race it.
338
+ * Re-runs every loaded list's own first-page query, the channel-list half of connection recovery
339
+ * ({@link ConnectionRecoveryManager}). The page's channels are re-watched (`queryChannels`
340
+ * watches by default), those below it come back through `restoreInterruptedWatch`.
341
+ * Never-queried paginators are skipped: they run their own first query on mount, and querying them
342
+ * here would race it. Unlike {@link ChannelManager.reload}, it merges the page into the loaded
343
+ * list (`keepPreviousItems`) instead of blanking it, and is not `silent`: the `isLoading`
344
+ * transition guards against an overlapping query.
458
345
  */
459
346
  recover: () => Promise<PromiseSettledResult<void>[]>;
460
347
  }
@@ -3,22 +3,13 @@ import type { TimestampNS } from './types';
3
3
  import { WithSubscriptions } from './utils/WithSubscriptions';
4
4
  import type { Channel } from './channel';
5
5
  export type CooldownTimerState = {
6
- /**
7
- * Slow mode cooldown interval in seconds. Change reported via channel.updated WS event.
8
- */
6
+ /** Slow mode cooldown interval in seconds. Change reported via channel.updated WS event. */
9
7
  cooldownConfigSeconds: number;
10
- /**
11
- * Whether the current user can skip slow mode. Change is not reported via WS.
12
- */
8
+ /** Whether the current user can skip slow mode. Change is not reported via WS. */
13
9
  canSkipCooldown: boolean;
14
- /**
15
- * Creation timestamp of the latest message authored by the current user in this channel, in unix
16
- * nanoseconds as the API sends it. Change reported via message.new WS event.
17
- */
10
+ /** Creation time of the current user's latest message in this channel, in unix nanoseconds. */
18
11
  ownLatestMessageTimestamp?: TimestampNS;
19
- /**
20
- * Remaining cooldown in whole seconds (rounded).
21
- */
12
+ /** Remaining cooldown in whole seconds (rounded). */
22
13
  cooldownRemaining: number;
23
14
  };
24
15
  export declare class CooldownTimer extends WithSubscriptions {
@@ -33,22 +24,16 @@ export declare class CooldownTimer extends WithSubscriptions {
33
24
  get canSkipCooldown(): boolean;
34
25
  get ownLatestMessageTimestamp(): TimestampNS | undefined;
35
26
  /**
36
- * Subscribes the timer to the two stores it derives from — `channel.state` for `cooldown` and
37
- * `ownCapabilities`, the message paginator's store for the current user's latest message.
38
- *
39
- * `Channel` calls this right after constructing the timer and unregisters it in `disconnect`, the same
40
- * way it drives `messageReceiptsTracker`. That replaces four imperative `cooldownTimer.refresh()` calls
41
- * in `Channel`, and the three WS-event handlers that used to live here — which duplicated those calls
42
- * and never ran, because nothing registered them. Between them the two arrangements still missed every
43
- * `query()`, and any `updatePartial` that changed `cooldown` without changing capabilities.
27
+ * Derives the timer from `channel.state` (`cooldown`, `ownCapabilities`) and the message
28
+ * paginator's store (the current user's latest message). `Channel` registers it on construction
29
+ * and unregisters it in `disconnect`.
44
30
  */
45
31
  registerSubscriptions: () => void;
46
32
  setCooldownRemaining: (cooldownRemaining: number) => void;
47
33
  clearTimeout: () => void;
48
34
  refresh: () => void;
49
35
  /**
50
- * Updates the known latest own message timestamp and recomputes remaining time.
51
- * Prefer calling this when you already know it (e.g. from an event).
36
+ * Sets the own latest message timestamp and recomputes the remaining time.
52
37
  *
53
38
  * @param timestamp - Unix nanoseconds, as the API sends it.
54
39
  */