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

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 (269) hide show
  1. package/dist/cjs/index.browser.js +2196 -3902
  2. package/dist/cjs/index.browser.js.map +3 -3
  3. package/dist/cjs/index.node.js +2197 -3902
  4. package/dist/cjs/index.node.js.map +3 -3
  5. package/dist/esm/index.mjs +2199 -3905
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/ChannelManager.d.ts +120 -233
  8. package/dist/types/CooldownTimer.d.ts +8 -23
  9. package/dist/types/EventHandlerPipeline.d.ts +17 -37
  10. package/dist/types/LiveLocationManager.d.ts +22 -50
  11. package/dist/types/api-client.d.ts +9 -14
  12. package/dist/types/channel.d.ts +253 -448
  13. package/dist/types/channel_state.d.ts +48 -95
  14. package/dist/types/client.d.ts +245 -370
  15. package/dist/types/client_state.d.ts +1 -3
  16. package/dist/types/configuration/ConfigController.d.ts +30 -124
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
  18. package/dist/types/configuration/keys.d.ts +5 -19
  19. package/dist/types/configuration/shape.d.ts +12 -29
  20. package/dist/types/configuration/types.d.ts +59 -87
  21. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
  22. package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
  23. package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
  24. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
  25. package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
  26. package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
  27. package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
  28. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
  29. package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
  30. package/dist/types/connection/networkConnection/types.d.ts +12 -27
  31. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
  32. package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
  33. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
  34. package/dist/types/connection/wsConnection/config.d.ts +8 -28
  35. package/dist/types/connection/wsConnection/types.d.ts +17 -70
  36. package/dist/types/entityStore/EntityStore.d.ts +153 -113
  37. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
  38. package/dist/types/errors.d.ts +7 -19
  39. package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
  40. package/dist/types/gen/chat/ChatApi.d.ts +28 -14
  41. package/dist/types/gen/models/index.d.ts +769 -86
  42. package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
  43. package/dist/types/index.d.ts +2 -4
  44. package/dist/types/languageNames.d.ts +9 -24
  45. package/dist/types/logger.d.ts +1 -3
  46. package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
  47. package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
  48. package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
  49. package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
  50. package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
  51. package/dist/types/messageComposer/configuration/types.d.ts +29 -56
  52. package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
  53. package/dist/types/messageComposer/messageComposer.d.ts +30 -164
  54. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
  55. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
  56. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
  57. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
  58. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
  59. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
  60. package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
  61. package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
  62. package/dist/types/messageComposer/pollComposer.d.ts +8 -4
  63. package/dist/types/messageComposer/textComposer.d.ts +3 -9
  64. package/dist/types/messageComposer/types.d.ts +5 -8
  65. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
  66. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
  67. package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
  68. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
  69. package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
  70. package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
  71. package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
  72. package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
  73. package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
  74. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
  75. package/dist/types/messageOperations/types.d.ts +15 -30
  76. package/dist/types/middleware.d.ts +7 -5
  77. package/dist/types/moderation.d.ts +21 -14
  78. package/dist/types/notifications/NotificationManager.d.ts +8 -31
  79. package/dist/types/notifications/types.d.ts +19 -59
  80. package/dist/types/offline-support/offline_support_api.d.ts +145 -539
  81. package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
  82. package/dist/types/offline-support/queueableOperations.d.ts +24 -52
  83. package/dist/types/offline-support/types.d.ts +24 -187
  84. package/dist/types/pagination/ItemIndex.d.ts +4 -12
  85. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
  86. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
  87. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
  88. package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
  89. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
  90. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
  91. package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
  92. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
  93. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
  94. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
  95. package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
  96. package/dist/types/pagination/sortCompiler.d.ts +11 -22
  97. package/dist/types/pagination/utility.normalization.d.ts +5 -23
  98. package/dist/types/pagination/utility.search.d.ts +3 -8
  99. package/dist/types/poll.d.ts +14 -14
  100. package/dist/types/poll_manager.d.ts +11 -2
  101. package/dist/types/poll_optimistic_votes.d.ts +10 -14
  102. package/dist/types/reminders/Reminder.d.ts +4 -4
  103. package/dist/types/reminders/ReminderManager.d.ts +7 -20
  104. package/dist/types/search/BaseSearchSource.d.ts +7 -12
  105. package/dist/types/search/ChannelSearchSource.d.ts +7 -7
  106. package/dist/types/search/MessageSearchSource.d.ts +7 -9
  107. package/dist/types/search/SearchController.d.ts +17 -22
  108. package/dist/types/search/types.d.ts +6 -10
  109. package/dist/types/signing.d.ts +12 -3
  110. package/dist/types/thread.d.ts +23 -71
  111. package/dist/types/thread_manager.d.ts +45 -70
  112. package/dist/types/token_manager.d.ts +8 -13
  113. package/dist/types/types.d.ts +64 -125
  114. package/dist/types/types.utility.d.ts +3 -3
  115. package/dist/types/upload-utils.d.ts +5 -10
  116. package/dist/types/uploadManager.d.ts +17 -45
  117. package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
  118. package/dist/types/utils/WithSubscriptions.d.ts +5 -15
  119. package/dist/types/utils/concurrency.d.ts +11 -19
  120. package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
  121. package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
  122. package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
  123. package/dist/types/utils/objectPath.d.ts +6 -41
  124. package/dist/types/utils/retryable.d.ts +8 -12
  125. package/dist/types/utils/throttling/throttle.d.ts +8 -23
  126. package/dist/types/utils/time.d.ts +24 -64
  127. package/dist/types/utils.d.ts +40 -86
  128. package/package.json +7 -2
  129. package/src/ChannelManager.ts +159 -300
  130. package/src/CooldownTimer.ts +11 -29
  131. package/src/EventHandlerPipeline.ts +21 -44
  132. package/src/LiveLocationManager.ts +35 -74
  133. package/src/api-client.ts +43 -61
  134. package/src/campaign.ts +1 -1
  135. package/src/channel.ts +396 -749
  136. package/src/channel_batch_updater.ts +1 -1
  137. package/src/channel_state.ts +50 -105
  138. package/src/client.ts +360 -588
  139. package/src/client_state.ts +1 -6
  140. package/src/configuration/ConfigController.ts +41 -157
  141. package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
  142. package/src/configuration/index.ts +1 -1
  143. package/src/configuration/keys.ts +13 -32
  144. package/src/configuration/shape.ts +67 -70
  145. package/src/configuration/types.ts +60 -100
  146. package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
  147. package/src/configuration/utils/copyConfigPatch.ts +11 -32
  148. package/src/configuration/utils/declarativeSlices.ts +9 -39
  149. package/src/configuration/utils/deepFreezeConfig.ts +3 -17
  150. package/src/configuration/utils/index.ts +2 -4
  151. package/src/configuration/utils/serverAuthority.ts +20 -68
  152. package/src/connection/ConnectionIdManager.ts +20 -49
  153. package/src/connection/ConnectionRecoveryManager.ts +51 -178
  154. package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
  155. package/src/connection/networkConnection/reporters.ts +9 -36
  156. package/src/connection/networkConnection/types.ts +12 -27
  157. package/src/connection/wsConnection/StableWSConnection.ts +73 -193
  158. package/src/connection/wsConnection/WSConnection.ts +56 -131
  159. package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
  160. package/src/connection/wsConnection/config.ts +13 -48
  161. package/src/connection/wsConnection/types.ts +17 -70
  162. package/src/constants.ts +4 -4
  163. package/src/entityStore/EntityStore.ts +162 -167
  164. package/src/entityStore/StoreBackedItemIndex.ts +14 -47
  165. package/src/errors.ts +7 -19
  166. package/src/formatMessageMemo.ts +3 -9
  167. package/src/gen/chat/ChannelApi.ts +19 -0
  168. package/src/gen/chat/ChatApi.ts +87 -13
  169. package/src/gen/models/index.ts +793 -71
  170. package/src/gen/moderation/ModerationApi.ts +0 -4
  171. package/src/index.ts +10 -14
  172. package/src/languageNames.ts +9 -24
  173. package/src/logger.ts +1 -3
  174. package/src/messageComposer/LocationComposer.ts +7 -23
  175. package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
  176. package/src/messageComposer/attachmentIdentity.ts +2 -13
  177. package/src/messageComposer/attachmentManager.ts +17 -63
  178. package/src/messageComposer/attachmentUtils.ts +3 -17
  179. package/src/messageComposer/configuration/configuration.ts +5 -8
  180. package/src/messageComposer/configuration/types.ts +29 -56
  181. package/src/messageComposer/fileUtils.ts +1 -1
  182. package/src/messageComposer/linkPreviewsManager.ts +8 -20
  183. package/src/messageComposer/messageComposer.ts +54 -222
  184. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
  185. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
  186. package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
  187. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
  188. package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
  189. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
  190. package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
  191. package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
  192. package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
  193. package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
  194. package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
  195. package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
  196. package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
  197. package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
  198. package/src/messageComposer/middleware/textComposer/types.ts +1 -6
  199. package/src/messageComposer/pollComposer.ts +11 -8
  200. package/src/messageComposer/textComposer.ts +9 -59
  201. package/src/messageComposer/types.ts +9 -12
  202. package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
  203. package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
  204. package/src/messageOperations/FailedSendCache.ts +4 -9
  205. package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
  206. package/src/messageOperations/MessageOperations.ts +33 -62
  207. package/src/messageOperations/applyReactionLocally.ts +9 -28
  208. package/src/messageOperations/createMessageOperations.ts +17 -33
  209. package/src/messageOperations/reflectReactionEvent.ts +5 -13
  210. package/src/messageOperations/sendOrdering.ts +4 -7
  211. package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
  212. package/src/messageOperations/types.ts +15 -30
  213. package/src/middleware.ts +7 -10
  214. package/src/moderation.ts +25 -21
  215. package/src/notifications/NotificationManager.ts +11 -35
  216. package/src/notifications/types.ts +19 -59
  217. package/src/offline-support/offline_support_api.ts +178 -608
  218. package/src/offline-support/offline_sync_manager.ts +25 -69
  219. package/src/offline-support/queueableOperations.ts +31 -84
  220. package/src/offline-support/types.ts +25 -188
  221. package/src/pagination/ItemIndex.ts +4 -12
  222. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
  223. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
  224. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  225. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
  226. package/src/pagination/filterCompiler.ts +11 -25
  227. package/src/pagination/paginators/BasePaginator.ts +422 -976
  228. package/src/pagination/paginators/ChannelPaginator.ts +130 -190
  229. package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
  230. package/src/pagination/paginators/MessagePaginator.ts +135 -175
  231. package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
  232. package/src/pagination/paginators/ReminderPaginator.ts +12 -15
  233. package/src/pagination/paginators/ThreadPaginator.ts +16 -26
  234. package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
  235. package/src/pagination/paginators/stateThrottling.ts +5 -10
  236. package/src/pagination/sortCompiler.ts +23 -50
  237. package/src/pagination/utility.normalization.ts +8 -30
  238. package/src/pagination/utility.search.ts +4 -11
  239. package/src/poll.ts +19 -19
  240. package/src/poll_manager.ts +16 -20
  241. package/src/poll_optimistic_votes.ts +17 -22
  242. package/src/reminders/Reminder.ts +5 -6
  243. package/src/reminders/ReminderManager.ts +9 -34
  244. package/src/reminders/ReminderTimer.ts +1 -2
  245. package/src/search/BaseSearchSource.ts +14 -29
  246. package/src/search/ChannelSearchSource.ts +8 -8
  247. package/src/search/MessageSearchSource.ts +19 -25
  248. package/src/search/SearchController.ts +18 -24
  249. package/src/search/types.ts +6 -10
  250. package/src/segment.ts +1 -1
  251. package/src/signing.ts +23 -3
  252. package/src/thread.ts +72 -173
  253. package/src/thread_manager.ts +59 -76
  254. package/src/token_manager.ts +11 -21
  255. package/src/types.ts +78 -126
  256. package/src/types.utility.ts +3 -3
  257. package/src/upload-utils.ts +5 -10
  258. package/src/uploadManager.ts +22 -54
  259. package/src/utils/FixedSizeQueueCache.ts +13 -21
  260. package/src/utils/WithSubscriptions.ts +5 -15
  261. package/src/utils/concurrency.ts +16 -55
  262. package/src/utils/mergeWith/mergeWith.ts +10 -13
  263. package/src/utils/mergeWith/mergeWithCore.ts +24 -81
  264. package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
  265. package/src/utils/objectPath.ts +6 -41
  266. package/src/utils/retryable.ts +10 -14
  267. package/src/utils/throttling/throttle.ts +9 -25
  268. package/src/utils/time.ts +26 -66
  269. package/src/utils.ts +72 -128
@@ -3,20 +3,15 @@ import type { Channel } from './channel';
3
3
  import type { AxiosRequestConfig } from 'axios';
4
4
  import type { ScopedLogger } from './logger';
5
5
  /**
6
- * Logs the execution of a promise. Use this when you want to run the promise and handle errors by
7
- * logging a warning.
6
+ * Runs a promise fire-and-forget and logs an error when it rejects.
8
7
  *
9
- * @param promise - The promise you want to run and log.
10
- * @param name - A descriptive name of what the promise does for log output.
8
+ * @param promise - The promise to run.
9
+ * @param name - What the promise does, for the log output.
11
10
  */
12
11
  export declare function logChatPromiseExecution<T>(promise: Promise<T>, name: string): void;
13
12
  /**
14
- * Invokes a single event listener in isolation, so that a faulty listener cannot
15
- * abort the dispatch loop or the bookkeeping that follows it.
16
- *
17
- * Reports two failure modes: a synchronous throw, and a rejected promise from an `async`
18
- * listener — async handlers are assignable to the void-returning `EventHandler` type, so
19
- * without this they would be silent unhandled rejections.
13
+ * Invokes one event listener in isolation: a synchronous throw or a rejected promise (from an
14
+ * `async` listener) is logged and cannot abort the dispatch loop.
20
15
  */
21
16
  export declare const invokeEventListener: <T>(listener: (event: T) => unknown, event: T, scopedLogger: ScopedLogger) => void;
22
17
  export declare const sleep: (m: number) => Promise<void>;
@@ -27,43 +22,33 @@ export declare const chatCodes: {
27
22
  };
28
23
  export declare function isOwnUser(user?: OwnUserResponse | UserResponse): user is OwnUserResponse;
29
24
  export declare function isOwnUserBaseProperty(property: string): boolean;
30
- /**
31
- * channelHasReadEvents - Whether read events are enabled for the current user on a channel.
32
- */
25
+ /** Whether `read-events` is among the own capabilities (true while they are not loaded). */
33
26
  export declare const channelHasReadEvents: (channel?: Channel) => boolean;
34
- /**
35
- * channelTracksReadLocally - Whether a channel maintains a client local unread count.
36
- */
27
+ /** Whether read events are off and the channel keeps a client-local unread count. */
37
28
  export declare const channelTracksReadLocally: (channel?: Channel) => boolean;
38
- /**
39
- * retryInterval - A retry interval which increases acc to number of failures
40
- *
41
- * @returns Duration to wait in milliseconds
42
- */
29
+ /** A random retry delay in milliseconds that grows with `numberOfFailures`. */
43
30
  export declare function retryInterval(numberOfFailures: number): number;
44
31
  export declare function randomId(): string;
45
32
  export declare function generateUUIDv4(): string;
46
33
  export declare const axiosParamsSerializer: AxiosRequestConfig['paramsSerializer'];
47
34
  /**
48
- * Takes the message object, adds SDK-specific fields (status, error),
49
- * and returns a new LocalMessage object.
35
+ * Adds the SDK-specific fields (`status`, `error`) to a message. Memoized per source object: callers
36
+ * share the result, so do not mutate it.
50
37
  *
51
- * @param message - message object
38
+ * @param message - The message from the API, or a local one.
39
+ * @returns The `LocalMessage`.
52
40
  */
53
41
  export declare function formatMessage(message: MessageResponse | LocalMessage): LocalMessage;
54
42
  /**
55
- * Computes the current user's `own_reactions` after applying a single reaction change, off a
56
- * `current` base. A WS reaction/edit event carries `own_reactions: []` (or stale), so consumers
57
- * must recompute from the copy they already hold rather than trusting the event — this is the
58
- * shared core used by both the message paginator (`reflectReaction`) and the thread's parent
59
- * message (which is not held in any paginator, so it needs the same logic directly).
43
+ * Computes the current user's `own_reactions` after one reaction change, from the `current` copy. A
44
+ * WS reaction event carries `own_reactions: []` (or stale), so it cannot be trusted. Used by
45
+ * `applyReactionLocally` and `reflectReactionEvent`.
60
46
  *
61
47
  * - `removed`: drop the current user's reaction of this type.
62
- * - `enforceUnique`: replace any existing own reaction with the incoming one (used by
63
- * `reaction.updated`, where a user's reaction supersedes their previous one).
48
+ * - `enforceUnique`: replace any own reaction with the incoming one (`reaction.updated`).
64
49
  * - otherwise: add the reaction, de-duped by type.
65
50
  *
66
- * A reaction by another user never changes the current user's `own_reactions`.
51
+ * A reaction by another user never changes `own_reactions`.
67
52
  */
68
53
  export declare function computeOwnReactions({ current, enforceUnique, reaction, removed, userId, }: {
69
54
  current: ReactionResponse[];
@@ -74,10 +59,7 @@ export declare function computeOwnReactions({ current, enforceUnique, reaction,
74
59
  }): ReactionResponse[];
75
60
  /**
76
61
  * Returns a copy of `message` with `reaction` folded into its `reaction_groups` /
77
- * `latest_reactions`. Does not touch `own_reactions` — the reaction entry points
78
- * ({@link MessageIntervalPaginator.reflectReaction} / `Thread.applyParentReactionLocally`) own that
79
- * via {@link computeOwnReactions}. Shared so both the paginator and the (paginator-less) thread
80
- * parent compute counts identically.
62
+ * `latest_reactions`. `own_reactions` is left to {@link computeOwnReactions}.
81
63
  */
82
64
  export declare function messageWithReactionAdded(message: LocalMessage, reaction: ReactionResponse, enforceUnique: boolean): LocalMessage;
83
65
  /**
@@ -86,15 +68,10 @@ export declare function messageWithReactionAdded(message: LocalMessage, reaction
86
68
  */
87
69
  export declare function messageWithReactionRemoved(message: LocalMessage, reaction: ReactionResponse): LocalMessage;
88
70
  /**
89
- * Strips composer-internal state from a message's attachments, and drops any whose upload never
90
- * resolved.
91
- *
92
- * `localMetadata` is how `AttachmentManager` tracks an upload (its id, the `File`, the local
93
- * preview); it must never reach the API. An attachment that still carries it and has no remote
94
- * URL was never settled, which means something bypassed the send path that awaits those uploads.
95
- * Sending it would store an attachment pointing at nothing, so it is dropped and logged instead.
96
- *
97
- * Returns the same message object when there was nothing to change.
71
+ * Strips `localMetadata` (`AttachmentManager`'s upload state, never sent to the API) from a
72
+ * message's attachments. Of those that carried it, drops with a warning the ones with no remote URL:
73
+ * their upload never settled, so something bypassed the send path that awaits uploads. Returns the
74
+ * same message object when nothing changed.
98
75
  */
99
76
  export declare const sanitizeOutgoingAttachments: <T extends {
100
77
  attachments?: Attachment[];
@@ -180,9 +157,8 @@ export declare const findIndexInSortedArray: <T, L>({ needle, sortedArray, selec
180
157
  needle: T;
181
158
  sortedArray: readonly T[];
182
159
  /**
183
- * In an array of objects (like messages), pick a unique property identifying
184
- * an element. It will be used to find a direct match for the needle element
185
- * in case compare values are not unique.
160
+ * Picks a unique property identifying an element, used to find a direct match for the needle when
161
+ * compare values are not unique.
186
162
  *
187
163
  * @example
188
164
  * ```ts
@@ -191,8 +167,7 @@ export declare const findIndexInSortedArray: <T, L>({ needle, sortedArray, selec
191
167
  */
192
168
  selectKey?: (arrayElement: T) => string;
193
169
  /**
194
- * In an array of objects (like messages), pick a specific
195
- * property to compare the needle value to.
170
+ * Picks the property to compare the needle to.
196
171
  *
197
172
  * @example
198
173
  * ```ts
@@ -200,37 +175,19 @@ export declare const findIndexInSortedArray: <T, L>({ needle, sortedArray, selec
200
175
  * ```
201
176
  */
202
177
  selectValueToCompare?: (arrayElement: T) => L | T;
203
- /**
204
- * @default ascending
205
- * @description
206
- * ```md
207
- * ascending - [1,2,3,4,5...]
208
- * descending - [...5,4,3,2,1]
209
- * ```
210
- */
178
+ /** @default 'ascending' */
211
179
  sortDirection?: "ascending" | "descending";
212
180
  }) => number;
213
181
  export interface DebouncedFunc<T extends (...args: any[]) => any> {
214
182
  /**
215
- * Call the original function, but applying the debounce rules.
216
- *
217
- * If the debounced function can be run immediately, this calls it and returns its return
218
- * value.
219
- *
220
- * Otherwise, it returns the return value of the last invocation, or undefined if the debounced
221
- * function was not invoked yet.
183
+ * Calls the function under the debounce rules. Returns its value when it runs immediately, else
184
+ * the last invocation's value (`undefined` before the first).
222
185
  */
223
186
  (...args: Parameters<T>): ReturnType<T> | undefined;
224
- /**
225
- * Throw away any pending invocation of the debounced function.
226
- */
227
187
  cancel(): void;
228
188
  /**
229
- * If there is a pending invocation of the debounced function, invoke it immediately and return
230
- * its return value.
231
- *
232
- * Otherwise, return the value from the last invocation, or undefined if the debounced function
233
- * was never invoked.
189
+ * Runs the pending invocation immediately and returns its value; otherwise returns the last
190
+ * invocation's value (`undefined` if never invoked).
234
191
  */
235
192
  flush(): ReturnType<T> | undefined;
236
193
  }
@@ -242,8 +199,10 @@ export { throttle } from './utils/throttling/throttle';
242
199
  export type { Throttled, ThrottleOptions, ThrottledCallback, } from './utils/throttling/throttle';
243
200
  export declare const uniqBy: <T>(array: T[] | unknown, iteratee: ((item: T) => unknown) | keyof T) => T[];
244
201
  /**
245
- * The user id of a member as `ChannelInput.members` lists it: a user id, `{ user_id }` or
246
- * `{ user: { id } }`.
202
+ * Reads the user ID of a member.
203
+ *
204
+ * @param member - A user ID, a member request or a member response.
205
+ * @returns The user ID, or `''` if there is none.
247
206
  */
248
207
  export declare const getMemberUserId: (member: string | {
249
208
  user_id?: string;
@@ -252,20 +211,15 @@ export declare const getMemberUserId: (member: string | {
252
211
  };
253
212
  }) => string;
254
213
  /**
255
- * The id a channel created from members, without an id, has until the server answers: the sorted
256
- * member user ids joined by `,`, after `!members-`. It is the same for the same members whatever
257
- * their order. `undefined` when there are no members.
258
- *
259
- * @param memberIds - The member user ids.
214
+ * The temporary ID of a channel created from members without an ID, until the server answers:
215
+ * `!members-` plus the sorted member IDs joined by `,`, so it is order-independent. `undefined`
216
+ * when there are no members.
260
217
  */
261
218
  export declare const generateChannelTempId: (memberIds: string[]) => string | undefined;
262
219
  /**
263
- * The cid a channel created from members, without an id, has until the server answers: its
264
- * {@link generateChannelTempId} under its type. It stands in for the cid the server assigns, so the
265
- * channel is stored once under it. `undefined` when there are no members.
266
- *
267
- * @param channelType - The channel type.
268
- * @param memberIds - The member user ids.
220
+ * The temporary cid of a channel created from members without an ID: its
221
+ * {@link generateChannelTempId} under its type, so the channel is stored once under it until the
222
+ * server assigns the real cid. `undefined` when there are no members.
269
223
  */
270
224
  export declare const generateChannelTempCid: (channelType: string, memberIds: string[]) => string | undefined;
271
225
  export declare const isLocalMessage: (message: unknown) => message is LocalMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat",
3
- "version": "10.0.0-rc.21",
3
+ "version": "10.0.0-rc.23",
4
4
  "description": "JS SDK for the Stream Chat API",
5
5
  "homepage": "https://getstream.io/chat/",
6
6
  "author": {
@@ -56,7 +56,8 @@
56
56
  "@eslint/js": "^9.39.4",
57
57
  "@semantic-release/changelog": "^6.0.3",
58
58
  "@semantic-release/git": "^10.0.1",
59
- "@types/node": "^22",
59
+ "@stream-io/node-sdk": "^0.8.10",
60
+ "@types/node": "^22.19.19",
60
61
  "@types/sinon": "^10.0.6",
61
62
  "@vitest/coverage-v8": "^4.1.10",
62
63
  "concurrently": "^9.2.1",
@@ -90,6 +91,10 @@
90
91
  "test": "yarn test-unit",
91
92
  "test-unit": "vitest",
92
93
  "test-coverage": "vitest run --coverage",
94
+ "test-docs": "vitest run --config test/docs-snippets/vitest.config.mts",
95
+ "test-docs-sweep": "vitest run --config test/docs-snippets/vitest.sweep.config.mts",
96
+ "test-docs-sync": "vitest run --config test/docs-snippets/vitest.sync.config.mts",
97
+ "types-docs": "tsc -p test/docs-snippets/tsconfig.json",
93
98
  "fix-staged": "lint-staged --config .lintstagedrc.fix.json --concurrent 1",
94
99
  "semantic-release": "semantic-release",
95
100
  "postinstall": "node -e \"require('fs').existsSync('scripts/install-husky.mjs') && import('./scripts/install-husky.mjs')\"",