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,76 +1,72 @@
1
- import type { AxiosRequestConfig, AxiosResponse } from 'axios';
2
- import type { StableWSConnection } from './connection';
1
+ import type { AxiosResponse } from 'axios';
3
2
  import type { CustomEventTypes } from './custom_types';
4
- import type { NotificationManager } from './notifications';
5
- import type { InstanceConfigTree } from './configuration/types';
6
- import type { DeepPartial } from './types.utility';
7
- import type { APIError, Attachment, BanRequest, ChannelConfigWithInfo, ChannelOwnCapability, ChannelStateResponseFields, CreateDeviceRequest, CreatePollRequest, DraftPayloadResponse, FlagRequest, Images, MessageResponse, OwnUserResponse, QueryChannelsRequest, QueryMembersPayload, QueryPollsRequest, QueryPollVotesRequest, QueryRemindersRequest, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, SearchPayload, SendMessageRequest, SendMessageResponse, SharedLocationResponseData, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollRequest, UserResponse, WSEvent } from './gen/models';
3
+ import type { APIError, Attachment, BanRequest, ChannelConfigWithInfo, ChannelMemberRequest, ChannelStateResponseFields, CreateDeviceRequest, CreatePollRequest, CustomEvent, DraftPayloadResponse, FlagRequest, Images, MessageRequest, MessageResponse, OwnUserResponse, QueryChannelsRequest, QueryMembersPayload, QueryPollsRequest, QueryPollVotesRequest, QueryReactionsRequest, QueryRemindersRequest, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, SearchPayload, SendMessageRequest, SendMessageResponse, SharedLocationResponseData, TimestampNS, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollRequest, UserResponse, WSEvent } from './gen/models';
8
4
  import type { ChatApi } from './gen-imports';
9
- /**
10
- * Utility Types
11
- */
12
5
  export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> & {
13
6
  [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
14
7
  }[Keys];
15
8
  export type RequireAtLeastOne<T> = {
16
9
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
17
10
  }[keyof T];
18
- export type Unpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends Promise<infer U> ? U : T;
19
- /**
20
- * Response Types
21
- */
22
11
  /**
23
- * Legacy response envelope. Every generated response already carries `duration`, and the
24
- * transport wraps results in `StreamResponse<T>`, which also carries `metadata`.
25
- *
26
- * Only still referenced by the hand-written `/moderation/*` methods on `StreamChat` that
27
- * bypass the generated client. Delete this together with those.
12
+ * Used only by `StreamChat.unbanUser`, a hand-written `/moderation/*` call that bypasses the
13
+ * generated client.
28
14
  */
29
15
  export type APIResponse = {
30
16
  duration: string;
31
17
  };
32
18
  export type ChannelUpdateOptions = Omit<UpdateChannelRequest, 'message'>;
19
+ /**
20
+ * A channel update that adds or removes items (members, invitees, filter tags): the items, a message
21
+ * notifying the channel members, and any other `update()` option.
22
+ */
23
+ type ChannelItemsUpdate<Key extends string, Item> = Record<Key, Item[]> & {
24
+ /** Message object for channel members notification (optional). */
25
+ message?: MessageRequest;
26
+ } & ChannelUpdateOptions;
27
+ /** Request of `channel.addMembers`: user IDs, or member requests with a role or custom data. */
28
+ export type AddMembersRequest = ChannelItemsUpdate<'members', string | ChannelMemberRequest>;
29
+ /** Request of `channel.inviteMembers`. */
30
+ export type InviteMembersRequest = ChannelItemsUpdate<'members', string | Required<Omit<ChannelMemberRequest, 'channel_role'>>>;
31
+ /** Request of `channel.removeMembers`: the user IDs to remove. */
32
+ export type RemoveMembersRequest = ChannelItemsUpdate<'members', string>;
33
+ /** Request of `channel.addFilterTags` and `channel.removeFilterTags`. */
34
+ export type FilterTagsRequest = ChannelItemsUpdate<'tags', string>;
33
35
  export type ConnectAPIResponse = Promise<void | ConnectionOpen>;
34
36
  export type LocalMessage = MessageResponse & {
35
37
  status: string;
36
38
  error?: StreamAPIError;
37
39
  user_id?: string;
38
40
  };
39
- export type GetThreadOptions = Omit<Parameters<ChatApi['getThread']>[0], 'message_id'>;
41
+ export type GetThreadOptions = NonNullable<Parameters<ChatApi['getThread']>[1]>;
42
+ /** Options of `client.pinMessage`. */
43
+ export type PinMessageOptions = {
44
+ /** When the pin expires; `null` or leaving it out pins without expiry. */
45
+ pin_expires?: Date | string | null;
46
+ /** The pin time, which orders the pinned messages. Defaults to now. */
47
+ pinned_at?: Date | string;
48
+ };
40
49
  /**
41
- * The fields that exist on the connected user (`OwnUserResponse`) but not on a plain
42
- * `UserResponse` — i.e. the own-user-only slice of the user object.
43
- *
44
- * Derived, never hand-listed: `client._handleUserEvent` uses this set (through
45
- * `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event, so a field
46
- * missing from it is silently deleted off `client.user`. Deriving it means a spec change
47
- * cannot desynchronise the two.
50
+ * The fields of `OwnUserResponse` that a plain `UserResponse` lacks. `client._handleUserEvent` uses
51
+ * it (through `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event.
48
52
  */
49
53
  export type OwnUserBase = Pick<OwnUserResponse, Exclude<keyof OwnUserResponse, keyof UserResponse>>;
50
54
  export type BanUserOptions = Omit<BanRequest, 'target_user_id'>;
51
55
  /**
52
56
  * Everything `queryChannels()` accepts apart from the filter and the sort.
53
57
  *
54
- * Derived from the generated request so new query options appear here automatically.
55
- *
56
- * On `predefined_filter`: the backend resolves the named filter template and interpolates it
57
- * with `filter_values`. A regular `sort` can still be passed, but backend precedence applies —
58
- * if the predefined filter has its own stored sort template that template wins and the request
59
- * `sort` is ignored; if it does not, the request `sort` is used. `sort_values` interpolates the
60
- * stored sort template's placeholders. All three are only read when `predefined_filter` is set.
58
+ * `predefined_filter` names a backend filter template, interpolated with `filter_values`. If that
59
+ * template has its own stored sort, it wins over the request `sort` and `sort_values` fills its
60
+ * placeholders; otherwise the request `sort` is used. `filter_values` and `sort_values` are sent
61
+ * only when `predefined_filter` is set.
61
62
  */
62
63
  export type ChannelOptions = Omit<QueryChannelsRequest, 'filter_conditions' | 'sort'>;
63
64
  export type ChannelStateOptions = {
64
65
  offlineMode?: boolean;
65
- skipInitialization?: string[];
66
66
  skipHydration?: boolean;
67
67
  /**
68
- * Returns the full query response with hydrated channels from `queryChannels()`.
69
- *
70
- * This is a compatibility bridge for internal callers that need response level
71
- * metadata such as `predefined_filter`. The default `queryChannels()` return value
72
- * remains `Channel[]` to avoid a breaking change. This should be folded into a
73
- * single full response API in the next major release.
68
+ * Makes `queryChannelsAndHydrate()` return the full query response (with hydrated `channels`,
69
+ * plus metadata such as `predefined_filter`) instead of `Channel[]`.
74
70
  */
75
71
  withResponse?: boolean;
76
72
  };
@@ -78,76 +74,8 @@ export type ChannelStateOptions = {
78
74
  export type Automod = ChannelConfigWithInfo['automod'];
79
75
  /** What automod does when it trips, as reported by `channel.getConfig()`. */
80
76
  export type AutomodBehavior = ChannelConfigWithInfo['automod_behavior'];
81
- export type PinnedMessagePaginationOptions = Omit<Parameters<ChatApi['getPinnedMessages']>[0], 'id' | 'sort' | 'type'>;
77
+ export type PinnedMessagePaginationOptions = Omit<NonNullable<Parameters<ChatApi['getPinnedMessages']>[1]>, 'sort'>;
82
78
  export type QueryMembersOptions = Partial<Omit<QueryMembersPayload, 'filter_conditions'>>;
83
- export type StreamChatOptions = {
84
- /**
85
- * Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
86
- */
87
- allowServerSideConnect?: boolean;
88
- axiosRequestConfig?: AxiosRequestConfig;
89
- /**
90
- * Base url to use for API
91
- * such as https://chat-proxy-dublin.stream-io-api.com
92
- */
93
- baseURL?: string;
94
- browser?: boolean;
95
- /**
96
- * Disables the hydration of all caches within the JS Client. This includes this.activeChannels,
97
- * this.polls.pollCache and this.config.
98
- * It is mainly meant to be used for integrations where stream-chat is used as a server-side service
99
- * interacting with Stream's REST API, not depending on any state and purely serving as a wrapper
100
- * around HTTP requests. Using this property on either the client side or a backend implementation
101
- * that also relies on WS events will break these functionalities, so please use carefully.
102
- */
103
- disableCache?: boolean;
104
- enableInsights?: boolean;
105
- /**
106
- * When true, maintains a client-local unread count on channels that have read events disabled
107
- * (e.g. livestreams). The count increments on incoming messages and is reset via
108
- * `channel.markReadLocally()`. It is never sent to the backend, but is persisted to the offline DB.
109
- */
110
- isLocalUnreadCountEnabled?: boolean;
111
- /**
112
- * Custom notification manager service to use for the client.
113
- * If not provided, a default notification manager will be created.
114
- * Notifications are used to communicate events like errors, warnings, info, etc. Other services can publish notifications or subscribe to the NotificationManager state changes.
115
- */
116
- notifications?: NotificationManager;
117
- /**
118
- * Declarative configuration for instances the SDK creates on your behalf, seeded before the client's
119
- * own managers are constructed.
120
- *
121
- * Equivalent to calling `client.config.set(tree)` immediately after construction, except for the
122
- * `client` subtree — the configuration registry is created inside the constructor, so this is the only
123
- * way to configure `reminders` / `notifications` before they are built.
124
- */
125
- config?: DeepPartial<InstanceConfigTree>;
126
- /**
127
- * When true, user will be persisted on client. Otherwise if `connectUser` call fails, then you need to
128
- * call `connectUser` again to retry.
129
- * This is mainly useful for chat application working in offline mode, where you will need client.user to
130
- * persist even if connectUser call fails.
131
- */
132
- persistUserOnConnectionFailure?: boolean;
133
- warmUp?: boolean;
134
- /**
135
- * Sets the instance of `StableWSConnection` on the chat client. Intended purely for testing and
136
- * should not be used in production apps.
137
- */
138
- wsConnection?: StableWSConnection;
139
- /**
140
- * Overrides the `WebSocket` constructor used by `StableWSConnection`. Intended purely for
141
- * testing so a mock/drivable WebSocket can be swapped in; production code should leave this
142
- * unset and rely on the platform's global `WebSocket`.
143
- */
144
- WebSocketImpl?: typeof WebSocket;
145
- /**
146
- * Sets a suffix to the wsUrl when it is being built in `wsConnection`. Is meant to be
147
- * used purely in testing suites and should not be used in production apps.
148
- */
149
- wsUrlParams?: URLSearchParams;
150
- };
151
79
  export type UnBanUserOptions = {
152
80
  client_id?: string;
153
81
  connection_id?: string;
@@ -159,6 +87,12 @@ export type UnBanUserOptions = {
159
87
  };
160
88
  /** Everything `queryUsers()` accepts apart from the filter and the sort. */
161
89
  export type UserOptions = Omit<QueryUsersPayload, 'filter_conditions' | 'sort'>;
90
+ /**
91
+ * Which connection a status refers to: `'network'` is the device's network (reported by the
92
+ * platform reporter installed on `client.networkConnection`), `'ws'` is this client's WebSocket.
93
+ * They can disagree, so each has its own store.
94
+ */
95
+ export type ConnectionType = 'network' | 'ws';
162
96
  type LocalEvent = (({
163
97
  type: 'live_location_sharing.started';
164
98
  } & {
@@ -174,114 +108,83 @@ type LocalEvent = (({
174
108
  channels: ChannelStateResponseFields[];
175
109
  isLatestMessageSet: boolean;
176
110
  };
177
- }) | ({
178
- type: 'connection.changed';
179
- } & {
180
- online: boolean;
181
111
  }) | {
182
112
  type: 'connection.recovered';
183
113
  } | ({
184
- type: 'offline_reactions.queried';
114
+ type: 'connection.fallback_activated';
185
115
  } & {
186
- offlineReactions: ReactionResponse[];
116
+ mode: string;
187
117
  }) | ({
188
- type: 'capabilities.changed';
118
+ type: 'offline_reactions.queried';
189
119
  } & {
190
- cid: string;
191
- own_capabilities: ChannelOwnCapability[];
120
+ offlineReactions: ReactionResponse[];
192
121
  }) | ({
193
122
  type: 'message.read_locally';
194
123
  } & {
195
124
  channel_type: string;
196
125
  cid: string;
197
- created_at: Date;
126
+ created_at: TimestampNS;
198
127
  channel_id?: string;
199
128
  last_read_message_id?: string;
200
129
  team?: string;
201
130
  user?: UserResponse;
202
131
  })) & {
203
- received_at?: Date;
132
+ received_at?: TimestampNS;
204
133
  };
134
+ export type Event = (Exclude<WSEvent, {
135
+ type: '*';
136
+ }> & {
137
+ received_at?: TimestampNS;
138
+ }) | LocalEvent | CustomEventTypeUnion;
139
+ type CustomEventTypeUnion = {
140
+ [K in keyof CustomEventTypes]: {
141
+ type: K;
142
+ } & Omit<CustomEvent, 'type'> & {
143
+ received_at?: TimestampNS;
144
+ };
145
+ }[keyof CustomEventTypes];
146
+ export type EventType = Event['type'] | 'all';
205
147
  /**
206
- * The hello event of the `/api/v2/connect` WebSocket endpoint, sent once the auth frame
207
- * has been accepted. The v1 endpoint used `health.check` for this instead.
208
- *
209
- * Hand-written because the event is not published in the OpenAPI spec, so it cannot
210
- * come from `src/gen`. Remove this — along with the `decodeConnectionEvent` shim in
211
- * `connection.ts` — once the backend adds it to the spec and `src/gen` is regenerated.
148
+ * A listener for events of type `T`. `'all'` (the default) receives every event, any other type the
149
+ * event members declaring it. Custom event types have to be declared by augmenting
150
+ * `CustomEventTypes`; an undeclared name is not an `EventType`.
212
151
  */
213
- export type ConnectedEvent = {
214
- type: 'connection.ok';
215
- connection_id: string;
216
- created_at: Date;
217
- me: OwnUserResponse;
218
- received_at?: Date;
219
- };
220
- export type Event = WSEvent | ConnectedEvent | LocalEvent | keyof CustomEventTypes;
221
- export type EventType = Event['type'] | 'all';
222
- export type EventHandler<T = string> = (event: Extract<Event, {
152
+ export type EventHandler<T extends EventType = 'all'> = (event: T extends 'all' ? Event : Extract<Event, {
223
153
  type: T;
224
154
  }>) => void;
225
- /**
226
- * Filter Types
227
- */
228
- export type ReactionFilters = NonNullable<QueryReactionsRequestWithId['filter']>;
229
- export type QueryReactionsRequestWithId = Parameters<ChatApi['queryReactions']>[0];
155
+ export type ReactionFilters = NonNullable<QueryReactionsRequest['filter']>;
230
156
  export type ChannelFilters = NonNullable<QueryChannelsRequest['filter_conditions']>;
231
157
  export type QueryPollsOptions = Omit<QueryPollsRequest, 'filter' | 'sort'>;
232
158
  export type QueryVotesOptions = Omit<QueryPollVotesRequest, 'filter' | 'sort'>;
233
159
  export type QueryPollsFilters = NonNullable<QueryPollsRequest['filter']>;
234
160
  export type QueryVotesFilters = NonNullable<QueryPollVotesRequest['filter']>;
235
161
  export type MessageFilters = NonNullable<SearchPayload['message_filter_conditions']>;
236
- export type PrimitiveFilter<ObjectType> = ObjectType | null;
237
- export type QueryFilter<ObjectType = string> = NonNullable<ObjectType> extends string | number | boolean | Date ? {
238
- $eq?: PrimitiveFilter<ObjectType>;
239
- $exists?: boolean;
240
- $gt?: PrimitiveFilter<ObjectType>;
241
- $gte?: PrimitiveFilter<ObjectType>;
242
- $in?: PrimitiveFilter<ObjectType>[];
243
- $lt?: PrimitiveFilter<ObjectType>;
244
- $lte?: PrimitiveFilter<ObjectType>;
245
- } : {
246
- $eq?: PrimitiveFilter<ObjectType>;
247
- $exists?: boolean;
248
- $in?: PrimitiveFilter<Unpacked<ObjectType>>[];
249
- };
250
162
  export type UserFilters = QueryUsersPayload['filter_conditions'];
251
163
  export type MemberFilters = QueryMembersPayload['filter_conditions'];
252
164
  export type OGAttachment = RequireLiteral<Attachment, 'og_scrape_url'>;
253
165
  export type PushProvider = CreateDeviceRequest['push_provider'];
254
166
  /**
255
- * Server-provided channel configuration, keyed by **cid** (`messaging:general`, …). Most of
256
- * `ChannelConfigWithInfo` is a type-level setting, but a channel's `config_overrides` can narrow it for
257
- * that channel alone, so the effective answer is per channel. Read it via `channel.serverConfig`.
167
+ * Server-provided channel configuration, keyed by cid (`messaging:general`). Keyed per channel
168
+ * because a channel's `config_overrides` can narrow its type's config. Read it via
169
+ * `channel.serverConfig`.
258
170
  */
259
171
  export type Configs = Record<string, ChannelConfigWithInfo | undefined>;
260
172
  export type ConnectionOpen = EventPayload<'health.check'> | EventPayload<'connection.ok'>;
261
173
  /**
262
- * The message `type` values the server can return.
263
- *
264
- * Hand-written because there is no generated equivalent: `MessageResponse['type']` is a bare
265
- * `string`, so deriving it would widen rather than narrow. Both the React and React Native
266
- * SDKs use this as a discriminant (RN types its SQLite message rows with it).
174
+ * The message `type` values the server can return (`MessageResponse['type']` is a bare `string`).
267
175
  */
268
176
  export type MessageLabel = 'deleted' | 'ephemeral' | 'error' | 'regular' | 'reply' | 'system';
269
177
  export type SendMessageOptions = Omit<SendMessageRequest, 'message'>;
270
178
  export type TokenOrProvider = null | string | TokenProvider | undefined;
271
179
  export type TokenProvider = () => Promise<string>;
272
- export type MessageSetType = 'latest' | 'current' | 'new';
273
180
  export declare class StreamAPIError<T = APIError> extends Error {
274
181
  code: number | undefined;
275
182
  status: number | undefined;
276
183
  response: AxiosResponse<T> | undefined;
277
184
  constructor(message: string, { code, status, response, }: {
278
- /**
279
- * Stream error code (`APIError.code`)
280
- */
185
+ /** Stream error code (`APIError.code`) */
281
186
  code: StreamAPIError<T>['code'];
282
- /**
283
- * HTTP status code
284
- */
187
+ /** HTTP status code */
285
188
  status: StreamAPIError<T>['status'];
286
189
  response: StreamAPIError<T>['response'];
287
190
  });
@@ -295,18 +198,12 @@ export declare class StreamAPIError<T = APIError> extends Error {
295
198
  readonly status: number | undefined;
296
199
  };
297
200
  }
298
- /**
299
- * Poll vote visibility. Derived from the generated request shape so it tracks the spec.
300
- */
301
201
  export type VotingVisibility = NonNullable<CreatePollRequest['voting_visibility']>;
302
202
  export type PartialPollUpdate = {
303
203
  set?: Partial<UpdatePollRequest>;
304
204
  unset?: Array<keyof UpdatePollRequest>;
305
205
  };
306
- /**
307
- * Options accepted by `moderation.flagUser` / `moderation.flagMessage` on top of the
308
- * entity they resolve and the `reason` they take positionally.
309
- */
206
+ /** Options of `moderation.flagUser` / `moderation.flagMessage` besides the entity and `reason`. */
310
207
  export type ModerationFlagOptions = Omit<FlagRequest, 'entity_id' | 'entity_type' | 'reason'>;
311
208
  export type AIState = 'AI_STATE_IDLE' | 'AI_STATE_ERROR' | 'AI_STATE_EXTERNAL_SOURCES' | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | 'AI_STATE_STOP' | (string & {});
312
209
  export declare const AIStates: {
@@ -317,27 +214,18 @@ export declare const AIStates: {
317
214
  readonly Stop: "AI_STATE_STOP";
318
215
  readonly Thinking: "AI_STATE_THINKING";
319
216
  };
320
- /**
321
- * An identifier containing information about the downstream SDK using stream-chat. It
322
- * is used to resolve the user agent.
323
- */
217
+ /** The downstream SDK using stream-chat, used to resolve the user agent. */
324
218
  export type SdkIdentifier = {
325
219
  name: 'react' | 'react-native' | 'expo' | 'angular';
326
220
  version: string;
327
221
  };
328
- /**
329
- * An identifier containing information about the downstream device using stream-chat, if
330
- * available. Is used by the react-native SDKs to enrich the user agent further.
331
- */
222
+ /** The downstream device, used by the React Native SDKs to enrich the user agent. */
332
223
  export type DeviceIdentifier = {
333
224
  os: string;
334
225
  model?: string;
335
226
  };
336
227
  /**
337
- * An identifier containing information about the downstream application integrating
338
- * stream-chat, if available. `name` is reported as `app` and `version` as `app_version`
339
- * in the user agent. Distinct from the SDK ({@link SdkIdentifier}) and device
340
- * ({@link DeviceIdentifier}) identifiers.
228
+ * The downstream app: `name` is reported as `app` and `version` as `app_version` in the user agent.
341
229
  */
342
230
  export type AppIdentifier = {
343
231
  name: string;
@@ -346,7 +234,6 @@ export type AppIdentifier = {
346
234
  export type DraftMessage = DraftPayloadResponse & Partial<Pick<MessageResponse, 'shared_location' | 'mentioned_channel' | 'mentioned_group_ids' | 'mentioned_groups' | 'mentioned_here' | 'mentioned_roles'>>;
347
235
  export type SharedLiveLocationResponse = RequireLiteral<SharedLocationResponseData, 'end_at'>;
348
236
  export type ThreadFilters = NonNullable<QueryThreadsRequest['filter']>;
349
- export type CreateReminderOptions = Parameters<ChatApi['createReminder']>[0];
350
237
  export type ReminderFilters = NonNullable<QueryRemindersRequest['filter']>;
351
238
  export type ListUserGroupsOptions = NonNullable<Parameters<ChatApi['listUserGroups']>[0]>;
352
239
  export type SearchUserGroupsOptions = Parameters<ChatApi['searchUserGroups']>[0];
@@ -373,14 +260,10 @@ export type PartializeAllBut<T, K extends keyof T> = {
373
260
  } & {
374
261
  [P in Exclude<keyof T, K>]?: T[P];
375
262
  };
376
- export type DeleteMessageOptions = Omit<Parameters<ChatApi['deleteMessage']>[0], 'id'>;
263
+ export type DeleteMessageOptions = NonNullable<Parameters<ChatApi['deleteMessage']>[1]>;
377
264
  export type SendMessageAPIResponse = StreamResponse<SendMessageResponse>;
378
265
  export type UpdateMessageOptions = Omit<UpdateMessageRequest, 'message'>;
379
266
  export type UpdateMessageAPIResponse = StreamResponse<UpdateMessageResponse>;
380
- /**
381
- * The Giphy rendition names, derived from the generated `Images` shape so the two cannot
382
- * drift. Consumed by the React and React Native SDKs to pick a rendition size.
383
- */
384
267
  export type GiphyVersions = keyof Images;
385
268
  export type TranslationLanguage = TranslateMessageRequest['language'];
386
269
  export type FileReferenceBase = {
@@ -390,8 +273,7 @@ export type FileReferenceBase = {
390
273
  };
391
274
  export type FileUploadInput = File | Blob | FileReferenceBase | string;
392
275
  /**
393
- * Structural subset of axios' `AxiosProgressEvent`, kept transport-agnostic on purpose so the
394
- * public surface does not depend on axios.
276
+ * Structural subset of axios' `AxiosProgressEvent`, so the public surface does not depend on axios.
395
277
  */
396
278
  export type StreamProgressEvent = {
397
279
  loaded: number;
@@ -403,5 +285,7 @@ export type StreamRequestOptions = {
403
285
  signal?: AbortSignal;
404
286
  /** Only meaningful for upload (multipart) requests; ignored everywhere else. */
405
287
  onUploadProgress?: (event: StreamProgressEvent) => void;
288
+ /** Milliseconds before this request is aborted. */
289
+ timeout?: number;
406
290
  };
407
291
  export * from './gen/models';
@@ -2,9 +2,9 @@ export type DeepPartial<T> = {
2
2
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
3
3
  };
4
4
  /**
5
- * The keys of every union member, not only those common to all — which is what `keyof (A | B)` gives.
6
- * Distribution needs a naked type parameter: the same conditional written inline over a concrete union
7
- * silently yields the common keys instead.
5
+ * The keys of every union member, not only those common to all (`keyof (A | B)`). Distribution
6
+ * needs the naked type parameter: the same conditional inline over a concrete union yields the
7
+ * common keys.
8
8
  */
9
9
  export type KeysOfUnion<T> = T extends unknown ? keyof T : never;
10
10
  /** The type `Key` has in each union member declaring it; members without it drop out as `never`. */
@@ -1,20 +1,15 @@
1
1
  import type { FileReferenceBase, FileUploadInput } from './types';
2
2
  /**
3
- * Turns a bare URI string into a {@link FileReferenceBase} so the multipart encoder can derive a
4
- * file name from it. `File`, `Blob` and picker objects pass through untouched.
3
+ * Wraps a bare URI string in a {@link FileReferenceBase}; `File`, `Blob` and picker objects pass
4
+ * through.
5
5
  */
6
6
  export declare const normalizeUploadFile: (file?: FileUploadInput) => Blob | FileReferenceBase | {
7
7
  uri: string;
8
8
  } | undefined;
9
9
  /**
10
- * Appends one request-body entry to a multipart form using Stream's encoding rules.
11
- *
12
- * Callers must pass **raw** values - objects and arrays are JSON-encoded here (that is what
13
- * the API expects for `user` and `upload_sizes`), so pre-stringifying them double-encodes.
10
+ * Appends one request-body entry to a multipart form. Pass **raw** values: objects and arrays are
11
+ * JSON-encoded here, so pre-stringifying them double-encodes.
14
12
  */
15
13
  export declare function appendToFormData(data: FormData, key: string, value: unknown): void;
16
- /**
17
- * Encodes a request body as `multipart/form-data`. Used by `ApiClient.sendRequest` for every
18
- * generated operation declaring that content type.
19
- */
14
+ /** Encodes a request body as `multipart/form-data`. */
20
15
  export declare function toFormData(body: Record<string, unknown>): FormData;
@@ -1,11 +1,35 @@
1
1
  import type { StreamChat } from './client';
2
- import { StateStore } from './store';
3
- import type { AttachmentManager } from '.';
2
+ import { StateStore } from '@stream-io/state-store';
3
+ import type { AttachmentManager, LocalAttachmentUploadMetadata } from '.';
4
+ /**
5
+ * Whether an upload was aborted (attachment removed, client disconnected) rather than failed: an
6
+ * axios `CanceledError`, or an `AbortError` from a custom `doUploadRequest`.
7
+ */
8
+ export declare const isUploadCancellation: (error: unknown) => boolean;
4
9
  export type UploadRecord = {
10
+ /** The attachment's local ID (`localMetadata.id`); also the key this record is held under. */
5
11
  id: string;
12
+ /**
13
+ * `true` once every byte has been handed to the transport but the server has not responded yet.
14
+ * Progress reaches 100% when the request body is flushed, before the server confirms, so a
15
+ * determinate progress bar should turn indeterminate here. Confirmation is the record being
16
+ * removed. Stays `false` without `AttachmentManagerConfig.trackUploadProgress`.
17
+ */
18
+ uploadConfirmationPending?: boolean;
6
19
  uploadProgress?: number;
7
20
  };
21
+ /**
22
+ * Whether every byte is sent but the server has not answered. Reads
23
+ * {@link UploadRecord.uploadConfirmationPending} when present, else infers it from progress
24
+ * reaching 100. Takes `localMetadata`, as carried by a message payload.
25
+ */
26
+ export declare const isUploadConfirmationPending: (localMetadata?: Pick<LocalAttachmentUploadMetadata, "uploadConfirmationPending" | "uploadProgress" | "uploadState">) => boolean;
8
27
  export type UploadManagerState = {
28
+ /**
29
+ * In-flight uploads keyed by the attachment's local ID (`localMetadata.id`), which makes
30
+ * {@link UploadManager.upload} idempotent. A record lives only for the request (removed on
31
+ * success and failure alike), so for "did it upload" read `localMetadata.uploadState`.
32
+ */
9
33
  uploads: Record<string, UploadRecord>;
10
34
  };
11
35
  /**
@@ -20,20 +44,16 @@ export declare class UploadManager {
20
44
  get uploads(): Record<string, UploadRecord>;
21
45
  getUpload: (id: string) => UploadRecord;
22
46
  /**
23
- * Clears all upload records.
24
- * Invoked when the user disconnects so a later session does not inherit stale upload state.
25
- * Aborts every in-flight upload request via its `UploadRequestOptions.abortSignal`.
47
+ * Aborts every in-flight upload (`UploadRequestOptions.abortSignal`) and clears all records, so a
48
+ * later session does not inherit them. Invoked on disconnect.
26
49
  */
27
50
  reset: () => void;
28
- /**
29
- * Removes the upload record for `id` if present.
30
- * If an upload is still in progress, aborts its `UploadRequestOptions.abortSignal`.
31
- */
51
+ /** Removes the record for `id` and aborts its upload if still in progress. */
32
52
  deleteUploadRecord: (id: string) => void;
33
53
  /**
34
54
  * Starts an upload for `id`, or returns the existing in-flight promise if one is already running.
35
- * Uses {@link StreamChat.channel}(`channelCid`) → `messageComposer.attachmentManager.doUploadRequest`.
36
- * Resolves with that result; rejects if the upload rejects (the record is removed from state either way).
55
+ * Uploads through the `attachmentManager.doUploadRequest` of the channel `channelCid`, and
56
+ * rejects if that rejects (the record is removed from state either way).
37
57
  */
38
58
  upload: ({ id, channelCid, file, }: {
39
59
  id: string;
@@ -1,9 +1,6 @@
1
1
  /**
2
- * A cache that stores a fixed number of values in a queue.
3
- * The most recently added or retrieved value is kept at the front of the queue.
4
- *
5
- * @template K - The type of the keys.
6
- * @template T - The type of the values.
2
+ * Least-recently-used cache holding at most `size` values. `add` and `get` mark a key as most
3
+ * recently used. Adding to a full cache evicts the least recently used entry, calling `dispose`.
7
4
  */
8
5
  export declare class FixedSizeQueueCache<K, T> {
9
6
  private keys;
@@ -14,28 +11,28 @@ export declare class FixedSizeQueueCache<K, T> {
14
11
  dispose: (key: K, value: T) => void;
15
12
  });
16
13
  /**
17
- * Adds a new entry or moves the existing reference to the front of the queue.
14
+ * Inserts or updates an entry as the most recently used one.
18
15
  *
19
16
  * @param key - The cache key.
20
17
  * @param value - The value to associate with `key`.
21
18
  */
22
19
  add(key: K, value: T): void;
23
20
  /**
24
- * Retrieves the value by key without changing its position in the queue.
21
+ * Retrieves a value without marking it as recently used.
25
22
  *
26
23
  * @param key - The cache key.
27
24
  * @returns The value, or `undefined` when the key is not cached.
28
25
  */
29
26
  peek(key: K): T | undefined;
30
27
  /**
31
- * Retrieves the value and moves it to the front of the queue.
28
+ * Retrieves a value and marks it as most recently used.
32
29
  *
33
30
  * @param key - The cache key.
34
31
  * @returns The value, or `undefined` when the key is not cached.
35
32
  */
36
33
  get(key: K): T | undefined;
37
- /**
38
- * Clears queue entirely and disposes of each item individually.
39
- */
34
+ /** Every cached value, as a new array. */
35
+ values(): T[];
36
+ /** Empties the cache, calling `dispose` for each entry. */
40
37
  clear(): void;
41
38
  }
@@ -1,32 +1,22 @@
1
- import type { Unsubscribe } from '../store';
1
+ import type { Unsubscribe } from '@stream-io/state-store';
2
2
  /**
3
- * Class to use as a template for subscribable entities.
3
+ * Base class for entities that own event subscriptions. `unregisterSubscriptions` is ref-counted:
4
+ * only the last consumer's call tears the subscriptions down.
4
5
  *
5
6
  * @internal
6
7
  */
7
8
  export declare abstract class WithSubscriptions {
8
9
  private unsubscribeFunctions;
9
- /**
10
- * Workaround for the missing TS keyword - ensures that inheritants
11
- * overriding `unregisterSubscriptions` call the base method and return
12
- * its unique symbol value.
13
- */
10
+ /** Return brand that makes overrides of `unregisterSubscriptions` return the base result. */
14
11
  protected static symbol: symbol;
15
12
  private refCount;
16
13
  abstract registerSubscriptions(): void;
17
- /**
18
- * Returns a boolean, provides information of whether `registerSubscriptions`
19
- * method has already been called for this instance.
20
- */
14
+ /** Whether subscriptions are registered. Guards `registerSubscriptions` against running twice. */
21
15
  get hasSubscriptions(): boolean;
22
16
  protected addUnsubscribeFunction(unsubscribeFunction: Unsubscribe): void;
23
- /**
24
- * Increments `refCount` by one and returns new value.
25
- */
26
17
  protected incrementRefCount(): number;
27
18
  /**
28
- * If you re-declare `unregisterSubscriptions` method within your class
29
- * make sure to run the original too.
19
+ * Overrides must call `super.unregisterSubscriptions()` and return its result.
30
20
  *
31
21
  * @example
32
22
  * ```ts
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The rejection for a wait an `AbortSignal` ended, shaped like the one `fetch` and `axios` raise:
3
+ * the signal's reason when it is an `Error`, otherwise an `AbortError` carrying `message`.
4
+ */
5
+ export declare const abortError: (signal: AbortSignal, message: string) => Error;
6
+ /**
7
+ * Settles as `promise` does, or rejects with {@link abortError} as soon as `signal` aborts.
8
+ * `onAbort` runs, before the rejection, when the signal aborts before the wait has seen `promise`
9
+ * settle. Ending the wait does not cancel the work behind `promise`.
10
+ */
11
+ export declare const waitUnlessAborted: <T>({ abortMessage, onAbort, promise, signal, }: {
12
+ /** The message of the `AbortError` the wait rejects with when the abort reason is no `Error`. */
13
+ abortMessage: string;
14
+ onAbort?: () => void;
15
+ promise: Promise<T>;
16
+ signal: AbortSignal | undefined;
17
+ }) => Promise<T>;