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
@@ -1,15 +1,11 @@
1
1
  import type { Event, EventType } from './types';
2
2
  import type { KeysOfUnion, ValueOfUnion } from './types.utility';
3
3
  import type { Unsubscribe } from '@stream-io/state-store';
4
+ type EventObject = Extract<Event, object>;
4
5
  /**
5
- * Flat routing view of an event: every field any event can carry, all optional, on one object.
6
- *
7
- * Handlers route without narrowing, which `Event` does not allow — it is a discriminated union whose
8
- * `{ type: '*' } & CustomEvent` member has none of the channel fields, and it admits bare custom-event
9
- * strings (hence the `unknown` hop in `processOne`). Derived from that union, so a new generated field
10
- * is routable without widening anything by hand.
6
+ * Flat view of an event for routing without narrowing: every field any `Event` member can carry,
7
+ * all optional. Derived from the `Event` union, so new generated fields are routable automatically.
11
8
  */
12
- type EventObject = Extract<Event, object>;
13
9
  export type PipelineEvent = {
14
10
  type: EventType | (string & {});
15
11
  } & {
@@ -51,50 +47,34 @@ export declare class EventHandlerPipeline<CTX extends Record<string, unknown> =
51
47
  get size(): number;
52
48
  findIndex({ handler, idMatch }: FindEventHandlerParams<CTX>): number;
53
49
  /**
54
- * Insert a handler into the pipeline at the given index.
50
+ * Inserts a handler into the pipeline. With `replace` and an in-bounds index it overwrites the
51
+ * handler there instead.
55
52
  *
56
- * - If `replace` is `true` and the index is within bounds, the existing handler
57
- * at that position will be replaced by the new one.
58
- * - If `revertOnUnsubscribe` is also `true`, then calling the returned
59
- * unsubscribe will both remove the inserted handler *and* restore the
60
- * previously replaced handler at the same index.
61
- * - If `replace` is `false` (default), the new handler is inserted at the index
62
- * (or appended if the index is greater than the pipeline size). Unsubscribe
63
- * will only remove this handler.
64
- *
65
- * @param payload - Insertion options.
66
53
  * @param payload.handle - The handler function to insert.
67
- * @param payload.index - Target index in the pipeline (clamped to valid range).
68
- * @param payload.replace - If true, replace existing handler at index instead of inserting.
69
- * @param payload.revertOnUnsubscribe - If true, restore the replaced handler when unsubscribing.
70
- * @returns An unsubscribe function that removes (and optionally restores) the handler.
54
+ * @param payload.id - The handler ID. Defaults to a generated UUID.
55
+ * @param payload.index - Target index, clamped to the pipeline size. Defaults to appending.
56
+ * @param payload.replace - Whether to replace the handler at `index` instead of inserting.
57
+ * @param payload.revertOnUnsubscribe - Whether unsubscribing restores the replaced handler.
58
+ * @returns An unsubscribe function that removes the handler and, with `revertOnUnsubscribe`, puts
59
+ * back the one it replaced.
71
60
  */
72
61
  insert({ handle, id, index, replace, revertOnUnsubscribe, }: InsertEventHandlerPayload<CTX>): Unsubscribe;
73
62
  /**
74
- * Remove handler by:
75
- * - handler function identity or
76
- * - by id that could be an exact match or
77
- * - match by regexp.
63
+ * Removes every matching handler.
78
64
  *
79
- * @param params - {FindEventHandlerParams}
65
+ * @param params - Matches by handler function identity, exact ID or ID regexp.
80
66
  */
81
67
  remove(params: FindEventHandlerParams<CTX>): void;
82
68
  replaceAll(handlers: LabeledEventHandler<CTX>[]): void;
83
69
  clear(): void;
84
70
  /**
85
- * Queue an event for processing. Events are processed serially, in the order
86
- * `run` is called. Returns a promise that resolves/rejects for this specific
87
- * event’s processing, while the internal chain continues (errors won’t break it).
71
+ * Queues an event. Events are processed serially in call order. The promise settles for this
72
+ * event only, a rejection does not break the queue.
88
73
  */
89
74
  run(event: Event, ctx: CTX): Promise<void>;
90
- /**
91
- * Wait until all queued events have been processed.
92
- */
75
+ /** Resolves once all queued events have been processed. */
93
76
  drain(): Promise<void>;
94
- /**
95
- * Process a single event through a stable snapshot of handlers to avoid
96
- * mid-iteration mutations (insert/remove) affecting this run.
97
- */
77
+ /** Runs the event through a snapshot of the handlers, so mid-run changes do not affect it. */
98
78
  private processOne;
99
79
  }
100
80
  export {};
@@ -1,12 +1,7 @@
1
1
  /**
2
- * RULES:
3
- *
4
- * 1. one loc-sharing message per channel per user
5
- * 2. live location is intended to be per device, but `created_by_device_id` is set once
6
- * when the share is created and cannot be reassigned — `UpdateLiveLocationRequest` has no
7
- * device field at all, by design. Any of the user's devices can therefore push coordinate
8
- * updates to the same share, which makes location sharing effectively per user and
9
- * channel rather than per device.
2
+ * One live-location sharing message per channel per user. `created_by_device_id` is set at creation
3
+ * and cannot be reassigned (`UpdateLiveLocationRequest` has no device field), so any of the user's
4
+ * devices can update the same share: sharing is effectively per user and channel.
10
5
  */
11
6
  import { StateStore } from '@stream-io/state-store';
12
7
  import { WithSubscriptions } from './utils/WithSubscriptions';
@@ -30,14 +25,12 @@ export type LiveLocationManagerConstructorParameters = {
30
25
  getDeviceId: DeviceIdGenerator;
31
26
  watchLocation: WatchLocation;
32
27
  };
28
+ /** Default of `minUpdateThrottleMs`, in milliseconds. */
33
29
  export declare const UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT = 3000;
34
30
  export type LiveLocationManagerConfig = {
35
31
  /**
36
- * Shortest gap between live-location update requests (defaults to 3000ms).
37
- *
38
- * A failsafe against rate limiting, not a protocol limit: integrators already control the update
39
- * cadence through a custom `watchLocation`, and this floor stops a chatty one from flooding the API.
40
- * Raising it is always safe; lowering it risks 429s, so only do so against a known quota.
32
+ * Shortest gap between live-location update requests in milliseconds. Defaults to 3000. A
33
+ * failsafe against rate limiting for a chatty custom `watchLocation`; lowering it risks 429s.
41
34
  */
42
35
  minUpdateThrottleMs: number;
43
36
  };
@@ -48,54 +41,37 @@ export declare class LiveLocationManager extends WithSubscriptions {
48
41
  private getDeviceId;
49
42
  private _deviceId;
50
43
  private watchLocation;
51
- /** The shared configuration machinery — see {@link ConfigController}. */
52
44
  private readonly configController;
53
- /** Teardown for this manager's configuration subscription, released by {@link dispose}. */
54
45
  private unsubscribeConfiguration?;
55
- /**
56
- * Resolved configuration, as a store — the shape every configurable class exposes
57
- * (`configState` / `config` / `updateConfig`).
58
- */
59
46
  get configState(): StateStore<LiveLocationManagerConfig>;
60
47
  static symbol: symbol;
61
48
  constructor({ client, getDeviceId, watchLocation, }: LiveLocationManagerConstructorParameters);
62
- /**
63
- * Subscribes this instance to the `'liveLocationManager'` configuration key, if it is not subscribed
64
- * already. Idempotent, which is what lets both the constructor and {@link registerSubscriptions} call
65
- * it: the first gives a value registered before `init()` resolves somewhere to land, the second brings
66
- * a manager back after {@link dispose}.
67
- */
49
+ /** Subscribes to the `'liveLocationManager'` configuration key. Idempotent. */
68
50
  private subscribeConfiguration;
69
- /** The current resolved configuration. `Readonly` — change it through {@link updateConfig}. */
70
51
  get config(): Readonly<LiveLocationManagerConfig>;
71
- /** Merges a partial configuration into the resolved config and notifies subscribers. */
52
+ /**
53
+ * Merges a partial configuration into the resolved config.
54
+ *
55
+ * @param config - Fields to merge into the resolved config.
56
+ */
72
57
  updateConfig(config: Partial<LiveLocationManagerConfig>): void;
73
- /** Rebuilds the resolved configuration from package defaults plus the declarative slice. */
58
+ /**
59
+ * Re-derives the configuration from the declarative slice.
60
+ *
61
+ * @param config - The declarative slice. Leave it out to rebuild from the defaults.
62
+ */
74
63
  initializeConfig(config?: Partial<LiveLocationManagerConfig>): void;
75
64
  init(): Promise<void>;
76
65
  registerSubscriptions: () => void;
77
66
  /**
78
- * Ref-counted, and deliberately does **not** touch the configuration subscription: several callers can
79
- * share one manager, so an early caller leaving must not take anything the remaining ones still need.
80
- * Use {@link dispose} for the instance-level teardown.
67
+ * Releases the event subscriptions once the last caller unregisters (ref-counted). The
68
+ * configuration subscription is in effect from construction and stays until {@link dispose}.
81
69
  */
82
70
  unregisterSubscriptions: () => symbol;
83
71
  /**
84
72
  * Releases the configuration subscription, running the `'liveLocationManager'` setup function's
85
- * teardown. Call it when you are finished with the manager.
86
- *
87
- * Separate from {@link unregisterSubscriptions} because the two have different lifetimes. Event
88
- * subscriptions are shared and ref-counted; configuration is registered once, by the constructor, for
89
- * the life of the instance. Releasing it from the ref-counted call meant the first of two callers to
90
- * leave silently stopped a still-live manager from tracking `client.config` — permanently, since
91
- * nothing but the constructor registers it. Mirrors `SearchController.dispose` and the configuration
92
- * half of `Channel.disconnect`.
93
- *
94
- * Until this is called, the client's configuration registry holds a handle to this manager, so a
95
- * long-lived client and many short-lived managers need it to be called.
96
- *
97
- * Recoverable: a later {@link registerSubscriptions} re-subscribes, so disposing a manager that is
98
- * then reused costs a re-run of the setup function rather than silence.
73
+ * teardown. Call it when finished with the manager: until then the client's configuration
74
+ * registry holds a handle to it. A later {@link registerSubscriptions} re-subscribes.
99
75
  */
100
76
  dispose: () => void;
101
77
  get messages(): Map<string, ScheduledLiveLocationSharing>;
@@ -105,11 +81,7 @@ export declare class LiveLocationManager extends WithSubscriptions {
105
81
  private subscribeTargetMessagesChange;
106
82
  private subscribeWatchLocation;
107
83
  private subscribeLiveLocationSharingUpdates;
108
- /**
109
- * Arms the stop-sharing timer, stepping when the expiry is beyond `MAX_TIMEOUT_MS` (~24.9 days).
110
- * A share of any length is valid — only a minimum duration is enforced — and scheduling one in a
111
- * single call was clamped to 1 ms, unregistering it immediately.
112
- */
84
+ /** Arms the stop-sharing timer, in steps past `MAX_TIMEOUT_MS` (~24.9 days). */
113
85
  private scheduleStopSharing;
114
86
  private registerMessage;
115
87
  private unregisterMessages;
@@ -6,11 +6,9 @@ export declare class ApiClient {
6
6
  constructor(client?: StreamChat);
7
7
  _getToken(): string | undefined;
8
8
  /**
9
- * The transport of the generated API classes, which return what it resolves to as-is: the
10
- * response body with the request's `metadata` merged in.
11
- *
12
- * `async` so that a synchronous throw here (URL resolution, form encoding) still reaches the
13
- * caller as a rejection - the generated methods return this promise without awaiting it.
9
+ * The transport of the generated API classes. Resolves to the response body with the request's
10
+ * `metadata` merged in. `async` so synchronous throws (URL resolution, form encoding) become
11
+ * rejections.
14
12
  */
15
13
  sendRequest<T>(method: Method, url: string, pathParams?: Record<string, string>, queryParams?: Record<string, unknown>, body?: unknown, requestContentType?: string, options?: StreamRequestOptions): Promise<StreamResponse<T>>;
16
14
  doAxiosRequest<T>(type: string, url: string, data?: unknown, options?: AxiosRequestConfig): Promise<T>;
@@ -25,15 +23,12 @@ export declare class ApiClient {
25
23
  private _doRequest;
26
24
  }
27
25
  /**
28
- * Whether a request registers a server-side subscription, and so must not be sent before the
29
- * handshake has produced a connection id: one with a `watch` or `presence` flag set.
26
+ * Whether a request (one with a `watch` or `presence` flag) registers a server-side subscription
27
+ * and so must wait for the connection ID. Without it the server answers `200` but registers
28
+ * nothing, and the channel never receives an event.
30
29
  *
31
- * The server keys watches and presence by that id and answers `200` while registering nothing when it
32
- * is missing, so a request that races the handshake yields a channel that never receives an event.
33
- *
34
- * The two generated operations that declare `connection_id` without a flag set it themselves:
35
- * `stopWatchingChannel` through `StreamChat`'s override, and `longPoll`'s endpoint through the
36
- * long-poll fallback. `test/unit/codegen/connectionIdEndpoints.test.ts` pins that set, so a new one
37
- * surfaces there.
30
+ * Flagless operations that declare `connection_id` set it themselves (`stopWatchingChannel` through
31
+ * `StreamChat`'s override, `longPoll` through the fallback); `connectionIdEndpoints.test.ts` pins
32
+ * that set.
38
33
  */
39
34
  export declare const requiresConnectionId: (params: Record<string, unknown> | undefined, body: unknown) => boolean;