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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +11 -8
  2. package/dist/cjs/index.browser.js +15397 -12090
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +15349 -11991
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +15164 -11880
  7. package/dist/esm/index.mjs.map +4 -4
  8. package/dist/types/ChannelManager.d.ts +246 -6
  9. package/dist/types/CooldownTimer.d.ts +22 -8
  10. package/dist/types/EventHandlerPipeline.d.ts +12 -16
  11. package/dist/types/LiveLocationManager.d.ts +69 -6
  12. package/dist/types/api-client.d.ts +22 -9
  13. package/dist/types/channel.d.ts +550 -300
  14. package/dist/types/channel_state.d.ts +167 -22
  15. package/dist/types/client.d.ts +325 -305
  16. package/dist/types/configuration/ConfigController.d.ts +172 -0
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +192 -0
  18. package/dist/types/configuration/index.d.ts +3 -0
  19. package/dist/types/configuration/keys.d.ts +31 -0
  20. package/dist/types/configuration/shape.d.ts +58 -0
  21. package/dist/types/configuration/types.d.ts +206 -50
  22. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +59 -0
  23. package/dist/types/configuration/utils/copyConfigPatch.d.ts +1 -0
  24. package/dist/types/configuration/utils/declarativeSlices.d.ts +24 -0
  25. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +22 -0
  26. package/dist/types/configuration/utils/index.d.ts +1 -0
  27. package/dist/types/configuration/utils/serverAuthority.d.ts +49 -0
  28. package/dist/types/connection/ConnectionIdManager.d.ts +67 -0
  29. package/dist/types/connection/ConnectionRecoveryManager.d.ts +164 -0
  30. package/dist/types/connection/index.d.ts +4 -0
  31. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +153 -0
  32. package/dist/types/connection/networkConnection/index.d.ts +3 -0
  33. package/dist/types/connection/networkConnection/reporters.d.ts +43 -0
  34. package/dist/types/connection/networkConnection/types.d.ts +55 -0
  35. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +204 -0
  36. package/dist/types/connection/wsConnection/WSConnection.d.ts +168 -0
  37. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +55 -0
  38. package/dist/types/connection/wsConnection/config.d.ts +51 -0
  39. package/dist/types/connection/wsConnection/index.d.ts +4 -0
  40. package/dist/types/connection/wsConnection/types.d.ts +99 -0
  41. package/dist/types/constants.d.ts +3 -1
  42. package/dist/types/entityStore/EntityStore.d.ts +160 -40
  43. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +48 -29
  44. package/dist/types/entityStore/index.d.ts +0 -1
  45. package/dist/types/errors.d.ts +24 -4
  46. package/dist/types/formatMessageMemo.d.ts +5 -0
  47. package/dist/types/gen/chat/ChannelApi.d.ts +51 -23
  48. package/dist/types/gen/chat/ChatApi.d.ts +215 -168
  49. package/dist/types/gen/models/index.d.ts +2164 -557
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +39 -32
  52. package/dist/types/gen-imports.d.ts +1 -0
  53. package/dist/types/index.d.ts +20 -7
  54. package/dist/types/languageNames.d.ts +97 -0
  55. package/dist/types/logger.d.ts +1 -1
  56. package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
  57. package/dist/types/messageComposer/LocationComposer.d.ts +10 -4
  58. package/dist/types/messageComposer/attachmentIdentity.d.ts +11 -0
  59. package/dist/types/messageComposer/attachmentManager.d.ts +48 -10
  60. package/dist/types/messageComposer/attachmentUtils.d.ts +34 -0
  61. package/dist/types/messageComposer/configuration/commands.configuration.d.ts +1 -3
  62. package/dist/types/messageComposer/configuration/configuration.d.ts +9 -1
  63. package/dist/types/messageComposer/configuration/index.d.ts +0 -1
  64. package/dist/types/messageComposer/configuration/types.d.ts +57 -1
  65. package/dist/types/messageComposer/index.d.ts +1 -0
  66. package/dist/types/messageComposer/linkPreviewsManager.d.ts +10 -4
  67. package/dist/types/messageComposer/messageComposer.d.ts +210 -14
  68. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +20 -1
  69. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +11 -0
  70. package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +2 -2
  71. package/dist/types/messageComposer/middleware/pollComposer/index.d.ts +1 -0
  72. package/dist/types/messageComposer/middleware/pollComposer/state.d.ts +3 -2
  73. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +9 -2
  74. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +44 -0
  75. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +2 -2
  76. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +94 -229
  77. package/dist/types/messageComposer/pollComposer.d.ts +8 -3
  78. package/dist/types/messageComposer/textComposer.d.ts +9 -1
  79. package/dist/types/messageComposer/types.d.ts +7 -3
  80. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +64 -8
  81. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +48 -11
  82. package/dist/types/messageOperations/FailedSendCache.d.ts +34 -0
  83. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +52 -6
  84. package/dist/types/messageOperations/MessageOperations.d.ts +94 -11
  85. package/dist/types/{entityStore → messageOperations}/applyReactionLocally.d.ts +8 -2
  86. package/dist/types/messageOperations/createMessageOperations.d.ts +11 -0
  87. package/dist/types/messageOperations/index.d.ts +7 -1
  88. package/dist/types/messageOperations/reflectReactionEvent.d.ts +24 -0
  89. package/dist/types/messageOperations/sendOrdering.d.ts +17 -0
  90. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +28 -0
  91. package/dist/types/messageOperations/types.d.ts +66 -1
  92. package/dist/types/middleware.d.ts +8 -0
  93. package/dist/types/moderation.d.ts +18 -4
  94. package/dist/types/notifications/NotificationManager.d.ts +43 -2
  95. package/dist/types/notifications/types.d.ts +55 -42
  96. package/dist/types/offline-support/offline_support_api.d.ts +128 -12
  97. package/dist/types/offline-support/offline_sync_manager.d.ts +26 -5
  98. package/dist/types/offline-support/queueableOperations.d.ts +106 -0
  99. package/dist/types/offline-support/types.d.ts +77 -28
  100. package/dist/types/pagination/FilterBuilder.d.ts +1 -18
  101. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -1
  102. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +21 -3
  103. package/dist/types/pagination/filterCompiler.d.ts +5 -0
  104. package/dist/types/pagination/paginators/BasePaginator.d.ts +331 -7
  105. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +54 -11
  106. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +283 -66
  107. package/dist/types/pagination/paginators/MessagePaginator.d.ts +10 -9
  108. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +17 -1
  109. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +8 -8
  110. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +57 -0
  111. package/dist/types/pagination/paginators/index.d.ts +1 -0
  112. package/dist/types/pagination/utility.normalization.d.ts +29 -2
  113. package/dist/types/poll.d.ts +41 -14
  114. package/dist/types/poll_manager.d.ts +3 -2
  115. package/dist/types/poll_optimistic_votes.d.ts +61 -0
  116. package/dist/types/reminders/Reminder.d.ts +17 -7
  117. package/dist/types/reminders/ReminderManager.d.ts +34 -6
  118. package/dist/types/search/BaseSearchSource.d.ts +50 -25
  119. package/dist/types/search/ChannelMemberSearchSource.d.ts +11 -6
  120. package/dist/types/search/ChannelSearchSource.d.ts +27 -5
  121. package/dist/types/search/MessageSearchSource.d.ts +36 -6
  122. package/dist/types/search/SearchController.d.ts +44 -11
  123. package/dist/types/search/UserSearchSource.d.ts +11 -5
  124. package/dist/types/search/types.d.ts +14 -1
  125. package/dist/types/signing.d.ts +0 -157
  126. package/dist/types/thread.d.ts +118 -62
  127. package/dist/types/thread_manager.d.ts +124 -35
  128. package/dist/types/token_manager.d.ts +5 -8
  129. package/dist/types/types.d.ts +138 -562
  130. package/dist/types/types.utility.d.ts +8 -0
  131. package/dist/types/upload-utils.d.ts +20 -0
  132. package/dist/types/uploadManager.d.ts +50 -2
  133. package/dist/types/utils/FixedSizeQueueCache.d.ts +2 -0
  134. package/dist/types/utils/WithSubscriptions.d.ts +1 -1
  135. package/dist/types/utils/objectPath.d.ts +49 -0
  136. package/dist/types/utils/time.d.ts +85 -0
  137. package/dist/types/utils.d.ts +63 -40
  138. package/package.json +22 -33
  139. package/src/ChannelManager.ts +561 -109
  140. package/src/CooldownTimer.ts +55 -45
  141. package/src/EventHandlerPipeline.ts +13 -23
  142. package/src/LiveLocationManager.ts +191 -37
  143. package/src/api-client.ts +144 -53
  144. package/src/channel.ts +1573 -1050
  145. package/src/channel_state.ts +239 -129
  146. package/src/client.ts +843 -892
  147. package/src/client_state.ts +2 -2
  148. package/src/configuration/ConfigController.ts +298 -0
  149. package/src/configuration/InstanceConfigurationRegistry.ts +430 -0
  150. package/src/configuration/index.ts +7 -0
  151. package/src/configuration/keys.ts +86 -0
  152. package/src/configuration/shape.ts +776 -0
  153. package/src/configuration/types.ts +218 -60
  154. package/src/configuration/utils/applyInstanceConfiguration.ts +184 -0
  155. package/src/configuration/utils/copyConfigPatch.ts +61 -0
  156. package/src/configuration/utils/declarativeSlices.ts +81 -0
  157. package/src/configuration/utils/deepFreezeConfig.ts +33 -0
  158. package/src/configuration/utils/index.ts +5 -0
  159. package/src/configuration/utils/serverAuthority.ts +146 -0
  160. package/src/connection/ConnectionIdManager.ts +153 -0
  161. package/src/connection/ConnectionRecoveryManager.ts +371 -0
  162. package/src/connection/index.ts +4 -0
  163. package/src/connection/networkConnection/NetworkConnectionObserver.ts +281 -0
  164. package/src/connection/networkConnection/index.ts +3 -0
  165. package/src/connection/networkConnection/reporters.ts +85 -0
  166. package/src/connection/networkConnection/types.ts +60 -0
  167. package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +242 -151
  168. package/src/connection/wsConnection/WSConnection.ts +345 -0
  169. package/src/connection/wsConnection/WSConnectionFallback.ts +259 -0
  170. package/src/connection/wsConnection/config.ts +108 -0
  171. package/src/connection/wsConnection/index.ts +4 -0
  172. package/src/connection/wsConnection/types.ts +101 -0
  173. package/src/constants.ts +5 -3
  174. package/src/entityStore/EntityStore.ts +350 -10
  175. package/src/entityStore/StoreBackedItemIndex.ts +66 -37
  176. package/src/entityStore/index.ts +0 -1
  177. package/src/errors.ts +40 -7
  178. package/src/formatMessageMemo.ts +23 -0
  179. package/src/gen/chat/ChannelApi.ts +230 -44
  180. package/src/gen/chat/ChatApi.ts +1047 -1745
  181. package/src/gen/models/index.ts +2378 -3721
  182. package/src/gen/models/timestamp-guard.ts +27 -0
  183. package/src/gen/moderation/ModerationApi.ts +218 -388
  184. package/src/gen-imports.ts +1 -0
  185. package/src/index.ts +82 -6
  186. package/src/languageNames.ts +103 -0
  187. package/src/logger.ts +1 -1
  188. package/src/messageComposer/CustomDataManager.ts +10 -1
  189. package/src/messageComposer/LocationComposer.ts +68 -20
  190. package/src/messageComposer/attachmentIdentity.ts +39 -0
  191. package/src/messageComposer/attachmentManager.ts +191 -68
  192. package/src/messageComposer/attachmentUtils.ts +58 -0
  193. package/src/messageComposer/configuration/commands.configuration.ts +1 -26
  194. package/src/messageComposer/configuration/configuration.ts +22 -3
  195. package/src/messageComposer/configuration/index.ts +0 -1
  196. package/src/messageComposer/configuration/types.ts +58 -1
  197. package/src/messageComposer/index.ts +1 -0
  198. package/src/messageComposer/linkPreviewsManager.ts +16 -10
  199. package/src/messageComposer/messageComposer.ts +487 -98
  200. package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
  201. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +58 -33
  202. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +7 -2
  203. package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +3 -2
  204. package/src/messageComposer/middleware/messageComposer/attachments.ts +98 -1
  205. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +20 -10
  206. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
  207. package/src/messageComposer/middleware/messageComposer/types.ts +2 -7
  208. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +11 -6
  209. package/src/messageComposer/middleware/pollComposer/index.ts +1 -0
  210. package/src/messageComposer/middleware/pollComposer/state.ts +43 -11
  211. package/src/messageComposer/middleware/pollComposer/types.ts +9 -2
  212. package/src/messageComposer/middleware/pollComposer/validation.ts +76 -0
  213. package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -2
  214. package/src/messageComposer/middleware/textComposer/commands.ts +1 -2
  215. package/src/messageComposer/middleware/textComposer/mentions.ts +91 -39
  216. package/src/messageComposer/pollComposer.ts +11 -3
  217. package/src/messageComposer/textComposer.ts +36 -4
  218. package/src/messageComposer/types.ts +19 -14
  219. package/src/messageDelivery/MessageDeliveryReporter.ts +154 -53
  220. package/src/messageDelivery/MessageReceiptsTracker.ts +136 -64
  221. package/src/messageOperations/FailedSendCache.ts +90 -0
  222. package/src/messageOperations/MessageOperationStatePolicy.ts +269 -27
  223. package/src/messageOperations/MessageOperations.ts +340 -136
  224. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +10 -3
  225. package/src/messageOperations/createMessageOperations.ts +192 -0
  226. package/src/messageOperations/index.ts +7 -0
  227. package/src/messageOperations/reflectReactionEvent.ts +51 -0
  228. package/src/messageOperations/sendOrdering.ts +28 -0
  229. package/src/messageOperations/settlePendingAttachmentUploads.ts +110 -0
  230. package/src/messageOperations/types.ts +74 -0
  231. package/src/middleware.ts +11 -0
  232. package/src/moderation.ts +47 -24
  233. package/src/notifications/NotificationManager.ts +73 -3
  234. package/src/notifications/configuration.ts +10 -8
  235. package/src/notifications/types.ts +58 -42
  236. package/src/offline-support/offline_support_api.ts +380 -197
  237. package/src/offline-support/offline_sync_manager.ts +105 -32
  238. package/src/offline-support/queueableOperations.ts +270 -0
  239. package/src/offline-support/types.ts +85 -39
  240. package/src/pagination/FilterBuilder.ts +1 -22
  241. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +11 -7
  242. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +25 -7
  243. package/src/pagination/filterCompiler.ts +17 -0
  244. package/src/pagination/paginators/BasePaginator.ts +731 -81
  245. package/src/pagination/paginators/ChannelPaginator.ts +210 -102
  246. package/src/pagination/paginators/MessageIntervalPaginator.ts +703 -193
  247. package/src/pagination/paginators/MessagePaginator.ts +45 -36
  248. package/src/pagination/paginators/PinnedMessagePaginator.ts +74 -28
  249. package/src/pagination/paginators/ReminderPaginator.ts +15 -13
  250. package/src/pagination/paginators/ThreadPaginator.ts +181 -0
  251. package/src/pagination/paginators/UserGroupPaginator.ts +8 -1
  252. package/src/pagination/paginators/index.ts +1 -0
  253. package/src/pagination/utility.normalization.ts +37 -9
  254. package/src/poll.ts +189 -112
  255. package/src/poll_manager.ts +14 -8
  256. package/src/poll_optimistic_votes.ts +335 -0
  257. package/src/reminders/Reminder.ts +34 -16
  258. package/src/reminders/ReminderManager.ts +68 -41
  259. package/src/reminders/ReminderTimer.ts +7 -6
  260. package/src/search/BaseSearchSource.ts +133 -40
  261. package/src/search/ChannelMemberSearchSource.ts +27 -18
  262. package/src/search/ChannelSearchSource.ts +61 -7
  263. package/src/search/MessageSearchSource.ts +133 -28
  264. package/src/search/SearchController.ts +93 -16
  265. package/src/search/UserSearchSource.ts +27 -13
  266. package/src/search/types.ts +14 -1
  267. package/src/signing.ts +1 -315
  268. package/src/thread.ts +503 -511
  269. package/src/thread_manager.ts +339 -204
  270. package/src/token_manager.ts +12 -32
  271. package/src/types.ts +159 -780
  272. package/src/types.utility.ts +14 -0
  273. package/src/upload-utils.ts +53 -0
  274. package/src/uploadManager.ts +85 -7
  275. package/src/utils/FixedSizeQueueCache.ts +5 -0
  276. package/src/utils/WithSubscriptions.ts +1 -1
  277. package/src/utils/objectPath.ts +67 -0
  278. package/src/utils/time.ts +104 -0
  279. package/src/utils.ts +209 -157
  280. package/dist/types/base64.d.ts +0 -2
  281. package/dist/types/configuration/InstanceConfigurationService.d.ts +0 -26
  282. package/dist/types/connection.d.ts +0 -146
  283. package/dist/types/connection_fallback.d.ts +0 -42
  284. package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
  285. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
  286. package/dist/types/insights.d.ts +0 -58
  287. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  288. package/dist/types/permissions.d.ts +0 -55
  289. package/dist/types/store.d.ts +0 -125
  290. package/src/base64.ts +0 -78
  291. package/src/configuration/InstanceConfigurationService.ts +0 -73
  292. package/src/connection_fallback.ts +0 -215
  293. package/src/gen/model-decoders/decoders.ts +0 -2680
  294. package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
  295. package/src/insights.ts +0 -83
  296. package/src/pagination/utility.queryChannel.ts +0 -84
  297. package/src/permissions.ts +0 -102
  298. package/src/store.ts +0 -304
package/src/types.ts CHANGED
@@ -1,55 +1,41 @@
1
1
  import type { AxiosRequestConfig, AxiosResponse } from 'axios';
2
- import type { StableWSConnection } from './connection';
3
- import type {
4
- CustomChannelData,
5
- CustomCommandData,
6
- CustomEventTypes,
7
- } from './custom_types';
2
+ import type { CustomEventTypes } from './custom_types';
8
3
  import type { NotificationManager } from './notifications';
9
- import type { RESERVED_UPDATED_MESSAGE_FIELDS } from './constants';
4
+ import type { InstanceConfigTree } from './configuration/types';
5
+ import type { DeepPartial } from './types.utility';
10
6
  import type {
11
7
  APIError,
12
8
  Attachment,
13
- AutomodDetailsResponse,
9
+ BanRequest,
14
10
  ChannelConfigWithInfo,
15
- ChannelInput,
16
- ChannelMemberResponse,
17
- ChannelMute,
18
11
  ChannelOwnCapability,
19
- ChannelResponse,
20
12
  ChannelStateResponseFields,
21
13
  CreateDeviceRequest,
14
+ CreatePollRequest,
22
15
  DraftPayloadResponse,
16
+ FlagRequest,
23
17
  Images,
24
18
  MessageResponse,
25
- ModerationPayload,
26
19
  OwnUserResponse,
27
- PollResponseData,
28
- PollVoteResponseData,
29
- PrivacySettingsResponse,
30
- PushPreferencesResponse,
31
20
  QueryChannelsRequest,
32
- QueryFilters,
33
21
  QueryMembersPayload,
22
+ QueryPollsRequest,
23
+ QueryPollVotesRequest,
24
+ QueryReactionsRequest,
25
+ QueryRemindersRequest,
34
26
  QueryThreadsRequest,
35
27
  QueryUsersPayload,
36
28
  ReactionResponse,
37
- ReminderResponseData,
38
- RequireAtLeastOne,
39
29
  SearchPayload,
40
- SearchWarning,
41
30
  SendMessageRequest,
42
31
  SendMessageResponse,
43
- SharedLocation,
44
32
  SharedLocationResponseData,
45
- SortParamRequest,
33
+ TimestampNS,
46
34
  TranslateMessageRequest,
47
35
  UpdateChannelRequest,
48
36
  UpdateMessageRequest,
49
37
  UpdateMessageResponse,
50
- UpdatePollOptionRequest,
51
38
  UpdatePollRequest,
52
- UserMuteResponse,
53
39
  UserResponse,
54
40
  WSEvent,
55
41
  } from './gen/models';
@@ -64,207 +50,66 @@ export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
64
50
  [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
65
51
  }[Keys];
66
52
 
67
- export type UR = Record<string, unknown>;
68
-
69
- export type Unpacked<T> = T extends (infer U)[]
70
- ? U
71
- : T extends (...args: any[]) => infer U
72
- ? U
73
- : T extends Promise<infer U>
74
- ? U
75
- : T;
53
+ export type RequireAtLeastOne<T> = {
54
+ [K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
55
+ }[keyof T];
76
56
 
77
57
  /**
78
58
  * Response Types
79
59
  */
80
60
 
61
+ /**
62
+ * Legacy response envelope. Every generated response already carries `duration`, and the
63
+ * transport wraps results in `StreamResponse<T>`, which also carries `metadata`.
64
+ *
65
+ * Only still referenced by the hand-written `/moderation/*` methods on `StreamChat` that
66
+ * bypass the generated client. Delete this together with those.
67
+ */
81
68
  export type APIResponse = {
82
69
  duration: string;
83
70
  };
84
71
 
85
- export type FlagDetails = {
86
- automod?: AutomodDetailsResponse;
87
- };
88
-
89
- export type Flag = {
90
- created_at: string;
91
- created_by_automod: boolean;
92
- updated_at: string;
93
- details?: FlagDetails;
94
- target_message?: MessageResponse;
95
- target_user?: UserResponse;
96
- user?: UserResponse;
97
- };
98
-
99
- export type ChannelUpdateOptions = Omit<UpdateChannelRequest, 'message' | 'members'>;
72
+ export type ChannelUpdateOptions = Omit<UpdateChannelRequest, 'message'>;
100
73
 
101
74
  export type ConnectAPIResponse = Promise<void | ConnectionOpen>;
102
75
 
103
- export type FlagMessageResponse = APIResponse & {
104
- flag: {
105
- created_at: string;
106
- created_by_automod: boolean;
107
- target_message_id: string;
108
- updated_at: string;
109
- user: UserResponse;
110
- approved_at?: string;
111
- channel_cid?: string;
112
- details?: object; // Any JSON
113
- message_user_id?: string;
114
- rejected_at?: string;
115
- reviewed_at?: string;
116
- reviewed_by?: string;
117
- };
118
- review_queue_item_id?: string;
119
- };
120
-
121
- export type FlagUserResponse = APIResponse & {
122
- flag: {
123
- created_at: string;
124
- created_by_automod: boolean;
125
- target_user: UserResponse;
126
- updated_at: string;
127
- user: UserResponse;
128
- approved_at?: string;
129
- details?: object; // Any JSON
130
- rejected_at?: string;
131
- reviewed_at?: string;
132
- reviewed_by?: string;
133
- };
134
- review_queue_item_id?: string;
135
- };
136
-
137
76
  export type LocalMessage = MessageResponse & {
138
77
  status: string;
139
78
  error?: StreamAPIError;
140
79
  user_id?: string;
141
80
  };
142
81
 
143
- // TODO: Figure out a way to strongly type set and unset.
144
- export type PartialThreadUpdate = {
145
- set?: Partial<Record<string, unknown>>;
146
- unset?: Array<string>;
147
- };
148
-
149
- export type GetThreadOptions = Omit<Parameters<ChatApi['getThread']>[0], 'message_id'>;
82
+ export type GetThreadOptions = NonNullable<Parameters<ChatApi['getThread']>[1]>;
150
83
 
151
- export enum Product {
152
- Chat = 'chat',
153
- Video = 'video',
154
- Moderation = 'moderation',
155
- Feeds = 'feeds',
156
- }
157
-
158
- export type GetRepliesAPIResponse = APIResponse & {
159
- messages: MessageResponse[];
160
- };
161
-
162
- export type MuteUserResponse = APIResponse & {
163
- mute?: UserMuteResponse;
164
- mutes?: Array<UserMuteResponse>;
165
- own_user?: OwnUserResponse;
166
- non_existing_users?: string[];
167
- };
168
-
169
- export type UnmuteUserResponse = APIResponse & {
170
- non_existing_users?: string[];
171
- };
172
-
173
- export type OwnUserBase = {
174
- channel_mutes: ChannelMute[];
175
- devices: Device[];
176
- mutes: UserMuteResponse[];
177
- total_unread_count: number;
178
- unread_channels: number;
179
- unread_count: number;
180
- unread_threads: number;
181
- invisible?: boolean;
182
- privacy_settings?: PrivacySettingsResponse;
183
- push_preferences?: PushPreferencesResponse;
184
- roles?: string[];
185
- total_unread_count_by_team?: Record<string, number> | null;
186
- };
187
-
188
- export type ReactionAPIResponse = APIResponse & {
189
- message: MessageResponse;
190
- reaction: ReactionResponse;
191
- };
192
-
193
- export type SearchAPIResponse = APIResponse & {
194
- results: {
195
- message: MessageResponse;
196
- }[];
197
- next?: string;
198
- previous?: string;
199
- results_warning?: SearchWarning | null;
200
- };
84
+ /**
85
+ * The fields that exist on the connected user (`OwnUserResponse`) but not on a plain
86
+ * `UserResponse` — i.e. the own-user-only slice of the user object.
87
+ *
88
+ * Derived, never hand-listed: `client._handleUserEvent` uses this set (through
89
+ * `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event, so a field
90
+ * missing from it is silently deleted off `client.user`. Deriving it means a spec change
91
+ * cannot desynchronise the two.
92
+ */
93
+ export type OwnUserBase = Pick<
94
+ OwnUserResponse,
95
+ Exclude<keyof OwnUserResponse, keyof UserResponse>
96
+ >;
201
97
 
202
98
  // Thumb URL(thumb_url) is added considering video attachments as the backend will return the thumbnail in the response.
203
- export type SendFileAPIResponse = APIResponse & { file: string; thumb_url?: string };
204
-
205
- export type UpdateChannelAPIResponse = APIResponse & {
206
- channel: ChannelResponse;
207
- members: ChannelMemberResponse[];
208
- message?: MessageResponse;
209
- };
210
-
211
- export type UsersAPIResponse = APIResponse & {
212
- users: Array<UserResponse>;
213
- membership_deletion_task_id?: string;
214
- };
215
-
216
- export type BanUserOptions = UnBanUserOptions & {
217
- ban_from_future_channels?: boolean;
218
- banned_by?: UserResponse;
219
- banned_by_id?: string;
220
- ip_ban?: boolean;
221
- reason?: string;
222
- timeout?: number;
223
- delete_messages?: MessageDeletionStrategy;
224
- delete_reactions?: boolean;
225
- };
99
+ export type BanUserOptions = Omit<BanRequest, 'target_user_id'>;
226
100
 
227
- export type ChannelOptions = {
228
- limit?: number;
229
- member_limit?: number;
230
- message_limit?: number;
231
- offset?: number;
232
- presence?: boolean;
233
- state?: boolean;
234
- user_id?: string;
235
- watch?: boolean;
236
- /**
237
- * Name of a predefined filter to use instead of sending raw
238
- * `filter_conditions`.
239
- *
240
- * The backend resolves the filter template by name and interpolates it using
241
- * `filter_values`.
242
- *
243
- * A regular `sort` can still be passed to `queryChannels()`, but backend
244
- * precedence rules apply:
245
- *
246
- * - if the predefined filter has its own stored sort template, that stored
247
- * sort takes precedence and the request `sort` is ignored
248
- * - if the predefined filter does not define a sort template, the request
249
- * `sort` can still be used
250
- */
251
- predefined_filter?: string;
252
- /**
253
- * Values used to interpolate placeholders inside the predefined filter's
254
- * `filter` template.
255
- *
256
- * Example: a template value like `{{user_id}}` can be resolved with
257
- * `{ user_id: 'alice' }`.
258
- *
259
- * Only used when `predefined_filter` is provided.
260
- */
261
- filter_values?: Record<string, unknown>;
262
- /**
263
- * Values to interpolate into the predefined filter sort template placeholders.
264
- * Only used when predefined_filter is provided.
265
- */
266
- sort_values?: Record<string, unknown>;
267
- };
101
+ /**
102
+ * Everything `queryChannels()` accepts apart from the filter and the sort.
103
+ *
104
+ * Derived from the generated request so new query options appear here automatically.
105
+ *
106
+ * On `predefined_filter`: the backend resolves the named filter template and interpolates it
107
+ * with `filter_values`. A regular `sort` can still be passed, but backend precedence applies —
108
+ * if the predefined filter has its own stored sort template that template wins and the request
109
+ * `sort` is ignored; if it does not, the request `sort` is used. `sort_values` interpolates the
110
+ * stored sort template's placeholders. All three are only read when `predefined_filter` is set.
111
+ */
112
+ export type ChannelOptions = Omit<QueryChannelsRequest, 'filter_conditions' | 'sort'>;
268
113
 
269
114
  export type ChannelStateOptions = {
270
115
  offlineMode?: boolean;
@@ -281,76 +126,16 @@ export type ChannelStateOptions = {
281
126
  withResponse?: boolean;
282
127
  };
283
128
 
284
- export type PolicyRequest = {
285
- action: 'Deny' | 'Allow' | (string & {});
286
- /**
287
- * @description User-friendly policy name
288
- */
289
- name: string;
290
- /**
291
- * @description Whether policy applies to resource owner or not
292
- */
293
- owner: boolean;
294
- priority: number;
295
- /**
296
- * @description List of resources to apply policy to
297
- */
298
- resources: string[];
299
- /**
300
- * @description List of roles to apply policy to
301
- */
302
- roles: string[];
303
- };
304
-
305
- export type Automod = 'disabled' | 'simple' | 'AI' | (string & {});
306
- export type AutomodBehavior = 'flag' | 'block' | 'shadow_block' | (string & {});
129
+ /** The channel-type automod mode, as reported by `channel.getConfig()`. */
130
+ export type Automod = ChannelConfigWithInfo['automod'];
131
+ /** What automod does when it trips, as reported by `channel.getConfig()`. */
132
+ export type AutomodBehavior = ChannelConfigWithInfo['automod_behavior'];
307
133
 
308
- export type MuteUserOptions = {
309
- client_id?: string;
310
- connection_id?: string;
311
- id?: string;
312
- reason?: string;
313
- target_user_id?: string;
314
- timeout?: number;
315
- type?: string;
316
- user?: UserResponse;
317
- user_id?: string;
318
- };
319
-
320
- export type PaginationOptions = {
321
- created_at_after?: string | Date;
322
- created_at_after_or_equal?: string | Date;
323
- created_at_before?: string | Date;
324
- created_at_before_or_equal?: string | Date;
325
- id_gt?: string;
326
- id_gte?: string;
327
- id_lt?: string;
328
- id_lte?: string;
329
- limit?: number;
330
- offset?: number; // should be avoided with channel.query()
331
- };
332
-
333
- export type MessagePaginationOptions = PaginationOptions & {
334
- created_at_around?: string | Date;
335
- id_around?: string;
336
- };
337
-
338
- export type PinnedMessagePaginationOptions = {
339
- id_around?: string;
340
- id_gt?: string;
341
- id_gte?: string;
342
- id_lt?: string;
343
- id_lte?: string;
344
- limit?: number;
345
- offset?: number;
346
- pinned_at_after?: string | Date;
347
- pinned_at_after_or_equal?: string | Date;
348
- pinned_at_around?: string | Date;
349
- pinned_at_before?: string | Date;
350
- pinned_at_before_or_equal?: string | Date;
351
- };
134
+ export type PinnedMessagePaginationOptions = Omit<
135
+ NonNullable<Parameters<ChatApi['getPinnedMessages']>[1]>,
136
+ 'sort'
137
+ >;
352
138
 
353
- export type GetRepliesRequest = Parameters<ChatApi['getReplies']>[0];
354
139
  export type QueryMembersOptions = Partial<Omit<QueryMembersPayload, 'filter_conditions'>>;
355
140
 
356
141
  export type StreamChatOptions = {
@@ -365,31 +150,21 @@ export type StreamChatOptions = {
365
150
  */
366
151
  baseURL?: string;
367
152
  browser?: boolean;
368
- device?: BaseDeviceFields;
369
- /**
370
- * Disables the hydration of all caches within the JS Client. This includes this.activeChannels,
371
- * this.polls.pollCache and this.config.
372
- * It is mainly meant to be used for integrations where stream-chat is used as a server-side service
373
- * interacting with Stream's REST API, not depending on any state and purely serving as a wrapper
374
- * around HTTP requests. Using this property on either the client side or a backend implementation
375
- * that also relies on WS events will break these functionalities, so please use carefully.
376
- */
377
- disableCache?: boolean;
378
- enableInsights?: boolean;
379
- /**
380
- * When true, maintains a client-local unread count on channels that have read events disabled
381
- * (e.g. livestreams). The count increments on incoming messages and is reset via
382
- * `channel.markReadLocally()`. It is never sent to the backend, but is persisted to the offline DB.
383
- */
384
- isLocalUnreadCountEnabled?: boolean;
385
- /** experimental feature, please contact support if you want this feature enabled for you */
386
- enableWSFallback?: boolean;
387
153
  /**
388
154
  * Custom notification manager service to use for the client.
389
155
  * If not provided, a default notification manager will be created.
390
156
  * Notifications are used to communicate events like errors, warnings, info, etc. Other services can publish notifications or subscribe to the NotificationManager state changes.
391
157
  */
392
158
  notifications?: NotificationManager;
159
+ /**
160
+ * Declarative configuration for instances the SDK creates on your behalf, seeded before the client's
161
+ * own managers are constructed.
162
+ *
163
+ * Equivalent to calling `client.config.set(tree)` immediately after construction, except for the
164
+ * `client` subtree — the configuration registry is created inside the constructor, so this is the only
165
+ * way to configure `reminders` / `notifications` before they are built.
166
+ */
167
+ config?: DeepPartial<InstanceConfigTree>;
393
168
  /**
394
169
  * When true, user will be persisted on client. Otherwise if `connectUser` call fails, then you need to
395
170
  * call `connectUser` again to retry.
@@ -397,27 +172,6 @@ export type StreamChatOptions = {
397
172
  * persist even if connectUser call fails.
398
173
  */
399
174
  persistUserOnConnectionFailure?: boolean;
400
- /**
401
- * When network is recovered, we re-query the active channels on client. But in single query, you can recover
402
- * only 30 channels. So its not guaranteed that all the channels in activeChannels object have updated state.
403
- * Thus in UI sdks, state recovery is managed by components themselves, they don't rely on js client for this.
404
- *
405
- * `recoverStateOnReconnect` parameter can be used in such cases, to disable state recovery within js client.
406
- * When false, user/consumer of this client will need to make sure all the channels present on UI by
407
- * manually calling queryChannels endpoint.
408
- */
409
- recoverStateOnReconnect?: boolean;
410
- warmUp?: boolean;
411
- /**
412
- * Sets the instance of `StableWSConnection` on the chat client. Intended purely for testing and
413
- * should not be used in production apps.
414
- */
415
- wsConnection?: StableWSConnection;
416
- /**
417
- * Sets a suffix to the wsUrl when it is being built in `wsConnection`. Is meant to be
418
- * used purely in testing suites and should not be used in production apps.
419
- */
420
- wsUrlParams?: URLSearchParams;
421
175
  };
422
176
 
423
177
  export type UnBanUserOptions = {
@@ -430,12 +184,19 @@ export type UnBanUserOptions = {
430
184
  type?: string;
431
185
  };
432
186
 
433
- export type UserOptions = {
434
- include_deactivated_users?: boolean;
435
- limit?: number;
436
- offset?: number;
437
- presence?: boolean;
438
- };
187
+ /** Everything `queryUsers()` accepts apart from the filter and the sort. */
188
+ export type UserOptions = Omit<QueryUsersPayload, 'filter_conditions' | 'sort'>;
189
+
190
+ /**
191
+ * Which of the two connections a status refers to, and so which store it came from.
192
+ *
193
+ * `'network'` is the device's own network status, reported by the platform reporter installed on
194
+ * `client.networkConnection`. `'ws'` is this client's WebSocket. They are different facts and routinely
195
+ * disagree: a socket dies on a working network (server close, expired token, health-check timeout),
196
+ * and a device goes offline while the socket has not noticed yet — which is why each has its own
197
+ * store and neither is derived from the other.
198
+ */
199
+ export type ConnectionType = 'network' | 'ws';
439
200
 
440
201
  type LocalEvent = (
441
202
  | ({ type: 'live_location_sharing.started' } & { message: MessageResponse })
@@ -448,9 +209,9 @@ type LocalEvent = (
448
209
  isLatestMessageSet: boolean;
449
210
  };
450
211
  })
451
- | ({ type: 'transport.changed' } & { mode: string })
452
- | ({ type: 'connection.changed' } & { online: boolean })
453
212
  | { type: 'connection.recovered' }
213
+ // `enableWSFallback` switched from the WebSocket to long-polling.
214
+ | ({ type: 'connection.fallback_activated' } & { mode: string })
454
215
  | ({ type: 'offline_reactions.queried' } & {
455
216
  offlineReactions: ReactionResponse[];
456
217
  })
@@ -461,15 +222,19 @@ type LocalEvent = (
461
222
  | ({ type: 'message.read_locally' } & {
462
223
  channel_type: string;
463
224
  cid: string;
464
- created_at: Date;
225
+ created_at: TimestampNS;
465
226
  channel_id?: string;
466
227
  last_read_message_id?: string;
467
228
  team?: string;
468
229
  user?: UserResponse;
469
230
  })
470
- ) & { received_at?: Date };
231
+ ) & { received_at?: TimestampNS };
471
232
 
472
- export type Event = WSEvent | LocalEvent | keyof CustomEventTypes;
233
+ // Two WS events miss `received_at` in API spec, so we add it to typedef here
234
+ export type Event =
235
+ | (WSEvent & { received_at?: TimestampNS })
236
+ | LocalEvent
237
+ | keyof CustomEventTypes;
473
238
  export type EventType = Event['type'] | 'all';
474
239
 
475
240
  export type EventHandler<T = string> = (event: Extract<Event, { type: T }>) => void;
@@ -478,336 +243,44 @@ export type EventHandler<T = string> = (event: Extract<Event, { type: T }>) => v
478
243
  * Filter Types
479
244
  */
480
245
 
481
- export type ReactionFilters = NonNullable<QueryReactionsRequestWithId['filter']>;
482
-
483
- export type QueryReactionsRequestWithId = Parameters<ChatApi['queryReactions']>[0];
246
+ export type ReactionFilters = NonNullable<QueryReactionsRequest['filter']>;
484
247
 
485
248
  export type ChannelFilters = NonNullable<QueryChannelsRequest['filter_conditions']>;
486
249
 
487
- export type QueryPollsOptions = Pager;
250
+ export type QueryPollsOptions = Omit<QueryPollsRequest, 'filter' | 'sort'>;
488
251
 
489
- export type VotesFiltersOptions = {
490
- is_answer?: boolean;
491
- option_id?: string;
492
- user_id?: string;
493
- };
252
+ export type QueryVotesOptions = Omit<QueryPollVotesRequest, 'filter' | 'sort'>;
494
253
 
495
- export type QueryVotesOptions = Pager;
254
+ export type QueryPollsFilters = NonNullable<QueryPollsRequest['filter']>;
496
255
 
497
- export type QueryPollsFilters = QueryFilters<
498
- {
499
- id?:
500
- | RequireOnlyOne<Pick<QueryFilter<PollResponse_old['id']>, '$eq' | '$in'>>
501
- | PrimitiveFilter<PollResponse_old['id']>;
502
- } & {
503
- user_id?:
504
- | RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['user_id']>, '$eq' | '$in'>>
505
- | PrimitiveFilter<VotesFiltersOptions['user_id']>;
506
- } & {
507
- is_closed?:
508
- | RequireOnlyOne<Pick<QueryFilter<PollResponse_old['is_closed']>, '$eq'>>
509
- | PrimitiveFilter<PollResponse_old['is_closed']>;
510
- } & {
511
- max_votes_allowed?:
512
- | RequireOnlyOne<
513
- Pick<
514
- QueryFilter<PollResponse_old['max_votes_allowed']>,
515
- '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
516
- >
517
- >
518
- | PrimitiveFilter<PollResponse_old['max_votes_allowed']>;
519
- } & {
520
- allow_answers?:
521
- | RequireOnlyOne<Pick<QueryFilter<PollResponse_old['allow_answers']>, '$eq'>>
522
- | PrimitiveFilter<PollResponse_old['allow_answers']>;
523
- } & {
524
- allow_user_suggested_options?:
525
- | RequireOnlyOne<
526
- Pick<QueryFilter<PollResponse_old['allow_user_suggested_options']>, '$eq'>
527
- >
528
- | PrimitiveFilter<PollResponse_old['allow_user_suggested_options']>;
529
- } & {
530
- voting_visibility?:
531
- | RequireOnlyOne<Pick<QueryFilter<PollResponse_old['voting_visibility']>, '$eq'>>
532
- | PrimitiveFilter<PollResponse_old['voting_visibility']>;
533
- } & {
534
- created_at?:
535
- | RequireOnlyOne<
536
- Pick<
537
- QueryFilter<PollResponse_old['created_at']>,
538
- '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
539
- >
540
- >
541
- | PrimitiveFilter<PollResponse_old['created_at']>;
542
- } & {
543
- created_by_id?:
544
- | RequireOnlyOne<
545
- Pick<QueryFilter<PollResponse_old['created_by_id']>, '$eq' | '$in'>
546
- >
547
- | PrimitiveFilter<PollResponse_old['created_by_id']>;
548
- } & {
549
- updated_at?:
550
- | RequireOnlyOne<
551
- Pick<
552
- QueryFilter<PollResponse_old['updated_at']>,
553
- '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
554
- >
555
- >
556
- | PrimitiveFilter<PollResponse_old['updated_at']>;
557
- } & {
558
- name?:
559
- | RequireOnlyOne<Pick<QueryFilter<PollResponse_old['name']>, '$eq' | '$in'>>
560
- | PrimitiveFilter<PollResponse_old['name']>;
561
- }
562
- >;
563
-
564
- export type QueryVotesFilters = QueryFilters<
565
- {
566
- id?:
567
- | RequireOnlyOne<Pick<QueryFilter<PollResponse_old['id']>, '$eq' | '$in'>>
568
- | PrimitiveFilter<PollResponse_old['id']>;
569
- } & {
570
- option_id?:
571
- | RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['option_id']>, '$eq' | '$in'>>
572
- | PrimitiveFilter<VotesFiltersOptions['option_id']>;
573
- } & {
574
- is_answer?:
575
- | RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['is_answer']>, '$eq'>>
576
- | PrimitiveFilter<VotesFiltersOptions['is_answer']>;
577
- } & {
578
- user_id?:
579
- | RequireOnlyOne<Pick<QueryFilter<VotesFiltersOptions['user_id']>, '$eq' | '$in'>>
580
- | PrimitiveFilter<VotesFiltersOptions['user_id']>;
581
- } & {
582
- created_at?:
583
- | RequireOnlyOne<
584
- Pick<
585
- QueryFilter<PollResponse_old['created_at']>,
586
- '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
587
- >
588
- >
589
- | PrimitiveFilter<PollResponse_old['created_at']>;
590
- } & {
591
- created_by_id?:
592
- | RequireOnlyOne<
593
- Pick<QueryFilter<PollResponse_old['created_by_id']>, '$eq' | '$in'>
594
- >
595
- | PrimitiveFilter<PollResponse_old['created_by_id']>;
596
- } & {
597
- updated_at?:
598
- | RequireOnlyOne<
599
- Pick<
600
- QueryFilter<PollResponse_old['updated_at']>,
601
- '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
602
- >
603
- >
604
- | PrimitiveFilter<PollResponse_old['updated_at']>;
605
- }
606
- >;
256
+ export type QueryVotesFilters = NonNullable<QueryPollVotesRequest['filter']>;
607
257
 
608
258
  export type MessageFilters = NonNullable<SearchPayload['message_filter_conditions']>;
609
259
 
610
- export type PrimitiveFilter<ObjectType> = ObjectType | null;
611
-
612
- export type QueryFilter<ObjectType = string> =
613
- NonNullable<ObjectType> extends string | number | boolean | Date
614
- ? {
615
- $eq?: PrimitiveFilter<ObjectType>;
616
- $exists?: boolean;
617
- $gt?: PrimitiveFilter<ObjectType>;
618
- $gte?: PrimitiveFilter<ObjectType>;
619
- $in?: PrimitiveFilter<ObjectType>[];
620
- $lt?: PrimitiveFilter<ObjectType>;
621
- $lte?: PrimitiveFilter<ObjectType>;
622
- }
623
- : {
624
- $eq?: PrimitiveFilter<ObjectType>;
625
- $exists?: boolean;
626
- $in?: PrimitiveFilter<Unpacked<ObjectType>>[];
627
- };
628
-
629
260
  export type UserFilters = QueryUsersPayload['filter_conditions'];
630
261
 
631
262
  export type MemberFilters = QueryMembersPayload['filter_conditions'];
632
263
 
633
- /**
634
- * Sort Types
635
- */
636
-
637
- export type BannedUsersSort = SortParamRequest[];
638
-
639
- export type ReactionSort = SortParamRequest[];
640
-
641
- export type ChannelSort = SortParamRequest[];
642
-
643
- export type PinnedMessagesSort = SortParamRequest[];
644
-
645
- export type UserSort = SortParamRequest[];
646
-
647
- export type MemberSort = SortParamRequest[];
648
-
649
- export type SearchMessageSort = SortParamRequest[];
650
-
651
- export type DraftSort = SortParamRequest[];
652
-
653
- export type PollSort = SortParamRequest[];
654
-
655
- export type VoteSort = SortParamRequest[];
656
-
657
- /**
658
- * Base Types
659
- */
660
-
661
- export type APNConfig = {
662
- auth_key?: string;
663
- auth_type?: string;
664
- bundle_id?: string;
665
- development?: boolean;
666
- enabled?: boolean;
667
- host?: string;
668
- key_id?: string;
669
- notification_template?: string;
670
- p12_cert?: string;
671
- team_id?: string;
672
- };
673
-
674
- export type AsyncModerationOptions = {
675
- callback?: {
676
- mode?: 'CALLBACK_MODE_NONE' | 'CALLBACK_MODE_REST' | 'CALLBACK_MODE_TWIRP';
677
- server_url?: string;
678
- };
679
- timeout_ms?: number;
680
- };
681
-
682
- // export type Attachment = ReplacePropertyTypes<
683
- // Attachment,
684
- // { custom: CustomAttachmentData & { file_size?: number; mime_type?: string } }
685
- // >;
686
-
687
264
  export type OGAttachment = RequireLiteral<Attachment, 'og_scrape_url'>;
688
265
 
689
- export type BlockList = {
690
- name: string;
691
- words: string[];
692
- team?: string;
693
- type?: string;
694
- validate?: boolean;
695
- is_confusable_folding_enabled?: boolean;
696
- is_leet_check_enabled?: boolean;
697
- is_plural_check_enabled?: boolean;
698
- };
699
-
700
- export type ChannelData = ReplacePropertyTypes<
701
- ChannelInput,
702
- { custom: CustomChannelData }
703
- >;
704
-
705
266
  export type PushProvider = CreateDeviceRequest['push_provider'];
706
267
 
707
- export type PushProviderConfig = PushProviderCommon &
708
- PushProviderID &
709
- PushProviderAPN &
710
- PushProviderFirebase &
711
- PushProviderHuawei &
712
- PushProviderXiaomi;
713
-
714
- export type PushProviderID = {
715
- name: string;
716
- type: PushProvider;
717
- };
718
-
719
- export type PushProviderCommon = {
720
- created_at: string;
721
- updated_at: string;
722
- description?: string;
723
- disabled_at?: string;
724
- disabled_reason?: string;
725
- };
726
-
727
- export type PushProviderAPN = {
728
- apn_auth_key?: string;
729
- apn_auth_type?: 'token' | 'certificate';
730
- apn_development?: boolean;
731
- apn_host?: string;
732
- apn_key_id?: string;
733
- apn_notification_template?: string;
734
- apn_p12_cert?: string;
735
- apn_team_id?: string;
736
- apn_topic?: string;
737
- };
738
-
739
- export type PushProviderFirebase = {
740
- firebase_apn_template?: string;
741
- firebase_credentials?: string;
742
- firebase_data_template?: string;
743
- firebase_notification_template?: string;
744
- firebase_server_key?: string;
745
- };
746
-
747
- export type PushProviderHuawei = {
748
- huawei_app_id?: string;
749
- huawei_app_secret?: string;
750
- };
751
-
752
- export type PushProviderXiaomi = {
753
- xiaomi_package_name?: string;
754
- xiaomi_secret?: string;
755
- };
756
-
757
- export type CommandVariants =
758
- | 'all'
759
- | 'ban'
760
- | 'fun_set'
761
- | 'giphy'
762
- | 'moderation_set'
763
- | 'mute'
764
- | 'unban'
765
- | 'unmute'
766
- | keyof CustomCommandData;
767
-
268
+ /**
269
+ * Server-provided channel configuration, keyed by **cid** (`messaging:general`, …). Most of
270
+ * `ChannelConfigWithInfo` is a type-level setting, but a channel's `config_overrides` can narrow it for
271
+ * that channel alone, so the effective answer is per channel. Read it via `channel.serverConfig`.
272
+ */
768
273
  export type Configs = Record<string, ChannelConfigWithInfo | undefined>;
769
274
 
770
- export type ConnectionOpen = EventPayload<'health.check'>;
771
-
772
- export type Device = DeviceFields & {
773
- provider?: string;
774
- user?: UserResponse;
775
- user_id?: string;
776
- };
777
-
778
- export type BaseDeviceFields = {
779
- id: string;
780
- push_provider: PushProvider;
781
- push_provider_name?: string;
782
- };
783
-
784
- export type DeviceFields = BaseDeviceFields & {
785
- created_at: string;
786
- disabled?: boolean;
787
- disabled_reason?: string;
788
- };
789
-
790
- export type FirebaseConfig = {
791
- apn_template?: string;
792
- credentials_json?: string;
793
- data_template?: string;
794
- enabled?: boolean;
795
- notification_template?: string;
796
- server_key?: string;
797
- };
798
-
799
- export type HuaweiConfig = {
800
- enabled?: boolean;
801
- id?: string;
802
- secret?: string;
803
- };
804
-
805
- export type XiaomiConfig = {
806
- enabled?: boolean;
807
- package_name?: string;
808
- secret?: string;
809
- };
275
+ export type ConnectionOpen = EventPayload<'health.check'> | EventPayload<'connection.ok'>;
810
276
 
277
+ /**
278
+ * The message `type` values the server can return.
279
+ *
280
+ * Hand-written because there is no generated equivalent: `MessageResponse['type']` is a bare
281
+ * `string`, so deriving it would widen rather than narrow. Both the React and React Native
282
+ * SDKs use this as a discriminant (RN types its SQLite message rows with it).
283
+ */
811
284
  export type MessageLabel =
812
285
  | 'deleted'
813
286
  | 'ephemeral'
@@ -818,54 +291,10 @@ export type MessageLabel =
818
291
 
819
292
  export type SendMessageOptions = Omit<SendMessageRequest, 'message'>;
820
293
 
821
- export type PermissionObject = {
822
- action?: 'Deny' | 'Allow';
823
- name?: string;
824
- owner?: boolean;
825
- priority?: number;
826
- resources?: string[];
827
- roles?: string[];
828
- };
829
-
830
- export type Policy = {
831
- action?: 0 | 1;
832
- created_at?: string;
833
- name?: string;
834
- owner?: boolean;
835
- priority?: number;
836
- resources?: string[];
837
- roles?: string[] | null;
838
- updated_at?: string;
839
- };
840
-
841
294
  export type TokenOrProvider = null | string | TokenProvider | undefined;
842
295
 
843
296
  export type TokenProvider = () => Promise<string>;
844
297
 
845
- export type ReservedUpdatedMessageFields = keyof typeof RESERVED_UPDATED_MESSAGE_FIELDS;
846
-
847
- export type UpdatedMessage = Omit<
848
- MessageResponse,
849
- ReservedUpdatedMessageFields | 'mentioned_groups'
850
- > & {
851
- mentioned_users?: string[];
852
- mentioned_channel?: boolean;
853
- mentioned_here?: boolean;
854
- mentioned_group_ids?: string[];
855
- mentioned_roles?: string[];
856
- type?: MessageLabel;
857
- };
858
-
859
- export type TaskResponse = {
860
- task_id: string;
861
- };
862
-
863
- export type Pager = {
864
- limit?: number;
865
- next?: string;
866
- prev?: string;
867
- };
868
-
869
298
  export type MessageSetType = 'latest' | 'current' | 'new';
870
299
 
871
300
  export class StreamAPIError<T = APIError> extends Error {
@@ -934,47 +363,43 @@ export class StreamAPIError<T = APIError> extends Error {
934
363
  }
935
364
  }
936
365
 
937
- export type PollResponse_old = PollResponseData & PollEnrichData;
938
-
939
- export enum VotingVisibility {
940
- anonymous = 'anonymous',
941
- public = 'public',
942
- }
943
-
944
- export type PollEnrichData = {
945
- answers_count: number;
946
- latest_answers: PollVoteResponseData[]; // not updated with WS events, ordered DESC by created_at, seems like updated_at cannot be different from created_at
947
- latest_votes_by_option: Record<string, PollVoteResponseData[]>; // not updated with WS events; always null in anonymous polls
948
- vote_count: number;
949
- vote_counts_by_option: Record<string, number>;
950
- own_votes?: PollVoteResponseData[]; // not updated with WS events
951
- };
366
+ /**
367
+ * Poll vote visibility. Derived from the generated request shape so it tracks the spec.
368
+ */
369
+ export type VotingVisibility = NonNullable<CreatePollRequest['voting_visibility']>;
952
370
 
953
371
  export type PartialPollUpdate = {
954
372
  set?: Partial<UpdatePollRequest>;
955
373
  unset?: Array<keyof UpdatePollRequest>;
956
374
  };
957
375
 
958
- export type PollOptionData = UpdatePollOptionRequest & {
959
- position?: number;
960
- };
961
-
962
- export type MessageDeletionStrategy = 'soft' | 'hard' | 'pruning';
963
- // @deprecated use type MessageDeletionStrategy instead
964
-
965
- export type ModerationFlagOptions = {
966
- custom?: Record<string, unknown>;
967
- moderation_payload?: ModerationPayload;
968
- user_id?: string;
969
- };
376
+ /**
377
+ * Options accepted by `moderation.flagUser` / `moderation.flagMessage` on top of the
378
+ * entity they resolve and the `reason` they take positionally.
379
+ */
380
+ export type ModerationFlagOptions = Omit<
381
+ FlagRequest,
382
+ 'entity_id' | 'entity_type' | 'reason'
383
+ >;
970
384
 
971
385
  export type AIState =
386
+ | 'AI_STATE_IDLE'
972
387
  | 'AI_STATE_ERROR'
973
- | 'AI_STATE_CHECKING_SOURCES'
388
+ | 'AI_STATE_EXTERNAL_SOURCES'
974
389
  | 'AI_STATE_THINKING'
975
390
  | 'AI_STATE_GENERATING'
391
+ | 'AI_STATE_STOP'
976
392
  | (string & {});
977
393
 
394
+ export const AIStates = {
395
+ Error: 'AI_STATE_ERROR',
396
+ ExternalSources: 'AI_STATE_EXTERNAL_SOURCES',
397
+ Generating: 'AI_STATE_GENERATING',
398
+ Idle: 'AI_STATE_IDLE',
399
+ Stop: 'AI_STATE_STOP',
400
+ Thinking: 'AI_STATE_THINKING',
401
+ } as const satisfies Record<string, AIState>;
402
+
978
403
  /**
979
404
  * An identifier containing information about the downstream SDK using stream-chat. It
980
405
  * is used to resolve the user agent.
@@ -1016,45 +441,9 @@ export type SharedLiveLocationResponse = RequireLiteral<
1016
441
  'end_at'
1017
442
  >;
1018
443
 
1019
- export type LiveLocationPayload = RequireLiteral<SharedLocation, 'end_at'>;
1020
-
1021
- export type ThreadSort = SortParamRequest[];
1022
-
1023
444
  export type ThreadFilters = NonNullable<QueryThreadsRequest['filter']>;
1024
445
 
1025
- export type CreateReminderOptions = Parameters<ChatApi['createReminder']>[0];
1026
-
1027
- export type ReminderFilters = QueryFilters<{
1028
- channel_cid?:
1029
- | RequireOnlyOne<
1030
- Pick<QueryFilter<ReminderResponseData['channel_cid']>, '$eq' | '$in'>
1031
- >
1032
- | PrimitiveFilter<ReminderResponseData['channel_cid']>;
1033
- created_at?:
1034
- | RequireOnlyOne<
1035
- Pick<
1036
- QueryFilter<ReminderResponseData['created_at']>,
1037
- '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
1038
- >
1039
- >
1040
- | PrimitiveFilter<ReminderResponseData['created_at']>;
1041
- message_id?:
1042
- | RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['message_id']>, '$eq' | '$in'>>
1043
- | PrimitiveFilter<ReminderResponseData['message_id']>;
1044
- remind_at?:
1045
- | RequireOnlyOne<
1046
- Pick<
1047
- QueryFilter<ReminderResponseData['remind_at']>,
1048
- '$exists' | '$eq' | '$gt' | '$lt' | '$gte' | '$lte'
1049
- >
1050
- >
1051
- | PrimitiveFilter<ReminderResponseData['remind_at']>;
1052
- user_id?:
1053
- | RequireOnlyOne<Pick<QueryFilter<ReminderResponseData['user_id']>, '$eq' | '$in'>>
1054
- | PrimitiveFilter<ReminderResponseData['user_id']>;
1055
- }>;
1056
-
1057
- export type ReminderSort = SortParamRequest[];
446
+ export type ReminderFilters = NonNullable<QueryRemindersRequest['filter']>;
1058
447
 
1059
448
  export type ListUserGroupsOptions = NonNullable<Parameters<ChatApi['listUserGroups']>[0]>;
1060
449
 
@@ -1084,58 +473,48 @@ export type EventPayload<T extends Event['type'] | (string & {})> = Extract<
1084
473
 
1085
474
  export type RequireLiteral<L, T extends keyof L> = Omit<L, T> & Required<Pick<L, T>>;
1086
475
 
1087
- export type ReplacePropertyTypes<
1088
- Base,
1089
- Replacement extends RequireAtLeastOne<Record<keyof Base, any>>,
1090
- > = keyof Replacement extends keyof Base
1091
- ? Omit<Base, keyof Replacement> & {
1092
- [K in keyof Replacement as undefined extends Base[K] ? never : K]: Replacement[K];
1093
- } & {
1094
- [K in keyof Replacement as undefined extends Base[K] ? K : never]?: Replacement[K];
1095
- }
1096
- : never;
1097
-
1098
476
  export type PartializeAllBut<T, K extends keyof T> = {
1099
477
  [P in K]-?: T[P];
1100
478
  } & { [P in Exclude<keyof T, K>]?: T[P] };
1101
479
 
1102
- export type DeleteMessageOptions = Omit<Parameters<ChatApi['deleteMessage']>[0], 'id'>;
480
+ export type DeleteMessageOptions = NonNullable<Parameters<ChatApi['deleteMessage']>[1]>;
1103
481
  export type SendMessageAPIResponse = StreamResponse<SendMessageResponse>;
1104
482
  export type UpdateMessageOptions = Omit<UpdateMessageRequest, 'message'>;
1105
483
  export type UpdateMessageAPIResponse = StreamResponse<UpdateMessageResponse>;
484
+ /**
485
+ * The Giphy rendition names, derived from the generated `Images` shape so the two cannot
486
+ * drift. Consumed by the React and React Native SDKs to pick a rendition size.
487
+ */
1106
488
  export type GiphyVersions = keyof Images;
1107
489
  export type TranslationLanguage = TranslateMessageRequest['language'];
1108
490
 
1109
- export * from './gen/models';
1110
-
1111
- export type EventAPIResponse = APIResponse & {
1112
- event: Event;
491
+ export type FileReferenceBase = {
492
+ uri: string;
493
+ type: string;
494
+ name?: string;
1113
495
  };
1114
496
 
1115
- export type PartializeKeys<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
1116
-
1117
- type ErrorResponseDetails = {
1118
- code: number;
1119
- messages: string[];
1120
- };
497
+ export type FileUploadInput = File | Blob | FileReferenceBase | string;
1121
498
 
1122
- export type APIErrorResponse = {
1123
- duration: string;
1124
- message: string;
1125
- more_info: string;
1126
- StatusCode: number;
1127
- code?: number;
1128
- details?: ErrorResponseDetails;
499
+ /**
500
+ * Structural subset of axios' `AxiosProgressEvent`, kept transport-agnostic on purpose so the
501
+ * public surface does not depend on axios.
502
+ */
503
+ export type StreamProgressEvent = {
504
+ loaded: number;
505
+ total?: number;
506
+ lengthComputable?: boolean;
507
+ progress?: number;
1129
508
  };
1130
509
 
1131
- export type DraftMessagePayload = PartializeKeys<
1132
- Omit<DraftMessage, 'mentioned_groups'>,
1133
- 'id'
1134
- > & {
1135
- user_id?: string;
510
+ export type StreamRequestOptions = {
511
+ signal?: AbortSignal;
512
+ /** Only meaningful for upload (multipart) requests; ignored everywhere else. */
513
+ onUploadProgress?: (event: StreamProgressEvent) => void;
514
+ /**
515
+ * Milliseconds before this request is aborted.
516
+ */
517
+ timeout?: number;
1136
518
  };
1137
519
 
1138
- export type QueryRemindersOptions = Pager & {
1139
- filter?: ReminderFilters;
1140
- sort?: ReminderSort;
1141
- };
520
+ export * from './gen/models';