stream-chat 10.0.0-rc.2 → 10.0.0-rc.21

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 (298) hide show
  1. package/README.md +11 -8
  2. package/dist/cjs/index.browser.js +15397 -12090
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +15349 -11991
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +15164 -11880
  7. package/dist/esm/index.mjs.map +4 -4
  8. package/dist/types/ChannelManager.d.ts +246 -6
  9. package/dist/types/CooldownTimer.d.ts +22 -8
  10. package/dist/types/EventHandlerPipeline.d.ts +12 -16
  11. package/dist/types/LiveLocationManager.d.ts +69 -6
  12. package/dist/types/api-client.d.ts +22 -9
  13. package/dist/types/channel.d.ts +550 -300
  14. package/dist/types/channel_state.d.ts +167 -22
  15. package/dist/types/client.d.ts +325 -305
  16. package/dist/types/configuration/ConfigController.d.ts +172 -0
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +192 -0
  18. package/dist/types/configuration/index.d.ts +3 -0
  19. package/dist/types/configuration/keys.d.ts +31 -0
  20. package/dist/types/configuration/shape.d.ts +58 -0
  21. package/dist/types/configuration/types.d.ts +206 -50
  22. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +59 -0
  23. package/dist/types/configuration/utils/copyConfigPatch.d.ts +1 -0
  24. package/dist/types/configuration/utils/declarativeSlices.d.ts +24 -0
  25. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +22 -0
  26. package/dist/types/configuration/utils/index.d.ts +1 -0
  27. package/dist/types/configuration/utils/serverAuthority.d.ts +49 -0
  28. package/dist/types/connection/ConnectionIdManager.d.ts +67 -0
  29. package/dist/types/connection/ConnectionRecoveryManager.d.ts +164 -0
  30. package/dist/types/connection/index.d.ts +4 -0
  31. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +153 -0
  32. package/dist/types/connection/networkConnection/index.d.ts +3 -0
  33. package/dist/types/connection/networkConnection/reporters.d.ts +43 -0
  34. package/dist/types/connection/networkConnection/types.d.ts +55 -0
  35. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +204 -0
  36. package/dist/types/connection/wsConnection/WSConnection.d.ts +168 -0
  37. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +55 -0
  38. package/dist/types/connection/wsConnection/config.d.ts +51 -0
  39. package/dist/types/connection/wsConnection/index.d.ts +4 -0
  40. package/dist/types/connection/wsConnection/types.d.ts +99 -0
  41. package/dist/types/constants.d.ts +3 -1
  42. package/dist/types/entityStore/EntityStore.d.ts +160 -40
  43. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +48 -29
  44. package/dist/types/entityStore/index.d.ts +0 -1
  45. package/dist/types/errors.d.ts +24 -4
  46. package/dist/types/formatMessageMemo.d.ts +5 -0
  47. package/dist/types/gen/chat/ChannelApi.d.ts +51 -23
  48. package/dist/types/gen/chat/ChatApi.d.ts +215 -168
  49. package/dist/types/gen/models/index.d.ts +2164 -557
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +39 -32
  52. package/dist/types/gen-imports.d.ts +1 -0
  53. package/dist/types/index.d.ts +20 -7
  54. package/dist/types/languageNames.d.ts +97 -0
  55. package/dist/types/logger.d.ts +1 -1
  56. package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
  57. package/dist/types/messageComposer/LocationComposer.d.ts +10 -4
  58. package/dist/types/messageComposer/attachmentIdentity.d.ts +11 -0
  59. package/dist/types/messageComposer/attachmentManager.d.ts +48 -10
  60. package/dist/types/messageComposer/attachmentUtils.d.ts +34 -0
  61. package/dist/types/messageComposer/configuration/commands.configuration.d.ts +1 -3
  62. package/dist/types/messageComposer/configuration/configuration.d.ts +9 -1
  63. package/dist/types/messageComposer/configuration/index.d.ts +0 -1
  64. package/dist/types/messageComposer/configuration/types.d.ts +57 -1
  65. package/dist/types/messageComposer/index.d.ts +1 -0
  66. package/dist/types/messageComposer/linkPreviewsManager.d.ts +10 -4
  67. package/dist/types/messageComposer/messageComposer.d.ts +210 -14
  68. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +20 -1
  69. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +11 -0
  70. package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +2 -2
  71. package/dist/types/messageComposer/middleware/pollComposer/index.d.ts +1 -0
  72. package/dist/types/messageComposer/middleware/pollComposer/state.d.ts +3 -2
  73. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +9 -2
  74. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +44 -0
  75. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +2 -2
  76. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +94 -229
  77. package/dist/types/messageComposer/pollComposer.d.ts +8 -3
  78. package/dist/types/messageComposer/textComposer.d.ts +9 -1
  79. package/dist/types/messageComposer/types.d.ts +7 -3
  80. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +64 -8
  81. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +48 -11
  82. package/dist/types/messageOperations/FailedSendCache.d.ts +34 -0
  83. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +52 -6
  84. package/dist/types/messageOperations/MessageOperations.d.ts +94 -11
  85. package/dist/types/{entityStore → messageOperations}/applyReactionLocally.d.ts +8 -2
  86. package/dist/types/messageOperations/createMessageOperations.d.ts +11 -0
  87. package/dist/types/messageOperations/index.d.ts +7 -1
  88. package/dist/types/messageOperations/reflectReactionEvent.d.ts +24 -0
  89. package/dist/types/messageOperations/sendOrdering.d.ts +17 -0
  90. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +28 -0
  91. package/dist/types/messageOperations/types.d.ts +66 -1
  92. package/dist/types/middleware.d.ts +8 -0
  93. package/dist/types/moderation.d.ts +18 -4
  94. package/dist/types/notifications/NotificationManager.d.ts +43 -2
  95. package/dist/types/notifications/types.d.ts +55 -42
  96. package/dist/types/offline-support/offline_support_api.d.ts +128 -12
  97. package/dist/types/offline-support/offline_sync_manager.d.ts +26 -5
  98. package/dist/types/offline-support/queueableOperations.d.ts +106 -0
  99. package/dist/types/offline-support/types.d.ts +77 -28
  100. package/dist/types/pagination/FilterBuilder.d.ts +1 -18
  101. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -1
  102. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +21 -3
  103. package/dist/types/pagination/filterCompiler.d.ts +5 -0
  104. package/dist/types/pagination/paginators/BasePaginator.d.ts +331 -7
  105. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +54 -11
  106. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +283 -66
  107. package/dist/types/pagination/paginators/MessagePaginator.d.ts +10 -9
  108. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +17 -1
  109. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +8 -8
  110. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +57 -0
  111. package/dist/types/pagination/paginators/index.d.ts +1 -0
  112. package/dist/types/pagination/utility.normalization.d.ts +29 -2
  113. package/dist/types/poll.d.ts +41 -14
  114. package/dist/types/poll_manager.d.ts +3 -2
  115. package/dist/types/poll_optimistic_votes.d.ts +61 -0
  116. package/dist/types/reminders/Reminder.d.ts +17 -7
  117. package/dist/types/reminders/ReminderManager.d.ts +34 -6
  118. package/dist/types/search/BaseSearchSource.d.ts +50 -25
  119. package/dist/types/search/ChannelMemberSearchSource.d.ts +11 -6
  120. package/dist/types/search/ChannelSearchSource.d.ts +27 -5
  121. package/dist/types/search/MessageSearchSource.d.ts +36 -6
  122. package/dist/types/search/SearchController.d.ts +44 -11
  123. package/dist/types/search/UserSearchSource.d.ts +11 -5
  124. package/dist/types/search/types.d.ts +14 -1
  125. package/dist/types/signing.d.ts +0 -157
  126. package/dist/types/thread.d.ts +118 -62
  127. package/dist/types/thread_manager.d.ts +124 -35
  128. package/dist/types/token_manager.d.ts +5 -8
  129. package/dist/types/types.d.ts +138 -562
  130. package/dist/types/types.utility.d.ts +8 -0
  131. package/dist/types/upload-utils.d.ts +20 -0
  132. package/dist/types/uploadManager.d.ts +50 -2
  133. package/dist/types/utils/FixedSizeQueueCache.d.ts +2 -0
  134. package/dist/types/utils/WithSubscriptions.d.ts +1 -1
  135. package/dist/types/utils/objectPath.d.ts +49 -0
  136. package/dist/types/utils/time.d.ts +85 -0
  137. package/dist/types/utils.d.ts +63 -40
  138. package/package.json +22 -33
  139. package/src/ChannelManager.ts +561 -109
  140. package/src/CooldownTimer.ts +55 -45
  141. package/src/EventHandlerPipeline.ts +13 -23
  142. package/src/LiveLocationManager.ts +191 -37
  143. package/src/api-client.ts +144 -53
  144. package/src/channel.ts +1573 -1050
  145. package/src/channel_state.ts +239 -129
  146. package/src/client.ts +843 -892
  147. package/src/client_state.ts +2 -2
  148. package/src/configuration/ConfigController.ts +298 -0
  149. package/src/configuration/InstanceConfigurationRegistry.ts +430 -0
  150. package/src/configuration/index.ts +7 -0
  151. package/src/configuration/keys.ts +86 -0
  152. package/src/configuration/shape.ts +776 -0
  153. package/src/configuration/types.ts +218 -60
  154. package/src/configuration/utils/applyInstanceConfiguration.ts +184 -0
  155. package/src/configuration/utils/copyConfigPatch.ts +61 -0
  156. package/src/configuration/utils/declarativeSlices.ts +81 -0
  157. package/src/configuration/utils/deepFreezeConfig.ts +33 -0
  158. package/src/configuration/utils/index.ts +5 -0
  159. package/src/configuration/utils/serverAuthority.ts +146 -0
  160. package/src/connection/ConnectionIdManager.ts +153 -0
  161. package/src/connection/ConnectionRecoveryManager.ts +371 -0
  162. package/src/connection/index.ts +4 -0
  163. package/src/connection/networkConnection/NetworkConnectionObserver.ts +281 -0
  164. package/src/connection/networkConnection/index.ts +3 -0
  165. package/src/connection/networkConnection/reporters.ts +85 -0
  166. package/src/connection/networkConnection/types.ts +60 -0
  167. package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +242 -151
  168. package/src/connection/wsConnection/WSConnection.ts +345 -0
  169. package/src/connection/wsConnection/WSConnectionFallback.ts +259 -0
  170. package/src/connection/wsConnection/config.ts +108 -0
  171. package/src/connection/wsConnection/index.ts +4 -0
  172. package/src/connection/wsConnection/types.ts +101 -0
  173. package/src/constants.ts +5 -3
  174. package/src/entityStore/EntityStore.ts +350 -10
  175. package/src/entityStore/StoreBackedItemIndex.ts +66 -37
  176. package/src/entityStore/index.ts +0 -1
  177. package/src/errors.ts +40 -7
  178. package/src/formatMessageMemo.ts +23 -0
  179. package/src/gen/chat/ChannelApi.ts +230 -44
  180. package/src/gen/chat/ChatApi.ts +1047 -1745
  181. package/src/gen/models/index.ts +2378 -3721
  182. package/src/gen/models/timestamp-guard.ts +27 -0
  183. package/src/gen/moderation/ModerationApi.ts +218 -388
  184. package/src/gen-imports.ts +1 -0
  185. package/src/index.ts +82 -6
  186. package/src/languageNames.ts +103 -0
  187. package/src/logger.ts +1 -1
  188. package/src/messageComposer/CustomDataManager.ts +10 -1
  189. package/src/messageComposer/LocationComposer.ts +68 -20
  190. package/src/messageComposer/attachmentIdentity.ts +39 -0
  191. package/src/messageComposer/attachmentManager.ts +191 -68
  192. package/src/messageComposer/attachmentUtils.ts +58 -0
  193. package/src/messageComposer/configuration/commands.configuration.ts +1 -26
  194. package/src/messageComposer/configuration/configuration.ts +22 -3
  195. package/src/messageComposer/configuration/index.ts +0 -1
  196. package/src/messageComposer/configuration/types.ts +58 -1
  197. package/src/messageComposer/index.ts +1 -0
  198. package/src/messageComposer/linkPreviewsManager.ts +16 -10
  199. package/src/messageComposer/messageComposer.ts +487 -98
  200. package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
  201. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +58 -33
  202. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +7 -2
  203. package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +3 -2
  204. package/src/messageComposer/middleware/messageComposer/attachments.ts +98 -1
  205. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +20 -10
  206. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
  207. package/src/messageComposer/middleware/messageComposer/types.ts +2 -7
  208. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +11 -6
  209. package/src/messageComposer/middleware/pollComposer/index.ts +1 -0
  210. package/src/messageComposer/middleware/pollComposer/state.ts +43 -11
  211. package/src/messageComposer/middleware/pollComposer/types.ts +9 -2
  212. package/src/messageComposer/middleware/pollComposer/validation.ts +76 -0
  213. package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -2
  214. package/src/messageComposer/middleware/textComposer/commands.ts +1 -2
  215. package/src/messageComposer/middleware/textComposer/mentions.ts +91 -39
  216. package/src/messageComposer/pollComposer.ts +11 -3
  217. package/src/messageComposer/textComposer.ts +36 -4
  218. package/src/messageComposer/types.ts +19 -14
  219. package/src/messageDelivery/MessageDeliveryReporter.ts +154 -53
  220. package/src/messageDelivery/MessageReceiptsTracker.ts +136 -64
  221. package/src/messageOperations/FailedSendCache.ts +90 -0
  222. package/src/messageOperations/MessageOperationStatePolicy.ts +269 -27
  223. package/src/messageOperations/MessageOperations.ts +340 -136
  224. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +10 -3
  225. package/src/messageOperations/createMessageOperations.ts +192 -0
  226. package/src/messageOperations/index.ts +7 -0
  227. package/src/messageOperations/reflectReactionEvent.ts +51 -0
  228. package/src/messageOperations/sendOrdering.ts +28 -0
  229. package/src/messageOperations/settlePendingAttachmentUploads.ts +110 -0
  230. package/src/messageOperations/types.ts +74 -0
  231. package/src/middleware.ts +11 -0
  232. package/src/moderation.ts +47 -24
  233. package/src/notifications/NotificationManager.ts +73 -3
  234. package/src/notifications/configuration.ts +10 -8
  235. package/src/notifications/types.ts +58 -42
  236. package/src/offline-support/offline_support_api.ts +380 -197
  237. package/src/offline-support/offline_sync_manager.ts +105 -32
  238. package/src/offline-support/queueableOperations.ts +270 -0
  239. package/src/offline-support/types.ts +85 -39
  240. package/src/pagination/FilterBuilder.ts +1 -22
  241. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +11 -7
  242. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +25 -7
  243. package/src/pagination/filterCompiler.ts +17 -0
  244. package/src/pagination/paginators/BasePaginator.ts +731 -81
  245. package/src/pagination/paginators/ChannelPaginator.ts +210 -102
  246. package/src/pagination/paginators/MessageIntervalPaginator.ts +703 -193
  247. package/src/pagination/paginators/MessagePaginator.ts +45 -36
  248. package/src/pagination/paginators/PinnedMessagePaginator.ts +74 -28
  249. package/src/pagination/paginators/ReminderPaginator.ts +15 -13
  250. package/src/pagination/paginators/ThreadPaginator.ts +181 -0
  251. package/src/pagination/paginators/UserGroupPaginator.ts +8 -1
  252. package/src/pagination/paginators/index.ts +1 -0
  253. package/src/pagination/utility.normalization.ts +37 -9
  254. package/src/poll.ts +189 -112
  255. package/src/poll_manager.ts +14 -8
  256. package/src/poll_optimistic_votes.ts +335 -0
  257. package/src/reminders/Reminder.ts +34 -16
  258. package/src/reminders/ReminderManager.ts +68 -41
  259. package/src/reminders/ReminderTimer.ts +7 -6
  260. package/src/search/BaseSearchSource.ts +133 -40
  261. package/src/search/ChannelMemberSearchSource.ts +27 -18
  262. package/src/search/ChannelSearchSource.ts +61 -7
  263. package/src/search/MessageSearchSource.ts +133 -28
  264. package/src/search/SearchController.ts +93 -16
  265. package/src/search/UserSearchSource.ts +27 -13
  266. package/src/search/types.ts +14 -1
  267. package/src/signing.ts +1 -315
  268. package/src/thread.ts +503 -511
  269. package/src/thread_manager.ts +339 -204
  270. package/src/token_manager.ts +12 -32
  271. package/src/types.ts +159 -780
  272. package/src/types.utility.ts +14 -0
  273. package/src/upload-utils.ts +53 -0
  274. package/src/uploadManager.ts +85 -7
  275. package/src/utils/FixedSizeQueueCache.ts +5 -0
  276. package/src/utils/WithSubscriptions.ts +1 -1
  277. package/src/utils/objectPath.ts +67 -0
  278. package/src/utils/time.ts +104 -0
  279. package/src/utils.ts +209 -157
  280. package/dist/types/base64.d.ts +0 -2
  281. package/dist/types/configuration/InstanceConfigurationService.d.ts +0 -26
  282. package/dist/types/connection.d.ts +0 -146
  283. package/dist/types/connection_fallback.d.ts +0 -42
  284. package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
  285. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
  286. package/dist/types/insights.d.ts +0 -58
  287. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  288. package/dist/types/permissions.d.ts +0 -55
  289. package/dist/types/store.d.ts +0 -125
  290. package/src/base64.ts +0 -78
  291. package/src/configuration/InstanceConfigurationService.ts +0 -73
  292. package/src/connection_fallback.ts +0 -215
  293. package/src/gen/model-decoders/decoders.ts +0 -2680
  294. package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
  295. package/src/insights.ts +0 -83
  296. package/src/pagination/utility.queryChannel.ts +0 -84
  297. package/src/permissions.ts +0 -102
  298. package/src/store.ts +0 -304
@@ -1,106 +1,158 @@
1
- import type { AxiosRequestConfig } from 'axios';
2
- import { ChannelState } from './channel_state';
1
+ import { ChannelState, ChannelWatchStatus } from './channel_state';
3
2
  import { CooldownTimer } from './CooldownTimer';
4
3
  import { MessageComposer } from './messageComposer';
5
4
  import { MessageReceiptsTracker } from './messageDelivery';
6
5
  import { MessagePaginator, PinnedMessagePaginator } from './pagination/paginators';
7
- import { MessageOperations } from './messageOperations';
6
+ import type { MessageOperations } from './messageOperations';
7
+ import type { OperationRequestFn } from './messageOperations/types';
8
8
  import type { StreamChat } from './client';
9
- import type { AIState, APIResponse, BanUserOptions, ChannelData, ChannelGetOrCreateRequest, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields, ChannelUpdateOptions, CreateDraftResponse, DeleteMessageOptions, Event, EventAPIResponse, EventHandler, EventPayload, EventType, GetRepliesAPIResponse, GetRepliesRequest, LocalMessage, MarkReadRequest, MarkUnreadRequest, MessageRequest, MessageResponse, MessageSetType, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersPayload, ReactionAPIResponse, ReactionRequest, SearchPayload, SendMessageOptions, SendReactionRequest, SharedLocation, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UpdateMessageOptions, UserResponse } from './types';
10
- import type { RoleName } from './permissions';
11
- import { StateStore } from './store';
12
- import type { ChannelMemberRequest as Gen_ChannelMemberRequest, ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, ChannelStopWatchingRequest as Gen_ChannelStopWatchingRequest, CreateDraftRequest as Gen_CreateDraftRequest, HideChannelRequest as Gen_HideChannelRequest, MuteChannelRequest as Gen_MuteChannelRequest, SendMessageRequest as Gen_SendMessageRequest, ShowChannelRequest as Gen_ShowChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UpdateChannelRequest as Gen_UpdateChannelRequest, WSEvent } from './gen/models';
9
+ import type { ChannelDeclarativeConfig } from './configuration/types';
10
+ import type { AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields, ChannelUpdateOptions, Command, Event, EventHandler, EventPayload, EventType, FileUploadInput, LocalMessage, MarkReadRequest, MarkReadResponse, MessageRequest, MessageResponse, MessageSetType, QueryMembersPayload, SharedLocation, StreamRequestOptions, StreamResponse, TimestampNS, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UserResponse } from './types';
11
+ import type { StateStore } from '@stream-io/state-store';
12
+ import type { ChannelMemberRequest as Gen_ChannelMemberRequest, ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, MuteChannelRequest as Gen_MuteChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UploadChannelFileRequest, UploadChannelRequest, WSEvent } from './gen/models';
13
13
  import type { ChatApi } from './gen/chat/ChatApi';
14
14
  import { ChannelApi } from './gen/chat/ChannelApi';
15
- export type SendMessageWithStateUpdateParams = {
16
- localMessage: LocalMessage;
17
- message?: MessageRequest;
18
- options?: SendMessageOptions;
15
+ /**
16
+ * The message-operation vocabulary, re-exported so it has a public path: `src/messageOperations` is
17
+ * not part of the root barrel, while `src/index.ts` re-exports this module wholesale.
18
+ *
19
+ * `OperationParams<K>` and `OperationRequestFn<K>` are the one spelling for every operation's
20
+ * parameters and request function — both derived from `MessageOperationSpec`, so adding an operation
21
+ * kind extends them rather than needing a new hand-written pair.
22
+ */
23
+ export type { DefaultOperationRequest, MessageOperationSpec, OperationKind, OperationParams, OperationRequestFn, OperationResponse, } from './messageOperations/types';
24
+ export type CustomMarkReadRequestFn = (params: {
25
+ channel: Channel;
26
+ options?: MarkReadRequest;
27
+ }) => Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
28
+ /**
29
+ * A channel's **resolved** configuration — what {@link Channel.config} returns.
30
+ *
31
+ * Not `ChannelConfigWithInfo`, which is the generated type for the channel *type's server*
32
+ * configuration behind {@link Channel.serverConfig}. The two are related: the gates below are the
33
+ * server's flags already ANDed with what the integrator registered.
34
+ */
35
+ export type ChannelConfig = {
36
+ requestHandlers?: {
37
+ deleteMessageRequest?: OperationRequestFn<'delete'>;
38
+ markReadRequest?: CustomMarkReadRequestFn;
39
+ sendMessageRequest?: OperationRequestFn<'send'>;
40
+ retrySendMessageRequest?: OperationRequestFn<'retry'>;
41
+ updateMessageRequest?: OperationRequestFn<'update'>;
42
+ };
19
43
  /**
20
- * Per-call override for the send/retry request (advanced).
21
- * If set, it takes precedence over channel instance configuration handlers.
44
+ * Typing indicators for this channel (defaults to enabled). ANDed with the channel type's
45
+ * `typing_events`, so either side can switch them off and neither can widen.
46
+ *
47
+ * This is the channel-wide gate, read by {@link Channel.keystroke} and {@link Channel.stopTyping}.
48
+ * `messageComposer.text.publishTypingEvents` sits on top of it as a per-composer refinement — a thread
49
+ * composer can stay quiet while the channel still permits typing events.
22
50
  */
23
- sendMessageRequestFn?: CustomSendMessageRequestFn;
24
- };
25
- export type RetrySendMessageWithLocalUpdateParams = Omit<SendMessageWithStateUpdateParams, 'message'>;
26
- export type UpdateMessageWithStateUpdateParams = {
27
- localMessage: LocalMessage;
28
- options?: UpdateMessageOptions;
51
+ typingEvents: {
52
+ enabled: boolean;
53
+ };
29
54
  /**
30
- * Per-call override for the update request (advanced).
31
- * If set, it takes precedence over channel instance configuration handlers.
55
+ * Read receipts for this channel. `enabled` (defaults to true) is ANDed with the channel type's
56
+ * `read_events`, so either side can switch them off and neither can widen. Read by
57
+ * {@link Channel.markRead} and {@link Channel.markUnread}.
58
+ *
59
+ * `localUnreadCountEnabled` (defaults to false) applies only once `enabled` is false: the channel
60
+ * keeps counting unread messages for this user and {@link Channel.markReadLocally} resets that
61
+ * count, with nothing sent to the server. It is deliberately outside the server's authority -
62
+ * counting locally is what an integrator does *because* the server declines to.
32
63
  */
33
- updateMessageRequestFn?: CustomUpdateMessageRequestFn;
34
- };
35
- export type DeleteMessageWithStateUpdateParams = {
36
- localMessage: LocalMessage;
37
- options?: DeleteMessageOptions;
64
+ readEvents: {
65
+ enabled: boolean;
66
+ localUnreadCountEnabled: boolean;
67
+ };
38
68
  /**
39
- * Per-call override for the delete request (advanced).
40
- * If set, it takes precedence over channel instance configuration handlers.
69
+ * Threaded replies for this channel (defaults to enabled). ANDed with the channel type's `replies`.
41
70
  */
42
- deleteMessageRequestFn?: CustomDeleteMessageRequestFn;
43
- };
44
- export type CustomSendMessageRequestFn = (params: Omit<SendMessageWithStateUpdateParams, 'sendMessageRequestFn'>) => Promise<{
45
- message: MessageResponse;
46
- }>;
47
- export type CustomUpdateMessageRequestFn = (params: Omit<UpdateMessageWithStateUpdateParams, 'updateMessageRequestFn'>) => Promise<{
48
- message: MessageResponse;
49
- }>;
50
- export type CustomDeleteMessageRequestFn = (params: Omit<DeleteMessageWithStateUpdateParams, 'deleteMessageRequestFn'>) => Promise<{
51
- message: MessageResponse;
52
- }>;
53
- export type CustomMarkReadRequestFn = (params: {
54
- channel: Channel;
55
- options?: MarkReadRequest;
56
- }) => Promise<EventAPIResponse | null>;
57
- export type ChannelInstanceConfig = {
58
- requestHandlers?: {
59
- deleteMessageRequest?: CustomDeleteMessageRequestFn;
60
- markReadRequest?: CustomMarkReadRequestFn;
61
- sendMessageRequest?: CustomSendMessageRequestFn;
62
- retrySendMessageRequest?: CustomSendMessageRequestFn;
63
- updateMessageRequest?: CustomUpdateMessageRequestFn;
71
+ replies: {
72
+ enabled: boolean;
73
+ };
74
+ /**
75
+ * Message reminders — "remind me" and "save for later" (defaults to enabled). ANDed with the channel
76
+ * type's `user_message_reminders`.
77
+ */
78
+ userMessageReminders: {
79
+ enabled: boolean;
64
80
  };
81
+ /**
82
+ * Delivery receipts (defaults to enabled). ANDed with the channel type's `delivery_events`.
83
+ */
84
+ deliveryEvents: {
85
+ enabled: boolean;
86
+ };
87
+ /**
88
+ * The slash commands this channel type offers, as the server reports them.
89
+ *
90
+ * Named for availability rather than enablement on purpose: whether any given command can be *used*
91
+ * right now is `messageComposer.isCommandDisabled(command)`, which depends on the message context —
92
+ * editing and quoting disable different ones. A list called `enabledCommands` would routinely contain
93
+ * disabled entries.
94
+ *
95
+ * **Server-owned, and the one field here the integrator cannot set.** It is a list rather than a gate,
96
+ * so there is nothing to AND and no intent to express — the server's answer simply *is* the value, and
97
+ * it is absent from the declarative tree for that reason.
98
+ *
99
+ * It lives on the resolved configuration anyway so that consumers never need a second place to look:
100
+ * every question about what this channel permits is answered by `config`. Reading the raw
101
+ * {@link Channel.serverConfig} instead is what made a UI show features the client had disabled — the
102
+ * gates below have a client half, and mixing the two sources meant sometimes reading only one.
103
+ */
104
+ availableCommands: Command[];
65
105
  };
106
+ export declare const DEFAULT_CHANNEL_CONFIG: ChannelConfig;
66
107
  /**
67
108
  * The Channel class manages its own state.
68
109
  */
69
110
  export declare class Channel extends ChannelApi {
70
111
  _client: StreamChat;
71
- data: Partial<ChannelResponse> | undefined;
72
- _data: ChannelData;
112
+ _data: ChannelInput;
73
113
  cid: string;
74
114
  /** */
75
115
  listeners: Map<EventType, Set<EventHandler>>;
76
116
  state: ChannelState;
77
- /**
78
- * This boolean is a vague indication of whether the channel exists on chat backend.
79
- *
80
- * If the value is true, then that means the channel has been initialized by either calling
81
- * channel.create() or channel.query() or channel.watch().
82
- *
83
- * If the value is false, then channel may or may not exist on the backend. The only way to ensure
84
- * is by calling channel.create() or channel.query() or channel.watch().
85
- */
86
- initialized: boolean;
87
- /**
88
- * Indicates whether channel has been initialized by manually populating the state with some messages, members etc.
89
- * Static state indicates that channel exists on backend, but is not being watched yet.
90
- */
91
- offlineMode: boolean;
92
117
  lastKeyStroke?: Date;
93
118
  lastTypingEvent: Date | null;
94
119
  isTyping: boolean;
95
- disconnected: boolean;
120
+ /** Re-entrancy guard for {@link Channel.reload} (mirrors Thread.reload's isLoading guard). */
121
+ private _reloading;
122
+ /** Refcount backing the reactive `active` flag (a shared Channel instance can have several consumers). */
123
+ private _activeRefCount;
124
+ private _channelQueriesInFlight;
125
+ /**
126
+ * The watch {@link Channel.ensureWatched} started and is still waiting for the response, with its
127
+ * options. Later `ensureWatched()` calls with the same options wait for it instead of sending
128
+ * another request; `watch()` calls are not recorded here.
129
+ */
130
+ private _ensureWatchedInFlight?;
96
131
  push_preferences?: Gen_ChannelPushPreferencesResponse;
97
- readonly configState: StateStore<ChannelInstanceConfig>;
132
+ /**
133
+ * The shared configuration machinery. Owned rather than inherited — `Channel` already extends
134
+ * `ChannelApi`, so single inheritance is spent.
135
+ *
136
+ * `mergeSlice: 'deep'` because the config has nested groups: registering `typingEvents.enabled` must
137
+ * not drop `readEvents`. `applyAuthority` is what makes `channel.config` the *whole* answer rather
138
+ * than the client's half — see {@link serverRestrictions}.
139
+ */
140
+ private readonly configController;
98
141
  readonly messageComposer: MessageComposer;
99
142
  readonly messageReceiptsTracker: MessageReceiptsTracker;
143
+ readonly messageOperations: MessageOperations;
100
144
  readonly messagePaginator: MessagePaginator;
101
145
  readonly pinnedMessagesPaginator: PinnedMessagePaginator;
102
- readonly messageOperations: MessageOperations;
103
146
  readonly cooldownTimer: CooldownTimer;
147
+ /**
148
+ * Teardown for this channel's configuration subscription, released by {@link disconnect}. Left
149
+ * subscribed, a disconnected channel would stay in the configuration store's handler set for good.
150
+ */
151
+ private unsubscribeConfiguration?;
152
+ /** Teardown for the server-config re-derivation subscription, released by {@link disconnect}. */
153
+ private unsubscribeServerConfig?;
154
+ /** The declarative slice last derived from, so a late server answer can re-derive from the same one. */
155
+ private declarativeConfig?;
104
156
  /**
105
157
  * Creates a `Channel` instance bound to the given chat client.
106
158
  *
@@ -110,258 +162,249 @@ export declare class Channel extends ChannelApi {
110
162
  * @param data - Any additional custom params.
111
163
  * @returns A new uninitialized channel.
112
164
  */
113
- constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelData);
165
+ constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelInput);
114
166
  /**
115
- * Returns the chat client for this channel. Throws if `client.disconnect()` was called.
167
+ * The configuration fields this channel's *type* decides server-side.
116
168
  *
117
- * @returns The chat client.
169
+ * Both are boolean gates, so `mergeServerRestrictions` ANDs them with what was requested: either the
170
+ * server or the integrator may switch a feature off, and neither can widen. Re-read on every
171
+ * derivation rather than captured, so a flag that changes mid-session is picked up.
118
172
  */
119
- getClient(): StreamChat;
173
+ private get serverRestrictions();
120
174
  /**
121
- * Returns the config for this channel ID (CID).
175
+ * Derives this channel's configuration — and its sub-objects' — from the declarative slice.
122
176
  *
123
- * @returns The channel config.
177
+ * Called by the constructor and by `client.config.reset()`. The channel owns only its own
178
+ * `requestHandlers`; each sub-object derives its own configuration, so the knowledge of what
179
+ * `messagePaginator.pageSize` means stays inside the paginator.
124
180
  */
125
- getConfig(): import(".").ChannelConfigWithInfo | undefined;
126
- _sendMessage(request: Gen_SendMessageRequest): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
181
+ initializeConfig(declarativeConfig?: ChannelDeclarativeConfig): void;
127
182
  /**
128
- * Sends a message to this channel.
183
+ * Returns the chat client for this channel. Throws if the channel is pending disposal — see
184
+ * {@link Channel.pendingDisposal}.
129
185
  *
130
- * @param request - The send message request payload, including the message body and optional flags
131
- * such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`.
132
- * @returns The server response.
133
- */
134
- sendMessage(request: Gen_SendMessageRequest): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
135
- /**
136
- * Sends a message with optimistic local state update.
137
- */
138
- sendMessageWithLocalUpdate(params: SendMessageWithStateUpdateParams): Promise<void>;
139
- /**
140
- * Retry sending a failed message.
186
+ * @returns The chat client.
141
187
  */
142
- retrySendMessageWithLocalUpdate(params: Omit<SendMessageWithStateUpdateParams, 'message'>): Promise<void>;
188
+ getClient(): StreamChat;
189
+ /** What a call on a disposed instance fails with: it is done for good, and how to get a live one. */
190
+ private disposedError;
143
191
  /**
144
- * Updates a message with optimistic local state update.
192
+ * Resolved configuration, as a store. Delegates rather than holding a copy, so the field and the
193
+ * controller's store cannot drift.
194
+ *
195
+ * Still directly writable, and deliberately so: the React SDK installs per-component request handlers
196
+ * by calling `partialNext({ requestHandlers })` on it. That write bypasses the controller, which is
197
+ * why `requestHandlers` is the one field a re-derivation replaces wholesale — see
198
+ * {@link initializeConfig}.
145
199
  */
146
- updateMessageWithLocalUpdate(params: UpdateMessageWithStateUpdateParams): Promise<void>;
200
+ get configState(): StateStore<ChannelConfig>;
147
201
  /**
148
- * Deletes a message with local state update.
202
+ * This channel's **resolved** configuration — the shape every configurable class exposes.
203
+ *
204
+ * Not to be confused with {@link serverConfig}, which is this channel's configuration as the
205
+ * server reports it. This one has already folded that in: `typingEvents.enabled` is the server's
206
+ * `typing_events` ANDed with whatever the integrator registered, so it is the whole answer. The
207
+ * near-collision is why the server side became `serverConfig`, a getter that says what it
208
+ * is.
149
209
  */
150
- deleteMessageWithLocalUpdate(params: DeleteMessageWithStateUpdateParams): Promise<void>;
210
+ get config(): Readonly<ChannelConfig>;
151
211
  /**
152
- * Adds a reaction with an optimistic local state update: the reaction is applied to the cached
153
- * message immediately ({@link applyReactionLocally}), then the request is
154
- * fired via {@link Channel.sendReaction} (which owns the offline-DB write + queue). The
155
- * server-authoritative counts reconcile on the response; the message is rolled back on failure.
212
+ * This channel's configuration as the server reports it — feature flags such as `uploads`,
213
+ * `typing_events`, `read_events` and `commands`.
214
+ *
215
+ * Mostly a property of the channel *type*, but not only: a channel's own `config_overrides` narrow it
216
+ * for that channel alone, which is why the cache behind this is keyed by cid rather than by type. See
217
+ * `StreamChat._addChannelConfig`.
218
+ *
219
+ * `undefined` until this channel has been queried or watched — there is nothing to fall back on that
220
+ * would not be another channel's overrides. {@link config} covers that case with its defaults.
221
+ *
222
+ * Distinct from {@link config}, which is this instance's resolved configuration and already has the
223
+ * relevant flags below folded into it. Prefer `config` when deciding whether a feature is available:
224
+ * this getter answers only the server's half, so gating UI on it offers features the client has
225
+ * already disabled.
156
226
  */
157
- addReactionWithLocalUpdate({ messageId, reaction, options, }: {
158
- messageId: string;
159
- reaction: ReactionRequest;
160
- options?: Pick<SendReactionRequest, 'enforce_unique' | 'skip_push'>;
161
- }): Promise<void>;
227
+ get serverConfig(): import(".").ChannelConfigWithInfo | undefined;
162
228
  /**
163
- * Removes the current user's reaction with an optimistic local state update, mirroring
164
- * {@link Channel.addReactionWithLocalUpdate}.
229
+ * Sends a message to this channel.
230
+ *
231
+ * @param ...args - `[request, requestOptions]`. `request` holds the message body and optional
232
+ * flags such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`; `requestOptions`
233
+ * carries per-request options such as an abort `signal` and is never serialized into the request.
234
+ * @returns The server response.
165
235
  */
166
- deleteReactionWithLocalUpdate({ messageId, type, }: {
167
- messageId: string;
168
- type: string;
169
- }): Promise<void>;
236
+ sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<StreamResponse<import(".").SendMessageResponse>>;
237
+ sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<StreamResponse<import(".").SendReactionResponse>>;
238
+ deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<StreamResponse<import(".").DeleteReactionResponse>>;
170
239
  /**
171
- * Upload a file to this channel’s file endpoint (multipart). Forwards to the client’s `sendFile` implementation.
240
+ * Upload a file to this channel's file endpoint (multipart).
172
241
  *
173
- * @param uri - File source: URL string, `File`, `Buffer`, or readable stream (Node).
174
- * @param name - File name sent in the multipart body (optional).
175
- * @param contentType - MIME type; defaults are applied when omitted (optional).
176
- * @param user - User payload appended to the form as JSON (optional).
177
- * @param axiosRequestConfig - Axios per-request config, merged after upload defaults, e.g. `onUploadProgress`, `signal` from `AbortController` (optional).
242
+ * @param request - Upload payload. `request.file` is the file to upload.
243
+ * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
178
244
  * @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
179
245
  */
180
- sendFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
246
+ uploadChannelFile(request?: Omit<UploadChannelFileRequest, 'file'> & {
247
+ file?: FileUploadInput;
248
+ }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
181
249
  /**
182
- * Upload an image to this channel's image endpoint (multipart). Uses the same transport as `sendFile`.
250
+ * Upload an image to this channel's image endpoint (multipart).
183
251
  *
184
- * @param uri - Image source: URL string, `File`, or readable stream (Node). For `Buffer` uploads, use `sendFile` toward the channel file endpoint instead.
185
- * @param name - File name sent in the multipart body (optional).
186
- * @param contentType - MIME type (optional).
187
- * @param user - User payload appended to the form as JSON (optional).
188
- * @param axiosRequestConfig - Axios per-request config, merged after upload defaults, e.g. `onUploadProgress`, `signal` (optional).
252
+ * @param request - Upload payload. `request.file` is the image to upload.
253
+ * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
189
254
  * @returns A promise resolving to `{ file: string, ... }` with the CDN URL.
190
255
  */
191
- sendImage(uri: string | NodeJS.ReadableStream | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<import("./types").SendFileAPIResponse>;
192
- deleteFile(url: string): Promise<import("./types").StreamResponse<import(".").Response>>;
193
- deleteImage(url: string): Promise<import("./types").StreamResponse<import(".").Response>>;
256
+ uploadChannelImage(request?: Omit<UploadChannelRequest, 'file'> & {
257
+ file?: FileUploadInput;
258
+ }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelResponse>>;
259
+ /**
260
+ * Alias for {@link uploadChannelFile}, mirroring `client.uploadFile`.
261
+ */
262
+ uploadFile: (...args: Parameters<Channel["uploadChannelFile"]>) => Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
263
+ /** Alias for {@link uploadChannelImage}, mirroring `client.uploadImage`. */
264
+ uploadImage: (...args: Parameters<Channel["uploadChannelImage"]>) => Promise<StreamResponse<import(".").UploadChannelResponse>>;
265
+ deleteFile(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
266
+ deleteImage(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
194
267
  /**
195
268
  * Sends an event on this channel.
196
269
  *
197
- * @param event - For example `{ type: 'message.read' }`.
270
+ * @param request - For example `{ event: { type: 'message.read' } }`.
271
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
272
+ * into the request (optional).
198
273
  * @returns The server response.
199
274
  */
200
275
  sendEvent(request: {
201
276
  event: Event;
202
- }): Promise<import("./types").StreamResponse<import(".").EventResponse>>;
203
- /**
204
- * Queries messages.
205
- *
206
- * @param request - The search request payload (optional). The inner `payload` accepts
207
- * MongoDB-style filters and additional options such as `user_id`.
208
- * @returns The search messages response.
209
- */
210
- search(request?: {
211
- payload?: SearchPayload;
212
- }): Promise<import("./types").StreamResponse<import(".").SearchResponse>>;
277
+ }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").EventResponse>>;
213
278
  /**
214
279
  * Queries members.
215
280
  *
216
281
  * @param request - The query members request payload (optional). The inner `payload` accepts
217
282
  * MongoDB-style filters, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`),
218
283
  * and pagination options (`limit`, `offset`).
284
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
285
+ * into the request (optional).
219
286
  * @returns The query members response.
220
287
  */
221
288
  queryMembers(request?: {
222
289
  payload?: Partial<QueryMembersPayload>;
223
- }): Promise<import("./types").StreamResponse<import(".").MembersResponse>>;
224
- /**
225
- * Sends a reaction to a message. If offline support is enabled, it will make sure
226
- * that sending the reaction is queued up if it fails due to bad internet conditions and executed
227
- * later.
228
- *
229
- * @param request - The send-reaction request payload, including the target message ID, the
230
- * reaction object (e.g. `{ type: 'love' }`), and optional flags such as `enforce_unique` and
231
- * `skip_push`.
232
- * @returns The server response.
233
- */
234
- sendReaction(request: Parameters<ChatApi['sendReaction']>[0]): Promise<ReactionAPIResponse>;
235
- _sendReaction(request: Parameters<ChatApi['sendReaction']>[0]): Promise<import("./types").StreamResponse<import(".").SendReactionResponse>>;
236
- deleteReaction(request: Parameters<ChatApi['deleteReaction']>[0]): Promise<ReactionAPIResponse>;
237
- /**
238
- * Deletes a reaction by user and type.
239
- *
240
- * @param request - The delete reaction request payload identifying the target message and reaction type.
241
- * @returns The server response.
242
- */
243
- _deleteReaction(request: Parameters<ChatApi['deleteReaction']>[0]): Promise<import("./types").StreamResponse<import(".").DeleteReactionResponse>>;
290
+ }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MembersResponse>>;
244
291
  /**
245
292
  * Edit the channel using the inherited `update()` from `ChannelApi`. Caches the
246
293
  * server-returned channel onto `this.data`.
247
294
  *
248
- * @param request - Channel update payload, e.g. `{ data: { name: 'foo' }, message }` (optional).
295
+ * @param ...args - `[request, requestOptions]`. `request` is the channel update payload, e.g.
296
+ * `{ data: { name: 'foo' }, message }`; `requestOptions` carries per-request options such as an
297
+ * abort `signal` and is never serialized into the request.
249
298
  * @returns The server response.
250
299
  */
251
- update(request?: Gen_UpdateChannelRequest): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
300
+ update(...args: Parameters<ChannelApi['update']>): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
252
301
  /**
253
302
  * Partial update of channel properties.
254
303
  *
255
304
  * @param update - The partial update request.
305
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
306
+ * into the request (optional).
256
307
  * @returns The server response.
257
308
  */
258
- updatePartial(update: UpdateChannelPartialRequest): Promise<import("./types").StreamResponse<import(".").UpdateChannelPartialResponse>>;
309
+ updatePartial(update: UpdateChannelPartialRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelPartialResponse>>;
259
310
  /**
260
311
  * Enables slow mode.
261
312
  *
262
313
  * @param coolDownInterval - The cooldown interval in seconds.
314
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
315
+ * into the request (optional).
263
316
  * @returns The server response.
264
317
  */
265
- enableSlowMode(coolDownInterval: number): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
318
+ enableSlowMode(coolDownInterval: number, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
266
319
  /**
267
320
  * Disables slow mode.
268
321
  *
322
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
323
+ * second argument, as on the generated methods; pass `undefined`.
324
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
325
+ * into the request (optional).
269
326
  * @returns The server response.
270
327
  */
271
- disableSlowMode(): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
328
+ disableSlowMode(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
272
329
  sendSharedLocation(location: SharedLocation & {
273
330
  message_id?: string;
274
- }): Promise<import("./types").StreamResponse<import(".").SendMessageResponse>>;
275
- stopLiveLocationSharing(payload: UpdateLiveLocationRequest): Promise<void>;
331
+ }): Promise<import(".").SendMessageResponse & {
332
+ metadata: import("./types").RequestMetadata;
333
+ }>;
334
+ stopLiveLocationSharing(payload: UpdateLiveLocationRequest, requestOptions?: StreamRequestOptions): Promise<void>;
276
335
  /**
277
336
  * Accepts an invitation to the channel.
278
337
  *
279
338
  * @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
339
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
340
+ * into the request (optional).
280
341
  * @returns The server response.
281
342
  */
282
- acceptInvite(options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
343
+ acceptInvite(options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
283
344
  /**
284
345
  * Rejects an invitation to the channel.
285
346
  *
286
347
  * @param options - The object to update the custom properties of this channel with (optional, defaults to `{}`).
348
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
349
+ * into the request (optional).
287
350
  * @returns The server response.
288
351
  */
289
- rejectInvite(options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
352
+ rejectInvite(options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
290
353
  /**
291
354
  * Adds members to the channel.
292
355
  *
293
356
  * @param members - An array of members to add to the channel.
294
357
  * @param message - Message object for channel members notification (optional).
295
358
  * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
359
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
360
+ * into the request (optional).
296
361
  * @returns The server response.
297
362
  */
298
- addMembers(members: string[] | Array<Gen_ChannelMemberRequest>, message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
363
+ addMembers(members: string[] | Array<Gen_ChannelMemberRequest>, message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
299
364
  /**
300
365
  * Adds filter tags to the channel.
301
366
  *
302
367
  * @param tags - An array of tags to add to the channel.
303
368
  * @param message - Message object for channel members notification (optional).
304
369
  * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
370
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
371
+ * into the request (optional).
305
372
  * @returns The server response.
306
373
  */
307
- addFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
374
+ addFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
308
375
  /**
309
376
  * Removes filter tags from the channel.
310
377
  *
311
378
  * @param tags - An array of tags to remove from the channel.
312
379
  * @param message - Message object for channel members notification (optional).
313
380
  * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
381
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
382
+ * into the request (optional).
314
383
  * @returns The server response.
315
384
  */
316
- removeFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
317
- /**
318
- * Adds moderators to the channel.
319
- *
320
- * @param members - An array of member identifiers.
321
- * @param message - Message object for channel members notification (optional).
322
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
323
- * @returns The server response.
324
- */
325
- addModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
326
- /**
327
- * Sets member roles in a channel.
328
- *
329
- * @param roles - List of role assignments.
330
- * @param message - Message object for channel members notification (optional).
331
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
332
- * @returns The server response.
333
- */
334
- assignRoles(roles: {
335
- channel_role: RoleName;
336
- user_id: string;
337
- }[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
385
+ removeFilterTags(tags: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
338
386
  /**
339
387
  * Invite members to the channel.
340
388
  *
341
389
  * @param members - An array of members to invite to the channel.
342
390
  * @param message - Message object for channel members notification (optional).
343
391
  * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
392
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
393
+ * into the request (optional).
344
394
  * @returns The server response.
345
395
  */
346
- inviteMembers(members: string[] | Required<Omit<Gen_ChannelMemberRequest, 'channel_role'>>[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
396
+ inviteMembers(members: string[] | Required<Omit<Gen_ChannelMemberRequest, 'channel_role'>>[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
347
397
  /**
348
398
  * Removes members from the channel.
349
399
  *
350
400
  * @param members - An array of member identifiers.
351
401
  * @param message - Message object for channel members notification (optional).
352
402
  * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
403
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
404
+ * into the request (optional).
353
405
  * @returns The server response.
354
406
  */
355
- removeMembers(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
356
- /**
357
- * Removes the moderator role from channel members.
358
- *
359
- * @param members - An array of member identifiers.
360
- * @param message - Message object for channel members notification (optional).
361
- * @param options - Configuration to control the behavior while updating (optional, defaults to `{}`).
362
- * @returns The server response.
363
- */
364
- demoteModerators(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions): Promise<import("./types").StreamResponse<import(".").UpdateChannelResponse>>;
407
+ removeMembers(members: string[], message?: MessageRequest, options?: ChannelUpdateOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
365
408
  /**
366
409
  * Mutes the current channel.
367
410
  *
@@ -375,9 +418,11 @@ export declare class Channel extends ChannelApi {
375
418
  *
376
419
  * @param options - Mute options (optional, defaults to `{}`).
377
420
  * @param options.expiration - Expiration in minutes (optional).
421
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
422
+ * into the request (optional).
378
423
  * @returns The server response.
379
424
  */
380
- mute(options?: Gen_MuteChannelRequest): Promise<import("./types").StreamResponse<import(".").MuteChannelResponse>>;
425
+ mute(options?: Gen_MuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MuteChannelResponse>>;
381
426
  /**
382
427
  * Unmutes the current channel.
383
428
  *
@@ -387,60 +432,78 @@ export declare class Channel extends ChannelApi {
387
432
  *
388
433
  * @param options - Unmute options (optional, defaults to `{}`).
389
434
  * @param options.user_id - User ID (optional).
435
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
436
+ * into the request (optional).
390
437
  * @returns The server response.
391
438
  */
392
- unmute(options?: Gen_UnmuteChannelRequest): Promise<import("./types").StreamResponse<import(".").UnmuteResponse>>;
439
+ unmute(options?: Gen_UnmuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnmuteResponse>>;
393
440
  /**
394
441
  * Archives the current channel.
395
442
  *
396
443
  * @example
397
444
  * await channel.archive();
398
445
  *
446
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
447
+ * second argument, as on the generated methods; pass `undefined`.
448
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
449
+ * into the request (optional).
399
450
  * @returns The server response.
400
451
  */
401
- archive(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
452
+ archive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
402
453
  /**
403
454
  * Unarchives the current channel.
404
455
  *
405
456
  * @example
406
457
  * await channel.unarchive();
407
458
  *
459
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
460
+ * second argument, as on the generated methods; pass `undefined`.
461
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
462
+ * into the request (optional).
408
463
  * @returns The server response.
409
464
  */
410
- unarchive(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
465
+ unarchive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
411
466
  /**
412
467
  * Pins the current channel.
413
468
  *
414
469
  * @example
415
470
  * await channel.pin();
416
471
  *
472
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
473
+ * second argument, as on the generated methods; pass `undefined`.
474
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
475
+ * into the request (optional).
417
476
  * @returns The server response.
418
477
  */
419
- pin(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
478
+ pin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
420
479
  /**
421
480
  * Unpins the current channel.
422
481
  *
423
482
  * @example
424
483
  * await channel.unpin();
425
484
  *
485
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
486
+ * second argument, as on the generated methods; pass `undefined`.
487
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
488
+ * into the request (optional).
426
489
  * @returns The server response.
427
490
  */
428
- unpin(): Promise<import("./types").StreamResponse<import(".").UpdateMemberPartialResponse>>;
491
+ unpin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
429
492
  /**
430
493
  * Returns the mute status for the current channel.
431
494
  *
432
- * @returns An object of the form `{ muted: true | false, createdAt: Date | null, expiresAt: Date | null }`.
495
+ * @returns An object of the form `{ muted: true | false, createdAt: TimestampNS | null, expiresAt: TimestampNS | null }`,
496
+ * where the timestamps are unix nanoseconds as the API sends them.
433
497
  */
434
- muteStatus(): {
435
- muted: boolean;
436
- createdAt: Date;
437
- expiresAt: Date | null;
438
- } | {
439
- muted: boolean;
440
- createdAt: null;
441
- expiresAt: null;
442
- };
443
- sendAction(messageId: string, formData: Record<string, string>): Promise<import("./types").StreamResponse<import(".").MessageActionResponse>>;
498
+ muteStatus(): import("./channel_state").ChannelMuteStatus;
499
+ /**
500
+ * Recomputes this channel's reactive `state.muteStatus` from the client's current `mutedChannels`
501
+ * and publishes it only when it actually changed — so the frequent `health.check` fan-out does not
502
+ * churn subscribers. Called from the constructor and by the client whenever `mutedChannels`
503
+ * updates. Unlike `muteStatus()`, this does not require the channel to be initialized.
504
+ */
505
+ _syncMuteStatus(): void;
506
+ sendAction(messageId: string, formData: Record<string, string>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MessageActionResponse>>;
444
507
  /**
445
508
  * First of the `typing.start` and `typing.stop` events based on the user's keystrokes.
446
509
  * Call this on every keystroke.
@@ -449,10 +512,12 @@ export declare class Channel extends ChannelApi {
449
512
  *
450
513
  * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
451
514
  * @param options - Optional override carrying a `user_id` (optional).
515
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
516
+ * into the request (optional).
452
517
  */
453
518
  keystroke(parentId?: string, options?: {
454
519
  user_id: string;
455
- }): Promise<void>;
520
+ }, requestOptions?: StreamRequestOptions): Promise<void>;
456
521
  /**
457
522
  * Sends an event to update the AI state for a specific message.
458
523
  * Typically used by the server connected to the AI service to notify clients of state changes.
@@ -461,20 +526,32 @@ export declare class Channel extends ChannelApi {
461
526
  * @param state - The new state of the AI process, e.g. thinking, generating.
462
527
  * @param options - Parameters such as `ai_message` to include additional details in the event (optional, defaults to `{}`).
463
528
  * @param options.ai_message - Additional message detail to include in the event (optional).
529
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
530
+ * into the request (optional).
464
531
  */
465
532
  updateAIState(messageId: string, state: AIState, options?: {
466
533
  ai_message?: string;
467
- }): Promise<void>;
534
+ }, requestOptions?: StreamRequestOptions): Promise<void>;
468
535
  /**
469
536
  * Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming.
470
537
  * Typically used by the server connected to the AI service to inform clients that the AI response has started.
538
+ *
539
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
540
+ * second argument, as on the generated methods; pass `undefined`.
541
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
542
+ * into the request (optional).
471
543
  */
472
- clearAIIndicator(): Promise<void>;
544
+ clearAIIndicator(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
473
545
  /**
474
546
  * Sends an event to stop AI response generation, leaving the message in its current state.
475
547
  * Triggered by the user to halt the AI response process.
548
+ *
549
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
550
+ * second argument, as on the generated methods; pass `undefined`.
551
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
552
+ * into the request (optional).
476
553
  */
477
- stopAIResponse(): Promise<void>;
554
+ stopAIResponse(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
478
555
  /**
479
556
  * Sets last typing to null and sends the `typing.stop` event.
480
557
  *
@@ -482,10 +559,12 @@ export declare class Channel extends ChannelApi {
482
559
  *
483
560
  * @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
484
561
  * @param options - Optional override carrying a `user_id` (optional).
562
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
563
+ * into the request (optional).
485
564
  */
486
565
  stopTyping(parentId?: string, options?: {
487
566
  user_id: string;
488
- }): Promise<void>;
567
+ }, requestOptions?: StreamRequestOptions): Promise<void>;
489
568
  _isTypingIndicatorsEnabled(): boolean;
490
569
  /**
491
570
  * Run this user's mark-read reporter for this channel. Delegates to
@@ -496,26 +575,128 @@ export declare class Channel extends ChannelApi {
496
575
  *
497
576
  * @param data - Mark read options (optional, defaults to `{}`).
498
577
  */
499
- markReadViaReporter(data?: MarkReadRequest): Promise<EventAPIResponse | import("./types").StreamResponse<import(".").MarkReadResponse> | null>;
578
+ markReadViaReporter(data?: MarkReadRequest): Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
500
579
  /**
501
580
  * Override of the inherited `markRead()` from `ChannelApi` that requires the
502
581
  * channel to be initialized and respects the `read_events` channel config.
503
582
  *
504
- * @param data - Mark read options (optional, defaults to `{}`).
583
+ * @param ...args - `[data, requestOptions]`. `data` holds the mark-read options;
584
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
585
+ * serialized into the request.
505
586
  * @returns The server response, or `null` if the request was skipped.
506
587
  */
507
- markRead(data?: MarkReadRequest): Promise<import("./types").StreamResponse<import(".").MarkReadResponse>>;
588
+ markRead(...args: Parameters<ChannelApi['markRead']>): Promise<StreamResponse<MarkReadResponse>>;
589
+ /**
590
+ * Whether a live server response was applied to this instance since it was created — see
591
+ * {@link ChannelLifecycleState.initialized}. Store-backed and reactive: subscribe via
592
+ * `useStateStore(channel.state, (s) => ({ initialized: s.initialized }))`.
593
+ */
594
+ get initialized(): boolean;
595
+ set initialized(initialized: boolean);
596
+ /**
597
+ * Whether the channel has no id yet: it was built from members, and the server assigns its id when
598
+ * its query is answered. Until then no request but that query can be sent for it, and its cid is
599
+ * the temporary one built from the members. A channel with an id is never provisional, whether or
600
+ * not the server has it: requests for it go to the server, which answers for it.
601
+ *
602
+ * Not reactive, as `id` is not kept in `channel.state`. To react to it, subscribe to
603
+ * {@link Channel.initialized}: the response that sets `id` sets `initialized` to `true` too.
604
+ */
605
+ get isProvisional(): boolean;
606
+ /**
607
+ * The stored instance that replaced this one, if any — see
608
+ * {@link ChannelLifecycleState.supersededBy}. Store-backed and reactive.
609
+ *
610
+ * A superseded instance receives no events (they go to the stored instance under its cid) and
611
+ * reports `watchStatus: NotWatching`. Use the successor from then on: switch a UI showing this
612
+ * instance to it, as `ChatView` does. `ensureWatched()` resolves with it.
613
+ *
614
+ * The SDK never disconnects a superseded instance on its own before logout, as the app may still
615
+ * hold it. Call {@link Channel.disconnect} on it once nothing uses it.
616
+ */
617
+ get supersededBy(): Channel | undefined;
618
+ /**
619
+ * Whether the channel was initialized by manually populating its state (offline hydration) rather
620
+ * than a live watch. Store-backed and reactive.
621
+ */
622
+ get offlineMode(): boolean;
623
+ set offlineMode(offlineMode: boolean);
624
+ /**
625
+ * The channel's server-provided data, read from `state.data`. Assigning publishes `data`,
626
+ * `memberCount` and `ownCapabilities` in one state update. An assigned object that omits
627
+ * `member_count` or `own_capabilities` gets the last known value carried over onto a copy, so a
628
+ * partial update doesn't wipe them and raw readers (e.g. `channelHasReadEvents`) stay consistent
629
+ * with the store. The assigned object itself is never changed; editing `channel.data.x` in place
630
+ * doesn't reach the state.
631
+ */
632
+ get data(): Partial<ChannelResponse> | undefined;
633
+ set data(next: Partial<ChannelResponse> | undefined);
634
+ /**
635
+ * Whether {@link Channel.disconnect} has run: the channel was deleted, the current user removed
636
+ * from it, the client disconnected, or nothing used it any more. Store-backed and reactive.
637
+ *
638
+ * One-way and terminal — read-only, set only by {@link Channel.disconnect}, and nothing revives
639
+ * the instance. Its resources are already released ({@link Channel.disconnect} disposes the
640
+ * paginators and unregisters the subscriptions), so nothing should touch it. It stays in the
641
+ * channel store until `client.channelManager.releaseUnusedChannels()` drops it, and until then the
642
+ * SDK treats it as not stored: `client.channelManager.ensure(…)` gives a fresh instance for its
643
+ * cid, lists refuse it, and recovery never re-watches it. The offline DB refuses it as a source of
644
+ * `channel.data`, and `getClient()` throws on it, so a reference held across a `disconnectUser()`
645
+ * fails loudly instead of quietly requesting on a client with no user.
646
+ */
647
+ get pendingDisposal(): boolean;
648
+ /**
649
+ * Whether this client holds a server-side watch on the channel, and if not, whether it should be
650
+ * restored — see {@link ChannelWatchStatus}. Store-backed and reactive: subscribe via
651
+ * `useStateStore(channel.state, (s) => ({ watchStatus: s.watchStatus }))`.
652
+ */
653
+ get watchStatus(): ChannelWatchStatus;
654
+ set watchStatus(watchStatus: ChannelWatchStatus);
655
+ /**
656
+ * Whether a query for this channel (`watch()`, `query()`, `create()`) is waiting for its response.
657
+ * The channel store keeps a channel while it is loaded.
658
+ *
659
+ * @internal
660
+ */
661
+ get isQueryingChannel(): boolean;
662
+ /**
663
+ * Whether a consumer has declared this channel as the one it is currently consuming (see
664
+ * {@link Channel.activate}). Reactive — subscribe via
665
+ * `useStateStore(channel.state, (s) => ({ active: s.active }))`.
666
+ */
667
+ get active(): boolean;
668
+ /**
669
+ * Declares that a consumer is now consuming this channel's own state, and returns the function
670
+ * that ends it. Refcounted, as a single `Channel` instance can be held by several consumers at
671
+ * once, so it stays active until the last one releases. Calling a release function again does
672
+ * nothing.
673
+ *
674
+ * While active, the channel's own state takes precedence over bulk state writes: channel-list
675
+ * hydration does not re-seed its message list (its own `channel.reload()` owns that window).
676
+ *
677
+ * An active channel also stays in the channel store. Once the last consumer releases it, it is
678
+ * kept only while something else uses it (a watch, a channel list, a claim). A superseded channel
679
+ * (see {@link ChannelLifecycleState.supersededBy}) is never disconnected by its release: the app
680
+ * may still hold it. It ends at logout, or when the app calls {@link Channel.disconnect}.
681
+ *
682
+ * A disposed channel (`pendingDisposal`) isn't activated: it is not stored, gets no events and
683
+ * recovery skips it. A warning points at `client.channelManager.ensure()` for a live instance, and
684
+ * the returned release does nothing, so the caller's cleanup still runs.
685
+ */
686
+ activate: () => (() => void);
508
687
  /**
509
688
  * Marks the channel as unread from `messageId`. Only works when the `read_events` setting is enabled.
510
689
  *
511
- * @param data - Mark unread options.
690
+ * @param ...args - `[data, requestOptions]`. `data` holds the mark-unread options;
691
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
692
+ * serialized into the request.
512
693
  * @returns An API response, or `null` if the request was skipped.
513
694
  */
514
- markUnread(data?: MarkUnreadRequest): Promise<import("./types").StreamResponse<import(".").Response>>;
695
+ markUnread(...args: Parameters<ChannelApi['markUnread']>): Promise<StreamResponse<import(".").Response>>;
515
696
  /**
516
697
  * Resets this user's unread count locally, without any backend call. Intended for
517
698
  * channels that have read events disabled (e.g. livestreams) when the client is created with the
518
- * `isLocalUnreadCountEnabled` option. Dispatches a dedicated, client-only `message.read_locally` event
699
+ * `readEvents.localUnreadCountEnabled` configuration. Dispatches a dedicated, client-only `message.read_locally` event
519
700
  * that runs through the same `_handleChannelEvent` read logic as a real `message.read` (minus the
520
701
  * delivery-report network sync), so the read-state update lives in one place. When offline support
521
702
  * is enabled, the offline DB persists the reset for read-events-disabled channels, so the local
@@ -528,79 +709,110 @@ export declare class Channel extends ChannelApi {
528
709
  } & {
529
710
  channel_type: string;
530
711
  cid: string;
531
- created_at: Date;
712
+ created_at: TimestampNS;
532
713
  channel_id?: string;
533
714
  last_read_message_id?: string;
534
715
  team?: string;
535
716
  user?: UserResponse;
536
717
  } & {
537
- received_at?: Date;
718
+ received_at?: TimestampNS;
538
719
  }) | undefined;
539
720
  /**
540
721
  * Cleans the channel state and fires stop typing if needed.
541
722
  */
542
723
  clean(): void;
543
724
  /**
544
- * Loads the initial channel state and watches for changes.
725
+ * Watches the channel unless it is watched already, without duplicating a request: a call made
726
+ * while an earlier `ensureWatched()` with the same options is still in flight waits for that one
727
+ * instead of sending another. For callers that may ask for the same channel at the same time, such
728
+ * as several events naming it, or a click while an event already restores its watch.
545
729
  *
546
- * @param options - Additional options for the query endpoint (optional).
547
- * @returns The server response.
730
+ * {@link Channel.watch} and {@link Channel.query} are not affected: they always send their request,
731
+ * and are not joined by this method. A channel already watched sends nothing, so `options` such as
732
+ * a message window apply only when the call watches it; use the message paginator to load a window.
733
+ *
734
+ * Resolves with the instance to use from now on: this one, or the one that superseded it
735
+ * ({@link Channel.supersededBy}). A channel created from members is superseded when its watch
736
+ * answers with a cid another instance is already stored under; that instance is the one stored,
737
+ * listed and receiving events, so it is the one this ensures watched and resolves with.
738
+ *
739
+ * Rejects as the watch does, and every caller waiting for that watch gets its rejection. The next
740
+ * call sends a new request.
741
+ *
742
+ * @param options - Options for the watch request (optional). Calls join only a watch with the same
743
+ * options.
744
+ * @returns The instance to use, so it can follow `client.channelManager.ensure(...)` in one
745
+ * expression.
548
746
  */
549
- watch(options?: ChannelGetOrCreateRequest): Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
747
+ ensureWatched(options?: ChannelGetOrCreateRequest): Promise<Channel>;
748
+ /** This instance, or its successor if the watch just superseded it (see `ensureWatched`). */
749
+ private afterEnsuredWatch;
550
750
  /**
551
- * Stops watching the channel.
751
+ * Loads the initial channel state and watches for changes.
552
752
  *
553
- * @param request - The stop-watching request payload (optional).
753
+ * @param options - Additional options for the query endpoint (optional).
754
+ * @param requestOptions - Per-request options such as an abort `signal` (optional). The signal
755
+ * reaches the wait for a live socket as well as the request, so abandoning the call abandons the
756
+ * wait with it.
554
757
  * @returns The server response.
555
758
  */
556
- stopWatching(request?: Gen_ChannelStopWatchingRequest): Promise<import("./types").StreamResponse<import(".").Response>>;
759
+ watch(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ChannelStateResponse>>;
557
760
  /**
558
- * List the message replies for a parent message.
761
+ * Re-watch the channel and refresh its FULL loaded message window — the channel analog of
762
+ * {@link Thread.reload}. Used on reconnect to catch up AND reconcile hard deletes that happened
763
+ * while offline: a hard delete reaches other clients via no event, so an offline client only learns
764
+ * of it by diffing the re-queried page.
559
765
  *
560
- * The recommended way of working with threads is to use the `Thread` class.
766
+ * This is intentionally thin: it only re-issues `watch()` with a limit sized to the loaded window
767
+ * (`items.length`, so the whole loaded window is refreshed — not the smaller channel-list page). The
768
+ * actual fold + destructive reconciliation happens inside `query()` → `seedFirstPageSync`
769
+ * (the same path the channel-list re-hydrate and connection recovery use), driven by the loaded-id
770
+ * snapshot `query()` captures before its await. Owning that single path is what lets the SDK stop
771
+ * passing the reconciliation window/snapshot itself.
561
772
  *
562
- * @param request - The get-replies request payload, including the parent message ID, pagination
563
- * params, and optional sort directions for `created_at`.
564
- * @returns A response with a list of messages.
773
+ * Preserves failed (unsent) messages: an overlap merge keeps them (the reconcile's provenance guard
774
+ * never prunes a non-server message); only a disjoint rebuild can drop them, so any that actually
775
+ * fell out are re-ingested below. The offline DB is consulted alongside the in-memory window, because
776
+ * a failed message can be absent from memory and still be the user's unsent work — a cold boot starts
777
+ * with an empty paginator, and an eviction can drop it mid-session. v9 got this from a second, lagging
778
+ * copy of the list (the React SDK's own state); with one reactive source of truth the persisted row is
779
+ * that buffer.
565
780
  */
566
- getReplies(request: GetRepliesRequest): Promise<import("./types").StreamResponse<import(".").GetRepliesResponse>>;
781
+ reload(): Promise<void>;
567
782
  /**
568
- * List pinned messages of the channel.
569
- *
570
- * @param options - Pagination params, e.g. `{ limit: 10, id_lte: 10 }`.
571
- * @param sort - Defines sorting direction of pinned messages (optional, defaults to `[]`).
572
- * @returns A response with a list of messages.
573
- */
574
- getPinnedMessages(options: PinnedMessagePaginationOptions, sort?: PinnedMessagesSort): Promise<GetRepliesAPIResponse>;
575
- /**
576
- * List the reactions; supports pagination.
783
+ * Stops watching the channel.
577
784
  *
578
- * @param request - The request payload, including the target message ID and
579
- * pagination options (`limit`, `offset`).
785
+ * @param ...args - `[request, requestOptions]`. `request` is the stop-watching payload;
786
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
787
+ * serialized into the request.
580
788
  * @returns The server response.
581
789
  */
582
- getReactions(request: Parameters<ChatApi['getReactions']>[0]): Promise<import("./types").StreamResponse<import(".").GetReactionsResponse>>;
790
+ stopWatching(...args: Parameters<ChannelApi['stopWatching']>): Promise<StreamResponse<import(".").Response>>;
583
791
  /**
584
792
  * Retrieves a list of messages by ID.
585
793
  *
586
794
  * @param messageIds - The IDs of the messages to retrieve from this channel.
795
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
796
+ * into the request (optional).
587
797
  * @returns Server response.
588
798
  */
589
- getMessagesById(messageIds: string[]): Promise<import("./types").StreamResponse<import(".").GetManyMessagesResponse>>;
799
+ getMessagesById(messageIds: string[], requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").GetManyMessagesResponse>>;
590
800
  /**
591
801
  * Returns the last time the user marked the channel as read. If the user never marked the channel as read, this will return `null`.
592
802
  *
593
- * @returns The last-read `Date`, `null` if never read, or `undefined` if the user is unset.
803
+ * @returns The last-read timestamp in unix nanoseconds, `null` if never read, or `undefined` if
804
+ * the user is unset.
594
805
  */
595
- lastRead(): Date | null | undefined;
806
+ lastRead(): TimestampNS | null | undefined;
596
807
  _countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
597
808
  /**
598
809
  * Count of unread messages.
599
810
  *
600
- * @param lastRead - The time that the user read a message (optional, defaults to the current user's read state).
811
+ * @param lastRead - The time that the user read a message, in unix nanoseconds (optional,
812
+ * defaults to the current user's read state).
601
813
  * @returns Unread count.
602
814
  */
603
- countUnread(lastRead?: Date | null): number;
815
+ countUnread(lastRead?: TimestampNS | null): number;
604
816
  /**
605
817
  * Count the number of unread messages mentioning the current user.
606
818
  *
@@ -613,7 +825,16 @@ export declare class Channel extends ChannelApi {
613
825
  * @param options - Channel query options (optional).
614
826
  * @returns The server response.
615
827
  */
616
- create: (options?: ChannelGetOrCreateRequest) => Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
828
+ create: (options?: ChannelGetOrCreateRequest) => Promise<StreamResponse<import(".").ChannelStateResponse>>;
829
+ /**
830
+ * Stores this channel, created without an id, under the cid the server gave it. It is stored under
831
+ * `this.cid` until then: the temporary cid built from its members ({@link generateChannelTempCid}),
832
+ * or nowhere for a channel with neither id nor members. The entry moves to the server's cid. When
833
+ * another instance already holds that cid (stored by an event or a list while this one was in
834
+ * flight), that instance stays the one stored, since something may be using it, and takes over
835
+ * from this one ({@link ChannelManager.supersedeChannel}), which also drops this one's entry.
836
+ */
837
+ private storeUnderServerCid;
617
838
  /**
618
839
  * Queries the API to load messages, members, or other channel fields.
619
840
  *
@@ -622,9 +843,12 @@ export declare class Channel extends ChannelApi {
622
843
  * messages into state. Use `current` to load the initial channel state or to extend the
623
844
  * currently displayed messages; use `latest` to load/extend the latest messages; `new` is
624
845
  * used for loading a specific message and its surroundings (optional, defaults to `'current'`).
846
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
847
+ * into the request (optional).
625
848
  * @returns A query response.
626
849
  */
627
- query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<import("./types").StreamResponse<import(".").ChannelStateResponse>>;
850
+ query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ChannelStateResponse>>;
851
+ private runQuery;
628
852
  /**
629
853
  * Bans a user from a channel.
630
854
  *
@@ -632,23 +856,26 @@ export declare class Channel extends ChannelApi {
632
856
  * @param options - Ban options.
633
857
  * @returns The server response.
634
858
  */
635
- banUser(targetUserId: string, options: BanUserOptions): Promise<APIResponse>;
859
+ banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
636
860
  /**
637
861
  * Hides the channel from `queryChannels` for the user until a message is added.
638
862
  * If `clear_history` is set to `true`, all messages will be removed for the user.
639
863
  *
640
- * @param request - The hide channel request payload (optional). Pass `{ clear_history: true }`
641
- * to clear message history for the user.
864
+ * @param ...args - `[request, requestOptions]`. Pass `request: { clear_history: true }` to clear
865
+ * message history for the user; `requestOptions` carries per-request options such as an abort
866
+ * `signal` and is never serialized into the request.
642
867
  * @returns The server response.
643
868
  */
644
- hide(request?: Gen_HideChannelRequest): Promise<import("./types").StreamResponse<import(".").HideChannelResponse>>;
869
+ hide(...args: Parameters<ChannelApi['hide']>): Promise<StreamResponse<import(".").HideChannelResponse>>;
645
870
  /**
646
871
  * Removes the hidden status for a channel. Ensures the channel is initialized first.
647
872
  *
648
- * @param request - The show channel request payload (optional).
873
+ * @param ...args - `[request, requestOptions]`. `request` is the show-channel payload;
874
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
875
+ * serialized into the request.
649
876
  * @returns The server response.
650
877
  */
651
- show(request?: Gen_ShowChannelRequest): Promise<import("./types").StreamResponse<import(".").ShowChannelResponse>>;
878
+ show(...args: Parameters<ChannelApi['show']>): Promise<StreamResponse<import(".").ShowChannelResponse>>;
652
879
  /**
653
880
  * Removes the bans for a user on a channel.
654
881
  *
@@ -656,43 +883,34 @@ export declare class Channel extends ChannelApi {
656
883
  * @param options - Unban options (optional).
657
884
  * @returns The server response.
658
885
  */
659
- unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
660
- /**
661
- * Shadow bans a user from a channel.
662
- *
663
- * @param targetUserId - The user to shadow ban.
664
- * @param options - Ban options.
665
- * @returns The server response.
666
- */
667
- shadowBan(targetUserId: string, options: BanUserOptions): Promise<APIResponse>;
668
- /**
669
- * Removes the shadow ban for a user on a channel.
670
- *
671
- * @param targetUserId - The user to remove the shadow ban for.
672
- * @returns The server response.
673
- */
674
- removeShadowBan(targetUserId: string): Promise<APIResponse>;
886
+ unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<import("./types").APIResponse>;
675
887
  /**
676
888
  * Casts or cancels one or more votes on a poll.
677
889
  *
678
- * @param request - The cast-poll-vote request payload, including the target message ID, poll ID,
679
- * and the vote to cast (or an empty payload to cancel).
890
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams` holds the target
891
+ * `message_id` and `poll_id`; `request` holds the vote to cast (or an empty payload to cancel);
892
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
893
+ * serialized into the request.
680
894
  * @returns The poll vote response.
681
895
  */
682
- vote(request: Parameters<ChatApi['castPollVote']>[0]): Promise<import("./types").StreamResponse<import(".").PollVoteResponse>>;
683
- removeVote(request: Parameters<ChatApi['deletePollVote']>[0]): Promise<import("./types").StreamResponse<import(".").PollVoteResponse>>;
684
- _createDraft(request: Gen_CreateDraftRequest): Promise<import("./types").StreamResponse<CreateDraftResponse>>;
896
+ vote(...args: Parameters<ChatApi['castPollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
897
+ removeVote(...args: Parameters<ChatApi['deletePollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
898
+ _createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<StreamResponse<import(".").CreateDraftResponse>>;
685
899
  /**
686
900
  * Creates or updates a draft message in a channel. If offline support is enabled, the
687
901
  * call is queued so it is replayed on reconnect.
688
902
  */
689
- createDraft(request: Gen_CreateDraftRequest): Promise<import("./types").StreamResponse<CreateDraftResponse>>;
690
- _deleteDraft(request?: Parameters<ChannelApi['deleteDraft']>[0]): Promise<import("./types").StreamResponse<import(".").Response>>;
903
+ createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<import(".").CreateDraftResponse & {
904
+ metadata: import("./types").RequestMetadata;
905
+ }>;
906
+ _deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<StreamResponse<import(".").Response>>;
691
907
  /**
692
908
  * Deletes a draft message from a channel or a thread. If offline support is enabled, the
693
909
  * call is queued so it is replayed on reconnect.
694
910
  */
695
- deleteDraft(request?: Parameters<ChannelApi['deleteDraft']>[0]): Promise<import("./types").StreamResponse<import(".").Response>>;
911
+ deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<import(".").Response & {
912
+ metadata: import("./types").RequestMetadata;
913
+ }>;
696
914
  /**
697
915
  * Listens to events on this channel.
698
916
  *
@@ -726,16 +944,29 @@ export declare class Channel extends ChannelApi {
726
944
  off(callback: EventHandler): void;
727
945
  private _patchReadState;
728
946
  private _upsertReadState;
947
+ /**
948
+ * Sets the current user's unread count. The count lives in exactly one place — the reactive
949
+ * `read[userId].unread_messages`, which is what the unread badge reads and what
950
+ * `state.unreadCount` derives from — so channel-wide resets (`channel.truncated`, "all channels
951
+ * read") must route through here rather than writing a count of their own.
952
+ */
953
+ /** @returns whether the count actually changed, so callers can react only to the channels it did. */
954
+ _setOwnUnreadCount(unreadCount: number): boolean;
729
955
  _handleChannelEvent(event: Event): void;
730
956
  _callChannelListeners: (event: WSEvent) => void;
731
957
  /**
732
- * Returns the channel url.
958
+ * Asserts that the channel has an id. Throws an error if not (happens when we init channel with members only and not id).
959
+ * Call this before calling any API method reading this.id or this.cid directly
733
960
  *
734
- * @returns The channel url.
961
+ * Note: only id is optional, cid is defined as string, so TS won't complain about a missing check there.
962
+ */
963
+ _checkHasId(): asserts this is this & {
964
+ id: string;
965
+ };
966
+ /**
967
+ * Checks if channel has been queried/initialized. Call this when a method relies on data only available after channel is queried from API.
735
968
  */
736
- _channelURL: () => string;
737
969
  _checkInitialized(): void;
738
- _syncStateFromChannelData(data: Channel['data'], fallbackData?: Channel['data']): void;
739
970
  _initializeState(state: ChannelStateResponseFields): void;
740
971
  _extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
741
972
  _hydrateMembers({ members, overrideCurrentState, }: {
@@ -748,5 +979,24 @@ export declare class Channel extends ChannelApi {
748
979
  */
749
980
  overrideCurrentState?: boolean;
750
981
  }): void;
751
- _disconnect(): void;
982
+ /**
983
+ * Stops the instance for good and marks it for disposal: it unsubscribes from the client's
984
+ * configuration and the server config, stops the receipts tracker and the cooldown timer, disposes
985
+ * the message and pinned-message paginators (which unlinks them from the shared message store), and
986
+ * then sets `pendingDisposal: true` and `watchStatus: NotWatching`. It sends no request, so the
987
+ * server keeps a watch this connection held until the connection ends. Calling it again does
988
+ * nothing, and nothing revives the instance.
989
+ *
990
+ * The SDK calls it when a channel ends: deleted, the current user removed from it, the user
991
+ * logged out, or released as unused. Call it yourself to finish an instance you are done with.
992
+ *
993
+ * It doesn't remove the channel from the channel store, as parts of the app may still use the
994
+ * instance: a stored instance stays there, and in the lists showing it, finished, until the next
995
+ * `client.channelManager.releaseUnusedChannels()` removes it (or an end the SDK handles: deleted,
996
+ * removed from it, logout). Meanwhile `client.channelManager.ensure(…)` gives a fresh instance
997
+ * for its cid.
998
+ *
999
+ * It doesn't free memory itself: the instance is garbage collected once nothing refers to it.
1000
+ */
1001
+ disconnect(): void;
752
1002
  }