stream-chat 10.0.0-rc.8 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/README.md +7 -6
  2. package/dist/cjs/index.browser.js +22095 -22290
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +22143 -22298
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +22093 -22288
  7. package/dist/esm/index.mjs.map +4 -4
  8. package/dist/types/ChannelManager.d.ts +216 -135
  9. package/dist/types/CooldownTimer.d.ts +16 -27
  10. package/dist/types/EventHandlerPipeline.d.ts +18 -38
  11. package/dist/types/LiveLocationManager.d.ts +25 -47
  12. package/dist/types/api-client.d.ts +17 -5
  13. package/dist/types/channel.d.ts +435 -500
  14. package/dist/types/channel_state.d.ts +72 -112
  15. package/dist/types/client.d.ts +323 -440
  16. package/dist/types/client_state.d.ts +1 -3
  17. package/dist/types/configuration/ConfigController.d.ts +31 -125
  18. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +32 -124
  19. package/dist/types/configuration/keys.d.ts +5 -19
  20. package/dist/types/configuration/shape.d.ts +12 -29
  21. package/dist/types/configuration/types.d.ts +64 -79
  22. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +14 -36
  23. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  24. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  25. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  26. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  27. package/dist/types/connection/ConnectionIdManager.d.ts +45 -0
  28. package/dist/types/connection/ConnectionRecoveryManager.d.ts +84 -0
  29. package/dist/types/connection/index.d.ts +4 -0
  30. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +82 -0
  31. package/dist/types/connection/networkConnection/index.d.ts +3 -0
  32. package/dist/types/connection/networkConnection/reporters.d.ts +20 -0
  33. package/dist/types/connection/networkConnection/types.d.ts +40 -0
  34. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +137 -0
  35. package/dist/types/connection/wsConnection/WSConnection.d.ts +105 -0
  36. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +47 -0
  37. package/dist/types/connection/wsConnection/config.d.ts +31 -0
  38. package/dist/types/connection/wsConnection/index.d.ts +4 -0
  39. package/dist/types/connection/wsConnection/types.d.ts +46 -0
  40. package/dist/types/constants.d.ts +3 -1
  41. package/dist/types/custom_types.d.ts +0 -2
  42. package/dist/types/entityStore/EntityStore.d.ts +226 -65
  43. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +19 -33
  44. package/dist/types/entityStore/index.d.ts +0 -1
  45. package/dist/types/errors.d.ts +16 -19
  46. package/dist/types/formatMessageMemo.d.ts +5 -0
  47. package/dist/types/gen/chat/ChannelApi.d.ts +5 -1
  48. package/dist/types/gen/chat/ChatApi.d.ts +149 -105
  49. package/dist/types/gen/models/index.d.ts +2540 -698
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +37 -14
  52. package/dist/types/index.d.ts +10 -5
  53. package/dist/types/{i18n/languageNames.d.ts → languageNames.d.ts} +9 -24
  54. package/dist/types/logger.d.ts +1 -3
  55. package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
  56. package/dist/types/messageComposer/LocationComposer.d.ts +8 -2
  57. package/dist/types/messageComposer/attachmentIdentity.d.ts +24 -0
  58. package/dist/types/messageComposer/attachmentManager.d.ts +52 -24
  59. package/dist/types/messageComposer/attachmentUtils.d.ts +23 -0
  60. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  61. package/dist/types/messageComposer/configuration/types.d.ts +38 -50
  62. package/dist/types/messageComposer/index.d.ts +1 -0
  63. package/dist/types/messageComposer/linkPreviewsManager.d.ts +12 -9
  64. package/dist/types/messageComposer/messageComposer.d.ts +60 -123
  65. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +10 -1
  66. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +4 -0
  67. package/dist/types/messageComposer/middleware/messageComposer/commandInjection.d.ts +5 -0
  68. package/dist/types/messageComposer/middleware/messageComposer/index.d.ts +2 -0
  69. package/dist/types/messageComposer/middleware/messageComposer/pollOnly.d.ts +6 -0
  70. package/dist/types/messageComposer/middleware/messageComposer/userDataInjection.d.ts +5 -0
  71. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  72. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  73. package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +4 -0
  74. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +11 -2
  75. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +20 -19
  76. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  77. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  78. package/dist/types/messageComposer/pollComposer.d.ts +15 -5
  79. package/dist/types/messageComposer/textComposer.d.ts +14 -7
  80. package/dist/types/messageComposer/types.d.ts +27 -7
  81. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +27 -80
  82. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +43 -73
  83. package/dist/types/messageOperations/FailedSendCache.d.ts +29 -0
  84. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +16 -22
  85. package/dist/types/messageOperations/MessageOperations.d.ts +63 -34
  86. package/dist/types/messageOperations/applyReactionLocally.d.ts +15 -0
  87. package/dist/types/messageOperations/createMessageOperations.d.ts +9 -0
  88. package/dist/types/messageOperations/index.d.ts +6 -4
  89. package/dist/types/messageOperations/reflectReactionEvent.d.ts +16 -0
  90. package/dist/types/messageOperations/sendOrdering.d.ts +14 -0
  91. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +20 -0
  92. package/dist/types/messageOperations/types.d.ts +43 -14
  93. package/dist/types/middleware.d.ts +10 -0
  94. package/dist/types/moderation.d.ts +21 -14
  95. package/dist/types/notifications/NotificationManager.d.ts +10 -23
  96. package/dist/types/notifications/types.d.ts +21 -57
  97. package/dist/types/offline-support/offline_support_api.d.ts +150 -528
  98. package/dist/types/offline-support/offline_sync_manager.d.ts +21 -42
  99. package/dist/types/offline-support/queueableOperations.d.ts +35 -37
  100. package/dist/types/offline-support/types.d.ts +40 -185
  101. package/dist/types/pagination/FilterBuilder.d.ts +1 -18
  102. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  103. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  104. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +4 -5
  105. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +19 -5
  106. package/dist/types/pagination/index.d.ts +1 -0
  107. package/dist/types/pagination/paginators/BasePaginator.d.ts +604 -550
  108. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +123 -106
  109. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +576 -327
  110. package/dist/types/pagination/paginators/MessagePaginator.d.ts +237 -131
  111. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +15 -26
  112. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +4 -3
  113. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +44 -0
  114. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +5 -8
  115. package/dist/types/pagination/paginators/index.d.ts +1 -0
  116. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  117. package/dist/types/pagination/utility.normalization.d.ts +8 -13
  118. package/dist/types/pagination/utility.search.d.ts +3 -8
  119. package/dist/types/poll.d.ts +35 -8
  120. package/dist/types/poll_manager.d.ts +12 -2
  121. package/dist/types/poll_optimistic_votes.d.ts +57 -0
  122. package/dist/types/reminders/Reminder.d.ts +17 -7
  123. package/dist/types/reminders/ReminderManager.d.ts +13 -25
  124. package/dist/types/search/BaseSearchSource.d.ts +10 -8
  125. package/dist/types/search/ChannelSearchSource.d.ts +16 -0
  126. package/dist/types/search/MessageSearchSource.d.ts +17 -0
  127. package/dist/types/search/SearchController.d.ts +26 -28
  128. package/dist/types/search/types.d.ts +6 -10
  129. package/dist/types/signing.d.ts +12 -3
  130. package/dist/types/thread.d.ts +67 -129
  131. package/dist/types/thread_manager.d.ts +95 -66
  132. package/dist/types/token_manager.d.ts +8 -13
  133. package/dist/types/types.d.ts +81 -197
  134. package/dist/types/types.utility.d.ts +3 -3
  135. package/dist/types/upload-utils.d.ts +5 -10
  136. package/dist/types/uploadManager.d.ts +31 -11
  137. package/dist/types/utils/FixedSizeQueueCache.d.ts +8 -11
  138. package/dist/types/utils/WithSubscriptions.d.ts +6 -16
  139. package/dist/types/utils/abort.d.ts +17 -0
  140. package/dist/types/utils/concurrency.d.ts +12 -20
  141. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  142. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  143. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  144. package/dist/types/utils/objectPath.d.ts +6 -41
  145. package/dist/types/utils/retryable.d.ts +8 -12
  146. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  147. package/dist/types/utils/time.d.ts +45 -0
  148. package/dist/types/utils.d.ts +74 -93
  149. package/package.json +14 -40
  150. package/src/ChannelManager.ts +494 -303
  151. package/src/CooldownTimer.ts +46 -59
  152. package/src/EventHandlerPipeline.ts +22 -45
  153. package/src/LiveLocationManager.ts +99 -91
  154. package/src/api-client.ts +113 -50
  155. package/src/campaign.ts +1 -1
  156. package/src/channel.ts +1098 -1351
  157. package/src/channel_batch_updater.ts +1 -1
  158. package/src/channel_state.ts +81 -174
  159. package/src/client.ts +755 -970
  160. package/src/client_state.ts +3 -8
  161. package/src/configuration/ConfigController.ts +42 -158
  162. package/src/configuration/InstanceConfigurationRegistry.ts +43 -172
  163. package/src/configuration/index.ts +1 -1
  164. package/src/configuration/keys.ts +13 -32
  165. package/src/configuration/shape.ts +169 -59
  166. package/src/configuration/types.ts +69 -92
  167. package/src/configuration/utils/applyInstanceConfiguration.ts +22 -54
  168. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  169. package/src/configuration/utils/declarativeSlices.ts +9 -39
  170. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  171. package/src/configuration/utils/index.ts +2 -4
  172. package/src/configuration/utils/serverAuthority.ts +20 -68
  173. package/src/connection/ConnectionIdManager.ts +111 -0
  174. package/src/connection/ConnectionRecoveryManager.ts +257 -0
  175. package/src/connection/index.ts +4 -0
  176. package/src/connection/networkConnection/NetworkConnectionObserver.ts +204 -0
  177. package/src/connection/networkConnection/index.ts +3 -0
  178. package/src/connection/networkConnection/reporters.ts +58 -0
  179. package/src/connection/networkConnection/types.ts +45 -0
  180. package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +230 -231
  181. package/src/connection/wsConnection/WSConnection.ts +270 -0
  182. package/src/connection/wsConnection/WSConnectionFallback.ts +250 -0
  183. package/src/connection/wsConnection/config.ts +73 -0
  184. package/src/connection/wsConnection/index.ts +4 -0
  185. package/src/connection/wsConnection/types.ts +48 -0
  186. package/src/constants.ts +7 -5
  187. package/src/custom_types.ts +0 -1
  188. package/src/entityStore/EntityStore.ts +415 -79
  189. package/src/entityStore/StoreBackedItemIndex.ts +37 -41
  190. package/src/entityStore/index.ts +0 -1
  191. package/src/errors.ts +39 -20
  192. package/src/formatMessageMemo.ts +17 -0
  193. package/src/gen/chat/ChannelApi.ts +122 -36
  194. package/src/gen/chat/ChatApi.ts +578 -1752
  195. package/src/gen/models/index.ts +2566 -3440
  196. package/src/gen/models/timestamp-guard.ts +27 -0
  197. package/src/gen/moderation/ModerationApi.ts +183 -406
  198. package/src/index.ts +32 -10
  199. package/src/languageNames.ts +88 -0
  200. package/src/logger.ts +1 -3
  201. package/src/messageComposer/CustomDataManager.ts +19 -6
  202. package/src/messageComposer/LocationComposer.ts +49 -9
  203. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  204. package/src/messageComposer/attachmentIdentity.ts +54 -0
  205. package/src/messageComposer/attachmentManager.ts +170 -185
  206. package/src/messageComposer/attachmentUtils.ts +44 -0
  207. package/src/messageComposer/configuration/configuration.ts +15 -8
  208. package/src/messageComposer/configuration/types.ts +38 -50
  209. package/src/messageComposer/fileUtils.ts +1 -1
  210. package/src/messageComposer/index.ts +1 -0
  211. package/src/messageComposer/linkPreviewsManager.ts +18 -21
  212. package/src/messageComposer/messageComposer.ts +234 -179
  213. package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
  214. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +46 -33
  215. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +4 -1
  216. package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +1 -1
  217. package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +6 -0
  218. package/src/messageComposer/middleware/messageComposer/attachments.ts +76 -5
  219. package/src/messageComposer/middleware/messageComposer/commandInjection.ts +10 -4
  220. package/src/messageComposer/middleware/messageComposer/customData.ts +17 -5
  221. package/src/messageComposer/middleware/messageComposer/index.ts +2 -0
  222. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +22 -12
  223. package/src/messageComposer/middleware/messageComposer/pollOnly.ts +9 -1
  224. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
  225. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  226. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +12 -12
  227. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  228. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  229. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  230. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +8 -6
  231. package/src/messageComposer/middleware/textComposer/commandUtils.ts +10 -3
  232. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  233. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  234. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  235. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  236. package/src/messageComposer/pollComposer.ts +21 -9
  237. package/src/messageComposer/textComposer.ts +37 -57
  238. package/src/messageComposer/types.ts +39 -11
  239. package/src/messageDelivery/MessageDeliveryReporter.ts +86 -124
  240. package/src/messageDelivery/MessageReceiptsTracker.ts +122 -139
  241. package/src/messageOperations/FailedSendCache.ts +85 -0
  242. package/src/messageOperations/MessageOperationStatePolicy.ts +124 -116
  243. package/src/messageOperations/MessageOperations.ts +297 -175
  244. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +13 -25
  245. package/src/messageOperations/createMessageOperations.ts +176 -0
  246. package/src/messageOperations/index.ts +6 -14
  247. package/src/messageOperations/reflectReactionEvent.ts +43 -0
  248. package/src/messageOperations/sendOrdering.ts +25 -0
  249. package/src/messageOperations/settlePendingAttachmentUploads.ts +98 -0
  250. package/src/messageOperations/types.ts +51 -13
  251. package/src/middleware.ts +13 -5
  252. package/src/moderation.ts +25 -21
  253. package/src/notifications/NotificationManager.ts +19 -28
  254. package/src/notifications/types.ts +21 -57
  255. package/src/offline-support/offline_support_api.ts +231 -681
  256. package/src/offline-support/offline_sync_manager.ts +51 -90
  257. package/src/offline-support/queueableOperations.ts +98 -73
  258. package/src/offline-support/types.ts +43 -185
  259. package/src/pagination/FilterBuilder.ts +1 -22
  260. package/src/pagination/ItemIndex.ts +4 -12
  261. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  262. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +17 -62
  263. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  264. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +53 -33
  265. package/src/pagination/filterCompiler.ts +11 -25
  266. package/src/pagination/index.ts +1 -0
  267. package/src/pagination/paginators/BasePaginator.ts +1415 -1041
  268. package/src/pagination/paginators/ChannelPaginator.ts +481 -219
  269. package/src/pagination/paginators/MessageIntervalPaginator.ts +1362 -775
  270. package/src/pagination/paginators/MessagePaginator.ts +521 -240
  271. package/src/pagination/paginators/PinnedMessagePaginator.ts +32 -40
  272. package/src/pagination/paginators/ReminderPaginator.ts +21 -16
  273. package/src/pagination/paginators/ThreadPaginator.ts +170 -0
  274. package/src/pagination/paginators/UserGroupPaginator.ts +18 -15
  275. package/src/pagination/paginators/index.ts +1 -0
  276. package/src/pagination/paginators/stateThrottling.ts +5 -10
  277. package/src/pagination/sortCompiler.ts +23 -50
  278. package/src/pagination/utility.normalization.ts +17 -24
  279. package/src/pagination/utility.search.ts +4 -11
  280. package/src/poll.ts +183 -102
  281. package/src/poll_manager.ts +24 -22
  282. package/src/poll_optimistic_votes.ts +335 -0
  283. package/src/reminders/Reminder.ts +33 -16
  284. package/src/reminders/ReminderManager.ts +23 -56
  285. package/src/reminders/ReminderTimer.ts +6 -6
  286. package/src/search/BaseSearchSource.ts +19 -25
  287. package/src/search/ChannelSearchSource.ts +43 -1
  288. package/src/search/MessageSearchSource.ts +77 -13
  289. package/src/search/SearchController.ts +39 -36
  290. package/src/search/types.ts +6 -10
  291. package/src/segment.ts +1 -1
  292. package/src/signing.ts +23 -3
  293. package/src/thread.ts +430 -712
  294. package/src/thread_manager.ts +300 -234
  295. package/src/token_manager.ts +12 -22
  296. package/src/types.ts +102 -214
  297. package/src/types.utility.ts +3 -3
  298. package/src/upload-utils.ts +5 -10
  299. package/src/uploadManager.ts +64 -18
  300. package/src/utils/FixedSizeQueueCache.ts +18 -21
  301. package/src/utils/WithSubscriptions.ts +6 -16
  302. package/src/utils/abort.ts +45 -0
  303. package/src/utils/concurrency.ts +16 -55
  304. package/src/utils/mergeWith/mergeWith.ts +10 -13
  305. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  306. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  307. package/src/utils/objectPath.ts +6 -41
  308. package/src/utils/retryable.ts +10 -14
  309. package/src/utils/throttling/throttle.ts +9 -25
  310. package/src/utils/time.ts +64 -0
  311. package/src/utils.ts +227 -174
  312. package/codegen/i18n/callSites.ts +0 -126
  313. package/codegen/i18n/generate.ts +0 -226
  314. package/codegen/i18n/guards.ts +0 -178
  315. package/codegen/i18n/index.ts +0 -29
  316. package/codegen/i18n/stringMaps.ts +0 -91
  317. package/codegen/i18n/types.ts +0 -100
  318. package/dist/cjs/i18n.browser.js +0 -1131
  319. package/dist/cjs/i18n.browser.js.map +0 -7
  320. package/dist/cjs/i18n.node.js +0 -1160
  321. package/dist/cjs/i18n.node.js.map +0 -7
  322. package/dist/esm/i18n-codegen.mjs +0 -409
  323. package/dist/esm/i18n-codegen.mjs.map +0 -7
  324. package/dist/esm/i18n.mjs +0 -1098
  325. package/dist/esm/i18n.mjs.map +0 -7
  326. package/dist/types/ConnectionRecoveryManager.d.ts +0 -156
  327. package/dist/types/connection.d.ts +0 -139
  328. package/dist/types/entityStore/applyReactionLocally.d.ts +0 -26
  329. package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
  330. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
  331. package/dist/types/i18n/Streami18n.d.ts +0 -168
  332. package/dist/types/i18n/TranslationBuilder.d.ts +0 -70
  333. package/dist/types/i18n/TranslationStore.d.ts +0 -57
  334. package/dist/types/i18n/dayjs.d.ts +0 -104
  335. package/dist/types/i18n/formatters.d.ts +0 -91
  336. package/dist/types/i18n/index.d.ts +0 -15
  337. package/dist/types/i18n/translator.d.ts +0 -29
  338. package/dist/types/i18n/types.d.ts +0 -262
  339. package/dist/types/i18n-codegen/callSites.d.ts +0 -10
  340. package/dist/types/i18n-codegen/generate.d.ts +0 -15
  341. package/dist/types/i18n-codegen/guards.d.ts +0 -61
  342. package/dist/types/i18n-codegen/index.d.ts +0 -29
  343. package/dist/types/i18n-codegen/stringMaps.d.ts +0 -14
  344. package/dist/types/i18n-codegen/types.d.ts +0 -94
  345. package/dist/types/insights.d.ts +0 -56
  346. package/dist/types/messageOperations/optimistic.d.ts +0 -118
  347. package/dist/types/messageOperations/persistence.d.ts +0 -21
  348. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  349. package/dist/types/store.d.ts +0 -125
  350. package/src/ConnectionRecoveryManager.ts +0 -293
  351. package/src/gen/model-decoders/decoders.ts +0 -2710
  352. package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
  353. package/src/i18n/Streami18n.ts +0 -520
  354. package/src/i18n/TranslationBuilder.ts +0 -176
  355. package/src/i18n/TranslationStore.ts +0 -96
  356. package/src/i18n/dayjs.ts +0 -228
  357. package/src/i18n/formatters.ts +0 -461
  358. package/src/i18n/index.ts +0 -15
  359. package/src/i18n/languageNames.ts +0 -103
  360. package/src/i18n/translator.ts +0 -76
  361. package/src/i18n/types.ts +0 -375
  362. package/src/insights.ts +0 -82
  363. package/src/messageOperations/optimistic.ts +0 -249
  364. package/src/messageOperations/persistence.ts +0 -40
  365. package/src/pagination/utility.queryChannel.ts +0 -84
  366. package/src/store.ts +0 -304
@@ -1,31 +1,31 @@
1
1
  import type { AxiosInstance } from 'axios';
2
- import { Channel } from './channel';
2
+ import type { Channel } from './channel';
3
+ import type { ChannelMuteStatus } from './channel_state';
3
4
  import { ClientState } from './client_state';
4
- import { StableWSConnection } from './connection';
5
5
  import { UploadManager } from './uploadManager';
6
6
  import { TokenManager, type TokenManagerMinimalUser } from './token_manager';
7
7
  import { ApiClient } from './api-client';
8
- import type { APIResponse, AppIdentifier, ChannelInput, ChannelMute, ChannelOptions, ChannelResponse, ChannelStateOptions, ChannelStateResponseFields, Configs, ConnectAPIResponse, DeviceIdentifier, Event, EventHandler, EventType, FileUploadInput, GetThreadOptions, LocalMessage, OwnUserResponse, PartializeAllBut, QueryChannelsRequest, QueryChannelsResponse, QueryReactionsRequestWithId, QueryThreadsRequest, SdkIdentifier, StreamChatOptions, StreamRequestOptions, TokenOrProvider, UnBanUserOptions, UserMuteResponse, UserResponse } from './types';
9
- import { InsightMetrics } from './insights';
10
- import { Thread } from './thread';
8
+ import type { APIResponse, AppIdentifier, ChannelInput, ChannelMute, ChannelOptions, ChannelResponse, ChannelStateOptions, ChannelStateResponseFields, Configs, ConnectAPIResponse, DeviceIdentifier, Event, EventHandler, EventType, FileUploadInput, GetThreadOptions, LocalMessage, OwnUserResponse, PartializeAllBut, PinMessageOptions, QueryChannelsRequest, QueryChannelsResponse, QueryThreadsRequest, SdkIdentifier, StreamRequestOptions, TokenOrProvider, UnBanUserOptions, UserMuteResponse, UserRequest, UserResponse } from './types';
9
+ import { type Thread } from './thread';
11
10
  import { Moderation } from './moderation';
12
11
  import { ThreadManager } from './thread_manager';
13
12
  import { PollManager } from './poll_manager';
14
13
  import { EntityStore } from './entityStore/EntityStore';
15
14
  import { ChannelManager } from './ChannelManager';
16
- import { ConnectionRecoveryManager } from './ConnectionRecoveryManager';
15
+ import { ConnectionIdManager, ConnectionRecoveryManager, NetworkConnectionObserver, WSConnection } from './connection';
17
16
  import { MessageDeliveryReporter } from './messageDelivery';
18
17
  import { NotificationManager } from './notifications';
19
18
  import { ReminderManager } from './reminders';
20
19
  import type { AbstractOfflineDB } from './offline-support';
21
20
  import { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
22
21
  import type { MessageComposer } from './messageComposer';
23
- import type { InstanceSetupState } from './configuration';
22
+ import type { InstanceConfigTree, InstanceSetupState } from './configuration';
23
+ import type { DeepPartial } from './types.utility';
24
24
  import { InstanceConfigurationRegistry } from './configuration/InstanceConfigurationRegistry';
25
- import { StateStore } from './store';
26
- import type { FileUploadRequest, GetApplicationResponse as Gen_GetApplicationResponse, MarkDeliveredRequest as Gen_MarkDeliveredRequest, ImageUploadRequest, WSEvent } from './gen/models';
25
+ import { StateStore } from '@stream-io/state-store';
26
+ import type { FileUploadRequest, GetApplicationResponse as Gen_GetApplicationResponse, MarkDeliveredRequest as Gen_MarkDeliveredRequest, ImageUploadRequest, WSAuthMessage, WSEvent } from './gen/models';
27
27
  import { ChatApi } from './gen-imports';
28
- import type { ConnectedEvent, StreamResponse } from './types';
28
+ import type { StreamResponse } from './types';
29
29
  export type QueryChannelsResponseWithChannels = Omit<QueryChannelsResponse, 'channels'> & {
30
30
  channels: Channel[];
31
31
  };
@@ -41,61 +41,57 @@ export type ClientUser = PartializeAllBut<OwnUserResponse, 'id'> & {
41
41
  export declare class StreamChat extends ChatApi {
42
42
  private static _instance?;
43
43
  messageDeliveryReporter: MessageDeliveryReporter;
44
- /**
45
- * @internal
46
- */
44
+ /** @internal */
47
45
  uploadManager: UploadManager;
48
- /**
49
- * @private
50
- */
46
+ /** @private */
51
47
  _user?: ClientUser;
52
48
  appSettingsPromise?: Promise<StreamResponse<Gen_GetApplicationResponse>>;
53
- activeChannels: {
54
- [key: string]: Channel;
55
- };
56
49
  threads: ThreadManager;
57
50
  polls: PollManager;
58
51
  /**
59
- * Channel lists — one or more `ChannelPaginator`s kept in sync with WS events, with ownership
60
- * arbitration between them. Instantiated with the client and living as long as it does; register
61
- * the lists with `client.channelManager.insertPaginator()` and drop them again with
62
- * `removePaginator()`. It only starts handling events once something calls its (ref-counted)
63
- * `registerSubscriptions()`.
64
- *
65
- * It is deliberately not configurable through the client options — everything is set on the
66
- * manager itself (`setOwnershipResolver`, `addEventHandler` / `setEventHandlers` /
67
- * `removeEventHandlers`), which is also the only way to reconfigure it later.
52
+ * Channel lists (`ChannelPaginator`s kept in sync with WS events, with ownership arbitration
53
+ * between them). Register lists with `insertPaginator()` / `removePaginator()`. It handles events
54
+ * only once something calls its ref-counted `registerSubscriptions()`. It is configured on the
55
+ * manager itself (`setOwnershipResolver`, `addEventHandler`, ...), not through the client
56
+ * options.
68
57
  */
69
58
  channelManager: ChannelManager;
70
59
  /**
71
- * Owns connection recovery: on reconnect it re-runs each loaded channel list's own first-page query
72
- * and reloads each active channel, then dispatches `connection.recovered`. Instantiated with the
73
- * client and subscribed for its lifetime.
74
- *
75
- * Turn it off through the declarative configuration if the application recovers state itself:
76
- * `client.config.set({ client: { connectionRecovery: { enabled: false } } })`.
60
+ * On reconnect, re-runs each loaded channel list's first-page query and reloads each active
61
+ * channel and thread, then dispatches `connection.recovered`. Disable it when the app recovers
62
+ * state itself: `client.config.set({ client: { connectionRecovery: { enabled: false } } })`.
77
63
  */
78
64
  connectionRecovery: ConnectionRecoveryManager;
79
65
  /**
80
- * Client-global, normalized store holding one canonical copy of each message. The channel main
81
- * list and thread reply paginators read/write message content through it, so a message held in
82
- * more than one of them stays consistent without copy-to-copy fan-out.
66
+ * The device's network status, separate from the WebSocket's ({@link wsConnection}). Platforms
67
+ * report it through `client.config.set({ client: { networkConnection: { statusReporter } } })` or
68
+ * `client.networkConnection.setStatusReporter(...)`. Browsers get a reporter automatically;
69
+ * elsewhere a stand-in mirrors the WebSocket. `isOnline` is `undefined` (unknown, not offline)
70
+ * until something reports.
71
+ */
72
+ networkConnection: NetworkConnectionObserver;
73
+ /**
74
+ * The connection ID (the WebSocket's, or the long-poll's after an `enableWSFallback` switch). A
75
+ * request with `watch` or `presence` waits here for the handshake (see `requiresConnectionId`).
76
+ */
77
+ connectionIdManager: ConnectionIdManager;
78
+ /**
79
+ * Client-global store with one canonical copy of each message. The channel and thread paginators
80
+ * read and write messages through it, so a message held in several of them stays consistent.
83
81
  */
84
82
  messageStore: EntityStore<LocalMessage>;
85
83
  offlineDb?: AbstractOfflineDB;
86
84
  notifications: NotificationManager;
87
85
  reminders: ReminderManager;
88
- persistUserOnConnectionFailure?: boolean;
89
86
  axiosInstance: AxiosInstance;
90
87
  baseURL?: string;
91
- browser: boolean;
92
88
  cleaningIntervalRef?: ReturnType<typeof setTimeout>;
93
89
  clientId?: string;
94
90
  key: string;
95
91
  listeners: Map<EventType, Set<EventHandler>>;
96
92
  /**
97
- * If true, we will not clean up threads when channel state is in initializing state.
98
- * The main use case for SDKs who do independent state recovery for channels.
93
+ * When true, threads are not cleaned up while the channel state is initializing (for SDKs that
94
+ * recover channel state themselves).
99
95
  */
100
96
  preventThreadCleanup: boolean;
101
97
  moderation: Moderation;
@@ -104,52 +100,47 @@ export declare class StreamChat extends ChatApi {
104
100
  mutedUsers: UserMuteResponse[];
105
101
  }>;
106
102
  /**
107
- * Reactive store behind {@link channelServerConfigs}. The only reactive way to observe server channel
108
- * configuration today, which is why `stream-chat-react` reads it — a public, per-channel feature
109
- * resolver is the intended replacement.
110
- *
111
- * Named for what it holds plus a `Store` suffix for what it is, matching {@link mutedUsersStore}. These
112
- * are the backend's configs, not the ones you register through {@link config}.
103
+ * Reactive store behind {@link channelServerConfigs}: the backend's channel configs, not the ones
104
+ * registered through {@link config}.
113
105
  *
114
106
  * @internal
115
107
  */
116
108
  readonly channelServerConfigsStore: StateStore<ChannelConfigsState>;
117
109
  blockedUsers: StateStore<BlockedUsersState>;
118
- node: boolean;
119
- options: StreamChatOptions;
120
110
  setUserPromise: ConnectAPIResponse | null;
121
111
  state: ClientState;
122
112
  tokenManager: TokenManager;
123
113
  user?: ClientUser;
124
114
  userAgent?: string;
125
115
  wsBaseURL?: string;
126
- wsConnection: StableWSConnection | null;
116
+ wsConnection: WSConnection;
127
117
  wsPromise: ConnectAPIResponse | null;
128
- get anonymous(): boolean;
129
- get userId(): string | undefined;
118
+ private _wsPromiseSettled;
119
+ private _wsConnectId;
120
+ private _resolveWsPromise?;
121
+ private _rejectWsPromise?;
130
122
  /**
131
- * @deprecated Use `userId` instead.
123
+ * Whether the client runs in a browser: the `client.browser` option, else whether `window`
124
+ * exists.
132
125
  */
126
+ get browser(): boolean;
127
+ get node(): boolean;
128
+ get anonymous(): boolean;
129
+ get userId(): string | undefined;
130
+ /** @deprecated Use `userId` instead. */
133
131
  get userID(): string | undefined;
134
- /**
135
- * @deprecated Use `clientId` instead.
136
- */
132
+ /** @deprecated Use `clientId` instead. */
137
133
  get clientID(): string | undefined;
138
134
  set clientID(id: string | undefined);
139
135
  get api(): ApiClient;
140
- insightMetrics: InsightMetrics;
141
- defaultWSTimeout: number;
142
136
  sdkIdentifier?: SdkIdentifier;
143
137
  deviceIdentifier?: DeviceIdentifier;
144
138
  appIdentifier?: AppIdentifier;
145
139
  private cachedUserAgent?;
146
140
  readonly messageComposerCache: FixedSizeQueueCache<string, MessageComposer>;
147
141
  /**
148
- * Configuration you register for instances the SDK creates on your behalf — channels, threads,
149
- * composers, and the client's own managers. See `InstanceConfigurationRegistry`.
150
- *
151
- * Not to be confused with {@link channelServerConfigs}, which holds the **server-provided channel
152
- * configs** keyed by cid. This one is yours; that one is the backend's.
142
+ * Configuration registered for the instances the SDK creates (channels, threads, composers, the
143
+ * client's own managers). Not the server-provided channel configs ({@link channelServerConfigs}).
153
144
  */
154
145
  readonly config: InstanceConfigurationRegistry;
155
146
  /** Teardown for the `'client'` setup function, released by {@link disconnectUser}. */
@@ -157,68 +148,38 @@ export declare class StreamChat extends ChatApi {
157
148
  /**
158
149
  * Initializes a client.
159
150
  *
160
- * **Only use constructor for advanced usages. It is strongly advised to use `StreamChat.getInstance()` instead of `new StreamChat()` to reduce integration issues due to multiple WebSocket connections.**
151
+ * **Prefer `StreamChat.getInstance()`: a second client opens a second WebSocket connection.**
161
152
  *
162
153
  * @example <caption>initialize the client in user mode</caption>
163
154
  * new StreamChat('api_key')
164
- * @example <caption>initialize the client in user mode with options</caption>
165
- * new StreamChat('api_key', { warmUp: true, timeout: 5000 })
166
- * @example <caption>secret is optional and only used in server side mode</caption>
167
- * new StreamChat('api_key', 'secret', { httpsAgent: customAgent })
155
+ * @example <caption>initialize the client with configuration</caption>
156
+ * new StreamChat('api_key', { client: { axiosRequestConfig: { timeout: 5000 } } })
168
157
  *
169
158
  * @param key - The API key.
170
- * @param options - Additional options; here you can pass custom options to the axios instance (optional).
171
- * @param options.browser - Enforce the client to be in browser mode (optional).
172
- * @param options.warmUp - If `true`, the client will open a connection as soon as possible to speed up following requests (optional, defaults to `false`).
173
- * @param options.logLevel - Minimum log level for the default sink (optional, defaults to `'info'`).
174
- * @param options.logOptions - Per-scope sink/level overrides for `chatLoggerSystem` (optional).
175
- * @param options.timeout - Request timeout (optional, defaults to `3000`).
176
- * @param options.httpsAgent - Custom `httpsAgent` (optional).
159
+ * @param config - Declarative configuration, the tree `client.config.set()` takes (optional).
160
+ * Applied before anything is built, so it reaches the managers and the options read once at
161
+ * construction (`client.baseURL`, `client.axiosRequestConfig`, `client.notificationManager`).
177
162
  */
178
- constructor(key: string, options?: StreamChatOptions);
163
+ constructor(key: string, config?: DeepPartial<InstanceConfigTree>);
179
164
  /**
180
- * Subscribes the client's managers to the `'client'` configuration key.
181
- *
182
- * Called by the constructor and again by {@link _setUser}, because {@link disconnectUser} releases this
183
- * subscription to run the setup function's teardown. A client is reusable — `getInstance` hands the same
184
- * object back, and disconnect/connect is the documented multi-user and mobile-background flow — and the
185
- * managers this key configures (`reminders`, `threads`, `messageDeliveryReporter`, `notifications`)
186
- * outlive the user. Without the re-arm the key went permanently dead on the second connect: `setConfig`,
187
- * `setSetupFunction` and `reset` all stopped reaching any manager, silently.
188
- *
189
- * Idempotent through the `unsubscribeClientConfiguration` guard, so the constructor's wiring is not
190
- * duplicated by the first `connectUser`.
165
+ * Subscribes the client's managers to the `'client'` configuration key. Called by the constructor
166
+ * and by {@link _setUser}, because {@link disconnectUser} releases the subscription (to run the
167
+ * setup function's teardown) while the managers outlive the user. Idempotent.
191
168
  */
192
169
  private wireClientConfiguration;
193
170
  /**
194
- * Derives each manager's configuration from package defaults plus the `client` declarative subtree.
195
- * Shared by the constructor and `config.reset()`, so the two cannot drift.
196
- *
197
- * Defaults are spread first, and every manager is written unconditionally, because this is a
198
- * derivation* rather than a patch — the same rule `Channel.initializeConfig` follows. Guarding on
199
- * `if (config?.reminders)` and merging made `reset()` a no-op for this key: the store is cleared
200
- * before instances re-derive, so the guards all failed and the registered values stayed in force.
201
- * It also meant a field *removed* from the tree lingered, which is exactly what a merge cannot express.
171
+ * Derives each manager's configuration from the package defaults plus the `client` subtree. Every
172
+ * manager is written unconditionally: it is a derivation, not a merge, so `config.reset()` and
173
+ * removed fields take effect.
202
174
  */
203
175
  private initializeManagerConfig;
204
176
  get mutedUsers(): UserMuteResponse[];
205
177
  set mutedUsers(mutedUsers: UserMuteResponse[]);
206
178
  /**
207
- * Cache of server-provided channel configuration, keyed by **cid** — a channel's own
208
- * `config_overrides` can make it differ from every other channel of its type, so one entry per
209
- * channel is the only key space that can represent the answer. See {@link _addChannelConfig}.
210
- *
211
- * Read it through {@link Channel.serverConfig} rather than here. Not to be confused with
212
- * {@link config}, which is the configuration *you* register for SDK-created instances.
213
- *
214
- * This is `client.configs` from v9 under a name that says whose configuration it is — the key space is
215
- * unchanged, so a v9 `client.configs[cid]` lookup translates directly. There is deliberately no
216
- * `configs` alias: it read as a sibling of the integrator-facing {@link config} while holding the
217
- * backend's answer, and the two being one letter apart is what made `channel.getConfig()` ambiguous
218
- * enough to rename as well.
219
- *
220
- * Assigning through this setter notifies subscribers; mutating the returned record in place does not.
221
- * Prefer {@link _addChannelConfig}.
179
+ * Cache of server-provided channel configuration, keyed by cid (a channel's `config_overrides`
180
+ * can make it differ from other channels of its type). Read it through
181
+ * {@link Channel.serverConfig}. Assigning through the setter notifies subscribers, mutating the
182
+ * record in place does not (prefer {@link _addChannelConfig}).
222
183
  *
223
184
  * @internal
224
185
  */
@@ -226,84 +187,86 @@ export declare class StreamChat extends ChatApi {
226
187
  /** @internal */
227
188
  set channelServerConfigs(configs: Configs);
228
189
  /**
229
- * Returns a client instance.
190
+ * Returns the shared client instance, so there is only one client and WebSocket connection.
230
191
  *
231
- * This function always returns the same client instance to avoid issues raised by multiple client and WS connections.
232
- *
233
- * **After the first call, the client configuration will not change if the key or options parameters change.**
192
+ * **After the first call, the `key` and `config` parameters are ignored.**
234
193
  *
235
194
  * @example <caption>initialize the client in user mode</caption>
236
195
  * StreamChat.getInstance('api_key')
237
- * @example <caption>initialize the client in user mode with options</caption>
238
- * StreamChat.getInstance('api_key', { timeout: 5000 })
239
- * @example <caption>secret is optional and only used in server side mode</caption>
240
- * StreamChat.getInstance('api_key', 'secret', { httpsAgent: customAgent })
196
+ * @example <caption>initialize the client with configuration</caption>
197
+ * StreamChat.getInstance('api_key', { client: { axiosRequestConfig: { timeout: 5000 } } })
241
198
  *
242
199
  * @param key - The API key.
243
- * @param options - Additional options; here you can pass custom options to the axios instance (optional).
244
- * @param options.browser - Enforce the client to be in browser mode (optional).
245
- * @param options.warmUp - If `true`, the client will open a connection as soon as possible to speed up following requests (optional, defaults to `false`).
246
- * @param options.logLevel - Minimum log level for the default sink (optional, defaults to `'info'`).
247
- * @param options.logOptions - Per-scope sink/level overrides for `chatLoggerSystem` (optional).
248
- * @param options.timeout - Request timeout (optional, defaults to `3000`).
249
- * @param options.httpsAgent - Custom `httpsAgent` (optional, in Node defaults to `https.agent()`).
200
+ * @param config - Declarative configuration, as for the constructor (optional).
250
201
  * @returns The shared client instance.
251
202
  */
252
- static getInstance(key: string, options?: StreamChatOptions): StreamChat;
203
+ static getInstance(key: string, config?: DeepPartial<InstanceConfigTree>): StreamChat;
253
204
  setOfflineDBApi(offlineDBInstance: AbstractOfflineDB): void;
205
+ /**
206
+ * Creates a development token for apps with auth checks disabled. Never use one in production.
207
+ * See {@link DevToken}.
208
+ *
209
+ * @param userId - The ID of the user the token is for.
210
+ * @returns The development token.
211
+ */
212
+ devToken(userId: string): string;
254
213
  getAuthType(): "anonymous" | "jwt";
255
214
  setBaseURL(baseURL: string): void;
256
215
  _getConnectionID: () => string | undefined;
257
216
  _hasConnectionID: () => boolean;
258
- /**
259
- * @deprecated Use `client.config.setSetupFunction('messageComposer', fn)`.
260
- */
217
+ /** @deprecated Use `client.config.setSetupFunction('messageComposer', fn)`. */
261
218
  setMessageComposerSetupFunction: (setupFunction: InstanceSetupState<"messageComposer">["setupFunction"]) => void;
262
219
  /**
263
- * Sets the current user and opens a WebSocket connection.
220
+ * Sets the current user and opens the WebSocket connection.
264
221
  *
265
- * @param user - Data about this user, e.g. `{ name: 'john' }`.
266
- * @param userTokenOrProvider - A token string or an async provider that returns one.
222
+ * @param user - The user, with its required `id`, e.g. `{ id: 'john', name: 'John' }`.
223
+ * @param userTokenOrProvider - A token string, or an async provider that resolves to one.
267
224
  * @returns A promise that resolves when the connection is set up.
225
+ * @throws For a different user, unless `disconnectUser()` ran first.
268
226
  */
269
227
  connectUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
270
228
  /**
271
- * Sets the current user and opens a WebSocket connection.
229
+ * Sets the current user and opens the WebSocket connection.
272
230
  *
273
- * @deprecated Use {@link StreamChat.connectUser} instead. Its naming is more consistent with its functionality.
231
+ * @deprecated Use {@link StreamChat.connectUser} instead.
274
232
  *
275
- * @param user - Data about this user, e.g. `{ name: 'john' }`.
276
- * @param userTokenOrProvider - A token string or an async provider that returns one.
233
+ * @param user - The user, with its required `id`, e.g. `{ id: 'john', name: 'John' }`.
234
+ * @param userTokenOrProvider - A token string, or an async provider that resolves to one.
277
235
  * @returns A promise that resolves when the connection is set up.
278
236
  */
279
237
  setUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
280
238
  _setToken: (user: TokenManagerMinimalUser, userTokenOrProvider: TokenOrProvider) => Promise<void>;
281
239
  _setUser(user: TokenManagerMinimalUser): void;
282
240
  /**
283
- * Disconnects the WebSocket connection, without removing the user set on client.
284
- * client.closeConnection will not trigger default auto-retry mechanism for reconnection. You need
285
- * to call `client.openConnection` to reconnect to the WebSocket.
241
+ * Closes the WebSocket without removing the user, and without auto-reconnect: call
242
+ * `openConnection` to reconnect. Mainly for mobile: push notifications arrive only while no
243
+ * WebSocket is active, so close on background and reopen on foreground. After an
244
+ * `enableWSFallback` switch it also closes the long-poll, telling the server to close its
245
+ * connection ID.
286
246
  *
287
- * This is mainly useful on mobile side. You can only receive push notifications
288
- * if you don't have an active WebSocket connection.
289
- * So when your app goes to background, you can call `client.closeConnection`.
290
- * And when app comes back to foreground, call `client.openConnection`.
291
- *
292
- * @param timeout - Max number of milliseconds to wait for the WebSocket close event before forcefully assuming
293
- * successful disconnection. See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent (optional).
247
+ * @param timeout - Milliseconds to wait for the WebSocket close event and for the long-poll close
248
+ * request. Defaults to 1s and 2s respectively.
294
249
  */
295
250
  closeConnection: (timeout?: number) => Promise<void>;
296
251
  /**
297
- * Creates a new WebSocket connection with the current user.
252
+ * Opens a WebSocket connection for the current user. After an `enableWSFallback` switch it
253
+ * reconnects the long-poll instead: the client never goes back to the WebSocket.
298
254
  *
299
- * @returns The WebSocket connect promise, or an empty resolved promise if a connection is already active.
255
+ * @returns The connect promise, or `undefined` when a healthy connection already exists.
300
256
  */
301
257
  openConnection: () => ConnectAPIResponse | undefined;
258
+ /** Rejects the shared `wsPromise` and invalidates any in-flight connect attempt. */
259
+ private _rejectPendingWsPromise;
260
+ /**
261
+ * Keeps a single pending `wsPromise` across close/reopen, so callers already awaiting it are not
262
+ * stranded when `openConnection` starts a new connect.
263
+ */
264
+ private _bindWsPromise;
302
265
  /**
303
- * Revokes tokens for a connected user issued before the given time.
266
+ * Revokes the connected user's tokens issued before the given time.
304
267
  *
305
- * @param before - Cutoff date; tokens issued before this are revoked (optional, defaults to the current time).
306
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
268
+ * @param before - Cutoff date; tokens issued before it are revoked (optional). Defaults to now.
269
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
307
270
  * into the request (optional).
308
271
  * @returns The updated users response.
309
272
  */
@@ -311,48 +274,46 @@ export declare class StreamChat extends ChatApi {
311
274
  /**
312
275
  * Retrieves application settings.
313
276
  *
277
+ * @param _request - Unused. Holds the request position so `requestOptions` stays the
278
+ * second argument, as on the generated methods; pass `undefined`.
314
279
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
315
280
  * into the request (optional).
316
- * @returns The application settings response.
281
+ * @returns The application settings response. A failed request is not kept in
282
+ * {@link appSettingsPromise}, so the next call fetches again.
317
283
  */
318
- getAppSettings(requestOptions?: StreamRequestOptions): Promise<StreamResponse<Gen_GetApplicationResponse>>;
284
+ getAppSettings(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<Gen_GetApplicationResponse>>;
319
285
  /**
320
- * Disconnects the WebSocket and removes the user from client.
286
+ * Disconnects the WebSocket and removes the user and its state.
321
287
  *
322
- * @param timeout - Max number of milliseconds to wait for the WebSocket close event before forcefully assuming
323
- * successful disconnection. See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent (optional).
324
- * @returns The close-connection promise.
288
+ * @param timeout - Passed to {@link closeConnection} (optional).
325
289
  */
326
290
  disconnectUser: (timeout?: number) => Promise<void>;
327
- /**
328
- *
329
- * @deprecated Please use client.disconnectUser instead.
330
- *
331
- * Disconnects the WebSocket and removes the user from client.
332
- */
291
+ /** @deprecated Use `client.disconnectUser` instead. */
333
292
  disconnect: (timeout?: number) => Promise<void>;
334
293
  /**
335
- * Sets an anonymous user and opens a WebSocket connection.
294
+ * Sets an anonymous user and opens the WebSocket connection.
336
295
  *
337
296
  * @returns A promise that resolves when the connection is set up.
338
297
  */
339
298
  connectAnonymousUser: () => ConnectAPIResponse | undefined;
340
299
  /**
341
- * Creates a guest user and returns its access token.
300
+ * Creates a guest user.
342
301
  *
343
- * @param args - The guest creation request, plus optional per-request options.
302
+ * @param ...args - `[request, requestOptions]`. `request.user` is the guest user to create;
303
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
304
+ * serialized into the request.
344
305
  * @returns The created guest user and its access token.
345
306
  */
346
307
  createGuest(...args: Parameters<ChatApi['createGuest']>): Promise<StreamResponse<import(".").CreateGuestResponse>>;
347
308
  /**
348
- * Sets up a temporary guest user.
309
+ * Creates a temporary guest user and connects as it.
349
310
  *
350
- * @param user - Data about this user, e.g. `{ name: 'john' }`.
351
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
311
+ * @param user - The guest user, with its required `id`, e.g. `{ id: 'john', name: 'John' }`.
312
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
352
313
  * into the request (optional).
353
314
  * @returns A promise that resolves when the connection is set up.
354
315
  */
355
- setGuestUser(user: UserResponse, requestOptions?: StreamRequestOptions): Promise<void | import("./types").ConnectionOpen>;
316
+ setGuestUser(user: UserRequest, requestOptions?: StreamRequestOptions): Promise<void | import("./types").ConnectionOpen>;
356
317
  /**
357
318
  * Listens to events on all channels and users you're watching.
358
319
  *
@@ -366,270 +327,202 @@ export declare class StreamChat extends ChatApi {
366
327
  * console.log(event.type);
367
328
  * });
368
329
  *
369
- * @param callbackOrString - The event type to listen for, or the callback when listening to all events.
370
- * @param callbackOrNothing - The callback to call when an event type was provided (optional).
330
+ * @param callback - Called with every event.
371
331
  * @returns An object with an `unsubscribe()` method.
372
332
  */
373
333
  on(callback: EventHandler): {
374
334
  unsubscribe: () => void;
375
335
  };
376
- on<T extends EventType | string>(eventType: T, callback: EventHandler<T>): {
336
+ /**
337
+ * Listens to one event type on all channels and users you're watching.
338
+ *
339
+ * @param eventType - The event type to listen for.
340
+ * @param callback - Called with each event of that type.
341
+ * @returns An object with an `unsubscribe()` method.
342
+ */
343
+ on<T extends EventType>(eventType: T, callback: EventHandler<T>): {
377
344
  unsubscribe: () => void;
378
345
  };
379
346
  /**
380
- * Removes the event handler.
347
+ * Removes a listener for all events.
381
348
  *
382
- * @param callbackOrString - The event type, or the callback when removing an all-events listener.
383
- * @param callbackOrNothing - The callback to remove when an event type was provided (optional).
349
+ * @param callback - The listener to remove.
384
350
  */
385
351
  off(callback: EventHandler): void;
386
- off(eventType: string, callback: EventHandler): void;
352
+ /**
353
+ * Removes a listener for one event type.
354
+ *
355
+ * @param eventType - The event type it listens to.
356
+ * @param callback - The listener to remove.
357
+ */
358
+ off<T extends EventType>(eventType: T, callback: EventHandler<T>): void;
387
359
  dispatchEvent: (event: Event) => void;
388
360
  /**
389
- * Updates the members, watchers and read references of the currently active channels that contain this user.
361
+ * Puts `user`'s new object into the members, watchers, own membership and (with `readEntries`)
362
+ * read entries of the channels that list them, in one state update per channel.
390
363
  *
391
- * @param user - The updated user.
364
+ * @param options.readEntries - Also replace the user in read entries, refreshing read receipts.
365
+ * Off for presence changes: receipts never show online status. Defaults to `true`.
392
366
  */
393
- _updateMemberWatcherReferences: (user: UserResponse) => void;
367
+ _updateMemberWatcherReferences: (user: UserResponse, { readEntries }?: {
368
+ readEntries?: boolean;
369
+ }) => void;
394
370
  /**
395
371
  * @deprecated Please use `_updateMemberWatcherReferences` instead.
396
372
  * @private
397
373
  */
398
- _updateUserReferences: (user: UserResponse) => void;
374
+ _updateUserReferences: (user: UserResponse, { readEntries }?: {
375
+ readEntries?: boolean;
376
+ }) => void;
399
377
  /**
400
- * Updates the messages from the currently active channels that contain this user, with the updated user object.
378
+ * Replaces the user's object in the messages of the loaded channels.
401
379
  *
402
380
  * @private
403
- *
404
- * @param user - The updated user.
405
381
  */
406
382
  _updateUserMessageReferences: (user: UserResponse) => void;
407
383
  /**
408
- * Deletes the messages from the currently active channels that contain this user.
409
- *
410
- * If `hardDelete` is `true`, all the content of the message will be stripped down.
411
- * Otherwise, only `message.type` will be set as `'deleted'`.
384
+ * Deletes the user's messages in the loaded channels: stripped of their content with
385
+ * `hardDelete`, otherwise marked as deleted. `deletedAt` defaults to now.
412
386
  *
413
387
  * @private
414
- *
415
- * @param user - The user whose messages should be deleted.
416
- * @param hardDelete - Whether to fully strip the message content (optional, defaults to `false`).
417
- * @param deletedAt - Timestamp to mark messages as deleted at (optional).
418
388
  */
419
389
  _deleteUserMessageReference: (user: UserResponse, hardDelete?: boolean, deletedAt?: LocalMessage["deleted_at"]) => void;
420
- /**
421
- * Handle the following user-related events:
422
- * - `user.presence.changed`
423
- * - `user.updated`
424
- * - `user.deleted`
425
- *
426
- * @private
427
- *
428
- * @param event - The user event.
429
- */
390
+ /** @private */
430
391
  _handleUserEvent: (event: Extract<WSEvent, {
431
392
  type: "user.presence.changed" | "user.updated" | "user.deleted";
432
393
  }>) => void;
433
- _handleClientEvent(event: WSEvent | ConnectedEvent): (() => void)[];
434
- /**
435
- * Fans the client-owned `mutedChannels` out to every active channel's reactive `state.muteStatus`.
436
- * Each channel republishes only when its own mute status actually changed, so this stays cheap on
437
- * the frequent `health.check` path.
438
- */
439
- _reflectMutedChannelsToActiveChannels(): void;
440
- /**
441
- * Resets the AI indicator state to `Idle` on every active channel. Invoked from `closeConnection`
442
- * as it's a deliberate shutdown and will not natively trigger a WS event.
443
- */
444
- _resetAIStateOnActiveChannels(): void;
445
- /**
446
- * Demotes every actively-watched channel to `WasWatching`. The server keys watches by connection
447
- * ID, so losing the socket ends every watch this client held — a reconnect issues a NEW id and the
448
- * channels have to be re-queried to watch again. `WasWatching` is what records that they should be.
449
- *
450
- * Only `Watching` is demoted: a channel the consumer stopped on purpose, or one that was torn
451
- * down, stays `NotWatching` and must not be resurrected by a reconnect.
452
- *
453
- * Invoked from two places, because neither covers the other: `StableWSConnection._setHealth(false)`
454
- * for an abnormal close/error (immediately — NOT via the `connection.changed` event, which is
455
- * 5s-debounced when going offline and is skipped entirely on a quick flap, both of which would
456
- * leave the status lying), and `closeConnection()` for a deliberate shutdown (e.g. mobile
457
- * backgrounding), which sets `isHealthy` directly and so never reaches `_setHealth`.
458
- */
459
- _markActiveChannelsWatchInterrupted(): void;
460
- _muteStatus(cid: string): {
461
- muted: boolean;
462
- createdAt: Date;
463
- expiresAt: Date | null;
464
- } | {
465
- muted: boolean;
466
- createdAt: null;
467
- expiresAt: null;
468
- };
394
+ _handleClientEvent(event: WSEvent): (() => void)[];
395
+ _muteStatus(cid: string): ChannelMuteStatus;
469
396
  _callClientListeners: (event: Event) => void;
470
397
  /**
471
- * Settles the connect promises after a successful reconnect, so the `await this.wsPromise` gates
472
- * spread across the client stop resolving against a superseded (possibly rejected) attempt.
473
- *
474
- * Called by `StableWSConnection._reconnect()`. Recovery itself is owned by
475
- * {@link ConnectionRecoveryManager}, which subscribes to the connection lifecycle and so covers
476
- * every reconnect path — including `closeConnection()` → `openConnection()` (mobile backgrounding),
477
- * which never reaches `_reconnect()` at all.
398
+ * Settles the connect promises after a successful reconnect, so a held `wsPromise` /
399
+ * `setUserPromise` stops resolving against a superseded (possibly rejected) attempt. Called by
400
+ * `StableWSConnection._reconnect()` and `WSConnectionFallback.connect(true)`. Recovery itself
401
+ * belongs to {@link ConnectionRecoveryManager}.
478
402
  *
479
403
  * @internal
480
404
  */
481
405
  _settleConnectPromises: () => void;
482
- /**
483
- * @private
484
- */
406
+ /** @private */
485
407
  connect(): Promise<void | import("./types").ConnectionOpen>;
486
408
  /**
487
- * Checks connectivity with the server for warmup purposes.
488
- *
489
- * @private
490
- */
491
- _sayHi(): void;
492
- /**
493
- * Queries users and watches user presence.
409
+ * Queries users and stores them in `client.state.users`. Watches presence only when
410
+ * `request.payload.presence` is set.
494
411
  *
495
412
  * @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts
496
- * MongoDB-style filter conditions, sort directions (e.g. `[{ field: 'last_active', direction: -1 }]`),
497
- * and options such as `presence`. `requestOptions` carries per-request options such as an
498
- * abort `signal` and is never serialized into the request.
413
+ * MongoDB-style filter conditions, sort directions (e.g.
414
+ * `[{ field: 'last_active', direction: -1 }]`), and options such as `presence`.
415
+ * `requestOptions` carries per-request options such as an abort `signal` and is never
416
+ * serialized into the request.
499
417
  * @returns The user query response.
500
418
  */
501
419
  queryUsers(...args: Parameters<ChatApi['queryUsers']>): Promise<StreamResponse<import(".").QueryUsersResponse>>;
502
420
  /**
503
- * Queries channels and returns the full API response including top-level metadata such as
504
- * `predefined_filter`.
421
+ * Stops watching a channel on this client's connection. It carries no `watch` flag, but it waits
422
+ * for the connection ID like a watching request (through a handshake or reconnect, until the
423
+ * caller's abort signal fires) and throws when there is no connection and none is being
424
+ * established.
505
425
  *
506
- * This exists as a compatibility bridge, as changing `queryChannelsRequest()` to return
507
- * `QueryChannelsResponse` would be a breaking change because it currently returns
508
- * only the channel list. In the next major release, the request/response APIs should
509
- * be consolidated so callers can access the full response through the primary API.
426
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams` identifies the channel
427
+ * (`{ type, id }`); `request.connection_id` is replaced by this client's connection ID.
428
+ * @returns The server response.
429
+ */
430
+ stopWatchingChannel(...args: Parameters<ChatApi['stopWatchingChannel']>): Promise<StreamResponse<import(".").Response>>;
431
+ /**
432
+ * Queries channels and returns the raw API response. See {@link queryChannelsAndHydrate} for
433
+ * `Channel` instances.
510
434
  *
511
435
  * @param ...args - `[request, requestOptions]`. The optional `request` accepts MongoDB-style
512
436
  * filter conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and
513
- * options such as `predefined_filter`, `filter_values`, and `sort_values`. `requestOptions`
514
- * carries per-request options such as an abort `signal` and is never serialized into the request.
515
- * @returns The full query channels response.
437
+ * options such as `predefined_filter`, `filter_values`, and `sort_values`. `state`, `watch` and
438
+ * `presence` default to `true`, `true` and `false`. `requestOptions` carries per-request
439
+ * options such as an abort `signal` and is never serialized into the request.
440
+ * @returns The full query channels response, including metadata such as `predefined_filter`.
516
441
  */
517
442
  queryChannels(...args: Parameters<ChatApi['queryChannels']>): Promise<StreamResponse<QueryChannelsResponse>>;
518
443
  /**
519
- * Queries channels and hydrates them into `Channel` instances on this client.
520
- *
521
- * Use the inherited `queryChannels()` from `ChatApi` when only the raw API response
522
- * is needed; this method wraps it with state hydration, `channels.queried` dispatch,
523
- * and offline-db sync.
444
+ * Queries channels and hydrates them into `Channel` instances on this client, dispatching
445
+ * `channels.queried` and syncing the offline DB. Use `queryChannels()` for the raw API response.
524
446
  *
525
447
  * @param options - The query channels request payload (optional). Accepts MongoDB-style filter
526
448
  * conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and options
527
449
  * such as `predefined_filter`, `filter_values`, and `sort_values`.
528
- * @param stateOptions - Options that only affect state management and aren't sent in the request
529
- * (optional, defaults to `{}`).
530
- * @param stateOptions.skipInitialization - Skips the initialization of the state for the
531
- * channels matching the IDs in the list (optional).
532
- * @param stateOptions.skipHydration - Skips returning the channels as instances of the `Channel`
533
- * class and instead returns the raw query response (optional).
534
- * @param stateOptions.withResponse - Returns the full query response with hydrated channels.
535
- * This is a compatibility bridge for internal callers that need response-level metadata while
536
- * the default return value remains `Channel[]` (optional).
537
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
450
+ * @param stateOptions - Options that only affect state management and are not sent in the
451
+ * request. Defaults to `{}`.
452
+ * @param stateOptions.skipHydration - Not read: it has no effect.
453
+ * @param stateOptions.withResponse - Returns the full query response (with hydrated `channels`)
454
+ * instead of `Channel[]`.
455
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
538
456
  * into the request (optional).
539
457
  * @returns The hydrated channel list, or the full response when `withResponse` is `true`.
540
458
  */
541
- queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions & {
459
+ queryChannelsAndHydrate(options: QueryChannelsRequest | undefined, stateOptions: ChannelStateOptions & {
542
460
  withResponse: true;
543
461
  }, requestOptions?: StreamRequestOptions): Promise<QueryChannelsResponseWithChannels>;
544
462
  queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions, requestOptions?: StreamRequestOptions): Promise<Channel[]>;
545
463
  /**
546
- * Queries reactions for a message and hydrates any cached offline reactions before the network
547
- * request.
464
+ * Queries a message's reactions. On the first page, cached offline reactions are dispatched
465
+ * (`offline_reactions.queried`) before the network request.
548
466
  *
549
- * @param request - The query reactions request payload, including the target message ID,
550
- * MongoDB-style filters, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`),
551
- * and pagination options.
552
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
553
- * into the request (optional).
467
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the target message
468
+ * ID; `request` carries MongoDB-style filters, sort directions (e.g.
469
+ * `[{ field: 'created_at', direction: -1 }]`) and pagination options; `requestOptions` carries
470
+ * per-request options such as an abort `signal` and is never serialized into the request.
554
471
  * @returns The query reactions response.
555
472
  */
556
- queryReactionsAndHydrate(request: QueryReactionsRequestWithId, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").QueryReactionsResponse>>;
557
- hydrateActiveChannels(channelsFromApi?: ChannelStateResponseFields[], stateOptions?: ChannelStateOptions, queryChannelsOptions?: ChannelOptions, candidateIdsByCid?: Map<string, ReadonlySet<string>>): Channel[];
558
- /**
559
- * Queries messages.
560
- *
561
- * @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts
562
- * MongoDB-style filter conditions, a search query, and options such as `user_id`.
563
- * `requestOptions` carries per-request options such as an abort `signal` and is never
564
- * serialized into the request.
565
- * @returns The search messages response.
566
- */
567
- search(...args: Parameters<ChatApi['search']>): Promise<StreamResponse<import(".").SearchResponse>>;
473
+ queryReactionsAndHydrate(...args: Parameters<ChatApi['queryReactions']>): Promise<StreamResponse<import(".").QueryReactionsResponse>>;
474
+ hydrateChannels(channelsFromApi?: ChannelStateResponseFields[], stateOptions?: ChannelStateOptions, queryChannelsOptions?: ChannelOptions, headIntervalItemIdsAtRequestByCid?: Map<string, ReadonlySet<string>>): Channel[];
568
475
  /**
569
- * Caches one channel's server configuration, read through {@link Channel.serverConfig}.
476
+ * Returns the channel with the given type and ID: the stored instance for the cid, or a new one,
477
+ * stored (one instance per cid; a channel disposed with `disconnect()` is replaced by a fresh
478
+ * one). Use it instead of `new Channel()`.
570
479
  *
571
- * Keyed by **cid** rather than by channel type: a channel's own `config_overrides` narrow its type's
572
- * settings for that channel alone, so two channels of one type can disagree.
480
+ * For a distinct channel between users, leave out the ID and pass the members. It is stored under
481
+ * a temporary cid until the response of `channel.watch()`, `query()` or `create()` brings the
482
+ * real one; a stored distinct channel with the same loaded members is returned instead. If
483
+ * another instance holds the real cid by then, it stays stored and takes over from this one
484
+ * (`channel.supersededBy`; `watch()` resolves with it). A group with the same members as another
485
+ * needs its own ID. Until its query is answered such a channel is
486
+ * {@link Channel.isProvisional}: it has no ID yet, so nothing but that query can be sent for it.
573
487
  *
574
- * Two writes are skipped. A response with no `config` — `notification.message_new` is one route that
575
- * omits it — would otherwise un-learn a config already known for the channel. A config deep-equal to
576
- * the stored one keeps a repeated query from waking that channel's subscribers, which matters because
577
- * the API returns a fresh object every time and the store compares by reference.
578
- *
579
- * @internal
580
- */
581
- _addChannelConfig({ cid, config }: Pick<ChannelResponse, 'cid' | 'config'>): void;
582
- /**
583
- * Returns a new channel with the given type, ID and custom data.
584
- *
585
- * If you want to create a unique conversation between 2 or more users, you can leave out the ID
586
- * parameter and provide the list of members.
587
- * Make sure to await `channel.create()` or `channel.watch()` before accessing channel functions,
588
- * i.e. `channel = client.channel('messaging', { members: ['tommaso', 'thierry'] })` then
589
- * `await channel.create()` to assign an ID to the channel.
488
+ * ```ts
489
+ * const general = client.channel('messaging', 'general');
490
+ * const dm = await client
491
+ * .channel('messaging', { members: [{ user_id: 'ann' }, { user_id: 'bob' }] })
492
+ * .watch();
493
+ * ```
590
494
  *
591
495
  * @param channelType - The channel type.
592
- * @param channelIdOrCustom - The channel ID; you can leave this out if you want to create a
593
- * conversation channel (optional).
594
- * @param custom - Custom data to attach to the channel (optional, defaults to `{}`).
595
- * @returns The channel object; initialize it using `channel.watch()`.
496
+ * @param channelId - The channel ID; leave it out for a distinct channel created from members
497
+ * (optional).
498
+ * @param custom - Data for a new channel, e.g. `members` or `custom`; for a stored channel only
499
+ * `custom` is applied. Defaults to `{}`.
500
+ * @returns The channel; initialize it with `channel.watch()`.
596
501
  */
597
502
  channel(channelType: string, channelId?: string | null, custom?: ChannelInput): Channel;
598
503
  channel(channelType: string, custom?: ChannelInput): Channel;
599
504
  /**
600
- * It's a helper method for `client.channel()` method, used to create unique conversation or
601
- * channel based on member list instead of ID.
602
- *
603
- * If the channel already exists in `activeChannels` list, then we simply return it, since that
604
- * means the same channel was already requested or created.
605
- *
606
- * Otherwise we create a new instance of Channel class and return it.
505
+ * Searches messages.
607
506
  *
608
- * @private
609
- *
610
- * @param channelType - The channel type.
611
- * @param custom - Custom data to attach to the channel.
612
- * @returns The channel object; initialize it using `channel.watch()`.
507
+ * @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts channel
508
+ * `filter_conditions`, `message_filter_conditions`, a `query`, and options such as `limit`,
509
+ * `offset`, `next` and `sort`. `requestOptions` carries per-request options such as an abort
510
+ * `signal` and is never serialized into the request.
511
+ * @returns The search messages response.
512
+ * @throws When both `offset` and `next` are given.
613
513
  */
614
- getChannelByMembers: (channelType: string, custom: ChannelInput) => Channel;
514
+ search(...args: Parameters<ChatApi['search']>): Promise<StreamResponse<import(".").SearchResponse>>;
615
515
  /**
616
- * It's a helper method for `client.channel()`, used to retrieve a channel given its ID.
617
- *
618
- * If the channel already exists in `activeChannels` list, then we simply return it, since that
619
- * means the same channel was already requested or created.
620
- *
621
- * Otherwise we create a new instance of `Channel` class and return it.
622
- *
623
- * @private
516
+ * Caches one channel's server configuration, keyed by cid (see {@link Channel.serverConfig}).
517
+ * Skips the write for a response without `config` (`notification.message_new` omits it) and for a
518
+ * config deep-equal to the stored one: the API returns a fresh object each time and the store
519
+ * compares by reference.
624
520
  *
625
- * @param channelType - The channel type.
626
- * @param channelId - The channel ID.
627
- * @param custom - Custom data to attach to the channel.
628
- * @returns The channel object; initialize it using `channel.watch()`.
521
+ * @internal
629
522
  */
630
- getChannelById: (channelType: string, channelId: string, custom: ChannelInput) => Channel;
523
+ _addChannelConfig({ cid, config }: Pick<ChannelResponse, 'cid' | 'config'>): void;
631
524
  /**
632
- * Revoke a global ban for a user.
525
+ * Revokes a global ban.
633
526
  *
634
527
  * @param targetUserId - The user to unban.
635
528
  * @param options - Unban options (optional).
@@ -640,94 +533,74 @@ export declare class StreamChat extends ChatApi {
640
533
  getBlockedUsers(...args: Parameters<ChatApi['getBlockedUsers']>): Promise<StreamResponse<import(".").GetBlockedUsersResponse>>;
641
534
  unblockUser(blockedUserId: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnblockUsersResponse>>;
642
535
  /**
643
- * Checks whether a user is muted. Can be used after `connectUser()` is called.
536
+ * Checks whether a user is muted.
644
537
  *
645
538
  * @param targetId - The user ID to check.
646
539
  * @returns `true` if the user is muted, otherwise `false`.
540
+ * @throws When no user is connected.
647
541
  */
648
542
  userMuteStatus(targetId: string): boolean;
649
- /**
650
- * Transforms an expiration value into an ISO string.
651
- *
652
- * @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
653
- * in seconds, `string` or `Date` to set the exact expiration date (optional).
654
- * @returns The expiration as an ISO string, or `null`.
655
- */
656
- _normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
657
- /**
658
- * Extracts a string message ID from either a message object or a message ID.
659
- *
660
- * @param messageOrMessageId - MessageRequest object or message ID.
661
- * @param errorText - Error message to report in case of message ID absence.
662
- * @returns The extracted message ID.
663
- */
664
- _validateAndGetMessageId(messageOrMessageId: string | {
665
- id: string;
666
- }, errorText: string): string;
667
543
  /**
668
544
  * Pins the message.
669
545
  *
670
- * @param messageOrMessageId - MessageRequest object or message ID.
671
- * @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
672
- * in seconds, `string` or `Date` to set the exact expiration date (optional).
673
- * @param pinnedAt - Date when the message should be pinned. It affects the order of pinned
674
- * messages. Use a negative number to set relative time in the past, `string` or `Date` to
675
- * set the exact date of pin (optional).
546
+ * @param message - The message to pin, or just its `{ id }`.
547
+ * @param options - When the pin expires and where it sorts (optional).
548
+ * @param options.pin_expires - When the pin expires, as a `Date` or an RFC3339 string; `null` or
549
+ * leaving it out pins without expiry. Hand a server-sent timestamp back with `nsToDate(timestamp)`.
550
+ * @param options.pinned_at - The pin time, which orders the pinned messages, as a `Date` or an
551
+ * RFC3339 string (optional). Defaults to now.
676
552
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
677
553
  * into the request (optional).
678
554
  * @returns The updated message response.
679
555
  */
680
- pinMessage(messageOrMessageId: string | {
556
+ pinMessage({ id }: {
681
557
  id: string;
682
- }, timeoutOrExpirationDate?: null | number | string | Date, pinnedAt?: number | string | Date, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
558
+ }, { pin_expires, pinned_at }?: PinMessageOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
683
559
  /**
684
560
  * Unpins the message that was previously pinned.
685
561
  *
686
- * @param messageOrMessageId - MessageRequest object or message ID.
562
+ * @param message - The message to unpin, or just its `{ id }`.
687
563
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
688
564
  * into the request (optional).
689
565
  * @returns The updated message response.
690
566
  */
691
- unpinMessage(messageOrMessageId: string | {
567
+ unpinMessage({ id }: {
692
568
  id: string;
693
569
  }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
694
570
  /**
695
- * Updates the given message. When an `offlineDb` is registered the call is queued
696
- * so it is replayed on reconnect.
697
- */
698
- updateMessage(...args: [
699
- request: Parameters<ChatApi['updateMessage']>[0] & {
700
- message: {
701
- cid?: string;
702
- };
703
- },
704
- requestOptions?: StreamRequestOptions
705
- ]): Promise<import(".").UpdateMessageResponse & {
706
- metadata: import("./types").RequestMetadata;
707
- }>;
708
- _updateMessage(...args: Parameters<ChatApi['updateMessage']>): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
571
+ * Updates a message over HTTP only: no offline queueing and no local state.
572
+ * `messageOperations.update` on a channel or thread is the full edit.
573
+ *
574
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the message ID;
575
+ * `request.message` is the updated message; `requestOptions` carries per-request options such
576
+ * as an abort `signal` and is never serialized into the request.
577
+ * @returns The update message response.
578
+ */
579
+ updateMessage(...args: Parameters<ChatApi['updateMessage']>): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
709
580
  /**
710
- * Deletes a message. When an `offlineDb` is registered the call is queued so it
711
- * is replayed on reconnect.
581
+ * Deletes a message over HTTP only: no offline queueing and no local state.
582
+ * `messageOperations.delete` on a channel or thread is the full delete.
583
+ *
584
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the message ID;
585
+ * `request.hard` deletes it permanently and `request.delete_for_me` deletes it for the current
586
+ * user only; `requestOptions` carries per-request options such as an abort `signal` and is
587
+ * never serialized into the request.
588
+ * @returns The delete message response.
712
589
  */
713
- deleteMessage(...args: Parameters<ChatApi['deleteMessage']>): Promise<import(".").DeleteMessageResponse & {
714
- metadata: import("./types").RequestMetadata;
715
- }>;
716
- _deleteMessage(...args: Parameters<ChatApi['deleteMessage']>): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
717
- /**
718
- * Returns the list of threads of the current user.
719
- *
720
- * @param options - Options object for pagination and limiting the participants and replies
721
- * (optional, defaults to `{}`).
722
- * @param options.limit - Limits the number of threads to be returned (optional).
723
- * @param options.watch - Subscribes the user to the channels of the threads (optional).
724
- * @param options.participant_limit - Limits the number of participants returned per thread (optional).
725
- * @param options.reply_limit - Limits the number of replies returned per thread (optional).
726
- * @param options.filter - MongoDB style filters for threads (optional).
727
- * @param options.sort - MongoDB style sort for threads (optional).
728
- * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
590
+ deleteMessage(...args: Parameters<ChatApi['deleteMessage']>): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
591
+ /**
592
+ * Returns the current user's threads as hydrated `Thread` instances.
593
+ *
594
+ * @param options - Pagination and limits for the participants and replies. Defaults to `{}`.
595
+ * @param options.limit - Limits the number of threads returned. Defaults to 10.
596
+ * @param options.watch - Subscribes the user to the channels of the threads. Defaults to `true`.
597
+ * @param options.participant_limit - Limits the participants returned per thread. Defaults to 10.
598
+ * @param options.reply_limit - Limits the replies returned per thread. Defaults to 3.
599
+ * @param options.filter - MongoDB-style filters for threads (optional).
600
+ * @param options.sort - MongoDB-style sort for threads (optional).
601
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
729
602
  * into the request (optional).
730
- * @returns The list of threads and the next cursor.
603
+ * @returns The threads and the next cursor.
731
604
  */
732
605
  queryThreadsAndHydrate(options?: QueryThreadsRequest, requestOptions?: StreamRequestOptions): Promise<{
733
606
  threads: Thread[];
@@ -736,17 +609,20 @@ export declare class StreamChat extends ChatApi {
736
609
  /**
737
610
  * Returns the thread of a message by its ID, wrapped in a hydrated `Thread` instance.
738
611
  *
739
- * @param messageId - The message ID.
740
- * @param options - Options object for pagination and limiting the participants and replies
741
- * (optional, defaults to `{}`).
742
- * @param options.watch - Subscribes the user to the channel of the thread (optional).
743
- * @param options.participant_limit - Limits the number of participants returned per thread (optional).
744
- * @param options.reply_limit - Limits the number of replies returned per thread (optional).
612
+ * @param pathParams - The thread's parent message, as for `getThread`.
613
+ * @param pathParams.message_id - The parent message ID.
614
+ * @param options - Options object for pagination and limiting the participants and replies.
615
+ * Defaults to `{}`.
616
+ * @param options.watch - Subscribes the user to the channel of the thread. Defaults to `true`.
617
+ * @param options.participant_limit - Limits the participants returned. Defaults to 100.
618
+ * @param options.reply_limit - Limits the replies returned. Defaults to 3.
745
619
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
746
620
  * into the request (optional).
747
621
  * @returns The thread.
748
622
  */
749
- getThreadAndHydrate(messageId: string, options?: GetThreadOptions, requestOptions?: StreamRequestOptions): Promise<Thread>;
623
+ getThreadAndHydrate({ message_id: messageId }: {
624
+ message_id: string;
625
+ }, options?: GetThreadOptions, requestOptions?: StreamRequestOptions): Promise<Thread>;
750
626
  getUserAgent: () => string;
751
627
  /**
752
628
  * Sets the user agent string.
@@ -756,53 +632,60 @@ export declare class StreamChat extends ChatApi {
756
632
  * @param userAgent - The user agent string.
757
633
  */
758
634
  setUserAgent(userAgent: string): void;
759
- _cacheEnabled: () => boolean;
760
635
  _startCleaning(): void;
761
636
  /**
762
- * Encodes the WebSocket auth message, sent as the first frame once the socket opens.
637
+ * The JSON-encoded WebSocket auth message, sent as the first frame once the socket opens.
763
638
  *
764
- * `products` is not optional in practice: without `'chat'` the server treats the
765
- * connection as video-only, which drops every chat event and unread count.
639
+ * @private
640
+ */
641
+ _buildWSAuthMessage: () => string;
642
+ /**
643
+ * The auth message that {@link _buildWSAuthMessage} encodes for the WebSocket and the long-poll
644
+ * fallback sends as `longPoll()`'s `json` query param.
766
645
  *
767
646
  * @private
768
647
  *
769
- * @returns The JSON-encoded auth message.
648
+ * @param token - The long-poll passes none: it authenticates through the `Authorization` header.
770
649
  */
771
- _buildWSAuthMessage: () => string;
650
+ _buildWSAuthPayload: (token?: string) => WSAuthMessage;
772
651
  /**
773
- * Queries poll answers.
652
+ * Queries poll answers: the votes with `is_answer: true`.
774
653
  *
775
- * @param request - The query poll answers request payload, including the poll ID, optional vote
776
- * filter conditions, sort directions, and pagination options (`limit`, `offset`).
777
- * @param request.poll_id - The poll ID.
778
- * @param request.filter - Vote filter conditions.
654
+ * @param ...args - `[pathParams, request, requestOptions]`. `pathParams.poll_id` is the poll ID;
655
+ * `request` carries optional vote filter conditions, sort directions, and pagination options
656
+ * (`limit`, `next`, `prev`); `requestOptions` carries per-request options such as an abort
657
+ * `signal` and is never serialized into the request.
779
658
  * @returns The poll answers.
780
659
  */
781
- queryPollAnswers({ poll_id, filter, ...options }: Parameters<ChatApi['queryPollVotes']>[0], requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").PollVotesResponse>>;
660
+ queryPollAnswers(...args: Parameters<ChatApi['queryPollVotes']>): Promise<StreamResponse<import(".").PollVotesResponse>>;
782
661
  /**
783
- * Uploads a file to the Stream CDN
662
+ * Uploads a file to the Stream CDN.
784
663
  *
785
664
  * @param request - Upload payload. `request.file` is the file to upload.
786
- * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
787
- * @returns Response containing the file URL.
665
+ * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
666
+ * (optional).
667
+ * @returns The upload response, with the file URL.
788
668
  */
789
669
  uploadFile(request?: Omit<FileUploadRequest, 'file'> & {
790
670
  file?: FileUploadInput;
791
671
  }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").FileUploadResponse>>;
792
672
  /**
793
- * Uploads an image to Stream CDN
673
+ * Uploads an image to the Stream CDN.
794
674
  *
795
675
  * @param request - Upload payload. `request.file` is the image to upload.
796
- * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
797
- * @returns Response containing the image URL.
676
+ * @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
677
+ * (optional).
678
+ * @returns The upload response, with the image URL.
798
679
  */
799
680
  uploadImage(request?: Omit<ImageUploadRequest, 'file'> & {
800
681
  file?: FileUploadInput;
801
682
  }, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ImageUploadResponse>>;
802
683
  /**
803
- * Marks the channels as delivered for the given messages and the user.
684
+ * Marks channels as delivered for the given messages.
804
685
  *
805
686
  * @param request - Mark delivered options.
687
+ * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
688
+ * into the request (optional).
806
689
  * @returns The server response, or `undefined` if there are no messages to mark.
807
690
  */
808
691
  markChannelsDelivered(request?: Gen_MarkDeliveredRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MarkDeliveredResponse> | undefined>;