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
package/dist/types/channel.d.ts
CHANGED
|
@@ -3,326 +3,206 @@ import { CooldownTimer } from './CooldownTimer';
|
|
|
3
3
|
import { MessageComposer } from './messageComposer';
|
|
4
4
|
import { MessageReceiptsTracker } from './messageDelivery';
|
|
5
5
|
import { MessagePaginator, PinnedMessagePaginator } from './pagination/paginators';
|
|
6
|
-
import { MessageOperations } from './messageOperations';
|
|
6
|
+
import type { MessageOperations } from './messageOperations';
|
|
7
|
+
import type { OperationRequestFn } from './messageOperations/types';
|
|
7
8
|
import type { StreamChat } from './client';
|
|
8
9
|
import type { ChannelDeclarativeConfig } from './configuration/types';
|
|
9
|
-
import type { AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse,
|
|
10
|
-
import type { StateStore } from '
|
|
11
|
-
import type {
|
|
10
|
+
import type { AddMembersRequest, AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse, ChannelStateResponse, ChannelStateResponseFields, Command, Event, EventHandler, EventPayload, EventType, FileUploadInput, FilterTagsRequest, InviteMembersRequest, LocalMessage, MarkReadRequest, MarkReadResponse, MessageResponse, QueryMembersPayload, RemoveMembersRequest, SharedLocation, StreamRequestOptions, StreamResponse, TimestampNS, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UserResponse } from './types';
|
|
11
|
+
import type { StateStore } from '@stream-io/state-store';
|
|
12
|
+
import type { ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, MuteChannelRequest as Gen_MuteChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UploadChannelFileRequest, UploadChannelRequest } from './gen/models';
|
|
12
13
|
import type { ChatApi } from './gen/chat/ChatApi';
|
|
13
14
|
import { ChannelApi } from './gen/chat/ChannelApi';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
message?: MessageRequest;
|
|
17
|
-
options?: SendMessageOptions;
|
|
18
|
-
/**
|
|
19
|
-
* Per-call override for the send/retry request (advanced).
|
|
20
|
-
* If set, it takes precedence over channel instance configuration handlers.
|
|
21
|
-
*/
|
|
22
|
-
sendMessageRequestFn?: CustomSendMessageRequestFn;
|
|
23
|
-
};
|
|
24
|
-
export type RetrySendMessageWithLocalUpdateParams = Omit<SendMessageWithStateUpdateParams, 'message'>;
|
|
25
|
-
export type UpdateMessageWithStateUpdateParams = {
|
|
26
|
-
localMessage: LocalMessage;
|
|
27
|
-
options?: UpdateMessageOptions;
|
|
28
|
-
/**
|
|
29
|
-
* Per-call override for the update request (advanced).
|
|
30
|
-
* If set, it takes precedence over channel instance configuration handlers.
|
|
31
|
-
*/
|
|
32
|
-
updateMessageRequestFn?: CustomUpdateMessageRequestFn;
|
|
33
|
-
};
|
|
34
|
-
export type DeleteMessageWithStateUpdateParams = {
|
|
35
|
-
localMessage: LocalMessage;
|
|
36
|
-
options?: DeleteMessageOptions;
|
|
37
|
-
/**
|
|
38
|
-
* Per-call override for the delete request (advanced).
|
|
39
|
-
* If set, it takes precedence over channel instance configuration handlers.
|
|
40
|
-
*/
|
|
41
|
-
deleteMessageRequestFn?: CustomDeleteMessageRequestFn;
|
|
42
|
-
};
|
|
43
|
-
export type CustomSendMessageRequestFn = (params: Omit<SendMessageWithStateUpdateParams, 'sendMessageRequestFn'>) => Promise<{
|
|
44
|
-
message: MessageResponse;
|
|
45
|
-
}>;
|
|
46
|
-
export type CustomUpdateMessageRequestFn = (params: Omit<UpdateMessageWithStateUpdateParams, 'updateMessageRequestFn'>) => Promise<{
|
|
47
|
-
message: MessageResponse;
|
|
48
|
-
}>;
|
|
49
|
-
export type CustomDeleteMessageRequestFn = (params: Omit<DeleteMessageWithStateUpdateParams, 'deleteMessageRequestFn'>) => Promise<{
|
|
50
|
-
message: MessageResponse;
|
|
51
|
-
}>;
|
|
15
|
+
/** Re-exported here because `src/messageOperations` is not in the root barrel. */
|
|
16
|
+
export type { DefaultOperationRequest, MessageOperationSpec, OperationKind, OperationParams, OperationRequestFn, OperationResponse, } from './messageOperations/types';
|
|
52
17
|
export type CustomMarkReadRequestFn = (params: {
|
|
53
18
|
channel: Channel;
|
|
54
19
|
options?: MarkReadRequest;
|
|
55
20
|
}) => Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
|
|
56
21
|
/**
|
|
57
|
-
* A channel's
|
|
58
|
-
*
|
|
59
|
-
* Not `ChannelConfigWithInfo`, which is the generated type for the channel *type's server*
|
|
60
|
-
* configuration behind {@link Channel.serverConfig}. The two are related: the gates below are the
|
|
61
|
-
* server's flags already ANDed with what the integrator registered.
|
|
22
|
+
* A channel's resolved configuration, returned by {@link Channel.config}. The gates are the server's
|
|
23
|
+
* flags (see {@link Channel.serverConfig}) ANDed with what the integrator registered.
|
|
62
24
|
*/
|
|
63
25
|
export type ChannelConfig = {
|
|
64
26
|
requestHandlers?: {
|
|
65
|
-
deleteMessageRequest?:
|
|
27
|
+
deleteMessageRequest?: OperationRequestFn<'delete'>;
|
|
66
28
|
markReadRequest?: CustomMarkReadRequestFn;
|
|
67
|
-
sendMessageRequest?:
|
|
68
|
-
retrySendMessageRequest?:
|
|
69
|
-
updateMessageRequest?:
|
|
29
|
+
sendMessageRequest?: OperationRequestFn<'send'>;
|
|
30
|
+
retrySendMessageRequest?: OperationRequestFn<'retry'>;
|
|
31
|
+
updateMessageRequest?: OperationRequestFn<'update'>;
|
|
70
32
|
};
|
|
71
33
|
/**
|
|
72
|
-
* Typing indicators
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* This is the channel-wide gate, read by {@link Channel.keystroke} and {@link Channel.stopTyping}.
|
|
76
|
-
* `messageComposer.text.publishTypingEvents` sits on top of it as a per-composer refinement — a thread
|
|
77
|
-
* composer can stay quiet while the channel still permits typing events.
|
|
34
|
+
* Typing indicators. Defaults to enabled. ANDed with the channel type's `typing_events`. Read by
|
|
35
|
+
* {@link Channel.keystroke} and {@link Channel.stopTyping}.
|
|
36
|
+
* `messageComposer.text.publishTypingEvents` further switches them off per composer.
|
|
78
37
|
*/
|
|
79
38
|
typingEvents: {
|
|
80
39
|
enabled: boolean;
|
|
81
40
|
};
|
|
82
41
|
/**
|
|
83
|
-
* Read receipts
|
|
84
|
-
*
|
|
85
|
-
* {@link Channel.markUnread}.
|
|
42
|
+
* Read receipts. `enabled` is ANDed with the channel type's `read_events`. Together with the own
|
|
43
|
+
* `read-events` capability it decides {@link Channel.readEventsEnabled}, which gates counting
|
|
44
|
+
* unread messages, {@link Channel.markRead} and {@link Channel.markUnread}. Defaults to `true`.
|
|
45
|
+
*
|
|
46
|
+
* `localUnreadCountEnabled` applies only while read events are off
|
|
47
|
+
* ({@link Channel.readEventsEnabled} is false): the channel keeps counting unread messages and
|
|
48
|
+
* {@link Channel.markReadLocally} resets the count, sending nothing to the server. The server does
|
|
49
|
+
* not restrict it. Defaults to `false`.
|
|
86
50
|
*/
|
|
87
51
|
readEvents: {
|
|
88
52
|
enabled: boolean;
|
|
53
|
+
localUnreadCountEnabled: boolean;
|
|
89
54
|
};
|
|
90
|
-
/**
|
|
91
|
-
* Threaded replies for this channel (defaults to enabled). ANDed with the channel type's `replies`.
|
|
92
|
-
*/
|
|
55
|
+
/** Threaded replies. Defaults to enabled. ANDed with the channel type's `replies`. */
|
|
93
56
|
replies: {
|
|
94
57
|
enabled: boolean;
|
|
95
58
|
};
|
|
96
59
|
/**
|
|
97
|
-
* Message reminders
|
|
98
|
-
* type's `user_message_reminders`.
|
|
60
|
+
* Message reminders. Defaults to enabled. ANDed with the channel type's `user_message_reminders`.
|
|
99
61
|
*/
|
|
100
62
|
userMessageReminders: {
|
|
101
63
|
enabled: boolean;
|
|
102
64
|
};
|
|
103
|
-
/**
|
|
104
|
-
* Delivery receipts (defaults to enabled). ANDed with the channel type's `delivery_events`.
|
|
105
|
-
*/
|
|
65
|
+
/** Delivery receipts. Defaults to enabled. ANDed with the channel type's `delivery_events`. */
|
|
106
66
|
deliveryEvents: {
|
|
107
67
|
enabled: boolean;
|
|
108
68
|
};
|
|
109
69
|
/**
|
|
110
|
-
* The slash commands
|
|
111
|
-
*
|
|
112
|
-
* Named for availability rather than enablement on purpose: whether any given command can be *used*
|
|
113
|
-
* right now is `messageComposer.isCommandDisabled(command)`, which depends on the message context —
|
|
114
|
-
* editing and quoting disable different ones. A list called `enabledCommands` would routinely contain
|
|
115
|
-
* disabled entries.
|
|
116
|
-
*
|
|
117
|
-
* **Server-owned, and the one field here the integrator cannot set.** It is a list rather than a gate,
|
|
118
|
-
* so there is nothing to AND and no intent to express — the server's answer simply *is* the value, and
|
|
119
|
-
* it is absent from the declarative tree for that reason.
|
|
120
|
-
*
|
|
121
|
-
* It lives on the resolved configuration anyway so that consumers never need a second place to look:
|
|
122
|
-
* every question about what this channel permits is answered by `config`. Reading the raw
|
|
123
|
-
* {@link Channel.serverConfig} instead is what made a UI show features the client had disabled — the
|
|
124
|
-
* gates below have a client half, and mixing the two sources meant sometimes reading only one.
|
|
70
|
+
* The slash commands the channel type offers. Server-owned: the integrator cannot set it. Whether a
|
|
71
|
+
* command can be used right now is `messageComposer.isCommandDisabled(command)`.
|
|
125
72
|
*/
|
|
126
73
|
availableCommands: Command[];
|
|
127
74
|
};
|
|
128
75
|
export declare const DEFAULT_CHANNEL_CONFIG: ChannelConfig;
|
|
129
|
-
/**
|
|
130
|
-
* The Channel class manages its own state.
|
|
131
|
-
*/
|
|
132
76
|
export declare class Channel extends ChannelApi {
|
|
133
77
|
_client: StreamChat;
|
|
134
|
-
data: Partial<ChannelResponse> | undefined;
|
|
135
78
|
_data: ChannelInput;
|
|
136
79
|
cid: string;
|
|
137
|
-
/** */
|
|
138
80
|
listeners: Map<EventType, Set<EventHandler>>;
|
|
139
81
|
state: ChannelState;
|
|
140
82
|
lastKeyStroke?: Date;
|
|
141
83
|
lastTypingEvent: Date | null;
|
|
142
84
|
isTyping: boolean;
|
|
143
|
-
/** Re-entrancy guard for {@link Channel.reload}
|
|
85
|
+
/** Re-entrancy guard for {@link Channel.reload}. */
|
|
144
86
|
private _reloading;
|
|
145
|
-
/** Refcount
|
|
87
|
+
/** Refcount behind the `active` flag: several consumers can hold one instance. */
|
|
146
88
|
private _activeRefCount;
|
|
147
|
-
|
|
89
|
+
/** Stops releaseUnusedChannels() from removing a channel while a query for it is still running. */
|
|
90
|
+
private _channelQueriesInFlight;
|
|
91
|
+
/** The watch queries {@link Channel.watch} callers wait for, joined by equal options. */
|
|
92
|
+
private _watchQueriesInFlight;
|
|
148
93
|
/**
|
|
149
|
-
* The
|
|
150
|
-
* `
|
|
151
|
-
*
|
|
152
|
-
* `mergeSlice: 'deep'` because the config has nested groups: registering `typingEvents.enabled` must
|
|
153
|
-
* not drop `readEvents`. `applyAuthority` is what makes `channel.config` the *whole* answer rather
|
|
154
|
-
* than the client's half — see {@link serverRestrictions}.
|
|
94
|
+
* The options of the last {@link Channel.watch} query that succeeded during the current watch: a
|
|
95
|
+
* `watch()` with these options has nothing to send. Cleared when the watch ends.
|
|
155
96
|
*/
|
|
97
|
+
private _lastWatchOptions?;
|
|
98
|
+
push_preferences?: Gen_ChannelPushPreferencesResponse;
|
|
156
99
|
private readonly configController;
|
|
157
100
|
readonly messageComposer: MessageComposer;
|
|
158
101
|
readonly messageReceiptsTracker: MessageReceiptsTracker;
|
|
102
|
+
readonly messageOperations: MessageOperations;
|
|
159
103
|
readonly messagePaginator: MessagePaginator;
|
|
160
104
|
readonly pinnedMessagesPaginator: PinnedMessagePaginator;
|
|
161
|
-
readonly messageOperations: MessageOperations;
|
|
162
105
|
readonly cooldownTimer: CooldownTimer;
|
|
163
|
-
/**
|
|
164
|
-
* Teardown for this channel's configuration subscription, released by {@link _disconnect}. Channels
|
|
165
|
-
* are retained in `client.activeChannels`, so leaving this subscribed would keep growing the
|
|
166
|
-
* configuration store's handler set across reconnects.
|
|
167
|
-
*/
|
|
168
106
|
private unsubscribeConfiguration?;
|
|
169
|
-
/** Teardown for the server-config re-derivation subscription, released by {@link _disconnect}. */
|
|
170
107
|
private unsubscribeServerConfig?;
|
|
171
|
-
/** The declarative slice last derived from, so a late server
|
|
108
|
+
/** The declarative slice last derived from, so a late server config can re-derive from it. */
|
|
172
109
|
private declarativeConfig?;
|
|
173
110
|
/**
|
|
174
|
-
* Creates
|
|
111
|
+
* Creates an uninitialized channel. Without an `id` its `cid` is a temporary one built from
|
|
112
|
+
* `data.members`, until the server answers.
|
|
175
113
|
*
|
|
176
114
|
* @param client - The chat client.
|
|
177
|
-
* @param type - The type
|
|
178
|
-
* @param id - The ID
|
|
179
|
-
* @param data -
|
|
180
|
-
* @returns A new uninitialized channel.
|
|
115
|
+
* @param type - The channel type.
|
|
116
|
+
* @param id - The channel ID, or `undefined` for a channel created from members.
|
|
117
|
+
* @param data - Data for the channel (members, custom fields).
|
|
181
118
|
*/
|
|
182
119
|
constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelInput);
|
|
183
|
-
/**
|
|
184
|
-
* The configuration fields this channel's *type* decides server-side.
|
|
185
|
-
*
|
|
186
|
-
* Both are boolean gates, so `mergeServerRestrictions` ANDs them with what was requested: either the
|
|
187
|
-
* server or the integrator may switch a feature off, and neither can widen. Re-read on every
|
|
188
|
-
* derivation rather than captured, so a flag that changes mid-session is picked up.
|
|
189
|
-
*/
|
|
120
|
+
/** Flags the channel type decides server-side (ANDed with the requested ones). */
|
|
190
121
|
private get serverRestrictions();
|
|
191
122
|
/**
|
|
192
|
-
*
|
|
123
|
+
* Re-derives the configuration of the channel, its paginators and its message operations from the
|
|
124
|
+
* declarative slice. Runs at construction, on every change to the `channel`, `messagePaginator` or
|
|
125
|
+
* `messageOperations` configuration, and on `client.config.reset()`.
|
|
193
126
|
*
|
|
194
|
-
*
|
|
195
|
-
* `requestHandlers`; each sub-object derives its own configuration, so the knowledge of what
|
|
196
|
-
* `messagePaginator.pageSize` means stays inside the paginator.
|
|
127
|
+
* @param declarativeConfig - The channel's declarative slice (optional).
|
|
197
128
|
*/
|
|
198
129
|
initializeConfig(declarativeConfig?: ChannelDeclarativeConfig): void;
|
|
199
130
|
/**
|
|
200
|
-
* Returns the chat client for this channel.
|
|
201
|
-
* {@link Channel.pendingDisposal}.
|
|
131
|
+
* Returns the chat client for this channel.
|
|
202
132
|
*
|
|
203
133
|
* @returns The chat client.
|
|
134
|
+
* @throws If the channel is pending disposal ({@link Channel.pendingDisposal}).
|
|
204
135
|
*/
|
|
205
136
|
getClient(): StreamChat;
|
|
206
|
-
|
|
207
|
-
* Resolved configuration, as a store. Delegates rather than holding a copy, so the field and the
|
|
208
|
-
* controller's store cannot drift.
|
|
209
|
-
*
|
|
210
|
-
* Still directly writable, and deliberately so: the React SDK installs per-component request handlers
|
|
211
|
-
* by calling `partialNext({ requestHandlers })` on it. That write bypasses the controller, which is
|
|
212
|
-
* why `requestHandlers` is the one field a re-derivation replaces wholesale — see
|
|
213
|
-
* {@link initializeConfig}.
|
|
214
|
-
*/
|
|
137
|
+
private disposedError;
|
|
215
138
|
get configState(): StateStore<ChannelConfig>;
|
|
216
|
-
/**
|
|
217
|
-
* This channel's **resolved** configuration — the shape every configurable class exposes.
|
|
218
|
-
*
|
|
219
|
-
* Not to be confused with {@link serverConfig}, which is this channel's configuration as the
|
|
220
|
-
* server reports it. This one has already folded that in: `typingEvents.enabled` is the server's
|
|
221
|
-
* `typing_events` ANDed with whatever the integrator registered, so it is the whole answer. The
|
|
222
|
-
* near-collision is why the server side became `serverConfig`, a getter that says what it
|
|
223
|
-
* is.
|
|
224
|
-
*/
|
|
225
139
|
get config(): Readonly<ChannelConfig>;
|
|
226
140
|
/**
|
|
227
|
-
*
|
|
228
|
-
* `
|
|
229
|
-
*
|
|
230
|
-
* Mostly a property of the channel *type*, but not only: a channel's own `config_overrides` narrow it
|
|
231
|
-
* for that channel alone, which is why the cache behind this is keyed by cid rather than by type. See
|
|
232
|
-
* `StreamChat._addChannelConfig`.
|
|
233
|
-
*
|
|
234
|
-
* `undefined` until this channel has been queried or watched — there is nothing to fall back on that
|
|
235
|
-
* would not be another channel's overrides. {@link config} covers that case with its defaults.
|
|
236
|
-
*
|
|
237
|
-
* Distinct from {@link config}, which is this instance's resolved configuration and already has the
|
|
238
|
-
* relevant flags below folded into it. Prefer `config` when deciding whether a feature is available:
|
|
239
|
-
* this getter answers only the server's half, so gating UI on it offers features the client has
|
|
240
|
-
* already disabled.
|
|
141
|
+
* The channel's configuration as the server reports it (`uploads`, `typing_events`, `commands`, ...),
|
|
142
|
+
* including this channel's `config_overrides`. `undefined` until the channel is queried or watched.
|
|
143
|
+
* Gate features on {@link config} instead: it also folds in what the integrator disabled.
|
|
241
144
|
*/
|
|
242
145
|
get serverConfig(): import(".").ChannelConfigWithInfo | undefined;
|
|
243
|
-
_sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<StreamResponse<import(".").SendMessageResponse>>;
|
|
244
146
|
/**
|
|
245
|
-
* Sends a message to this channel.
|
|
147
|
+
* Sends a message to this channel. Strips `localMetadata` from attachments and drops those whose
|
|
148
|
+
* upload never completed.
|
|
246
149
|
*
|
|
247
150
|
* @param ...args - `[request, requestOptions]`. `request` holds the message body and optional
|
|
248
151
|
* flags such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`; `requestOptions`
|
|
249
152
|
* carries per-request options such as an abort `signal` and is never serialized into the request.
|
|
250
153
|
* @returns The server response.
|
|
251
154
|
*/
|
|
252
|
-
sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<import(".").SendMessageResponse
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Sends a message with optimistic local state update.
|
|
257
|
-
*/
|
|
258
|
-
sendMessageWithLocalUpdate(params: SendMessageWithStateUpdateParams): Promise<void>;
|
|
259
|
-
/**
|
|
260
|
-
* Retry sending a failed message.
|
|
261
|
-
*/
|
|
262
|
-
retrySendMessageWithLocalUpdate(params: Omit<SendMessageWithStateUpdateParams, 'message'>): Promise<void>;
|
|
263
|
-
/**
|
|
264
|
-
* Updates a message with optimistic local state update.
|
|
265
|
-
*/
|
|
266
|
-
updateMessageWithLocalUpdate(params: UpdateMessageWithStateUpdateParams): Promise<void>;
|
|
267
|
-
/**
|
|
268
|
-
* Deletes a message with local state update.
|
|
269
|
-
*/
|
|
270
|
-
deleteMessageWithLocalUpdate(params: DeleteMessageWithStateUpdateParams): Promise<void>;
|
|
155
|
+
sendMessage(...args: Parameters<ChannelApi['sendMessage']>): Promise<StreamResponse<import(".").SendMessageResponse>>;
|
|
156
|
+
sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<StreamResponse<import(".").SendReactionResponse>>;
|
|
157
|
+
deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<StreamResponse<import(".").DeleteReactionResponse>>;
|
|
271
158
|
/**
|
|
272
|
-
*
|
|
273
|
-
*/
|
|
274
|
-
addReactionWithLocalUpdate({ messageId, reaction, options, }: {
|
|
275
|
-
messageId: string;
|
|
276
|
-
reaction: ReactionRequest;
|
|
277
|
-
options?: Pick<SendReactionRequest, 'enforce_unique' | 'skip_push'>;
|
|
278
|
-
}): Promise<void>;
|
|
279
|
-
/**
|
|
280
|
-
* Removes the current user's reaction with an optimistic local state update - see
|
|
281
|
-
* {@link deleteReactionOptimistically}.
|
|
282
|
-
*/
|
|
283
|
-
deleteReactionWithLocalUpdate({ messageId, type, }: {
|
|
284
|
-
messageId: string;
|
|
285
|
-
type: string;
|
|
286
|
-
}): Promise<void>;
|
|
287
|
-
/**
|
|
288
|
-
* Upload a file to this channel's file endpoint (multipart).
|
|
159
|
+
* Uploads a file to this channel's file endpoint (multipart).
|
|
289
160
|
*
|
|
290
161
|
* @param request - Upload payload. `request.file` is the file to upload.
|
|
291
|
-
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
292
|
-
*
|
|
162
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
163
|
+
* (optional).
|
|
164
|
+
* @returns The upload response, with the CDN URL in `file`.
|
|
293
165
|
*/
|
|
294
166
|
uploadChannelFile(request?: Omit<UploadChannelFileRequest, 'file'> & {
|
|
295
167
|
file?: FileUploadInput;
|
|
296
168
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
|
|
297
169
|
/**
|
|
298
|
-
*
|
|
170
|
+
* Uploads an image to this channel's image endpoint (multipart).
|
|
299
171
|
*
|
|
300
172
|
* @param request - Upload payload. `request.file` is the image to upload.
|
|
301
|
-
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
302
|
-
*
|
|
173
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
174
|
+
* (optional).
|
|
175
|
+
* @returns The upload response, with the CDN URL in `file`.
|
|
303
176
|
*/
|
|
304
177
|
uploadChannelImage(request?: Omit<UploadChannelRequest, 'file'> & {
|
|
305
178
|
file?: FileUploadInput;
|
|
306
179
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelResponse>>;
|
|
307
|
-
/**
|
|
308
|
-
* Alias for {@link uploadChannelFile}, mirroring `client.uploadFile`.
|
|
309
|
-
*/
|
|
180
|
+
/** Alias for {@link uploadChannelFile}. */
|
|
310
181
|
uploadFile: (...args: Parameters<Channel["uploadChannelFile"]>) => Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
|
|
311
|
-
/** Alias for {@link uploadChannelImage}
|
|
182
|
+
/** Alias for {@link uploadChannelImage}. */
|
|
312
183
|
uploadImage: (...args: Parameters<Channel["uploadChannelImage"]>) => Promise<StreamResponse<import(".").UploadChannelResponse>>;
|
|
313
|
-
deleteFile(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
314
|
-
deleteImage(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
315
184
|
/**
|
|
316
|
-
*
|
|
185
|
+
* Deletes a file uploaded to this channel, the same request shape as `client.deleteFile`.
|
|
317
186
|
*
|
|
318
|
-
* @param request -
|
|
187
|
+
* @param request - The file to delete. `request.url` is its URL.
|
|
319
188
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
320
189
|
* into the request (optional).
|
|
321
190
|
* @returns The server response.
|
|
322
191
|
*/
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").
|
|
192
|
+
deleteFile(request: {
|
|
193
|
+
url: string;
|
|
194
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
195
|
+
/**
|
|
196
|
+
* Deletes an image uploaded to this channel, the same request shape as `client.deleteImage`.
|
|
197
|
+
*
|
|
198
|
+
* @param request - The image to delete. `request.url` is its URL.
|
|
199
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
200
|
+
* into the request (optional).
|
|
201
|
+
* @returns The server response.
|
|
202
|
+
*/
|
|
203
|
+
deleteImage(request: {
|
|
204
|
+
url: string;
|
|
205
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
326
206
|
/**
|
|
327
207
|
* Queries members.
|
|
328
208
|
*
|
|
@@ -337,48 +217,19 @@ export declare class Channel extends ChannelApi {
|
|
|
337
217
|
payload?: Partial<QueryMembersPayload>;
|
|
338
218
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MembersResponse>>;
|
|
339
219
|
/**
|
|
340
|
-
*
|
|
341
|
-
* that sending the reaction is queued up if it fails due to bad internet conditions and executed
|
|
342
|
-
* later.
|
|
343
|
-
*
|
|
344
|
-
* @param ...args - `[request, requestOptions]`. `request` holds the target message ID, the
|
|
345
|
-
* reaction object (e.g. `{ type: 'love' }`), and optional flags such as `enforce_unique` and
|
|
346
|
-
* `skip_push`; `requestOptions` carries per-request options such as an abort `signal`.
|
|
347
|
-
* When the call is queued for offline replay, `requestOptions` is queued with it - see the
|
|
348
|
-
* note on signal persistence in `AbstractOfflineDB.queueTask`.
|
|
349
|
-
* @returns The server response.
|
|
350
|
-
*/
|
|
351
|
-
sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<import(".").SendReactionResponse & {
|
|
352
|
-
metadata: import("./types").RequestMetadata;
|
|
353
|
-
}>;
|
|
354
|
-
_sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<StreamResponse<import(".").SendReactionResponse>>;
|
|
355
|
-
deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<import(".").DeleteReactionResponse & {
|
|
356
|
-
metadata: import("./types").RequestMetadata;
|
|
357
|
-
}>;
|
|
358
|
-
/**
|
|
359
|
-
* Deletes a reaction by user and type.
|
|
360
|
-
*
|
|
361
|
-
* @param ...args - `[request, requestOptions]`. `request` identifies the target message and
|
|
362
|
-
* reaction type; `requestOptions` carries per-request options such as an abort `signal` and is
|
|
363
|
-
* never serialized into the request.
|
|
364
|
-
* @returns The server response.
|
|
365
|
-
*/
|
|
366
|
-
_deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<StreamResponse<import(".").DeleteReactionResponse>>;
|
|
367
|
-
/**
|
|
368
|
-
* Edit the channel using the inherited `update()` from `ChannelApi`. Caches the
|
|
369
|
-
* server-returned channel onto `this.data`.
|
|
220
|
+
* Updates the channel and stores the returned channel in `this.data`.
|
|
370
221
|
*
|
|
371
222
|
* @param ...args - `[request, requestOptions]`. `request` is the channel update payload, e.g.
|
|
372
|
-
* `{ data: { name: 'foo' }, message }`; `requestOptions` carries per-request options
|
|
373
|
-
* abort `signal` and is never serialized into the request.
|
|
223
|
+
* `{ data: { custom: { name: 'foo' } }, message }`; `requestOptions` carries per-request options
|
|
224
|
+
* such as an abort `signal` and is never serialized into the request.
|
|
374
225
|
* @returns The server response.
|
|
375
226
|
*/
|
|
376
227
|
update(...args: Parameters<ChannelApi['update']>): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
377
228
|
/**
|
|
378
|
-
*
|
|
229
|
+
* Partially updates the channel's properties and stores the returned channel in `this.data`.
|
|
379
230
|
*
|
|
380
231
|
* @param update - The partial update request.
|
|
381
|
-
* @param
|
|
232
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
382
233
|
* into the request (optional).
|
|
383
234
|
* @returns The server response.
|
|
384
235
|
*/
|
|
@@ -387,7 +238,7 @@ export declare class Channel extends ChannelApi {
|
|
|
387
238
|
* Enables slow mode.
|
|
388
239
|
*
|
|
389
240
|
* @param coolDownInterval - The cooldown interval in seconds.
|
|
390
|
-
* @param
|
|
241
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
391
242
|
* into the request (optional).
|
|
392
243
|
* @returns The server response.
|
|
393
244
|
*/
|
|
@@ -395,11 +246,13 @@ export declare class Channel extends ChannelApi {
|
|
|
395
246
|
/**
|
|
396
247
|
* Disables slow mode.
|
|
397
248
|
*
|
|
249
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
250
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
398
251
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
399
252
|
* into the request (optional).
|
|
400
253
|
* @returns The server response.
|
|
401
254
|
*/
|
|
402
|
-
disableSlowMode(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
255
|
+
disableSlowMode(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
403
256
|
sendSharedLocation(location: SharedLocation & {
|
|
404
257
|
message_id?: string;
|
|
405
258
|
}): Promise<import(".").SendMessageResponse & {
|
|
@@ -409,188 +262,183 @@ export declare class Channel extends ChannelApi {
|
|
|
409
262
|
/**
|
|
410
263
|
* Accepts an invitation to the channel.
|
|
411
264
|
*
|
|
412
|
-
* @param options -
|
|
265
|
+
* @param options - Other channel update options to send with it. Defaults to `{}`.
|
|
413
266
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
414
267
|
* into the request (optional).
|
|
415
268
|
* @returns The server response.
|
|
416
269
|
*/
|
|
417
|
-
acceptInvite(options?:
|
|
270
|
+
acceptInvite(options?: NonNullable<Parameters<ChannelApi['update']>[0]>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
418
271
|
/**
|
|
419
272
|
* Rejects an invitation to the channel.
|
|
420
273
|
*
|
|
421
|
-
* @param options -
|
|
274
|
+
* @param options - Other channel update options to send with it. Defaults to `{}`.
|
|
422
275
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
423
276
|
* into the request (optional).
|
|
424
277
|
* @returns The server response.
|
|
425
278
|
*/
|
|
426
|
-
rejectInvite(options?:
|
|
279
|
+
rejectInvite(options?: NonNullable<Parameters<ChannelApi['update']>[0]>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
427
280
|
/**
|
|
428
281
|
* Adds members to the channel.
|
|
429
282
|
*
|
|
430
|
-
* @param
|
|
431
|
-
* @param
|
|
432
|
-
* @param
|
|
283
|
+
* @param request - The members to add, and any other channel update option.
|
|
284
|
+
* @param request.members - User IDs, or member requests (`{ user_id, channel_role?, custom? }`).
|
|
285
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
433
286
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
434
287
|
* into the request (optional).
|
|
435
288
|
* @returns The server response.
|
|
436
289
|
*/
|
|
437
|
-
addMembers(members
|
|
290
|
+
addMembers({ members, ...options }: AddMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
438
291
|
/**
|
|
439
292
|
* Adds filter tags to the channel.
|
|
440
293
|
*
|
|
441
|
-
* @param
|
|
442
|
-
* @param
|
|
443
|
-
* @param
|
|
294
|
+
* @param request - The tags to add, and any other channel update option.
|
|
295
|
+
* @param request.tags - The tags to add.
|
|
296
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
444
297
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
445
298
|
* into the request (optional).
|
|
446
299
|
* @returns The server response.
|
|
447
300
|
*/
|
|
448
|
-
addFilterTags(tags
|
|
301
|
+
addFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
449
302
|
/**
|
|
450
303
|
* Removes filter tags from the channel.
|
|
451
304
|
*
|
|
452
|
-
* @param
|
|
453
|
-
* @param
|
|
454
|
-
* @param
|
|
305
|
+
* @param request - The tags to remove, and any other channel update option.
|
|
306
|
+
* @param request.tags - The tags to remove.
|
|
307
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
455
308
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
456
309
|
* into the request (optional).
|
|
457
310
|
* @returns The server response.
|
|
458
311
|
*/
|
|
459
|
-
removeFilterTags(tags
|
|
312
|
+
removeFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
460
313
|
/**
|
|
461
314
|
* Invite members to the channel.
|
|
462
315
|
*
|
|
463
|
-
* @param
|
|
464
|
-
* @param
|
|
465
|
-
* @param
|
|
316
|
+
* @param request - The members to invite, and any other channel update option.
|
|
317
|
+
* @param request.members - User IDs, or member requests (`{ user_id, custom }`).
|
|
318
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
466
319
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
467
320
|
* into the request (optional).
|
|
468
321
|
* @returns The server response.
|
|
469
322
|
*/
|
|
470
|
-
inviteMembers(members
|
|
323
|
+
inviteMembers({ members, ...options }: InviteMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
471
324
|
/**
|
|
472
325
|
* Removes members from the channel.
|
|
473
326
|
*
|
|
474
|
-
* @param
|
|
475
|
-
* @param
|
|
476
|
-
* @param
|
|
327
|
+
* @param request - The members to remove, and any other channel update option.
|
|
328
|
+
* @param request.members - The user IDs to remove.
|
|
329
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
477
330
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
478
331
|
* into the request (optional).
|
|
479
332
|
* @returns The server response.
|
|
480
333
|
*/
|
|
481
|
-
removeMembers(members
|
|
334
|
+
removeMembers({ members, ...options }: RemoveMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
482
335
|
/**
|
|
483
|
-
* Mutes the
|
|
336
|
+
* Mutes the channel.
|
|
484
337
|
*
|
|
485
338
|
* @example
|
|
486
|
-
* // with expiration
|
|
487
|
-
* await channel.mute({ expiration:
|
|
339
|
+
* // with expiration (two weeks)
|
|
340
|
+
* await channel.mute({ expiration: 14 * 24 * 60 * 60 * 1000 });
|
|
488
341
|
*
|
|
489
|
-
* @
|
|
490
|
-
*
|
|
491
|
-
* await channel.mute({ user_id: userId });
|
|
492
|
-
*
|
|
493
|
-
* @param options - Mute options (optional, defaults to `{}`).
|
|
494
|
-
* @param options.expiration - Expiration in minutes (optional).
|
|
342
|
+
* @param options - Mute options (optional).
|
|
343
|
+
* @param options.expiration - Mute duration in milliseconds (optional).
|
|
495
344
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
496
345
|
* into the request (optional).
|
|
497
346
|
* @returns The server response.
|
|
498
347
|
*/
|
|
499
348
|
mute(options?: Gen_MuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MuteChannelResponse>>;
|
|
500
349
|
/**
|
|
501
|
-
* Unmutes the
|
|
350
|
+
* Unmutes the channel.
|
|
502
351
|
*
|
|
503
352
|
* @example
|
|
504
|
-
*
|
|
505
|
-
* await channel.unmute({ user_id: userId });
|
|
353
|
+
* await channel.unmute();
|
|
506
354
|
*
|
|
507
|
-
* @param options - Unmute options (optional
|
|
508
|
-
* @param options.user_id - User ID (optional).
|
|
355
|
+
* @param options - Unmute options (optional).
|
|
509
356
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
510
357
|
* into the request (optional).
|
|
511
358
|
* @returns The server response.
|
|
512
359
|
*/
|
|
513
360
|
unmute(options?: Gen_UnmuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnmuteResponse>>;
|
|
514
361
|
/**
|
|
515
|
-
* Archives the current
|
|
362
|
+
* Archives the channel for the current user.
|
|
516
363
|
*
|
|
517
364
|
* @example
|
|
518
365
|
* await channel.archive();
|
|
519
366
|
*
|
|
367
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
368
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
520
369
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
521
370
|
* into the request (optional).
|
|
522
371
|
* @returns The server response.
|
|
523
372
|
*/
|
|
524
|
-
archive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
373
|
+
archive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
525
374
|
/**
|
|
526
|
-
* Unarchives the current
|
|
375
|
+
* Unarchives the channel for the current user.
|
|
527
376
|
*
|
|
528
377
|
* @example
|
|
529
378
|
* await channel.unarchive();
|
|
530
379
|
*
|
|
380
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
381
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
531
382
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
532
383
|
* into the request (optional).
|
|
533
384
|
* @returns The server response.
|
|
534
385
|
*/
|
|
535
|
-
unarchive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
386
|
+
unarchive(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
536
387
|
/**
|
|
537
|
-
* Pins the current
|
|
388
|
+
* Pins the channel for the current user.
|
|
538
389
|
*
|
|
539
390
|
* @example
|
|
540
391
|
* await channel.pin();
|
|
541
392
|
*
|
|
393
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
394
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
542
395
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
543
396
|
* into the request (optional).
|
|
544
397
|
* @returns The server response.
|
|
545
398
|
*/
|
|
546
|
-
pin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
399
|
+
pin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
547
400
|
/**
|
|
548
|
-
* Unpins the current
|
|
401
|
+
* Unpins the channel for the current user.
|
|
549
402
|
*
|
|
550
403
|
* @example
|
|
551
404
|
* await channel.unpin();
|
|
552
405
|
*
|
|
406
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
407
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
553
408
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
554
409
|
* into the request (optional).
|
|
555
410
|
* @returns The server response.
|
|
556
411
|
*/
|
|
557
|
-
unpin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
412
|
+
unpin(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
558
413
|
/**
|
|
559
|
-
* Returns the mute status
|
|
414
|
+
* Returns the mute status of the channel.
|
|
560
415
|
*
|
|
561
|
-
* @returns
|
|
562
|
-
*
|
|
416
|
+
* @returns `{ muted, createdAt, expiresAt }`, the timestamps in unix nanoseconds as the API sends
|
|
417
|
+
* them.
|
|
563
418
|
*/
|
|
564
419
|
muteStatus(): import("./channel_state").ChannelMuteStatus;
|
|
565
420
|
/**
|
|
566
|
-
* Recomputes
|
|
567
|
-
*
|
|
568
|
-
* churn subscribers. Called from the constructor and by the client whenever `mutedChannels`
|
|
569
|
-
* updates. Unlike `muteStatus()`, this does not require the channel to be initialized.
|
|
421
|
+
* Recomputes `state.muteStatus` from `client.mutedChannels`, publishing only on change (the client
|
|
422
|
+
* calls this on every `mutedChannels` update). Unlike `muteStatus()`, it needs no channel ID.
|
|
570
423
|
*/
|
|
571
424
|
_syncMuteStatus(): void;
|
|
572
425
|
sendAction(messageId: string, formData: Record<string, string>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MessageActionResponse>>;
|
|
573
426
|
/**
|
|
574
|
-
*
|
|
575
|
-
* Call this on every keystroke.
|
|
427
|
+
* Call on every keystroke: sends `typing.start` at most every 2 seconds.
|
|
576
428
|
*
|
|
577
429
|
* @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
|
|
578
430
|
*
|
|
579
|
-
* @param parentId -
|
|
580
|
-
* @param options - Optional override carrying a `user_id` (optional).
|
|
431
|
+
* @param parentId - The parent message ID, for a typing event in a thread (optional).
|
|
581
432
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
582
433
|
* into the request (optional).
|
|
583
434
|
*/
|
|
584
|
-
keystroke(parentId?: string,
|
|
585
|
-
user_id: string;
|
|
586
|
-
}, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
435
|
+
keystroke(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
587
436
|
/**
|
|
588
|
-
*
|
|
589
|
-
* Typically used by the server connected to the AI service to notify clients of state changes.
|
|
437
|
+
* Notifies watchers of a message's AI state. Meant for the server connected to the AI service.
|
|
590
438
|
*
|
|
591
439
|
* @param messageId - The ID of the message associated with the AI state.
|
|
592
440
|
* @param state - The new state of the AI process, e.g. thinking, generating.
|
|
593
|
-
* @param options -
|
|
441
|
+
* @param options - Additional details for the event. Defaults to `{}`.
|
|
594
442
|
* @param options.ai_message - Additional message detail to include in the event (optional).
|
|
595
443
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
596
444
|
* into the request (optional).
|
|
@@ -602,170 +450,200 @@ export declare class Channel extends ChannelApi {
|
|
|
602
450
|
* Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming.
|
|
603
451
|
* Typically used by the server connected to the AI service to inform clients that the AI response has started.
|
|
604
452
|
*
|
|
453
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
454
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
605
455
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
606
456
|
* into the request (optional).
|
|
607
457
|
*/
|
|
608
|
-
clearAIIndicator(requestOptions?: StreamRequestOptions): Promise<void>;
|
|
458
|
+
clearAIIndicator(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
609
459
|
/**
|
|
610
460
|
* Sends an event to stop AI response generation, leaving the message in its current state.
|
|
611
461
|
* Triggered by the user to halt the AI response process.
|
|
612
462
|
*
|
|
463
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
464
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
613
465
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
614
466
|
* into the request (optional).
|
|
615
467
|
*/
|
|
616
|
-
stopAIResponse(requestOptions?: StreamRequestOptions): Promise<void>;
|
|
468
|
+
stopAIResponse(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
617
469
|
/**
|
|
618
|
-
*
|
|
470
|
+
* Resets the typing state and sends `typing.stop`.
|
|
619
471
|
*
|
|
620
|
-
* @
|
|
621
|
-
*
|
|
622
|
-
* @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
|
|
623
|
-
* @param options - Optional override carrying a `user_id` (optional).
|
|
472
|
+
* @param parentId - The parent message ID, for a typing event in a thread (optional).
|
|
624
473
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
625
474
|
* into the request (optional).
|
|
626
475
|
*/
|
|
627
|
-
stopTyping(parentId?: string,
|
|
628
|
-
user_id: string;
|
|
629
|
-
}, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
476
|
+
stopTyping(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
630
477
|
_isTypingIndicatorsEnabled(): boolean;
|
|
631
478
|
/**
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
|
|
479
|
+
* Whether read events are on. `config.readEvents.enabled` (the channel type's `read_events` and
|
|
480
|
+
* the client configuration) and the own `read-events` capability allow them. Unread messages are
|
|
481
|
+
* counted and marked read only while it is true, unless `readEvents.localUnreadCountEnabled` keeps
|
|
482
|
+
* a local count.
|
|
483
|
+
*/
|
|
484
|
+
get readEventsEnabled(): boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Marks read through `MessageDeliveryReporter`: uses the `markReadRequest` handler if set, marks
|
|
487
|
+
* read locally when read events are off and `localUnreadCountEnabled` is set, and drops the
|
|
488
|
+
* delivery candidate when a request went out. `markRead()` does none of this.
|
|
637
489
|
*
|
|
638
|
-
* @param data - Mark read options
|
|
490
|
+
* @param data - Mark read options. Defaults to `{}`.
|
|
491
|
+
* @returns The server response, or `null` when no request went out.
|
|
639
492
|
*/
|
|
640
493
|
markReadViaReporter(data?: MarkReadRequest): Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
|
|
641
494
|
/**
|
|
642
|
-
*
|
|
643
|
-
* channel to be initialized and respects the `read_events` channel config.
|
|
495
|
+
* Marks the channel read.
|
|
644
496
|
*
|
|
645
497
|
* @param ...args - `[data, requestOptions]`. `data` holds the mark-read options;
|
|
646
498
|
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
647
499
|
* serialized into the request.
|
|
648
|
-
* @returns The server response
|
|
500
|
+
* @returns The server response.
|
|
501
|
+
* @throws If the channel is not initialized or read events are disabled.
|
|
649
502
|
*/
|
|
650
503
|
markRead(...args: Parameters<ChannelApi['markRead']>): Promise<StreamResponse<MarkReadResponse>>;
|
|
651
|
-
/**
|
|
652
|
-
* A vague indication of whether the channel exists on the chat backend — `true` once
|
|
653
|
-
* `create()`/`query()`/`watch()` has run. Store-backed and reactive: subscribe via
|
|
654
|
-
* `useStateStore(channel.state, (s) => ({ initialized: s.initialized }))`.
|
|
655
|
-
*/
|
|
504
|
+
/** See {@link ChannelLifecycleState.initialized}. */
|
|
656
505
|
get initialized(): boolean;
|
|
657
506
|
set initialized(initialized: boolean);
|
|
658
507
|
/**
|
|
659
|
-
* Whether the channel was
|
|
660
|
-
*
|
|
508
|
+
* Whether the channel has no ID yet: it was built from members and the server assigns the ID when its
|
|
509
|
+
* query is answered. Until then only that query can be sent and the cid is a temporary one.
|
|
510
|
+
*
|
|
511
|
+
* Not reactive: subscribe to {@link Channel.initialized}, which turns `true` with the response that
|
|
512
|
+
* sets `id`.
|
|
661
513
|
*/
|
|
514
|
+
get isProvisional(): boolean;
|
|
515
|
+
/**
|
|
516
|
+
* See {@link ChannelLifecycleState.supersededBy}. A superseded instance receives no events and
|
|
517
|
+
* reports `watchStatus: NotWatching`: use its successor (`watch()` resolves with it). The SDK
|
|
518
|
+
* does not disconnect it before logout, so call {@link Channel.disconnect} once nothing uses it.
|
|
519
|
+
*/
|
|
520
|
+
get supersededBy(): Channel | undefined;
|
|
521
|
+
/** See {@link ChannelLifecycleState.offlineMode}. */
|
|
662
522
|
get offlineMode(): boolean;
|
|
663
523
|
set offlineMode(offlineMode: boolean);
|
|
664
524
|
/**
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
* subscriptions) and the client drops it from `activeChannels` right after, so nothing should
|
|
671
|
-
* touch it: it is skipped by the `client.activeChannels` lookups (so `client.channel(…)` mints a
|
|
672
|
-
* fresh instance), never re-watched on recovery, refused as a source of `channel.data` by the
|
|
673
|
-
* offline DB, and `getClient()` throws on it so a reference held across a `disconnectUser()`
|
|
674
|
-
* fails loudly instead of quietly requesting on a client with no user.
|
|
525
|
+
* Reads `state.data`. Assigning publishes `data`, `memberCount` and `ownCapabilities` in one update.
|
|
526
|
+
* If the object omits `member_count` or `own_capabilities`, the last known values are carried onto
|
|
527
|
+
* a copy (the assigned object is not changed). Editing `channel.data.x` in place does not reach
|
|
528
|
+
* the state. `ownCapabilities` keeps its array while the capabilities stay the same (in any
|
|
529
|
+
* order), so a subscriber to it is notified only when they change.
|
|
675
530
|
*/
|
|
676
|
-
get
|
|
677
|
-
set
|
|
531
|
+
get data(): Partial<ChannelResponse> | undefined;
|
|
532
|
+
set data(next: Partial<ChannelResponse> | undefined);
|
|
678
533
|
/**
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
534
|
+
* See {@link ChannelLifecycleState.pendingDisposal}. Set only by {@link Channel.disconnect} and never
|
|
535
|
+
* reverted: `getClient()` throws, `client.channel()` returns a fresh instance for the
|
|
536
|
+
* cid, and lists and recovery skip it.
|
|
682
537
|
*/
|
|
538
|
+
get pendingDisposal(): boolean;
|
|
539
|
+
/** See {@link ChannelWatchStatus}. */
|
|
683
540
|
get watchStatus(): ChannelWatchStatus;
|
|
684
541
|
set watchStatus(watchStatus: ChannelWatchStatus);
|
|
685
542
|
/**
|
|
686
|
-
* Whether a
|
|
687
|
-
* {@link
|
|
688
|
-
*
|
|
543
|
+
* Whether a query for this channel (`watch()`, `query()`, `create()` or one of the message
|
|
544
|
+
* paginator's own queries, see {@link runTrackedQuery}) awaits its response. The channel store
|
|
545
|
+
* keeps the channel meanwhile.
|
|
546
|
+
*
|
|
547
|
+
* @internal
|
|
689
548
|
*/
|
|
549
|
+
get isQueryingChannel(): boolean;
|
|
550
|
+
/** See {@link Channel.activate}. */
|
|
690
551
|
get active(): boolean;
|
|
691
552
|
/**
|
|
692
|
-
* Declares that a consumer is
|
|
693
|
-
*
|
|
694
|
-
*
|
|
553
|
+
* Declares that a consumer is consuming this channel's own state and returns its release function.
|
|
554
|
+
* Refcounted: the channel stays active until the last consumer releases, and releasing twice is a
|
|
555
|
+
* no-op.
|
|
695
556
|
*
|
|
696
|
-
* While active,
|
|
697
|
-
*
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Declares that a consumer has stopped consuming this channel (mirrors `thread.deactivate()`).
|
|
702
|
-
* Only flips `active` back to `false` once the last holder deactivates.
|
|
557
|
+
* While active, channel-list hydration places no page in the message list (`channel.reload()`
|
|
558
|
+
* owns it), the message list keeps its active interval (otherwise a fresh newest page from a
|
|
559
|
+
* query the list did not run is shown), and the channel stays in the channel store. A disposed
|
|
560
|
+
* channel is not activated: a warning is logged and the returned release does nothing.
|
|
703
561
|
*/
|
|
704
|
-
|
|
562
|
+
activate: () => (() => void);
|
|
705
563
|
/**
|
|
706
|
-
* Marks the channel
|
|
564
|
+
* Marks the channel unread from a message.
|
|
707
565
|
*
|
|
708
566
|
* @param ...args - `[data, requestOptions]`. `data` holds the mark-unread options;
|
|
709
567
|
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
710
568
|
* serialized into the request.
|
|
711
|
-
* @returns
|
|
569
|
+
* @returns The server response.
|
|
570
|
+
* @throws If the channel is not initialized or read events are disabled.
|
|
712
571
|
*/
|
|
713
572
|
markUnread(...args: Parameters<ChannelApi['markUnread']>): Promise<StreamResponse<import(".").Response>>;
|
|
714
573
|
/**
|
|
715
|
-
* Resets
|
|
716
|
-
*
|
|
717
|
-
* `
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
574
|
+
* Resets the unread count without a backend call, for channels with read events off
|
|
575
|
+
* ({@link Channel.readEventsEnabled}, e.g. livestreams) that set `readEvents.localUnreadCountEnabled`. Dispatches the client-only
|
|
576
|
+
* `message.read_locally` event, handled like `message.read` minus the delivery-report sync. With
|
|
577
|
+
* offline support the reset is persisted.
|
|
578
|
+
*
|
|
579
|
+
* The event's `last_read_message_id` is the newest server-confirmed message, whatever its type,
|
|
580
|
+
* of the interval holding the channel's newest messages
|
|
581
|
+
* (`messagePaginator.anchoredHeadServerConfirmedItem`). While that interval is not loaded (e.g.
|
|
582
|
+
* only a jumped-to interval is), the event carries none and the read covers everything up to its
|
|
583
|
+
* `created_at`.
|
|
722
584
|
*
|
|
723
|
-
* @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected
|
|
585
|
+
* @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected
|
|
586
|
+
* user.
|
|
724
587
|
*/
|
|
725
588
|
markReadLocally(): ({
|
|
726
589
|
type: "message.read_locally";
|
|
727
590
|
} & {
|
|
728
591
|
channel_type: string;
|
|
729
592
|
cid: string;
|
|
730
|
-
created_at:
|
|
593
|
+
created_at: TimestampNS;
|
|
731
594
|
channel_id?: string;
|
|
732
595
|
last_read_message_id?: string;
|
|
733
596
|
team?: string;
|
|
734
597
|
user?: UserResponse;
|
|
735
598
|
} & {
|
|
736
|
-
received_at?:
|
|
599
|
+
received_at?: TimestampNS;
|
|
737
600
|
}) | undefined;
|
|
738
601
|
/**
|
|
739
|
-
*
|
|
602
|
+
* Sends `typing.stop` after a second without a keystroke, drops stale typing users, and resets a
|
|
603
|
+
* stuck AI indicator while the connection is unhealthy. Run by the client's cleaning interval.
|
|
604
|
+
*
|
|
605
|
+
* @internal
|
|
740
606
|
*/
|
|
741
607
|
clean(): void;
|
|
742
608
|
/**
|
|
743
|
-
*
|
|
609
|
+
* Watches the channel and loads its state and messages. Sends nothing when that is done already
|
|
610
|
+
* (`Watching`, `initialized` and `messagePaginator.hasResults`) and the call asks for nothing
|
|
611
|
+
* new: it passes no options, or the same options as the last `watch()` that succeeded during the
|
|
612
|
+
* current watch. Other options, e.g. `presence: true`, send a query. A `watch()` already in
|
|
613
|
+
* flight with the same options is joined, not repeated.
|
|
614
|
+
* Refresh a watched channel with {@link Channel.reload}. Rejects with the query's error.
|
|
744
615
|
*
|
|
745
|
-
* @param options -
|
|
746
|
-
* @
|
|
616
|
+
* @param options - Options for the watch query (optional).
|
|
617
|
+
* @param requestOptions - Per-request options (optional). Aborting `signal` ends this caller's
|
|
618
|
+
* wait (at once if aborted already); the query is cancelled once every waiting caller has
|
|
619
|
+
* aborted. The other options apply only when this call sends the query.
|
|
620
|
+
* @returns The instance to use: this one, or the one that superseded it ({@link supersededBy}).
|
|
747
621
|
*/
|
|
748
|
-
watch(options?: ChannelGetOrCreateRequest): Promise<
|
|
622
|
+
watch(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<Channel>;
|
|
749
623
|
/**
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
*
|
|
760
|
-
*
|
|
624
|
+
* Sends the query {@link Channel.watch} callers wait for. It is cancelled through an abort
|
|
625
|
+
* controller of its own, once no caller waits any more ({@link leaveWatchQuery}).
|
|
626
|
+
*/
|
|
627
|
+
private sendWatchQuery;
|
|
628
|
+
/** A caller stops waiting; the last one cancels and forgets the query, so the next is new. */
|
|
629
|
+
private leaveWatchQuery;
|
|
630
|
+
/** Stops offering `watchQuery` to {@link Channel.watch} callers. */
|
|
631
|
+
private forgetWatchQuery;
|
|
632
|
+
/**
|
|
633
|
+
* Sends a watch query, watched or not, and places the page it fetched (a page at a cursor or
|
|
634
|
+
* around a message is only stored; `messagePaginator.jumpToMessage()` shows it).
|
|
635
|
+
* `requestOptions.signal` also ends the wait for a live socket.
|
|
636
|
+
*/
|
|
637
|
+
private runWatchQuery;
|
|
638
|
+
/**
|
|
639
|
+
* Re-watches the channel and refreshes its whole loaded message interval (the channel analogue of
|
|
640
|
+
* {@link Thread.reload}). Used on reconnect. Hard deletes reach other clients through no event, so
|
|
641
|
+
* the watch query reconciles the loaded newest messages with the re-queried page
|
|
642
|
+
* (`messagePaginator.reconcileNewestMessages`, against the loaded IDs captured before its await).
|
|
761
643
|
*
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
* a failed message can be absent from memory and still be the user's unsent work — a cold boot starts
|
|
766
|
-
* with an empty paginator, and an eviction can drop it mid-session. v9 got this from a second, lagging
|
|
767
|
-
* copy of the list (the React SDK's own state); with one reactive source of truth the persisted row is
|
|
768
|
-
* that buffer.
|
|
644
|
+
* Failed (unsent) messages are kept: those loaded or in the offline DB (cold boot, eviction)
|
|
645
|
+
* before the request that are no longer loaded after it are ingested again. The offline DB is
|
|
646
|
+
* read on a best-effort basis.
|
|
769
647
|
*/
|
|
770
648
|
reload(): Promise<void>;
|
|
771
649
|
/**
|
|
@@ -778,85 +656,152 @@ export declare class Channel extends ChannelApi {
|
|
|
778
656
|
*/
|
|
779
657
|
stopWatching(...args: Parameters<ChannelApi['stopWatching']>): Promise<StreamResponse<import(".").Response>>;
|
|
780
658
|
/**
|
|
781
|
-
* Retrieves
|
|
659
|
+
* Retrieves messages of this channel by ID.
|
|
782
660
|
*
|
|
783
|
-
* @param messageIds - The IDs of the messages to retrieve
|
|
661
|
+
* @param messageIds - The IDs of the messages to retrieve.
|
|
784
662
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
785
663
|
* into the request (optional).
|
|
786
|
-
* @returns
|
|
664
|
+
* @returns The server response.
|
|
787
665
|
*/
|
|
788
666
|
getMessagesById(messageIds: string[], requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").GetManyMessagesResponse>>;
|
|
789
667
|
/**
|
|
790
|
-
* Returns
|
|
668
|
+
* Returns when the current user last marked the channel read.
|
|
791
669
|
*
|
|
792
670
|
* @returns The last-read timestamp in unix nanoseconds, `null` if never read, or `undefined` if
|
|
793
671
|
* the user is unset.
|
|
794
672
|
*/
|
|
795
|
-
lastRead():
|
|
673
|
+
lastRead(): TimestampNS | null | undefined;
|
|
796
674
|
_countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
|
|
797
675
|
/**
|
|
798
|
-
*
|
|
676
|
+
* Counts the unread messages.
|
|
799
677
|
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
678
|
+
* Counting from `lastRead` counts within the channel's newest messages that are loaded (see
|
|
679
|
+
* {@link newestKnownMessages}).
|
|
680
|
+
*
|
|
681
|
+
* @param lastRead - The time the user read a message, in unix nanoseconds (optional). Defaults to
|
|
682
|
+
* the current user's read state.
|
|
683
|
+
* @returns The unread count.
|
|
684
|
+
*/
|
|
685
|
+
countUnread(lastRead?: TimestampNS | null): number;
|
|
686
|
+
/**
|
|
687
|
+
* The channel's newest messages that are loaded: the interval that reaches the newest message (the
|
|
688
|
+
* paginator's anchored head), or, while that interval is not loaded, the messages received live
|
|
689
|
+
* since. An interval reached by a jump is never part of it, as the messages between it and the
|
|
690
|
+
* newest are unknown.
|
|
803
691
|
*/
|
|
804
|
-
|
|
692
|
+
private newestKnownMessages;
|
|
805
693
|
/**
|
|
806
|
-
*
|
|
694
|
+
* Lowers the own unread count by the unread ones among `deletedMessages`, as they were before the
|
|
695
|
+
* delete. The server lowers it for every unread message deleted, except in a soft bulk delete
|
|
696
|
+
* (`user.messages.deleted`), and does not send the new count. Unread messages that are not loaded
|
|
697
|
+
* cannot be counted; the next query brings the server's count.
|
|
807
698
|
*
|
|
808
|
-
* @
|
|
699
|
+
* @internal
|
|
700
|
+
*/
|
|
701
|
+
_lowerUnreadCountForDeletedMessages(deletedMessages: LocalMessage[]): void;
|
|
702
|
+
/**
|
|
703
|
+
* Counts the unread messages that mention the current user, within the channel's newest messages
|
|
704
|
+
* that are loaded (see {@link newestKnownMessages}).
|
|
705
|
+
*
|
|
706
|
+
* @returns The unread mentions count.
|
|
809
707
|
*/
|
|
810
708
|
countUnreadMentions(): number;
|
|
811
709
|
/**
|
|
812
|
-
* Creates
|
|
710
|
+
* Creates the channel without watching it.
|
|
813
711
|
*
|
|
814
712
|
* @param options - Channel query options (optional).
|
|
815
713
|
* @returns The server response.
|
|
816
714
|
*/
|
|
817
|
-
create: (options?: ChannelGetOrCreateRequest) => Promise<StreamResponse<
|
|
715
|
+
create: (options?: ChannelGetOrCreateRequest) => Promise<StreamResponse<ChannelStateResponse>>;
|
|
716
|
+
/**
|
|
717
|
+
* Moves this channel, created without an ID, from its temporary cid to the one the server gave it.
|
|
718
|
+
* If another instance already holds that cid, it stays stored and takes over from this one
|
|
719
|
+
* ({@link ChannelManager.supersedeChannel}).
|
|
720
|
+
*/
|
|
721
|
+
private storeUnderServerCid;
|
|
818
722
|
/**
|
|
819
|
-
* Queries the API
|
|
723
|
+
* Queries the API for messages, members and other channel fields.
|
|
724
|
+
*
|
|
725
|
+
* The returned messages are not added to {@link Channel.messagePaginator}: the paginator loads its
|
|
726
|
+
* own pages, and {@link Channel.watch} / {@link Channel.create} place the page they query.
|
|
820
727
|
*
|
|
821
728
|
* @param options - The query options (optional, defaults to `{}`).
|
|
822
|
-
* @param messageSetToAddToIfDoesNotExist - It's possible to load disjunct sets of a channel's
|
|
823
|
-
* messages into state. Use `current` to load the initial channel state or to extend the
|
|
824
|
-
* currently displayed messages; use `latest` to load/extend the latest messages; `new` is
|
|
825
|
-
* used for loading a specific message and its surroundings (optional, defaults to `'current'`).
|
|
826
729
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
827
730
|
* into the request (optional).
|
|
828
|
-
* @returns
|
|
731
|
+
* @returns The query response.
|
|
829
732
|
*/
|
|
830
|
-
query(options?: ChannelGetOrCreateRequest,
|
|
733
|
+
query(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<ChannelStateResponse>>;
|
|
831
734
|
/**
|
|
832
|
-
*
|
|
735
|
+
* The query behind `query()`, `watch()` and `create()`, in three steps: sends the request
|
|
736
|
+
* ({@link requestChannelState}), has the message paginator place the returned page when
|
|
737
|
+
* `placeMessages` is set (a watch query), then applies the rest of the response
|
|
738
|
+
* ({@link applyChannelStateFromResponse}), all as a tracked query ({@link runTrackedQuery}).
|
|
833
739
|
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
740
|
+
* The page is placed before the rest is applied, because the rest reads the loaded messages: read
|
|
741
|
+
* and delivery positions that come without a message id are looked up among them, and the latest
|
|
742
|
+
* message is reported as delivered. A first page then takes the unread snapshot, from the read
|
|
743
|
+
* state the rest brought. The message paginator's own queries keep the same order: they place
|
|
744
|
+
* their page, then apply the rest with {@link applyChannelStateFromResponse}.
|
|
837
745
|
*/
|
|
838
|
-
|
|
746
|
+
private runChannelQuery;
|
|
839
747
|
/**
|
|
840
|
-
*
|
|
841
|
-
*
|
|
748
|
+
* Runs `run`, a query of this channel, as a tracked query: refused for a disposed instance, and
|
|
749
|
+
* the channel counts as being queried until `run` settles ({@link isQueryingChannel}), so the
|
|
750
|
+
* channel store keeps it meanwhile. Used by {@link runChannelQuery} and by the message
|
|
751
|
+
* paginator's own queries.
|
|
842
752
|
*
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* @
|
|
753
|
+
* `run` starts synchronously: a paginator query publishes its loading flag before anything is
|
|
754
|
+
* awaited, which keeps a second query in the same tick from starting.
|
|
755
|
+
*
|
|
756
|
+
* @internal
|
|
847
757
|
*/
|
|
848
|
-
|
|
758
|
+
runTrackedQuery<T>(run: () => Promise<T>): Promise<T>;
|
|
849
759
|
/**
|
|
850
|
-
*
|
|
760
|
+
* Sends the channel query and takes in what the response says about the channel itself: its id,
|
|
761
|
+
* the cid it is stored under, its config, and its `last_message_at`, against which the message
|
|
762
|
+
* paginator's head interval is checked before any page is placed (see
|
|
763
|
+
* `MessagePaginator.unmarkStaleHead`). The request of {@link runChannelQuery} and of the message
|
|
764
|
+
* paginator's own queries, which run it as a tracked query ({@link runTrackedQuery}); it does not
|
|
765
|
+
* track the query itself. Refused for a disposed instance, before anything is sent.
|
|
851
766
|
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
767
|
+
* `placesNewestPage`: the caller places the newest page with this response, which brings the
|
|
768
|
+
* newest messages up to date, so the head interval is not checked.
|
|
769
|
+
*
|
|
770
|
+
* @internal
|
|
771
|
+
*/
|
|
772
|
+
requestChannelState(options: ChannelGetOrCreateRequest, requestOptions: StreamRequestOptions | undefined, { placesNewestPage }?: {
|
|
773
|
+
placesNewestPage?: boolean;
|
|
774
|
+
}): Promise<StreamResponse<ChannelStateResponse>>;
|
|
775
|
+
/**
|
|
776
|
+
* Whether nothing but this query brings the head interval up to date, so its `last_message_at` may
|
|
777
|
+
* show the interval stale: the watch was stopped (`NotWatching`), or this query itself watches
|
|
778
|
+
* again after a dropped connection (`WasWatching`), leaving nothing to re-watch with the newest
|
|
779
|
+
* page. While the channel is watched, a message the interval lacks is still on its way; after a
|
|
780
|
+
* dropped connection, the re-watch that follows places the newest page (see
|
|
781
|
+
* `ConnectionRecoveryManager`).
|
|
782
|
+
*/
|
|
783
|
+
private isHeadLeftWithoutRefresh;
|
|
784
|
+
/**
|
|
785
|
+
* Applies a channel query response: watch status, read/members state, polls, reminders, composer,
|
|
786
|
+
* channel data, and the `channels.queried` event and offline write. Called once the response's
|
|
787
|
+
* page of messages, if any, is placed (see {@link runChannelQuery}).
|
|
788
|
+
*
|
|
789
|
+
* @internal
|
|
790
|
+
*/
|
|
791
|
+
applyChannelStateFromResponse(state: ChannelStateResponseFields, { isLatestMessageSet, watch }: {
|
|
792
|
+
isLatestMessageSet: boolean;
|
|
793
|
+
watch?: boolean;
|
|
794
|
+
}): void;
|
|
795
|
+
/**
|
|
796
|
+
* Bans a user from this channel.
|
|
797
|
+
*
|
|
798
|
+
* @param targetUserId - The user to ban.
|
|
799
|
+
* @param options - Ban options.
|
|
855
800
|
* @returns The server response.
|
|
856
801
|
*/
|
|
857
|
-
|
|
802
|
+
banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
|
|
858
803
|
/**
|
|
859
|
-
* Removes the bans
|
|
804
|
+
* Removes the bans of a user on this channel.
|
|
860
805
|
*
|
|
861
806
|
* @param targetUserId - The user to unban.
|
|
862
807
|
* @param options - Unban options (optional).
|
|
@@ -864,33 +809,27 @@ export declare class Channel extends ChannelApi {
|
|
|
864
809
|
*/
|
|
865
810
|
unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<import("./types").APIResponse>;
|
|
866
811
|
/**
|
|
867
|
-
* Casts
|
|
812
|
+
* Casts a vote on a poll. `removeVote()` removes one.
|
|
868
813
|
*
|
|
869
|
-
* @param ...args - `[request, requestOptions]`. `
|
|
870
|
-
* and the vote to cast
|
|
871
|
-
* options such as an abort `signal` and is never serialized into the request.
|
|
814
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams` holds the target
|
|
815
|
+
* `message_id` and `poll_id`; `request` holds the vote to cast; `requestOptions` carries
|
|
816
|
+
* per-request options such as an abort `signal` and is never serialized into the request.
|
|
872
817
|
* @returns The poll vote response.
|
|
873
818
|
*/
|
|
874
819
|
vote(...args: Parameters<ChatApi['castPollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
|
|
875
820
|
removeVote(...args: Parameters<ChatApi['deletePollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
|
|
876
821
|
_createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<StreamResponse<import(".").CreateDraftResponse>>;
|
|
877
|
-
/**
|
|
878
|
-
* Creates or updates a draft message in a channel. If offline support is enabled, the
|
|
879
|
-
* call is queued so it is replayed on reconnect.
|
|
880
|
-
*/
|
|
822
|
+
/** Creates or updates a draft. With offline support the call is queued and replayed on reconnect. */
|
|
881
823
|
createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<import(".").CreateDraftResponse & {
|
|
882
824
|
metadata: import("./types").RequestMetadata;
|
|
883
825
|
}>;
|
|
884
826
|
_deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<StreamResponse<import(".").Response>>;
|
|
885
|
-
/**
|
|
886
|
-
* Deletes a draft message from a channel or a thread. If offline support is enabled, the
|
|
887
|
-
* call is queued so it is replayed on reconnect.
|
|
888
|
-
*/
|
|
827
|
+
/** Deletes a draft. With offline support the call is queued and replayed on reconnect. */
|
|
889
828
|
deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<import(".").Response & {
|
|
890
829
|
metadata: import("./types").RequestMetadata;
|
|
891
830
|
}>;
|
|
892
831
|
/**
|
|
893
|
-
* Listens to events on this channel.
|
|
832
|
+
* Listens to events on this channel. A callback alone listens to all events.
|
|
894
833
|
*
|
|
895
834
|
* @example
|
|
896
835
|
* channel.on('message.new', (event) => {
|
|
@@ -902,48 +841,71 @@ export declare class Channel extends ChannelApi {
|
|
|
902
841
|
* console.log(event.type);
|
|
903
842
|
* });
|
|
904
843
|
*
|
|
905
|
-
* @param
|
|
906
|
-
* @param
|
|
844
|
+
* @param eventType - The event type to listen for.
|
|
845
|
+
* @param callback - Called with each event of that type.
|
|
907
846
|
* @returns An object with an `unsubscribe()` method.
|
|
908
847
|
*/
|
|
909
|
-
on<T extends EventType
|
|
848
|
+
on<T extends EventType>(eventType: T, callback: EventHandler<T>): {
|
|
910
849
|
unsubscribe: () => void;
|
|
911
850
|
};
|
|
851
|
+
/**
|
|
852
|
+
* Listens to all events on this channel.
|
|
853
|
+
*
|
|
854
|
+
* @param callback - Called with every event.
|
|
855
|
+
* @returns An object with an `unsubscribe()` method.
|
|
856
|
+
*/
|
|
912
857
|
on(callback: EventHandler): {
|
|
913
858
|
unsubscribe: () => void;
|
|
914
859
|
};
|
|
915
860
|
/**
|
|
916
|
-
* Removes
|
|
861
|
+
* Removes a listener for one event type.
|
|
917
862
|
*
|
|
918
|
-
* @param
|
|
919
|
-
* @param
|
|
863
|
+
* @param eventType - The event type it listens to.
|
|
864
|
+
* @param callback - The listener to remove.
|
|
865
|
+
*/
|
|
866
|
+
off<T extends EventType>(eventType: T, callback: EventHandler<T>): void;
|
|
867
|
+
/**
|
|
868
|
+
* Removes a listener for all events.
|
|
869
|
+
*
|
|
870
|
+
* @param callback - The listener to remove.
|
|
920
871
|
*/
|
|
921
|
-
off<T extends EventType | string>(eventType: T, callback: EventHandler): void;
|
|
922
872
|
off(callback: EventHandler): void;
|
|
923
873
|
private _patchReadState;
|
|
924
874
|
private _upsertReadState;
|
|
925
875
|
/**
|
|
926
|
-
* Sets the current user's unread count
|
|
927
|
-
* `
|
|
928
|
-
* `state.unreadCount` derives from — so channel-wide resets (`channel.truncated`, "all channels
|
|
929
|
-
* read") must route through here rather than writing a count of their own.
|
|
876
|
+
* Sets the current user's unread count in `read[userId].unread_messages`, the one place it lives
|
|
877
|
+
* (`state.unreadCount` derives from it). Returns whether the count changed.
|
|
930
878
|
*/
|
|
931
|
-
/** @returns whether the count actually changed, so callers can react only to the channels it did. */
|
|
932
879
|
_setOwnUnreadCount(unreadCount: number): boolean;
|
|
933
880
|
_handleChannelEvent(event: Event): void;
|
|
934
|
-
_callChannelListeners: (event:
|
|
881
|
+
_callChannelListeners: (event: Event) => void;
|
|
882
|
+
/**
|
|
883
|
+
* Throws if the channel has no ID (created from members only). Narrows `id` to `string`. Call it
|
|
884
|
+
* before any request that uses `this.cid`: it is a string (possibly temporary) even without an ID,
|
|
885
|
+
* so TypeScript does not flag a missing check.
|
|
886
|
+
*/
|
|
887
|
+
_checkHasId(): asserts this is this & {
|
|
888
|
+
id: string;
|
|
889
|
+
};
|
|
890
|
+
/** Throws unless the channel was queried or populated from the offline DB. */
|
|
935
891
|
_checkInitialized(): void;
|
|
936
892
|
_initializeState(state: ChannelStateResponseFields): void;
|
|
937
893
|
_extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
|
|
938
894
|
_hydrateMembers({ members, overrideCurrentState, }: {
|
|
939
895
|
members: ChannelMemberResponse[];
|
|
940
|
-
/**
|
|
941
|
-
* If set to `true` then `ChannelState.members` will be overriden with the newly
|
|
942
|
-
* provided `members`, setting this property to `false` will merge current `ChannelState.members`
|
|
943
|
-
* object with the newly provided `members`
|
|
944
|
-
* (new members with the same `userId` will replace the old ones).
|
|
945
|
-
*/
|
|
896
|
+
/** `true` replaces `state.members`. `false` merges (a new member replaces one with the same ID). */
|
|
946
897
|
overrideCurrentState?: boolean;
|
|
947
898
|
}): void;
|
|
948
|
-
|
|
899
|
+
/**
|
|
900
|
+
* Ends the instance for good: unsubscribes from the configuration and the server config, stops the
|
|
901
|
+
* receipts tracker and the cooldown timer, disposes both paginators, then sets
|
|
902
|
+
* `pendingDisposal: true` and `watchStatus: NotWatching`. It sends no request, so the server keeps a
|
|
903
|
+
* watch this connection held until the connection ends. Calling it again does nothing.
|
|
904
|
+
*
|
|
905
|
+
* The SDK calls it when a channel ends (deleted, current user removed, logout, released as unused).
|
|
906
|
+
* It does not remove the channel from the channel store. The SDK's own ends remove it; after a
|
|
907
|
+
* direct call it stays until `client.channelManager.releaseUnusedChannels()`, or until `ensure()`
|
|
908
|
+
* for the same cid replaces it.
|
|
909
|
+
*/
|
|
910
|
+
disconnect(): void;
|
|
949
911
|
}
|