stream-chat 10.0.0-rc.9 → 10.0.0
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/README.md +7 -6
- package/dist/cjs/index.browser.js +21650 -19790
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +21690 -19798
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +21755 -19895
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +216 -135
- package/dist/types/CooldownTimer.d.ts +13 -27
- package/dist/types/EventHandlerPipeline.d.ts +18 -38
- package/dist/types/LiveLocationManager.d.ts +24 -52
- package/dist/types/api-client.d.ts +17 -5
- package/dist/types/channel.d.ts +432 -470
- package/dist/types/channel_state.d.ts +68 -112
- package/dist/types/client.d.ts +321 -435
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +31 -125
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +32 -124
- 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 +64 -79
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +14 -36
- 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 +45 -0
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +84 -0
- package/dist/types/connection/index.d.ts +4 -0
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +82 -0
- package/dist/types/connection/networkConnection/index.d.ts +3 -0
- package/dist/types/connection/networkConnection/reporters.d.ts +20 -0
- package/dist/types/connection/networkConnection/types.d.ts +40 -0
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +137 -0
- package/dist/types/connection/wsConnection/WSConnection.d.ts +105 -0
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +47 -0
- package/dist/types/connection/wsConnection/config.d.ts +31 -0
- package/dist/types/connection/wsConnection/index.d.ts +4 -0
- package/dist/types/connection/wsConnection/types.d.ts +46 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/custom_types.d.ts +0 -2
- package/dist/types/entityStore/EntityStore.d.ts +226 -65
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +19 -33
- package/dist/types/entityStore/index.d.ts +0 -1
- package/dist/types/errors.d.ts +16 -19
- package/dist/types/formatMessageMemo.d.ts +5 -0
- package/dist/types/gen/chat/ChannelApi.d.ts +5 -1
- package/dist/types/gen/chat/ChatApi.d.ts +149 -105
- package/dist/types/gen/models/index.d.ts +2528 -690
- package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +33 -14
- package/dist/types/index.d.ts +10 -6
- package/dist/types/{i18n/languageNames.d.ts → languageNames.d.ts} +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
- package/dist/types/messageComposer/LocationComposer.d.ts +7 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +24 -0
- package/dist/types/messageComposer/attachmentManager.d.ts +52 -24
- package/dist/types/messageComposer/attachmentUtils.d.ts +23 -0
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +38 -50
- package/dist/types/messageComposer/index.d.ts +1 -0
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +12 -9
- package/dist/types/messageComposer/messageComposer.d.ts +60 -128
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +10 -1
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +4 -0
- package/dist/types/messageComposer/middleware/messageComposer/commandInjection.d.ts +5 -0
- package/dist/types/messageComposer/middleware/messageComposer/index.d.ts +2 -0
- package/dist/types/messageComposer/middleware/messageComposer/pollOnly.d.ts +6 -0
- package/dist/types/messageComposer/middleware/messageComposer/userDataInjection.d.ts +5 -0
- 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/commandUtils.d.ts +4 -0
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +11 -2
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +19 -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 +15 -5
- package/dist/types/messageComposer/textComposer.d.ts +14 -7
- package/dist/types/messageComposer/types.d.ts +27 -7
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +27 -80
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +40 -73
- package/dist/types/messageOperations/FailedSendCache.d.ts +29 -0
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +16 -22
- package/dist/types/messageOperations/MessageOperations.d.ts +63 -34
- package/dist/types/messageOperations/applyReactionLocally.d.ts +15 -0
- package/dist/types/messageOperations/createMessageOperations.d.ts +9 -0
- package/dist/types/messageOperations/index.d.ts +6 -4
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +16 -0
- package/dist/types/messageOperations/sendOrdering.d.ts +14 -0
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +20 -0
- package/dist/types/messageOperations/types.d.ts +43 -14
- package/dist/types/middleware.d.ts +10 -0
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +10 -23
- package/dist/types/notifications/types.d.ts +21 -57
- package/dist/types/offline-support/offline_support_api.d.ts +150 -528
- package/dist/types/offline-support/offline_sync_manager.d.ts +21 -42
- package/dist/types/offline-support/queueableOperations.d.ts +35 -37
- package/dist/types/offline-support/types.d.ts +40 -186
- package/dist/types/pagination/FilterBuilder.d.ts +1 -18
- 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 +4 -5
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +19 -5
- package/dist/types/pagination/index.d.ts +1 -0
- package/dist/types/pagination/paginators/BasePaginator.d.ts +604 -550
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +123 -106
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +576 -334
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +237 -131
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +15 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +4 -3
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +44 -0
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +5 -8
- package/dist/types/pagination/paginators/index.d.ts +1 -0
- 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 +34 -8
- package/dist/types/poll_manager.d.ts +12 -2
- package/dist/types/poll_optimistic_votes.d.ts +57 -0
- package/dist/types/reminders/Reminder.d.ts +11 -11
- package/dist/types/reminders/ReminderManager.d.ts +13 -25
- package/dist/types/search/BaseSearchSource.d.ts +10 -8
- package/dist/types/search/ChannelSearchSource.d.ts +16 -0
- package/dist/types/search/MessageSearchSource.d.ts +17 -0
- package/dist/types/search/SearchController.d.ts +26 -28
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +63 -129
- package/dist/types/thread_manager.d.ts +95 -66
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +81 -199
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +31 -11
- package/dist/types/utils/FixedSizeQueueCache.d.ts +8 -11
- package/dist/types/utils/WithSubscriptions.d.ts +6 -16
- package/dist/types/utils/abort.d.ts +17 -0
- package/dist/types/utils/concurrency.d.ts +12 -20
- 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 +33 -57
- package/dist/types/utils.d.ts +72 -91
- package/package.json +14 -40
- package/src/ChannelManager.ts +494 -303
- package/src/CooldownTimer.ts +28 -38
- package/src/EventHandlerPipeline.ts +22 -45
- package/src/LiveLocationManager.ts +37 -76
- package/src/api-client.ts +113 -50
- package/src/campaign.ts +1 -1
- package/src/channel.ts +1067 -1276
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +73 -168
- package/src/client.ts +744 -974
- package/src/client_state.ts +3 -8
- package/src/configuration/ConfigController.ts +42 -158
- package/src/configuration/InstanceConfigurationRegistry.ts +43 -172
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +169 -59
- package/src/configuration/types.ts +69 -92
- package/src/configuration/utils/applyInstanceConfiguration.ts +22 -54
- 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 +111 -0
- package/src/connection/ConnectionRecoveryManager.ts +257 -0
- package/src/connection/index.ts +4 -0
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +204 -0
- package/src/connection/networkConnection/index.ts +3 -0
- package/src/connection/networkConnection/reporters.ts +58 -0
- package/src/connection/networkConnection/types.ts +45 -0
- package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +230 -232
- package/src/connection/wsConnection/WSConnection.ts +270 -0
- package/src/connection/wsConnection/WSConnectionFallback.ts +250 -0
- package/src/connection/wsConnection/config.ts +73 -0
- package/src/connection/wsConnection/index.ts +4 -0
- package/src/connection/wsConnection/types.ts +48 -0
- package/src/constants.ts +6 -5
- package/src/custom_types.ts +0 -1
- package/src/entityStore/EntityStore.ts +415 -79
- package/src/entityStore/StoreBackedItemIndex.ts +37 -41
- package/src/entityStore/index.ts +0 -1
- package/src/errors.ts +39 -20
- package/src/formatMessageMemo.ts +17 -0
- package/src/gen/chat/ChannelApi.ts +122 -36
- package/src/gen/chat/ChatApi.ts +578 -1540
- package/src/gen/models/index.ts +2498 -3383
- package/src/gen/models/timestamp-guard.ts +27 -0
- package/src/gen/moderation/ModerationApi.ts +170 -367
- package/src/index.ts +22 -10
- package/src/languageNames.ts +88 -0
- package/src/logger.ts +1 -3
- package/src/messageComposer/CustomDataManager.ts +19 -6
- package/src/messageComposer/LocationComposer.ts +19 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +54 -0
- package/src/messageComposer/attachmentManager.ts +170 -185
- package/src/messageComposer/attachmentUtils.ts +44 -0
- package/src/messageComposer/configuration/configuration.ts +15 -8
- package/src/messageComposer/configuration/types.ts +38 -50
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/index.ts +1 -0
- package/src/messageComposer/linkPreviewsManager.ts +18 -21
- package/src/messageComposer/messageComposer.ts +223 -174
- package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +46 -33
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +4 -1
- package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +6 -0
- package/src/messageComposer/middleware/messageComposer/attachments.ts +76 -5
- package/src/messageComposer/middleware/messageComposer/commandInjection.ts +10 -4
- package/src/messageComposer/middleware/messageComposer/customData.ts +17 -5
- package/src/messageComposer/middleware/messageComposer/index.ts +2 -0
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +22 -12
- package/src/messageComposer/middleware/messageComposer/pollOnly.ts +9 -1
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +12 -12
- 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 +8 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +10 -3
- 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 +21 -9
- package/src/messageComposer/textComposer.ts +37 -57
- package/src/messageComposer/types.ts +39 -11
- package/src/messageDelivery/MessageDeliveryReporter.ts +86 -125
- package/src/messageDelivery/MessageReceiptsTracker.ts +88 -101
- package/src/messageOperations/FailedSendCache.ts +85 -0
- package/src/messageOperations/MessageOperationStatePolicy.ts +121 -112
- package/src/messageOperations/MessageOperations.ts +297 -175
- package/src/{entityStore → messageOperations}/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +176 -0
- package/src/messageOperations/index.ts +6 -14
- package/src/messageOperations/reflectReactionEvent.ts +43 -0
- package/src/messageOperations/sendOrdering.ts +25 -0
- package/src/messageOperations/settlePendingAttachmentUploads.ts +98 -0
- package/src/messageOperations/types.ts +51 -13
- package/src/middleware.ts +13 -5
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +19 -28
- package/src/notifications/types.ts +21 -57
- package/src/offline-support/offline_support_api.ts +226 -669
- package/src/offline-support/offline_sync_manager.ts +51 -80
- package/src/offline-support/queueableOperations.ts +98 -73
- package/src/offline-support/types.ts +43 -186
- package/src/pagination/FilterBuilder.ts +1 -22
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +15 -63
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +53 -33
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/index.ts +1 -0
- package/src/pagination/paginators/BasePaginator.ts +1415 -1041
- package/src/pagination/paginators/ChannelPaginator.ts +479 -217
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1351 -772
- package/src/pagination/paginators/MessagePaginator.ts +513 -233
- package/src/pagination/paginators/PinnedMessagePaginator.ts +32 -40
- package/src/pagination/paginators/ReminderPaginator.ts +21 -16
- package/src/pagination/paginators/ThreadPaginator.ts +170 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +16 -19
- package/src/pagination/paginators/index.ts +1 -0
- 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 +177 -98
- package/src/poll_manager.ts +24 -22
- package/src/poll_optimistic_votes.ts +335 -0
- package/src/reminders/Reminder.ts +16 -12
- package/src/reminders/ReminderManager.ts +22 -55
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +19 -25
- package/src/search/ChannelSearchSource.ts +43 -1
- package/src/search/MessageSearchSource.ts +77 -13
- package/src/search/SearchController.ts +39 -36
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +418 -703
- package/src/thread_manager.ts +300 -234
- package/src/token_manager.ts +12 -22
- package/src/types.ts +102 -216
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +64 -18
- package/src/utils/FixedSizeQueueCache.ts +18 -21
- package/src/utils/WithSubscriptions.ts +6 -16
- package/src/utils/abort.ts +45 -0
- 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 +40 -60
- package/src/utils.ts +181 -174
- package/codegen/i18n/callSites.ts +0 -126
- package/codegen/i18n/generate.ts +0 -226
- package/codegen/i18n/guards.ts +0 -178
- package/codegen/i18n/index.ts +0 -29
- package/codegen/i18n/stringMaps.ts +0 -91
- package/codegen/i18n/types.ts +0 -100
- package/dist/cjs/i18n.browser.js +0 -1131
- package/dist/cjs/i18n.browser.js.map +0 -7
- package/dist/cjs/i18n.node.js +0 -1160
- package/dist/cjs/i18n.node.js.map +0 -7
- package/dist/esm/i18n-codegen.mjs +0 -409
- package/dist/esm/i18n-codegen.mjs.map +0 -7
- package/dist/esm/i18n.mjs +0 -1098
- package/dist/esm/i18n.mjs.map +0 -7
- package/dist/types/ConnectionRecoveryManager.d.ts +0 -156
- package/dist/types/connection.d.ts +0 -139
- package/dist/types/entityStore/applyReactionLocally.d.ts +0 -32
- package/dist/types/i18n/Streami18n.d.ts +0 -168
- package/dist/types/i18n/TranslationBuilder.d.ts +0 -70
- package/dist/types/i18n/TranslationStore.d.ts +0 -57
- package/dist/types/i18n/dayjs.d.ts +0 -104
- package/dist/types/i18n/formatters.d.ts +0 -91
- package/dist/types/i18n/index.d.ts +0 -15
- package/dist/types/i18n/translator.d.ts +0 -29
- package/dist/types/i18n/types.d.ts +0 -262
- package/dist/types/i18n-codegen/callSites.d.ts +0 -10
- package/dist/types/i18n-codegen/generate.d.ts +0 -15
- package/dist/types/i18n-codegen/guards.d.ts +0 -61
- package/dist/types/i18n-codegen/index.d.ts +0 -29
- package/dist/types/i18n-codegen/stringMaps.d.ts +0 -14
- package/dist/types/i18n-codegen/types.d.ts +0 -94
- package/dist/types/insights.d.ts +0 -56
- package/dist/types/messageOperations/optimistic.d.ts +0 -118
- package/dist/types/messageOperations/persistence.d.ts +0 -21
- package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
- package/dist/types/store.d.ts +0 -125
- package/src/ConnectionRecoveryManager.ts +0 -293
- package/src/i18n/Streami18n.ts +0 -520
- package/src/i18n/TranslationBuilder.ts +0 -176
- package/src/i18n/TranslationStore.ts +0 -96
- package/src/i18n/dayjs.ts +0 -228
- package/src/i18n/formatters.ts +0 -461
- package/src/i18n/index.ts +0 -15
- package/src/i18n/languageNames.ts +0 -103
- package/src/i18n/translator.ts +0 -76
- package/src/i18n/types.ts +0 -375
- package/src/insights.ts +0 -82
- package/src/messageOperations/optimistic.ts +0 -257
- package/src/messageOperations/persistence.ts +0 -40
- package/src/pagination/utility.queryChannel.ts +0 -84
- package/src/store.ts +0 -304
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConnectionRecoveryManagerConfig,
|
|
3
|
+
NetworkConnectionObserverConfig,
|
|
4
|
+
WSConnectionConfig,
|
|
5
|
+
} from '../connection';
|
|
1
6
|
import type {
|
|
2
7
|
ChannelDeclarativeConfig,
|
|
3
8
|
ClientDeclarativeConfig,
|
|
@@ -9,7 +14,7 @@ import type { DeclarativePaginatorConfig } from '../pagination/paginators/BasePa
|
|
|
9
14
|
import type { MessageOperationsConfig } from '../messageOperations/MessageOperations';
|
|
10
15
|
import type { MessageDeliveryReporterConfig } from '../messageDelivery/MessageDeliveryReporter';
|
|
11
16
|
import type { ThreadManagerConfig } from '../thread_manager';
|
|
12
|
-
|
|
17
|
+
|
|
13
18
|
import type { LiveLocationManagerConfig } from '../LiveLocationManager';
|
|
14
19
|
import type { SearchControllerConfig } from '../search/SearchController';
|
|
15
20
|
import type { NotificationManagerConfig } from '../notifications/types';
|
|
@@ -25,10 +30,7 @@ import type {
|
|
|
25
30
|
TextComposerConfig,
|
|
26
31
|
} from '../messageComposer/configuration/types';
|
|
27
32
|
|
|
28
|
-
/**
|
|
29
|
-
* What a configuration value holds. `'object'` covers anything whose interior is not described further
|
|
30
|
-
* — a map of handler functions, a cursor — and tells a caller not to expect editable leaves inside.
|
|
31
|
-
*/
|
|
33
|
+
/** What a value holds. `'object'` is anything whose interior is not described further (a cursor). */
|
|
32
34
|
export type ConfigValueType =
|
|
33
35
|
| 'boolean'
|
|
34
36
|
| 'enum'
|
|
@@ -40,14 +42,14 @@ export type ConfigValueType =
|
|
|
40
42
|
| 'string[]';
|
|
41
43
|
|
|
42
44
|
export type ConfigValueNode = {
|
|
43
|
-
/** One line on what the value does
|
|
45
|
+
/** One line on what the value does, for settings UIs and JS callers. */
|
|
44
46
|
description: string;
|
|
45
47
|
/** The permitted values, for `type: 'enum'` only. */
|
|
46
48
|
enumValues?: readonly string[];
|
|
47
49
|
kind: 'value';
|
|
48
50
|
/**
|
|
49
|
-
* `'function'` marks a path the declarative tree cannot carry
|
|
50
|
-
*
|
|
51
|
+
* `'function'` marks a path the declarative tree cannot carry (JSON has no functions): reachable only
|
|
52
|
+
* through a setup function or `updateConfig`.
|
|
51
53
|
*/
|
|
52
54
|
type: ConfigValueType;
|
|
53
55
|
};
|
|
@@ -63,13 +65,14 @@ export type ConfigNode = ConfigGroupNode | ConfigValueNode;
|
|
|
63
65
|
export type ConfigShape = { readonly [field: string]: ConfigNode };
|
|
64
66
|
|
|
65
67
|
/**
|
|
66
|
-
* The declarative paginator
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* to `DeclarativePaginatorConfig` fails the build here until it is described. Same guard as
|
|
70
|
-
* `INSTANCE_CONFIG_TREE_KEY_PRESENCE` uses for the top-level keys.
|
|
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}.
|
|
71
71
|
*/
|
|
72
|
-
const PAGINATOR_FIELDS: Record<
|
|
72
|
+
const PAGINATOR_FIELDS: Record<
|
|
73
|
+
Exclude<keyof DeclarativePaginatorConfig, 'maxLoadedItems'>,
|
|
74
|
+
ConfigNode
|
|
75
|
+
> = {
|
|
73
76
|
debounceMs: {
|
|
74
77
|
description:
|
|
75
78
|
'Delay before a queued page request fires, collapsing rapid scrolling into one query.',
|
|
@@ -101,7 +104,7 @@ const PAGINATOR_FIELDS: Record<keyof DeclarativePaginatorConfig, ConfigNode> = {
|
|
|
101
104
|
},
|
|
102
105
|
pageSize: {
|
|
103
106
|
description:
|
|
104
|
-
'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.',
|
|
105
108
|
kind: 'value',
|
|
106
109
|
type: 'number',
|
|
107
110
|
},
|
|
@@ -129,6 +132,12 @@ const MESSAGE_PAGINATOR_FIELDS: Record<
|
|
|
129
132
|
ConfigNode
|
|
130
133
|
> = {
|
|
131
134
|
...PAGINATOR_FIELDS,
|
|
135
|
+
maxLoadedItems: {
|
|
136
|
+
description:
|
|
137
|
+
'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.',
|
|
138
|
+
kind: 'value',
|
|
139
|
+
type: 'number',
|
|
140
|
+
},
|
|
132
141
|
unreadReferencePolicy: {
|
|
133
142
|
description:
|
|
134
143
|
"'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.",
|
|
@@ -176,10 +185,6 @@ const messageOperationsGroup = (description: string): ConfigGroupNode => ({
|
|
|
176
185
|
kind: 'group',
|
|
177
186
|
});
|
|
178
187
|
|
|
179
|
-
// ---------------------------------------------------------------------------
|
|
180
|
-
// messageComposer
|
|
181
|
-
// ---------------------------------------------------------------------------
|
|
182
|
-
|
|
183
188
|
const ATTACHMENTS_FIELDS: Record<keyof AttachmentManagerConfig, ConfigNode> = {
|
|
184
189
|
enabled: {
|
|
185
190
|
description:
|
|
@@ -195,7 +200,7 @@ const ATTACHMENTS_FIELDS: Record<keyof AttachmentManagerConfig, ConfigNode> = {
|
|
|
195
200
|
},
|
|
196
201
|
customCdn: {
|
|
197
202
|
description:
|
|
198
|
-
"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.",
|
|
199
204
|
kind: 'value',
|
|
200
205
|
type: 'boolean',
|
|
201
206
|
},
|
|
@@ -214,6 +219,12 @@ const ATTACHMENTS_FIELDS: Record<keyof AttachmentManagerConfig, ConfigNode> = {
|
|
|
214
219
|
kind: 'value',
|
|
215
220
|
type: 'number',
|
|
216
221
|
},
|
|
222
|
+
pendingUploadsEnabled: {
|
|
223
|
+
description:
|
|
224
|
+
'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.',
|
|
225
|
+
kind: 'value',
|
|
226
|
+
type: 'boolean',
|
|
227
|
+
},
|
|
217
228
|
trackUploadProgress: {
|
|
218
229
|
description:
|
|
219
230
|
'Reports upload progress on each attachment. Turning it off skips the progress bookkeeping.',
|
|
@@ -306,8 +317,7 @@ const TEXT_FIELDS: Record<keyof TextComposerConfig, ConfigNode> = {
|
|
|
306
317
|
type: 'number',
|
|
307
318
|
},
|
|
308
319
|
publishTypingEvents: {
|
|
309
|
-
description:
|
|
310
|
-
'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`.',
|
|
311
321
|
kind: 'value',
|
|
312
322
|
type: 'boolean',
|
|
313
323
|
},
|
|
@@ -349,13 +359,15 @@ const MESSAGE_COMPOSER_FIELDS: Record<keyof MessageComposerConfig, ConfigNode> =
|
|
|
349
359
|
fields: POLLS_FIELDS,
|
|
350
360
|
kind: 'group',
|
|
351
361
|
},
|
|
362
|
+
retainCompositionOnSubmit: {
|
|
363
|
+
description:
|
|
364
|
+
"Decides whether submitting keeps the composer's contents instead of clearing them. Retains for a poll message by default, while the composition chain sends polls alone.",
|
|
365
|
+
kind: 'value',
|
|
366
|
+
type: 'function',
|
|
367
|
+
},
|
|
352
368
|
text: { description: 'The text input itself.', fields: TEXT_FIELDS, kind: 'group' },
|
|
353
369
|
};
|
|
354
370
|
|
|
355
|
-
// ---------------------------------------------------------------------------
|
|
356
|
-
// client
|
|
357
|
-
// ---------------------------------------------------------------------------
|
|
358
|
-
|
|
359
371
|
const MESSAGE_DELIVERY_FIELDS: Record<keyof MessageDeliveryReporterConfig, ConfigNode> = {
|
|
360
372
|
markAsDeliveredBufferTimeoutMs: {
|
|
361
373
|
description: 'How long delivery reports are buffered before being sent as one batch.',
|
|
@@ -394,7 +406,7 @@ const LIVE_LOCATION_MANAGER_FIELDS: Record<keyof LiveLocationManagerConfig, Conf
|
|
|
394
406
|
{
|
|
395
407
|
minUpdateThrottleMs: {
|
|
396
408
|
description:
|
|
397
|
-
'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.',
|
|
398
410
|
kind: 'value',
|
|
399
411
|
type: 'number',
|
|
400
412
|
},
|
|
@@ -426,7 +438,7 @@ const NOTIFICATION_FIELDS: Record<keyof NotificationManagerConfig, ConfigNode> =
|
|
|
426
438
|
const REMINDER_FIELDS: Record<keyof ReminderManagerConfig, ConfigNode> = {
|
|
427
439
|
scheduledOffsetsMs: {
|
|
428
440
|
description:
|
|
429
|
-
'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.',
|
|
430
442
|
kind: 'value',
|
|
431
443
|
type: 'number[]',
|
|
432
444
|
},
|
|
@@ -450,7 +462,93 @@ const CONNECTION_RECOVERY_FIELDS: Record<
|
|
|
450
462
|
},
|
|
451
463
|
};
|
|
452
464
|
|
|
465
|
+
const NETWORK_CONNECTION_FIELDS: Record<
|
|
466
|
+
keyof NetworkConnectionObserverConfig,
|
|
467
|
+
ConfigNode
|
|
468
|
+
> = {
|
|
469
|
+
statusReporter: {
|
|
470
|
+
description:
|
|
471
|
+
"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.",
|
|
472
|
+
kind: 'value',
|
|
473
|
+
type: 'function',
|
|
474
|
+
},
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
const WS_CONNECTION_FIELDS: Record<keyof WSConnectionConfig, ConfigNode> = {
|
|
478
|
+
connection: {
|
|
479
|
+
description:
|
|
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.',
|
|
481
|
+
kind: 'value',
|
|
482
|
+
type: 'object',
|
|
483
|
+
},
|
|
484
|
+
connectTimeoutMs: {
|
|
485
|
+
description:
|
|
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.",
|
|
487
|
+
kind: 'value',
|
|
488
|
+
type: 'number',
|
|
489
|
+
},
|
|
490
|
+
enableWSFallback: {
|
|
491
|
+
description:
|
|
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`.',
|
|
493
|
+
kind: 'value',
|
|
494
|
+
type: 'boolean',
|
|
495
|
+
},
|
|
496
|
+
offlineNotificationDisplayDelayMs: {
|
|
497
|
+
description:
|
|
498
|
+
'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.',
|
|
499
|
+
kind: 'value',
|
|
500
|
+
type: 'number',
|
|
501
|
+
},
|
|
502
|
+
healthCheckGracePeriodMs: {
|
|
503
|
+
description:
|
|
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.',
|
|
505
|
+
kind: 'value',
|
|
506
|
+
type: 'number',
|
|
507
|
+
},
|
|
508
|
+
pingIntervalMs: {
|
|
509
|
+
description:
|
|
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.',
|
|
511
|
+
kind: 'value',
|
|
512
|
+
type: 'number',
|
|
513
|
+
},
|
|
514
|
+
urlParams: {
|
|
515
|
+
description: 'Extra query parameters appended to the WebSocket URL.',
|
|
516
|
+
kind: 'value',
|
|
517
|
+
type: 'object',
|
|
518
|
+
},
|
|
519
|
+
webSocketImpl: {
|
|
520
|
+
description:
|
|
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`.',
|
|
522
|
+
kind: 'value',
|
|
523
|
+
type: 'function',
|
|
524
|
+
},
|
|
525
|
+
};
|
|
526
|
+
|
|
453
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
|
+
},
|
|
454
552
|
connectionRecovery: {
|
|
455
553
|
description:
|
|
456
554
|
'Bringing the channels, lists and threads you are reading back in line after a reconnect.',
|
|
@@ -462,11 +560,29 @@ const CLIENT_FIELDS: Record<keyof ClientDeclarativeConfig, ConfigNode> = {
|
|
|
462
560
|
fields: MESSAGE_DELIVERY_FIELDS,
|
|
463
561
|
kind: 'group',
|
|
464
562
|
},
|
|
563
|
+
networkConnection: {
|
|
564
|
+
description:
|
|
565
|
+
"The device's own network status, as distinct from this client's WebSocket. Fed by a platform listener you register.",
|
|
566
|
+
fields: NETWORK_CONNECTION_FIELDS,
|
|
567
|
+
kind: 'group',
|
|
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
|
+
},
|
|
465
575
|
notifications: {
|
|
466
576
|
description: 'The client-wide notification (toast) manager.',
|
|
467
577
|
fields: NOTIFICATION_FIELDS,
|
|
468
578
|
kind: 'group',
|
|
469
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
|
+
},
|
|
470
586
|
reminders: {
|
|
471
587
|
description: 'Message reminders and their scheduling offsets.',
|
|
472
588
|
fields: REMINDER_FIELDS,
|
|
@@ -477,12 +593,14 @@ const CLIENT_FIELDS: Record<keyof ClientDeclarativeConfig, ConfigNode> = {
|
|
|
477
593
|
fields: THREAD_MANAGER_FIELDS,
|
|
478
594
|
kind: 'group',
|
|
479
595
|
},
|
|
596
|
+
wsConnection: {
|
|
597
|
+
description:
|
|
598
|
+
"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.",
|
|
599
|
+
fields: WS_CONNECTION_FIELDS,
|
|
600
|
+
kind: 'group',
|
|
601
|
+
},
|
|
480
602
|
};
|
|
481
603
|
|
|
482
|
-
// ---------------------------------------------------------------------------
|
|
483
|
-
// channel / thread
|
|
484
|
-
// ---------------------------------------------------------------------------
|
|
485
|
-
|
|
486
604
|
const CHANNEL_FIELDS: Record<keyof ChannelDeclarativeConfig, ConfigNode> = {
|
|
487
605
|
messageOperations: messageOperationsGroup(
|
|
488
606
|
'Sending and retrying messages in the channel. Overrides the shared `messageOperations` key for channels only.',
|
|
@@ -519,7 +637,7 @@ const CHANNEL_FIELDS: Record<keyof ChannelDeclarativeConfig, ConfigNode> = {
|
|
|
519
637
|
kind: 'group',
|
|
520
638
|
},
|
|
521
639
|
userMessageReminders: {
|
|
522
|
-
description: 'Message reminders
|
|
640
|
+
description: 'Message reminders: "remind me" and "save for later".',
|
|
523
641
|
fields: {
|
|
524
642
|
enabled: {
|
|
525
643
|
description:
|
|
@@ -547,7 +665,13 @@ const CHANNEL_FIELDS: Record<keyof ChannelDeclarativeConfig, ConfigNode> = {
|
|
|
547
665
|
fields: {
|
|
548
666
|
enabled: {
|
|
549
667
|
description:
|
|
550
|
-
'Allows marking the channel read or unread. The server must also allow it per channel type (`read_events`), and a server "no" wins.',
|
|
668
|
+
'Allows counting unread messages and marking the channel read or unread. The server must also allow it per channel type (`read_events`), and a server "no" wins. Without the own `read-events` capability read events stay off.',
|
|
669
|
+
kind: 'value',
|
|
670
|
+
type: 'boolean',
|
|
671
|
+
},
|
|
672
|
+
localUnreadCountEnabled: {
|
|
673
|
+
description:
|
|
674
|
+
'Counts unread messages client-side while read events are off (`channel.readEventsEnabled` is false), reset by `channel.markReadLocally()` instead of a request. Has no effect while read events are on. Not subject to server authority.',
|
|
551
675
|
kind: 'value',
|
|
552
676
|
type: 'boolean',
|
|
553
677
|
},
|
|
@@ -567,29 +691,15 @@ const THREAD_FIELDS: Record<keyof ThreadDeclarativeConfig, ConfigNode> = {
|
|
|
567
691
|
};
|
|
568
692
|
|
|
569
693
|
/**
|
|
570
|
-
* A runtime description of the
|
|
571
|
-
*
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
* `client.config.set()`. This is the same knowledge for everyone who cannot read the types at the moment
|
|
575
|
-
* they need it — a settings UI listing what can be changed, a JavaScript caller, a documentation
|
|
576
|
-
* generator. Without it, the only way to learn that `thread` accepts `messagePaginator` is to open the
|
|
577
|
-
* SDK source.
|
|
578
|
-
*
|
|
579
|
-
* **Completeness is enforced by the compiler, not by discipline.** Every level is annotated
|
|
580
|
-
* `Record<keyof SomeConfigType, ConfigNode>`, so a field added to any configuration type fails the build
|
|
581
|
-
* until it is described here. That is what separates this from a hand-maintained list, which drifts
|
|
582
|
-
* behind the tree silently and is exactly the failure this replaces.
|
|
583
|
-
*
|
|
584
|
-
* **What is deliberately absent.** No default values: an effective default depends on the construction
|
|
585
|
-
* site — `pageSize` is 10 for a bare paginator and larger for the channel message list — so a table of
|
|
586
|
-
* them here would be a second source of truth that disagrees with the instances. Read current values from
|
|
587
|
-
* the instance (`channel.messagePaginator.config`) and registered values from
|
|
588
|
-
* {@link InstanceConfigurationRegistry.getTree}. Construction-only paths are absent for the same reason:
|
|
589
|
-
* `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.
|
|
590
698
|
*
|
|
591
|
-
*
|
|
592
|
-
*
|
|
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`.
|
|
593
703
|
*/
|
|
594
704
|
export const INSTANCE_CONFIG_TREE_SHAPE: Record<
|
|
595
705
|
keyof InstanceConfigTree,
|
|
@@ -615,7 +725,7 @@ export const INSTANCE_CONFIG_TREE_SHAPE: Record<
|
|
|
615
725
|
},
|
|
616
726
|
messageComposer: {
|
|
617
727
|
description:
|
|
618
|
-
"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.",
|
|
619
729
|
fields: MESSAGE_COMPOSER_FIELDS,
|
|
620
730
|
kind: 'group',
|
|
621
731
|
},
|
|
@@ -627,13 +737,13 @@ export const INSTANCE_CONFIG_TREE_SHAPE: Record<
|
|
|
627
737
|
},
|
|
628
738
|
messagePaginator: {
|
|
629
739
|
description:
|
|
630
|
-
'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.',
|
|
631
741
|
fields: MESSAGE_PAGINATOR_FIELDS,
|
|
632
742
|
kind: 'group',
|
|
633
743
|
},
|
|
634
744
|
searchController: {
|
|
635
745
|
description:
|
|
636
|
-
'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).',
|
|
637
747
|
fields: SEARCH_CONTROLLER_FIELDS,
|
|
638
748
|
kind: 'group',
|
|
639
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,25 +13,22 @@ 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';
|
|
18
|
-
import type {
|
|
20
|
+
import type {
|
|
21
|
+
ConnectionRecoveryManagerConfig,
|
|
22
|
+
NetworkConnectionObserverConfig,
|
|
23
|
+
WSConnectionConfig,
|
|
24
|
+
} from '../connection';
|
|
19
25
|
import type { MessageOperationsConfig } from '../messageOperations/MessageOperations';
|
|
20
26
|
import type { DeclarativePaginatorConfig as ImportedDeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
|
|
21
27
|
import type { DeepPartial } from '../types.utility';
|
|
22
28
|
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
// Keys
|
|
25
|
-
// ---------------------------------------------------------------------------
|
|
26
|
-
|
|
27
29
|
/**
|
|
28
|
-
* Maps a configuration key to the argument its setup function receives.
|
|
29
|
-
*
|
|
30
|
-
* A closed set, and deliberately not an `interface`: a type alias cannot be reached by module
|
|
31
|
-
* augmentation, so the key space cannot be extended from outside this package. Configuration for a class
|
|
32
|
-
* this package does not own belongs to whoever owns that class — a registry of its own, not a key in this
|
|
33
|
-
* 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.
|
|
34
32
|
*/
|
|
35
33
|
export type InstanceSetupFunctionArgs = {
|
|
36
34
|
channel: { channel: Channel };
|
|
@@ -42,32 +40,20 @@ export type InstanceSetupFunctionArgs = {
|
|
|
42
40
|
};
|
|
43
41
|
|
|
44
42
|
/**
|
|
45
|
-
* The keys that take a
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* Closed, and not extensible: an undeclared string is a compile error, and {@link
|
|
49
|
-
* InstanceSetupFunctionArgs} is a type alias rather than an interface, so a key cannot be added by module
|
|
50
|
-
* augmentation either. This key space describes what *this package* configures.
|
|
51
|
-
*
|
|
52
|
-
* A strict subset of {@link InstanceConfigKey}: `messagePaginator` and `messageOperations` take
|
|
53
|
-
* configuration but have no setup function, because they are not built one-per-key — a channel and every
|
|
54
|
-
* one of its threads each own one.
|
|
43
|
+
* The keys that take a setup function. A strict subset of {@link InstanceConfigKey}: `messagePaginator`
|
|
44
|
+
* and `messageOperations` take configuration but no setup function, since a channel and each of its
|
|
45
|
+
* threads own one.
|
|
55
46
|
*/
|
|
56
47
|
export type InstanceSetupKey = keyof InstanceSetupFunctionArgs;
|
|
57
48
|
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
// Tier 2 — setup functions
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
|
|
62
49
|
export type InstanceSetupFunctionArgsOf<K extends InstanceSetupKey> =
|
|
63
50
|
InstanceSetupFunctionArgs[K];
|
|
64
51
|
|
|
65
52
|
export type InstanceSetupTearDownFunction = () => void;
|
|
66
53
|
|
|
67
54
|
/**
|
|
68
|
-
* Runs against every instance of its class
|
|
69
|
-
*
|
|
70
|
-
* 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.
|
|
71
57
|
*/
|
|
72
58
|
export type InstanceSetupFunction<K extends InstanceSetupKey = InstanceSetupKey> = (
|
|
73
59
|
args: InstanceSetupFunctionArgsOf<K>,
|
|
@@ -77,31 +63,19 @@ export type InstanceSetupState<K extends InstanceSetupKey = InstanceSetupKey> =
|
|
|
77
63
|
setupFunction: InstanceSetupFunction<K> | null;
|
|
78
64
|
};
|
|
79
65
|
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
// Tier 1 — declarative configuration
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
|
|
84
66
|
/** Whether `jumpToTheFirstUnreadMessage` prefers the paginator's snapshot or the channel read state. */
|
|
85
67
|
export type UnreadReferencePolicy = 'snapshot' | 'read-state-only';
|
|
86
68
|
|
|
87
69
|
/**
|
|
88
|
-
* Paginator fields settable through the declarative tree.
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* Deliberately excluded there:
|
|
93
|
-
* - `itemIndex` / `createItemIndex` — an index instance and a factory, not configuration. Deep-merging
|
|
94
|
-
* a class instance is unsound, and swapping an index would drop already-loaded items.
|
|
95
|
-
* - `doRequest`, `itemOrderComparator`, `deriveCursor` — installed per paginator subclass
|
|
96
|
-
* (`PinnedMessagePaginator` supplies all three). Replace them through a setup function, where the
|
|
97
|
-
* existing value is visible and restorable.
|
|
98
|
-
*
|
|
99
|
-
* `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
|
|
100
74
|
* {@link CONSTRUCTION_ONLY_CONFIG_PATHS}.
|
|
101
75
|
*/
|
|
102
76
|
export type { DeclarativePaginatorConfig } from '../pagination/paginators/BasePaginator';
|
|
103
77
|
|
|
104
|
-
/** Adds the message-list-only
|
|
78
|
+
/** Adds the message-list-only `unreadReferencePolicy`. */
|
|
105
79
|
export type DeclarativeMessagePaginatorConfig = ImportedDeclarativePaginatorConfig & {
|
|
106
80
|
unreadReferencePolicy?: UnreadReferencePolicy;
|
|
107
81
|
};
|
|
@@ -122,7 +96,7 @@ export type ChannelDeclarativeConfig = {
|
|
|
122
96
|
userMessageReminders?: Partial<ChannelConfig['userMessageReminders']>;
|
|
123
97
|
/** Delivery receipts, ANDed with the channel type's `delivery_events`. */
|
|
124
98
|
deliveryEvents?: Partial<ChannelConfig['deliveryEvents']>;
|
|
125
|
-
// `commands` is
|
|
99
|
+
// `commands` is absent: the server owns the list.
|
|
126
100
|
};
|
|
127
101
|
|
|
128
102
|
export type ThreadDeclarativeConfig = {
|
|
@@ -134,85 +108,88 @@ export type ThreadDeclarativeConfig = {
|
|
|
134
108
|
|
|
135
109
|
export type ClientDeclarativeConfig = {
|
|
136
110
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
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`.
|
|
139
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;
|
|
140
139
|
connectionRecovery?: Partial<ConnectionRecoveryManagerConfig>;
|
|
141
140
|
messageDelivery?: Partial<MessageDeliveryReporterConfig>;
|
|
141
|
+
/**
|
|
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.
|
|
145
|
+
*/
|
|
146
|
+
networkConnection?: Partial<NetworkConnectionObserverConfig>;
|
|
142
147
|
threads?: Partial<ThreadManagerConfig>;
|
|
148
|
+
/** `Partial`, not `DeepPartial`: fields are flat or class instances, which it would descend into. */
|
|
149
|
+
wsConnection?: Partial<WSConnectionConfig>;
|
|
143
150
|
notifications?: DeepPartial<NotificationManagerConfig>;
|
|
144
151
|
/**
|
|
145
152
|
* `Partial`, not `DeepPartial`: `scheduledOffsetsMs` is a `number[]`, and `DeepPartial` would widen
|
|
146
|
-
* its elements to `number | undefined`, which `ReminderManager.updateConfig`
|
|
153
|
+
* its elements to `number | undefined`, which `ReminderManager.updateConfig` rejects.
|
|
147
154
|
*/
|
|
148
155
|
reminders?: Partial<ReminderManagerConfig>;
|
|
149
156
|
};
|
|
150
157
|
|
|
151
158
|
/**
|
|
152
|
-
* Maps a configuration key to its declarative configuration subtree.
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* **When something gets its own key rather than being nested under a parent** — the rule that decides
|
|
157
|
-
* the shape of this interface:
|
|
158
|
-
*
|
|
159
|
-
* - **One parent type ⇒ nest it.** `channel.pinnedMessagesPaginator`, `channel.cooldownTimer`, the
|
|
160
|
-
* composer's own sub-managers. There is only one place it can be reached from.
|
|
161
|
-
* - **Several parent types, and the configuration means the same thing under each ⇒ own key.**
|
|
162
|
-
* `MessageComposer` hangs off a `Channel`, a `Thread`, *and* a message (the React SDK builds
|
|
163
|
-
* message-scoped composers for editing). `drafts.enabled` means the same in all three, so nesting it
|
|
164
|
-
* under `channel` would silently miss two thirds of the composers.
|
|
165
|
-
* - **Several parent types, but the configuration is inherently parent-specific ⇒ nest it anyway.**
|
|
166
|
-
* No built-in falls here today. It is kept as a case because it is the one that decides against a shared
|
|
167
|
-
* key, and the next entity to arrive may need it.
|
|
168
|
-
* - **Several parent types, mixed ⇒ both.** A shared top-level key for what means the same thing, plus
|
|
169
|
-
* per-parent paths that override it field by field (see {@link mergeDeclarativeMessageOperationsConfig}).
|
|
170
|
-
* Both shared keys are here: `MessagePaginator` backs the channel message list *and* thread replies
|
|
171
|
-
* (`stateThrottleMs` / `retryCount` have no reason to differ, `pageSize` legitimately does), and
|
|
172
|
-
* `MessageOperations` backs channel *and* thread sends. `messageOperations` was briefly nested under
|
|
173
|
-
* `channel` on the reasoning that a channel send and a thread reply are different operations — which made
|
|
174
|
-
* `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}).
|
|
175
163
|
*/
|
|
176
164
|
export type InstanceConfigTree = {
|
|
177
165
|
channel: ChannelDeclarativeConfig;
|
|
178
166
|
client: ClientDeclarativeConfig;
|
|
179
167
|
/**
|
|
180
|
-
* Constructed by
|
|
181
|
-
*
|
|
182
|
-
* 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.
|
|
183
170
|
*/
|
|
184
171
|
liveLocationManager: Partial<LiveLocationManagerConfig>;
|
|
185
172
|
messageComposer: DeepPartial<MessageComposerConfig>;
|
|
186
173
|
/**
|
|
187
|
-
* Applies to
|
|
188
|
-
*
|
|
174
|
+
* Applies to every `MessageOperations`, the channel's and each thread's.
|
|
175
|
+
* `channel.messageOperations` and `thread.messageOperations` override it per parent.
|
|
189
176
|
*/
|
|
190
177
|
messageOperations: Partial<MessageOperationsConfig>;
|
|
191
178
|
/**
|
|
192
|
-
* Applies to
|
|
179
|
+
* Applies to every `MessagePaginator`, the channel message list and thread replies alike.
|
|
193
180
|
* `channel.messagePaginator` and `thread.messagePaginator` override it per parent.
|
|
194
|
-
*
|
|
195
|
-
* `channel.pinnedMessagesPaginator` is deliberately **not** included: it has a single parent, so by
|
|
196
|
-
* the rule above it stays nested. It is also a different class (`PinnedMessagePaginator`, with its own
|
|
197
|
-
* ordering and endpoint) rather than a `MessagePaginator`.
|
|
181
|
+
* `channel.pinnedMessagesPaginator` is not included: it is a different class with a single parent.
|
|
198
182
|
*/
|
|
199
183
|
messagePaginator: DeclarativeMessagePaginatorConfig;
|
|
200
184
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* 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`).
|
|
204
187
|
*/
|
|
205
188
|
searchController: Partial<SearchControllerConfig>;
|
|
206
189
|
thread: ThreadDeclarativeConfig;
|
|
207
190
|
};
|
|
208
191
|
|
|
209
|
-
/**
|
|
210
|
-
* Every key that takes **declarative configuration** — {@link InstanceSetupKey} plus the two that are
|
|
211
|
-
* configuration-only.
|
|
212
|
-
*
|
|
213
|
-
* Closed for the same reason, and {@link InstanceConfigTree} is likewise a type alias, so this set is
|
|
214
|
-
* fixed by the package.
|
|
215
|
-
*/
|
|
192
|
+
/** Every key that takes declarative configuration: {@link InstanceSetupKey} plus the config-only ones. */
|
|
216
193
|
export type InstanceConfigKey = keyof InstanceConfigTree;
|
|
217
194
|
|
|
218
195
|
export type InstanceConfigOf<K extends InstanceConfigKey> = InstanceConfigTree[K];
|