stream-chat 10.0.0-rc.8 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/README.md +7 -6
  2. package/dist/cjs/index.browser.js +22095 -22290
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +22143 -22298
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +22093 -22288
  7. package/dist/esm/index.mjs.map +4 -4
  8. package/dist/types/ChannelManager.d.ts +216 -135
  9. package/dist/types/CooldownTimer.d.ts +16 -27
  10. package/dist/types/EventHandlerPipeline.d.ts +18 -38
  11. package/dist/types/LiveLocationManager.d.ts +25 -47
  12. package/dist/types/api-client.d.ts +17 -5
  13. package/dist/types/channel.d.ts +435 -500
  14. package/dist/types/channel_state.d.ts +72 -112
  15. package/dist/types/client.d.ts +323 -440
  16. package/dist/types/client_state.d.ts +1 -3
  17. package/dist/types/configuration/ConfigController.d.ts +31 -125
  18. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +32 -124
  19. package/dist/types/configuration/keys.d.ts +5 -19
  20. package/dist/types/configuration/shape.d.ts +12 -29
  21. package/dist/types/configuration/types.d.ts +64 -79
  22. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +14 -36
  23. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  24. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  25. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  26. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  27. package/dist/types/connection/ConnectionIdManager.d.ts +45 -0
  28. package/dist/types/connection/ConnectionRecoveryManager.d.ts +84 -0
  29. package/dist/types/connection/index.d.ts +4 -0
  30. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +82 -0
  31. package/dist/types/connection/networkConnection/index.d.ts +3 -0
  32. package/dist/types/connection/networkConnection/reporters.d.ts +20 -0
  33. package/dist/types/connection/networkConnection/types.d.ts +40 -0
  34. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +137 -0
  35. package/dist/types/connection/wsConnection/WSConnection.d.ts +105 -0
  36. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +47 -0
  37. package/dist/types/connection/wsConnection/config.d.ts +31 -0
  38. package/dist/types/connection/wsConnection/index.d.ts +4 -0
  39. package/dist/types/connection/wsConnection/types.d.ts +46 -0
  40. package/dist/types/constants.d.ts +3 -1
  41. package/dist/types/custom_types.d.ts +0 -2
  42. package/dist/types/entityStore/EntityStore.d.ts +226 -65
  43. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +19 -33
  44. package/dist/types/entityStore/index.d.ts +0 -1
  45. package/dist/types/errors.d.ts +16 -19
  46. package/dist/types/formatMessageMemo.d.ts +5 -0
  47. package/dist/types/gen/chat/ChannelApi.d.ts +5 -1
  48. package/dist/types/gen/chat/ChatApi.d.ts +149 -105
  49. package/dist/types/gen/models/index.d.ts +2540 -698
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +37 -14
  52. package/dist/types/index.d.ts +10 -5
  53. package/dist/types/{i18n/languageNames.d.ts → languageNames.d.ts} +9 -24
  54. package/dist/types/logger.d.ts +1 -3
  55. package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
  56. package/dist/types/messageComposer/LocationComposer.d.ts +8 -2
  57. package/dist/types/messageComposer/attachmentIdentity.d.ts +24 -0
  58. package/dist/types/messageComposer/attachmentManager.d.ts +52 -24
  59. package/dist/types/messageComposer/attachmentUtils.d.ts +23 -0
  60. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  61. package/dist/types/messageComposer/configuration/types.d.ts +38 -50
  62. package/dist/types/messageComposer/index.d.ts +1 -0
  63. package/dist/types/messageComposer/linkPreviewsManager.d.ts +12 -9
  64. package/dist/types/messageComposer/messageComposer.d.ts +60 -123
  65. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +10 -1
  66. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +4 -0
  67. package/dist/types/messageComposer/middleware/messageComposer/commandInjection.d.ts +5 -0
  68. package/dist/types/messageComposer/middleware/messageComposer/index.d.ts +2 -0
  69. package/dist/types/messageComposer/middleware/messageComposer/pollOnly.d.ts +6 -0
  70. package/dist/types/messageComposer/middleware/messageComposer/userDataInjection.d.ts +5 -0
  71. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  72. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  73. package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +4 -0
  74. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +11 -2
  75. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +20 -19
  76. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  77. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  78. package/dist/types/messageComposer/pollComposer.d.ts +15 -5
  79. package/dist/types/messageComposer/textComposer.d.ts +14 -7
  80. package/dist/types/messageComposer/types.d.ts +27 -7
  81. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +27 -80
  82. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +43 -73
  83. package/dist/types/messageOperations/FailedSendCache.d.ts +29 -0
  84. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +16 -22
  85. package/dist/types/messageOperations/MessageOperations.d.ts +63 -34
  86. package/dist/types/messageOperations/applyReactionLocally.d.ts +15 -0
  87. package/dist/types/messageOperations/createMessageOperations.d.ts +9 -0
  88. package/dist/types/messageOperations/index.d.ts +6 -4
  89. package/dist/types/messageOperations/reflectReactionEvent.d.ts +16 -0
  90. package/dist/types/messageOperations/sendOrdering.d.ts +14 -0
  91. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +20 -0
  92. package/dist/types/messageOperations/types.d.ts +43 -14
  93. package/dist/types/middleware.d.ts +10 -0
  94. package/dist/types/moderation.d.ts +21 -14
  95. package/dist/types/notifications/NotificationManager.d.ts +10 -23
  96. package/dist/types/notifications/types.d.ts +21 -57
  97. package/dist/types/offline-support/offline_support_api.d.ts +150 -528
  98. package/dist/types/offline-support/offline_sync_manager.d.ts +21 -42
  99. package/dist/types/offline-support/queueableOperations.d.ts +35 -37
  100. package/dist/types/offline-support/types.d.ts +40 -185
  101. package/dist/types/pagination/FilterBuilder.d.ts +1 -18
  102. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  103. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  104. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +4 -5
  105. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +19 -5
  106. package/dist/types/pagination/index.d.ts +1 -0
  107. package/dist/types/pagination/paginators/BasePaginator.d.ts +604 -550
  108. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +123 -106
  109. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +576 -327
  110. package/dist/types/pagination/paginators/MessagePaginator.d.ts +237 -131
  111. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +15 -26
  112. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +4 -3
  113. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +44 -0
  114. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +5 -8
  115. package/dist/types/pagination/paginators/index.d.ts +1 -0
  116. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  117. package/dist/types/pagination/utility.normalization.d.ts +8 -13
  118. package/dist/types/pagination/utility.search.d.ts +3 -8
  119. package/dist/types/poll.d.ts +35 -8
  120. package/dist/types/poll_manager.d.ts +12 -2
  121. package/dist/types/poll_optimistic_votes.d.ts +57 -0
  122. package/dist/types/reminders/Reminder.d.ts +17 -7
  123. package/dist/types/reminders/ReminderManager.d.ts +13 -25
  124. package/dist/types/search/BaseSearchSource.d.ts +10 -8
  125. package/dist/types/search/ChannelSearchSource.d.ts +16 -0
  126. package/dist/types/search/MessageSearchSource.d.ts +17 -0
  127. package/dist/types/search/SearchController.d.ts +26 -28
  128. package/dist/types/search/types.d.ts +6 -10
  129. package/dist/types/signing.d.ts +12 -3
  130. package/dist/types/thread.d.ts +67 -129
  131. package/dist/types/thread_manager.d.ts +95 -66
  132. package/dist/types/token_manager.d.ts +8 -13
  133. package/dist/types/types.d.ts +81 -197
  134. package/dist/types/types.utility.d.ts +3 -3
  135. package/dist/types/upload-utils.d.ts +5 -10
  136. package/dist/types/uploadManager.d.ts +31 -11
  137. package/dist/types/utils/FixedSizeQueueCache.d.ts +8 -11
  138. package/dist/types/utils/WithSubscriptions.d.ts +6 -16
  139. package/dist/types/utils/abort.d.ts +17 -0
  140. package/dist/types/utils/concurrency.d.ts +12 -20
  141. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  142. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  143. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  144. package/dist/types/utils/objectPath.d.ts +6 -41
  145. package/dist/types/utils/retryable.d.ts +8 -12
  146. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  147. package/dist/types/utils/time.d.ts +45 -0
  148. package/dist/types/utils.d.ts +74 -93
  149. package/package.json +14 -40
  150. package/src/ChannelManager.ts +494 -303
  151. package/src/CooldownTimer.ts +46 -59
  152. package/src/EventHandlerPipeline.ts +22 -45
  153. package/src/LiveLocationManager.ts +99 -91
  154. package/src/api-client.ts +113 -50
  155. package/src/campaign.ts +1 -1
  156. package/src/channel.ts +1098 -1351
  157. package/src/channel_batch_updater.ts +1 -1
  158. package/src/channel_state.ts +81 -174
  159. package/src/client.ts +755 -970
  160. package/src/client_state.ts +3 -8
  161. package/src/configuration/ConfigController.ts +42 -158
  162. package/src/configuration/InstanceConfigurationRegistry.ts +43 -172
  163. package/src/configuration/index.ts +1 -1
  164. package/src/configuration/keys.ts +13 -32
  165. package/src/configuration/shape.ts +169 -59
  166. package/src/configuration/types.ts +69 -92
  167. package/src/configuration/utils/applyInstanceConfiguration.ts +22 -54
  168. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  169. package/src/configuration/utils/declarativeSlices.ts +9 -39
  170. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  171. package/src/configuration/utils/index.ts +2 -4
  172. package/src/configuration/utils/serverAuthority.ts +20 -68
  173. package/src/connection/ConnectionIdManager.ts +111 -0
  174. package/src/connection/ConnectionRecoveryManager.ts +257 -0
  175. package/src/connection/index.ts +4 -0
  176. package/src/connection/networkConnection/NetworkConnectionObserver.ts +204 -0
  177. package/src/connection/networkConnection/index.ts +3 -0
  178. package/src/connection/networkConnection/reporters.ts +58 -0
  179. package/src/connection/networkConnection/types.ts +45 -0
  180. package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +230 -231
  181. package/src/connection/wsConnection/WSConnection.ts +270 -0
  182. package/src/connection/wsConnection/WSConnectionFallback.ts +250 -0
  183. package/src/connection/wsConnection/config.ts +73 -0
  184. package/src/connection/wsConnection/index.ts +4 -0
  185. package/src/connection/wsConnection/types.ts +48 -0
  186. package/src/constants.ts +7 -5
  187. package/src/custom_types.ts +0 -1
  188. package/src/entityStore/EntityStore.ts +415 -79
  189. package/src/entityStore/StoreBackedItemIndex.ts +37 -41
  190. package/src/entityStore/index.ts +0 -1
  191. package/src/errors.ts +39 -20
  192. package/src/formatMessageMemo.ts +17 -0
  193. package/src/gen/chat/ChannelApi.ts +122 -36
  194. package/src/gen/chat/ChatApi.ts +578 -1752
  195. package/src/gen/models/index.ts +2566 -3440
  196. package/src/gen/models/timestamp-guard.ts +27 -0
  197. package/src/gen/moderation/ModerationApi.ts +183 -406
  198. package/src/index.ts +32 -10
  199. package/src/languageNames.ts +88 -0
  200. package/src/logger.ts +1 -3
  201. package/src/messageComposer/CustomDataManager.ts +19 -6
  202. package/src/messageComposer/LocationComposer.ts +49 -9
  203. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  204. package/src/messageComposer/attachmentIdentity.ts +54 -0
  205. package/src/messageComposer/attachmentManager.ts +170 -185
  206. package/src/messageComposer/attachmentUtils.ts +44 -0
  207. package/src/messageComposer/configuration/configuration.ts +15 -8
  208. package/src/messageComposer/configuration/types.ts +38 -50
  209. package/src/messageComposer/fileUtils.ts +1 -1
  210. package/src/messageComposer/index.ts +1 -0
  211. package/src/messageComposer/linkPreviewsManager.ts +18 -21
  212. package/src/messageComposer/messageComposer.ts +234 -179
  213. package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
  214. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +46 -33
  215. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +4 -1
  216. package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +1 -1
  217. package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +6 -0
  218. package/src/messageComposer/middleware/messageComposer/attachments.ts +76 -5
  219. package/src/messageComposer/middleware/messageComposer/commandInjection.ts +10 -4
  220. package/src/messageComposer/middleware/messageComposer/customData.ts +17 -5
  221. package/src/messageComposer/middleware/messageComposer/index.ts +2 -0
  222. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +22 -12
  223. package/src/messageComposer/middleware/messageComposer/pollOnly.ts +9 -1
  224. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
  225. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  226. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +12 -12
  227. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  228. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  229. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  230. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +8 -6
  231. package/src/messageComposer/middleware/textComposer/commandUtils.ts +10 -3
  232. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  233. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  234. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  235. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  236. package/src/messageComposer/pollComposer.ts +21 -9
  237. package/src/messageComposer/textComposer.ts +37 -57
  238. package/src/messageComposer/types.ts +39 -11
  239. package/src/messageDelivery/MessageDeliveryReporter.ts +86 -124
  240. package/src/messageDelivery/MessageReceiptsTracker.ts +122 -139
  241. package/src/messageOperations/FailedSendCache.ts +85 -0
  242. package/src/messageOperations/MessageOperationStatePolicy.ts +124 -116
  243. package/src/messageOperations/MessageOperations.ts +297 -175
  244. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +13 -25
  245. package/src/messageOperations/createMessageOperations.ts +176 -0
  246. package/src/messageOperations/index.ts +6 -14
  247. package/src/messageOperations/reflectReactionEvent.ts +43 -0
  248. package/src/messageOperations/sendOrdering.ts +25 -0
  249. package/src/messageOperations/settlePendingAttachmentUploads.ts +98 -0
  250. package/src/messageOperations/types.ts +51 -13
  251. package/src/middleware.ts +13 -5
  252. package/src/moderation.ts +25 -21
  253. package/src/notifications/NotificationManager.ts +19 -28
  254. package/src/notifications/types.ts +21 -57
  255. package/src/offline-support/offline_support_api.ts +231 -681
  256. package/src/offline-support/offline_sync_manager.ts +51 -90
  257. package/src/offline-support/queueableOperations.ts +98 -73
  258. package/src/offline-support/types.ts +43 -185
  259. package/src/pagination/FilterBuilder.ts +1 -22
  260. package/src/pagination/ItemIndex.ts +4 -12
  261. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  262. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +17 -62
  263. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  264. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +53 -33
  265. package/src/pagination/filterCompiler.ts +11 -25
  266. package/src/pagination/index.ts +1 -0
  267. package/src/pagination/paginators/BasePaginator.ts +1415 -1041
  268. package/src/pagination/paginators/ChannelPaginator.ts +481 -219
  269. package/src/pagination/paginators/MessageIntervalPaginator.ts +1362 -775
  270. package/src/pagination/paginators/MessagePaginator.ts +521 -240
  271. package/src/pagination/paginators/PinnedMessagePaginator.ts +32 -40
  272. package/src/pagination/paginators/ReminderPaginator.ts +21 -16
  273. package/src/pagination/paginators/ThreadPaginator.ts +170 -0
  274. package/src/pagination/paginators/UserGroupPaginator.ts +18 -15
  275. package/src/pagination/paginators/index.ts +1 -0
  276. package/src/pagination/paginators/stateThrottling.ts +5 -10
  277. package/src/pagination/sortCompiler.ts +23 -50
  278. package/src/pagination/utility.normalization.ts +17 -24
  279. package/src/pagination/utility.search.ts +4 -11
  280. package/src/poll.ts +183 -102
  281. package/src/poll_manager.ts +24 -22
  282. package/src/poll_optimistic_votes.ts +335 -0
  283. package/src/reminders/Reminder.ts +33 -16
  284. package/src/reminders/ReminderManager.ts +23 -56
  285. package/src/reminders/ReminderTimer.ts +6 -6
  286. package/src/search/BaseSearchSource.ts +19 -25
  287. package/src/search/ChannelSearchSource.ts +43 -1
  288. package/src/search/MessageSearchSource.ts +77 -13
  289. package/src/search/SearchController.ts +39 -36
  290. package/src/search/types.ts +6 -10
  291. package/src/segment.ts +1 -1
  292. package/src/signing.ts +23 -3
  293. package/src/thread.ts +430 -712
  294. package/src/thread_manager.ts +300 -234
  295. package/src/token_manager.ts +12 -22
  296. package/src/types.ts +102 -214
  297. package/src/types.utility.ts +3 -3
  298. package/src/upload-utils.ts +5 -10
  299. package/src/uploadManager.ts +64 -18
  300. package/src/utils/FixedSizeQueueCache.ts +18 -21
  301. package/src/utils/WithSubscriptions.ts +6 -16
  302. package/src/utils/abort.ts +45 -0
  303. package/src/utils/concurrency.ts +16 -55
  304. package/src/utils/mergeWith/mergeWith.ts +10 -13
  305. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  306. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  307. package/src/utils/objectPath.ts +6 -41
  308. package/src/utils/retryable.ts +10 -14
  309. package/src/utils/throttling/throttle.ts +9 -25
  310. package/src/utils/time.ts +64 -0
  311. package/src/utils.ts +227 -174
  312. package/codegen/i18n/callSites.ts +0 -126
  313. package/codegen/i18n/generate.ts +0 -226
  314. package/codegen/i18n/guards.ts +0 -178
  315. package/codegen/i18n/index.ts +0 -29
  316. package/codegen/i18n/stringMaps.ts +0 -91
  317. package/codegen/i18n/types.ts +0 -100
  318. package/dist/cjs/i18n.browser.js +0 -1131
  319. package/dist/cjs/i18n.browser.js.map +0 -7
  320. package/dist/cjs/i18n.node.js +0 -1160
  321. package/dist/cjs/i18n.node.js.map +0 -7
  322. package/dist/esm/i18n-codegen.mjs +0 -409
  323. package/dist/esm/i18n-codegen.mjs.map +0 -7
  324. package/dist/esm/i18n.mjs +0 -1098
  325. package/dist/esm/i18n.mjs.map +0 -7
  326. package/dist/types/ConnectionRecoveryManager.d.ts +0 -156
  327. package/dist/types/connection.d.ts +0 -139
  328. package/dist/types/entityStore/applyReactionLocally.d.ts +0 -26
  329. package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
  330. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
  331. package/dist/types/i18n/Streami18n.d.ts +0 -168
  332. package/dist/types/i18n/TranslationBuilder.d.ts +0 -70
  333. package/dist/types/i18n/TranslationStore.d.ts +0 -57
  334. package/dist/types/i18n/dayjs.d.ts +0 -104
  335. package/dist/types/i18n/formatters.d.ts +0 -91
  336. package/dist/types/i18n/index.d.ts +0 -15
  337. package/dist/types/i18n/translator.d.ts +0 -29
  338. package/dist/types/i18n/types.d.ts +0 -262
  339. package/dist/types/i18n-codegen/callSites.d.ts +0 -10
  340. package/dist/types/i18n-codegen/generate.d.ts +0 -15
  341. package/dist/types/i18n-codegen/guards.d.ts +0 -61
  342. package/dist/types/i18n-codegen/index.d.ts +0 -29
  343. package/dist/types/i18n-codegen/stringMaps.d.ts +0 -14
  344. package/dist/types/i18n-codegen/types.d.ts +0 -94
  345. package/dist/types/insights.d.ts +0 -56
  346. package/dist/types/messageOperations/optimistic.d.ts +0 -118
  347. package/dist/types/messageOperations/persistence.d.ts +0 -21
  348. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  349. package/dist/types/store.d.ts +0 -125
  350. package/src/ConnectionRecoveryManager.ts +0 -293
  351. package/src/gen/model-decoders/decoders.ts +0 -2710
  352. package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
  353. package/src/i18n/Streami18n.ts +0 -520
  354. package/src/i18n/TranslationBuilder.ts +0 -176
  355. package/src/i18n/TranslationStore.ts +0 -96
  356. package/src/i18n/dayjs.ts +0 -228
  357. package/src/i18n/formatters.ts +0 -461
  358. package/src/i18n/index.ts +0 -15
  359. package/src/i18n/languageNames.ts +0 -103
  360. package/src/i18n/translator.ts +0 -76
  361. package/src/i18n/types.ts +0 -375
  362. package/src/insights.ts +0 -82
  363. package/src/messageOperations/optimistic.ts +0 -249
  364. package/src/messageOperations/persistence.ts +0 -40
  365. package/src/pagination/utility.queryChannel.ts +0 -84
  366. package/src/store.ts +0 -304
@@ -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>;
271
- /**
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>;
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>>;
287
158
  /**
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`.
186
+ *
187
+ * @param request - The file to delete. `request.url` is its URL.
188
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
189
+ * into the request (optional).
190
+ * @returns The server response.
191
+ */
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`.
317
197
  *
318
- * @param request - For example `{ event: { type: 'message.read' } }`.
198
+ * @param request - The image to delete. `request.url` is its URL.
319
199
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
320
200
  * into the request (optional).
321
201
  * @returns The server response.
322
202
  */
323
- sendEvent(request: {
324
- event: Event;
325
- }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").EventResponse>>;
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,217 +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 `{}`).
455
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
456
- * into the request (optional).
457
- * @returns The server response.
458
- */
459
- removeFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
460
- /**
461
- * Adds moderators to the channel.
462
- *
463
- * @param members - An array of member identifiers.
464
- * @param message - Message object for channel members notification (optional).
465
- * @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).
466
308
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
467
309
  * into the request (optional).
468
310
  * @returns The server response.
469
311
  */
470
- addModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
312
+ removeFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
471
313
  /**
472
314
  * Invite members to the channel.
473
315
  *
474
- * @param members - An array of members to invite to the channel.
475
- * @param message - Message object for channel members notification (optional).
476
- * @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).
477
319
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
478
320
  * into the request (optional).
479
321
  * @returns The server response.
480
322
  */
481
- 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>>;
482
324
  /**
483
325
  * Removes members from the channel.
484
326
  *
485
- * @param members - An array of member identifiers.
486
- * @param message - Message object for channel members notification (optional).
487
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
488
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
489
- * into the request (optional).
490
- * @returns The server response.
491
- */
492
- removeMembers(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
493
- /**
494
- * Removes the moderator role from channel members.
495
- *
496
- * @param members - An array of member identifiers.
497
- * @param message - Message object for channel members notification (optional).
498
- * @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).
499
330
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
500
331
  * into the request (optional).
501
332
  * @returns The server response.
502
333
  */
503
- demoteModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
334
+ removeMembers({ members, ...options }: RemoveMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
504
335
  /**
505
- * Mutes the current channel.
336
+ * Mutes the channel.
506
337
  *
507
338
  * @example
508
- * // with expiration
509
- * await channel.mute({ expiration: moment.duration(2, 'weeks') });
339
+ * // with expiration (two weeks)
340
+ * await channel.mute({ expiration: 14 * 24 * 60 * 60 * 1000 });
510
341
  *
511
- * @example
512
- * // server side
513
- * await channel.mute({ user_id: userId });
514
- *
515
- * @param options - Mute options (optional, defaults to `{}`).
516
- * @param options.expiration - Expiration in minutes (optional).
342
+ * @param options - Mute options (optional).
343
+ * @param options.expiration - Mute duration in milliseconds (optional).
517
344
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
518
345
  * into the request (optional).
519
346
  * @returns The server response.
520
347
  */
521
348
  mute(options?: Gen_MuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MuteChannelResponse>>;
522
349
  /**
523
- * Unmutes the current channel.
350
+ * Unmutes the channel.
524
351
  *
525
352
  * @example
526
- * // server side
527
- * await channel.unmute({ user_id: userId });
353
+ * await channel.unmute();
528
354
  *
529
- * @param options - Unmute options (optional, defaults to `{}`).
530
- * @param options.user_id - User ID (optional).
355
+ * @param options - Unmute options (optional).
531
356
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
532
357
  * into the request (optional).
533
358
  * @returns The server response.
534
359
  */
535
360
  unmute(options?: Gen_UnmuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnmuteResponse>>;
536
361
  /**
537
- * Archives the current channel.
362
+ * Archives the channel for the current user.
538
363
  *
539
364
  * @example
540
365
  * await channel.archive();
541
366
  *
367
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
368
+ * second argument, as on the generated methods; pass `undefined`.
542
369
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
543
370
  * into the request (optional).
544
371
  * @returns The server response.
545
372
  */
546
- archive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
373
+ archive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
547
374
  /**
548
- * Unarchives the current channel.
375
+ * Unarchives the channel for the current user.
549
376
  *
550
377
  * @example
551
378
  * await channel.unarchive();
552
379
  *
380
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
381
+ * second argument, as on the generated methods; pass `undefined`.
553
382
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
554
383
  * into the request (optional).
555
384
  * @returns The server response.
556
385
  */
557
- unarchive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
386
+ unarchive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
558
387
  /**
559
- * Pins the current channel.
388
+ * Pins the channel for the current user.
560
389
  *
561
390
  * @example
562
391
  * await channel.pin();
563
392
  *
393
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
394
+ * second argument, as on the generated methods; pass `undefined`.
564
395
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
565
396
  * into the request (optional).
566
397
  * @returns The server response.
567
398
  */
568
- pin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
399
+ pin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
569
400
  /**
570
- * Unpins the current channel.
401
+ * Unpins the channel for the current user.
571
402
  *
572
403
  * @example
573
404
  * await channel.unpin();
574
405
  *
406
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
407
+ * second argument, as on the generated methods; pass `undefined`.
575
408
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
576
409
  * into the request (optional).
577
410
  * @returns The server response.
578
411
  */
579
- unpin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
412
+ unpin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
580
413
  /**
581
- * Returns the mute status for the current channel.
414
+ * Returns the mute status of the channel.
582
415
  *
583
- * @returns An object of the form `{ muted: true | false, createdAt: Date | null, expiresAt: Date | null }`.
416
+ * @returns `{ muted, createdAt, expiresAt }`, the timestamps in unix nanoseconds as the API sends
417
+ * them.
584
418
  */
585
- muteStatus(): {
586
- muted: boolean;
587
- createdAt: Date;
588
- expiresAt: Date | null;
589
- } | {
590
- muted: boolean;
591
- createdAt: null;
592
- expiresAt: null;
593
- };
419
+ muteStatus(): import("./channel_state").ChannelMuteStatus;
594
420
  /**
595
- * Recomputes this channel's reactive `state.muteStatus` from the client's current `mutedChannels`
596
- * and publishes it only when it actually changed — so the frequent `health.check` fan-out does not
597
- * churn subscribers. Called from the constructor and by the client whenever `mutedChannels`
598
- * 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.
599
423
  */
600
424
  _syncMuteStatus(): void;
601
425
  sendAction(messageId: string, formData: Record<string, string>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MessageActionResponse>>;
602
426
  /**
603
- * First of the `typing.start` and `typing.stop` events based on the user's keystrokes.
604
- * Call this on every keystroke.
427
+ * Call on every keystroke: sends `typing.start` at most every 2 seconds.
605
428
  *
606
429
  * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
607
430
  *
608
- * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
609
- * @param options - Optional override carrying a `user_id` (optional).
431
+ * @param parentId - The parent message ID, for a typing event in a thread (optional).
610
432
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
611
433
  * into the request (optional).
612
434
  */
613
- keystroke(parentId?: string, options?: {
614
- user_id: string;
615
- }, requestOptions?: StreamRequestOptions): Promise<void>;
435
+ keystroke(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
616
436
  /**
617
- * Sends an event to update the AI state for a specific message.
618
- * 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.
619
438
  *
620
439
  * @param messageId - The ID of the message associated with the AI state.
621
440
  * @param state - The new state of the AI process, e.g. thinking, generating.
622
- * @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 `{}`.
623
442
  * @param options.ai_message - Additional message detail to include in the event (optional).
624
443
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
625
444
  * into the request (optional).
@@ -631,170 +450,200 @@ export declare class Channel extends ChannelApi {
631
450
  * Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming.
632
451
  * Typically used by the server connected to the AI service to inform clients that the AI response has started.
633
452
  *
453
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
454
+ * second argument, as on the generated methods; pass `undefined`.
634
455
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
635
456
  * into the request (optional).
636
457
  */
637
- clearAIIndicator(requestOptions?: StreamRequestOptions): Promise<void>;
458
+ clearAIIndicator(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
638
459
  /**
639
460
  * Sends an event to stop AI response generation, leaving the message in its current state.
640
461
  * Triggered by the user to halt the AI response process.
641
462
  *
463
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
464
+ * second argument, as on the generated methods; pass `undefined`.
642
465
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
643
466
  * into the request (optional).
644
467
  */
645
- stopAIResponse(requestOptions?: StreamRequestOptions): Promise<void>;
468
+ stopAIResponse(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
646
469
  /**
647
- * Sets last typing to null and sends the `typing.stop` event.
648
- *
649
- * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
470
+ * Resets the typing state and sends `typing.stop`.
650
471
  *
651
- * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
652
- * @param options - Optional override carrying a `user_id` (optional).
472
+ * @param parentId - The parent message ID, for a typing event in a thread (optional).
653
473
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
654
474
  * into the request (optional).
655
475
  */
656
- stopTyping(parentId?: string, options?: {
657
- user_id: string;
658
- }, requestOptions?: StreamRequestOptions): Promise<void>;
476
+ stopTyping(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
659
477
  _isTypingIndicatorsEnabled(): boolean;
660
478
  /**
661
- * Run this user's mark-read reporter for this channel. Delegates to
662
- * `MessageDeliveryReporter`, which batches the underlying `markRead` request
663
- * with the user's read receipts state.
664
- *
665
- * 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.
666
489
  *
667
- * @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.
668
492
  */
669
493
  markReadViaReporter(data?: MarkReadRequest): Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
670
494
  /**
671
- * Override of the inherited `markRead()` from `ChannelApi` that requires the
672
- * channel to be initialized and respects the `read_events` channel config.
495
+ * Marks the channel read.
673
496
  *
674
497
  * @param ...args - `[data, requestOptions]`. `data` holds the mark-read options;
675
498
  * `requestOptions` carries per-request options such as an abort `signal` and is never
676
499
  * serialized into the request.
677
- * @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.
678
502
  */
679
503
  markRead(...args: Parameters<ChannelApi['markRead']>): Promise<StreamResponse<MarkReadResponse>>;
680
- /**
681
- * A vague indication of whether the channel exists on the chat backend — `true` once
682
- * `create()`/`query()`/`watch()` has run. Store-backed and reactive: subscribe via
683
- * `useStateStore(channel.state, (s) => ({ initialized: s.initialized }))`.
684
- */
504
+ /** See {@link ChannelLifecycleState.initialized}. */
685
505
  get initialized(): boolean;
686
506
  set initialized(initialized: boolean);
687
507
  /**
688
- * Whether the channel was initialized by manually populating its state (offline hydration) rather
689
- * 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`.
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.
690
519
  */
520
+ get supersededBy(): Channel | undefined;
521
+ /** See {@link ChannelLifecycleState.offlineMode}. */
691
522
  get offlineMode(): boolean;
692
523
  set offlineMode(offlineMode: boolean);
693
524
  /**
694
- * Whether the channel has been torn down and is awaiting disposal (deleted, the current user
695
- * removed, or the client disconnected). Store-backed and reactive.
696
- *
697
- * One-way and terminal — there is no counterpart that revives the instance. Its resources are
698
- * already released ({@link Channel._disconnect} disposes the paginators and unregisters the
699
- * subscriptions) and the client drops it from `activeChannels` right after, so nothing should
700
- * touch it: it is skipped by the `client.activeChannels` lookups (so `client.channel(…)` mints a
701
- * fresh instance), never re-watched on recovery, refused as a source of `channel.data` by the
702
- * offline DB, and `getClient()` throws on it so a reference held across a `disconnectUser()`
703
- * 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.
704
530
  */
705
- get pendingDisposal(): boolean;
706
- set pendingDisposal(pendingDisposal: boolean);
531
+ get data(): Partial<ChannelResponse> | undefined;
532
+ set data(next: Partial<ChannelResponse> | undefined);
707
533
  /**
708
- * Whether this client holds a server-side watch on the channel, and if not, whether it should be
709
- * restored — see {@link ChannelWatchStatus}. Store-backed and reactive: subscribe via
710
- * `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.
711
537
  */
538
+ get pendingDisposal(): boolean;
539
+ /** See {@link ChannelWatchStatus}. */
712
540
  get watchStatus(): ChannelWatchStatus;
713
541
  set watchStatus(watchStatus: ChannelWatchStatus);
714
542
  /**
715
- * Whether a consumer has declared this channel as the one it is currently consuming (see
716
- * {@link Channel.activate}). Reactive — subscribe via
717
- * `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
718
548
  */
549
+ get isQueryingChannel(): boolean;
550
+ /** See {@link Channel.activate}. */
719
551
  get active(): boolean;
720
552
  /**
721
- * Declares that a consumer is now consuming this channel's own state (mirrors
722
- * `thread.activate()`). Refcounted, as a single `Channel` instance can be held by several
723
- * 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.
724
556
  *
725
- * While active, the channel's own state takes precedence over bulk state writes: channel-list
726
- * hydration does not re-seed its message list (its own `channel.reload()` owns that window).
727
- */
728
- activate: () => void;
729
- /**
730
- * Declares that a consumer has stopped consuming this channel (mirrors `thread.deactivate()`).
731
- * 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.
732
561
  */
733
- deactivate: () => void;
562
+ activate: () => (() => void);
734
563
  /**
735
- * Marks the channel as unread from `messageId`. Only works when the `read_events` setting is enabled.
564
+ * Marks the channel unread from a message.
736
565
  *
737
566
  * @param ...args - `[data, requestOptions]`. `data` holds the mark-unread options;
738
567
  * `requestOptions` carries per-request options such as an abort `signal` and is never
739
568
  * serialized into the request.
740
- * @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.
741
571
  */
742
572
  markUnread(...args: Parameters<ChannelApi['markUnread']>): Promise<StreamResponse<import(".").Response>>;
743
573
  /**
744
- * Resets this user's unread count locally, without any backend call. Intended for
745
- * channels that have read events disabled (e.g. livestreams) when the client is created with the
746
- * `isLocalUnreadCountEnabled` option. Dispatches a dedicated, client-only `message.read_locally` event
747
- * that runs through the same `_handleChannelEvent` read logic as a real `message.read` (minus the
748
- * delivery-report network sync), so the read-state update lives in one place. When offline support
749
- * is enabled, the offline DB persists the reset for read-events-disabled channels, so the local
750
- * 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`.
751
584
  *
752
- * @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.
753
587
  */
754
588
  markReadLocally(): ({
755
589
  type: "message.read_locally";
756
590
  } & {
757
591
  channel_type: string;
758
592
  cid: string;
759
- created_at: Date;
593
+ created_at: TimestampNS;
760
594
  channel_id?: string;
761
595
  last_read_message_id?: string;
762
596
  team?: string;
763
597
  user?: UserResponse;
764
598
  } & {
765
- received_at?: Date;
599
+ received_at?: TimestampNS;
766
600
  }) | undefined;
767
601
  /**
768
- * 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
769
606
  */
770
607
  clean(): void;
771
608
  /**
772
- * 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.
773
615
  *
774
- * @param options - Additional options for the query endpoint (optional).
775
- * @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}).
776
621
  */
777
- watch(options?: ChannelGetOrCreateRequest): Promise<StreamResponse<import(".").ChannelStateResponse>>;
622
+ watch(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<Channel>;
778
623
  /**
779
- * Re-watch the channel and refresh its FULL loaded message window — the channel analog of
780
- * {@link Thread.reload}. Used on reconnect to catch up AND reconcile hard deletes that happened
781
- * while offline: a hard delete reaches other clients via no event, so an offline client only learns
782
- * of it by diffing the re-queried page.
783
- *
784
- * This is intentionally thin: it only re-issues `watch()` with a limit sized to the loaded window
785
- * (`items.length`, so the whole loaded window is refreshed — not the smaller channel-list page). The
786
- * actual fold + destructive reconciliation happens inside `query()` → `seedFirstPageSync`
787
- * (the same path the channel-list re-hydrate and connection recovery use), driven by the loaded-id
788
- * snapshot `query()` captures before its await. Owning that single path is what lets the SDK stop
789
- * 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).
790
643
  *
791
- * Preserves failed (unsent) messages: an overlap merge keeps them (the reconcile's provenance guard
792
- * never prunes a non-server message); only a disjoint rebuild can drop them, so any that actually
793
- * fell out are re-ingested below. The offline DB is consulted alongside the in-memory window, because
794
- * a failed message can be absent from memory and still be the user's unsent work — a cold boot starts
795
- * with an empty paginator, and an eviction can drop it mid-session. v9 got this from a second, lagging
796
- * copy of the list (the React SDK's own state); with one reactive source of truth the persisted row is
797
- * 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.
798
647
  */
799
648
  reload(): Promise<void>;
800
649
  /**
@@ -807,83 +656,152 @@ export declare class Channel extends ChannelApi {
807
656
  */
808
657
  stopWatching(...args: Parameters<ChannelApi['stopWatching']>): Promise<StreamResponse<import(".").Response>>;
809
658
  /**
810
- * Retrieves a list of messages by ID.
659
+ * Retrieves messages of this channel by ID.
811
660
  *
812
- * @param messageIds - The IDs of the messages to retrieve from this channel.
661
+ * @param messageIds - The IDs of the messages to retrieve.
813
662
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
814
663
  * into the request (optional).
815
- * @returns Server response.
664
+ * @returns The server response.
816
665
  */
817
666
  getMessagesById(messageIds: string[], requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").GetManyMessagesResponse>>;
818
667
  /**
819
- * 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.
820
669
  *
821
- * @returns The last-read `Date`, `null` if never read, or `undefined` if the user is unset.
670
+ * @returns The last-read timestamp in unix nanoseconds, `null` if never read, or `undefined` if
671
+ * the user is unset.
822
672
  */
823
- lastRead(): Date | null | undefined;
673
+ lastRead(): TimestampNS | null | undefined;
824
674
  _countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
825
675
  /**
826
- * Count of unread messages.
676
+ * Counts the unread messages.
677
+ *
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.
691
+ */
692
+ private newestKnownMessages;
693
+ /**
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.
827
698
  *
828
- * @param lastRead - The time that the user read a message (optional, defaults to the current user's read state).
829
- * @returns Unread count.
699
+ * @internal
830
700
  */
831
- countUnread(lastRead?: Date | null): number;
701
+ _lowerUnreadCountForDeletedMessages(deletedMessages: LocalMessage[]): void;
832
702
  /**
833
- * Count the number of unread messages mentioning the current user.
703
+ * Counts the unread messages that mention the current user, within the channel's newest messages
704
+ * that are loaded (see {@link newestKnownMessages}).
834
705
  *
835
- * @returns Unread mentions count.
706
+ * @returns The unread mentions count.
836
707
  */
837
708
  countUnreadMentions(): number;
838
709
  /**
839
- * Creates a new channel.
710
+ * Creates the channel without watching it.
840
711
  *
841
712
  * @param options - Channel query options (optional).
842
713
  * @returns The server response.
843
714
  */
844
- 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;
845
722
  /**
846
- * 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.
847
727
  *
848
728
  * @param options - The query options (optional, defaults to `{}`).
849
- * @param messageSetToAddToIfDoesNotExist - It's possible to load disjunct sets of a channel's
850
- * messages into state. Use `current` to load the initial channel state or to extend the
851
- * currently displayed messages; use `latest` to load/extend the latest messages; `new` is
852
- * used for loading a specific message and its surroundings (optional, defaults to `'current'`).
853
729
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
854
730
  * into the request (optional).
855
- * @returns A query response.
731
+ * @returns The query response.
856
732
  */
857
- query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ChannelStateResponse>>;
733
+ query(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<ChannelStateResponse>>;
858
734
  /**
859
- * 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}).
860
739
  *
861
- * @param targetUserId - The user to ban.
862
- * @param options - Ban options.
863
- * @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}.
864
745
  */
865
- banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
746
+ private runChannelQuery;
866
747
  /**
867
- * Hides the channel from `queryChannels` for the user until a message is added.
868
- * 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.
869
752
  *
870
- * @param ...args - `[request, requestOptions]`. Pass `request: { clear_history: true }` to clear
871
- * message history for the user; `requestOptions` carries per-request options such as an abort
872
- * `signal` and is never serialized into the request.
873
- * @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
874
757
  */
875
- hide(...args: Parameters<ChannelApi['hide']>): Promise<StreamResponse<import(".").HideChannelResponse>>;
758
+ runTrackedQuery<T>(run: () => Promise<T>): Promise<T>;
876
759
  /**
877
- * 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.
878
766
  *
879
- * @param ...args - `[request, requestOptions]`. `request` is the show-channel payload;
880
- * `requestOptions` carries per-request options such as an abort `signal` and is never
881
- * 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.
882
800
  * @returns The server response.
883
801
  */
884
- show(...args: Parameters<ChannelApi['show']>): Promise<StreamResponse<import(".").ShowChannelResponse>>;
802
+ banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
885
803
  /**
886
- * Removes the bans for a user on a channel.
804
+ * Removes the bans of a user on this channel.
887
805
  *
888
806
  * @param targetUserId - The user to unban.
889
807
  * @param options - Unban options (optional).
@@ -891,33 +809,27 @@ export declare class Channel extends ChannelApi {
891
809
  */
892
810
  unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<import("./types").APIResponse>;
893
811
  /**
894
- * Casts or cancels one or more votes on a poll.
812
+ * Casts a vote on a poll. `removeVote()` removes one.
895
813
  *
896
- * @param ...args - `[request, requestOptions]`. `request` holds the target message ID, poll ID,
897
- * and the vote to cast (or an empty payload to cancel); `requestOptions` carries per-request
898
- * 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.
899
817
  * @returns The poll vote response.
900
818
  */
901
819
  vote(...args: Parameters<ChatApi['castPollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
902
820
  removeVote(...args: Parameters<ChatApi['deletePollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
903
821
  _createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<StreamResponse<import(".").CreateDraftResponse>>;
904
- /**
905
- * Creates or updates a draft message in a channel. If offline support is enabled, the
906
- * call is queued so it is replayed on reconnect.
907
- */
822
+ /** Creates or updates a draft. With offline support the call is queued and replayed on reconnect. */
908
823
  createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<import(".").CreateDraftResponse & {
909
824
  metadata: import("./types").RequestMetadata;
910
825
  }>;
911
826
  _deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<StreamResponse<import(".").Response>>;
912
- /**
913
- * Deletes a draft message from a channel or a thread. If offline support is enabled, the
914
- * call is queued so it is replayed on reconnect.
915
- */
827
+ /** Deletes a draft. With offline support the call is queued and replayed on reconnect. */
916
828
  deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<import(".").Response & {
917
829
  metadata: import("./types").RequestMetadata;
918
830
  }>;
919
831
  /**
920
- * Listens to events on this channel.
832
+ * Listens to events on this channel. A callback alone listens to all events.
921
833
  *
922
834
  * @example
923
835
  * channel.on('message.new', (event) => {
@@ -929,48 +841,71 @@ export declare class Channel extends ChannelApi {
929
841
  * console.log(event.type);
930
842
  * });
931
843
  *
932
- * @param callbackOrString - The event type to listen for, or the callback when listening to all events.
933
- * @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.
934
846
  * @returns An object with an `unsubscribe()` method.
935
847
  */
936
- on<T extends EventType | string>(eventType: T, callback: EventHandler<T>): {
848
+ on<T extends EventType>(eventType: T, callback: EventHandler<T>): {
937
849
  unsubscribe: () => void;
938
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
+ */
939
857
  on(callback: EventHandler): {
940
858
  unsubscribe: () => void;
941
859
  };
942
860
  /**
943
- * Removes the event handler.
861
+ * Removes a listener for one event type.
944
862
  *
945
- * @param callbackOrString - The event type, or the callback when removing an all-events listener.
946
- * @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.
947
871
  */
948
- off<T extends EventType | string>(eventType: T, callback: EventHandler): void;
949
872
  off(callback: EventHandler): void;
950
873
  private _patchReadState;
951
874
  private _upsertReadState;
952
875
  /**
953
- * Sets the current user's unread count. The count lives in exactly one place — the reactive
954
- * `read[userId].unread_messages`, which is what the unread badge reads and what
955
- * `state.unreadCount` derives from — so channel-wide resets (`channel.truncated`, "all channels
956
- * 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.
957
878
  */
958
- /** @returns whether the count actually changed, so callers can react only to the channels it did. */
959
879
  _setOwnUnreadCount(unreadCount: number): boolean;
960
880
  _handleChannelEvent(event: Event): void;
961
- _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. */
962
891
  _checkInitialized(): void;
963
892
  _initializeState(state: ChannelStateResponseFields): void;
964
893
  _extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
965
894
  _hydrateMembers({ members, overrideCurrentState, }: {
966
895
  members: ChannelMemberResponse[];
967
- /**
968
- * If set to `true` then `ChannelState.members` will be overriden with the newly
969
- * provided `members`, setting this property to `false` will merge current `ChannelState.members`
970
- * object with the newly provided `members`
971
- * (new members with the same `userId` will replace the old ones).
972
- */
896
+ /** `true` replaces `state.members`. `false` merges (a new member replaces one with the same ID). */
973
897
  overrideCurrentState?: boolean;
974
898
  }): void;
975
- _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;
976
911
  }