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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/README.md +11 -8
  2. package/dist/cjs/index.browser.js +15397 -12090
  3. package/dist/cjs/index.browser.js.map +4 -4
  4. package/dist/cjs/index.node.js +15349 -11991
  5. package/dist/cjs/index.node.js.map +4 -4
  6. package/dist/esm/index.mjs +15164 -11880
  7. package/dist/esm/index.mjs.map +4 -4
  8. package/dist/types/ChannelManager.d.ts +246 -6
  9. package/dist/types/CooldownTimer.d.ts +22 -8
  10. package/dist/types/EventHandlerPipeline.d.ts +12 -16
  11. package/dist/types/LiveLocationManager.d.ts +69 -6
  12. package/dist/types/api-client.d.ts +22 -9
  13. package/dist/types/channel.d.ts +550 -300
  14. package/dist/types/channel_state.d.ts +167 -22
  15. package/dist/types/client.d.ts +325 -305
  16. package/dist/types/configuration/ConfigController.d.ts +172 -0
  17. package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +192 -0
  18. package/dist/types/configuration/index.d.ts +3 -0
  19. package/dist/types/configuration/keys.d.ts +31 -0
  20. package/dist/types/configuration/shape.d.ts +58 -0
  21. package/dist/types/configuration/types.d.ts +206 -50
  22. package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +59 -0
  23. package/dist/types/configuration/utils/copyConfigPatch.d.ts +1 -0
  24. package/dist/types/configuration/utils/declarativeSlices.d.ts +24 -0
  25. package/dist/types/configuration/utils/deepFreezeConfig.d.ts +22 -0
  26. package/dist/types/configuration/utils/index.d.ts +1 -0
  27. package/dist/types/configuration/utils/serverAuthority.d.ts +49 -0
  28. package/dist/types/connection/ConnectionIdManager.d.ts +67 -0
  29. package/dist/types/connection/ConnectionRecoveryManager.d.ts +164 -0
  30. package/dist/types/connection/index.d.ts +4 -0
  31. package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +153 -0
  32. package/dist/types/connection/networkConnection/index.d.ts +3 -0
  33. package/dist/types/connection/networkConnection/reporters.d.ts +43 -0
  34. package/dist/types/connection/networkConnection/types.d.ts +55 -0
  35. package/dist/types/connection/wsConnection/StableWSConnection.d.ts +204 -0
  36. package/dist/types/connection/wsConnection/WSConnection.d.ts +168 -0
  37. package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +55 -0
  38. package/dist/types/connection/wsConnection/config.d.ts +51 -0
  39. package/dist/types/connection/wsConnection/index.d.ts +4 -0
  40. package/dist/types/connection/wsConnection/types.d.ts +99 -0
  41. package/dist/types/constants.d.ts +3 -1
  42. package/dist/types/entityStore/EntityStore.d.ts +160 -40
  43. package/dist/types/entityStore/StoreBackedItemIndex.d.ts +48 -29
  44. package/dist/types/entityStore/index.d.ts +0 -1
  45. package/dist/types/errors.d.ts +24 -4
  46. package/dist/types/formatMessageMemo.d.ts +5 -0
  47. package/dist/types/gen/chat/ChannelApi.d.ts +51 -23
  48. package/dist/types/gen/chat/ChatApi.d.ts +215 -168
  49. package/dist/types/gen/models/index.d.ts +2164 -557
  50. package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
  51. package/dist/types/gen/moderation/ModerationApi.d.ts +39 -32
  52. package/dist/types/gen-imports.d.ts +1 -0
  53. package/dist/types/index.d.ts +20 -7
  54. package/dist/types/languageNames.d.ts +97 -0
  55. package/dist/types/logger.d.ts +1 -1
  56. package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
  57. package/dist/types/messageComposer/LocationComposer.d.ts +10 -4
  58. package/dist/types/messageComposer/attachmentIdentity.d.ts +11 -0
  59. package/dist/types/messageComposer/attachmentManager.d.ts +48 -10
  60. package/dist/types/messageComposer/attachmentUtils.d.ts +34 -0
  61. package/dist/types/messageComposer/configuration/commands.configuration.d.ts +1 -3
  62. package/dist/types/messageComposer/configuration/configuration.d.ts +9 -1
  63. package/dist/types/messageComposer/configuration/index.d.ts +0 -1
  64. package/dist/types/messageComposer/configuration/types.d.ts +57 -1
  65. package/dist/types/messageComposer/index.d.ts +1 -0
  66. package/dist/types/messageComposer/linkPreviewsManager.d.ts +10 -4
  67. package/dist/types/messageComposer/messageComposer.d.ts +210 -14
  68. package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +20 -1
  69. package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +11 -0
  70. package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +2 -2
  71. package/dist/types/messageComposer/middleware/pollComposer/index.d.ts +1 -0
  72. package/dist/types/messageComposer/middleware/pollComposer/state.d.ts +3 -2
  73. package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +9 -2
  74. package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +44 -0
  75. package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +2 -2
  76. package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +94 -229
  77. package/dist/types/messageComposer/pollComposer.d.ts +8 -3
  78. package/dist/types/messageComposer/textComposer.d.ts +9 -1
  79. package/dist/types/messageComposer/types.d.ts +7 -3
  80. package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +64 -8
  81. package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +48 -11
  82. package/dist/types/messageOperations/FailedSendCache.d.ts +34 -0
  83. package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +52 -6
  84. package/dist/types/messageOperations/MessageOperations.d.ts +94 -11
  85. package/dist/types/{entityStore → messageOperations}/applyReactionLocally.d.ts +8 -2
  86. package/dist/types/messageOperations/createMessageOperations.d.ts +11 -0
  87. package/dist/types/messageOperations/index.d.ts +7 -1
  88. package/dist/types/messageOperations/reflectReactionEvent.d.ts +24 -0
  89. package/dist/types/messageOperations/sendOrdering.d.ts +17 -0
  90. package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +28 -0
  91. package/dist/types/messageOperations/types.d.ts +66 -1
  92. package/dist/types/middleware.d.ts +8 -0
  93. package/dist/types/moderation.d.ts +18 -4
  94. package/dist/types/notifications/NotificationManager.d.ts +43 -2
  95. package/dist/types/notifications/types.d.ts +55 -42
  96. package/dist/types/offline-support/offline_support_api.d.ts +128 -12
  97. package/dist/types/offline-support/offline_sync_manager.d.ts +26 -5
  98. package/dist/types/offline-support/queueableOperations.d.ts +106 -0
  99. package/dist/types/offline-support/types.d.ts +77 -28
  100. package/dist/types/pagination/FilterBuilder.d.ts +1 -18
  101. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -1
  102. package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +21 -3
  103. package/dist/types/pagination/filterCompiler.d.ts +5 -0
  104. package/dist/types/pagination/paginators/BasePaginator.d.ts +331 -7
  105. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +54 -11
  106. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +283 -66
  107. package/dist/types/pagination/paginators/MessagePaginator.d.ts +10 -9
  108. package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +17 -1
  109. package/dist/types/pagination/paginators/ReminderPaginator.d.ts +8 -8
  110. package/dist/types/pagination/paginators/ThreadPaginator.d.ts +57 -0
  111. package/dist/types/pagination/paginators/index.d.ts +1 -0
  112. package/dist/types/pagination/utility.normalization.d.ts +29 -2
  113. package/dist/types/poll.d.ts +41 -14
  114. package/dist/types/poll_manager.d.ts +3 -2
  115. package/dist/types/poll_optimistic_votes.d.ts +61 -0
  116. package/dist/types/reminders/Reminder.d.ts +17 -7
  117. package/dist/types/reminders/ReminderManager.d.ts +34 -6
  118. package/dist/types/search/BaseSearchSource.d.ts +50 -25
  119. package/dist/types/search/ChannelMemberSearchSource.d.ts +11 -6
  120. package/dist/types/search/ChannelSearchSource.d.ts +27 -5
  121. package/dist/types/search/MessageSearchSource.d.ts +36 -6
  122. package/dist/types/search/SearchController.d.ts +44 -11
  123. package/dist/types/search/UserSearchSource.d.ts +11 -5
  124. package/dist/types/search/types.d.ts +14 -1
  125. package/dist/types/signing.d.ts +0 -157
  126. package/dist/types/thread.d.ts +118 -62
  127. package/dist/types/thread_manager.d.ts +124 -35
  128. package/dist/types/token_manager.d.ts +5 -8
  129. package/dist/types/types.d.ts +138 -562
  130. package/dist/types/types.utility.d.ts +8 -0
  131. package/dist/types/upload-utils.d.ts +20 -0
  132. package/dist/types/uploadManager.d.ts +50 -2
  133. package/dist/types/utils/FixedSizeQueueCache.d.ts +2 -0
  134. package/dist/types/utils/WithSubscriptions.d.ts +1 -1
  135. package/dist/types/utils/objectPath.d.ts +49 -0
  136. package/dist/types/utils/time.d.ts +85 -0
  137. package/dist/types/utils.d.ts +63 -40
  138. package/package.json +22 -33
  139. package/src/ChannelManager.ts +561 -109
  140. package/src/CooldownTimer.ts +55 -45
  141. package/src/EventHandlerPipeline.ts +13 -23
  142. package/src/LiveLocationManager.ts +191 -37
  143. package/src/api-client.ts +144 -53
  144. package/src/channel.ts +1573 -1050
  145. package/src/channel_state.ts +239 -129
  146. package/src/client.ts +843 -892
  147. package/src/client_state.ts +2 -2
  148. package/src/configuration/ConfigController.ts +298 -0
  149. package/src/configuration/InstanceConfigurationRegistry.ts +430 -0
  150. package/src/configuration/index.ts +7 -0
  151. package/src/configuration/keys.ts +86 -0
  152. package/src/configuration/shape.ts +776 -0
  153. package/src/configuration/types.ts +218 -60
  154. package/src/configuration/utils/applyInstanceConfiguration.ts +184 -0
  155. package/src/configuration/utils/copyConfigPatch.ts +61 -0
  156. package/src/configuration/utils/declarativeSlices.ts +81 -0
  157. package/src/configuration/utils/deepFreezeConfig.ts +33 -0
  158. package/src/configuration/utils/index.ts +5 -0
  159. package/src/configuration/utils/serverAuthority.ts +146 -0
  160. package/src/connection/ConnectionIdManager.ts +153 -0
  161. package/src/connection/ConnectionRecoveryManager.ts +371 -0
  162. package/src/connection/index.ts +4 -0
  163. package/src/connection/networkConnection/NetworkConnectionObserver.ts +281 -0
  164. package/src/connection/networkConnection/index.ts +3 -0
  165. package/src/connection/networkConnection/reporters.ts +85 -0
  166. package/src/connection/networkConnection/types.ts +60 -0
  167. package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +242 -151
  168. package/src/connection/wsConnection/WSConnection.ts +345 -0
  169. package/src/connection/wsConnection/WSConnectionFallback.ts +259 -0
  170. package/src/connection/wsConnection/config.ts +108 -0
  171. package/src/connection/wsConnection/index.ts +4 -0
  172. package/src/connection/wsConnection/types.ts +101 -0
  173. package/src/constants.ts +5 -3
  174. package/src/entityStore/EntityStore.ts +350 -10
  175. package/src/entityStore/StoreBackedItemIndex.ts +66 -37
  176. package/src/entityStore/index.ts +0 -1
  177. package/src/errors.ts +40 -7
  178. package/src/formatMessageMemo.ts +23 -0
  179. package/src/gen/chat/ChannelApi.ts +230 -44
  180. package/src/gen/chat/ChatApi.ts +1047 -1745
  181. package/src/gen/models/index.ts +2378 -3721
  182. package/src/gen/models/timestamp-guard.ts +27 -0
  183. package/src/gen/moderation/ModerationApi.ts +218 -388
  184. package/src/gen-imports.ts +1 -0
  185. package/src/index.ts +82 -6
  186. package/src/languageNames.ts +103 -0
  187. package/src/logger.ts +1 -1
  188. package/src/messageComposer/CustomDataManager.ts +10 -1
  189. package/src/messageComposer/LocationComposer.ts +68 -20
  190. package/src/messageComposer/attachmentIdentity.ts +39 -0
  191. package/src/messageComposer/attachmentManager.ts +191 -68
  192. package/src/messageComposer/attachmentUtils.ts +58 -0
  193. package/src/messageComposer/configuration/commands.configuration.ts +1 -26
  194. package/src/messageComposer/configuration/configuration.ts +22 -3
  195. package/src/messageComposer/configuration/index.ts +0 -1
  196. package/src/messageComposer/configuration/types.ts +58 -1
  197. package/src/messageComposer/index.ts +1 -0
  198. package/src/messageComposer/linkPreviewsManager.ts +16 -10
  199. package/src/messageComposer/messageComposer.ts +487 -98
  200. package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
  201. package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +58 -33
  202. package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +7 -2
  203. package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +3 -2
  204. package/src/messageComposer/middleware/messageComposer/attachments.ts +98 -1
  205. package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +20 -10
  206. package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
  207. package/src/messageComposer/middleware/messageComposer/types.ts +2 -7
  208. package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +11 -6
  209. package/src/messageComposer/middleware/pollComposer/index.ts +1 -0
  210. package/src/messageComposer/middleware/pollComposer/state.ts +43 -11
  211. package/src/messageComposer/middleware/pollComposer/types.ts +9 -2
  212. package/src/messageComposer/middleware/pollComposer/validation.ts +76 -0
  213. package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -2
  214. package/src/messageComposer/middleware/textComposer/commands.ts +1 -2
  215. package/src/messageComposer/middleware/textComposer/mentions.ts +91 -39
  216. package/src/messageComposer/pollComposer.ts +11 -3
  217. package/src/messageComposer/textComposer.ts +36 -4
  218. package/src/messageComposer/types.ts +19 -14
  219. package/src/messageDelivery/MessageDeliveryReporter.ts +154 -53
  220. package/src/messageDelivery/MessageReceiptsTracker.ts +136 -64
  221. package/src/messageOperations/FailedSendCache.ts +90 -0
  222. package/src/messageOperations/MessageOperationStatePolicy.ts +269 -27
  223. package/src/messageOperations/MessageOperations.ts +340 -136
  224. package/src/{entityStore → messageOperations}/applyReactionLocally.ts +10 -3
  225. package/src/messageOperations/createMessageOperations.ts +192 -0
  226. package/src/messageOperations/index.ts +7 -0
  227. package/src/messageOperations/reflectReactionEvent.ts +51 -0
  228. package/src/messageOperations/sendOrdering.ts +28 -0
  229. package/src/messageOperations/settlePendingAttachmentUploads.ts +110 -0
  230. package/src/messageOperations/types.ts +74 -0
  231. package/src/middleware.ts +11 -0
  232. package/src/moderation.ts +47 -24
  233. package/src/notifications/NotificationManager.ts +73 -3
  234. package/src/notifications/configuration.ts +10 -8
  235. package/src/notifications/types.ts +58 -42
  236. package/src/offline-support/offline_support_api.ts +380 -197
  237. package/src/offline-support/offline_sync_manager.ts +105 -32
  238. package/src/offline-support/queueableOperations.ts +270 -0
  239. package/src/offline-support/types.ts +85 -39
  240. package/src/pagination/FilterBuilder.ts +1 -22
  241. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +11 -7
  242. package/src/pagination/cursorDerivation/linearPaginationFlags.ts +25 -7
  243. package/src/pagination/filterCompiler.ts +17 -0
  244. package/src/pagination/paginators/BasePaginator.ts +731 -81
  245. package/src/pagination/paginators/ChannelPaginator.ts +210 -102
  246. package/src/pagination/paginators/MessageIntervalPaginator.ts +703 -193
  247. package/src/pagination/paginators/MessagePaginator.ts +45 -36
  248. package/src/pagination/paginators/PinnedMessagePaginator.ts +74 -28
  249. package/src/pagination/paginators/ReminderPaginator.ts +15 -13
  250. package/src/pagination/paginators/ThreadPaginator.ts +181 -0
  251. package/src/pagination/paginators/UserGroupPaginator.ts +8 -1
  252. package/src/pagination/paginators/index.ts +1 -0
  253. package/src/pagination/utility.normalization.ts +37 -9
  254. package/src/poll.ts +189 -112
  255. package/src/poll_manager.ts +14 -8
  256. package/src/poll_optimistic_votes.ts +335 -0
  257. package/src/reminders/Reminder.ts +34 -16
  258. package/src/reminders/ReminderManager.ts +68 -41
  259. package/src/reminders/ReminderTimer.ts +7 -6
  260. package/src/search/BaseSearchSource.ts +133 -40
  261. package/src/search/ChannelMemberSearchSource.ts +27 -18
  262. package/src/search/ChannelSearchSource.ts +61 -7
  263. package/src/search/MessageSearchSource.ts +133 -28
  264. package/src/search/SearchController.ts +93 -16
  265. package/src/search/UserSearchSource.ts +27 -13
  266. package/src/search/types.ts +14 -1
  267. package/src/signing.ts +1 -315
  268. package/src/thread.ts +503 -511
  269. package/src/thread_manager.ts +339 -204
  270. package/src/token_manager.ts +12 -32
  271. package/src/types.ts +159 -780
  272. package/src/types.utility.ts +14 -0
  273. package/src/upload-utils.ts +53 -0
  274. package/src/uploadManager.ts +85 -7
  275. package/src/utils/FixedSizeQueueCache.ts +5 -0
  276. package/src/utils/WithSubscriptions.ts +1 -1
  277. package/src/utils/objectPath.ts +67 -0
  278. package/src/utils/time.ts +104 -0
  279. package/src/utils.ts +209 -157
  280. package/dist/types/base64.d.ts +0 -2
  281. package/dist/types/configuration/InstanceConfigurationService.d.ts +0 -26
  282. package/dist/types/connection.d.ts +0 -146
  283. package/dist/types/connection_fallback.d.ts +0 -42
  284. package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
  285. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
  286. package/dist/types/insights.d.ts +0 -58
  287. package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
  288. package/dist/types/permissions.d.ts +0 -55
  289. package/dist/types/store.d.ts +0 -125
  290. package/src/base64.ts +0 -78
  291. package/src/configuration/InstanceConfigurationService.ts +0 -73
  292. package/src/connection_fallback.ts +0 -215
  293. package/src/gen/model-decoders/decoders.ts +0 -2680
  294. package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
  295. package/src/insights.ts +0 -83
  296. package/src/pagination/utility.queryChannel.ts +0 -84
  297. package/src/permissions.ts +0 -102
  298. package/src/store.ts +0 -304
@@ -0,0 +1,776 @@
1
+ import type {
2
+ ConnectionRecoveryManagerConfig,
3
+ NetworkConnectionObserverConfig,
4
+ WSConnectionConfig,
5
+ } from '../connection';
6
+ import type {
7
+ ChannelDeclarativeConfig,
8
+ ClientDeclarativeConfig,
9
+ DeclarativeMessagePaginatorConfig,
10
+ InstanceConfigTree,
11
+ ThreadDeclarativeConfig,
12
+ } from './types';
13
+ import type { DeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
14
+ import type { MessageOperationsConfig } from '../messageOperations/MessageOperations';
15
+ import type { MessageDeliveryReporterConfig } from '../messageDelivery/MessageDeliveryReporter';
16
+ import type { ThreadManagerConfig } from '../thread_manager';
17
+
18
+ import type { LiveLocationManagerConfig } from '../LiveLocationManager';
19
+ import type { SearchControllerConfig } from '../search/SearchController';
20
+ import type { NotificationManagerConfig } from '../notifications/types';
21
+ import type { ReminderManagerConfig } from '../reminders/ReminderManager';
22
+ import type {
23
+ AttachmentManagerConfig,
24
+ CommandsConfig,
25
+ DraftsConfiguration,
26
+ LinkPreviewsManagerConfig,
27
+ LocationComposerConfig,
28
+ MessageComposerConfig,
29
+ PollComposerConfig,
30
+ TextComposerConfig,
31
+ } from '../messageComposer/configuration/types';
32
+
33
+ /**
34
+ * What a configuration value holds. `'object'` covers anything whose interior is not described further
35
+ * — a map of handler functions, a cursor — and tells a caller not to expect editable leaves inside.
36
+ */
37
+ export type ConfigValueType =
38
+ | 'boolean'
39
+ | 'enum'
40
+ | 'function'
41
+ | 'number'
42
+ | 'number[]'
43
+ | 'object'
44
+ | 'string'
45
+ | 'string[]';
46
+
47
+ export type ConfigValueNode = {
48
+ /** One line on what the value does. This is the payload a settings UI or a JS caller reads. */
49
+ description: string;
50
+ /** The permitted values, for `type: 'enum'` only. */
51
+ enumValues?: readonly string[];
52
+ kind: 'value';
53
+ /**
54
+ * `'function'` marks a path the declarative tree cannot carry: JSON has no functions, so these are
55
+ * reachable only through a setup function or a direct `updateConfig` call.
56
+ */
57
+ type: ConfigValueType;
58
+ };
59
+
60
+ export type ConfigGroupNode = {
61
+ description: string;
62
+ fields: ConfigShape;
63
+ kind: 'group';
64
+ };
65
+
66
+ export type ConfigNode = ConfigGroupNode | ConfigValueNode;
67
+
68
+ export type ConfigShape = { readonly [field: string]: ConfigNode };
69
+
70
+ /**
71
+ * The declarative paginator knobs, shared by every paginator path in the tree.
72
+ *
73
+ * Annotated as `Record<keyof …>` rather than left to inference, which is the whole point: adding a field
74
+ * to `DeclarativePaginatorConfig` fails the build here until it is described. Same guard as
75
+ * `INSTANCE_CONFIG_TREE_KEY_PRESENCE` uses for the top-level keys.
76
+ */
77
+ /**
78
+ * `maxLoadedItems` is excluded here and documented only under {@link MESSAGE_PAGINATOR_FIELDS}: the
79
+ * type allows it on any paginator, but a bounded window only makes sense for a message list — that is
80
+ * the only paginator whose declarative config reaches it, and the only one whose pruned items can be
81
+ * fetched back by cursor.
82
+ */
83
+ const PAGINATOR_FIELDS: Record<
84
+ Exclude<keyof DeclarativePaginatorConfig, 'maxLoadedItems'>,
85
+ ConfigNode
86
+ > = {
87
+ debounceMs: {
88
+ description:
89
+ 'Delay before a queued page request fires, collapsing rapid scrolling into one query.',
90
+ kind: 'value',
91
+ type: 'number',
92
+ },
93
+ hasPaginationQueryShapeChanged: {
94
+ description:
95
+ 'Decides whether a new query is different enough to discard loaded pages rather than append to them.',
96
+ kind: 'value',
97
+ type: 'function',
98
+ },
99
+ initialCursor: {
100
+ description:
101
+ 'Cursor the first page is fetched from. Read once, when the paginator is built.',
102
+ kind: 'value',
103
+ type: 'object',
104
+ },
105
+ initialOffset: {
106
+ description: 'Offset the first page is fetched from, for offset-based sources.',
107
+ kind: 'value',
108
+ type: 'number',
109
+ },
110
+ lockItemOrder: {
111
+ description:
112
+ 'Keeps loaded items in their current order instead of re-sorting when an item is updated.',
113
+ kind: 'value',
114
+ type: 'boolean',
115
+ },
116
+ pageSize: {
117
+ description:
118
+ 'Items requested per page. The effective default differs per paginator — the channel message list asks for more than the base default.',
119
+ kind: 'value',
120
+ type: 'number',
121
+ },
122
+ retryCount: {
123
+ description: 'Retries attempted for a failed page request before the error surfaces.',
124
+ kind: 'value',
125
+ type: 'number',
126
+ },
127
+ stateThrottleMs: {
128
+ description:
129
+ 'Shortest gap between state publications, so a burst of events becomes a couple of renders rather than one per event.',
130
+ kind: 'value',
131
+ type: 'number',
132
+ },
133
+ throwErrors: {
134
+ description:
135
+ 'Rethrows a failed page request instead of only recording it in the paginator state.',
136
+ kind: 'value',
137
+ type: 'boolean',
138
+ },
139
+ };
140
+
141
+ const MESSAGE_PAGINATOR_FIELDS: Record<
142
+ keyof DeclarativeMessagePaginatorConfig,
143
+ ConfigNode
144
+ > = {
145
+ ...PAGINATOR_FIELDS,
146
+ maxLoadedItems: {
147
+ description:
148
+ 'Caps how many messages stay loaded. Past it the oldest are dropped as new ones arrive, and scrolling back re-fetches them. Unset means unbounded. Values below the page size are raised to it.',
149
+ kind: 'value',
150
+ type: 'number',
151
+ },
152
+ unreadReferencePolicy: {
153
+ description:
154
+ "'snapshot' freezes the unread divider where the user opened the channel until it is explicitly cleared; 'read-state-only' follows the server read state, so the divider moves as messages are marked read.",
155
+ enumValues: ['snapshot', 'read-state-only'],
156
+ kind: 'value',
157
+ type: 'enum',
158
+ },
159
+ };
160
+
161
+ const MESSAGE_OPERATIONS_FIELDS: Record<keyof MessageOperationsConfig, ConfigNode> = {
162
+ failedSendCacheMaxSize: {
163
+ description: 'Failed sends kept for retry; the oldest is evicted past this.',
164
+ kind: 'value',
165
+ type: 'number',
166
+ },
167
+ failedSendCacheTtlMs: {
168
+ description: 'How long a failed send stays retryable.',
169
+ kind: 'value',
170
+ type: 'number',
171
+ },
172
+ };
173
+
174
+ const REQUEST_HANDLERS_NODE: ConfigValueNode = {
175
+ description:
176
+ 'Overrides for the API calls this entity makes. Functions, so they travel through a setup function rather than the declarative tree.',
177
+ kind: 'value',
178
+ type: 'function',
179
+ };
180
+
181
+ const paginatorGroup = (description: string): ConfigGroupNode => ({
182
+ description,
183
+ fields: PAGINATOR_FIELDS,
184
+ kind: 'group',
185
+ });
186
+
187
+ const messagePaginatorGroup = (description: string): ConfigGroupNode => ({
188
+ description,
189
+ fields: MESSAGE_PAGINATOR_FIELDS,
190
+ kind: 'group',
191
+ });
192
+
193
+ const messageOperationsGroup = (description: string): ConfigGroupNode => ({
194
+ description,
195
+ fields: MESSAGE_OPERATIONS_FIELDS,
196
+ kind: 'group',
197
+ });
198
+
199
+ // ---------------------------------------------------------------------------
200
+ // messageComposer
201
+ // ---------------------------------------------------------------------------
202
+
203
+ const ATTACHMENTS_FIELDS: Record<keyof AttachmentManagerConfig, ConfigNode> = {
204
+ enabled: {
205
+ description:
206
+ 'Offers file attachments in the composer. The server must also allow them per channel type (`uploads`), and a server "no" wins.',
207
+ kind: 'value',
208
+ type: 'boolean',
209
+ },
210
+ acceptedFiles: {
211
+ description:
212
+ 'File types offered in the file picker, as extensions or MIME patterns. Empty means no restriction.',
213
+ kind: 'value',
214
+ type: 'string[]',
215
+ },
216
+ customCdn: {
217
+ description:
218
+ "Whether a custom upload request stores files somewhere Stream does not host. Left false — the default — files are treated as reaching Stream, so Stream's `uploads` flag and `upload-file` capability apply.",
219
+ kind: 'value',
220
+ type: 'boolean',
221
+ },
222
+ doUploadRequest: {
223
+ description: 'Replaces the built-in upload request with your own.',
224
+ kind: 'value',
225
+ type: 'function',
226
+ },
227
+ fileUploadFilter: {
228
+ description: 'Rejects selected files before they are uploaded.',
229
+ kind: 'value',
230
+ type: 'function',
231
+ },
232
+ maxNumberOfFilesPerMessage: {
233
+ description: 'Attachments allowed on a single message.',
234
+ kind: 'value',
235
+ type: 'number',
236
+ },
237
+ pendingUploadsEnabled: {
238
+ description:
239
+ 'Lets a message be sent while its attachments are still uploading. The message appears immediately and the request waits for the uploads; one failed upload fails the message.',
240
+ kind: 'value',
241
+ type: 'boolean',
242
+ },
243
+ trackUploadProgress: {
244
+ description:
245
+ 'Reports upload progress on each attachment. Turning it off skips the progress bookkeeping.',
246
+ kind: 'value',
247
+ type: 'boolean',
248
+ },
249
+ };
250
+
251
+ const COMMANDS_FIELDS: Record<keyof CommandsConfig, ConfigNode> = {
252
+ sendValidator: {
253
+ description: 'Decides whether a message carrying a slash command may be sent.',
254
+ kind: 'value',
255
+ type: 'function',
256
+ },
257
+ };
258
+
259
+ const DRAFTS_FIELDS: Record<keyof DraftsConfiguration, ConfigNode> = {
260
+ enabled: {
261
+ description: 'Stores unsent composer content as a draft on the server.',
262
+ kind: 'value',
263
+ type: 'boolean',
264
+ },
265
+ };
266
+
267
+ const LINK_PREVIEWS_FIELDS: Record<keyof LinkPreviewsManagerConfig, ConfigNode> = {
268
+ debounceURLEnrichmentMs: {
269
+ description: 'Delay after typing stops before URLs in the message are enriched.',
270
+ kind: 'value',
271
+ type: 'number',
272
+ },
273
+ enabled: {
274
+ description: 'Turns URL enrichment and link previews in the composer on.',
275
+ kind: 'value',
276
+ type: 'boolean',
277
+ },
278
+ findURLFn: {
279
+ description: 'Finds the URLs in the composed text that should be enriched.',
280
+ kind: 'value',
281
+ type: 'function',
282
+ },
283
+ onLinkPreviewDismissed: {
284
+ description: 'Runs when a link preview is dismissed.',
285
+ kind: 'value',
286
+ type: 'function',
287
+ },
288
+ };
289
+
290
+ const LOCATION_FIELDS: Record<keyof LocationComposerConfig, ConfigNode> = {
291
+ enabled: {
292
+ description:
293
+ 'Offers location sharing in the composer. The server must also allow it per channel type (`shared_locations`), and a server "no" wins.',
294
+ kind: 'value',
295
+ type: 'boolean',
296
+ },
297
+ getDeviceId: {
298
+ description: 'Supplies a stable identifier for the device sharing the location.',
299
+ kind: 'value',
300
+ type: 'function',
301
+ },
302
+ minShareDurationMs: {
303
+ description:
304
+ 'Shortest live-location duration treated as valid. A shorter one makes the composed location invalid rather than being clamped.',
305
+ kind: 'value',
306
+ type: 'number',
307
+ },
308
+ };
309
+
310
+ const TEXT_FIELDS: Record<keyof TextComposerConfig, ConfigNode> = {
311
+ defaultValue: {
312
+ description: 'Text the composer starts with.',
313
+ kind: 'value',
314
+ type: 'string',
315
+ },
316
+ enabled: {
317
+ description:
318
+ 'Accepts text input. Turning it off disables input, change and selection events.',
319
+ kind: 'value',
320
+ type: 'boolean',
321
+ },
322
+ maxLengthOnEdit: {
323
+ description:
324
+ "Longest text accepted while editing an existing message. Capped by the channel type's `max_message_length`: a smaller value here wins, a larger one is lowered to the server's.",
325
+ kind: 'value',
326
+ type: 'number',
327
+ },
328
+ maxLengthOnSend: {
329
+ description:
330
+ "Longest text accepted when sending a new message. Capped by the channel type's `max_message_length`: a smaller value here wins, a larger one is lowered to the server's. Unset means the server's maximum applies.",
331
+ kind: 'value',
332
+ type: 'number',
333
+ },
334
+ publishTypingEvents: {
335
+ description:
336
+ 'Emits typing events as the user types. Off by default for threads and message editing.',
337
+ kind: 'value',
338
+ type: 'boolean',
339
+ },
340
+ };
341
+
342
+ const POLLS_FIELDS: Record<keyof PollComposerConfig, ConfigNode> = {
343
+ enabled: {
344
+ description:
345
+ 'Offers poll creation in the composer. The server must also allow it per channel type (`polls`), and a server "no" wins.',
346
+ kind: 'value',
347
+ type: 'boolean',
348
+ },
349
+ };
350
+
351
+ const MESSAGE_COMPOSER_FIELDS: Record<keyof MessageComposerConfig, ConfigNode> = {
352
+ attachments: {
353
+ description: 'Uploads and the file picker.',
354
+ fields: ATTACHMENTS_FIELDS,
355
+ kind: 'group',
356
+ },
357
+ commands: {
358
+ description: 'Slash-command validation.',
359
+ fields: COMMANDS_FIELDS,
360
+ kind: 'group',
361
+ },
362
+ drafts: { description: 'Server-side drafts.', fields: DRAFTS_FIELDS, kind: 'group' },
363
+ linkPreviews: {
364
+ description: 'URL enrichment and link previews.',
365
+ fields: LINK_PREVIEWS_FIELDS,
366
+ kind: 'group',
367
+ },
368
+ location: {
369
+ description: 'Static and live location sharing.',
370
+ fields: LOCATION_FIELDS,
371
+ kind: 'group',
372
+ },
373
+ polls: {
374
+ description: 'Poll creation.',
375
+ fields: POLLS_FIELDS,
376
+ kind: 'group',
377
+ },
378
+ retainCompositionOnSubmit: {
379
+ description:
380
+ "Decides whether submitting keeps the composer's contents instead of clearing them. Retains for a poll message by default.",
381
+ kind: 'value',
382
+ type: 'function',
383
+ },
384
+ text: { description: 'The text input itself.', fields: TEXT_FIELDS, kind: 'group' },
385
+ };
386
+
387
+ // ---------------------------------------------------------------------------
388
+ // client
389
+ // ---------------------------------------------------------------------------
390
+
391
+ const MESSAGE_DELIVERY_FIELDS: Record<keyof MessageDeliveryReporterConfig, ConfigNode> = {
392
+ markAsDeliveredBufferTimeoutMs: {
393
+ description: 'How long delivery reports are buffered before being sent as one batch.',
394
+ kind: 'value',
395
+ type: 'number',
396
+ },
397
+ markAsReadThrottleTimeoutMs: {
398
+ description:
399
+ 'Shortest gap between automatic markRead calls. Read once, when the throttle is built.',
400
+ kind: 'value',
401
+ type: 'number',
402
+ },
403
+ maxDeliveredMessageCountInPayload: {
404
+ description:
405
+ 'Delivery receipts sent in a single request; the remainder is carried to the next one.',
406
+ kind: 'value',
407
+ type: 'number',
408
+ },
409
+ retryCountLimitForTimeoutIncrease: {
410
+ description: 'Consecutive timeouts before the buffer window is widened.',
411
+ kind: 'value',
412
+ type: 'number',
413
+ },
414
+ };
415
+
416
+ const THREAD_MANAGER_FIELDS: Record<keyof ThreadManagerConfig, ConfigNode> = {
417
+ connectionRecoveryThrottleMs: {
418
+ description:
419
+ 'Shortest gap between thread-list reloads triggered by connection recovery. Applies from the next registerSubscriptions().',
420
+ kind: 'value',
421
+ type: 'number',
422
+ },
423
+ };
424
+
425
+ const LIVE_LOCATION_MANAGER_FIELDS: Record<keyof LiveLocationManagerConfig, ConfigNode> =
426
+ {
427
+ minUpdateThrottleMs: {
428
+ description:
429
+ 'Shortest gap between live-location update requests, in milliseconds. A rate-limit failsafe — raising it is always safe, lowering it risks 429s.',
430
+ kind: 'value',
431
+ type: 'number',
432
+ },
433
+ };
434
+
435
+ const SEARCH_CONTROLLER_FIELDS: Record<keyof SearchControllerConfig, ConfigNode> = {
436
+ keepSingleActiveSource: {
437
+ description:
438
+ 'Keeps exactly one search source active at a time, rather than letting several run together.',
439
+ kind: 'value',
440
+ type: 'boolean',
441
+ },
442
+ };
443
+
444
+ const NOTIFICATION_FIELDS: Record<keyof NotificationManagerConfig, ConfigNode> = {
445
+ durations: {
446
+ description:
447
+ 'How long a notification stays up, in milliseconds, per severity: error, warning, info, success.',
448
+ kind: 'value',
449
+ type: 'object',
450
+ },
451
+ sortComparator: {
452
+ description: 'Orders the notifications shown at once.',
453
+ kind: 'value',
454
+ type: 'function',
455
+ },
456
+ };
457
+
458
+ const REMINDER_FIELDS: Record<keyof ReminderManagerConfig, ConfigNode> = {
459
+ scheduledOffsetsMs: {
460
+ description:
461
+ 'Offsets from now offered when scheduling a reminder, in milliseconds — the "in 30 minutes / tomorrow" choices.',
462
+ kind: 'value',
463
+ type: 'number[]',
464
+ },
465
+ stopTimerRefreshBoundaryMs: {
466
+ description:
467
+ 'How far ahead a reminder must be before its refresh timer stops running; beyond this it is refreshed on demand instead.',
468
+ kind: 'value',
469
+ type: 'number',
470
+ },
471
+ };
472
+
473
+ const CONNECTION_RECOVERY_FIELDS: Record<
474
+ keyof ConnectionRecoveryManagerConfig,
475
+ ConfigNode
476
+ > = {
477
+ enabled: {
478
+ description:
479
+ 'Whether the client recovers its own state on reconnect. Turn it off only if the application re-queries and re-watches everything on screen itself.',
480
+ kind: 'value',
481
+ type: 'boolean',
482
+ },
483
+ };
484
+
485
+ const NETWORK_CONNECTION_FIELDS: Record<
486
+ keyof NetworkConnectionObserverConfig,
487
+ ConfigNode
488
+ > = {
489
+ statusReporter: {
490
+ description:
491
+ "The platform listener that reports the device's network status. A browser reporter is installed automatically; everywhere else a stand-in mirrors the WebSocket until a real one is supplied, so React Native should still install its own.",
492
+ kind: 'value',
493
+ type: 'function',
494
+ },
495
+ };
496
+
497
+ const WS_CONNECTION_FIELDS: Record<keyof WSConnectionConfig, ConfigNode> = {
498
+ connection: {
499
+ description:
500
+ 'A pre-built `StableWSConnection` to use instead of constructing one. A test seam; `client.config.reset()` discards it and the next connect builds a real socket. Was `StreamChatOptions.wsConnection`.',
501
+ kind: 'value',
502
+ type: 'object',
503
+ },
504
+ connectTimeoutMs: {
505
+ description:
506
+ "How long `connect()` waits for the server's hello before giving up. The default of 15s allows between two and three attempts of the underlying retry. Was `client.defaultWSTimeout`.",
507
+ kind: 'value',
508
+ type: 'number',
509
+ },
510
+ enableWSFallback: {
511
+ description:
512
+ 'Falls back to HTTP long-polling (`/api/v2/longpoll`) when the WebSocket cannot connect, for networks that block WebSockets. The WebSocket connects within `connectTimeoutMs`, as without the flag; lower it to switch sooner. Dispatches `connection.fallback_activated` when it switches, and stays on long-poll from then on. Defaults to `false`. Was `StreamChatOptions.enableWSFallback`.',
513
+ kind: 'value',
514
+ type: 'boolean',
515
+ },
516
+ offlineNotificationDisplayDelayMs: {
517
+ description:
518
+ 'How long a drop must last before a UI reports it. Most drops resolve in under a second, so a banner showing all of them makes a working application look broken. Nothing in this package waits on it: it is here so the UI SDKs share one value. Zero holds nothing back, landing on the next task.',
519
+ kind: 'value',
520
+ type: 'number',
521
+ },
522
+ healthCheckGracePeriodMs: {
523
+ description:
524
+ 'Extra room on top of the ping interval before the socket is declared dead — the time a ping has to make its round trip. The connection check fires at `pingIntervalMs + healthCheckGracePeriodMs`, so changing the ping interval moves it too. Floored at 1s, below which the connection check would fire on a healthy connection.',
525
+ kind: 'value',
526
+ type: 'number',
527
+ },
528
+ pingIntervalMs: {
529
+ description:
530
+ 'How often a health-check ping goes out while the socket is up. Held between 1s and 25s — 25s is also the default, so this can only make the socket ping more often, never less: a slower ping risks the connection being closed for idleness.',
531
+ kind: 'value',
532
+ type: 'number',
533
+ },
534
+ urlParams: {
535
+ description:
536
+ 'Extra query parameters appended to the WebSocket URL. Was `StreamChatOptions.wsUrlParams`.',
537
+ kind: 'value',
538
+ type: 'object',
539
+ },
540
+ webSocketImpl: {
541
+ description:
542
+ 'The `WebSocket` constructor to open the socket with, for hosts with no usable global — a Node process, or a test wanting a fake socket. Defaults to the global `WebSocket`. Was `StreamChatOptions.WebSocketImpl`.',
543
+ kind: 'value',
544
+ type: 'function',
545
+ },
546
+ };
547
+
548
+ const CLIENT_FIELDS: Record<keyof ClientDeclarativeConfig, ConfigNode> = {
549
+ connectionRecovery: {
550
+ description:
551
+ 'Bringing the channels, lists and threads you are reading back in line after a reconnect.',
552
+ fields: CONNECTION_RECOVERY_FIELDS,
553
+ kind: 'group',
554
+ },
555
+ messageDelivery: {
556
+ description: 'Delivery and read receipt reporting.',
557
+ fields: MESSAGE_DELIVERY_FIELDS,
558
+ kind: 'group',
559
+ },
560
+ networkConnection: {
561
+ description:
562
+ "The device's own network status, as distinct from this client's WebSocket. Fed by a platform listener you register.",
563
+ fields: NETWORK_CONNECTION_FIELDS,
564
+ kind: 'group',
565
+ },
566
+ notifications: {
567
+ description: 'The client-wide notification (toast) manager.',
568
+ fields: NOTIFICATION_FIELDS,
569
+ kind: 'group',
570
+ },
571
+ reminders: {
572
+ description: 'Message reminders and their scheduling offsets.',
573
+ fields: REMINDER_FIELDS,
574
+ kind: 'group',
575
+ },
576
+ threads: {
577
+ description: 'The thread list manager.',
578
+ fields: THREAD_MANAGER_FIELDS,
579
+ kind: 'group',
580
+ },
581
+ wsConnection: {
582
+ description:
583
+ "This client's WebSocket: how long to wait for it, how often to ping it, how long it may go quiet before being declared dead, how long a drop must last before a UI reports it, and whether to fall back to long-polling when it cannot connect.",
584
+ fields: WS_CONNECTION_FIELDS,
585
+ kind: 'group',
586
+ },
587
+ };
588
+
589
+ // ---------------------------------------------------------------------------
590
+ // channel / thread
591
+ // ---------------------------------------------------------------------------
592
+
593
+ const CHANNEL_FIELDS: Record<keyof ChannelDeclarativeConfig, ConfigNode> = {
594
+ messageOperations: messageOperationsGroup(
595
+ 'Sending and retrying messages in the channel. Overrides the shared `messageOperations` key for channels only.',
596
+ ),
597
+ messagePaginator: messagePaginatorGroup(
598
+ 'The channel message list. Overrides the shared `messagePaginator` key for channels only.',
599
+ ),
600
+ pinnedMessagesPaginator: paginatorGroup(
601
+ "The channel's pinned message list. Nested rather than top-level: a channel is its only parent.",
602
+ ),
603
+ requestHandlers: REQUEST_HANDLERS_NODE,
604
+ typingEvents: {
605
+ description: 'Typing indicators for the channel.',
606
+ fields: {
607
+ enabled: {
608
+ description:
609
+ 'Publishes typing events from this channel. The server must also allow them per channel type (`typing_events`), and a server "no" wins. `messageComposer.text.publishTypingEvents` refines this per composer.',
610
+ kind: 'value',
611
+ type: 'boolean',
612
+ },
613
+ },
614
+ kind: 'group',
615
+ },
616
+ replies: {
617
+ description: 'Threaded replies for the channel.',
618
+ fields: {
619
+ enabled: {
620
+ description:
621
+ 'Offers threaded replies. The server must also allow them per channel type (`replies`), and a server "no" wins.',
622
+ kind: 'value',
623
+ type: 'boolean',
624
+ },
625
+ },
626
+ kind: 'group',
627
+ },
628
+ userMessageReminders: {
629
+ description: 'Message reminders — "remind me" and "save for later".',
630
+ fields: {
631
+ enabled: {
632
+ description:
633
+ 'Offers message reminders. The server must also allow them per channel type (`user_message_reminders`), and a server "no" wins.',
634
+ kind: 'value',
635
+ type: 'boolean',
636
+ },
637
+ },
638
+ kind: 'group',
639
+ },
640
+ deliveryEvents: {
641
+ description: 'Delivery receipts for the channel.',
642
+ fields: {
643
+ enabled: {
644
+ description:
645
+ 'Reports message delivery. The server must also allow it per channel type (`delivery_events`), and a server "no" wins.',
646
+ kind: 'value',
647
+ type: 'boolean',
648
+ },
649
+ },
650
+ kind: 'group',
651
+ },
652
+ readEvents: {
653
+ description: 'Read receipts for the channel.',
654
+ fields: {
655
+ enabled: {
656
+ description:
657
+ 'Allows marking the channel read or unread. The server must also allow it per channel type (`read_events`), and a server "no" wins.',
658
+ kind: 'value',
659
+ type: 'boolean',
660
+ },
661
+ localUnreadCountEnabled: {
662
+ description:
663
+ 'Counts unread messages client-side when `enabled` is false, reset by `channel.markReadLocally()` instead of a request. Not subject to server authority.',
664
+ kind: 'value',
665
+ type: 'boolean',
666
+ },
667
+ },
668
+ kind: 'group',
669
+ },
670
+ };
671
+
672
+ const THREAD_FIELDS: Record<keyof ThreadDeclarativeConfig, ConfigNode> = {
673
+ messageOperations: messageOperationsGroup(
674
+ 'Sending and retrying thread replies. Overrides the shared `messageOperations` key for threads only.',
675
+ ),
676
+ messagePaginator: messagePaginatorGroup(
677
+ 'The thread reply list. Overrides the shared `messagePaginator` key for threads only.',
678
+ ),
679
+ requestHandlers: REQUEST_HANDLERS_NODE,
680
+ };
681
+
682
+ /**
683
+ * A runtime description of the whole declarative configuration tree: every path, what it holds, and what
684
+ * it does.
685
+ *
686
+ * The tree's types already describe all of this, and a TypeScript caller gets it as autocomplete on
687
+ * `client.config.set()`. This is the same knowledge for everyone who cannot read the types at the moment
688
+ * they need it — a settings UI listing what can be changed, a JavaScript caller, a documentation
689
+ * generator. Without it, the only way to learn that `thread` accepts `messagePaginator` is to open the
690
+ * SDK source.
691
+ *
692
+ * **Completeness is enforced by the compiler, not by discipline.** Every level is annotated
693
+ * `Record<keyof SomeConfigType, ConfigNode>`, so a field added to any configuration type fails the build
694
+ * until it is described here. That is what separates this from a hand-maintained list, which drifts
695
+ * behind the tree silently and is exactly the failure this replaces.
696
+ *
697
+ * **What is deliberately absent.** No default values: an effective default depends on the construction
698
+ * site — `pageSize` is 10 for a bare paginator and larger for the channel message list — so a table of
699
+ * them here would be a second source of truth that disagrees with the instances. Read current values from
700
+ * the instance (`channel.messagePaginator.config`) and registered values from
701
+ * {@link InstanceConfigurationRegistry.getTree}. Construction-only paths are absent for the same reason:
702
+ * `CONSTRUCTION_ONLY_CONFIG_PATHS` already lists them.
703
+ *
704
+ * **Built-in keys only.** The key space is open, so a key registered through module augmentation has no
705
+ * entry here. Merge {@link InstanceConfigurationRegistry.getTree} in to see those.
706
+ */
707
+ export const INSTANCE_CONFIG_TREE_SHAPE: Record<
708
+ keyof InstanceConfigTree,
709
+ ConfigGroupNode
710
+ > = {
711
+ channel: {
712
+ description:
713
+ 'Everything a Channel builds, and the channel-specific slice of shared keys.',
714
+ fields: CHANNEL_FIELDS,
715
+ kind: 'group',
716
+ },
717
+ client: {
718
+ description:
719
+ 'Managers the client owns outright. Nested rather than top-level keys, since each has exactly one parent.',
720
+ fields: CLIENT_FIELDS,
721
+ kind: 'group',
722
+ },
723
+ liveLocationManager: {
724
+ description:
725
+ 'Live-location sharing. Constructed by the integrator or a downstream SDK rather than by this package, and reaches this key by registering itself.',
726
+ fields: LIVE_LOCATION_MANAGER_FIELDS,
727
+ kind: 'group',
728
+ },
729
+ messageComposer: {
730
+ description:
731
+ "Every MessageComposer — a channel's, a thread's, and the message-scoped ones built for editing. Its own key because the same settings mean the same thing under all three.",
732
+ fields: MESSAGE_COMPOSER_FIELDS,
733
+ kind: 'group',
734
+ },
735
+ messageOperations: {
736
+ description:
737
+ 'Every MessageOperations at once. `channel.messageOperations` and `thread.messageOperations` override it per parent.',
738
+ fields: MESSAGE_OPERATIONS_FIELDS,
739
+ kind: 'group',
740
+ },
741
+ messagePaginator: {
742
+ description:
743
+ 'Every MessagePaginator at once — the channel message list and thread replies alike. `channel.messagePaginator` and `thread.messagePaginator` override it per parent.',
744
+ fields: MESSAGE_PAGINATOR_FIELDS,
745
+ kind: 'group',
746
+ },
747
+ searchController: {
748
+ description:
749
+ 'Message/channel/user search. Reaches this key only when constructed with a `client` — see SearchControllerOptions.',
750
+ fields: SEARCH_CONTROLLER_FIELDS,
751
+ kind: 'group',
752
+ },
753
+ thread: {
754
+ description:
755
+ 'Everything a Thread builds, and the thread-specific slice of shared keys.',
756
+ fields: THREAD_FIELDS,
757
+ kind: 'group',
758
+ },
759
+ };
760
+
761
+ /** Every path in the shape as `a.b.c`, with the node it points at. Sorted, so output is stable. */
762
+ export const flattenConfigShape = (
763
+ shape: ConfigShape = INSTANCE_CONFIG_TREE_SHAPE,
764
+ prefix = '',
765
+ ): { node: ConfigNode; path: string }[] => {
766
+ const out: { node: ConfigNode; path: string }[] = [];
767
+
768
+ for (const field of Object.keys(shape).sort()) {
769
+ const node = shape[field];
770
+ const path = prefix ? `${prefix}.${field}` : field;
771
+ out.push({ node, path });
772
+ if (node.kind === 'group') out.push(...flattenConfigShape(node.fields, path));
773
+ }
774
+
775
+ return out;
776
+ };