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
@@ -46,62 +46,47 @@ export type MessageOperationsHandlers = {
46
46
  update?: OperationRequestFn<'update'>;
47
47
  };
48
48
  export type MessageOperationsContext = {
49
- /**
50
- * The channel every request and offline-DB row belongs to. A `Thread` passes its parent channel,
51
- * since a reply is sent, persisted and reacted to against the channel like any other message. It is
52
- * what lets the reaction operations live here rather than being written once per owner.
53
- */
49
+ /** The channel every request and offline-DB row belongs to. A `Thread` passes its parent channel. */
54
50
  channel: Channel;
55
51
  ingest: (m: LocalMessage) => void;
56
52
  get: (id: string) => LocalMessage | undefined;
57
- /**
58
- * Drops the message from local state entirely. Needed by the delete lifecycle: a hard delete removes
59
- * the message rather than marking it `deleted` (mirroring the `message.deleted` WS handler, which
60
- * branches on `event.hard_delete` the same way).
61
- */
53
+ /** Drops the message from local state: a hard delete removes it rather than marking it `deleted`. */
62
54
  remove: (id: string) => void;
63
- /**
64
- * Mirrors a message into the offline DB. Fire-and-forget: local state is the source of truth, so a
65
- * failed DB write must never fail the operation.
66
- */
55
+ /** Mirrors a message into the offline DB. Fire-and-forget: a failed write never fails the operation. */
67
56
  persist: (m: LocalMessage) => void;
68
57
  /** Removes a message's offline-DB row (the hard-delete counterpart of {@link persist}). */
69
58
  purge: (id: string) => void;
70
59
  /**
71
- * Whether this message's mutation is sitting in the offline queue waiting to be replayed — read from
72
- * the queue, not inferred from the error ({@link isQueuedForReplay}). A queued mutation is pending,
73
- * not failed, so the optimistic state stays exactly as it is: no `failed` status, no error, no revert.
74
- * Reactions run the same predicate, which is what keeps the two from drifting.
60
+ * Whether this message's mutation sits in the offline queue waiting to be replayed, read from the
61
+ * queue rather than inferred from the error ({@link isQueuedForReplay}). A queued mutation is pending,
62
+ * not failed: the optimistic state stays as it is. Reactions use the same predicate.
75
63
  */
76
64
  isQueued: (messageId: string, types: readonly QueueableType[]) => Promise<boolean>;
77
65
  normalizeOutgoingMessage?: (m: MessageRequest) => MessageRequest;
78
66
  /** Runs first on every send (not a retry). This is where the typing indicator is stopped. */
79
67
  beforeSend?: () => void;
80
68
  /**
81
- * Lets the owner run a request on its own instead of in parallel — the server dates a message
82
- * on arrival, so a short text sent after a photo would otherwise be dated first. Wraps the
83
- * request only; call it once and return its result.
69
+ * Lets the owner serialize requests: the server dates a message on arrival, so a short text sent after
70
+ * a photo would otherwise be dated first. Wraps the request only; call it once and return its result.
84
71
  */
85
72
  sequenceRequests?: <T>(kind: OperationKind, request: () => Promise<T>) => Promise<T>;
86
73
  /**
87
- * Resolves any attachment upload still in flight, returning the attachments with their URLs
88
- * written on. Supplied by the owner, which knows the target `cid` and the client. Only reachable
89
- * with {@link AttachmentManagerConfig.pendingUploadsEnabled} on.
74
+ * Resolves any attachment upload still in flight, returning the attachments with their URLs written
75
+ * on. Only reachable with {@link AttachmentManagerConfig.pendingUploadsEnabled} on.
90
76
  */
91
77
  settlePendingUploads?: (attachments: NonNullable<LocalMessage['attachments']>) => Promise<{
92
78
  /**
93
- * The same list, with each upload that resolved replaced by its uploaded form — URL written,
94
- * `localMetadata` dropped. Ones that did not resolve come back untouched, so on failure this
95
- * is a mix; `failureReason` is what distinguishes the two cases. Returned by reference when
96
- * nothing was pending.
79
+ * The same list, with each resolved upload replaced by its uploaded form (URL written,
80
+ * `localMetadata` dropped). Unresolved ones come back untouched, so on failure this is a mix. The
81
+ * same reference when nothing was pending.
97
82
  */
98
83
  attachments: NonNullable<LocalMessage['attachments']>;
99
84
  /** Set if any upload failed. The ones that did resolve are still kept above. */
100
85
  failureReason?: unknown;
101
86
  }>;
102
87
  /**
103
- * The HTTP requests, through the offline queue — used when no integrator {@link handlers} entry
104
- * replaces them. A replaced request still reaches them through its `defaultRequest`.
88
+ * The HTTP requests, through the offline queue, used when no {@link handlers} entry replaces them.
89
+ * A replaced request still reaches them through its `defaultRequest`.
105
90
  */
106
91
  defaults: {
107
92
  delete: (id: string, o?: DeleteMessageOptions) => Promise<OperationResponse>;
@@ -13,6 +13,10 @@ export type MiddlewareExecutionResult<TValue> = {
13
13
  export type ExecuteParams<TValue> = {
14
14
  eventName: string;
15
15
  initialValue: TValue;
16
+ /**
17
+ * `cancelable`: a new run cancels the unresolved previous run of the same `eventName`.
18
+ * `concurrent`: every run executes. Defaults to `cancelable`.
19
+ */
16
20
  mode?: 'concurrent' | 'cancelable';
17
21
  };
18
22
  export type MiddlewareHandlerParams<TValue> = {
@@ -35,11 +39,9 @@ export declare class MiddlewareExecutor<TValue, THandlers extends string> {
35
39
  private middleware;
36
40
  constructor();
37
41
  /**
38
- * The middleware currently installed, in execution order.
39
- *
40
- * Read-only: use `use` / `insert` / `replace` / `setOrder` / `remove` to change the chain. It
41
- * exists so components can ask what the chain is capable of - a middleware may declare
42
- * behaviour its host has to account for, and the host has no other way to find out.
42
+ * The installed middleware in execution order, read-only, so a host component can check what the
43
+ * chain contains (by `id`). Change the chain with `use`, `insert`, `replace`, `setOrder` or
44
+ * `remove`.
43
45
  */
44
46
  get installedMiddleware(): ReadonlyArray<Middleware<TValue, THandlers>>;
45
47
  use(middleware: Middleware<TValue, THandlers> | Middleware<TValue, THandlers>[]): this;
@@ -5,41 +5,48 @@ export declare const MODERATION_ENTITY_TYPES: {
5
5
  user: string;
6
6
  message: string;
7
7
  };
8
+ /** Moderation v2 endpoints. */
8
9
  export declare class Moderation extends ModerationApi {
9
10
  client: StreamChat;
10
11
  constructor(client: StreamChat);
11
12
  /**
12
13
  * Flags a user.
13
14
  *
14
- * @param flaggedUserId - User ID to be flagged.
15
- * @param reason - Reason for flagging the user.
16
- * @param options - Additional options for flagging the user (optional, defaults to `{}`).
17
- * @param options.custom - Additional data to be stored with the flag (optional).
18
- * @param options.entity_creator_id - ID of the user who created the flagged entity.
15
+ * @param request - The user to flag, the reason and any other flag option.
16
+ * @param request.user_id - User ID to be flagged.
17
+ * @param request.reason - Reason for flagging the user (optional).
18
+ * @param request.custom - Additional data to be stored with the flag (optional).
19
+ * @param request.entity_creator_id - ID of the user who created the flagged entity.
19
20
  * Omitted when not supplied; the server resolves it from the entity (optional).
20
- * @param options.moderation_payload - Content submitted for moderation alongside the
21
+ * @param request.moderation_payload - Content submitted for moderation alongside the
21
22
  * flag (optional).
22
23
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
23
24
  * into the request (optional).
24
25
  * @returns The flag response.
25
26
  */
26
- flagUser(flaggedUserId: string, reason?: string, options?: ModerationFlagOptions, requestOptions?: StreamRequestOptions): Promise<import("./types").StreamResponse<import(".").FlagItemResponse>>;
27
+ flagUser({ user_id, reason, ...options }: {
28
+ user_id: string;
29
+ reason?: string;
30
+ } & ModerationFlagOptions, requestOptions?: StreamRequestOptions): Promise<import("./types").StreamResponse<import(".").FlagItemResponse>>;
27
31
  /**
28
32
  * Flags a message.
29
33
  *
30
- * @param messageId - MessageRequest ID to be flagged.
31
- * @param reason - Reason for flagging the message.
32
- * @param options - Additional options for flagging the message (optional, defaults to `{}`).
33
- * @param options.custom - Additional data to be stored with the flag (optional).
34
- * @param options.entity_creator_id - ID of the user who created the flagged entity.
34
+ * @param request - The message to flag, the reason and any other flag option.
35
+ * @param request.message_id - ID of the message to be flagged.
36
+ * @param request.reason - Reason for flagging the message (optional).
37
+ * @param request.custom - Additional data to be stored with the flag (optional).
38
+ * @param request.entity_creator_id - ID of the user who created the flagged entity.
35
39
  * Omitted when not supplied; the server resolves it from the entity (optional).
36
- * @param options.moderation_payload - Content submitted for moderation alongside the
40
+ * @param request.moderation_payload - Content submitted for moderation alongside the
37
41
  * flag (optional).
38
42
  * @param requestOptions - Per-request options such as an abort `signal`. Never serialized
39
43
  * into the request (optional).
40
44
  * @returns The flag response.
41
45
  */
42
- flagMessage(messageId: string, reason?: string, options?: ModerationFlagOptions, requestOptions?: StreamRequestOptions): Promise<import("./types").StreamResponse<import(".").FlagItemResponse>>;
46
+ flagMessage({ message_id, reason, ...options }: {
47
+ message_id: string;
48
+ reason?: string;
49
+ } & ModerationFlagOptions, requestOptions?: StreamRequestOptions): Promise<import("./types").StreamResponse<import(".").FlagItemResponse>>;
43
50
  /**
44
51
  * Unmutes a user.
45
52
  *
@@ -4,36 +4,21 @@ import type { DeepPartial } from '../types.utility';
4
4
  export declare class NotificationManager {
5
5
  store: StateStore<NotificationState>;
6
6
  private timeouts;
7
- /** The shared configuration machinery — see {@link ConfigController}. */
8
7
  private readonly configController;
9
- /**
10
- * Resolved configuration, as a store so consumers can react to it — the same shape every configurable
11
- * class exposes (`configState` for the store, {@link config} for the current value).
12
- */
13
8
  get configState(): StateStore<NotificationManagerConfig>;
14
9
  constructor(config?: Partial<NotificationManagerConfig>);
10
+ get config(): Readonly<NotificationManagerConfig>;
15
11
  /**
16
- * The current resolved configuration. `Readonly` because the value is the store's live object —
17
- * assigning to a field of it would change state without notifying anyone. Use {@link updateConfig}.
12
+ * Merges a partial configuration into the resolved config.
13
+ *
14
+ * @param config - Fields to merge into the resolved config.
18
15
  */
19
- get config(): Readonly<NotificationManagerConfig>;
20
- /** Deep-merges a partial configuration into the resolved config and notifies subscribers. */
21
16
  updateConfig(config: Partial<NotificationManagerConfig>): void;
22
17
  /**
23
- * Rebuilds the resolved configuration from package defaults plus the declarative slice, **replacing**
24
- * what is there rather than merging into it. Called by the client's derivation, which shares one path
25
- * with `client.config.reset()`.
18
+ * Rebuilds the config from the defaults, `config` and the constructor options instead of merging
19
+ * into the current value, so a `sortComparator` set through `updateConfig` is dropped.
26
20
  *
27
- * The distinction is not cosmetic here, and this manager is the only one that needs it.
28
- * {@link updateConfig} deep-merges, and `sortComparator` is optional — so unlike every other field of
29
- * every other manager config, it has no counterpart in {@link DEFAULT_NOTIFICATION_MANAGER_CONFIG} for
30
- * a derivation to overwrite it with. Registering one through `client.config` therefore made it
31
- * permanent: `reset()` re-derived, the merge kept it, and nothing could ever remove it. A merge cannot
32
- * express a removal; this is the same rule `Channel.initializeConfig` follows for `requestHandlers`.
33
- *
34
- * The defaults are copied rather than spread, because a shallow spread would leave `durations`
35
- * pointing at the module-level object and put it in the store, where a nested write would change the
36
- * default for every client in the process.
21
+ * @param config - The declarative slice. Defaults to `{}`.
37
22
  */
38
23
  initializeConfig(config?: DeepPartial<NotificationManagerConfig>): void;
39
24
  get notifications(): Notification[];
@@ -48,15 +33,7 @@ export declare class NotificationManager {
48
33
  addSuccess({ message, origin, options }: AddNotificationPayload): string;
49
34
  clearTimeout(id: string): void;
50
35
  startTimeout(id: string, durationOverride?: number): void;
51
- /**
52
- * Starts the notification's auto-dismiss countdown unless one is already running.
53
- *
54
- * The counterpart to {@link startTimeout}, which always restarts. Use this wherever the caller
55
- * cannot know whether the countdown has been started already -- a UI component that remounts and
56
- * has lost the record, or a second view displaying the same notification. Restarting there is
57
- * invisible and open-ended: each call hands the notification another full lifetime, so it can
58
- * outlive its duration indefinitely while looking like it is counting down.
59
- */
36
+ /** Like {@link startTimeout}, but a no-op when a countdown is already running. */
60
37
  ensureTimeout(id: string, durationOverride?: number): void;
61
38
  remove(id: string): void;
62
39
  clear(): void;
@@ -1,12 +1,7 @@
1
- /** Represents the severity level of a notification */
2
1
  export type NotificationSeverity = 'error' | 'warning' | 'info' | 'success' | (string & {});
3
- /** Represents an action button for a notification */
4
2
  export type NotificationAction = {
5
- /** Text label for the action button */
6
3
  label: string;
7
- /** Handler function called when action button is clicked */
8
4
  handler: () => void;
9
- /** Optional metadata for styling or other custom properties */
10
5
  metadata?: Record<string, unknown>;
11
6
  };
12
7
  export type NotificationOrigin = {
@@ -14,22 +9,11 @@ export type NotificationOrigin = {
14
9
  context?: Record<string, unknown>;
15
10
  };
16
11
  /**
17
- * Every notification type emitted by `stream-chat` itself.
12
+ * Notification types emitted by `stream-chat`, formatted `domain:entity:operation:result`
13
+ * (e.g. `api:message:send:failed`).
18
14
  *
19
- * Format is `domain:entity:operation:result`:
20
- * - `domain` — where it happened: `api`, `validation`, `permission`, `network`, `auth`, `system`
21
- * - `entity` — what was operated on: `attachment`, `poll`, `message`, `command`, `location`
22
- * - `operation` — what was attempted, lowerCamelCase: `upload`, `create`, `castVote`, `jumpToLatest`
23
- * - `result` — what happened: `failed`, `blocked`, `invalid`, `missing`, `limit`, `success`,
24
- * or a short hyphenated state such as `in-progress` / `not-ready`
25
- *
26
- * **These values are public API.** UI SDKs key their translation tables on them, so renaming one is
27
- * a breaking change. Emit them through this map rather than writing the literal inline, so the whole
28
- * set stays greppable from one place and a typo is a compile error.
29
- *
30
- * Consumers translating notifications should switch on {@link Notification.type} rather than matching
31
- * on {@link Notification.message}, which is untranslated English intended as a developer-facing
32
- * fallback.
15
+ * **The values are public API**: UI SDKs key their translations on them. Emit them through this
16
+ * map, never as inline literals.
33
17
  */
34
18
  export declare const CORE_NOTIFICATION_TYPE: {
35
19
  readonly attachmentFileMissing: "validation:attachment:file:missing";
@@ -41,79 +25,55 @@ export declare const CORE_NOTIFICATION_TYPE: {
41
25
  readonly commandDisabled: "validation:command:disabled";
42
26
  readonly commandNotReady: "validation:command:not-ready";
43
27
  readonly locationCreateFailed: "api:location:create:failed";
44
- /** Jumping to a specific message failed. */
45
28
  readonly messageJumpFailed: "api:message:jump:failed";
46
- /** Jumping to the latest message failed. */
47
29
  readonly messageJumpToLatestFailed: "api:message:jumpToLatest:failed";
48
- /** Sending a composed message failed. The message stays in the list, marked failed. */
30
+ /** The message stays in the list, marked failed. */
49
31
  readonly messageSendFailed: "api:message:send:failed";
50
- /** Saving an edit failed. The edit is kept on the message, marked failed. */
32
+ /** The edit is kept on the message, marked failed. */
51
33
  readonly messageUpdateFailed: "api:message:update:failed";
52
34
  readonly pollCastVoteLimit: "validation:poll:castVote:limit";
53
35
  readonly pollCreateFailed: "api:poll:create:failed";
54
36
  };
55
37
  /** A notification type emitted by `stream-chat` itself. See {@link CORE_NOTIFICATION_TYPE}. */
56
38
  export type CoreNotificationType = (typeof CORE_NOTIFICATION_TYPE)[keyof typeof CORE_NOTIFICATION_TYPE];
57
- /** Represents a single notification message */
58
39
  export type Notification = {
59
- /** Unique identifier for the notification */
60
40
  id: string;
61
41
  /**
62
- * Untranslated English text describing what happened.
63
- *
64
- * This is a **developer-facing fallback, not display copy.** It is not localized and its exact
65
- * wording is not part of the public contract — it can be reworded in a minor release. Anything
66
- * user-facing should resolve {@link Notification.type} to its own copy and fall back to this string
67
- * only for an identifier it does not recognize.
42
+ * Untranslated English text, a developer-facing fallback rather than display copy. Its wording
43
+ * can change in a minor release: resolve {@link Notification.type} to your own copy instead.
68
44
  */
69
45
  message: string;
70
- /** Timestamp when notification was created */
46
+ /** Creation time, in ms since epoch. */
71
47
  createdAt: number;
72
- /**
73
- * Identifier of the notification emitter.
74
- * The identifier then can be recognized by notification consumers to act upon specific origin values.
75
- */
48
+ /** The emitter, which consumers can match to act on specific origins. */
76
49
  origin: NotificationOrigin;
77
- /** Array of action buttons for the notification */
78
50
  actions?: NotificationAction[];
79
- /** The severity level of the notification (defaults to `undefined` unless explicitly provided). */
80
51
  severity?: NotificationSeverity;
81
52
  /**
82
- * Stable identifier for what this notification is about, used to group notifications of the same
83
- * kind and — for UI SDKs — to resolve a translation without matching on the English `message`.
84
- *
85
- * Values emitted by `stream-chat` are enumerated in {@link CORE_NOTIFICATION_TYPE}; those are the
86
- * ones that autocomplete. The type stays open so SDKs and integrators can emit their own
87
- * identifiers following the same `domain:entity:operation:result` convention.
53
+ * Stable identifier for what the notification is about, for grouping and for resolving a
54
+ * translation. Values emitted by `stream-chat` are in {@link CORE_NOTIFICATION_TYPE}. Custom
55
+ * identifiers should follow the same `domain:entity:operation:result` format.
88
56
  */
89
57
  type?: CoreNotificationType | (string & {});
90
- /** Optional auto-dismiss duration in milliseconds. The timeout starts when NotificationManager.startTimeout() is called. */
58
+ /** Auto-dismiss duration in ms. The countdown starts on `NotificationManager.startTimeout()`. */
91
59
  duration?: number;
92
- /** Optional metadata to attach to the notification */
93
60
  metadata?: Record<string, unknown>;
94
- /** Optional tags that can be used for routing or grouping notifications (e.g. `target:channel`). */
61
+ /** For routing or grouping (e.g. `target:channel`). */
95
62
  tags?: string[];
96
- /** In case of error notification the instance of the originally thrown error */
63
+ /** The originally thrown error, for error notifications. */
97
64
  originalError?: Error;
98
65
  };
99
- /** Configuration options when creating a notification */
100
66
  export type NotificationOptions = Partial<Pick<Notification, 'type' | 'severity' | 'actions' | 'metadata' | 'tags' | 'originalError'>> & {
101
67
  /**
102
- * How long a notification should be displayed in milliseconds.
103
- * Use `0` for persistent (no auto-dismiss); call `client.notifications.remove(id)` to dismiss.
68
+ * Display time in ms. `0` is persistent: dismiss it with `client.notifications.remove(id)`.
69
+ * Defaults to the configured duration of the severity.
104
70
  */
105
71
  duration?: number;
106
72
  };
107
- /**
108
- * State shape for the notification store.
109
- *
110
- * @deprecated Use {@link NotificationManagerState} instead.
111
- */
73
+ /** @deprecated Use {@link NotificationManagerState} instead. */
112
74
  export type NotificationState = {
113
- /** Array of current notification objects. */
114
75
  notifications: Notification[];
115
76
  };
116
- /** State shape for the notification store */
117
77
  export type NotificationManagerState = NotificationState;
118
78
  export type NotificationSortComparator = (a: Notification, b: Notification) => number;
119
79
  export type NotificationManagerConfig = {