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.
- package/dist/cjs/index.browser.js +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
|
@@ -30,10 +30,7 @@ import type {
|
|
|
30
30
|
TextComposerConfig,
|
|
31
31
|
} from '../messageComposer/configuration/types';
|
|
32
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
|
-
*/
|
|
33
|
+
/** What a value holds. `'object'` is anything whose interior is not described further (a cursor). */
|
|
37
34
|
export type ConfigValueType =
|
|
38
35
|
| 'boolean'
|
|
39
36
|
| 'enum'
|
|
@@ -45,14 +42,14 @@ export type ConfigValueType =
|
|
|
45
42
|
| 'string[]';
|
|
46
43
|
|
|
47
44
|
export type ConfigValueNode = {
|
|
48
|
-
/** One line on what the value does
|
|
45
|
+
/** One line on what the value does, for settings UIs and JS callers. */
|
|
49
46
|
description: string;
|
|
50
47
|
/** The permitted values, for `type: 'enum'` only. */
|
|
51
48
|
enumValues?: readonly string[];
|
|
52
49
|
kind: 'value';
|
|
53
50
|
/**
|
|
54
|
-
* `'function'` marks a path the declarative tree cannot carry
|
|
55
|
-
*
|
|
51
|
+
* `'function'` marks a path the declarative tree cannot carry (JSON has no functions): reachable only
|
|
52
|
+
* through a setup function or `updateConfig`.
|
|
56
53
|
*/
|
|
57
54
|
type: ConfigValueType;
|
|
58
55
|
};
|
|
@@ -68,17 +65,9 @@ export type ConfigNode = ConfigGroupNode | ConfigValueNode;
|
|
|
68
65
|
export type ConfigShape = { readonly [field: string]: ConfigNode };
|
|
69
66
|
|
|
70
67
|
/**
|
|
71
|
-
* The declarative paginator
|
|
72
|
-
*
|
|
73
|
-
*
|
|
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.
|
|
68
|
+
* The declarative paginator fields shared by every paginator path in the tree. `maxLoadedItems` is
|
|
69
|
+
* left out: only the message paginator's declarative config reaches it, see
|
|
70
|
+
* {@link MESSAGE_PAGINATOR_FIELDS}.
|
|
82
71
|
*/
|
|
83
72
|
const PAGINATOR_FIELDS: Record<
|
|
84
73
|
Exclude<keyof DeclarativePaginatorConfig, 'maxLoadedItems'>,
|
|
@@ -115,7 +104,7 @@ const PAGINATOR_FIELDS: Record<
|
|
|
115
104
|
},
|
|
116
105
|
pageSize: {
|
|
117
106
|
description:
|
|
118
|
-
'Items requested per page. The effective default differs per paginator
|
|
107
|
+
'Items requested per page. The effective default differs per paginator: the channel message list asks for more than the base default.',
|
|
119
108
|
kind: 'value',
|
|
120
109
|
type: 'number',
|
|
121
110
|
},
|
|
@@ -196,10 +185,6 @@ const messageOperationsGroup = (description: string): ConfigGroupNode => ({
|
|
|
196
185
|
kind: 'group',
|
|
197
186
|
});
|
|
198
187
|
|
|
199
|
-
// ---------------------------------------------------------------------------
|
|
200
|
-
// messageComposer
|
|
201
|
-
// ---------------------------------------------------------------------------
|
|
202
|
-
|
|
203
188
|
const ATTACHMENTS_FIELDS: Record<keyof AttachmentManagerConfig, ConfigNode> = {
|
|
204
189
|
enabled: {
|
|
205
190
|
description:
|
|
@@ -215,7 +200,7 @@ const ATTACHMENTS_FIELDS: Record<keyof AttachmentManagerConfig, ConfigNode> = {
|
|
|
215
200
|
},
|
|
216
201
|
customCdn: {
|
|
217
202
|
description:
|
|
218
|
-
"Whether a custom upload request stores files somewhere Stream does not host.
|
|
203
|
+
"Whether a custom upload request stores files somewhere Stream does not host. When false (the default), files are treated as reaching Stream, so Stream's `uploads` flag and `upload-file` capability apply.",
|
|
219
204
|
kind: 'value',
|
|
220
205
|
type: 'boolean',
|
|
221
206
|
},
|
|
@@ -332,8 +317,7 @@ const TEXT_FIELDS: Record<keyof TextComposerConfig, ConfigNode> = {
|
|
|
332
317
|
type: 'number',
|
|
333
318
|
},
|
|
334
319
|
publishTypingEvents: {
|
|
335
|
-
description:
|
|
336
|
-
'Emits typing events as the user types. Off by default for threads and message editing.',
|
|
320
|
+
description: 'Emits typing events as the user types. Defaults to `true`.',
|
|
337
321
|
kind: 'value',
|
|
338
322
|
type: 'boolean',
|
|
339
323
|
},
|
|
@@ -384,10 +368,6 @@ const MESSAGE_COMPOSER_FIELDS: Record<keyof MessageComposerConfig, ConfigNode> =
|
|
|
384
368
|
text: { description: 'The text input itself.', fields: TEXT_FIELDS, kind: 'group' },
|
|
385
369
|
};
|
|
386
370
|
|
|
387
|
-
// ---------------------------------------------------------------------------
|
|
388
|
-
// client
|
|
389
|
-
// ---------------------------------------------------------------------------
|
|
390
|
-
|
|
391
371
|
const MESSAGE_DELIVERY_FIELDS: Record<keyof MessageDeliveryReporterConfig, ConfigNode> = {
|
|
392
372
|
markAsDeliveredBufferTimeoutMs: {
|
|
393
373
|
description: 'How long delivery reports are buffered before being sent as one batch.',
|
|
@@ -426,7 +406,7 @@ const LIVE_LOCATION_MANAGER_FIELDS: Record<keyof LiveLocationManagerConfig, Conf
|
|
|
426
406
|
{
|
|
427
407
|
minUpdateThrottleMs: {
|
|
428
408
|
description:
|
|
429
|
-
'Shortest gap between live-location update requests, in milliseconds. A rate-limit failsafe
|
|
409
|
+
'Shortest gap between live-location update requests, in milliseconds. A rate-limit failsafe: raising it is always safe, lowering it risks 429s.',
|
|
430
410
|
kind: 'value',
|
|
431
411
|
type: 'number',
|
|
432
412
|
},
|
|
@@ -458,7 +438,7 @@ const NOTIFICATION_FIELDS: Record<keyof NotificationManagerConfig, ConfigNode> =
|
|
|
458
438
|
const REMINDER_FIELDS: Record<keyof ReminderManagerConfig, ConfigNode> = {
|
|
459
439
|
scheduledOffsetsMs: {
|
|
460
440
|
description:
|
|
461
|
-
'Offsets from now offered when scheduling a reminder, in milliseconds
|
|
441
|
+
'Offsets from now offered when scheduling a reminder, in milliseconds: the "in 30 minutes / tomorrow" choices.',
|
|
462
442
|
kind: 'value',
|
|
463
443
|
type: 'number[]',
|
|
464
444
|
},
|
|
@@ -497,19 +477,19 @@ const NETWORK_CONNECTION_FIELDS: Record<
|
|
|
497
477
|
const WS_CONNECTION_FIELDS: Record<keyof WSConnectionConfig, ConfigNode> = {
|
|
498
478
|
connection: {
|
|
499
479
|
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.
|
|
480
|
+
'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.',
|
|
501
481
|
kind: 'value',
|
|
502
482
|
type: 'object',
|
|
503
483
|
},
|
|
504
484
|
connectTimeoutMs: {
|
|
505
485
|
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.
|
|
486
|
+
"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.",
|
|
507
487
|
kind: 'value',
|
|
508
488
|
type: 'number',
|
|
509
489
|
},
|
|
510
490
|
enableWSFallback: {
|
|
511
491
|
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`.
|
|
492
|
+
'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`.',
|
|
513
493
|
kind: 'value',
|
|
514
494
|
type: 'boolean',
|
|
515
495
|
},
|
|
@@ -521,31 +501,54 @@ const WS_CONNECTION_FIELDS: Record<keyof WSConnectionConfig, ConfigNode> = {
|
|
|
521
501
|
},
|
|
522
502
|
healthCheckGracePeriodMs: {
|
|
523
503
|
description:
|
|
524
|
-
'Extra room on top of the ping interval before the socket is declared dead
|
|
504
|
+
'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
505
|
kind: 'value',
|
|
526
506
|
type: 'number',
|
|
527
507
|
},
|
|
528
508
|
pingIntervalMs: {
|
|
529
509
|
description:
|
|
530
|
-
'How often a health-check ping goes out while the socket is up. Held between 1s and 25s
|
|
510
|
+
'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
511
|
kind: 'value',
|
|
532
512
|
type: 'number',
|
|
533
513
|
},
|
|
534
514
|
urlParams: {
|
|
535
|
-
description:
|
|
536
|
-
'Extra query parameters appended to the WebSocket URL. Was `StreamChatOptions.wsUrlParams`.',
|
|
515
|
+
description: 'Extra query parameters appended to the WebSocket URL.',
|
|
537
516
|
kind: 'value',
|
|
538
517
|
type: 'object',
|
|
539
518
|
},
|
|
540
519
|
webSocketImpl: {
|
|
541
520
|
description:
|
|
542
|
-
'The `WebSocket` constructor to open the socket with, for hosts with no usable global
|
|
521
|
+
'The `WebSocket` constructor to open the socket with, for hosts with no usable global, such as a Node process or a test wanting a fake socket. Defaults to the global `WebSocket`.',
|
|
543
522
|
kind: 'value',
|
|
544
523
|
type: 'function',
|
|
545
524
|
},
|
|
546
525
|
};
|
|
547
526
|
|
|
548
527
|
const CLIENT_FIELDS: Record<keyof ClientDeclarativeConfig, ConfigNode> = {
|
|
528
|
+
allowServerSideConnect: {
|
|
529
|
+
description:
|
|
530
|
+
'Silences the warning logged when `connectUser` is called server-side, where a connection counts towards MAU and concurrent-connection billing.',
|
|
531
|
+
kind: 'value',
|
|
532
|
+
type: 'boolean',
|
|
533
|
+
},
|
|
534
|
+
axiosRequestConfig: {
|
|
535
|
+
description:
|
|
536
|
+
"Axios-level request configuration, such as `timeout`, `headers` and `httpsAgent`. Built into the client's axios instance at construction; `headers` and `params` are also read on every request.",
|
|
537
|
+
kind: 'value',
|
|
538
|
+
type: 'object',
|
|
539
|
+
},
|
|
540
|
+
baseURL: {
|
|
541
|
+
description:
|
|
542
|
+
'Base URL of the API, such as `https://chat-proxy-dublin.stream-io-api.com`. Read at construction.',
|
|
543
|
+
kind: 'value',
|
|
544
|
+
type: 'string',
|
|
545
|
+
},
|
|
546
|
+
browser: {
|
|
547
|
+
description:
|
|
548
|
+
'Enforces browser (`true`) or Node (`false`) mode; detected from the global `window` when absent. Read live, through `client.browser` and `client.node`.',
|
|
549
|
+
kind: 'value',
|
|
550
|
+
type: 'boolean',
|
|
551
|
+
},
|
|
549
552
|
connectionRecovery: {
|
|
550
553
|
description:
|
|
551
554
|
'Bringing the channels, lists and threads you are reading back in line after a reconnect.',
|
|
@@ -563,11 +566,23 @@ const CLIENT_FIELDS: Record<keyof ClientDeclarativeConfig, ConfigNode> = {
|
|
|
563
566
|
fields: NETWORK_CONNECTION_FIELDS,
|
|
564
567
|
kind: 'group',
|
|
565
568
|
},
|
|
569
|
+
notificationManager: {
|
|
570
|
+
description:
|
|
571
|
+
'A pre-built `NotificationManager` to use instead of the client constructing its own, to share one between clients or hand over one that already holds notifications. Read at construction.',
|
|
572
|
+
kind: 'value',
|
|
573
|
+
type: 'object',
|
|
574
|
+
},
|
|
566
575
|
notifications: {
|
|
567
576
|
description: 'The client-wide notification (toast) manager.',
|
|
568
577
|
fields: NOTIFICATION_FIELDS,
|
|
569
578
|
kind: 'group',
|
|
570
579
|
},
|
|
580
|
+
persistUserOnConnectionFailure: {
|
|
581
|
+
description:
|
|
582
|
+
'Keeps the user on the client when `connectUser` fails, so an application working offline keeps `client.user` and need not call `connectUser` again to retry. Read when a connect fails.',
|
|
583
|
+
kind: 'value',
|
|
584
|
+
type: 'boolean',
|
|
585
|
+
},
|
|
571
586
|
reminders: {
|
|
572
587
|
description: 'Message reminders and their scheduling offsets.',
|
|
573
588
|
fields: REMINDER_FIELDS,
|
|
@@ -586,10 +601,6 @@ const CLIENT_FIELDS: Record<keyof ClientDeclarativeConfig, ConfigNode> = {
|
|
|
586
601
|
},
|
|
587
602
|
};
|
|
588
603
|
|
|
589
|
-
// ---------------------------------------------------------------------------
|
|
590
|
-
// channel / thread
|
|
591
|
-
// ---------------------------------------------------------------------------
|
|
592
|
-
|
|
593
604
|
const CHANNEL_FIELDS: Record<keyof ChannelDeclarativeConfig, ConfigNode> = {
|
|
594
605
|
messageOperations: messageOperationsGroup(
|
|
595
606
|
'Sending and retrying messages in the channel. Overrides the shared `messageOperations` key for channels only.',
|
|
@@ -626,7 +637,7 @@ const CHANNEL_FIELDS: Record<keyof ChannelDeclarativeConfig, ConfigNode> = {
|
|
|
626
637
|
kind: 'group',
|
|
627
638
|
},
|
|
628
639
|
userMessageReminders: {
|
|
629
|
-
description: 'Message reminders
|
|
640
|
+
description: 'Message reminders: "remind me" and "save for later".',
|
|
630
641
|
fields: {
|
|
631
642
|
enabled: {
|
|
632
643
|
description:
|
|
@@ -680,29 +691,15 @@ const THREAD_FIELDS: Record<keyof ThreadDeclarativeConfig, ConfigNode> = {
|
|
|
680
691
|
};
|
|
681
692
|
|
|
682
693
|
/**
|
|
683
|
-
* A runtime description of the
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
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.
|
|
694
|
+
* A runtime description of the declarative configuration tree (every path, what it holds and does) for
|
|
695
|
+
* settings UIs, JavaScript callers and doc generators. Every level is annotated
|
|
696
|
+
* `Record<keyof SomeConfigType, ConfigNode>`, so a field added to a configuration type fails the build
|
|
697
|
+
* until it is described here.
|
|
703
698
|
*
|
|
704
|
-
*
|
|
705
|
-
*
|
|
699
|
+
* Carries no default values, since an effective default depends on the construction site. Read current
|
|
700
|
+
* values from the instance (`channel.messagePaginator.config`), registered values from
|
|
701
|
+
* {@link InstanceConfigurationRegistry.getTree}, and read-once paths from
|
|
702
|
+
* `CONSTRUCTION_ONLY_CONFIG_PATHS`.
|
|
706
703
|
*/
|
|
707
704
|
export const INSTANCE_CONFIG_TREE_SHAPE: Record<
|
|
708
705
|
keyof InstanceConfigTree,
|
|
@@ -728,7 +725,7 @@ export const INSTANCE_CONFIG_TREE_SHAPE: Record<
|
|
|
728
725
|
},
|
|
729
726
|
messageComposer: {
|
|
730
727
|
description:
|
|
731
|
-
"Every MessageComposer
|
|
728
|
+
"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
729
|
fields: MESSAGE_COMPOSER_FIELDS,
|
|
733
730
|
kind: 'group',
|
|
734
731
|
},
|
|
@@ -740,13 +737,13 @@ export const INSTANCE_CONFIG_TREE_SHAPE: Record<
|
|
|
740
737
|
},
|
|
741
738
|
messagePaginator: {
|
|
742
739
|
description:
|
|
743
|
-
'Every MessagePaginator at once
|
|
740
|
+
'Every MessagePaginator at once: the channel message list and thread replies alike. `channel.messagePaginator` and `thread.messagePaginator` override it per parent.',
|
|
744
741
|
fields: MESSAGE_PAGINATOR_FIELDS,
|
|
745
742
|
kind: 'group',
|
|
746
743
|
},
|
|
747
744
|
searchController: {
|
|
748
745
|
description:
|
|
749
|
-
'Message/channel/user search. Reaches this key only when constructed with a `client`
|
|
746
|
+
'Message/channel/user search. Reaches this key only when constructed with a `client` (see SearchControllerOptions).',
|
|
750
747
|
fields: SEARCH_CONTROLLER_FIELDS,
|
|
751
748
|
kind: 'group',
|
|
752
749
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AxiosRequestConfig } from 'axios';
|
|
1
2
|
import type { StreamChat } from '../client';
|
|
2
3
|
import type {
|
|
3
4
|
LiveLocationManager,
|
|
@@ -12,6 +13,7 @@ import type { MessageComposerConfig } from '../messageComposer/configuration/typ
|
|
|
12
13
|
import type { Channel, ChannelConfig } from '../channel';
|
|
13
14
|
import type { Thread, ThreadConfig } from '../thread';
|
|
14
15
|
import type { ReminderManagerConfig } from '../reminders/ReminderManager';
|
|
16
|
+
import type { NotificationManager } from '../notifications/NotificationManager';
|
|
15
17
|
import type { NotificationManagerConfig } from '../notifications/types';
|
|
16
18
|
import type { MessageDeliveryReporterConfig } from '../messageDelivery/MessageDeliveryReporter';
|
|
17
19
|
import type { ThreadManagerConfig } from '../thread_manager';
|
|
@@ -24,17 +26,9 @@ import type { MessageOperationsConfig } from '../messageOperations/MessageOperat
|
|
|
24
26
|
import type { DeclarativePaginatorConfig as ImportedDeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
|
|
25
27
|
import type { DeepPartial } from '../types.utility';
|
|
26
28
|
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
|
-
// Keys
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
|
|
31
29
|
/**
|
|
32
|
-
* Maps a configuration key to the argument its setup function receives.
|
|
33
|
-
*
|
|
34
|
-
* A closed set, and deliberately not an `interface`: a type alias cannot be reached by module
|
|
35
|
-
* augmentation, so the key space cannot be extended from outside this package. Configuration for a class
|
|
36
|
-
* this package does not own belongs to whoever owns that class — a registry of its own, not a key in this
|
|
37
|
-
* one, which the SDK could neither type nor apply.
|
|
30
|
+
* Maps a configuration key to the argument its setup function receives. A type alias, so the key space
|
|
31
|
+
* is closed to module augmentation.
|
|
38
32
|
*/
|
|
39
33
|
export type InstanceSetupFunctionArgs = {
|
|
40
34
|
channel: { channel: Channel };
|
|
@@ -46,32 +40,20 @@ export type InstanceSetupFunctionArgs = {
|
|
|
46
40
|
};
|
|
47
41
|
|
|
48
42
|
/**
|
|
49
|
-
* The keys that take a
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* Closed, and not extensible: an undeclared string is a compile error, and {@link
|
|
53
|
-
* InstanceSetupFunctionArgs} is a type alias rather than an interface, so a key cannot be added by module
|
|
54
|
-
* augmentation either. This key space describes what *this package* configures.
|
|
55
|
-
*
|
|
56
|
-
* A strict subset of {@link InstanceConfigKey}: `messagePaginator` and `messageOperations` take
|
|
57
|
-
* configuration but have no setup function, because they are not built one-per-key — a channel and every
|
|
58
|
-
* 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.
|
|
59
46
|
*/
|
|
60
47
|
export type InstanceSetupKey = keyof InstanceSetupFunctionArgs;
|
|
61
48
|
|
|
62
|
-
// ---------------------------------------------------------------------------
|
|
63
|
-
// Tier 2 — setup functions
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
|
|
66
49
|
export type InstanceSetupFunctionArgsOf<K extends InstanceSetupKey> =
|
|
67
50
|
InstanceSetupFunctionArgs[K];
|
|
68
51
|
|
|
69
52
|
export type InstanceSetupTearDownFunction = () => void;
|
|
70
53
|
|
|
71
54
|
/**
|
|
72
|
-
* Runs against every instance of its class
|
|
73
|
-
*
|
|
74
|
-
* before the setup function is re-applied, and when the instance is disposed of.
|
|
55
|
+
* Runs against every instance of its class, existing and future. Return a function that undoes what you
|
|
56
|
+
* changed: it runs before the setup function is re-applied and when the instance is disposed of.
|
|
75
57
|
*/
|
|
76
58
|
export type InstanceSetupFunction<K extends InstanceSetupKey = InstanceSetupKey> = (
|
|
77
59
|
args: InstanceSetupFunctionArgsOf<K>,
|
|
@@ -81,31 +63,19 @@ export type InstanceSetupState<K extends InstanceSetupKey = InstanceSetupKey> =
|
|
|
81
63
|
setupFunction: InstanceSetupFunction<K> | null;
|
|
82
64
|
};
|
|
83
65
|
|
|
84
|
-
// ---------------------------------------------------------------------------
|
|
85
|
-
// Tier 1 — declarative configuration
|
|
86
|
-
// ---------------------------------------------------------------------------
|
|
87
|
-
|
|
88
66
|
/** Whether `jumpToTheFirstUnreadMessage` prefers the paginator's snapshot or the channel read state. */
|
|
89
67
|
export type UnreadReferencePolicy = 'snapshot' | 'read-state-only';
|
|
90
68
|
|
|
91
69
|
/**
|
|
92
|
-
* Paginator fields settable through the declarative tree.
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* Deliberately excluded there:
|
|
97
|
-
* - `itemIndex` / `createItemIndex` — an index instance and a factory, not configuration. Deep-merging
|
|
98
|
-
* a class instance is unsound, and swapping an index would drop already-loaded items.
|
|
99
|
-
* - `doRequest`, `itemOrderComparator`, `deriveCursor` — installed per paginator subclass
|
|
100
|
-
* (`PinnedMessagePaginator` supplies all three). Replace them through a setup function, where the
|
|
101
|
-
* existing value is visible and restorable.
|
|
102
|
-
*
|
|
103
|
-
* `initialCursor` and `initialOffset` are included but read only during construction — see
|
|
70
|
+
* Paginator fields settable through the declarative tree. Defined in `BasePaginator`, which excludes
|
|
71
|
+
* what is not plain configuration: `itemIndex` / `createItemIndex`, and the per-subclass `doRequest`,
|
|
72
|
+
* `itemOrderComparator` and `deriveCursor` (replace those through a setup function).
|
|
73
|
+
* `initialCursor` and `initialOffset` are read only during construction, see
|
|
104
74
|
* {@link CONSTRUCTION_ONLY_CONFIG_PATHS}.
|
|
105
75
|
*/
|
|
106
76
|
export type { DeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
|
|
107
77
|
|
|
108
|
-
/** Adds the message-list-only
|
|
78
|
+
/** Adds the message-list-only `unreadReferencePolicy`. */
|
|
109
79
|
export type DeclarativeMessagePaginatorConfig = ImportedDeclarativePaginatorConfig & {
|
|
110
80
|
unreadReferencePolicy?: UnreadReferencePolicy;
|
|
111
81
|
};
|
|
@@ -126,7 +96,7 @@ export type ChannelDeclarativeConfig = {
|
|
|
126
96
|
userMessageReminders?: Partial<ChannelConfig['userMessageReminders']>;
|
|
127
97
|
/** Delivery receipts, ANDed with the channel type's `delivery_events`. */
|
|
128
98
|
deliveryEvents?: Partial<ChannelConfig['deliveryEvents']>;
|
|
129
|
-
// `commands` is
|
|
99
|
+
// `commands` is absent: the server owns the list.
|
|
130
100
|
};
|
|
131
101
|
|
|
132
102
|
export type ThreadDeclarativeConfig = {
|
|
@@ -138,98 +108,88 @@ export type ThreadDeclarativeConfig = {
|
|
|
138
108
|
|
|
139
109
|
export type ClientDeclarativeConfig = {
|
|
140
110
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
111
|
+
* Silences the warning `connectUser` / `connectAnonymousUser` log when called server-side, where a
|
|
112
|
+
* connection counts towards MAU and concurrent-connection billing. Read on every connect.
|
|
113
|
+
*/
|
|
114
|
+
allowServerSideConnect?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Axios request configuration (`timeout`, `headers`, `httpsAgent`, ...). Built into the client's axios
|
|
117
|
+
* instance once, at construction; `headers` and `params` are also read on every request. Copied when
|
|
118
|
+
* registered, so mutating the object afterwards has no effect.
|
|
119
|
+
*/
|
|
120
|
+
axiosRequestConfig?: AxiosRequestConfig;
|
|
121
|
+
/** Base URL of the API, such as `https://chat-proxy-dublin.stream-io-api.com`. Read once. */
|
|
122
|
+
baseURL?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Forces browser (`true`) or Node (`false`) mode; detected from the global `window` when absent. Read
|
|
125
|
+
* live, through `client.browser` and `client.node`.
|
|
143
126
|
*/
|
|
127
|
+
browser?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* A pre-built {@link NotificationManager} to use instead of constructing one, to share it between
|
|
130
|
+
* clients or hand over one that already holds notifications. Read once, at construction. The
|
|
131
|
+
* `notifications` slice is still applied to it.
|
|
132
|
+
*/
|
|
133
|
+
notificationManager?: NotificationManager;
|
|
134
|
+
/**
|
|
135
|
+
* When true, `client.user` is kept if `connectUser` fails, so an offline-capable app does not have to
|
|
136
|
+
* call `connectUser` again to retry. Read when a connect fails.
|
|
137
|
+
*/
|
|
138
|
+
persistUserOnConnectionFailure?: boolean;
|
|
144
139
|
connectionRecovery?: Partial<ConnectionRecoveryManagerConfig>;
|
|
145
140
|
messageDelivery?: Partial<MessageDeliveryReporterConfig>;
|
|
146
141
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* `
|
|
150
|
-
* into.
|
|
142
|
+
* The platform listener that reports the device's network, which React Native and other hosts supply
|
|
143
|
+
* here. Defaults to browser events, else a reporter that mirrors the WebSocket. `Partial`, not
|
|
144
|
+
* `DeepPartial`: the only field holds a function, which `DeepPartial` would descend into.
|
|
151
145
|
*/
|
|
152
146
|
networkConnection?: Partial<NetworkConnectionObserverConfig>;
|
|
153
147
|
threads?: Partial<ThreadManagerConfig>;
|
|
154
|
-
/**
|
|
155
|
-
* The WebSocket's timing: connect timeout, ping interval, and the health-check grace period on top of it.
|
|
156
|
-
* These three, and only these, because each was a public mutable field before it was configuration.
|
|
157
|
-
* `Partial`, not `DeepPartial`: every field is a flat number.
|
|
158
|
-
*/
|
|
148
|
+
/** `Partial`, not `DeepPartial`: fields are flat or class instances, which it would descend into. */
|
|
159
149
|
wsConnection?: Partial<WSConnectionConfig>;
|
|
160
150
|
notifications?: DeepPartial<NotificationManagerConfig>;
|
|
161
151
|
/**
|
|
162
152
|
* `Partial`, not `DeepPartial`: `scheduledOffsetsMs` is a `number[]`, and `DeepPartial` would widen
|
|
163
|
-
* its elements to `number | undefined`, which `ReminderManager.updateConfig`
|
|
153
|
+
* its elements to `number | undefined`, which `ReminderManager.updateConfig` rejects.
|
|
164
154
|
*/
|
|
165
155
|
reminders?: Partial<ReminderManagerConfig>;
|
|
166
156
|
};
|
|
167
157
|
|
|
168
158
|
/**
|
|
169
|
-
* Maps a configuration key to its declarative configuration subtree.
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* **When something gets its own key rather than being nested under a parent** — the rule that decides
|
|
174
|
-
* the shape of this interface:
|
|
175
|
-
*
|
|
176
|
-
* - **One parent type ⇒ nest it.** `channel.pinnedMessagesPaginator`, `channel.cooldownTimer`, the
|
|
177
|
-
* composer's own sub-managers. There is only one place it can be reached from.
|
|
178
|
-
* - **Several parent types, and the configuration means the same thing under each ⇒ own key.**
|
|
179
|
-
* `MessageComposer` hangs off a `Channel`, a `Thread`, *and* a message (the React SDK builds
|
|
180
|
-
* message-scoped composers for editing). `drafts.enabled` means the same in all three, so nesting it
|
|
181
|
-
* under `channel` would silently miss two thirds of the composers.
|
|
182
|
-
* - **Several parent types, but the configuration is inherently parent-specific ⇒ nest it anyway.**
|
|
183
|
-
* No built-in falls here today. It is kept as a case because it is the one that decides against a shared
|
|
184
|
-
* key, and the next entity to arrive may need it.
|
|
185
|
-
* - **Several parent types, mixed ⇒ both.** A shared top-level key for what means the same thing, plus
|
|
186
|
-
* per-parent paths that override it field by field (see {@link mergeDeclarativeMessageOperationsConfig}).
|
|
187
|
-
* Both shared keys are here: `MessagePaginator` backs the channel message list *and* thread replies
|
|
188
|
-
* (`stateThrottleMs` / `retryCount` have no reason to differ, `pageSize` legitimately does), and
|
|
189
|
-
* `MessageOperations` backs channel *and* thread sends. `messageOperations` was briefly nested under
|
|
190
|
-
* `channel` on the reasoning that a channel send and a thread reply are different operations — which made
|
|
191
|
-
* `thread.messageOperations` unconfigurable entirely (**DV-15**). Counting parents is the check.
|
|
159
|
+
* Maps a configuration key to its declarative configuration subtree. A class with one parent type is
|
|
160
|
+
* nested under that parent. A class held by several parents (`MessageComposer`, `MessagePaginator`,
|
|
161
|
+
* `MessageOperations`) gets its own shared key, and where parents need to differ they override it per
|
|
162
|
+
* field (see {@link mergeDeclarativeMessageOperationsConfig}).
|
|
192
163
|
*/
|
|
193
164
|
export type InstanceConfigTree = {
|
|
194
165
|
channel: ChannelDeclarativeConfig;
|
|
195
166
|
client: ClientDeclarativeConfig;
|
|
196
167
|
/**
|
|
197
|
-
* Constructed by
|
|
198
|
-
*
|
|
199
|
-
* registering itself against this key, so its owner does not have to thread a slice through.
|
|
168
|
+
* Constructed by the integrator or a UI SDK, never by this package. It reaches its configuration by
|
|
169
|
+
* registering itself against this key.
|
|
200
170
|
*/
|
|
201
171
|
liveLocationManager: Partial<LiveLocationManagerConfig>;
|
|
202
172
|
messageComposer: DeepPartial<MessageComposerConfig>;
|
|
203
173
|
/**
|
|
204
|
-
* Applies to
|
|
205
|
-
*
|
|
174
|
+
* Applies to every `MessageOperations`, the channel's and each thread's.
|
|
175
|
+
* `channel.messageOperations` and `thread.messageOperations` override it per parent.
|
|
206
176
|
*/
|
|
207
177
|
messageOperations: Partial<MessageOperationsConfig>;
|
|
208
178
|
/**
|
|
209
|
-
* Applies to
|
|
179
|
+
* Applies to every `MessagePaginator`, the channel message list and thread replies alike.
|
|
210
180
|
* `channel.messagePaginator` and `thread.messagePaginator` override it per parent.
|
|
211
|
-
*
|
|
212
|
-
* `channel.pinnedMessagesPaginator` is deliberately **not** included: it has a single parent, so by
|
|
213
|
-
* the rule above it stays nested. It is also a different class (`PinnedMessagePaginator`, with its own
|
|
214
|
-
* ordering and endpoint) rather than a `MessagePaginator`.
|
|
181
|
+
* `channel.pinnedMessagesPaginator` is not included: it is a different class with a single parent.
|
|
215
182
|
*/
|
|
216
183
|
messagePaginator: DeclarativeMessagePaginatorConfig;
|
|
217
184
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* SDK does not hand a client to. See `SearchControllerOptions.client`.
|
|
185
|
+
* Like {@link InstanceConfigTree.liveLocationManager}, but a `SearchController` reaches this key only
|
|
186
|
+
* when constructed with a `client` (see `SearchControllerOptions.client`).
|
|
221
187
|
*/
|
|
222
188
|
searchController: Partial<SearchControllerConfig>;
|
|
223
189
|
thread: ThreadDeclarativeConfig;
|
|
224
190
|
};
|
|
225
191
|
|
|
226
|
-
/**
|
|
227
|
-
* Every key that takes **declarative configuration** — {@link InstanceSetupKey} plus the two that are
|
|
228
|
-
* configuration-only.
|
|
229
|
-
*
|
|
230
|
-
* Closed for the same reason, and {@link InstanceConfigTree} is likewise a type alias, so this set is
|
|
231
|
-
* fixed by the package.
|
|
232
|
-
*/
|
|
192
|
+
/** Every key that takes declarative configuration: {@link InstanceSetupKey} plus the config-only ones. */
|
|
233
193
|
export type InstanceConfigKey = keyof InstanceConfigTree;
|
|
234
194
|
|
|
235
195
|
export type InstanceConfigOf<K extends InstanceConfigKey> = InstanceConfigTree[K];
|