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,3 +1,4 @@
1
+ import type { AxiosRequestConfig } from 'axios';
1
2
  import type { StreamChat } from '../client';
2
3
  import type { LiveLocationManager, LiveLocationManagerConfig } from '../LiveLocationManager';
3
4
  import type { SearchController, SearchControllerConfig } from '../search/SearchController';
@@ -6,6 +7,7 @@ import type { MessageComposerConfig } from '../messageComposer/configuration/typ
6
7
  import type { Channel, ChannelConfig } from '../channel';
7
8
  import type { Thread, ThreadConfig } from '../thread';
8
9
  import type { ReminderManagerConfig } from '../reminders/ReminderManager';
10
+ import type { NotificationManager } from '../notifications/NotificationManager';
9
11
  import type { NotificationManagerConfig } from '../notifications/types';
10
12
  import type { MessageDeliveryReporterConfig } from '../messageDelivery/MessageDeliveryReporter';
11
13
  import type { ThreadManagerConfig } from '../thread_manager';
@@ -14,12 +16,8 @@ import type { MessageOperationsConfig } from '../messageOperations/MessageOperat
14
16
  import type { DeclarativePaginatorConfig as ImportedDeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
15
17
  import type { DeepPartial } from '../types.utility';
16
18
  /**
17
- * Maps a configuration key to the argument its setup function receives.
18
- *
19
- * A closed set, and deliberately not an `interface`: a type alias cannot be reached by module
20
- * augmentation, so the key space cannot be extended from outside this package. Configuration for a class
21
- * this package does not own belongs to whoever owns that class — a registry of its own, not a key in this
22
- * one, which the SDK could neither type nor apply.
19
+ * Maps a configuration key to the argument its setup function receives. A type alias, so the key space
20
+ * is closed to module augmentation.
23
21
  */
24
22
  export type InstanceSetupFunctionArgs = {
25
23
  channel: {
@@ -42,24 +40,16 @@ export type InstanceSetupFunctionArgs = {
42
40
  };
43
41
  };
44
42
  /**
45
- * The keys that take a **setup function** — every one names a class the setup function receives an
46
- * instance of.
47
- *
48
- * Closed, and not extensible: an undeclared string is a compile error, and {@link
49
- * InstanceSetupFunctionArgs} is a type alias rather than an interface, so a key cannot be added by module
50
- * augmentation either. This key space describes what *this package* configures.
51
- *
52
- * A strict subset of {@link InstanceConfigKey}: `messagePaginator` and `messageOperations` take
53
- * configuration but have no setup function, because they are not built one-per-key — a channel and every
54
- * one of its threads each own one.
43
+ * The keys that take a setup function. A strict subset of {@link InstanceConfigKey}: `messagePaginator`
44
+ * and `messageOperations` take configuration but no setup function, since a channel and each of its
45
+ * threads own one.
55
46
  */
56
47
  export type InstanceSetupKey = keyof InstanceSetupFunctionArgs;
57
48
  export type InstanceSetupFunctionArgsOf<K extends InstanceSetupKey> = InstanceSetupFunctionArgs[K];
58
49
  export type InstanceSetupTearDownFunction = () => void;
59
50
  /**
60
- * Runs against every instance of its class — those that already exist when it is registered, and
61
- * every one created afterwards. Return a function that undoes whatever you changed: it is invoked
62
- * before the setup function is re-applied, and when the instance is disposed of.
51
+ * Runs against every instance of its class, existing and future. Return a function that undoes what you
52
+ * changed: it runs before the setup function is re-applied and when the instance is disposed of.
63
53
  */
64
54
  export type InstanceSetupFunction<K extends InstanceSetupKey = InstanceSetupKey> = (args: InstanceSetupFunctionArgsOf<K>) => void | InstanceSetupTearDownFunction;
65
55
  export type InstanceSetupState<K extends InstanceSetupKey = InstanceSetupKey> = {
@@ -68,22 +58,14 @@ export type InstanceSetupState<K extends InstanceSetupKey = InstanceSetupKey> =
68
58
  /** Whether `jumpToTheFirstUnreadMessage` prefers the paginator's snapshot or the channel read state. */
69
59
  export type UnreadReferencePolicy = 'snapshot' | 'read-state-only';
70
60
  /**
71
- * Paginator fields settable through the declarative tree. Single source of truth lives with the
72
- * paginator itself (`DeclarativePaginatorConfig` in `BasePaginator`), so the tree and the paginator's
73
- * own `initializeConfig` can never accept different sets of fields.
74
- *
75
- * Deliberately excluded there:
76
- * - `itemIndex` / `createItemIndex` — an index instance and a factory, not configuration. Deep-merging
77
- * a class instance is unsound, and swapping an index would drop already-loaded items.
78
- * - `doRequest`, `itemOrderComparator`, `deriveCursor` — installed per paginator subclass
79
- * (`PinnedMessagePaginator` supplies all three). Replace them through a setup function, where the
80
- * existing value is visible and restorable.
81
- *
82
- * `initialCursor` and `initialOffset` are included but read only during construction — see
61
+ * Paginator fields settable through the declarative tree. Defined in `BasePaginator`, which excludes
62
+ * what is not plain configuration: `itemIndex` / `createItemIndex`, and the per-subclass `doRequest`,
63
+ * `itemOrderComparator` and `deriveCursor` (replace those through a setup function).
64
+ * `initialCursor` and `initialOffset` are read only during construction, see
83
65
  * {@link CONSTRUCTION_ONLY_CONFIG_PATHS}.
84
66
  */
85
67
  export type { DeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
86
- /** Adds the message-list-only unread reference policy, which is a constructor argument. */
68
+ /** Adds the message-list-only `unreadReferencePolicy`. */
87
69
  export type DeclarativeMessagePaginatorConfig = ImportedDeclarativePaginatorConfig & {
88
70
  unreadReferencePolicy?: UnreadReferencePolicy;
89
71
  };
@@ -112,96 +94,86 @@ export type ThreadDeclarativeConfig = {
112
94
  };
113
95
  export type ClientDeclarativeConfig = {
114
96
  /**
115
- * Nested rather than top-level keys: each of these managers has exactly one parent — the client — so
116
- * there is nothing to say once and reuse, which is what a top-level key buys (**DEC-25**).
97
+ * Silences the warning `connectUser` / `connectAnonymousUser` log when called server-side, where a
98
+ * connection counts towards MAU and concurrent-connection billing. Read on every connect.
117
99
  */
100
+ allowServerSideConnect?: boolean;
101
+ /**
102
+ * Axios request configuration (`timeout`, `headers`, `httpsAgent`, ...). Built into the client's axios
103
+ * instance once, at construction; `headers` and `params` are also read on every request. Copied when
104
+ * registered, so mutating the object afterwards has no effect.
105
+ */
106
+ axiosRequestConfig?: AxiosRequestConfig;
107
+ /** Base URL of the API, such as `https://chat-proxy-dublin.stream-io-api.com`. Read once. */
108
+ baseURL?: string;
109
+ /**
110
+ * Forces browser (`true`) or Node (`false`) mode; detected from the global `window` when absent. Read
111
+ * live, through `client.browser` and `client.node`.
112
+ */
113
+ browser?: boolean;
114
+ /**
115
+ * A pre-built {@link NotificationManager} to use instead of constructing one, to share it between
116
+ * clients or hand over one that already holds notifications. Read once, at construction. The
117
+ * `notifications` slice is still applied to it.
118
+ */
119
+ notificationManager?: NotificationManager;
120
+ /**
121
+ * When true, `client.user` is kept if `connectUser` fails, so an offline-capable app does not have to
122
+ * call `connectUser` again to retry. Read when a connect fails.
123
+ */
124
+ persistUserOnConnectionFailure?: boolean;
118
125
  connectionRecovery?: Partial<ConnectionRecoveryManagerConfig>;
119
126
  messageDelivery?: Partial<MessageDeliveryReporterConfig>;
120
127
  /**
121
- * Connection status — specifically, the platform listener that reports the device's network. There
122
- * is no default outside the browser, so this is how React Native and other hosts supply one.
123
- * `Partial`, not `DeepPartial`: the only field holds a function, which `DeepPartial` would descend
124
- * into.
128
+ * The platform listener that reports the device's network, which React Native and other hosts supply
129
+ * here. Defaults to browser events, else a reporter that mirrors the WebSocket. `Partial`, not
130
+ * `DeepPartial`: the only field holds a function, which `DeepPartial` would descend into.
125
131
  */
126
132
  networkConnection?: Partial<NetworkConnectionObserverConfig>;
127
133
  threads?: Partial<ThreadManagerConfig>;
128
- /**
129
- * The WebSocket's timing: connect timeout, ping interval, and the health-check grace period on top of it.
130
- * These three, and only these, because each was a public mutable field before it was configuration.
131
- * `Partial`, not `DeepPartial`: every field is a flat number.
132
- */
134
+ /** `Partial`, not `DeepPartial`: fields are flat or class instances, which it would descend into. */
133
135
  wsConnection?: Partial<WSConnectionConfig>;
134
136
  notifications?: DeepPartial<NotificationManagerConfig>;
135
137
  /**
136
138
  * `Partial`, not `DeepPartial`: `scheduledOffsetsMs` is a `number[]`, and `DeepPartial` would widen
137
- * its elements to `number | undefined`, which `ReminderManager.updateConfig` rightly rejects.
139
+ * its elements to `number | undefined`, which `ReminderManager.updateConfig` rejects.
138
140
  */
139
141
  reminders?: Partial<ReminderManagerConfig>;
140
142
  };
141
143
  /**
142
- * Maps a configuration key to its declarative configuration subtree. Augmentable alongside
143
- * {@link InstanceSetupFunctionArgs}, so a custom key gets declarative configuration on the same terms
144
- * as a built-in one.
145
- *
146
- * **When something gets its own key rather than being nested under a parent** — the rule that decides
147
- * the shape of this interface:
148
- *
149
- * - **One parent type ⇒ nest it.** `channel.pinnedMessagesPaginator`, `channel.cooldownTimer`, the
150
- * composer's own sub-managers. There is only one place it can be reached from.
151
- * - **Several parent types, and the configuration means the same thing under each ⇒ own key.**
152
- * `MessageComposer` hangs off a `Channel`, a `Thread`, *and* a message (the React SDK builds
153
- * message-scoped composers for editing). `drafts.enabled` means the same in all three, so nesting it
154
- * under `channel` would silently miss two thirds of the composers.
155
- * - **Several parent types, but the configuration is inherently parent-specific ⇒ nest it anyway.**
156
- * No built-in falls here today. It is kept as a case because it is the one that decides against a shared
157
- * key, and the next entity to arrive may need it.
158
- * - **Several parent types, mixed ⇒ both.** A shared top-level key for what means the same thing, plus
159
- * per-parent paths that override it field by field (see {@link mergeDeclarativeMessageOperationsConfig}).
160
- * Both shared keys are here: `MessagePaginator` backs the channel message list *and* thread replies
161
- * (`stateThrottleMs` / `retryCount` have no reason to differ, `pageSize` legitimately does), and
162
- * `MessageOperations` backs channel *and* thread sends. `messageOperations` was briefly nested under
163
- * `channel` on the reasoning that a channel send and a thread reply are different operations — which made
164
- * `thread.messageOperations` unconfigurable entirely (**DV-15**). Counting parents is the check.
144
+ * Maps a configuration key to its declarative configuration subtree. A class with one parent type is
145
+ * nested under that parent. A class held by several parents (`MessageComposer`, `MessagePaginator`,
146
+ * `MessageOperations`) gets its own shared key, and where parents need to differ they override it per
147
+ * field (see {@link mergeDeclarativeMessageOperationsConfig}).
165
148
  */
166
149
  export type InstanceConfigTree = {
167
150
  channel: ChannelDeclarativeConfig;
168
151
  client: ClientDeclarativeConfig;
169
152
  /**
170
- * Constructed by whoever needs it — the React SDK's `useLiveLocationSharingManager`, or an app
171
- * directly — never by this package. It reaches its configuration the way a `MessageComposer` does, by
172
- * registering itself against this key, so its owner does not have to thread a slice through.
153
+ * Constructed by the integrator or a UI SDK, never by this package. It reaches its configuration by
154
+ * registering itself against this key.
173
155
  */
174
156
  liveLocationManager: Partial<LiveLocationManagerConfig>;
175
157
  messageComposer: DeepPartial<MessageComposerConfig>;
176
158
  /**
177
- * Applies to **every** `MessageOperations` — the channel's and every thread's, since messages are sent
178
- * from both. `channel.messageOperations` and `thread.messageOperations` override it per parent.
159
+ * Applies to every `MessageOperations`, the channel's and each thread's.
160
+ * `channel.messageOperations` and `thread.messageOperations` override it per parent.
179
161
  */
180
162
  messageOperations: Partial<MessageOperationsConfig>;
181
163
  /**
182
- * Applies to **every** `MessagePaginator` — the channel message list and thread replies alike.
164
+ * Applies to every `MessagePaginator`, the channel message list and thread replies alike.
183
165
  * `channel.messagePaginator` and `thread.messagePaginator` override it per parent.
184
- *
185
- * `channel.pinnedMessagesPaginator` is deliberately **not** included: it has a single parent, so by
186
- * the rule above it stays nested. It is also a different class (`PinnedMessagePaginator`, with its own
187
- * ordering and endpoint) rather than a `MessagePaginator`.
166
+ * `channel.pinnedMessagesPaginator` is not included: it is a different class with a single parent.
188
167
  */
189
168
  messagePaginator: DeclarativeMessagePaginatorConfig;
190
169
  /**
191
- * Same story as {@link InstanceConfigTree.liveLocationManager}, with one caveat: a `SearchController`
192
- * only reaches this key when it was constructed with a `client` — it is the one configurable class the
193
- * SDK does not hand a client to. See `SearchControllerOptions.client`.
170
+ * Like {@link InstanceConfigTree.liveLocationManager}, but a `SearchController` reaches this key only
171
+ * when constructed with a `client` (see `SearchControllerOptions.client`).
194
172
  */
195
173
  searchController: Partial<SearchControllerConfig>;
196
174
  thread: ThreadDeclarativeConfig;
197
175
  };
198
- /**
199
- * Every key that takes **declarative configuration** — {@link InstanceSetupKey} plus the two that are
200
- * configuration-only.
201
- *
202
- * Closed for the same reason, and {@link InstanceConfigTree} is likewise a type alias, so this set is
203
- * fixed by the package.
204
- */
176
+ /** Every key that takes declarative configuration: {@link InstanceSetupKey} plus the config-only ones. */
205
177
  export type InstanceConfigKey = keyof InstanceConfigTree;
206
178
  export type InstanceConfigOf<K extends InstanceConfigKey> = InstanceConfigTree[K];
207
179
  export type InstanceConfigState<K extends InstanceConfigKey = InstanceConfigKey> = {
@@ -4,55 +4,33 @@ import type { DeepPartial } from '../../types.utility';
4
4
  import type { Unsubscribe } from '@stream-io/state-store';
5
5
  /** @internal */
6
6
  export type ApplyInstanceConfigurationParams<K extends InstanceSetupKey> = {
7
- /** The instance's argument for its setup function — `{ channel }`, `{ composer }`, and so on. */
7
+ /** The instance's argument for its setup function, such as `{ channel }`. */
8
8
  args: InstanceSetupFunctionArgsOf<K>;
9
- /** The client's configuration registry, i.e. `client.config`. */
10
9
  config: InstanceConfigurationRegistry;
11
10
  key: K;
12
11
  /**
13
- * Other keys this instance derives from. `Channel` and `Thread` both read the shared `messagePaginator`
14
- * and `messageOperations` keys, so a change there has to re-run this instance's own cycle rather than
15
- * only re-deriving: re-deriving alone would drop the setup function's overrides, since tier 2 is
16
- * applied after tier 1.
17
- *
18
- * Keys rather than stores, which buys two things beyond brevity. The instance is registered as a
19
- * live instance of each, so `hasLiveInstances` is true for a shared key and its construction-only paths get
20
- * same late-registration warning the per-parent slices already got. And there is no longer a structural
21
- * store type needed to work around `StateStore`'s invariance.
12
+ * Other keys this instance derives from (`Channel` and `Thread` read `messagePaginator` and
13
+ * `messageOperations`). A change there re-runs the whole cycle, so the setup function is re-applied
14
+ * over the new values. The instance is also registered as live under each.
22
15
  */
23
16
  alsoWatch?: readonly InstanceConfigKey[];
24
17
  /**
25
- * Applies a declarative configuration slice to the instance. Omit it if the instance has no
26
- * declarative surface and only wants the setup function.
27
- *
28
- * Called on every cycle, **including when this key has no configuration of its own** — an instance may
29
- * derive from other inputs too (`alsoWatch`, or the server), so it has to be told to re-derive rather
30
- * than being skipped. Hence the optional argument.
18
+ * Applies the declarative slice to the instance. Omit it if the instance only wants the setup function.
19
+ * Called on every cycle, with `undefined` when the key has no configuration, since the instance may
20
+ * derive from other inputs too.
31
21
  */
32
22
  applyConfig?: (config?: DeepPartial<InstanceConfigOf<K>>) => void;
33
23
  /**
34
- * The instance's own `initializeConfig`, bound. Invoked by `config.reset()` after both slots are
35
- * cleared, so the instance re-derives its configuration from current inputs. Omit it to get
36
- * clear-registrations-only reset semantics.
24
+ * The instance's `initializeConfig`, bound. `reset` calls it after clearing both slots. Without it,
25
+ * reset only clears registrations.
37
26
  */
38
27
  reinitializeConfig?: () => void;
39
28
  };
40
29
  /**
41
- * Subscribes one instance to the configuration registered for its key, and returns the unsubscribe.
42
- *
43
- * This is the single place the *subscription* semantics live, so every configured instance behaves
44
- * identically:
45
- *
46
- * - applies whatever is already registered, immediately;
47
- * - re-applies on every change to either slot, declarative configuration first and the setup function
48
- * second, so a setup function always wins for the same field;
49
- * - runs the previous setup function's teardown before re-applying, and again on unsubscribe;
50
- * - contains errors — a throwing setup function, teardown or applier is logged and never propagates,
51
- * so it cannot break `client.channelManager.ensure()` or a `Thread` construction.
52
- *
53
- * Not exported from the package. It only does anything for a key in {@link InstanceSetupKey}, and those
54
- * keys all belong to classes this package constructs, so there is no caller outside it. `ConfigController`
55
- * _is_ exported, because resolution is reusable on its own — see `docs/instance-configuration.md` §6.
30
+ * Subscribes one instance to the configuration registered for its key and returns the unsubscribe.
31
+ * Applies what is registered immediately, then on every change: declarative configuration first and the
32
+ * setup function second (so it wins), running the previous teardown before each re-apply and on
33
+ * unsubscribe. A throwing setup function, teardown or applier is logged, never propagated.
56
34
  *
57
35
  * @internal
58
36
  */
@@ -1 +1,9 @@
1
+ /**
2
+ * Copies a caller-supplied configuration patch so the stored value shares no mutable object with the
3
+ * caller (`mergeWith` reuses source subtrees verbatim). Plain objects and arrays are copied; everything
4
+ * else (functions, `Date`s, class instances) passes through by reference. Not `structuredClone`, which
5
+ * throws on the functions configuration holds. Cycles terminate and shared references stay shared.
6
+ *
7
+ * @internal
8
+ */
1
9
  export declare const copyConfigPatch: <T>(value: T) => T;
@@ -1,24 +1,13 @@
1
1
  import type { DeclarativePaginatorConfig } from '../../pagination/paginators/BasePaginator';
2
2
  import type { MessageOperationsConfig } from '../../messageOperations/MessageOperations';
3
3
  import type { DeclarativeMessagePaginatorConfig } from '../types';
4
- /** Layers `channel.messageOperations` / `thread.messageOperations` over the shared `messageOperations` key. */
4
+ /** Layers a per-parent `messageOperations` slice (channel or thread) over the shared key. */
5
5
  export declare const mergeDeclarativeMessageOperationsConfig: (general?: Partial<MessageOperationsConfig>, specific?: Partial<MessageOperationsConfig>) => Partial<MessageOperationsConfig> | undefined;
6
- /** Layers `channel.messagePaginator` / `thread.messagePaginator` over the shared `messagePaginator` key. */
6
+ /** Layers a per-parent `messagePaginator` slice (channel or thread) over the shared key. */
7
7
  export declare const mergeDeclarativePaginatorConfig: (general?: DeclarativeMessagePaginatorConfig, specific?: DeclarativeMessagePaginatorConfig) => DeclarativeMessagePaginatorConfig | undefined;
8
8
  /**
9
- * Drops the construction-only arguments from a message-paginator slice, leaving only what is actually
10
- * paginator *configuration*.
11
- *
12
- * `unreadReferencePolicy` rides in the same subtree for the integrator's convenience, but it is not a
13
- * `BasePaginatorConfig` field — `MessagePaginator` reads it once into a private member. Passed through to
14
- * `initializeConfig` it landed in the published `config` as an untyped key that nothing reads, and a
15
- * registration arriving after construction made resolved configuration *contradict* behaviour: the
16
- * construction-only warning correctly said the value would not apply, and then
17
- * `paginator.config.unreadReferencePolicy` reported it as though it had. A settings UI reading resolved
18
- * config showed `read-state-only` for a paginator behaving as `snapshot`.
19
- *
20
- * So the owning `Channel` / `Thread` splits the slice: the constructor argument goes to the constructor,
21
- * and only this half reaches the paginator's configuration. Both already read the policy separately, so
22
- * nothing is lost.
9
+ * Drops `unreadReferencePolicy` from a message-paginator slice. `MessagePaginator` reads it once as a
10
+ * constructor argument, so leaving it in would make the resolved `config` report a value that does not
11
+ * apply.
23
12
  */
24
13
  export declare const toDeclarativePaginatorConfig: (slice?: DeclarativeMessagePaginatorConfig) => DeclarativePaginatorConfig | undefined;
@@ -1,21 +1,7 @@
1
1
  /**
2
- * Recursively freezes a package-level default configuration object.
3
- *
4
- * **Why a runtime guard rather than a type.** Resolved configuration is built by deep-merging over these
5
- * constants, and the merge only *copies* a subtree that some layer actually touches — so a subtree nobody
6
- * configured stays identical by reference to the module-level default, and is reachable through the
7
- * instance's public `config` getter. A write through it therefore changed the default for every instance
8
- * of every client in the process, including ones created afterwards. `Readonly<T>` cannot catch that: it
9
- * is shallow, so it rejects `config.pageSize = 5` but accepts `config.drafts.enabled = true` — and the
10
- * nested form is the one that reaches shared state. In ESM, which is always strict, a write to a frozen
11
- * object throws a `TypeError` at the offending line instead of silently succeeding somewhere else.
12
- *
13
- * Deliberately lives in its own module rather than `src/utils.ts`: that barrel is `vi.mock`ed wholesale by
14
- * some suites, and a default-config constant must not depend on which of its exports a test happens to
15
- * stub.
16
- *
17
- * Functions are frozen as values but not walked — a function's `prototype` is not configuration. Freezing
18
- * is idempotent and stops at anything already frozen, so shared sub-configs cost one visit.
2
+ * Recursively freezes a package-level default configuration. Resolved config shares untouched subtrees
3
+ * with these defaults, so an unfrozen nested write through `config` would change them for every instance
4
+ * in the process (`Readonly<T>` is shallow and cannot catch it). Functions are left as they are.
19
5
  *
20
6
  * @internal
21
7
  */
@@ -1,40 +1,20 @@
1
1
  import type { DeepPartial } from '../../types.utility';
2
2
  /**
3
- * The fields a server decides for some configurable object — a partial configuration holding *only* those
4
- * fields, with the value the server currently reports.
5
- *
6
- * Only server-decided fields may appear. The merge below lets any scalar on this side win, so an
7
- * unrelated field smuggled in here would override the caller's value while looking like a server
8
- * restriction.
3
+ * The fields a server decides, with the values it reports. Include only those: a non-boolean scalar
4
+ * here overrides the caller's, and a boolean is ANDed with it.
9
5
  */
10
6
  export type ServerRestrictions<TConfig extends object> = DeepPartial<TConfig>;
11
7
  /**
12
- * Numeric ceilings the server imposes — a partial configuration holding only fields where the server states
13
- * a *maximum*, such as a channel type's `max_message_length`.
14
- *
15
- * Separate from {@link ServerRestrictions} because the two combine differently, and putting a ceiling in the
16
- * wrong bucket is a silent bug rather than a type error: a restriction *replaces* the requested value, which
17
- * for a limit would widen a caller who deliberately asked for something stricter.
8
+ * Fields where the server states a maximum (e.g. `max_message_length`). Separate from
9
+ * {@link ServerRestrictions} because a restriction replaces the value, which would widen a stricter
10
+ * caller.
18
11
  */
19
12
  export type ServerUpperBounds<TConfig extends object> = DeepPartial<TConfig>;
20
13
  /**
21
- * Applies a server's restrictions to a configuration a caller asked for, so the result never claims more
22
- * than the server allows.
23
- *
24
- * **Why this is a named function rather than an inline merge.** It has to run on *every* route by which a
25
- * configuration can change — construction, the declarative tree, a setup function, a direct
26
- * `updateConfig` — because a restriction applied only at construction holds until the first time anything
27
- * updates the configuration and then silently stops holding. `MessageComposer` learned this the hard way:
28
- * only its `deriveConfig` applied the restrictions, so registering `location.enabled: true` on a running
29
- * app widened past a `shared_locations: false` server and produced a composer offering a feature the API
30
- * rejects (**DV-16**).
31
- *
32
- * **What it deliberately does not do.** It knows nothing about *where* restrictions come from. Reading
33
- * them is the entity's job, because only the entity knows what to ask — a composer reads its channel's
34
- * `serverConfig`, something else might read capabilities — and the answer depends on an instance that
35
- * exists. That is also why this does not live in `InstanceConfigurationRegistry`: that service merges
36
- * declarative layers before any instance exists, and its merges follow the opposite rule (a more specific
37
- * layer *may* re-enable what a broader one disabled), which rule 1 would break.
14
+ * Applies server restrictions to a requested configuration, so the result never claims more than the
15
+ * server allows. Call it on every route that changes a configuration (construction, declarative tree,
16
+ * setup function, `updateConfig`), or the restrictions stop holding at the first update. Reading the
17
+ * restrictions is the entity's job.
38
18
  *
39
19
  * @example
40
20
  * ```ts
@@ -1,66 +1,44 @@
1
1
  /**
2
- * Holds the connection id — the WebSocket's, or the long-poll's after an `enableWSFallback`
3
- * switch — and lets callers await one that is still being negotiated.
2
+ * Holds the connection ID (the WebSocket's, or the long-poll's after an `enableWSFallback` switch)
3
+ * and lets callers await one that is still being negotiated.
4
4
  *
5
- * The server keys channel watches and presence subscriptions by connection id, and answers `200`
6
- * while registering nothing when a request that needs one arrives without it. Requests carrying such
7
- * a subscription therefore have to wait for the handshake — see `requiresConnectionId` in
8
- * `api-client.ts` for which those are.
5
+ * The server keys channel watches and presence subscriptions by connection ID and answers `200`
6
+ * while registering nothing when a request that needs one carries none (see `requiresConnectionId`
7
+ * in `api-client.ts`), so such requests wait for the handshake. The ID lives only here, so a
8
+ * replaced socket cannot leave a stale copy behind.
9
9
  *
10
- * The id lives here and nowhere else. A copy kept on the socket outlives the socket it belongs to,
11
- * and a copy in `client.wsConnection.state` cannot be invalidated by a socket that has already been
12
- * replaced; either way requests go out keyed to a connection the server has torn down. The long-poll
13
- * keeps no copy either: `WSConnection.disconnect()` reads the id before the socket's `disconnect()`
14
- * drops it, and hands it to the long-poll's close.
15
- *
16
- * {@link StableWSConnection} drives the lifecycle: {@link arm} before a socket opens,
17
- * {@link resolveConnectionId} on the hello frame, {@link invalidate} when it drops or is closed
18
- * deliberately, {@link rejectConnectionId} when a reconnect gives up. After an `enableWSFallback`
19
- * switch, `WSConnectionFallback` drives it the same way instead.
10
+ * Driven by {@link StableWSConnection}, or by `WSConnectionFallback` after a fallback switch.
20
11
  */
21
12
  export declare class ConnectionIdManager {
22
13
  connectionId?: string;
23
14
  loadConnectionIdPromise?: Promise<string>;
24
15
  private resolve?;
25
16
  private reject?;
26
- /**
27
- * Arms the deferred a connection attempt will settle, so requests issued while the handshake is in
28
- * flight have something to await.
29
- */
17
+ /** Creates the deferred a connection attempt settles, so mid-handshake requests can await it. */
30
18
  arm: () => void;
31
19
  /**
32
- * Publishes the id the server answered the handshake with, releasing anything waiting on one.
20
+ * Publishes the ID from the `connection.ok` event and releases anything waiting on one.
33
21
  *
34
- * @param connectionId - The connection id carried by the `connection.ok` event.
22
+ * @param connectionId - The connection ID carried by the `connection.ok` event.
35
23
  */
36
24
  resolveConnectionId: (connectionId: string) => void;
37
25
  /**
38
- * Fails anything waiting on an id, for a connection attempt that will not be retried.
26
+ * Rejects pending waiters, for a connection attempt that will not be retried.
39
27
  *
40
28
  * @param reason - The error to reject pending waiters with.
41
29
  */
42
30
  rejectConnectionId: (reason: unknown) => void;
43
- /**
44
- * Drops the id without failing anything waiting on one, for a socket that died but will be
45
- * retried. Arming a fresh deferred is what makes those requests wait for the reconnect rather than
46
- * race ahead with a dead id.
47
- */
31
+ /** Drops the ID for a socket that died but will be retried. New requests wait for the reconnect. */
48
32
  invalidate: () => void;
49
- /**
50
- * Drops the id and fails any pending waiter, for a socket closed deliberately. The id is dead from
51
- * that moment, and a request keyed by it would register a subscription on a connection that no
52
- * longer exists.
53
- */
33
+ /** Drops the ID and rejects any pending waiter with a "connection closed" error. */
54
34
  reset: () => void;
55
35
  /**
56
- * The current id, or a promise for one while the handshake is in flight.
57
- *
58
- * Throws when there is neither, because no amount of waiting would produce one: no socket is open
59
- * and none is being opened.
36
+ * Returns the connection ID, waiting for the handshake when one is in flight.
60
37
  *
61
- * @param signal - Abandons the wait when the caller abandons the request it is waiting to issue.
62
- * Only the waiting path honours it; an id already in hand is returned either way, and the
63
- * request layer aborts the call itself.
38
+ * @param signal - Abandons the wait. Only the waiting path honours it; an ID already in hand is
39
+ * returned either way.
40
+ * @returns The current connection ID, or a promise for it while the handshake is in flight.
41
+ * @throws When no socket is open or being opened.
64
42
  */
65
43
  getConnectionId: (signal?: AbortSignal) => string | Promise<string>;
66
44
  private settle;