stream-chat 10.0.0-rc.9 → 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 (361) hide show
  1. package/README.md +7 -6
  2. package/dist/cjs/index.browser.js +21650 -19790
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +21690 -19798
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +21755 -19895
  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 +13 -27
  10. package/dist/types/EventHandlerPipeline.d.ts +18 -38
  11. package/dist/types/LiveLocationManager.d.ts +24 -52
  12. package/dist/types/api-client.d.ts +17 -5
  13. package/dist/types/channel.d.ts +432 -470
  14. package/dist/types/channel_state.d.ts +68 -112
  15. package/dist/types/client.d.ts +321 -435
  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 +2 -0
  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 +2528 -690
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +33 -14
  52. package/dist/types/index.d.ts +10 -6
  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 +7 -1
  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 -128
  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 +19 -18
  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 +40 -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 -186
  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 -334
  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 +5 -23
  118. package/dist/types/pagination/utility.search.d.ts +3 -8
  119. package/dist/types/poll.d.ts +34 -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 +11 -11
  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 +63 -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 -199
  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 +33 -57
  148. package/dist/types/utils.d.ts +72 -91
  149. package/package.json +14 -40
  150. package/src/ChannelManager.ts +494 -303
  151. package/src/CooldownTimer.ts +28 -38
  152. package/src/EventHandlerPipeline.ts +22 -45
  153. package/src/LiveLocationManager.ts +37 -76
  154. package/src/api-client.ts +113 -50
  155. package/src/campaign.ts +1 -1
  156. package/src/channel.ts +1067 -1276
  157. package/src/channel_batch_updater.ts +1 -1
  158. package/src/channel_state.ts +73 -168
  159. package/src/client.ts +744 -974
  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 -232
  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 +6 -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 -1540
  195. package/src/gen/models/index.ts +2498 -3383
  196. package/src/gen/models/timestamp-guard.ts +27 -0
  197. package/src/gen/moderation/ModerationApi.ts +170 -367
  198. package/src/index.ts +22 -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 +19 -23
  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 +223 -174
  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/textComposer.ts +1 -1
  225. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +12 -12
  226. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  227. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  228. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  229. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +8 -6
  230. package/src/messageComposer/middleware/textComposer/commandUtils.ts +10 -3
  231. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  232. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  233. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  234. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  235. package/src/messageComposer/pollComposer.ts +21 -9
  236. package/src/messageComposer/textComposer.ts +37 -57
  237. package/src/messageComposer/types.ts +39 -11
  238. package/src/messageDelivery/MessageDeliveryReporter.ts +86 -125
  239. package/src/messageDelivery/MessageReceiptsTracker.ts +88 -101
  240. package/src/messageOperations/FailedSendCache.ts +85 -0
  241. package/src/messageOperations/MessageOperationStatePolicy.ts +121 -112
  242. package/src/messageOperations/MessageOperations.ts +297 -175
  243. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +9 -28
  244. package/src/messageOperations/createMessageOperations.ts +176 -0
  245. package/src/messageOperations/index.ts +6 -14
  246. package/src/messageOperations/reflectReactionEvent.ts +43 -0
  247. package/src/messageOperations/sendOrdering.ts +25 -0
  248. package/src/messageOperations/settlePendingAttachmentUploads.ts +98 -0
  249. package/src/messageOperations/types.ts +51 -13
  250. package/src/middleware.ts +13 -5
  251. package/src/moderation.ts +25 -21
  252. package/src/notifications/NotificationManager.ts +19 -28
  253. package/src/notifications/types.ts +21 -57
  254. package/src/offline-support/offline_support_api.ts +226 -669
  255. package/src/offline-support/offline_sync_manager.ts +51 -80
  256. package/src/offline-support/queueableOperations.ts +98 -73
  257. package/src/offline-support/types.ts +43 -186
  258. package/src/pagination/FilterBuilder.ts +1 -22
  259. package/src/pagination/ItemIndex.ts +4 -12
  260. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  261. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +15 -63
  262. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  263. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +53 -33
  264. package/src/pagination/filterCompiler.ts +11 -25
  265. package/src/pagination/index.ts +1 -0
  266. package/src/pagination/paginators/BasePaginator.ts +1415 -1041
  267. package/src/pagination/paginators/ChannelPaginator.ts +479 -217
  268. package/src/pagination/paginators/MessageIntervalPaginator.ts +1351 -772
  269. package/src/pagination/paginators/MessagePaginator.ts +513 -233
  270. package/src/pagination/paginators/PinnedMessagePaginator.ts +32 -40
  271. package/src/pagination/paginators/ReminderPaginator.ts +21 -16
  272. package/src/pagination/paginators/ThreadPaginator.ts +170 -0
  273. package/src/pagination/paginators/UserGroupPaginator.ts +16 -19
  274. package/src/pagination/paginators/index.ts +1 -0
  275. package/src/pagination/paginators/stateThrottling.ts +5 -10
  276. package/src/pagination/sortCompiler.ts +23 -50
  277. package/src/pagination/utility.normalization.ts +8 -30
  278. package/src/pagination/utility.search.ts +4 -11
  279. package/src/poll.ts +177 -98
  280. package/src/poll_manager.ts +24 -22
  281. package/src/poll_optimistic_votes.ts +335 -0
  282. package/src/reminders/Reminder.ts +16 -12
  283. package/src/reminders/ReminderManager.ts +22 -55
  284. package/src/reminders/ReminderTimer.ts +1 -2
  285. package/src/search/BaseSearchSource.ts +19 -25
  286. package/src/search/ChannelSearchSource.ts +43 -1
  287. package/src/search/MessageSearchSource.ts +77 -13
  288. package/src/search/SearchController.ts +39 -36
  289. package/src/search/types.ts +6 -10
  290. package/src/segment.ts +1 -1
  291. package/src/signing.ts +23 -3
  292. package/src/thread.ts +418 -703
  293. package/src/thread_manager.ts +300 -234
  294. package/src/token_manager.ts +12 -22
  295. package/src/types.ts +102 -216
  296. package/src/types.utility.ts +3 -3
  297. package/src/upload-utils.ts +5 -10
  298. package/src/uploadManager.ts +64 -18
  299. package/src/utils/FixedSizeQueueCache.ts +18 -21
  300. package/src/utils/WithSubscriptions.ts +6 -16
  301. package/src/utils/abort.ts +45 -0
  302. package/src/utils/concurrency.ts +16 -55
  303. package/src/utils/mergeWith/mergeWith.ts +10 -13
  304. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  305. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  306. package/src/utils/objectPath.ts +6 -41
  307. package/src/utils/retryable.ts +10 -14
  308. package/src/utils/throttling/throttle.ts +9 -25
  309. package/src/utils/time.ts +40 -60
  310. package/src/utils.ts +181 -174
  311. package/codegen/i18n/callSites.ts +0 -126
  312. package/codegen/i18n/generate.ts +0 -226
  313. package/codegen/i18n/guards.ts +0 -178
  314. package/codegen/i18n/index.ts +0 -29
  315. package/codegen/i18n/stringMaps.ts +0 -91
  316. package/codegen/i18n/types.ts +0 -100
  317. package/dist/cjs/i18n.browser.js +0 -1131
  318. package/dist/cjs/i18n.browser.js.map +0 -7
  319. package/dist/cjs/i18n.node.js +0 -1160
  320. package/dist/cjs/i18n.node.js.map +0 -7
  321. package/dist/esm/i18n-codegen.mjs +0 -409
  322. package/dist/esm/i18n-codegen.mjs.map +0 -7
  323. package/dist/esm/i18n.mjs +0 -1098
  324. package/dist/esm/i18n.mjs.map +0 -7
  325. package/dist/types/ConnectionRecoveryManager.d.ts +0 -156
  326. package/dist/types/connection.d.ts +0 -139
  327. package/dist/types/entityStore/applyReactionLocally.d.ts +0 -32
  328. package/dist/types/i18n/Streami18n.d.ts +0 -168
  329. package/dist/types/i18n/TranslationBuilder.d.ts +0 -70
  330. package/dist/types/i18n/TranslationStore.d.ts +0 -57
  331. package/dist/types/i18n/dayjs.d.ts +0 -104
  332. package/dist/types/i18n/formatters.d.ts +0 -91
  333. package/dist/types/i18n/index.d.ts +0 -15
  334. package/dist/types/i18n/translator.d.ts +0 -29
  335. package/dist/types/i18n/types.d.ts +0 -262
  336. package/dist/types/i18n-codegen/callSites.d.ts +0 -10
  337. package/dist/types/i18n-codegen/generate.d.ts +0 -15
  338. package/dist/types/i18n-codegen/guards.d.ts +0 -61
  339. package/dist/types/i18n-codegen/index.d.ts +0 -29
  340. package/dist/types/i18n-codegen/stringMaps.d.ts +0 -14
  341. package/dist/types/i18n-codegen/types.d.ts +0 -94
  342. package/dist/types/insights.d.ts +0 -56
  343. package/dist/types/messageOperations/optimistic.d.ts +0 -118
  344. package/dist/types/messageOperations/persistence.d.ts +0 -21
  345. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  346. package/dist/types/store.d.ts +0 -125
  347. package/src/ConnectionRecoveryManager.ts +0 -293
  348. package/src/i18n/Streami18n.ts +0 -520
  349. package/src/i18n/TranslationBuilder.ts +0 -176
  350. package/src/i18n/TranslationStore.ts +0 -96
  351. package/src/i18n/dayjs.ts +0 -228
  352. package/src/i18n/formatters.ts +0 -461
  353. package/src/i18n/index.ts +0 -15
  354. package/src/i18n/languageNames.ts +0 -103
  355. package/src/i18n/translator.ts +0 -76
  356. package/src/i18n/types.ts +0 -375
  357. package/src/insights.ts +0 -82
  358. package/src/messageOperations/optimistic.ts +0 -257
  359. package/src/messageOperations/persistence.ts +0 -40
  360. package/src/pagination/utility.queryChannel.ts +0 -84
  361. package/src/store.ts +0 -304
@@ -3,326 +3,206 @@ import { CooldownTimer } from './CooldownTimer';
3
3
  import { MessageComposer } from './messageComposer';
4
4
  import { MessageReceiptsTracker } from './messageDelivery';
5
5
  import { MessagePaginator, PinnedMessagePaginator } from './pagination/paginators';
6
- import { MessageOperations } from './messageOperations';
6
+ import type { MessageOperations } from './messageOperations';
7
+ import type { OperationRequestFn } from './messageOperations/types';
7
8
  import type { StreamChat } from './client';
8
9
  import type { ChannelDeclarativeConfig } from './configuration/types';
9
- import type { AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields, ChannelUpdateOptions, Command, DeleteMessageOptions, Event, EventHandler, EventPayload, EventType, FileUploadInput, LocalMessage, MarkReadRequest, MarkReadResponse, MessageRequest, MessageResponse, MessageSetType, QueryMembersPayload, ReactionRequest, SendMessageOptions, SendReactionRequest, SharedLocation, StreamRequestOptions, StreamResponse, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UpdateMessageOptions, UserResponse } from './types';
10
- import type { StateStore } from './store';
11
- import type { ChannelMemberRequest as Gen_ChannelMemberRequest, ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, MuteChannelRequest as Gen_MuteChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UploadChannelFileRequest, UploadChannelRequest, WSEvent } from './gen/models';
10
+ import type { AddMembersRequest, AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse, ChannelStateResponse, ChannelStateResponseFields, Command, Event, EventHandler, EventPayload, EventType, FileUploadInput, FilterTagsRequest, InviteMembersRequest, LocalMessage, MarkReadRequest, MarkReadResponse, MessageResponse, QueryMembersPayload, RemoveMembersRequest, SharedLocation, StreamRequestOptions, StreamResponse, TimestampNS, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UserResponse } from './types';
11
+ import type { StateStore } from '@stream-io/state-store';
12
+ import type { ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, MuteChannelRequest as Gen_MuteChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UploadChannelFileRequest, UploadChannelRequest } from './gen/models';
12
13
  import type { ChatApi } from './gen/chat/ChatApi';
13
14
  import { ChannelApi } from './gen/chat/ChannelApi';
14
- export type SendMessageWithStateUpdateParams = {
15
- localMessage: LocalMessage;
16
- message?: MessageRequest;
17
- options?: SendMessageOptions;
18
- /**
19
- * Per-call override for the send/retry request (advanced).
20
- * If set, it takes precedence over channel instance configuration handlers.
21
- */
22
- sendMessageRequestFn?: CustomSendMessageRequestFn;
23
- };
24
- export type RetrySendMessageWithLocalUpdateParams = Omit<SendMessageWithStateUpdateParams, 'message'>;
25
- export type UpdateMessageWithStateUpdateParams = {
26
- localMessage: LocalMessage;
27
- options?: UpdateMessageOptions;
28
- /**
29
- * Per-call override for the update request (advanced).
30
- * If set, it takes precedence over channel instance configuration handlers.
31
- */
32
- updateMessageRequestFn?: CustomUpdateMessageRequestFn;
33
- };
34
- export type DeleteMessageWithStateUpdateParams = {
35
- localMessage: LocalMessage;
36
- options?: DeleteMessageOptions;
37
- /**
38
- * Per-call override for the delete request (advanced).
39
- * If set, it takes precedence over channel instance configuration handlers.
40
- */
41
- deleteMessageRequestFn?: CustomDeleteMessageRequestFn;
42
- };
43
- export type CustomSendMessageRequestFn = (params: Omit<SendMessageWithStateUpdateParams, 'sendMessageRequestFn'>) => Promise<{
44
- message: MessageResponse;
45
- }>;
46
- export type CustomUpdateMessageRequestFn = (params: Omit<UpdateMessageWithStateUpdateParams, 'updateMessageRequestFn'>) => Promise<{
47
- message: MessageResponse;
48
- }>;
49
- export type CustomDeleteMessageRequestFn = (params: Omit<DeleteMessageWithStateUpdateParams, 'deleteMessageRequestFn'>) => Promise<{
50
- message: MessageResponse;
51
- }>;
15
+ /** Re-exported here because `src/messageOperations` is not in the root barrel. */
16
+ export type { DefaultOperationRequest, MessageOperationSpec, OperationKind, OperationParams, OperationRequestFn, OperationResponse, } from './messageOperations/types';
52
17
  export type CustomMarkReadRequestFn = (params: {
53
18
  channel: Channel;
54
19
  options?: MarkReadRequest;
55
20
  }) => Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
56
21
  /**
57
- * A channel's **resolved** configuration — what {@link Channel.config} returns.
58
- *
59
- * Not `ChannelConfigWithInfo`, which is the generated type for the channel *type's server*
60
- * configuration behind {@link Channel.serverConfig}. The two are related: the gates below are the
61
- * server's flags already ANDed with what the integrator registered.
22
+ * A channel's resolved configuration, returned by {@link Channel.config}. The gates are the server's
23
+ * flags (see {@link Channel.serverConfig}) ANDed with what the integrator registered.
62
24
  */
63
25
  export type ChannelConfig = {
64
26
  requestHandlers?: {
65
- deleteMessageRequest?: CustomDeleteMessageRequestFn;
27
+ deleteMessageRequest?: OperationRequestFn<'delete'>;
66
28
  markReadRequest?: CustomMarkReadRequestFn;
67
- sendMessageRequest?: CustomSendMessageRequestFn;
68
- retrySendMessageRequest?: CustomSendMessageRequestFn;
69
- updateMessageRequest?: CustomUpdateMessageRequestFn;
29
+ sendMessageRequest?: OperationRequestFn<'send'>;
30
+ retrySendMessageRequest?: OperationRequestFn<'retry'>;
31
+ updateMessageRequest?: OperationRequestFn<'update'>;
70
32
  };
71
33
  /**
72
- * Typing indicators for this channel (defaults to enabled). ANDed with the channel type's
73
- * `typing_events`, so either side can switch them off and neither can widen.
74
- *
75
- * This is the channel-wide gate, read by {@link Channel.keystroke} and {@link Channel.stopTyping}.
76
- * `messageComposer.text.publishTypingEvents` sits on top of it as a per-composer refinement — a thread
77
- * composer can stay quiet while the channel still permits typing events.
34
+ * Typing indicators. Defaults to enabled. ANDed with the channel type's `typing_events`. Read by
35
+ * {@link Channel.keystroke} and {@link Channel.stopTyping}.
36
+ * `messageComposer.text.publishTypingEvents` further switches them off per composer.
78
37
  */
79
38
  typingEvents: {
80
39
  enabled: boolean;
81
40
  };
82
41
  /**
83
- * Read receipts for this channel (defaults to enabled). ANDed with the channel type's `read_events`,
84
- * so either side can switch them off and neither can widen. Read by {@link Channel.markRead} and
85
- * {@link Channel.markUnread}.
42
+ * Read receipts. `enabled` is ANDed with the channel type's `read_events`. Together with the own
43
+ * `read-events` capability it decides {@link Channel.readEventsEnabled}, which gates counting
44
+ * unread messages, {@link Channel.markRead} and {@link Channel.markUnread}. Defaults to `true`.
45
+ *
46
+ * `localUnreadCountEnabled` applies only while read events are off
47
+ * ({@link Channel.readEventsEnabled} is false): the channel keeps counting unread messages and
48
+ * {@link Channel.markReadLocally} resets the count, sending nothing to the server. The server does
49
+ * not restrict it. Defaults to `false`.
86
50
  */
87
51
  readEvents: {
88
52
  enabled: boolean;
53
+ localUnreadCountEnabled: boolean;
89
54
  };
90
- /**
91
- * Threaded replies for this channel (defaults to enabled). ANDed with the channel type's `replies`.
92
- */
55
+ /** Threaded replies. Defaults to enabled. ANDed with the channel type's `replies`. */
93
56
  replies: {
94
57
  enabled: boolean;
95
58
  };
96
59
  /**
97
- * Message reminders — "remind me" and "save for later" (defaults to enabled). ANDed with the channel
98
- * type's `user_message_reminders`.
60
+ * Message reminders. Defaults to enabled. ANDed with the channel type's `user_message_reminders`.
99
61
  */
100
62
  userMessageReminders: {
101
63
  enabled: boolean;
102
64
  };
103
- /**
104
- * Delivery receipts (defaults to enabled). ANDed with the channel type's `delivery_events`.
105
- */
65
+ /** Delivery receipts. Defaults to enabled. ANDed with the channel type's `delivery_events`. */
106
66
  deliveryEvents: {
107
67
  enabled: boolean;
108
68
  };
109
69
  /**
110
- * The slash commands this channel type offers, as the server reports them.
111
- *
112
- * Named for availability rather than enablement on purpose: whether any given command can be *used*
113
- * right now is `messageComposer.isCommandDisabled(command)`, which depends on the message context —
114
- * editing and quoting disable different ones. A list called `enabledCommands` would routinely contain
115
- * disabled entries.
116
- *
117
- * **Server-owned, and the one field here the integrator cannot set.** It is a list rather than a gate,
118
- * so there is nothing to AND and no intent to express — the server's answer simply *is* the value, and
119
- * it is absent from the declarative tree for that reason.
120
- *
121
- * It lives on the resolved configuration anyway so that consumers never need a second place to look:
122
- * every question about what this channel permits is answered by `config`. Reading the raw
123
- * {@link Channel.serverConfig} instead is what made a UI show features the client had disabled — the
124
- * gates below have a client half, and mixing the two sources meant sometimes reading only one.
70
+ * The slash commands the channel type offers. Server-owned: the integrator cannot set it. Whether a
71
+ * command can be used right now is `messageComposer.isCommandDisabled(command)`.
125
72
  */
126
73
  availableCommands: Command[];
127
74
  };
128
75
  export declare const DEFAULT_CHANNEL_CONFIG: ChannelConfig;
129
- /**
130
- * The Channel class manages its own state.
131
- */
132
76
  export declare class Channel extends ChannelApi {
133
77
  _client: StreamChat;
134
- data: Partial<ChannelResponse> | undefined;
135
78
  _data: ChannelInput;
136
79
  cid: string;
137
- /** */
138
80
  listeners: Map<EventType, Set<EventHandler>>;
139
81
  state: ChannelState;
140
82
  lastKeyStroke?: Date;
141
83
  lastTypingEvent: Date | null;
142
84
  isTyping: boolean;
143
- /** Re-entrancy guard for {@link Channel.reload} (mirrors Thread.reload's isLoading guard). */
85
+ /** Re-entrancy guard for {@link Channel.reload}. */
144
86
  private _reloading;
145
- /** Refcount backing the reactive `active` flag (a shared Channel instance can have several consumers). */
87
+ /** Refcount behind the `active` flag: several consumers can hold one instance. */
146
88
  private _activeRefCount;
147
- push_preferences?: Gen_ChannelPushPreferencesResponse;
89
+ /** Stops releaseUnusedChannels() from removing a channel while a query for it is still running. */
90
+ private _channelQueriesInFlight;
91
+ /** The watch queries {@link Channel.watch} callers wait for, joined by equal options. */
92
+ private _watchQueriesInFlight;
148
93
  /**
149
- * The shared configuration machinery. Owned rather than inherited — `Channel` already extends
150
- * `ChannelApi`, so single inheritance is spent.
151
- *
152
- * `mergeSlice: 'deep'` because the config has nested groups: registering `typingEvents.enabled` must
153
- * not drop `readEvents`. `applyAuthority` is what makes `channel.config` the *whole* answer rather
154
- * than the client's half — see {@link serverRestrictions}.
94
+ * The options of the last {@link Channel.watch} query that succeeded during the current watch: a
95
+ * `watch()` with these options has nothing to send. Cleared when the watch ends.
155
96
  */
97
+ private _lastWatchOptions?;
98
+ push_preferences?: Gen_ChannelPushPreferencesResponse;
156
99
  private readonly configController;
157
100
  readonly messageComposer: MessageComposer;
158
101
  readonly messageReceiptsTracker: MessageReceiptsTracker;
102
+ readonly messageOperations: MessageOperations;
159
103
  readonly messagePaginator: MessagePaginator;
160
104
  readonly pinnedMessagesPaginator: PinnedMessagePaginator;
161
- readonly messageOperations: MessageOperations;
162
105
  readonly cooldownTimer: CooldownTimer;
163
- /**
164
- * Teardown for this channel's configuration subscription, released by {@link _disconnect}. Channels
165
- * are retained in `client.activeChannels`, so leaving this subscribed would keep growing the
166
- * configuration store's handler set across reconnects.
167
- */
168
106
  private unsubscribeConfiguration?;
169
- /** Teardown for the server-config re-derivation subscription, released by {@link _disconnect}. */
170
107
  private unsubscribeServerConfig?;
171
- /** The declarative slice last derived from, so a late server answer can re-derive from the same one. */
108
+ /** The declarative slice last derived from, so a late server config can re-derive from it. */
172
109
  private declarativeConfig?;
173
110
  /**
174
- * Creates a `Channel` instance bound to the given chat client.
111
+ * Creates an uninitialized channel. Without an `id` its `cid` is a temporary one built from
112
+ * `data.members`, until the server answers.
175
113
  *
176
114
  * @param client - The chat client.
177
- * @param type - The type of channel.
178
- * @param id - The ID of the chat (optional).
179
- * @param data - Any additional custom params.
180
- * @returns A new uninitialized channel.
115
+ * @param type - The channel type.
116
+ * @param id - The channel ID, or `undefined` for a channel created from members.
117
+ * @param data - Data for the channel (members, custom fields).
181
118
  */
182
119
  constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelInput);
183
- /**
184
- * The configuration fields this channel's *type* decides server-side.
185
- *
186
- * Both are boolean gates, so `mergeServerRestrictions` ANDs them with what was requested: either the
187
- * server or the integrator may switch a feature off, and neither can widen. Re-read on every
188
- * derivation rather than captured, so a flag that changes mid-session is picked up.
189
- */
120
+ /** Flags the channel type decides server-side (ANDed with the requested ones). */
190
121
  private get serverRestrictions();
191
122
  /**
192
- * Derives this channel's configuration — and its sub-objects' — from the declarative slice.
123
+ * Re-derives the configuration of the channel, its paginators and its message operations from the
124
+ * declarative slice. Runs at construction, on every change to the `channel`, `messagePaginator` or
125
+ * `messageOperations` configuration, and on `client.config.reset()`.
193
126
  *
194
- * Called by the constructor and by `client.config.reset()`. The channel owns only its own
195
- * `requestHandlers`; each sub-object derives its own configuration, so the knowledge of what
196
- * `messagePaginator.pageSize` means stays inside the paginator.
127
+ * @param declarativeConfig - The channel's declarative slice (optional).
197
128
  */
198
129
  initializeConfig(declarativeConfig?: ChannelDeclarativeConfig): void;
199
130
  /**
200
- * Returns the chat client for this channel. Throws if the channel is pending disposal — see
201
- * {@link Channel.pendingDisposal}.
131
+ * Returns the chat client for this channel.
202
132
  *
203
133
  * @returns The chat client.
134
+ * @throws If the channel is pending disposal ({@link Channel.pendingDisposal}).
204
135
  */
205
136
  getClient(): StreamChat;
206
- /**
207
- * Resolved configuration, as a store. Delegates rather than holding a copy, so the field and the
208
- * controller's store cannot drift.
209
- *
210
- * Still directly writable, and deliberately so: the React SDK installs per-component request handlers
211
- * by calling `partialNext({ requestHandlers })` on it. That write bypasses the controller, which is
212
- * why `requestHandlers` is the one field a re-derivation replaces wholesale — see
213
- * {@link initializeConfig}.
214
- */
137
+ private disposedError;
215
138
  get configState(): StateStore<ChannelConfig>;
216
- /**
217
- * This channel's **resolved** configuration — the shape every configurable class exposes.
218
- *
219
- * Not to be confused with {@link serverConfig}, which is this channel's configuration as the
220
- * server reports it. This one has already folded that in: `typingEvents.enabled` is the server's
221
- * `typing_events` ANDed with whatever the integrator registered, so it is the whole answer. The
222
- * near-collision is why the server side became `serverConfig`, a getter that says what it
223
- * is.
224
- */
225
139
  get config(): Readonly<ChannelConfig>;
226
140
  /**
227
- * This channel's configuration as the server reports it — feature flags such as `uploads`,
228
- * `typing_events`, `read_events` and `commands`.
229
- *
230
- * Mostly a property of the channel *type*, but not only: a channel's own `config_overrides` narrow it
231
- * for that channel alone, which is why the cache behind this is keyed by cid rather than by type. See
232
- * `StreamChat._addChannelConfig`.
233
- *
234
- * `undefined` until this channel has been queried or watched — there is nothing to fall back on that
235
- * would not be another channel's overrides. {@link config} covers that case with its defaults.
236
- *
237
- * Distinct from {@link config}, which is this instance's resolved configuration and already has the
238
- * relevant flags below folded into it. Prefer `config` when deciding whether a feature is available:
239
- * this getter answers only the server's half, so gating UI on it offers features the client has
240
- * already disabled.
141
+ * The channel's configuration as the server reports it (`uploads`, `typing_events`, `commands`, ...),
142
+ * including this channel's `config_overrides`. `undefined` until the channel is queried or watched.
143
+ * Gate features on {@link config} instead: it also folds in what the integrator disabled.
241
144
  */
242
145
  get serverConfig(): import(".").ChannelConfigWithInfo | undefined;
243
- _sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<StreamResponse<import(".").SendMessageResponse>>;
244
146
  /**
245
- * Sends a message to this channel.
147
+ * Sends a message to this channel. Strips `localMetadata` from attachments and drops those whose
148
+ * upload never completed.
246
149
  *
247
150
  * @param ...args - `[request, requestOptions]`. `request` holds the message body and optional
248
151
  * flags such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`; `requestOptions`
249
152
  * carries per-request options such as an abort `signal` and is never serialized into the request.
250
153
  * @returns The server response.
251
154
  */
252
- sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<import(".").SendMessageResponse & {
253
- metadata: import("./types").RequestMetadata;
254
- }>;
255
- /**
256
- * Sends a message with optimistic local state update.
257
- */
258
- sendMessageWithLocalUpdate(params: SendMessageWithStateUpdateParams): Promise<void>;
259
- /**
260
- * Retry sending a failed message.
261
- */
262
- retrySendMessageWithLocalUpdate(params: Omit<SendMessageWithStateUpdateParams, 'message'>): Promise<void>;
263
- /**
264
- * Updates a message with optimistic local state update.
265
- */
266
- updateMessageWithLocalUpdate(params: UpdateMessageWithStateUpdateParams): Promise<void>;
267
- /**
268
- * Deletes a message with local state update.
269
- */
270
- deleteMessageWithLocalUpdate(params: DeleteMessageWithStateUpdateParams): Promise<void>;
155
+ sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<StreamResponse<import(".").SendMessageResponse>>;
156
+ sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<StreamResponse<import(".").SendReactionResponse>>;
157
+ deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<StreamResponse<import(".").DeleteReactionResponse>>;
271
158
  /**
272
- * Adds a reaction with an optimistic local state update - see {@link addReactionOptimistically}.
273
- */
274
- addReactionWithLocalUpdate({ messageId, reaction, options, }: {
275
- messageId: string;
276
- reaction: ReactionRequest;
277
- options?: Pick<SendReactionRequest, 'enforce_unique' | 'skip_push'>;
278
- }): Promise<void>;
279
- /**
280
- * Removes the current user's reaction with an optimistic local state update - see
281
- * {@link deleteReactionOptimistically}.
282
- */
283
- deleteReactionWithLocalUpdate({ messageId, type, }: {
284
- messageId: string;
285
- type: string;
286
- }): Promise<void>;
287
- /**
288
- * Upload a file to this channel's file endpoint (multipart).
159
+ * Uploads a file to this channel's file endpoint (multipart).
289
160
  *
290
161
  * @param request - Upload payload. `request.file` is the file to upload.
291
- * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
292
- * @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
162
+ * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
163
+ * (optional).
164
+ * @returns The upload response, with the CDN URL in `file`.
293
165
  */
294
166
  uploadChannelFile(request?: Omit<UploadChannelFileRequest, 'file'> & {
295
167
  file?: FileUploadInput;
296
168
  }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
297
169
  /**
298
- * Upload an image to this channel's image endpoint (multipart).
170
+ * Uploads an image to this channel's image endpoint (multipart).
299
171
  *
300
172
  * @param request - Upload payload. `request.file` is the image to upload.
301
- * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
302
- * @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
173
+ * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
174
+ * (optional).
175
+ * @returns The upload response, with the CDN URL in `file`.
303
176
  */
304
177
  uploadChannelImage(request?: Omit<UploadChannelRequest, 'file'> & {
305
178
  file?: FileUploadInput;
306
179
  }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelResponse>>;
307
- /**
308
- * Alias for {@link uploadChannelFile}, mirroring `client.uploadFile`.
309
- */
180
+ /** Alias for {@link uploadChannelFile}. */
310
181
  uploadFile: (...args: Parameters<Channel["uploadChannelFile"]>) => Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
311
- /** Alias for {@link uploadChannelImage}, mirroring `client.uploadImage`. */
182
+ /** Alias for {@link uploadChannelImage}. */
312
183
  uploadImage: (...args: Parameters<Channel["uploadChannelImage"]>) => Promise<StreamResponse<import(".").UploadChannelResponse>>;
313
- deleteFile(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
314
- deleteImage(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
315
184
  /**
316
- * Sends an event on this channel.
185
+ * Deletes a file uploaded to this channel, the same request shape as `client.deleteFile`.
317
186
  *
318
- * @param request - For example `{ event: { type: 'message.read' } }`.
187
+ * @param request - The file to delete. `request.url` is its URL.
319
188
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
320
189
  * into the request (optional).
321
190
  * @returns The server response.
322
191
  */
323
- sendEvent(request: {
324
- event: Event;
325
- }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").EventResponse>>;
192
+ deleteFile(request: {
193
+ url: string;
194
+ }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
195
+ /**
196
+ * Deletes an image uploaded to this channel, the same request shape as `client.deleteImage`.
197
+ *
198
+ * @param request - The image to delete. `request.url` is its URL.
199
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
200
+ * into the request (optional).
201
+ * @returns The server response.
202
+ */
203
+ deleteImage(request: {
204
+ url: string;
205
+ }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
326
206
  /**
327
207
  * Queries members.
328
208
  *
@@ -337,48 +217,19 @@ export declare class Channel extends ChannelApi {
337
217
  payload?: Partial<QueryMembersPayload>;
338
218
  }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MembersResponse>>;
339
219
  /**
340
- * Sends a reaction to a message. If offline support is enabled, it will make sure
341
- * that sending the reaction is queued up if it fails due to bad internet conditions and executed
342
- * later.
343
- *
344
- * @param ...args - `[request, requestOptions]`. `request` holds the target message ID, the
345
- * reaction object (e.g. `{ type: 'love' }`), and optional flags such as `enforce_unique` and
346
- * `skip_push`; `requestOptions` carries per-request options such as an abort `signal`.
347
- * When the call is queued for offline replay, `requestOptions` is queued with it - see the
348
- * note on signal persistence in `AbstractOfflineDB.queueTask`.
349
- * @returns The server response.
350
- */
351
- sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<import(".").SendReactionResponse & {
352
- metadata: import("./types").RequestMetadata;
353
- }>;
354
- _sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<StreamResponse<import(".").SendReactionResponse>>;
355
- deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<import(".").DeleteReactionResponse & {
356
- metadata: import("./types").RequestMetadata;
357
- }>;
358
- /**
359
- * Deletes a reaction by user and type.
360
- *
361
- * @param ...args - `[request, requestOptions]`. `request` identifies the target message and
362
- * reaction type; `requestOptions` carries per-request options such as an abort `signal` and is
363
- * never serialized into the request.
364
- * @returns The server response.
365
- */
366
- _deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<StreamResponse<import(".").DeleteReactionResponse>>;
367
- /**
368
- * Edit the channel using the inherited `update()` from `ChannelApi`. Caches the
369
- * server-returned channel onto `this.data`.
220
+ * Updates the channel and stores the returned channel in `this.data`.
370
221
  *
371
222
  * @param ...args - `[request, requestOptions]`. `request` is the channel update payload, e.g.
372
- * `{ data: { name: 'foo' }, message }`; `requestOptions` carries per-request options such as an
373
- * abort `signal` and is never serialized into the request.
223
+ * `{ data: { custom: { name: 'foo' } }, message }`; `requestOptions` carries per-request options
224
+ * such as an abort `signal` and is never serialized into the request.
374
225
  * @returns The server response.
375
226
  */
376
227
  update(...args: Parameters<ChannelApi['update']>): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
377
228
  /**
378
- * Partial update of channel properties.
229
+ * Partially updates the channel's properties and stores the returned channel in `this.data`.
379
230
  *
380
231
  * @param update - The partial update request.
381
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
232
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
382
233
  * into the request (optional).
383
234
  * @returns The server response.
384
235
  */
@@ -387,7 +238,7 @@ export declare class Channel extends ChannelApi {
387
238
  * Enables slow mode.
388
239
  *
389
240
  * @param coolDownInterval - The cooldown interval in seconds.
390
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
241
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
391
242
  * into the request (optional).
392
243
  * @returns The server response.
393
244
  */
@@ -395,11 +246,13 @@ export declare class Channel extends ChannelApi {
395
246
  /**
396
247
  * Disables slow mode.
397
248
  *
249
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
250
+ * second argument, as on the generated methods; pass `undefined`.
398
251
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
399
252
  * into the request (optional).
400
253
  * @returns The server response.
401
254
  */
402
- disableSlowMode(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
255
+ disableSlowMode(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
403
256
  sendSharedLocation(location: SharedLocation & {
404
257
  message_id?: string;
405
258
  }): Promise<import(".").SendMessageResponse & {
@@ -409,188 +262,183 @@ export declare class Channel extends ChannelApi {
409
262
  /**
410
263
  * Accepts an invitation to the channel.
411
264
  *
412
- * @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
265
+ * @param options - Other channel update options to send with it. Defaults to `{}`.
413
266
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
414
267
  * into the request (optional).
415
268
  * @returns The server response.
416
269
  */
417
- acceptInvite(options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
270
+ acceptInvite(options?: NonNullable<Parameters<ChannelApi['update']>[0]>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
418
271
  /**
419
272
  * Rejects an invitation to the channel.
420
273
  *
421
- * @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
274
+ * @param options - Other channel update options to send with it. Defaults to `{}`.
422
275
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
423
276
  * into the request (optional).
424
277
  * @returns The server response.
425
278
  */
426
- rejectInvite(options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
279
+ rejectInvite(options?: NonNullable<Parameters<ChannelApi['update']>[0]>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
427
280
  /**
428
281
  * Adds members to the channel.
429
282
  *
430
- * @param members - An array of members to add to the channel.
431
- * @param message - Message object for channel members notification (optional).
432
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
283
+ * @param request - The members to add, and any other channel update option.
284
+ * @param request.members - User IDs, or member requests (`{ user_id, channel_role?, custom? }`).
285
+ * @param request.message - Message object for channel members notification (optional).
433
286
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
434
287
  * into the request (optional).
435
288
  * @returns The server response.
436
289
  */
437
- addMembers(members: string[] | Array<Gen_ChannelMemberRequest>, message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
290
+ addMembers({ members, ...options }: AddMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
438
291
  /**
439
292
  * Adds filter tags to the channel.
440
293
  *
441
- * @param tags - An array of tags to add to the channel.
442
- * @param message - Message object for channel members notification (optional).
443
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
294
+ * @param request - The tags to add, and any other channel update option.
295
+ * @param request.tags - The tags to add.
296
+ * @param request.message - Message object for channel members notification (optional).
444
297
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
445
298
  * into the request (optional).
446
299
  * @returns The server response.
447
300
  */
448
- addFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
301
+ addFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
449
302
  /**
450
303
  * Removes filter tags from the channel.
451
304
  *
452
- * @param tags - An array of tags to remove from the channel.
453
- * @param message - Message object for channel members notification (optional).
454
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
305
+ * @param request - The tags to remove, and any other channel update option.
306
+ * @param request.tags - The tags to remove.
307
+ * @param request.message - Message object for channel members notification (optional).
455
308
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
456
309
  * into the request (optional).
457
310
  * @returns The server response.
458
311
  */
459
- removeFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
312
+ removeFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
460
313
  /**
461
314
  * Invite members to the channel.
462
315
  *
463
- * @param members - An array of members to invite to the channel.
464
- * @param message - Message object for channel members notification (optional).
465
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
316
+ * @param request - The members to invite, and any other channel update option.
317
+ * @param request.members - User IDs, or member requests (`{ user_id, custom }`).
318
+ * @param request.message - Message object for channel members notification (optional).
466
319
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
467
320
  * into the request (optional).
468
321
  * @returns The server response.
469
322
  */
470
- inviteMembers(members: string[] | Required<Omit<Gen_ChannelMemberRequest, 'channel_role'>>[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
323
+ inviteMembers({ members, ...options }: InviteMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
471
324
  /**
472
325
  * Removes members from the channel.
473
326
  *
474
- * @param members - An array of member identifiers.
475
- * @param message - Message object for channel members notification (optional).
476
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
327
+ * @param request - The members to remove, and any other channel update option.
328
+ * @param request.members - The user IDs to remove.
329
+ * @param request.message - Message object for channel members notification (optional).
477
330
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
478
331
  * into the request (optional).
479
332
  * @returns The server response.
480
333
  */
481
- removeMembers(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
334
+ removeMembers({ members, ...options }: RemoveMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
482
335
  /**
483
- * Mutes the current channel.
336
+ * Mutes the channel.
484
337
  *
485
338
  * @example
486
- * // with expiration
487
- * await channel.mute({ expiration: moment.duration(2, 'weeks') });
339
+ * // with expiration (two weeks)
340
+ * await channel.mute({ expiration: 14 * 24 * 60 * 60 * 1000 });
488
341
  *
489
- * @example
490
- * // server side
491
- * await channel.mute({ user_id: userId });
492
- *
493
- * @param options - Mute options (optional, defaults to `{}`).
494
- * @param options.expiration - Expiration in minutes (optional).
342
+ * @param options - Mute options (optional).
343
+ * @param options.expiration - Mute duration in milliseconds (optional).
495
344
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
496
345
  * into the request (optional).
497
346
  * @returns The server response.
498
347
  */
499
348
  mute(options?: Gen_MuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MuteChannelResponse>>;
500
349
  /**
501
- * Unmutes the current channel.
350
+ * Unmutes the channel.
502
351
  *
503
352
  * @example
504
- * // server side
505
- * await channel.unmute({ user_id: userId });
353
+ * await channel.unmute();
506
354
  *
507
- * @param options - Unmute options (optional, defaults to `{}`).
508
- * @param options.user_id - User ID (optional).
355
+ * @param options - Unmute options (optional).
509
356
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
510
357
  * into the request (optional).
511
358
  * @returns The server response.
512
359
  */
513
360
  unmute(options?: Gen_UnmuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnmuteResponse>>;
514
361
  /**
515
- * Archives the current channel.
362
+ * Archives the channel for the current user.
516
363
  *
517
364
  * @example
518
365
  * await channel.archive();
519
366
  *
367
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
368
+ * second argument, as on the generated methods; pass `undefined`.
520
369
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
521
370
  * into the request (optional).
522
371
  * @returns The server response.
523
372
  */
524
- archive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
373
+ archive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
525
374
  /**
526
- * Unarchives the current channel.
375
+ * Unarchives the channel for the current user.
527
376
  *
528
377
  * @example
529
378
  * await channel.unarchive();
530
379
  *
380
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
381
+ * second argument, as on the generated methods; pass `undefined`.
531
382
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
532
383
  * into the request (optional).
533
384
  * @returns The server response.
534
385
  */
535
- unarchive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
386
+ unarchive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
536
387
  /**
537
- * Pins the current channel.
388
+ * Pins the channel for the current user.
538
389
  *
539
390
  * @example
540
391
  * await channel.pin();
541
392
  *
393
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
394
+ * second argument, as on the generated methods; pass `undefined`.
542
395
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
543
396
  * into the request (optional).
544
397
  * @returns The server response.
545
398
  */
546
- pin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
399
+ pin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
547
400
  /**
548
- * Unpins the current channel.
401
+ * Unpins the channel for the current user.
549
402
  *
550
403
  * @example
551
404
  * await channel.unpin();
552
405
  *
406
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
407
+ * second argument, as on the generated methods; pass `undefined`.
553
408
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
554
409
  * into the request (optional).
555
410
  * @returns The server response.
556
411
  */
557
- unpin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
412
+ unpin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
558
413
  /**
559
- * Returns the mute status for the current channel.
414
+ * Returns the mute status of the channel.
560
415
  *
561
- * @returns An object of the form `{ muted: true | false, createdAt: number | null, expiresAt: number | null }`,
562
- * where the timestamps are unix nanoseconds as the API sends them.
416
+ * @returns `{ muted, createdAt, expiresAt }`, the timestamps in unix nanoseconds as the API sends
417
+ * them.
563
418
  */
564
419
  muteStatus(): import("./channel_state").ChannelMuteStatus;
565
420
  /**
566
- * Recomputes this channel's reactive `state.muteStatus` from the client's current `mutedChannels`
567
- * and publishes it only when it actually changed — so the frequent `health.check` fan-out does not
568
- * churn subscribers. Called from the constructor and by the client whenever `mutedChannels`
569
- * updates. Unlike `muteStatus()`, this does not require the channel to be initialized.
421
+ * Recomputes `state.muteStatus` from `client.mutedChannels`, publishing only on change (the client
422
+ * calls this on every `mutedChannels` update). Unlike `muteStatus()`, it needs no channel ID.
570
423
  */
571
424
  _syncMuteStatus(): void;
572
425
  sendAction(messageId: string, formData: Record<string, string>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MessageActionResponse>>;
573
426
  /**
574
- * First of the `typing.start` and `typing.stop` events based on the user's keystrokes.
575
- * Call this on every keystroke.
427
+ * Call on every keystroke: sends `typing.start` at most every 2 seconds.
576
428
  *
577
429
  * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
578
430
  *
579
- * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
580
- * @param options - Optional override carrying a `user_id` (optional).
431
+ * @param parentId - The parent message ID, for a typing event in a thread (optional).
581
432
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
582
433
  * into the request (optional).
583
434
  */
584
- keystroke(parentId?: string, options?: {
585
- user_id: string;
586
- }, requestOptions?: StreamRequestOptions): Promise<void>;
435
+ keystroke(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
587
436
  /**
588
- * Sends an event to update the AI state for a specific message.
589
- * Typically used by the server connected to the AI service to notify clients of state changes.
437
+ * Notifies watchers of a message's AI state. Meant for the server connected to the AI service.
590
438
  *
591
439
  * @param messageId - The ID of the message associated with the AI state.
592
440
  * @param state - The new state of the AI process, e.g. thinking, generating.
593
- * @param options - Parameters such as `ai_message` to include additional details in the event (optional, defaults to `{}`).
441
+ * @param options - Additional details for the event. Defaults to `{}`.
594
442
  * @param options.ai_message - Additional message detail to include in the event (optional).
595
443
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
596
444
  * into the request (optional).
@@ -602,170 +450,200 @@ export declare class Channel extends ChannelApi {
602
450
  * Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming.
603
451
  * Typically used by the server connected to the AI service to inform clients that the AI response has started.
604
452
  *
453
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
454
+ * second argument, as on the generated methods; pass `undefined`.
605
455
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
606
456
  * into the request (optional).
607
457
  */
608
- clearAIIndicator(requestOptions?: StreamRequestOptions): Promise<void>;
458
+ clearAIIndicator(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
609
459
  /**
610
460
  * Sends an event to stop AI response generation, leaving the message in its current state.
611
461
  * Triggered by the user to halt the AI response process.
612
462
  *
463
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
464
+ * second argument, as on the generated methods; pass `undefined`.
613
465
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
614
466
  * into the request (optional).
615
467
  */
616
- stopAIResponse(requestOptions?: StreamRequestOptions): Promise<void>;
468
+ stopAIResponse(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
617
469
  /**
618
- * Sets last typing to null and sends the `typing.stop` event.
470
+ * Resets the typing state and sends `typing.stop`.
619
471
  *
620
- * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
621
- *
622
- * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
623
- * @param options - Optional override carrying a `user_id` (optional).
472
+ * @param parentId - The parent message ID, for a typing event in a thread (optional).
624
473
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
625
474
  * into the request (optional).
626
475
  */
627
- stopTyping(parentId?: string, options?: {
628
- user_id: string;
629
- }, requestOptions?: StreamRequestOptions): Promise<void>;
476
+ stopTyping(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
630
477
  _isTypingIndicatorsEnabled(): boolean;
631
478
  /**
632
- * Run this user's mark-read reporter for this channel. Delegates to
633
- * `MessageDeliveryReporter`, which batches the underlying `markRead` request
634
- * with the user's read receipts state.
635
- *
636
- * Use the inherited `markRead()` from `ChannelApi` for a direct, unbatched call.
479
+ * Whether read events are on. `config.readEvents.enabled` (the channel type's `read_events` and
480
+ * the client configuration) and the own `read-events` capability allow them. Unread messages are
481
+ * counted and marked read only while it is true, unless `readEvents.localUnreadCountEnabled` keeps
482
+ * a local count.
483
+ */
484
+ get readEventsEnabled(): boolean;
485
+ /**
486
+ * Marks read through `MessageDeliveryReporter`: uses the `markReadRequest` handler if set, marks
487
+ * read locally when read events are off and `localUnreadCountEnabled` is set, and drops the
488
+ * delivery candidate when a request went out. `markRead()` does none of this.
637
489
  *
638
- * @param data - Mark read options (optional, defaults to `{}`).
490
+ * @param data - Mark read options. Defaults to `{}`.
491
+ * @returns The server response, or `null` when no request went out.
639
492
  */
640
493
  markReadViaReporter(data?: MarkReadRequest): Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
641
494
  /**
642
- * Override of the inherited `markRead()` from `ChannelApi` that requires the
643
- * channel to be initialized and respects the `read_events` channel config.
495
+ * Marks the channel read.
644
496
  *
645
497
  * @param ...args - `[data, requestOptions]`. `data` holds the mark-read options;
646
498
  * `requestOptions` carries per-request options such as an abort `signal` and is never
647
499
  * serialized into the request.
648
- * @returns The server response, or `null` if the request was skipped.
500
+ * @returns The server response.
501
+ * @throws If the channel is not initialized or read events are disabled.
649
502
  */
650
503
  markRead(...args: Parameters<ChannelApi['markRead']>): Promise<StreamResponse<MarkReadResponse>>;
651
- /**
652
- * A vague indication of whether the channel exists on the chat backend — `true` once
653
- * `create()`/`query()`/`watch()` has run. Store-backed and reactive: subscribe via
654
- * `useStateStore(channel.state, (s) => ({ initialized: s.initialized }))`.
655
- */
504
+ /** See {@link ChannelLifecycleState.initialized}. */
656
505
  get initialized(): boolean;
657
506
  set initialized(initialized: boolean);
658
507
  /**
659
- * Whether the channel was initialized by manually populating its state (offline hydration) rather
660
- * than a live watch. Store-backed and reactive.
508
+ * Whether the channel has no ID yet: it was built from members and the server assigns the ID when its
509
+ * query is answered. Until then only that query can be sent and the cid is a temporary one.
510
+ *
511
+ * Not reactive: subscribe to {@link Channel.initialized}, which turns `true` with the response that
512
+ * sets `id`.
661
513
  */
514
+ get isProvisional(): boolean;
515
+ /**
516
+ * See {@link ChannelLifecycleState.supersededBy}. A superseded instance receives no events and
517
+ * reports `watchStatus: NotWatching`: use its successor (`watch()` resolves with it). The SDK
518
+ * does not disconnect it before logout, so call {@link Channel.disconnect} once nothing uses it.
519
+ */
520
+ get supersededBy(): Channel | undefined;
521
+ /** See {@link ChannelLifecycleState.offlineMode}. */
662
522
  get offlineMode(): boolean;
663
523
  set offlineMode(offlineMode: boolean);
664
524
  /**
665
- * Whether the channel has been torn down and is awaiting disposal (deleted, the current user
666
- * removed, or the client disconnected). Store-backed and reactive.
667
- *
668
- * One-way and terminal — there is no counterpart that revives the instance. Its resources are
669
- * already released ({@link Channel._disconnect} disposes the paginators and unregisters the
670
- * subscriptions) and the client drops it from `activeChannels` right after, so nothing should
671
- * touch it: it is skipped by the `client.activeChannels` lookups (so `client.channel(…)` mints a
672
- * fresh instance), never re-watched on recovery, refused as a source of `channel.data` by the
673
- * offline DB, and `getClient()` throws on it so a reference held across a `disconnectUser()`
674
- * fails loudly instead of quietly requesting on a client with no user.
525
+ * Reads `state.data`. Assigning publishes `data`, `memberCount` and `ownCapabilities` in one update.
526
+ * If the object omits `member_count` or `own_capabilities`, the last known values are carried onto
527
+ * a copy (the assigned object is not changed). Editing `channel.data.x` in place does not reach
528
+ * the state. `ownCapabilities` keeps its array while the capabilities stay the same (in any
529
+ * order), so a subscriber to it is notified only when they change.
675
530
  */
676
- get pendingDisposal(): boolean;
677
- set pendingDisposal(pendingDisposal: boolean);
531
+ get data(): Partial<ChannelResponse> | undefined;
532
+ set data(next: Partial<ChannelResponse> | undefined);
678
533
  /**
679
- * Whether this client holds a server-side watch on the channel, and if not, whether it should be
680
- * restored — see {@link ChannelWatchStatus}. Store-backed and reactive: subscribe via
681
- * `useStateStore(channel.state, (s) => ({ watchStatus: s.watchStatus }))`.
534
+ * See {@link ChannelLifecycleState.pendingDisposal}. Set only by {@link Channel.disconnect} and never
535
+ * reverted: `getClient()` throws, `client.channel()` returns a fresh instance for the
536
+ * cid, and lists and recovery skip it.
682
537
  */
538
+ get pendingDisposal(): boolean;
539
+ /** See {@link ChannelWatchStatus}. */
683
540
  get watchStatus(): ChannelWatchStatus;
684
541
  set watchStatus(watchStatus: ChannelWatchStatus);
685
542
  /**
686
- * Whether a consumer has declared this channel as the one it is currently consuming (see
687
- * {@link Channel.activate}). Reactive — subscribe via
688
- * `useStateStore(channel.state, (s) => ({ active: s.active }))`.
543
+ * Whether a query for this channel (`watch()`, `query()`, `create()` or one of the message
544
+ * paginator's own queries, see {@link runTrackedQuery}) awaits its response. The channel store
545
+ * keeps the channel meanwhile.
546
+ *
547
+ * @internal
689
548
  */
549
+ get isQueryingChannel(): boolean;
550
+ /** See {@link Channel.activate}. */
690
551
  get active(): boolean;
691
552
  /**
692
- * Declares that a consumer is now consuming this channel's own state (mirrors
693
- * `thread.activate()`). Refcounted, as a single `Channel` instance can be held by several
694
- * consumers at once, so it stays active until the last one deactivates.
553
+ * Declares that a consumer is consuming this channel's own state and returns its release function.
554
+ * Refcounted: the channel stays active until the last consumer releases, and releasing twice is a
555
+ * no-op.
695
556
  *
696
- * While active, the channel's own state takes precedence over bulk state writes: channel-list
697
- * hydration does not re-seed its message list (its own `channel.reload()` owns that window).
698
- */
699
- activate: () => void;
700
- /**
701
- * Declares that a consumer has stopped consuming this channel (mirrors `thread.deactivate()`).
702
- * Only flips `active` back to `false` once the last holder deactivates.
557
+ * While active, channel-list hydration places no page in the message list (`channel.reload()`
558
+ * owns it), the message list keeps its active interval (otherwise a fresh newest page from a
559
+ * query the list did not run is shown), and the channel stays in the channel store. A disposed
560
+ * channel is not activated: a warning is logged and the returned release does nothing.
703
561
  */
704
- deactivate: () => void;
562
+ activate: () => (() => void);
705
563
  /**
706
- * Marks the channel as unread from `messageId`. Only works when the `read_events` setting is enabled.
564
+ * Marks the channel unread from a message.
707
565
  *
708
566
  * @param ...args - `[data, requestOptions]`. `data` holds the mark-unread options;
709
567
  * `requestOptions` carries per-request options such as an abort `signal` and is never
710
568
  * serialized into the request.
711
- * @returns An API response, or `null` if the request was skipped.
569
+ * @returns The server response.
570
+ * @throws If the channel is not initialized or read events are disabled.
712
571
  */
713
572
  markUnread(...args: Parameters<ChannelApi['markUnread']>): Promise<StreamResponse<import(".").Response>>;
714
573
  /**
715
- * Resets this user's unread count locally, without any backend call. Intended for
716
- * channels that have read events disabled (e.g. livestreams) when the client is created with the
717
- * `isLocalUnreadCountEnabled` option. Dispatches a dedicated, client-only `message.read_locally` event
718
- * that runs through the same `_handleChannelEvent` read logic as a real `message.read` (minus the
719
- * delivery-report network sync), so the read-state update lives in one place. When offline support
720
- * is enabled, the offline DB persists the reset for read-events-disabled channels, so the local
721
- * count stays consistent across app restarts.
574
+ * Resets the unread count without a backend call, for channels with read events off
575
+ * ({@link Channel.readEventsEnabled}, e.g. livestreams) that set `readEvents.localUnreadCountEnabled`. Dispatches the client-only
576
+ * `message.read_locally` event, handled like `message.read` minus the delivery-report sync. With
577
+ * offline support the reset is persisted.
578
+ *
579
+ * The event's `last_read_message_id` is the newest server-confirmed message, whatever its type,
580
+ * of the interval holding the channel's newest messages
581
+ * (`messagePaginator.anchoredHeadServerConfirmedItem`). While that interval is not loaded (e.g.
582
+ * only a jumped-to interval is), the event carries none and the read covers everything up to its
583
+ * `created_at`.
722
584
  *
723
- * @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected user.
585
+ * @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected
586
+ * user.
724
587
  */
725
588
  markReadLocally(): ({
726
589
  type: "message.read_locally";
727
590
  } & {
728
591
  channel_type: string;
729
592
  cid: string;
730
- created_at: number;
593
+ created_at: TimestampNS;
731
594
  channel_id?: string;
732
595
  last_read_message_id?: string;
733
596
  team?: string;
734
597
  user?: UserResponse;
735
598
  } & {
736
- received_at?: number;
599
+ received_at?: TimestampNS;
737
600
  }) | undefined;
738
601
  /**
739
- * Cleans the channel state and fires stop typing if needed.
602
+ * Sends `typing.stop` after a second without a keystroke, drops stale typing users, and resets a
603
+ * stuck AI indicator while the connection is unhealthy. Run by the client's cleaning interval.
604
+ *
605
+ * @internal
740
606
  */
741
607
  clean(): void;
742
608
  /**
743
- * Loads the initial channel state and watches for changes.
609
+ * Watches the channel and loads its state and messages. Sends nothing when that is done already
610
+ * (`Watching`, `initialized` and `messagePaginator.hasResults`) and the call asks for nothing
611
+ * new: it passes no options, or the same options as the last `watch()` that succeeded during the
612
+ * current watch. Other options, e.g. `presence: true`, send a query. A `watch()` already in
613
+ * flight with the same options is joined, not repeated.
614
+ * Refresh a watched channel with {@link Channel.reload}. Rejects with the query's error.
744
615
  *
745
- * @param options - Additional options for the query endpoint (optional).
746
- * @returns The server response.
616
+ * @param options - Options for the watch query (optional).
617
+ * @param requestOptions - Per-request options (optional). Aborting `signal` ends this caller's
618
+ * wait (at once if aborted already); the query is cancelled once every waiting caller has
619
+ * aborted. The other options apply only when this call sends the query.
620
+ * @returns The instance to use: this one, or the one that superseded it ({@link supersededBy}).
747
621
  */
748
- watch(options?: ChannelGetOrCreateRequest): Promise<StreamResponse<import(".").ChannelStateResponse>>;
622
+ watch(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<Channel>;
749
623
  /**
750
- * Re-watch the channel and refresh its FULL loaded message window — the channel analog of
751
- * {@link Thread.reload}. Used on reconnect to catch up AND reconcile hard deletes that happened
752
- * while offline: a hard delete reaches other clients via no event, so an offline client only learns
753
- * of it by diffing the re-queried page.
754
- *
755
- * This is intentionally thin: it only re-issues `watch()` with a limit sized to the loaded window
756
- * (`items.length`, so the whole loaded window is refreshed — not the smaller channel-list page). The
757
- * actual fold + destructive reconciliation happens inside `query()` → `seedFirstPageSync`
758
- * (the same path the channel-list re-hydrate and connection recovery use), driven by the loaded-id
759
- * snapshot `query()` captures before its await. Owning that single path is what lets the SDK stop
760
- * passing the reconciliation window/snapshot itself.
624
+ * Sends the query {@link Channel.watch} callers wait for. It is cancelled through an abort
625
+ * controller of its own, once no caller waits any more ({@link leaveWatchQuery}).
626
+ */
627
+ private sendWatchQuery;
628
+ /** A caller stops waiting; the last one cancels and forgets the query, so the next is new. */
629
+ private leaveWatchQuery;
630
+ /** Stops offering `watchQuery` to {@link Channel.watch} callers. */
631
+ private forgetWatchQuery;
632
+ /**
633
+ * Sends a watch query, watched or not, and places the page it fetched (a page at a cursor or
634
+ * around a message is only stored; `messagePaginator.jumpToMessage()` shows it).
635
+ * `requestOptions.signal` also ends the wait for a live socket.
636
+ */
637
+ private runWatchQuery;
638
+ /**
639
+ * Re-watches the channel and refreshes its whole loaded message interval (the channel analogue of
640
+ * {@link Thread.reload}). Used on reconnect. Hard deletes reach other clients through no event, so
641
+ * the watch query reconciles the loaded newest messages with the re-queried page
642
+ * (`messagePaginator.reconcileNewestMessages`, against the loaded IDs captured before its await).
761
643
  *
762
- * Preserves failed (unsent) messages: an overlap merge keeps them (the reconcile's provenance guard
763
- * never prunes a non-server message); only a disjoint rebuild can drop them, so any that actually
764
- * fell out are re-ingested below. The offline DB is consulted alongside the in-memory window, because
765
- * a failed message can be absent from memory and still be the user's unsent work — a cold boot starts
766
- * with an empty paginator, and an eviction can drop it mid-session. v9 got this from a second, lagging
767
- * copy of the list (the React SDK's own state); with one reactive source of truth the persisted row is
768
- * that buffer.
644
+ * Failed (unsent) messages are kept: those loaded or in the offline DB (cold boot, eviction)
645
+ * before the request that are no longer loaded after it are ingested again. The offline DB is
646
+ * read on a best-effort basis.
769
647
  */
770
648
  reload(): Promise<void>;
771
649
  /**
@@ -778,85 +656,152 @@ export declare class Channel extends ChannelApi {
778
656
  */
779
657
  stopWatching(...args: Parameters<ChannelApi['stopWatching']>): Promise<StreamResponse<import(".").Response>>;
780
658
  /**
781
- * Retrieves a list of messages by ID.
659
+ * Retrieves messages of this channel by ID.
782
660
  *
783
- * @param messageIds - The IDs of the messages to retrieve from this channel.
661
+ * @param messageIds - The IDs of the messages to retrieve.
784
662
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
785
663
  * into the request (optional).
786
- * @returns Server response.
664
+ * @returns The server response.
787
665
  */
788
666
  getMessagesById(messageIds: string[], requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").GetManyMessagesResponse>>;
789
667
  /**
790
- * Returns the last time the user marked the channel as read. If the user never marked the channel as read, this will return `null`.
668
+ * Returns when the current user last marked the channel read.
791
669
  *
792
670
  * @returns The last-read timestamp in unix nanoseconds, `null` if never read, or `undefined` if
793
671
  * the user is unset.
794
672
  */
795
- lastRead(): number | null | undefined;
673
+ lastRead(): TimestampNS | null | undefined;
796
674
  _countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
797
675
  /**
798
- * Count of unread messages.
676
+ * Counts the unread messages.
799
677
  *
800
- * @param lastRead - The time that the user read a message, in unix nanoseconds (optional,
801
- * defaults to the current user's read state).
802
- * @returns Unread count.
678
+ * Counting from `lastRead` counts within the channel's newest messages that are loaded (see
679
+ * {@link newestKnownMessages}).
680
+ *
681
+ * @param lastRead - The time the user read a message, in unix nanoseconds (optional). Defaults to
682
+ * the current user's read state.
683
+ * @returns The unread count.
684
+ */
685
+ countUnread(lastRead?: TimestampNS | null): number;
686
+ /**
687
+ * The channel's newest messages that are loaded: the interval that reaches the newest message (the
688
+ * paginator's anchored head), or, while that interval is not loaded, the messages received live
689
+ * since. An interval reached by a jump is never part of it, as the messages between it and the
690
+ * newest are unknown.
803
691
  */
804
- countUnread(lastRead?: number | null): number;
692
+ private newestKnownMessages;
805
693
  /**
806
- * Count the number of unread messages mentioning the current user.
694
+ * Lowers the own unread count by the unread ones among `deletedMessages`, as they were before the
695
+ * delete. The server lowers it for every unread message deleted, except in a soft bulk delete
696
+ * (`user.messages.deleted`), and does not send the new count. Unread messages that are not loaded
697
+ * cannot be counted; the next query brings the server's count.
807
698
  *
808
- * @returns Unread mentions count.
699
+ * @internal
700
+ */
701
+ _lowerUnreadCountForDeletedMessages(deletedMessages: LocalMessage[]): void;
702
+ /**
703
+ * Counts the unread messages that mention the current user, within the channel's newest messages
704
+ * that are loaded (see {@link newestKnownMessages}).
705
+ *
706
+ * @returns The unread mentions count.
809
707
  */
810
708
  countUnreadMentions(): number;
811
709
  /**
812
- * Creates a new channel.
710
+ * Creates the channel without watching it.
813
711
  *
814
712
  * @param options - Channel query options (optional).
815
713
  * @returns The server response.
816
714
  */
817
- create: (options?: ChannelGetOrCreateRequest) => Promise<StreamResponse<import(".").ChannelStateResponse>>;
715
+ create: (options?: ChannelGetOrCreateRequest) => Promise<StreamResponse<ChannelStateResponse>>;
716
+ /**
717
+ * Moves this channel, created without an ID, from its temporary cid to the one the server gave it.
718
+ * If another instance already holds that cid, it stays stored and takes over from this one
719
+ * ({@link ChannelManager.supersedeChannel}).
720
+ */
721
+ private storeUnderServerCid;
818
722
  /**
819
- * Queries the API to load messages, members, or other channel fields.
723
+ * Queries the API for messages, members and other channel fields.
724
+ *
725
+ * The returned messages are not added to {@link Channel.messagePaginator}: the paginator loads its
726
+ * own pages, and {@link Channel.watch} / {@link Channel.create} place the page they query.
820
727
  *
821
728
  * @param options - The query options (optional, defaults to `{}`).
822
- * @param messageSetToAddToIfDoesNotExist - It's possible to load disjunct sets of a channel's
823
- * messages into state. Use `current` to load the initial channel state or to extend the
824
- * currently displayed messages; use `latest` to load/extend the latest messages; `new` is
825
- * used for loading a specific message and its surroundings (optional, defaults to `'current'`).
826
729
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
827
730
  * into the request (optional).
828
- * @returns A query response.
731
+ * @returns The query response.
829
732
  */
830
- query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ChannelStateResponse>>;
733
+ query(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<ChannelStateResponse>>;
831
734
  /**
832
- * Bans a user from a channel.
735
+ * The query behind `query()`, `watch()` and `create()`, in three steps: sends the request
736
+ * ({@link requestChannelState}), has the message paginator place the returned page when
737
+ * `placeMessages` is set (a watch query), then applies the rest of the response
738
+ * ({@link applyChannelStateFromResponse}), all as a tracked query ({@link runTrackedQuery}).
833
739
  *
834
- * @param targetUserId - The user to ban.
835
- * @param options - Ban options.
836
- * @returns The server response.
740
+ * The page is placed before the rest is applied, because the rest reads the loaded messages: read
741
+ * and delivery positions that come without a message id are looked up among them, and the latest
742
+ * message is reported as delivered. A first page then takes the unread snapshot, from the read
743
+ * state the rest brought. The message paginator's own queries keep the same order: they place
744
+ * their page, then apply the rest with {@link applyChannelStateFromResponse}.
837
745
  */
838
- banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
746
+ private runChannelQuery;
839
747
  /**
840
- * Hides the channel from `queryChannels` for the user until a message is added.
841
- * If `clear_history` is set to `true`, all messages will be removed for the user.
748
+ * Runs `run`, a query of this channel, as a tracked query: refused for a disposed instance, and
749
+ * the channel counts as being queried until `run` settles ({@link isQueryingChannel}), so the
750
+ * channel store keeps it meanwhile. Used by {@link runChannelQuery} and by the message
751
+ * paginator's own queries.
842
752
  *
843
- * @param ...args - `[request, requestOptions]`. Pass `request: { clear_history: true }` to clear
844
- * message history for the user; `requestOptions` carries per-request options such as an abort
845
- * `signal` and is never serialized into the request.
846
- * @returns The server response.
753
+ * `run` starts synchronously: a paginator query publishes its loading flag before anything is
754
+ * awaited, which keeps a second query in the same tick from starting.
755
+ *
756
+ * @internal
847
757
  */
848
- hide(...args: Parameters<ChannelApi['hide']>): Promise<StreamResponse<import(".").HideChannelResponse>>;
758
+ runTrackedQuery<T>(run: () => Promise<T>): Promise<T>;
849
759
  /**
850
- * Removes the hidden status for a channel. Ensures the channel is initialized first.
760
+ * Sends the channel query and takes in what the response says about the channel itself: its id,
761
+ * the cid it is stored under, its config, and its `last_message_at`, against which the message
762
+ * paginator's head interval is checked before any page is placed (see
763
+ * `MessagePaginator.unmarkStaleHead`). The request of {@link runChannelQuery} and of the message
764
+ * paginator's own queries, which run it as a tracked query ({@link runTrackedQuery}); it does not
765
+ * track the query itself. Refused for a disposed instance, before anything is sent.
851
766
  *
852
- * @param ...args - `[request, requestOptions]`. `request` is the show-channel payload;
853
- * `requestOptions` carries per-request options such as an abort `signal` and is never
854
- * serialized into the request.
767
+ * `placesNewestPage`: the caller places the newest page with this response, which brings the
768
+ * newest messages up to date, so the head interval is not checked.
769
+ *
770
+ * @internal
771
+ */
772
+ requestChannelState(options: ChannelGetOrCreateRequest, requestOptions: StreamRequestOptions | undefined, { placesNewestPage }?: {
773
+ placesNewestPage?: boolean;
774
+ }): Promise<StreamResponse<ChannelStateResponse>>;
775
+ /**
776
+ * Whether nothing but this query brings the head interval up to date, so its `last_message_at` may
777
+ * show the interval stale: the watch was stopped (`NotWatching`), or this query itself watches
778
+ * again after a dropped connection (`WasWatching`), leaving nothing to re-watch with the newest
779
+ * page. While the channel is watched, a message the interval lacks is still on its way; after a
780
+ * dropped connection, the re-watch that follows places the newest page (see
781
+ * `ConnectionRecoveryManager`).
782
+ */
783
+ private isHeadLeftWithoutRefresh;
784
+ /**
785
+ * Applies a channel query response: watch status, read/members state, polls, reminders, composer,
786
+ * channel data, and the `channels.queried` event and offline write. Called once the response's
787
+ * page of messages, if any, is placed (see {@link runChannelQuery}).
788
+ *
789
+ * @internal
790
+ */
791
+ applyChannelStateFromResponse(state: ChannelStateResponseFields, { isLatestMessageSet, watch }: {
792
+ isLatestMessageSet: boolean;
793
+ watch?: boolean;
794
+ }): void;
795
+ /**
796
+ * Bans a user from this channel.
797
+ *
798
+ * @param targetUserId - The user to ban.
799
+ * @param options - Ban options.
855
800
  * @returns The server response.
856
801
  */
857
- show(...args: Parameters<ChannelApi['show']>): Promise<StreamResponse<import(".").ShowChannelResponse>>;
802
+ banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
858
803
  /**
859
- * Removes the bans for a user on a channel.
804
+ * Removes the bans of a user on this channel.
860
805
  *
861
806
  * @param targetUserId - The user to unban.
862
807
  * @param options - Unban options (optional).
@@ -864,33 +809,27 @@ export declare class Channel extends ChannelApi {
864
809
  */
865
810
  unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<import("./types").APIResponse>;
866
811
  /**
867
- * Casts or cancels one or more votes on a poll.
812
+ * Casts a vote on a poll. `removeVote()` removes one.
868
813
  *
869
- * @param ...args - `[request, requestOptions]`. `request` holds the target message ID, poll ID,
870
- * and the vote to cast (or an empty payload to cancel); `requestOptions` carries per-request
871
- * options such as an abort `signal` and is never serialized into the request.
814
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams` holds the target
815
+ * `message_id` and `poll_id`; `request` holds the vote to cast; `requestOptions` carries
816
+ * per-request options such as an abort `signal` and is never serialized into the request.
872
817
  * @returns The poll vote response.
873
818
  */
874
819
  vote(...args: Parameters<ChatApi['castPollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
875
820
  removeVote(...args: Parameters<ChatApi['deletePollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
876
821
  _createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<StreamResponse<import(".").CreateDraftResponse>>;
877
- /**
878
- * Creates or updates a draft message in a channel. If offline support is enabled, the
879
- * call is queued so it is replayed on reconnect.
880
- */
822
+ /** Creates or updates a draft. With offline support the call is queued and replayed on reconnect. */
881
823
  createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<import(".").CreateDraftResponse & {
882
824
  metadata: import("./types").RequestMetadata;
883
825
  }>;
884
826
  _deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<StreamResponse<import(".").Response>>;
885
- /**
886
- * Deletes a draft message from a channel or a thread. If offline support is enabled, the
887
- * call is queued so it is replayed on reconnect.
888
- */
827
+ /** Deletes a draft. With offline support the call is queued and replayed on reconnect. */
889
828
  deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<import(".").Response & {
890
829
  metadata: import("./types").RequestMetadata;
891
830
  }>;
892
831
  /**
893
- * Listens to events on this channel.
832
+ * Listens to events on this channel. A callback alone listens to all events.
894
833
  *
895
834
  * @example
896
835
  * channel.on('message.new', (event) => {
@@ -902,48 +841,71 @@ export declare class Channel extends ChannelApi {
902
841
  * console.log(event.type);
903
842
  * });
904
843
  *
905
- * @param callbackOrString - The event type to listen for, or the callback when listening to all events.
906
- * @param callbackOrNothing - The callback to call when an event type was provided (optional).
844
+ * @param eventType - The event type to listen for.
845
+ * @param callback - Called with each event of that type.
907
846
  * @returns An object with an `unsubscribe()` method.
908
847
  */
909
- on<T extends EventType | string>(eventType: T, callback: EventHandler<T>): {
848
+ on<T extends EventType>(eventType: T, callback: EventHandler<T>): {
910
849
  unsubscribe: () => void;
911
850
  };
851
+ /**
852
+ * Listens to all events on this channel.
853
+ *
854
+ * @param callback - Called with every event.
855
+ * @returns An object with an `unsubscribe()` method.
856
+ */
912
857
  on(callback: EventHandler): {
913
858
  unsubscribe: () => void;
914
859
  };
915
860
  /**
916
- * Removes the event handler.
861
+ * Removes a listener for one event type.
917
862
  *
918
- * @param callbackOrString - The event type, or the callback when removing an all-events listener.
919
- * @param callbackOrNothing - The callback to remove when an event type was provided (optional).
863
+ * @param eventType - The event type it listens to.
864
+ * @param callback - The listener to remove.
865
+ */
866
+ off<T extends EventType>(eventType: T, callback: EventHandler<T>): void;
867
+ /**
868
+ * Removes a listener for all events.
869
+ *
870
+ * @param callback - The listener to remove.
920
871
  */
921
- off<T extends EventType | string>(eventType: T, callback: EventHandler): void;
922
872
  off(callback: EventHandler): void;
923
873
  private _patchReadState;
924
874
  private _upsertReadState;
925
875
  /**
926
- * Sets the current user's unread count. The count lives in exactly one place — the reactive
927
- * `read[userId].unread_messages`, which is what the unread badge reads and what
928
- * `state.unreadCount` derives from — so channel-wide resets (`channel.truncated`, "all channels
929
- * read") must route through here rather than writing a count of their own.
876
+ * Sets the current user's unread count in `read[userId].unread_messages`, the one place it lives
877
+ * (`state.unreadCount` derives from it). Returns whether the count changed.
930
878
  */
931
- /** @returns whether the count actually changed, so callers can react only to the channels it did. */
932
879
  _setOwnUnreadCount(unreadCount: number): boolean;
933
880
  _handleChannelEvent(event: Event): void;
934
- _callChannelListeners: (event: WSEvent) => void;
881
+ _callChannelListeners: (event: Event) => void;
882
+ /**
883
+ * Throws if the channel has no ID (created from members only). Narrows `id` to `string`. Call it
884
+ * before any request that uses `this.cid`: it is a string (possibly temporary) even without an ID,
885
+ * so TypeScript does not flag a missing check.
886
+ */
887
+ _checkHasId(): asserts this is this & {
888
+ id: string;
889
+ };
890
+ /** Throws unless the channel was queried or populated from the offline DB. */
935
891
  _checkInitialized(): void;
936
892
  _initializeState(state: ChannelStateResponseFields): void;
937
893
  _extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
938
894
  _hydrateMembers({ members, overrideCurrentState, }: {
939
895
  members: ChannelMemberResponse[];
940
- /**
941
- * If set to `true` then `ChannelState.members` will be overriden with the newly
942
- * provided `members`, setting this property to `false` will merge current `ChannelState.members`
943
- * object with the newly provided `members`
944
- * (new members with the same `userId` will replace the old ones).
945
- */
896
+ /** `true` replaces `state.members`. `false` merges (a new member replaces one with the same ID). */
946
897
  overrideCurrentState?: boolean;
947
898
  }): void;
948
- _disconnect(): void;
899
+ /**
900
+ * Ends the instance for good: unsubscribes from the configuration and the server config, stops the
901
+ * receipts tracker and the cooldown timer, disposes both paginators, then sets
902
+ * `pendingDisposal: true` and `watchStatus: NotWatching`. It sends no request, so the server keeps a
903
+ * watch this connection held until the connection ends. Calling it again does nothing.
904
+ *
905
+ * The SDK calls it when a channel ends (deleted, current user removed, logout, released as unused).
906
+ * It does not remove the channel from the channel store. The SDK's own ends remove it; after a
907
+ * direct call it stays until `client.channelManager.releaseUnusedChannels()`, or until `ensure()`
908
+ * for the same cid replaces it.
909
+ */
910
+ disconnect(): void;
949
911
  }