stream-chat 10.0.0-rc.8 → 10.0.0

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 (366) hide show
  1. package/README.md +7 -6
  2. package/dist/cjs/index.browser.js +22095 -22290
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +22143 -22298
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +22093 -22288
  7. package/dist/esm/index.mjs.map +4 -4
  8. package/dist/types/ChannelManager.d.ts +216 -135
  9. package/dist/types/CooldownTimer.d.ts +16 -27
  10. package/dist/types/EventHandlerPipeline.d.ts +18 -38
  11. package/dist/types/LiveLocationManager.d.ts +25 -47
  12. package/dist/types/api-client.d.ts +17 -5
  13. package/dist/types/channel.d.ts +435 -500
  14. package/dist/types/channel_state.d.ts +72 -112
  15. package/dist/types/client.d.ts +323 -440
  16. package/dist/types/client_state.d.ts +1 -3
  17. package/dist/types/configuration/ConfigController.d.ts +31 -125
  18. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +32 -124
  19. package/dist/types/configuration/keys.d.ts +5 -19
  20. package/dist/types/configuration/shape.d.ts +12 -29
  21. package/dist/types/configuration/types.d.ts +64 -79
  22. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +14 -36
  23. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  24. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  25. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  26. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  27. package/dist/types/connection/ConnectionIdManager.d.ts +45 -0
  28. package/dist/types/connection/ConnectionRecoveryManager.d.ts +84 -0
  29. package/dist/types/connection/index.d.ts +4 -0
  30. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +82 -0
  31. package/dist/types/connection/networkConnection/index.d.ts +3 -0
  32. package/dist/types/connection/networkConnection/reporters.d.ts +20 -0
  33. package/dist/types/connection/networkConnection/types.d.ts +40 -0
  34. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +137 -0
  35. package/dist/types/connection/wsConnection/WSConnection.d.ts +105 -0
  36. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +47 -0
  37. package/dist/types/connection/wsConnection/config.d.ts +31 -0
  38. package/dist/types/connection/wsConnection/index.d.ts +4 -0
  39. package/dist/types/connection/wsConnection/types.d.ts +46 -0
  40. package/dist/types/constants.d.ts +3 -1
  41. package/dist/types/custom_types.d.ts +0 -2
  42. package/dist/types/entityStore/EntityStore.d.ts +226 -65
  43. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +19 -33
  44. package/dist/types/entityStore/index.d.ts +0 -1
  45. package/dist/types/errors.d.ts +16 -19
  46. package/dist/types/formatMessageMemo.d.ts +5 -0
  47. package/dist/types/gen/chat/ChannelApi.d.ts +5 -1
  48. package/dist/types/gen/chat/ChatApi.d.ts +149 -105
  49. package/dist/types/gen/models/index.d.ts +2540 -698
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +37 -14
  52. package/dist/types/index.d.ts +10 -5
  53. package/dist/types/{i18n/languageNames.d.ts → languageNames.d.ts} +9 -24
  54. package/dist/types/logger.d.ts +1 -3
  55. package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
  56. package/dist/types/messageComposer/LocationComposer.d.ts +8 -2
  57. package/dist/types/messageComposer/attachmentIdentity.d.ts +24 -0
  58. package/dist/types/messageComposer/attachmentManager.d.ts +52 -24
  59. package/dist/types/messageComposer/attachmentUtils.d.ts +23 -0
  60. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  61. package/dist/types/messageComposer/configuration/types.d.ts +38 -50
  62. package/dist/types/messageComposer/index.d.ts +1 -0
  63. package/dist/types/messageComposer/linkPreviewsManager.d.ts +12 -9
  64. package/dist/types/messageComposer/messageComposer.d.ts +60 -123
  65. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +10 -1
  66. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +4 -0
  67. package/dist/types/messageComposer/middleware/messageComposer/commandInjection.d.ts +5 -0
  68. package/dist/types/messageComposer/middleware/messageComposer/index.d.ts +2 -0
  69. package/dist/types/messageComposer/middleware/messageComposer/pollOnly.d.ts +6 -0
  70. package/dist/types/messageComposer/middleware/messageComposer/userDataInjection.d.ts +5 -0
  71. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  72. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  73. package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +4 -0
  74. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +11 -2
  75. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +20 -19
  76. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  77. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  78. package/dist/types/messageComposer/pollComposer.d.ts +15 -5
  79. package/dist/types/messageComposer/textComposer.d.ts +14 -7
  80. package/dist/types/messageComposer/types.d.ts +27 -7
  81. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +27 -80
  82. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +43 -73
  83. package/dist/types/messageOperations/FailedSendCache.d.ts +29 -0
  84. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +16 -22
  85. package/dist/types/messageOperations/MessageOperations.d.ts +63 -34
  86. package/dist/types/messageOperations/applyReactionLocally.d.ts +15 -0
  87. package/dist/types/messageOperations/createMessageOperations.d.ts +9 -0
  88. package/dist/types/messageOperations/index.d.ts +6 -4
  89. package/dist/types/messageOperations/reflectReactionEvent.d.ts +16 -0
  90. package/dist/types/messageOperations/sendOrdering.d.ts +14 -0
  91. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +20 -0
  92. package/dist/types/messageOperations/types.d.ts +43 -14
  93. package/dist/types/middleware.d.ts +10 -0
  94. package/dist/types/moderation.d.ts +21 -14
  95. package/dist/types/notifications/NotificationManager.d.ts +10 -23
  96. package/dist/types/notifications/types.d.ts +21 -57
  97. package/dist/types/offline-support/offline_support_api.d.ts +150 -528
  98. package/dist/types/offline-support/offline_sync_manager.d.ts +21 -42
  99. package/dist/types/offline-support/queueableOperations.d.ts +35 -37
  100. package/dist/types/offline-support/types.d.ts +40 -185
  101. package/dist/types/pagination/FilterBuilder.d.ts +1 -18
  102. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  103. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  104. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +4 -5
  105. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +19 -5
  106. package/dist/types/pagination/index.d.ts +1 -0
  107. package/dist/types/pagination/paginators/BasePaginator.d.ts +604 -550
  108. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +123 -106
  109. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +576 -327
  110. package/dist/types/pagination/paginators/MessagePaginator.d.ts +237 -131
  111. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +15 -26
  112. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +4 -3
  113. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +44 -0
  114. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +5 -8
  115. package/dist/types/pagination/paginators/index.d.ts +1 -0
  116. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  117. package/dist/types/pagination/utility.normalization.d.ts +8 -13
  118. package/dist/types/pagination/utility.search.d.ts +3 -8
  119. package/dist/types/poll.d.ts +35 -8
  120. package/dist/types/poll_manager.d.ts +12 -2
  121. package/dist/types/poll_optimistic_votes.d.ts +57 -0
  122. package/dist/types/reminders/Reminder.d.ts +17 -7
  123. package/dist/types/reminders/ReminderManager.d.ts +13 -25
  124. package/dist/types/search/BaseSearchSource.d.ts +10 -8
  125. package/dist/types/search/ChannelSearchSource.d.ts +16 -0
  126. package/dist/types/search/MessageSearchSource.d.ts +17 -0
  127. package/dist/types/search/SearchController.d.ts +26 -28
  128. package/dist/types/search/types.d.ts +6 -10
  129. package/dist/types/signing.d.ts +12 -3
  130. package/dist/types/thread.d.ts +67 -129
  131. package/dist/types/thread_manager.d.ts +95 -66
  132. package/dist/types/token_manager.d.ts +8 -13
  133. package/dist/types/types.d.ts +81 -197
  134. package/dist/types/types.utility.d.ts +3 -3
  135. package/dist/types/upload-utils.d.ts +5 -10
  136. package/dist/types/uploadManager.d.ts +31 -11
  137. package/dist/types/utils/FixedSizeQueueCache.d.ts +8 -11
  138. package/dist/types/utils/WithSubscriptions.d.ts +6 -16
  139. package/dist/types/utils/abort.d.ts +17 -0
  140. package/dist/types/utils/concurrency.d.ts +12 -20
  141. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  142. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  143. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  144. package/dist/types/utils/objectPath.d.ts +6 -41
  145. package/dist/types/utils/retryable.d.ts +8 -12
  146. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  147. package/dist/types/utils/time.d.ts +45 -0
  148. package/dist/types/utils.d.ts +74 -93
  149. package/package.json +14 -40
  150. package/src/ChannelManager.ts +494 -303
  151. package/src/CooldownTimer.ts +46 -59
  152. package/src/EventHandlerPipeline.ts +22 -45
  153. package/src/LiveLocationManager.ts +99 -91
  154. package/src/api-client.ts +113 -50
  155. package/src/campaign.ts +1 -1
  156. package/src/channel.ts +1098 -1351
  157. package/src/channel_batch_updater.ts +1 -1
  158. package/src/channel_state.ts +81 -174
  159. package/src/client.ts +755 -970
  160. package/src/client_state.ts +3 -8
  161. package/src/configuration/ConfigController.ts +42 -158
  162. package/src/configuration/InstanceConfigurationRegistry.ts +43 -172
  163. package/src/configuration/index.ts +1 -1
  164. package/src/configuration/keys.ts +13 -32
  165. package/src/configuration/shape.ts +169 -59
  166. package/src/configuration/types.ts +69 -92
  167. package/src/configuration/utils/applyInstanceConfiguration.ts +22 -54
  168. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  169. package/src/configuration/utils/declarativeSlices.ts +9 -39
  170. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  171. package/src/configuration/utils/index.ts +2 -4
  172. package/src/configuration/utils/serverAuthority.ts +20 -68
  173. package/src/connection/ConnectionIdManager.ts +111 -0
  174. package/src/connection/ConnectionRecoveryManager.ts +257 -0
  175. package/src/connection/index.ts +4 -0
  176. package/src/connection/networkConnection/NetworkConnectionObserver.ts +204 -0
  177. package/src/connection/networkConnection/index.ts +3 -0
  178. package/src/connection/networkConnection/reporters.ts +58 -0
  179. package/src/connection/networkConnection/types.ts +45 -0
  180. package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +230 -231
  181. package/src/connection/wsConnection/WSConnection.ts +270 -0
  182. package/src/connection/wsConnection/WSConnectionFallback.ts +250 -0
  183. package/src/connection/wsConnection/config.ts +73 -0
  184. package/src/connection/wsConnection/index.ts +4 -0
  185. package/src/connection/wsConnection/types.ts +48 -0
  186. package/src/constants.ts +7 -5
  187. package/src/custom_types.ts +0 -1
  188. package/src/entityStore/EntityStore.ts +415 -79
  189. package/src/entityStore/StoreBackedItemIndex.ts +37 -41
  190. package/src/entityStore/index.ts +0 -1
  191. package/src/errors.ts +39 -20
  192. package/src/formatMessageMemo.ts +17 -0
  193. package/src/gen/chat/ChannelApi.ts +122 -36
  194. package/src/gen/chat/ChatApi.ts +578 -1752
  195. package/src/gen/models/index.ts +2566 -3440
  196. package/src/gen/models/timestamp-guard.ts +27 -0
  197. package/src/gen/moderation/ModerationApi.ts +183 -406
  198. package/src/index.ts +32 -10
  199. package/src/languageNames.ts +88 -0
  200. package/src/logger.ts +1 -3
  201. package/src/messageComposer/CustomDataManager.ts +19 -6
  202. package/src/messageComposer/LocationComposer.ts +49 -9
  203. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  204. package/src/messageComposer/attachmentIdentity.ts +54 -0
  205. package/src/messageComposer/attachmentManager.ts +170 -185
  206. package/src/messageComposer/attachmentUtils.ts +44 -0
  207. package/src/messageComposer/configuration/configuration.ts +15 -8
  208. package/src/messageComposer/configuration/types.ts +38 -50
  209. package/src/messageComposer/fileUtils.ts +1 -1
  210. package/src/messageComposer/index.ts +1 -0
  211. package/src/messageComposer/linkPreviewsManager.ts +18 -21
  212. package/src/messageComposer/messageComposer.ts +234 -179
  213. package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
  214. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +46 -33
  215. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +4 -1
  216. package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +1 -1
  217. package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +6 -0
  218. package/src/messageComposer/middleware/messageComposer/attachments.ts +76 -5
  219. package/src/messageComposer/middleware/messageComposer/commandInjection.ts +10 -4
  220. package/src/messageComposer/middleware/messageComposer/customData.ts +17 -5
  221. package/src/messageComposer/middleware/messageComposer/index.ts +2 -0
  222. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +22 -12
  223. package/src/messageComposer/middleware/messageComposer/pollOnly.ts +9 -1
  224. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
  225. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  226. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +12 -12
  227. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  228. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  229. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  230. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +8 -6
  231. package/src/messageComposer/middleware/textComposer/commandUtils.ts +10 -3
  232. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  233. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  234. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  235. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  236. package/src/messageComposer/pollComposer.ts +21 -9
  237. package/src/messageComposer/textComposer.ts +37 -57
  238. package/src/messageComposer/types.ts +39 -11
  239. package/src/messageDelivery/MessageDeliveryReporter.ts +86 -124
  240. package/src/messageDelivery/MessageReceiptsTracker.ts +122 -139
  241. package/src/messageOperations/FailedSendCache.ts +85 -0
  242. package/src/messageOperations/MessageOperationStatePolicy.ts +124 -116
  243. package/src/messageOperations/MessageOperations.ts +297 -175
  244. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +13 -25
  245. package/src/messageOperations/createMessageOperations.ts +176 -0
  246. package/src/messageOperations/index.ts +6 -14
  247. package/src/messageOperations/reflectReactionEvent.ts +43 -0
  248. package/src/messageOperations/sendOrdering.ts +25 -0
  249. package/src/messageOperations/settlePendingAttachmentUploads.ts +98 -0
  250. package/src/messageOperations/types.ts +51 -13
  251. package/src/middleware.ts +13 -5
  252. package/src/moderation.ts +25 -21
  253. package/src/notifications/NotificationManager.ts +19 -28
  254. package/src/notifications/types.ts +21 -57
  255. package/src/offline-support/offline_support_api.ts +231 -681
  256. package/src/offline-support/offline_sync_manager.ts +51 -90
  257. package/src/offline-support/queueableOperations.ts +98 -73
  258. package/src/offline-support/types.ts +43 -185
  259. package/src/pagination/FilterBuilder.ts +1 -22
  260. package/src/pagination/ItemIndex.ts +4 -12
  261. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  262. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +17 -62
  263. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  264. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +53 -33
  265. package/src/pagination/filterCompiler.ts +11 -25
  266. package/src/pagination/index.ts +1 -0
  267. package/src/pagination/paginators/BasePaginator.ts +1415 -1041
  268. package/src/pagination/paginators/ChannelPaginator.ts +481 -219
  269. package/src/pagination/paginators/MessageIntervalPaginator.ts +1362 -775
  270. package/src/pagination/paginators/MessagePaginator.ts +521 -240
  271. package/src/pagination/paginators/PinnedMessagePaginator.ts +32 -40
  272. package/src/pagination/paginators/ReminderPaginator.ts +21 -16
  273. package/src/pagination/paginators/ThreadPaginator.ts +170 -0
  274. package/src/pagination/paginators/UserGroupPaginator.ts +18 -15
  275. package/src/pagination/paginators/index.ts +1 -0
  276. package/src/pagination/paginators/stateThrottling.ts +5 -10
  277. package/src/pagination/sortCompiler.ts +23 -50
  278. package/src/pagination/utility.normalization.ts +17 -24
  279. package/src/pagination/utility.search.ts +4 -11
  280. package/src/poll.ts +183 -102
  281. package/src/poll_manager.ts +24 -22
  282. package/src/poll_optimistic_votes.ts +335 -0
  283. package/src/reminders/Reminder.ts +33 -16
  284. package/src/reminders/ReminderManager.ts +23 -56
  285. package/src/reminders/ReminderTimer.ts +6 -6
  286. package/src/search/BaseSearchSource.ts +19 -25
  287. package/src/search/ChannelSearchSource.ts +43 -1
  288. package/src/search/MessageSearchSource.ts +77 -13
  289. package/src/search/SearchController.ts +39 -36
  290. package/src/search/types.ts +6 -10
  291. package/src/segment.ts +1 -1
  292. package/src/signing.ts +23 -3
  293. package/src/thread.ts +430 -712
  294. package/src/thread_manager.ts +300 -234
  295. package/src/token_manager.ts +12 -22
  296. package/src/types.ts +102 -214
  297. package/src/types.utility.ts +3 -3
  298. package/src/upload-utils.ts +5 -10
  299. package/src/uploadManager.ts +64 -18
  300. package/src/utils/FixedSizeQueueCache.ts +18 -21
  301. package/src/utils/WithSubscriptions.ts +6 -16
  302. package/src/utils/abort.ts +45 -0
  303. package/src/utils/concurrency.ts +16 -55
  304. package/src/utils/mergeWith/mergeWith.ts +10 -13
  305. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  306. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  307. package/src/utils/objectPath.ts +6 -41
  308. package/src/utils/retryable.ts +10 -14
  309. package/src/utils/throttling/throttle.ts +9 -25
  310. package/src/utils/time.ts +64 -0
  311. package/src/utils.ts +227 -174
  312. package/codegen/i18n/callSites.ts +0 -126
  313. package/codegen/i18n/generate.ts +0 -226
  314. package/codegen/i18n/guards.ts +0 -178
  315. package/codegen/i18n/index.ts +0 -29
  316. package/codegen/i18n/stringMaps.ts +0 -91
  317. package/codegen/i18n/types.ts +0 -100
  318. package/dist/cjs/i18n.browser.js +0 -1131
  319. package/dist/cjs/i18n.browser.js.map +0 -7
  320. package/dist/cjs/i18n.node.js +0 -1160
  321. package/dist/cjs/i18n.node.js.map +0 -7
  322. package/dist/esm/i18n-codegen.mjs +0 -409
  323. package/dist/esm/i18n-codegen.mjs.map +0 -7
  324. package/dist/esm/i18n.mjs +0 -1098
  325. package/dist/esm/i18n.mjs.map +0 -7
  326. package/dist/types/ConnectionRecoveryManager.d.ts +0 -156
  327. package/dist/types/connection.d.ts +0 -139
  328. package/dist/types/entityStore/applyReactionLocally.d.ts +0 -26
  329. package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
  330. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
  331. package/dist/types/i18n/Streami18n.d.ts +0 -168
  332. package/dist/types/i18n/TranslationBuilder.d.ts +0 -70
  333. package/dist/types/i18n/TranslationStore.d.ts +0 -57
  334. package/dist/types/i18n/dayjs.d.ts +0 -104
  335. package/dist/types/i18n/formatters.d.ts +0 -91
  336. package/dist/types/i18n/index.d.ts +0 -15
  337. package/dist/types/i18n/translator.d.ts +0 -29
  338. package/dist/types/i18n/types.d.ts +0 -262
  339. package/dist/types/i18n-codegen/callSites.d.ts +0 -10
  340. package/dist/types/i18n-codegen/generate.d.ts +0 -15
  341. package/dist/types/i18n-codegen/guards.d.ts +0 -61
  342. package/dist/types/i18n-codegen/index.d.ts +0 -29
  343. package/dist/types/i18n-codegen/stringMaps.d.ts +0 -14
  344. package/dist/types/i18n-codegen/types.d.ts +0 -94
  345. package/dist/types/insights.d.ts +0 -56
  346. package/dist/types/messageOperations/optimistic.d.ts +0 -118
  347. package/dist/types/messageOperations/persistence.d.ts +0 -21
  348. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  349. package/dist/types/store.d.ts +0 -125
  350. package/src/ConnectionRecoveryManager.ts +0 -293
  351. package/src/gen/model-decoders/decoders.ts +0 -2710
  352. package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
  353. package/src/i18n/Streami18n.ts +0 -520
  354. package/src/i18n/TranslationBuilder.ts +0 -176
  355. package/src/i18n/TranslationStore.ts +0 -96
  356. package/src/i18n/dayjs.ts +0 -228
  357. package/src/i18n/formatters.ts +0 -461
  358. package/src/i18n/index.ts +0 -15
  359. package/src/i18n/languageNames.ts +0 -103
  360. package/src/i18n/translator.ts +0 -76
  361. package/src/i18n/types.ts +0 -375
  362. package/src/insights.ts +0 -82
  363. package/src/messageOperations/optimistic.ts +0 -249
  364. package/src/messageOperations/persistence.ts +0 -40
  365. package/src/pagination/utility.queryChannel.ts +0 -84
  366. package/src/store.ts +0 -304
@@ -1,207 +1,313 @@
1
- import type { BasePaginatorConfig, ExecuteQueryReturnValue, Interval, PostQueryReconcileParams } from './BasePaginator';
2
- import { type MessagePaginatorOptions as BaseMessagePaginatorOptions, type JumpToMessageOptions, MessageIntervalPaginator, type MessageQueryShape } from './MessageIntervalPaginator';
3
- import type { LocalMessage } from '../../types';
4
- import { StateStore } from '../../store';
5
- export type { JumpToMessageOptions, MergeNewestPageOptions, MessageFocusReason, MessageFocusSignal, MessageFocusSignalState, MessagePaginatorFilter, MessagePaginatorSort, MessagePaginatorState, MessageQueryShape, SeedFirstPageOptions, } from './MessageIntervalPaginator';
1
+ import type { BasePaginatorConfig, Interval, QueryPagePlacement } from './BasePaginator';
2
+ import { type MessagePaginatorOptions as BaseMessagePaginatorOptions, type JumpToMessageOptions, MessageIntervalPaginator, type MessageQueryResponse, type MessageQueryShape } from './MessageIntervalPaginator';
3
+ import type { LocalMessage, TimestampNS, UserResponse } from '../../types';
4
+ import type { EntityStoreChangeBatch } from '../../entityStore/EntityStore';
5
+ import { StateStore } from '@stream-io/state-store';
6
+ export type { JumpToMessageOptions, MessageFocusReason, MessageFocusSignal, MessageFocusSignalState, MessagePaginatorFilter, MessagePaginatorSort, MessagePaginatorState, MessageQueryShape, PreparedExternalQuery, ReconcileNewestMessagesOptions, } from './MessageIntervalPaginator';
6
7
  export { MessageIntervalPaginator } from './MessageIntervalPaginator';
7
8
  /**
8
- * Auxiliary (non-pagination) state for the message paginator: whole-collection aggregates that are
9
- * independent of the active pagination window (the dual of pagination — values over the entire set,
10
- * not a page of it). `lastMessageAt` is effectively `MAX(created_at)` over the channel-relevant
11
- * messages and is the source of truth for channel-list ordering
12
- * (`channel.messagePaginator.lastMessageAt`): seeded from `ChannelResponse.last_message_at`, then
13
- * advanced monotonically as newer messages are ingested.
9
+ * Whole-collection aggregates, independent of the active pagination interval. `latestMessageAt` is
10
+ * the time of the channel's latest message and orders the channel list
11
+ * (`channel.messagePaginator.latestMessageAt`): the later of
12
+ * {@link MessagePaginatorAggregateState.latestMessage}'s `created_at` and the `last_message_at` of
13
+ * the latest channel or thread response.
14
14
  */
15
15
  export type MessagePaginatorAggregateState = {
16
16
  /**
17
- * The newest channel-relevant message, for display (e.g. a channel/thread list item's last-message
18
- * preview or latest-reply avatar). A LIVE reference: it advances to a strictly newer message, is
19
- * refreshed in place when that message is edited/soft-deleted/reacted-to, and is recomputed to the
20
- * next newest when it is hard-removed. Respects `shouldAdvanceLastMessage` (skips system messages
21
- * per `skip_last_msg_update_for_system_msgs`, and thread-only replies). `null` until one is ingested.
17
+ * The newest message the client holds that counts as the channel's latest, from any loaded
18
+ * interval or from an event. Not necessarily the server's latest message: when the client does
19
+ * not hold that one, {@link MessagePaginator.latestMessageAt} is later than its `created_at` (see
20
+ * {@link MessagePaginator.latestMessage}). For display (latest-message preview, latest-reply
21
+ * avatar). A live reference: it advances to a strictly newer message, is refreshed in place on
22
+ * edit, soft-delete or reaction, and is recomputed when hard-removed. Follows
23
+ * `shouldAdvanceLatestMessage` (skips `error` and `ephemeral` messages and thread-only replies).
24
+ * `null` until one is ingested.
22
25
  *
23
- * Lives here, NOT derived from pagination `state`, so it stays reactive when a WS message lands in
24
- * the head interval while an older window is active — the pagination store only emits when the
25
- * active* interval is impacted (see `BasePaginator.ingestItem`), so a `state`-derived latest would
26
- * go stale in that case.
26
+ * It lives outside pagination `state`, which only emits when the active interval is affected: a
27
+ * message landing in the head interval while an older interval is active would go stale there.
27
28
  */
28
- lastMessage: LocalMessage | null;
29
+ latestMessage: LocalMessage | null;
29
30
  /**
30
- * Server-provided `ChannelResponse.last_message_at` floor, for channels whose newest message is not
31
- * loaded (e.g. surfaced by a channel-list query). Kept SEPARATE from {@link lastMessage} so it can
32
- * outrank a stale/absent loaded message for sorting without overwriting the display message. The
33
- * sort key {@link MessagePaginator.lastMessageAt} is derived as the max of the two, so the two can
34
- * never drift out of sync.
31
+ * The `last_message_at` of the latest channel or thread query result (`ChannelResponse` or
32
+ * `ThreadStateResponse`). It comes with the channel or thread data rather than with a message, so
33
+ * the message it refers to may not be loaded. Each query result that carries it replaces it (see
34
+ * {@link MessagePaginator.setQueriedLatestMessageAt}); events never set it, as a new message from
35
+ * an event updates {@link latestMessage} instead. When the newest message is hard-deleted, it
36
+ * moves back to the previous loaded message; a truncation clears it. `null` when the query
37
+ * reported no messages.
38
+ *
39
+ * {@link MessagePaginator.latestMessageAt} is the later of this and {@link latestMessage}'s
40
+ * `created_at`, so it can be later than the message shown as the latest.
35
41
  */
36
- seededLastMessageAt: Date | null;
42
+ queriedLatestMessageAt: TimestampNS | null;
37
43
  };
38
44
  export type MessagePaginatorOptions = BaseMessagePaginatorOptions & {
39
45
  /**
40
- * Controls whether `jumpToTheFirstUnreadMessage()` should prefer the `unreadStateSnapshot`
41
- * state over `channel.state.read[...]`.
42
- *
43
- * - 'snapshot' (default): retrieve the first unread message id from the unreadStateSnapshot state when jumping to the first unread message
44
- * - 'read-state-only': retrieve the last read message id from the channel read state when jumping to the first unread message
46
+ * Where `jumpToTheFirstUnreadMessage()` reads the unread reference from: `'snapshot'`
47
+ * prefers `unreadStateSnapshot`, `'read-state-only'` uses only `channel.state.read[...]`.
48
+ * Defaults to `'snapshot'`.
45
49
  */
46
50
  unreadReferencePolicy?: 'snapshot' | 'read-state-only';
47
51
  };
48
52
  export type UnreadSnapshotState = {
49
- lastReadAt: Date | null;
53
+ lastReadAt: TimestampNS | null;
50
54
  unreadCount: number;
51
55
  /**
52
- * Snapshot of the first unread message id for the user.
53
- * This is intentionally decoupled from `channel.state.read[...]` because apps
54
- * may mark the channel read immediately on open, while still wanting to render
55
- * UI indicators that jump to the previously-unread location.
56
+ * First unread message ID. Decoupled from `channel.state.read[...]` because apps may mark the
57
+ * channel read on open yet still want UI that jumps to the previously unread location.
56
58
  */
57
59
  firstUnreadMessageId: string | null;
58
- /**
59
- * Snapshot of the last read message id for the user (fallback when first unread
60
- * is not known).
61
- */
60
+ /** Last read message ID, a fallback when the first unread is unknown. */
62
61
  lastReadMessageId: string | null;
63
62
  };
64
63
  /**
65
- * External, UI-driven signal: `true` while the user is actively viewing the latest messages of
66
- * this collection (app foregrounded AND the newest message on screen). The owning SDK sets it — the
67
- * state layer has no viewport. When live, an incoming message is NOT counted as unread (the count /
68
- * snapshot bump is skipped), so the "N new" separator/banner never flash for a message the user is
69
- * already looking at. Defaults to `false` (assume not viewing until the SDK proves otherwise).
64
+ * Set by the owning SDK (the state layer has no viewport): `true` while the user views the latest
65
+ * messages (app foregrounded and newest message on screen). While live, an incoming message does
66
+ * not bump the unread count or snapshot. Defaults to `false`.
70
67
  */
71
68
  export type LiveViewState = {
72
69
  isViewingLive: boolean;
73
70
  };
74
71
  /**
75
- * MessagePaginator extends {@link MessageIntervalPaginator} with the unread/live-view concern:
76
- * an independent unread reference snapshot, the UI-driven "viewing the latest messages" signal, and
77
- * the "jump to first unread" navigation built on top of them.
72
+ * Adds the unread snapshot, the UI-driven live-view signal and "jump to first unread" navigation to
73
+ * {@link MessageIntervalPaginator}.
78
74
  */
79
75
  export declare class MessagePaginator extends MessageIntervalPaginator {
76
+ protected get holderName(): string;
80
77
  private unreadReferencePolicy;
81
78
  /**
82
- * Independent unread reference state (not tied to `channel.state.read`).
83
- * Consumers may set this right before calling markRead / when opening a channel.
79
+ * Unread reference state, independent of `channel.state.read`. Seeded on each first page;
80
+ * consumers may also set it before `markRead`.
84
81
  */
85
82
  readonly unreadStateSnapshot: StateStore<UnreadSnapshotState>;
86
83
  /**
87
- * UI-driven "viewing the latest messages" signal (see {@link LiveViewState}). Set by the SDK via
88
- * {@link setViewingLive}; read by the channel to gate the unread bump on `message.new`. Subscribe to
89
- * this store for reactivity, or read the current boolean directly via the {@link isViewingLive} getter.
84
+ * The "viewing the latest messages" signal ({@link LiveViewState}), set via {@link setViewingLive}
85
+ * and read by the channel to gate the unread bump on `message.new`.
90
86
  */
91
87
  readonly liveViewState: StateStore<LiveViewState>;
92
88
  /**
93
- * Auxiliary (non-pagination) state — see {@link MessagePaginatorAggregateState}. A store separate
94
- * from `state` so `lastMessageAt` can be advanced from inside a `state.next` updater
95
- * (`ingestPage`) without being clobbered, and so consumers subscribe to a quiet signal that only
96
- * emits when the aggregate actually changes (not on every scroll/pagination emission). This is
97
- * distinct from the base's `intervalViews` interval-projection store.
89
+ * {@link MessagePaginatorAggregateState}, in a store apart from `state` so `latestMessage` can
90
+ * advance from inside a `state.next` updater (`ingestPage`) and subscribers only see aggregate
91
+ * changes.
98
92
  */
99
93
  readonly aggregateState: StateStore<MessagePaginatorAggregateState>;
100
94
  constructor({ unreadReferencePolicy, ...options }: MessagePaginatorOptions, builtInDefaults?: Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>);
101
95
  /**
102
- * Channel-list sort key: the later of the newest loaded message's `created_at` and the server seed.
103
- * **Derived** (never stored) so it cannot drift from {@link lastMessage}. `null` until seeded or a
104
- * message is ingested.
96
+ * The time of the channel's latest message as far as the client knows: the later of
97
+ * {@link latestMessage}'s `created_at` and the `last_message_at` of the latest response (see
98
+ * {@link setQueriedLatestMessageAt}). Later than {@link latestMessage} when the server has newer
99
+ * messages the client does not hold. The channel-list sort key. **Derived** (never stored) so it
100
+ * cannot drift from {@link latestMessage}. A system message that does not move `last_message_at`
101
+ * (see {@link isSkippedSystemMessage}) does not count: the newest loaded message that does is
102
+ * used instead. `null` until a query sets it or a message is ingested.
105
103
  */
106
- get lastMessageAt(): Date | null;
104
+ get latestMessageAt(): TimestampNS | null;
105
+ /** The newest loaded message that moves `last_message_at`, which {@link latestMessageAt} reads. */
106
+ private get latestMessageAtSource();
107
107
  /**
108
- * The newest channel-relevant message (the monotonic tracked latest), for display. Convenience read
109
- * of {@link aggregateState}; subscribe to `aggregateState` for reactivity. `null` until a message is
110
- * ingested (a server-only seed advances {@link lastMessageAt} but leaves this `null`).
108
+ * {@link latestMessageAt} as the server knows it (see {@link pageReachesHead}): an unsent latest
109
+ * message carries the device's clock, so the latest server-known message counts in its place.
111
110
  */
112
- get lastMessage(): LocalMessage | null;
111
+ private get latestServerMessageAt();
112
+ /** The later of `message`'s `created_at` and the queried `last_message_at`. */
113
+ private latestMessageAtIncluding;
113
114
  /**
114
- * The main channel list's notion of "latest message" for `channel.state.last_message_at`: on top of
115
- * the base rule (not shadowed) this excludes thread-only replies (a reply with a `parent_id` that is
116
- * not shown in the channel is not part of the channel list) and, when the channel is configured with
117
- * `skip_last_msg_update_for_system_msgs`, system messages. Mirrors the legacy
118
- * `Channel._trackLastMessage` skip logic.
115
+ * The newest message the client holds that counts as the channel's latest (see
116
+ * {@link shouldAdvanceLatestMessage}), from any loaded interval or from an event. Not necessarily
117
+ * the server's latest message: {@link latestMessageAt} is later than its `created_at` when the
118
+ * server has newer messages the client does not hold. `null` until a message is ingested (a
119
+ * `last_message_at` from a query sets {@link latestMessageAt} but leaves this `null`).
120
+ * Convenience read of {@link aggregateState}; subscribe to `aggregateState` for reactivity.
119
121
  *
120
- * These exclusions are specific to the MAIN channel list. A reply list (thread paginator, which has
121
- * a `parentMessageId`) is made ENTIRELY of thread replies — there the newest reply is exactly the
122
- * "latest message", so the exclusions are skipped and only the base rule applies.
122
+ * It differs from {@link anchoredHeadItem}, the newest message of the interval known to reach the
123
+ * server's latest message, in two ways:
124
+ * - It skips messages that do not count: an `error` message can be `anchoredHeadItem` but never
125
+ * `latestMessage`.
126
+ * - It does not need that interval. A channel opened at its first unread message loads m40–m60
127
+ * while the server's newest is m95: `latestMessage` is m60, `latestMessageAt` is m95's time and
128
+ * `anchoredHeadItem` is `undefined`.
123
129
  */
124
- protected shouldAdvanceLastMessage(message: LocalMessage): boolean;
130
+ get latestMessage(): LocalMessage | null;
125
131
  /**
126
- * Monotonically advance {@link lastMessageAt} to `message.created_at` when it is newer than the
127
- * current value and {@link shouldAdvanceLastMessage} permits it. Writes the dedicated
128
- * {@link aggregateState} store (not `state`), so it is safe to call from inside a `state.next`
129
- * updater (`ingestPage`). Returns `true` when the value moved.
132
+ * The newest server-confirmed message of the interval that reaches the newest message (see
133
+ * {@link anchoredHeadItems}). Any message the interval holds counts, system messages included, but
134
+ * not an unsent one: its id is local. `undefined` while that interval is not loaded or holds no
135
+ * server-confirmed message.
130
136
  *
131
- * Called internally on ingest; also public for callers that advance the aggregate without a normal
132
- * in-window ingest — e.g. offline pending-message replay, where the sent message has not yet been
133
- * ingested via the `message.new` event.
137
+ * @internal
138
+ */
139
+ get anchoredHeadServerConfirmedItem(): LocalMessage | undefined;
140
+ /**
141
+ * Whether `message` counts as the channel's latest message: not shadowed, not an `error` or
142
+ * `ephemeral` message (only the current user sees those, e.g. a failed command or a giphy preview)
143
+ * and, in the main list, not a thread-only reply. A reply list (`parentMessageId` set) holds only
144
+ * thread replies, so the thread-only rule does not apply there.
145
+ */
146
+ protected shouldAdvanceLatestMessage(message: LocalMessage): boolean;
147
+ /**
148
+ * Whether `message` is a main-list system message that, with
149
+ * `skip_last_msg_update_for_system_msgs`, does not move the channel's `last_message_at` on the
150
+ * server. It is still shown as the {@link latestMessage}, but {@link latestMessageAt} skips it.
151
+ */
152
+ private isSkippedSystemMessage;
153
+ /** Whether `message` counts for {@link latestMessageAt}. */
154
+ private movesLastMessageAt;
155
+ /**
156
+ * Advances {@link latestMessage} (and so {@link latestMessageAt}) to `message` when it is newer
157
+ * and {@link shouldAdvanceLatestMessage} permits. Writes {@link aggregateState} only, so it is
158
+ * safe inside a `state.next` updater (`ingestPage`). Returns `true` when the value moved. Public
159
+ * for callers that advance it without an in-interval ingest, e.g. offline pending-message replay.
134
160
  */
135
- trackLastMessage(message: LocalMessage): boolean;
161
+ trackLatestMessage(message: LocalMessage): boolean;
136
162
  /**
137
- * Seed {@link lastMessageAt} from the server-provided `ChannelResponse.last_message_at`, the
138
- * authoritative whole-channel aggregate. Monotonic: a no-op when the paginator already advanced
139
- * past it (e.g. from ingested messages), so seed order does not matter.
163
+ * Sets {@link MessagePaginatorAggregateState.queriedLatestMessageAt} from a query result's
164
+ * `last_message_at` (a channel's, or a thread's for a reply list), which {@link latestMessageAt}
165
+ * then takes into account. Each result replaces the previous value, even with an earlier one:
166
+ * the newest message may have been hard-deleted, which no event reports with the new value. A
167
+ * message ingested after the result was produced, such as a new one from an event, still counts,
168
+ * through {@link latestMessage}. `null` clears it (no messages); `undefined` (not in the result)
169
+ * leaves it.
170
+ */
171
+ setQueriedLatestMessageAt(value: TimestampNS | null | undefined): void;
172
+ /**
173
+ * Clears the head mark of the head interval when it is stale (see {@link unmarkHead}). It is stale
174
+ * when its newest message is older than the `last_message_at` the latest query returned (see
175
+ * {@link setQueriedLatestMessageAt}): the channel has newer messages the interval lacks. The
176
+ * interval then stops being the head interval ({@link anchoredHeadItem} becomes `undefined`) and
177
+ * can load newer messages, and a message that then arrives from an event starts a separate head
178
+ * interval instead of joining it across the gap. Messages that exist only locally, such as a
179
+ * failed send, are left out of the comparison: they carry the device's clock.
180
+ *
181
+ * For example, the interval holds m1–m20 and the channel is not watched while m21–m25 are sent. A
182
+ * query returns m25's time: the interval can now load m21–m25, and m26 from an event does not land
183
+ * right after m20.
184
+ *
185
+ * Call it with each response that does not bring the newest messages up to date, before any page
186
+ * the response carries is placed: a page that reaches the newest message marks its own interval as
187
+ * the head. Call it only when no events were arriving before the response and nothing else
188
+ * brings the newest messages: while the channel is watched, a message the interval lacks is still
189
+ * on its way, and a re-watch that places the newest page settles the interval itself.
190
+ */
191
+ unmarkStaleHead(): void;
192
+ /**
193
+ * A page reaches the newest message when its newest message is at or after
194
+ * {@link latestServerMessageAt}, as known before the page is ingested; one older than that is not
195
+ * the newest. That value comes from the latest response (`ChannelResponse` for a channel,
196
+ * `ThreadStateResponse` for a reply list, through {@link setQueriedLatestMessageAt}) and from the
197
+ * messages ingested since, such as new ones from events. `undefined` while it is not known.
198
+ */
199
+ protected pageReachesHead(page: LocalMessage[]): boolean | undefined;
200
+ /**
201
+ * Ingests a single message, from an event or an operation such as a send. A message that starts
202
+ * the newest interval is placed by {@link ingestAsNewestInterval}. Any other goes into the
203
+ * interval it belongs to and the active interval stays active, except for the current user's new
204
+ * send (see {@link isOwnSendWhileOlderIntervalIsActive}): the newest interval holding it is
205
+ * shown, so the user sees what they sent.
140
206
  */
141
- seedLastMessageAt(value: string | Date | null | undefined): void;
142
207
  ingestItem(item: LocalMessage): boolean;
208
+ /**
209
+ * Whether `message` is the current user's own send (see {@link isOwnSend}) that the paginator
210
+ * does not hold yet, while the newest interval is loaded but another interval is active. A message
211
+ * already held (a retry of a failed send, a replayed send, its server confirmation) is not new.
212
+ */
213
+ private isOwnSendWhileOlderIntervalIsActive;
214
+ /**
215
+ * Shows the interval holding the current user's own send. The send decides the interval shown, so
216
+ * it claims the active interval as a jump does: a page a query claimed earlier is then only
217
+ * stored.
218
+ */
219
+ private showIntervalOfOwnSend;
220
+ /**
221
+ * A message the paginator does not hold yet, at or after {@link latestMessageAt} (as known before
222
+ * it arrives), while no loaded interval reaches the newest message. It is then the newest message,
223
+ * so it starts the newest interval, as a page holding it would (see {@link pageReachesHead}).
224
+ */
225
+ private isNewNewestMessage;
226
+ /**
227
+ * The logical-head items (ingested one by one, usually from events, rather than as part of a
228
+ * page) not older than `queriedLatestMessageAt`, the `last_message_at` of the latest channel or
229
+ * thread response; all of them when no response has set it. They were ingested after that
230
+ * response, one after another, so nothing is missing between them. Items older than that, such as
231
+ * a message arriving out of order, are left out.
232
+ */
233
+ private get logicalHeadItemsSinceQueriedLatestMessageAt();
234
+ /**
235
+ * Starts the newest interval with `message`, together with the
236
+ * {@link logicalHeadItemsSinceQueriedLatestMessageAt} ingested before it. It can load older
237
+ * messages unless none are left to load (see {@link hasNoMessagesBeforeLiveMessages}). It becomes
238
+ * the active interval when no interval was active, when the logical head it takes items from was,
239
+ * or when `message` is the current user's own send (see {@link isOwnSend}), as every own send
240
+ * shows the newest interval (see {@link ingestItem}).
241
+ */
242
+ private ingestAsNewestInterval;
243
+ /**
244
+ * Whether no message older than the live messages is left to load: no interval of queried messages
245
+ * is loaded and the list reports no older messages, as after a newest page that came back empty.
246
+ * A list never queried, or one holding an interval (a jumped-to one, or one whose head mark was
247
+ * cleared), has older messages to load.
248
+ */
249
+ private get hasNoMessagesBeforeLiveMessages();
250
+ /**
251
+ * Whether `message` is one the current user is sending from this device: status `sending` and
252
+ * authored by the client's user. The same user's message from another device arrives
253
+ * server-confirmed and is not one.
254
+ */
255
+ private isOwnSend;
256
+ /** Whether the client's user wrote `message`; never for a paginator without a client. */
257
+ private isOwnMessage;
143
258
  ingestPage(params: Parameters<MessageIntervalPaginator['ingestPage']>[0]): Interval | null;
259
+ onEntitiesChanged(batch: EntityStoreChangeBatch): void;
260
+ reflectUserUpdate(user: UserResponse): void;
144
261
  removeItem(params: Parameters<MessageIntervalPaginator['removeItem']>[0]): ReturnType<MessageIntervalPaginator['removeItem']>;
262
+ truncate(params: Parameters<MessageIntervalPaginator['truncate']>[0]): void;
145
263
  /**
146
- * The still-loaded message with the greatest `created_at` that passes
147
- * {@link shouldAdvanceLastMessage} (skips system / thread-only per config), from the newest-loaded
148
- * window. Used to recompute the tracked latest after the current one is removed. `null` when nothing
149
- * loaded qualifies.
150
- *
151
- * "Latest" is defined by `created_at` (matching {@link trackLastMessage}), NOT by the paginator's
152
- * display order — so this compares timestamps rather than assuming a position, and stays correct
153
- * whatever `itemOrder` / `requestSort` are configured to.
264
+ * The still-loaded message with the greatest `created_at` that `counts` (by default
265
+ * {@link shouldAdvanceLatestMessage}), from the interval that reaches the newest message and the
266
+ * {@link logicalHeadItemsSinceQueriedLatestMessageAt}. An interval reached by a jump is not
267
+ * searched, nor an out-of-order older message: neither is the channel's previous message. Used to
268
+ * recompute the tracked latest after the current one is removed or stops counting;
269
+ * `serverConfirmedOnly` skips unsent messages and `excludeId` skips that message. `null` when
270
+ * nothing loaded qualifies. It compares timestamps rather than positions, so it holds for any
271
+ * `itemOrder` / `requestSort`.
154
272
  */
155
- private recomputeLastMessage;
273
+ private recomputeLatestMessage;
156
274
  /**
157
- * (Re)seed the unread state snapshot from the current own read state.
158
- *
159
- * Called after the first-page query, and can be called again by the SDK whenever a channel is
160
- * (re)opened from a cached paginator — where no fresh first-page query runs — so the snapshot
161
- * reflects the CURRENT read boundary rather than one frozen at the very first open. Without a
162
- * re-seed the separator position, unread count and "jump to first unread" target all go stale
163
- * across reopens.
275
+ * (Re)seeds the unread snapshot from the own read state. Runs once a first page and the rest of
276
+ * its response are in (the paginator's own first-page queries, `watch()` and the channel-list
277
+ * hydrate, when these place one), and the SDK calls it again when a channel is reopened from a
278
+ * cached paginator (no first-page query), so the separator, unread count and jump target follow
279
+ * the current read boundary.
164
280
  *
165
- * `firstUnreadMessageId` is intentionally reset to `null`: it represents an EXPLICIT mark-unread
166
- * (set by `notification.mark_unread`), not a live/computed boundary. Persisting a computed value
167
- * here would make the channel look explicitly marked-unread and suppress auto-mark-read.
281
+ * `firstUnreadMessageId` is reset to `null`: it holds only an explicit mark-unread
282
+ * (`notification.mark_unread`), and a computed value would suppress auto-mark-read.
168
283
  */
169
284
  seedUnreadSnapshot: () => void;
170
285
  /**
171
- * Invokes super.postQueryReconcile() and takes an unread state snapshot on the first-page query.
172
- * The snapshot has to be taken immediately after the query as the viewed channel is marked read
173
- * immediately after opening it. The snapshot can be used to display unread UI indicators.
286
+ * Applies the rest of the response, then takes the unread snapshot after a first-page query, from
287
+ * the read state the response brought. A viewed channel is marked read right after it opens, so
288
+ * the snapshot keeps the unread state from before, for unread UI indicators.
174
289
  */
175
- postQueryReconcile(params: PostQueryReconcileParams<LocalMessage, MessageQueryShape>): ExecuteQueryReturnValue<LocalMessage>;
290
+ protected applyQueryResponseRest(response: MessageQueryResponse, placeParams: QueryPagePlacement<MessageQueryShape>): void;
176
291
  /**
177
- * Jumps to the unread reference message.
178
- *
179
- * IMPORTANT: This intentionally does *not* rely on `channel.state.read[ownUserId]` only,
180
- * because apps may mark a channel read immediately after opening it, while still
181
- * wanting to keep "jump to unread" UI indicators alive (based on a snapshot).
292
+ * Jumps to the unread reference message. It does not rely on `channel.state.read` alone, since
293
+ * apps may mark a channel read on open yet keep "jump to unread" UI alive from the snapshot.
182
294
  *
183
295
  * Resolution order:
184
- * 1) explicit first-unread id from snapshot/read-state (mark-unread) — jump straight to it
185
- * 2) last-read timestamp: infer the FIRST UNREAD message from it — using the already-loaded
186
- * window when it straddles the boundary, otherwise a `created_at_around` query — and jump there
187
- * 3) last read id from snapshot/read-state (last-resort fallback when no timestamp is available)
296
+ * 1. an explicit first-unread ID (snapshot or read state): jump to it;
297
+ * 2. the last-read timestamp: infer the first unread message from the loaded interval, or from a
298
+ * `created_at_around` query when the interval does not straddle the boundary, and jump to it;
299
+ * 3. the last-read ID, when no timestamp is known.
188
300
  *
189
- * The timestamp inference (2) is preferred over jumping to the last-read id so that the jump lands
190
- * ON (and highlights) the first unread message rather than the last read one. The last-read id is
191
- * only used as a fallback when we cannot infer an unread boundary. The inference is NOT persisted
192
- * back into the snapshot (that is reserved for explicit mark-unread).
301
+ * The inference is not written to the snapshot: `firstUnreadMessageId` is reserved for an explicit
302
+ * mark-unread (it would suppress auto-mark-read).
193
303
  */
194
304
  jumpToTheFirstUnreadMessage: (options?: JumpToMessageOptions) => Promise<boolean>;
195
305
  setUnreadSnapshot: (next: Partial<UnreadSnapshotState>) => UnreadSnapshotState;
306
+ get isViewingLive(): boolean;
196
307
  /**
197
- * Set the UI-driven "viewing the latest messages" signal (see {@link LiveViewState}). Called by
198
- * the SDK from its message-list viewability + app-state tracking. No-ops when unchanged.
199
- *
200
- * Intentionally NOT reset by `clearStateAndCache` — it is an external input owned by the SDK, not
201
- * derived pagination state.
308
+ * Sets the live-view signal ({@link LiveViewState}). Not reset by `clearStateAndCache`: it is an
309
+ * external input owned by the SDK.
202
310
  */
203
- /** Current "viewing the latest messages" boolean (convenience read of {@link liveViewState}). */
204
- get isViewingLive(): boolean;
205
311
  setViewingLive: (isViewingLive: boolean) => void;
206
312
  clearUnreadSnapshot: () => void;
207
313
  clearStateAndCache(): void;
@@ -14,41 +14,30 @@ export type PinnedMessagePaginatorOptions = {
14
14
  paginatorOptions?: PaginatorOptions<LocalMessage, MessageQueryShape>;
15
15
  };
16
16
  /**
17
- * Pinned-message list paginator.
17
+ * The channel's pinned messages, ordered by `pinned_at` ascending (oldest-pinned first). Extends
18
+ * {@link MessageIntervalPaginator} rather than {@link MessagePaginator}: pinned messages are a subset
19
+ * of the channel and take no part in read/unread or delivery-receipt tracking.
18
20
  *
19
- * Extends the unread-free {@link MessageIntervalPaginator} base — pinned messages are a subset of
20
- * the channel and MUST NOT participate in read/unread or delivery-receipt tracking (that belongs to
21
- * the channel and thread message timelines). By extending the base rather than {@link MessagePaginator}
22
- * it simply never gets the unread surface.
23
- *
24
- * Differences from the main list:
25
- * - fetches from the `/pinned_messages` endpoint (`channel.getPinnedMessages`) rather than
26
- * `channel.query({ messages })`;
27
- * - includes only pinned, non-shadowed messages (`shouldIncludeMessageInInterval`), and filters on
28
- * `{ cid, pinned: true }` so `ingestItem` auto-adds on pin and auto-removes on unpin;
29
- * - orders by `pinned_at` ascending (oldest-pinned first), matching the legacy
30
- * `channel.state.pinnedMessages` order.
31
- *
32
- * Navigation (`jumpToMessage` / `jumpToTheLatestMessage`) is inherited and meaningful — the endpoint
33
- * supports `id_around` — but no unread-coupled navigation exists.
21
+ * Fetches through `channel.getPinnedMessages`, includes only pinned, non-shadowed messages and
22
+ * matches `{ cid, pinned: true }`, so `ingestItem` adds on pin and removes on unpin.
34
23
  */
35
24
  export declare class PinnedMessagePaginator extends MessageIntervalPaginator {
25
+ protected get holderName(): string;
36
26
  constructor({ channel, id, itemIndex, paginatorOptions, }: PinnedMessagePaginatorOptions);
37
- /**
38
- * Memoized for the reason {@link MessageIntervalPaginator}'s overlay is: the base derivation folds
39
- * this in and skips the publish when nothing moved, which needs stable references. Both close over
40
- * `this` and over a fixed `pinned_at` sort, so there is nothing to rebuild.
41
- */
27
+ /** Memoized: stable references let the base derivation skip a publish when nothing moved. */
42
28
  private pinnedBehaviour?;
43
29
  private buildPinnedBehaviour;
44
30
  private pinnedTiebreaker;
45
- /**
46
- * The ordering and request behaviour that makes this a *pinned*-message paginator, contributed to the
47
- * base derivation so a re-derivation cannot drop it and does not need a second write to restore it.
48
- * Spread over the interval overlay, so this class's `pinned_at` comparator wins.
49
- */
31
+ /** Adds the pinned ordering and request behaviour to the derivation, over the interval overlay. */
50
32
  protected getBehaviourOverrides(): Partial<BasePaginatorConfig<LocalMessage, MessageQueryShape>>;
51
33
  private installPinnedMessageBehaviour;
34
+ /**
35
+ * The newest page (no cursor, not around a message) holds the most recently pinned messages, so
36
+ * it reaches the head: its interval becomes the only newest interval, and an older interval that
37
+ * was the newest one can load newer pins (see `makeOnlyHead`). A newest page comes from this
38
+ * paginator's own query or with a channel response.
39
+ */
40
+ protected pageReachesHead(_page: LocalMessage[], queryShape: MessageQueryShape | undefined): boolean | undefined;
52
41
  buildMatchFilters: () => PinnedMessagePaginatorFilter;
53
42
  shouldIncludeMessageInInterval(message: LocalMessage): boolean;
54
43
  }
@@ -13,7 +13,8 @@ export declare class ReminderPaginator extends BasePaginator<ReminderResponseDat
13
13
  constructor(client: StreamChat, options?: PaginatorOptions<ReminderResponseData, QueryRemindersRequest>);
14
14
  getItemId(item: ReminderResponseData): string;
15
15
  private buildSortComparator;
16
- protected getNextQueryShape({ direction, }: Required<Pick<PaginationQueryParams<QueryRemindersRequest>, 'direction'>>): QueryRemindersRequest;
17
- query: ({ queryShape, }: PaginationQueryParams<QueryRemindersRequest>) => Promise<PaginationQueryReturnValue<ReminderResponseData>>;
18
- filterQueryResults: (items: ReminderResponseData[]) => ReminderResponseData[];
16
+ protected getNextQueryShape(): QueryRemindersRequest;
17
+ protected fetchQueryResponse: ({ direction, queryShape, }: PaginationQueryParams<QueryRemindersRequest>) => Promise<PaginationQueryReturnValue<ReminderResponseData>>;
18
+ /** The extracting step of the query pipeline: the response is the page. */
19
+ protected extractQueryPage(response: PaginationQueryReturnValue<ReminderResponseData>, _params: PaginationQueryParams<QueryRemindersRequest>): PaginationQueryReturnValue<ReminderResponseData>;
19
20
  }
@@ -0,0 +1,44 @@
1
+ import { BasePaginator } from './BasePaginator';
2
+ import type { PaginationQueryParams, PaginationQueryReturnValue, PaginatorOptions, PaginatorState } from './BasePaginator';
3
+ import type { StreamChat } from '../../client';
4
+ import { EntityStore } from '../../entityStore/EntityStore';
5
+ import type { Thread } from '../../thread';
6
+ import type { QueryThreadsRequest } from '../../types';
7
+ export declare const DEFAULT_THREAD_PAGE_SIZE = 25;
8
+ /** Default query options for every page of the thread list. */
9
+ export declare const DEFAULT_THREAD_QUERY: QueryThreadsRequest;
10
+ export type ThreadPaginatorOptions = {
11
+ client: StreamChat;
12
+ /** Store holding the list's threads (`client.threads`' thread store). Omitted: a private one. */
13
+ store?: EntityStore<Thread>;
14
+ paginatorOptions?: PaginatorOptions<Thread, QueryThreadsRequest>;
15
+ };
16
+ /**
17
+ * The thread list, in the order `queryThreads` returns it. There is no client-side sort: the server
18
+ * order (unread first, then latest reply) depends on state a `Thread` mutates in place, so a
19
+ * comparator would corrupt interval storage. Pages append in server order and
20
+ * {@link ThreadPaginator.reload} replaces the list.
21
+ */
22
+ export declare class ThreadPaginator extends BasePaginator<Thread, QueryThreadsRequest> {
23
+ private readonly client;
24
+ private readonly store;
25
+ constructor({ client, store, paginatorOptions, }: ThreadPaginatorOptions);
26
+ /** No next page until a load has landed, so `toTail()` is a no-op before the first reload. */
27
+ get initialState(): PaginatorState<Thread>;
28
+ getItemId(thread: Thread): string;
29
+ protected getNextQueryShape({ direction, }: Required<Pick<PaginationQueryParams<QueryThreadsRequest>, 'direction'>>): QueryThreadsRequest;
30
+ protected fetchQueryResponse: ({ queryShape, }: PaginationQueryParams<QueryThreadsRequest>) => Promise<PaginationQueryReturnValue<Thread>>;
31
+ /** The extracting step of the query pipeline: the response is the page. */
32
+ protected extractQueryPage(response: PaginationQueryReturnValue<Thread>, _params: PaginationQueryParams<QueryThreadsRequest>): PaginationQueryReturnValue<Thread>;
33
+ /**
34
+ * Re-queries the first page and replaces the list in server order; also the first load. The
35
+ * current threads stay until the response lands. A failed query leaves them and records
36
+ * `lastQueryError`; a success clears it. Only the first load publishes `isLoading` (with items it
37
+ * would mean the next page).
38
+ */
39
+ reload: ({ limit }?: {
40
+ limit?: number;
41
+ }) => Promise<void>;
42
+ /** Also clears the item index (the base reset keeps it), before the base publishes. */
43
+ resetState(): void;
44
+ }
@@ -3,12 +3,8 @@ import type { PaginationQueryParams, PaginationQueryReturnValue, PaginatorOption
3
3
  import type { ListUserGroupsOptions, UserGroupResponse } from '../../types';
4
4
  import type { StreamChat } from '../../client';
5
5
  /**
6
- * Paginates user-group listing through `/usergroups`.
7
- *
8
- * This entity only supports forward (tailward) cursor pagination via
9
- * `created_at_gt` and `id_gt`. Backward (headward) pagination is not available
10
- * because the API does not expose a backward cursor, so the headward cursor is
11
- * initialized as exhausted (`null`).
6
+ * Paginates `/usergroups` forward (tailward) only, via `created_at_gt` and `id_gt`. The API has no
7
+ * backward cursor, so the headward cursor starts exhausted (`null`).
12
8
  */
13
9
  export declare class UserGroupPaginator extends BasePaginator<UserGroupResponse, ListUserGroupsOptions> {
14
10
  private client;
@@ -19,6 +15,7 @@ export declare class UserGroupPaginator extends BasePaginator<UserGroupResponse,
19
15
  set teamId(teamId: string | undefined);
20
16
  private buildNextCursor;
21
17
  protected getNextQueryShape(): ListUserGroupsOptions;
22
- query: ({ direction, queryShape, }: PaginationQueryParams<ListUserGroupsOptions>) => Promise<PaginationQueryReturnValue<UserGroupResponse>>;
23
- filterQueryResults: (items: UserGroupResponse[]) => UserGroupResponse[];
18
+ protected fetchQueryResponse: ({ direction, queryShape, }: PaginationQueryParams<ListUserGroupsOptions>) => Promise<PaginationQueryReturnValue<UserGroupResponse>>;
19
+ /** The extracting step of the query pipeline: the response is the page. */
20
+ protected extractQueryPage(response: PaginationQueryReturnValue<UserGroupResponse>, _params: PaginationQueryParams<ListUserGroupsOptions>): PaginationQueryReturnValue<UserGroupResponse>;
24
21
  }
@@ -5,3 +5,4 @@ export * from './MessagePaginator';
5
5
  export * from './PinnedMessagePaginator';
6
6
  export * from './ReminderPaginator';
7
7
  export * from './UserGroupPaginator';
8
+ export * from './ThreadPaginator';