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
@@ -18,26 +18,17 @@ export type MessageFocusSignalState = {
18
18
  };
19
19
  export type JumpToMessageOptions = {
20
20
  pageSize?: number;
21
- /**
22
- * Optional reason attached to emitted focus signal.
23
- * Defaults to `jump-to-message`.
24
- */
21
+ /** Reason attached to the emitted focus signal. Defaults to `jump-to-message`. */
25
22
  focusReason?: MessageFocusReason;
26
- /**
27
- * TTL for the emitted focus signal in milliseconds.
28
- * Defaults to `3000`.
29
- */
23
+ /** TTL of the emitted focus signal in milliseconds. Defaults to `3000`. */
30
24
  focusSignalTtlMs?: number;
31
- /**
32
- * If true, suppresses focus signal emission after a successful jump.
33
- */
25
+ /** Suppresses the focus signal after a successful jump. */
34
26
  suppressFocusSignal?: boolean;
35
27
  /**
36
- * Also watch the channel, so it receives its events, when it isn't watched yet: the request that
37
- * loads the window around the message asks to watch too, so it takes one request. A message
38
- * already loaded is then loaded again with that request. Ignored for a thread's reply list, which
39
- * loads replies through a request that can't watch, and when the paginator's `doRequest` loads
40
- * the messages.
28
+ * Also watches the channel (so it receives events) when it is not watched yet. The request that
29
+ * loads the window around the message asks to watch too, so it stays one request, and a message
30
+ * already loaded is loaded again. Ignored for a thread's reply list (its request cannot watch)
31
+ * and when the paginator's `doRequest` loads the messages.
41
32
  */
42
33
  watchChannel?: boolean;
43
34
  };
@@ -48,107 +39,76 @@ export type MessagePaginatorFilter = {
48
39
  };
49
40
  export type MessagePaginatorState = PaginatorState<LocalMessage>;
50
41
  export type MessageQueryShape = MessagePaginationParams | PinnedMessagePaginationOptions;
51
- /**
52
- * A message's `created_at` as the comparable wire timestamp (unix nanoseconds), or `null` when it
53
- * is absent or not a finite number.
54
- *
55
- * Accepts `null`/`undefined` so callers holding an optional message (e.g.
56
- * `MessagePaginator.lastMessage`) do not each repeat the guard.
57
- */
42
+ /** A message's `created_at` (unix nanoseconds), or `null` when absent or not finite. */
58
43
  export declare const getMessageCreatedAtTimestamp: (message: LocalMessage | null | undefined) => TimestampNS | null;
59
44
  export type MessagePaginatorOptions = {
60
45
  channel: Channel;
61
46
  id?: string;
62
47
  itemIndex?: ItemIndexApi<LocalMessage>;
63
48
  parentMessageId?: string;
64
- /**
65
- * Sort passed to backend message/replies query.
66
- * Does not affect in-memory item ordering.
67
- */
49
+ /** Sort sent to the backend messages/replies query. Does not affect in-memory ordering. */
68
50
  requestSort?: MessagePaginatorSort;
69
51
  /**
70
52
  * @deprecated Use `requestSort` instead.
71
53
  */
72
54
  sort?: MessagePaginatorSort;
73
- /**
74
- * In-memory ordering for items exposed by paginator state.
75
- */
55
+ /** In-memory ordering of the items exposed by paginator state. */
76
56
  itemOrder?: MessagePaginatorSort;
77
57
  paginatorOptions?: PaginatorOptions<LocalMessage, MessageQueryShape>;
78
58
  };
79
59
  /**
80
- * Options for {@link MessageIntervalPaginator.mergeNewestPage} that enable destructive
81
- * reconciliation — removing messages that were hard-deleted (by anyone) while the client was
82
- * offline. A hard delete emits no event to other clients, and the merge is otherwise additive, so
83
- * without this such a message lingers as a ghost after reconnect.
84
- *
85
- * Throughout, `page` is the newest window the server returned for `mergeNewestPage`, and "`page`'s
86
- * newest / oldest message" are its bounds by `created_at`. With NO options, `mergeNewestPage` prunes
87
- * any loaded message that falls WITHIN `page`'s `created_at` span but is absent from it —
88
- * unconditionally safe (a message that arrived live during the caller's fetch is always strictly
89
- * newer than `page`'s newest message, so it can never fall in that span). `candidateIds` widens the
90
- * reconcilable window at the TOP edge; `requestedLimit` only tunes the `hasMoreTail` affordance and
91
- * can never remove a message:
60
+ * Options for {@link MessageIntervalPaginator.mergeNewestPage} that enable reconciling messages
61
+ * hard-deleted while the client was offline (no event reaches other clients). With no options it
62
+ * prunes loaded messages inside `page`'s `created_at` span that are absent from it, which is always
63
+ * safe: a live arrival is newer than `page`'s newest message. `candidateIds` widens reconciliation
64
+ * at the top edge; `requestedLimit` tunes `hasMoreTail` and gates the below-window probe.
92
65
  */
93
66
  export type MergeNewestPageOptions = {
94
67
  /**
95
- * The `limit` the caller passed to the query that produced `page`. Used ONLY to derive
96
- * `hasMoreTail` — whether `page` reached the channel's own oldest message — by comparing it to
97
- * `page.length`. It NEVER removes a message (reconciliation stays window-only regardless), so the
98
- * worst a wrong value can do is show/hide the "load older" affordance for one settle. Trusted only
99
- * when no larger than the paginator's own `pageSize` (see
100
- * {@link MessageIntervalPaginator.pageReachedChannelStart}); a larger over-request — e.g.
101
- * `channel.reload` re-fetching the whole loaded window to reconcile as much as possible — may have
102
- * been silently server-capped, so its short page is ignored rather than mistaken for reaching the
103
- * start.
68
+ * The `limit` of the query that produced `page`. Derives `hasMoreTail` and, when not smaller than
69
+ * the loaded count, enables the below-window reached-start probe. Trusted for `hasMoreTail` only
70
+ * when not larger than the paginator's `pageSize` (see
71
+ * {@link MessageIntervalPaginator.pageReachedChannelStart}): a larger over-request (e.g.
72
+ * `channel.reload`) may have been server-capped.
104
73
  */
105
74
  requestedLimit?: number;
106
75
  /**
107
- * A snapshot of the loaded message ids taken BEFORE the caller's fetch await. Required to prune
108
- * messages NEWER than `page`'s newest message (a hard-deleted newest message) and to reconcile an
109
- * empty `page` (a fully-emptied channel): at/above that top edge a just-deleted message and a
110
- * message that arrived live during the fetch are indistinguishable by timestamp — only the pre-fetch
111
- * snapshot separates them (a live arrival is not in it). Must be captured before the await; the
112
- * paginator's own items at merge time already include any live arrival.
76
+ * Loaded message IDs snapshotted before the caller's fetch await. Needed to prune a hard-deleted
77
+ * message newer than `page`'s newest and to reconcile an empty `page`: at or above that edge only
78
+ * the pre-fetch snapshot tells a just-deleted message from one that arrived live during the fetch.
113
79
  */
114
80
  candidateIds?: ReadonlySet<string>;
115
81
  };
116
- /**
117
- * Options for {@link MessageIntervalPaginator.seedFirstPageSync}, the synchronous channel-open seed.
118
- */
82
+ /** Options for {@link MessageIntervalPaginator.seedFirstPageSync}, the channel-open seed. */
119
83
  export type SeedFirstPageOptions = {
120
84
  /**
121
- * When true and the paginator has already been seeded once, fold the fresh page via
122
- * {@link MessageIntervalPaginator.mergeNewestPage} — merge in place, reconcile offline hard-deletes,
123
- * re-derive the tail cursor, rebuild on a disjoint window, and skip when jumped away from the head —
124
- * instead of a plain first-page ingest. Lets callers (channel.reload, the channel-list hydrate,
125
- * connection recovery) share one reconciling seed path. Left false for the differently-sorted
126
- * pinned list, and a no-op on a cold open (nothing loaded to fold).
85
+ * When true and the paginator was already seeded, folds the page in via
86
+ * {@link MessageIntervalPaginator.mergeNewestPage} instead of a plain first-page ingest, so
87
+ * `channel.reload`, the channel-list hydrate and connection recovery share one reconciling path.
88
+ * Leave false for the pinned list (different sort). No-op on a cold open.
127
89
  */
128
90
  reconcile?: boolean;
129
91
  /**
130
- * Pre-fetch snapshot of loaded message ids (captured before the caller's network await), forwarded
131
- * to {@link MergeNewestPageOptions.candidateIds} so a hard-deleted NEWEST message is reconciled
132
- * without mistaking a message that arrived live during the fetch for a delete. Only consulted when
133
- * {@link reconcile} is set and a window is already loaded.
92
+ * Message IDs snapshotted before the caller's network await, forwarded to
93
+ * {@link MergeNewestPageOptions.candidateIds}. Only used when {@link reconcile} is set.
134
94
  */
135
95
  candidateIds?: ReadonlySet<string>;
136
96
  };
137
97
  /**
138
- * MessageIntervalPaginator allows configuring backend request sort, while keeping internal item ordering stable.
139
- * Filtering of ingested items is still limited to local predicates (`filterQueryResults`).
98
+ * A message list with a configurable backend request sort and a stable in-memory item order.
99
+ * Ingested items are filtered only by local predicates (`filterQueryResults`).
140
100
  */
141
101
  export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage, MessageQueryShape> {
142
102
  /**
143
- * The name this list's index goes by as a holder in the message store. A prototype getter, so it
144
- * is already the subclass's while the base constructor builds the index.
103
+ * Holder name of this list's index in the message store. A getter, so a subclass's value is in
104
+ * place while the base constructor builds the index.
145
105
  */
146
106
  protected get holderName(): string;
147
107
  state: StateStore<MessagePaginatorState>;
148
108
  private readonly _id;
149
109
  /** The channel this list belongs to. A thread's reply list holds its parent channel. */
150
110
  readonly channel: Channel;
151
- /** Set when this is a thread's reply list, to the parent message's id. */
111
+ /** Set when this is a thread's reply list, to the parent message's ID. */
152
112
  readonly parentMessageId?: string;
153
113
  readonly messageFocusSignal: StateStore<MessageFocusSignalState>;
154
114
  private clearMessageFocusSignalTimeoutId;
@@ -156,91 +116,70 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
156
116
  protected _requestSort: MessagePaginatorSort;
157
117
  protected _itemOrder: MessagePaginatorSort;
158
118
  protected _nextQueryShape: MessageQueryShape | undefined;
159
- /** Pending below-window reached-start probe (exposed for deterministic test awaiting). */
119
+ /** Pending below-window reached-start probe (exposed so tests can await it). */
160
120
  private _belowWindowReconcile?;
161
121
  sortComparator: (a: LocalMessage, b: LocalMessage) => number;
162
122
  /**
163
- * Single source of truth for whether a message should be included in paginator intervals/state.
164
- * Keep this consistent with `filterQueryResults` AND cursor flag derivation.
123
+ * Whether a message belongs in intervals and state. Keep it consistent with `filterQueryResults`
124
+ * and cursor flag derivation.
165
125
  */
166
126
  shouldIncludeMessageInInterval(message: LocalMessage): boolean;
167
127
  /**
168
- * Entity-store adapter (this paginator is an `EntityStoreSubscriber`): the `EntityStore` calls this
169
- * on each holder with the subset of its watched ids that changed. Unwraps the batch and delegates to
170
- * the base's store-agnostic {@link BasePaginator.reconcileChangedIds}. Lives here, not on the generic
171
- * `BasePaginator`, so the base stays free of `EntityStore` types — only message paginators are
172
- * store-backed.
128
+ * Reconciles the held messages that changed in the entity store.
129
+ *
130
+ * @internal
131
+ * @param batch - The change batch from the store.
132
+ * @param batch.changedIds - IDs of the watched messages that changed.
173
133
  */
174
134
  onEntitiesChanged({ changedIds }: EntityStoreChangeBatch): void;
175
135
  /**
176
- * Entity-store subscriber: the store removed a message this paginator holds, so it drops it from
177
- * its windows.
136
+ * Drops a message from this paginator's windows after the entity store removed it.
137
+ *
138
+ * @internal
139
+ * @param id - ID of the removed message.
140
+ * @param message - The removed message.
178
141
  */
179
142
  onEntityRemoved(id: string, message: unknown): void;
180
- /**
181
- * Entity-store subscriber flush (the optional `EntityStoreSubscriber.flushState`): the `EntityStore`
182
- * calls this after an optimistic (local-user) write so the change renders without throttle delay.
183
- * Delegates to the base's generic {@link BasePaginator.flushPendingPublishes}.
184
- */
143
+ /** Entity-store subscriber flush after an optimistic (local-user) write: skips the throttle. */
185
144
  flushState(): void;
186
- /**
187
- * UI-driven "hold off on pruning" signal, set via {@link setPruningSuspended}. Defaults to not
188
- * suspended, so a paginator with no UI attached still honours its configured cap.
189
- */
145
+ /** UI-driven "hold off on pruning" signal ({@link setPruningSuspended}). Off by default. */
190
146
  protected get isPruningSuspended(): boolean;
191
147
  private _pruningSuspended;
192
148
  /**
193
- * Tells the paginator to hold off on dropping the oldest loaded messages. The SDK calls this from
194
- * its viewability tracking: while the user is reading near the oldest loaded message, pruning there
195
- * would pull content out from under them, so the window is allowed to grow past its cap until they
196
- * scroll back. Only meaningful alongside `maxLoadedItems`.
197
- *
198
- * Deliberately a plain field rather than a `StateStore` — nothing observes it, and a scroll-driven
199
- * signal must not be able to cost a render.
149
+ * Holds off dropping the oldest loaded messages, so pruning does not pull content from under a user
150
+ * reading near them: the window may grow past `maxLoadedItems` until they scroll back. A plain
151
+ * field, not a `StateStore`: nothing observes it and a scroll-driven signal must not cost a render.
200
152
  */
201
153
  setPruningSuspended: (suspended: boolean) => void;
202
154
  /**
203
- * A message can anchor pagination once the server has acknowledged it. Narrowing this is what keeps
204
- * an unsent message out of both halves of a prune: it is skipped rather than dropped, and it can
205
- * never become the window's tailward cursor (its id would go out as `id_lt` and mean nothing to the
206
- * server).
155
+ * A message anchors pagination once the server has acknowledged it. This keeps an unsent message
156
+ * out of both halves of a prune and stops its ID from becoming the tailward cursor (`id_lt`).
207
157
  */
208
158
  protected isPaginationAnchorable(item: LocalMessage | undefined): boolean;
209
159
  protected get intervalItemIdsAreHeadFirst(): boolean;
210
160
  protected get intervalSortDirection(): 'asc' | 'desc';
211
161
  constructor({ channel, id, itemIndex, parentMessageId, requestSort, sort, itemOrder, paginatorOptions, }: MessagePaginatorOptions, builtInDefaults?: Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>);
212
162
  /**
213
- * Memoized so every derivation sees the *same* two functions. `initializeConfig` folds this into the
214
- * config it publishes and skips the publish when nothing moved — which only works if these references
215
- * are stable.
216
- *
217
- * Safe to build once: both close over `this` and read `_itemOrder`, which is assigned in the
218
- * constructor and has no setter.
163
+ * Memoized: `initializeConfig` folds it in and skips the publish when nothing moved, which needs
164
+ * stable references. Safe to build once: `_itemOrder` is set in the constructor, with no setter.
219
165
  */
220
166
  private intervalBehaviour?;
221
167
  private buildIntervalBehaviour;
222
168
  /**
223
- * Cursor derivation and in-memory item ordering, which this class installs on `config` rather than
224
- * passing as constructor options.
225
- *
226
- * Contributed to the base derivation rather than written after it — see
227
- * {@link BasePaginator.getBehaviourOverrides}. That is what keeps one re-derivation to one publish,
228
- * and stops the intermediate publish that had these two stripped.
169
+ * Installs cursor derivation and item ordering on `config` through the base derivation
170
+ * ({@link BasePaginator.getBehaviourOverrides}), so one re-derivation is one publish.
229
171
  */
230
172
  protected getBehaviourOverrides(): Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>;
231
173
  /**
232
- * The constructor's route to the same overlay. Deliberately calls the private builder rather than the
233
- * overridable hook: this runs inside the constructor, and a subclass override would execute before its
234
- * own fields were initialized.
174
+ * The constructor's route to the same overlay. It calls the private builder, not the overridable
175
+ * hook, which would run a subclass override before its fields are initialized.
235
176
  */
236
177
  protected installIntervalBehaviour(): void;
237
178
  get id(): string;
238
179
  get sort(): MessagePaginatorSort;
239
180
  get requestSort(): MessagePaginatorSort;
240
181
  get itemOrder(): MessagePaginatorSort;
241
- /**
242
- * Even though we do not send filters object to the server, we need to have filters for client-side item ingestion logic.
243
- */
182
+ /** Not sent to the server: drives client-side item ingestion. */
244
183
  buildMatchFilters: () => MessagePaginatorFilter;
245
184
  protected getNextQueryShape({ direction, }: Omit<PaginationQueryParams<MessageQueryShape>, 'isFirstPageQuery'>): MessageQueryShape;
246
185
  getCursorFromQueryResults: ({ direction, items, }: {
@@ -256,169 +195,88 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
256
195
  */
257
196
  query: ({ direction, requestOptions, }: PaginationQueryParams<MessageQueryShape>) => Promise<PaginationQueryReturnValue<LocalMessage>>;
258
197
  /**
259
- * Seed the paginator with the page a channel-open query just fetched (`Channel.query` for
260
- * `watch`/`create`, and `client.hydrateChannels`).
261
- *
262
- * These paths hydrate the channel read state in the SAME synchronous tick they add messages
263
- * (`Channel._initializeState`), and the read patch drives `MessageReceiptsTracker`, which resolves
264
- * read/delivered cursors against this paginator (`findItemByTimestamp`) whenever the server omits
265
- * the `last_read_message_id` / `last_delivered_message_id`. `postQueryReconcile` is fully
266
- * synchronous (filtering is a local predicate), so seeding here guarantees the paginator is
267
- * populated before the reconcile runs. First-page reconciliation also takes the unread snapshot.
198
+ * Seeds the paginator with the page a channel-open query just fetched (`Channel.query` with
199
+ * `watch`/`create`, `client.hydrateChannels`). Those paths hydrate the read state in the same
200
+ * synchronous tick (`Channel._initializeState`), and the read patch drives
201
+ * `MessageReceiptsTracker`, which resolves cursors against this paginator
202
+ * (`findItemByTimestamp`) when the server omits the message IDs, so the paginator must be
203
+ * populated first. First-page reconciliation also takes the unread snapshot.
268
204
  *
269
- * The fetched page is NOT always the latest window: a channel can be opened AROUND a message
270
- * (`messages: { id_around }` / `{ created_at_around }`), so the original pagination options are
271
- * threaded through as the query shape. For an around/jump open this lets `postQueryReconcile`
272
- * apply jump semantics (no forced head/tail; cursor flags derived from the around position)
273
- * instead of wrongly flagging the window as the head (newest) page.
205
+ * The page is not always the latest window: a channel can open around a message (`id_around` /
206
+ * `created_at_around`), so the original pagination options are passed as the query shape and
207
+ * `postQueryReconcile` applies jump semantics instead of flagging the window as the newest page.
274
208
  */
275
209
  seedFirstPageSync(messages: LocalMessage[], requestedPageSize: number, messagePaginationOptions?: MessagePaginationParams, options?: SeedFirstPageOptions): void;
276
210
  isJumpQueryShape(queryShape: MessageQueryShape): boolean;
211
+ /** A jump sends its own `limit`: head/tail flags are derived against it, not `pageSize`. */
212
+ protected getRequestedPageSize(queryShape: MessageQueryShape | undefined): number;
277
213
  jumpToMessage: (messageId: string, { focusReason, focusSignalTtlMs, pageSize, suppressFocusSignal, watchChannel, }?: JumpToMessageOptions) => Promise<boolean>;
278
214
  jumpToTheLatestMessage: (options?: JumpToMessageOptions) => Promise<boolean>;
279
215
  /**
280
- * Fold an already fetched newest (head) page into the currently loaded items without issuing a
281
- * query. The caller supplies a page it obtained on its own and this reconciles it against what is
282
- * loaded, instead of rerunning the first page query, so the loaded set is updated in place rather
283
- * than blanked and reloaded. Two cases, decided by whether the incoming page overlaps the loaded
284
- * head:
216
+ * Folds an already fetched newest (head) page into the loaded items without a query. A page that
217
+ * shares an ID with the loaded head merges in place (reconciling by ID, appending new items,
218
+ * keeping older pages), sets the tail boundary via {@link pageReachedChannelStart} and runs
219
+ * {@link reconcileHeadAgainstPage}. A disjoint page would weld the two across a gap, so the
220
+ * loaded set is rebuilt from it as a fresh head (`hasMoreTail: true`) and the gap loads when
221
+ * paginating older.
285
222
  *
286
- * 1. OVERLAP - the incoming page shares at least one id with the loaded head (fewer than a full
287
- * page is new). Merge in place: existing items are reconciled by id (edits, soft deletes), new
288
- * items are appended and every already loaded item (including older pages already paged in) is
289
- * kept. The tail boundary (`hasMoreTail`/`cursor.tailward`) is set from whether the page reached
290
- * the channel start ({@link pageReachedChannelStart}): a bounded page that came back short means
291
- * no more older, otherwise "load older" stays enabled and the cursor re-anchors to the true loaded
292
- * oldest (which also clears a stale offline-DB cursor). Then destructive reconciliation
293
- * ({@link reconcileHeadAgainstPage}) removes any loaded message
294
- * that the authoritative page proves was hard-deleted while offline (see that method + the
295
- * {@link MergeNewestPageOptions} for the exact, safe window).
223
+ * Merges only when the head interval is loaded and in view (or only live content is loaded,
224
+ * which the page then anchors). When the caller jumped to an older window only offline
225
+ * hard-deletes are pruned from the hidden head. An empty page never wipes the list, except that
226
+ * with `options.candidateIds` it reads as "the channel has no messages". The query shape is
227
+ * recorded on every exit (see `recordLoadedWindowQueryShape`).
296
228
  *
297
- * 2. DISJOINT - the incoming page shares no id with the loaded head (at least a full page is new).
298
- * Merging would weld the two across the gap (the interval merge treats two head intervals as
299
- * overlapping when one reaches further headward), hiding the items in between with no way to
300
- * reach them. Instead the loaded set is discarded and rebuilt from the incoming page as a fresh
301
- * contiguous head (`hasMoreTail: true`, cursor reanchored to the page's oldest item) so the
302
- * gap and older history load again when paginating older. No separate reconciliation is needed:
303
- * the rebuilt window IS the server truth, so any hard-deleted message is simply absent from it.
304
- *
305
- * Never blanks the loaded set. Noop unless the newest slice is both loaded AND the interval
306
- * currently in view (the head interval is anchored at the head and active); when the caller has
307
- * jumped to a separate older window the merge is skipped so their position is preserved, and the
308
- * incoming page is picked up on a later load. An empty page never wipes the list on its own, but
309
- * — given a pre-fetch snapshot via `options.candidateIds` — is reconciled as "the channel has no
310
- * messages" (every server-confirmed loaded message removed).
311
- *
312
- * @param page - The fetched newest window (may be empty). `created_at` order is normalized on ingest.
313
- * @param options - See {@link MergeNewestPageOptions}. Omit to prune only within the page's own span.
314
- */
315
- /**
316
- * Merges a freshly fetched newest page into the loaded window (the hydrate path). Wraps the
317
- * implementation so the query shape is recorded on EVERY exit — the body returns early in
318
- * several places, and a window left without a shape loses itself on the next pagination (see
319
- * `recordLoadedWindowQueryShape`).
229
+ * @param page - The fetched newest window (may be empty). Ingest normalizes `created_at` order.
230
+ * @param options - See {@link MergeNewestPageOptions}. Omit to prune only within the page's own
231
+ * span.
320
232
  */
321
233
  mergeNewestPage: (page: LocalMessage[], options?: MergeNewestPageOptions) => void;
322
234
  private _mergeNewestPage;
323
235
  /**
324
- * Whether `page` proves it reached the channel's own oldest message: the caller's request was
325
- * bounded by this paginator's OWN `pageSize` AND `page` came back shorter than that request.
326
- *
327
- * `pageSize <= the server's max page size` is already the invariant normal pagination
328
- * (`executeQuery`) relies on — `page.length < pageSize` ⟹ reached the end — so a request no larger
329
- * than `pageSize` returns exactly what was asked unless the channel ended. This needs no hardcoded
330
- * max page size and is per-paginator, so a thread reply paginator uses its own `pageSize`.
331
- *
332
- * An OVER-request (larger than `pageSize`, e.g. `channel.reload` re-fetching the whole loaded window
333
- * to reconcile as much as possible) may have been silently capped by the server, so a short page
334
- * there is NOT proof of reaching the start — return `false` and stay conservative. This only ever
335
- * gates the `hasMoreTail` affordance; it never removes a message.
236
+ * Whether `page` proves it reached the channel's oldest message: the request was bounded by this
237
+ * paginator's own `pageSize` (so a short page means the end). A larger over-request (e.g.
238
+ * `channel.reload`) may have been server-capped and never proves it. Only gates `hasMoreTail`.
336
239
  */
337
240
  private pageReachedChannelStart;
338
241
  /**
339
- * Settle the below-window leftovers {@link reconcileHeadAgainstPage} handed back (loaded messages
340
- * older than `anchorId` — the returned page's oldest — and absent from the page). From the page alone
341
- * they're ambiguous: a hard-deleted oldest vs a server-capped over-request. Ask the server "anything
342
- * older than `anchorId`?" — the only cap-free way to tell. Nothing older ⇒ genuine deletes ⇒ remove
343
- * them and settle the tail. A probe failure or a head change across the await keeps them (never a false
344
- * delete). The caller decides WHEN this runs.
242
+ * Settles the below-window leftovers {@link reconcileHeadAgainstPage} returned (loaded messages
243
+ * older than `anchorId`, the page's oldest, and absent from it): from the page alone a
244
+ * hard-deleted oldest looks like a server-capped over-request. It asks the server whether anything
245
+ * is older than `anchorId`; if not, they are real deletes and are removed and the tail settled. A
246
+ * probe failure or a head change across the await keeps them. The caller decides when this runs.
345
247
  */
346
248
  private pruneBelowWindowIfReachedStart;
347
249
  /** One `limit: 1` fetch of messages older than `id` (channel main list or thread replies). */
348
250
  private hasMessagesOlderThan;
349
251
  /**
350
- * Whether a loaded message is server-confirmed and therefore eligible to be reconciled away when
351
- * absent from an authoritative page. Excludes local-only messages the server has never
352
- * acknowledged — optimistic (`sending`) and `failed` sends, and client-side `error` placeholders —
353
- * so a legitimately-unsent message is never mistaken for a hard delete.
252
+ * Whether a loaded message is server-confirmed, so it may be reconciled away when absent from an
253
+ * authoritative page. Optimistic (`sending`), `failed` and client-side `error` messages are not, so
254
+ * an unsent message is never mistaken for a hard delete.
354
255
  */
355
256
  protected isServerConfirmedMessage(message: LocalMessage): boolean;
356
257
  /**
357
- * Destructive half of {@link mergeNewestPage}: remove messages in the loaded head interval that
358
- * `page` proves were hard-deleted while offline (a hard delete emits no event to other clients, and
359
- * the merge is additive, so they would otherwise linger forever).
360
- *
361
- * Here `page` is the freshly-fetched newest window the server returned for the query that produced
362
- * it. Its two bounds are its NEWEST message (`page`'s last item by `created_at`) and its OLDEST
363
- * message (`page`'s first item). Reconciliation removes ONLY messages `page` actually covers — no
364
- * hardcoded page size is involved — in two regions, by a loaded message's `created_at`:
365
- *
366
- * - WITHIN `page` (strictly between `page`'s oldest and newest message): a server-confirmed loaded
367
- * message absent from `page` was hard-deleted. Safe with no snapshot — a message that arrived live
368
- * during the caller's fetch is always strictly newer than `page`'s newest message, so it can never
369
- * fall in this span.
370
- * - AT/ABOVE `page`'s newest message (a hard-deleted newest message), and the empty-`page` case:
371
- * only reconcilable with a pre-fetch `candidateIds` snapshot, which alone tells a just-deleted
372
- * message from one that arrived live during the fetch at that top edge.
258
+ * Destructive half of {@link mergeNewestPage}: removes loaded head-interval messages that `page`
259
+ * (the fresh newest window) proves were hard-deleted while offline, by `created_at`:
373
260
  *
374
- * A loaded message BELOW `page`'s oldest is NOT removed here (window-only) — from the page alone a
375
- * hard-deleted oldest is indistinguishable from a server-capped over-request. Those messages are
376
- * instead RETURNED (the below-window leftovers) so {@link pruneBelowWindowIfReachedStart} can settle
377
- * them with a `limit: 1` "anything older?" probe — the only cap-free proof — and remove them only if
378
- * the server confirms nothing older exists. Absent that proof they are kept (a later cold/fresh query
379
- * omits any real delete).
261
+ * - within `page`'s span: a server-confirmed message absent from `page` was deleted (a live
262
+ * arrival is newer than `page`'s newest, so this needs no snapshot);
263
+ * - at or above `page`'s newest, and for an empty `page`: only IDs in the pre-fetch `candidateIds`
264
+ * snapshot, which tells a just-deleted message from a live arrival.
380
265
  *
381
- * Removal goes through {@link removeItem} (batched) so the item index, intervals, shared message
382
- * store and — via the {@link MessagePaginator} override — the tracked last message all stay correct;
383
- * the active window is then re-emitted once.
266
+ * Messages below `page`'s oldest are kept (a hard-deleted oldest looks like a server-capped
267
+ * over-request) and returned for {@link pruneBelowWindowIfReachedStart}. Removal goes through
268
+ * {@link removeItem}, so the index, intervals, message store and any subclass bookkeeping (e.g.
269
+ * an overridden `removeItem`) stay correct.
384
270
  *
385
- * @returns the below-window leftover ids (loaded, server-confirmed, older than `page`'s oldest, absent
386
- * from it) for the caller's reached-start probe. Empty for the no-head / empty-page paths.
271
+ * @returns The below-window leftover IDs. Empty for the no-head and empty-page paths.
387
272
  */
388
273
  protected reconcileHeadAgainstPage(page: LocalMessage[], options?: MergeNewestPageOptions): string[];
389
- /**
390
- * Remove a set of reconciled (hard-deleted) ids from this paginator's loaded state in one coalesced
391
- * batch. Each id goes through {@link removeItem}, which drops it from THREE places — not a single
392
- * interval:
393
- *
394
- * 1. the item index — unlinks this paginator's membership from the shared entity store (GC'ing the
395
- * content if this was the last holder);
396
- * 2. the interval that holds it — located by id, so it is NOT head-specific in general; in practice
397
- * it is always the head interval, because the sole caller ({@link reconcileHeadAgainstPage})
398
- * sources these ids from `headInterval.itemIds` and an item has single-interval membership;
399
- * 3. the active window (`state.items`) if visible — blanking to `[]` when the window empties, per
400
- * {@link flushWindowPublish}.
401
- *
402
- * The coalesced batch collapses all of that into a single `state.items` publish. Then mirror the
403
- * removal into the offline DB (see {@link purgeReconciledFromOfflineDb}) so a cold start does not
404
- * re-seed the ghosts from SQLite. No-op for an empty set, so an unaffected merge does not touch
405
- * state a second time.
406
- */
274
+ /** Removes reconciled IDs in one coalesced batch (one publish), then mirrors it offline. */
407
275
  private removeReconciledItems;
408
276
  /**
409
- * Mirror a destructive reconciliation into the offline DB. A hard delete performed while the client
410
- * was offline reaches it via no event, so the offline store never ran its own hard-delete for these
411
- * ids; the reconnect query re-hydrates the DB by UPSERT (which never removes what is absent from the
412
- * page), so without this the ghosts survive in SQLite and a cold start would re-seed them after the
413
- * in-memory list already dropped them.
414
- *
415
- * Owned by the state layer, NOT the SDK: the SDK only supplies the platform `offlineDb`
416
- * implementation and never orchestrates DB writes for reconciliation. Fire-and-forget and
417
- * best-effort — the in-memory removal is the source of truth for the live list, so a failed/absent
418
- * DB write is no worse than before (the ghost merely re-appears on a cold start until the next
419
- * reconcile). No-op when offline support is off (`client.offlineDb` undefined). The ids are already
420
- * server-confirmed (the reconcile excludes pending/failed/optimistic), so a plain hard delete —
421
- * without the pending-task teardown of a local failed message — is correct.
277
+ * Mirrors a reconciliation into the offline DB: a hard delete done while offline reaches it via no
278
+ * event and the reconnect query upserts (never removing absent rows), so a cold start would re-seed
279
+ * the ghosts. Fire-and-forget, no-op without offline support.
422
280
  */
423
281
  private purgeReconciledFromOfflineDb;
424
282
  protected resolveUnreadBoundaryIdsByTimestamp: ({ lastReadAt, messages, }: {
@@ -434,10 +292,9 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
434
292
  ttlMs?: number;
435
293
  }) => MessageFocusSignal;
436
294
  /**
437
- * Starts the auto-dismissal countdown for the currently active focus signal. Call this once the
438
- * focused message has been viewed (rendered and visible), so the highlight's lifetime is measured
439
- * from when the user could actually see it rather than from when the jump resolved. No-op if the
440
- * signal has already been cleared or superseded (guarded by `token`).
295
+ * Starts the auto-dismiss countdown for the active focus signal. Call it once the focused message
296
+ * is viewed, so the highlight lasts from when the user could see it. No-op if the signal was
297
+ * cleared or superseded (guarded by `token`).
441
298
  */
442
299
  scheduleMessageFocusSignalClear: ({ token, ttlMs, }?: {
443
300
  token?: number;
@@ -448,50 +305,34 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
448
305
  }) => void;
449
306
  clearStateAndCache(): void;
450
307
  /**
451
- * Partial truncation for `channel.truncated` carrying a `truncated_at`: drop every loaded
452
- * message strictly older than the cutoff (keeping newer ones) across all loaded windows,
453
- * mirroring the legacy per-message-set pruning. For a full truncation (no `truncated_at`) use
454
- * {@link MessageIntervalPaginator.clearStateAndCache} instead.
455
- *
456
- * Batched and edge-classified: because messages are chronological, each interval is classified by
457
- * its `tail` (oldest) and `head` (newest) edges, so only the single interval that *straddles* the
458
- * cutoff is scanned member-by-member — the rest are kept or dropped wholesale. The straddling
459
- * interval becomes the new global tail (nothing older than the cutoff exists anymore), so its
460
- * `isTail`/`hasMoreTail` are set; intervals entirely newer keep their flags (unloaded older
461
- * messages may still sit between them and the cutoff). The active window is re-emitted once.
308
+ * Partial truncation for `channel.truncated` with a `truncated_at`: drops every loaded message
309
+ * strictly older than the cutoff across all windows (a full truncation uses
310
+ * {@link MessageIntervalPaginator.clearStateAndCache}). Only the interval straddling the cutoff is
311
+ * scanned member by member and becomes the new global tail; intervals entirely newer keep their
312
+ * flags, since unloaded older messages may sit between them and the cutoff. The active window is
313
+ * re-emitted once.
462
314
  */
463
- truncate: ({ truncatedAt }: {
315
+ truncate({ truncatedAt }: {
464
316
  truncatedAt: TimestampNS;
465
- }) => void;
317
+ }): void;
466
318
  applyMessageDeletionForUser: ({ userId, hardDelete, deletedAt, }: {
467
319
  userId: string;
468
320
  hardDelete?: boolean;
469
321
  deletedAt: TimestampNS;
470
322
  }) => void;
471
- /**
472
- * Ensures quoted-message snapshots across loaded paginator cache are in sync
473
- * with the provided message.
474
- *
475
- * Scans cached messages and updates any item where `quoted_message_id`
476
- * matches `message.id`.
477
- */
323
+ /** Updates the quoted-message snapshot of every cached message that quotes `message`. */
478
324
  reflectQuotedMessageUpdate: (message: LocalMessage) => void;
479
325
  /**
480
- * Reflect an updated `user` object onto every cached message authored by that user, mirroring
481
- * the legacy `ChannelState.updateUserMessages` for the main message list (does not touch
482
- * `quoted_message.user` — that is not part of the legacy behavior).
483
- *
484
- * Batched: a user rename can affect many messages, so this patches the shared item index and
485
- * re-emits the active window a single time (if it held an affected message) rather than one
486
- * `ingestItem` re-emit per message.
326
+ * Reflects an updated `user` onto every cached message authored by that user (not
327
+ * `quoted_message.user`). Patches the shared item index in one batch and re-emits the active
328
+ * window once, if it held an affected message.
487
329
  */
488
- reflectUserUpdate: (user: UserResponse) => void;
330
+ reflectUserUpdate(user: UserResponse): void;
489
331
  /**
490
- * Map a timestamp to a loaded message — the first message in the latest (head) window whose
491
- * `created_at` is >= `timestamp` (mirrors the legacy `ChannelState.findMessageByTimestamp`
492
- * lower-bound search), or the newest loaded message when the timestamp is beyond it. Used by the
493
- * receipts tracker to resolve read/delivered cursors. Searches the newest loaded window — where
494
- * read cursors live — which is already sorted, so this is O(log n) with no re-sort.
332
+ * The last loaded message created at or before `timestamp` (a floor), or `null` when it precedes
333
+ * every loaded message. With `exactTsMatch`, only a message created exactly at `timestamp` matches.
334
+ * Searches the newest loaded window (already sorted) in O(log n). Used by the receipts tracker to
335
+ * resolve read/delivered cursors.
495
336
  */
496
337
  findItemByTimestamp: (timestamp: TimestampNS, exactTsMatch?: boolean) => LocalMessage | null;
497
338
  filterQueryResults: (items: LocalMessage[]) => LocalMessage[];