stream-chat 10.0.0-rc.21 → 10.0.0-rc.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.js +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
package/dist/types/channel.d.ts
CHANGED
|
@@ -7,30 +7,20 @@ import type { MessageOperations } from './messageOperations';
|
|
|
7
7
|
import type { OperationRequestFn } from './messageOperations/types';
|
|
8
8
|
import type { StreamChat } from './client';
|
|
9
9
|
import type { ChannelDeclarativeConfig } from './configuration/types';
|
|
10
|
-
import type { AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields,
|
|
10
|
+
import type { AddMembersRequest, AIState, BanUserOptions, ChannelGetOrCreateRequest, ChannelInput, ChannelMemberResponse, ChannelResponse, ChannelStateResponseFields, Command, Event, EventHandler, EventPayload, EventType, FileUploadInput, FilterTagsRequest, InviteMembersRequest, LocalMessage, MarkReadRequest, MarkReadResponse, MessageResponse, MessageSetType, QueryMembersPayload, RemoveMembersRequest, SharedLocation, StreamRequestOptions, StreamResponse, TimestampNS, UnBanUserOptions, UpdateChannelPartialRequest, UpdateLiveLocationRequest, UserResponse } from './types';
|
|
11
11
|
import type { StateStore } from '@stream-io/state-store';
|
|
12
|
-
import type {
|
|
12
|
+
import type { ChannelPushPreferencesResponse as Gen_ChannelPushPreferencesResponse, MuteChannelRequest as Gen_MuteChannelRequest, UnmuteChannelRequest as Gen_UnmuteChannelRequest, UploadChannelFileRequest, UploadChannelRequest, WSEvent } from './gen/models';
|
|
13
13
|
import type { ChatApi } from './gen/chat/ChatApi';
|
|
14
14
|
import { ChannelApi } from './gen/chat/ChannelApi';
|
|
15
|
-
/**
|
|
16
|
-
* The message-operation vocabulary, re-exported so it has a public path: `src/messageOperations` is
|
|
17
|
-
* not part of the root barrel, while `src/index.ts` re-exports this module wholesale.
|
|
18
|
-
*
|
|
19
|
-
* `OperationParams<K>` and `OperationRequestFn<K>` are the one spelling for every operation's
|
|
20
|
-
* parameters and request function — both derived from `MessageOperationSpec`, so adding an operation
|
|
21
|
-
* kind extends them rather than needing a new hand-written pair.
|
|
22
|
-
*/
|
|
15
|
+
/** Re-exported here because `src/messageOperations` is not in the root barrel. */
|
|
23
16
|
export type { DefaultOperationRequest, MessageOperationSpec, OperationKind, OperationParams, OperationRequestFn, OperationResponse, } from './messageOperations/types';
|
|
24
17
|
export type CustomMarkReadRequestFn = (params: {
|
|
25
18
|
channel: Channel;
|
|
26
19
|
options?: MarkReadRequest;
|
|
27
20
|
}) => Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
|
|
28
21
|
/**
|
|
29
|
-
* A channel's
|
|
30
|
-
*
|
|
31
|
-
* Not `ChannelConfigWithInfo`, which is the generated type for the channel *type's server*
|
|
32
|
-
* configuration behind {@link Channel.serverConfig}. The two are related: the gates below are the
|
|
33
|
-
* 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.
|
|
34
24
|
*/
|
|
35
25
|
export type ChannelConfig = {
|
|
36
26
|
requestHandlers?: {
|
|
@@ -41,102 +31,66 @@ export type ChannelConfig = {
|
|
|
41
31
|
updateMessageRequest?: OperationRequestFn<'update'>;
|
|
42
32
|
};
|
|
43
33
|
/**
|
|
44
|
-
* Typing indicators
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* This is the channel-wide gate, read by {@link Channel.keystroke} and {@link Channel.stopTyping}.
|
|
48
|
-
* `messageComposer.text.publishTypingEvents` sits on top of it as a per-composer refinement — a thread
|
|
49
|
-
* 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.
|
|
50
37
|
*/
|
|
51
38
|
typingEvents: {
|
|
52
39
|
enabled: boolean;
|
|
53
40
|
};
|
|
54
41
|
/**
|
|
55
|
-
* Read receipts
|
|
56
|
-
*
|
|
57
|
-
* {@link Channel.markRead} and {@link Channel.markUnread}.
|
|
42
|
+
* Read receipts. `enabled` is ANDed with the channel type's `read_events`. Read by
|
|
43
|
+
* {@link Channel.markRead} and {@link Channel.markUnread}. Defaults to `true`.
|
|
58
44
|
*
|
|
59
|
-
* `localUnreadCountEnabled`
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* counting locally is what an integrator does *because* the server declines to.
|
|
45
|
+
* `localUnreadCountEnabled` applies only while `enabled` is false: the channel keeps counting
|
|
46
|
+
* unread messages and {@link Channel.markReadLocally} resets the count, sending nothing to the
|
|
47
|
+
* server. The server does not restrict it. Defaults to `false`.
|
|
63
48
|
*/
|
|
64
49
|
readEvents: {
|
|
65
50
|
enabled: boolean;
|
|
66
51
|
localUnreadCountEnabled: boolean;
|
|
67
52
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Threaded replies for this channel (defaults to enabled). ANDed with the channel type's `replies`.
|
|
70
|
-
*/
|
|
53
|
+
/** Threaded replies. Defaults to enabled. ANDed with the channel type's `replies`. */
|
|
71
54
|
replies: {
|
|
72
55
|
enabled: boolean;
|
|
73
56
|
};
|
|
74
57
|
/**
|
|
75
|
-
* Message reminders
|
|
76
|
-
* type's `user_message_reminders`.
|
|
58
|
+
* Message reminders. Defaults to enabled. ANDed with the channel type's `user_message_reminders`.
|
|
77
59
|
*/
|
|
78
60
|
userMessageReminders: {
|
|
79
61
|
enabled: boolean;
|
|
80
62
|
};
|
|
81
|
-
/**
|
|
82
|
-
* Delivery receipts (defaults to enabled). ANDed with the channel type's `delivery_events`.
|
|
83
|
-
*/
|
|
63
|
+
/** Delivery receipts. Defaults to enabled. ANDed with the channel type's `delivery_events`. */
|
|
84
64
|
deliveryEvents: {
|
|
85
65
|
enabled: boolean;
|
|
86
66
|
};
|
|
87
67
|
/**
|
|
88
|
-
* The slash commands
|
|
89
|
-
*
|
|
90
|
-
* Named for availability rather than enablement on purpose: whether any given command can be *used*
|
|
91
|
-
* right now is `messageComposer.isCommandDisabled(command)`, which depends on the message context —
|
|
92
|
-
* editing and quoting disable different ones. A list called `enabledCommands` would routinely contain
|
|
93
|
-
* disabled entries.
|
|
94
|
-
*
|
|
95
|
-
* **Server-owned, and the one field here the integrator cannot set.** It is a list rather than a gate,
|
|
96
|
-
* so there is nothing to AND and no intent to express — the server's answer simply *is* the value, and
|
|
97
|
-
* it is absent from the declarative tree for that reason.
|
|
98
|
-
*
|
|
99
|
-
* It lives on the resolved configuration anyway so that consumers never need a second place to look:
|
|
100
|
-
* every question about what this channel permits is answered by `config`. Reading the raw
|
|
101
|
-
* {@link Channel.serverConfig} instead is what made a UI show features the client had disabled — the
|
|
102
|
-
* gates below have a client half, and mixing the two sources meant sometimes reading only one.
|
|
68
|
+
* The slash commands the channel type offers. Server-owned: the integrator cannot set it. Whether a
|
|
69
|
+
* command can be used right now is `messageComposer.isCommandDisabled(command)`.
|
|
103
70
|
*/
|
|
104
71
|
availableCommands: Command[];
|
|
105
72
|
};
|
|
106
73
|
export declare const DEFAULT_CHANNEL_CONFIG: ChannelConfig;
|
|
107
|
-
/**
|
|
108
|
-
* The Channel class manages its own state.
|
|
109
|
-
*/
|
|
110
74
|
export declare class Channel extends ChannelApi {
|
|
111
75
|
_client: StreamChat;
|
|
112
76
|
_data: ChannelInput;
|
|
113
77
|
cid: string;
|
|
114
|
-
/** */
|
|
115
78
|
listeners: Map<EventType, Set<EventHandler>>;
|
|
116
79
|
state: ChannelState;
|
|
117
80
|
lastKeyStroke?: Date;
|
|
118
81
|
lastTypingEvent: Date | null;
|
|
119
82
|
isTyping: boolean;
|
|
120
|
-
/** Re-entrancy guard for {@link Channel.reload}
|
|
83
|
+
/** Re-entrancy guard for {@link Channel.reload}. */
|
|
121
84
|
private _reloading;
|
|
122
|
-
/** Refcount
|
|
85
|
+
/** Refcount behind the `active` flag: several consumers can hold one instance. */
|
|
123
86
|
private _activeRefCount;
|
|
124
87
|
private _channelQueriesInFlight;
|
|
125
88
|
/**
|
|
126
|
-
* The watch {@link Channel.ensureWatched} started and is
|
|
127
|
-
*
|
|
128
|
-
* another request; `watch()` calls are not recorded here.
|
|
89
|
+
* The watch {@link Channel.ensureWatched} started and is awaiting. Later `ensureWatched()` calls with
|
|
90
|
+
* the same options wait for it. `watch()` calls are not recorded here.
|
|
129
91
|
*/
|
|
130
92
|
private _ensureWatchedInFlight?;
|
|
131
93
|
push_preferences?: Gen_ChannelPushPreferencesResponse;
|
|
132
|
-
/**
|
|
133
|
-
* The shared configuration machinery. Owned rather than inherited — `Channel` already extends
|
|
134
|
-
* `ChannelApi`, so single inheritance is spent.
|
|
135
|
-
*
|
|
136
|
-
* `mergeSlice: 'deep'` because the config has nested groups: registering `typingEvents.enabled` must
|
|
137
|
-
* not drop `readEvents`. `applyAuthority` is what makes `channel.config` the *whole* answer rather
|
|
138
|
-
* than the client's half — see {@link serverRestrictions}.
|
|
139
|
-
*/
|
|
140
94
|
private readonly configController;
|
|
141
95
|
readonly messageComposer: MessageComposer;
|
|
142
96
|
readonly messageReceiptsTracker: MessageReceiptsTracker;
|
|
@@ -144,89 +98,49 @@ export declare class Channel extends ChannelApi {
|
|
|
144
98
|
readonly messagePaginator: MessagePaginator;
|
|
145
99
|
readonly pinnedMessagesPaginator: PinnedMessagePaginator;
|
|
146
100
|
readonly cooldownTimer: CooldownTimer;
|
|
147
|
-
/**
|
|
148
|
-
* Teardown for this channel's configuration subscription, released by {@link disconnect}. Left
|
|
149
|
-
* subscribed, a disconnected channel would stay in the configuration store's handler set for good.
|
|
150
|
-
*/
|
|
151
101
|
private unsubscribeConfiguration?;
|
|
152
|
-
/** Teardown for the server-config re-derivation subscription, released by {@link disconnect}. */
|
|
153
102
|
private unsubscribeServerConfig?;
|
|
154
|
-
/** The declarative slice last derived from, so a late server
|
|
103
|
+
/** The declarative slice last derived from, so a late server config can re-derive from it. */
|
|
155
104
|
private declarativeConfig?;
|
|
156
105
|
/**
|
|
157
|
-
* Creates
|
|
106
|
+
* Creates an uninitialized channel. Without an `id` its `cid` is a temporary one built from
|
|
107
|
+
* `data.members`, until the server answers.
|
|
158
108
|
*
|
|
159
109
|
* @param client - The chat client.
|
|
160
|
-
* @param type - The type
|
|
161
|
-
* @param id - The ID
|
|
162
|
-
* @param data -
|
|
163
|
-
* @returns A new uninitialized channel.
|
|
110
|
+
* @param type - The channel type.
|
|
111
|
+
* @param id - The channel ID, or `undefined` for a channel created from members.
|
|
112
|
+
* @param data - Data for the channel (members, custom fields).
|
|
164
113
|
*/
|
|
165
114
|
constructor(client: StreamChat, type: string, id: string | undefined, data: ChannelInput);
|
|
166
|
-
/**
|
|
167
|
-
* The configuration fields this channel's *type* decides server-side.
|
|
168
|
-
*
|
|
169
|
-
* Both are boolean gates, so `mergeServerRestrictions` ANDs them with what was requested: either the
|
|
170
|
-
* server or the integrator may switch a feature off, and neither can widen. Re-read on every
|
|
171
|
-
* derivation rather than captured, so a flag that changes mid-session is picked up.
|
|
172
|
-
*/
|
|
115
|
+
/** Flags the channel type decides server-side (ANDed with the requested ones). */
|
|
173
116
|
private get serverRestrictions();
|
|
174
117
|
/**
|
|
175
|
-
*
|
|
118
|
+
* Re-derives the configuration of the channel, its paginators and its message operations from the
|
|
119
|
+
* declarative slice. Runs at construction, on every change to the `channel`, `messagePaginator` or
|
|
120
|
+
* `messageOperations` configuration, and on `client.config.reset()`.
|
|
176
121
|
*
|
|
177
|
-
*
|
|
178
|
-
* `requestHandlers`; each sub-object derives its own configuration, so the knowledge of what
|
|
179
|
-
* `messagePaginator.pageSize` means stays inside the paginator.
|
|
122
|
+
* @param declarativeConfig - The channel's declarative slice (optional).
|
|
180
123
|
*/
|
|
181
124
|
initializeConfig(declarativeConfig?: ChannelDeclarativeConfig): void;
|
|
182
125
|
/**
|
|
183
|
-
* Returns the chat client for this channel.
|
|
184
|
-
* {@link Channel.pendingDisposal}.
|
|
126
|
+
* Returns the chat client for this channel.
|
|
185
127
|
*
|
|
186
128
|
* @returns The chat client.
|
|
129
|
+
* @throws If the channel is pending disposal ({@link Channel.pendingDisposal}).
|
|
187
130
|
*/
|
|
188
131
|
getClient(): StreamChat;
|
|
189
|
-
/** What a call on a disposed instance fails with: it is done for good, and how to get a live one. */
|
|
190
132
|
private disposedError;
|
|
191
|
-
/**
|
|
192
|
-
* Resolved configuration, as a store. Delegates rather than holding a copy, so the field and the
|
|
193
|
-
* controller's store cannot drift.
|
|
194
|
-
*
|
|
195
|
-
* Still directly writable, and deliberately so: the React SDK installs per-component request handlers
|
|
196
|
-
* by calling `partialNext({ requestHandlers })` on it. That write bypasses the controller, which is
|
|
197
|
-
* why `requestHandlers` is the one field a re-derivation replaces wholesale — see
|
|
198
|
-
* {@link initializeConfig}.
|
|
199
|
-
*/
|
|
200
133
|
get configState(): StateStore<ChannelConfig>;
|
|
201
|
-
/**
|
|
202
|
-
* This channel's **resolved** configuration — the shape every configurable class exposes.
|
|
203
|
-
*
|
|
204
|
-
* Not to be confused with {@link serverConfig}, which is this channel's configuration as the
|
|
205
|
-
* server reports it. This one has already folded that in: `typingEvents.enabled` is the server's
|
|
206
|
-
* `typing_events` ANDed with whatever the integrator registered, so it is the whole answer. The
|
|
207
|
-
* near-collision is why the server side became `serverConfig`, a getter that says what it
|
|
208
|
-
* is.
|
|
209
|
-
*/
|
|
210
134
|
get config(): Readonly<ChannelConfig>;
|
|
211
135
|
/**
|
|
212
|
-
*
|
|
213
|
-
* `
|
|
214
|
-
*
|
|
215
|
-
* Mostly a property of the channel *type*, but not only: a channel's own `config_overrides` narrow it
|
|
216
|
-
* for that channel alone, which is why the cache behind this is keyed by cid rather than by type. See
|
|
217
|
-
* `StreamChat._addChannelConfig`.
|
|
218
|
-
*
|
|
219
|
-
* `undefined` until this channel has been queried or watched — there is nothing to fall back on that
|
|
220
|
-
* would not be another channel's overrides. {@link config} covers that case with its defaults.
|
|
221
|
-
*
|
|
222
|
-
* Distinct from {@link config}, which is this instance's resolved configuration and already has the
|
|
223
|
-
* relevant flags below folded into it. Prefer `config` when deciding whether a feature is available:
|
|
224
|
-
* this getter answers only the server's half, so gating UI on it offers features the client has
|
|
225
|
-
* already disabled.
|
|
136
|
+
* The channel's configuration as the server reports it (`uploads`, `typing_events`, `commands`, ...),
|
|
137
|
+
* including this channel's `config_overrides`. `undefined` until the channel is queried or watched.
|
|
138
|
+
* Gate features on {@link config} instead: it also folds in what the integrator disabled.
|
|
226
139
|
*/
|
|
227
140
|
get serverConfig(): import(".").ChannelConfigWithInfo | undefined;
|
|
228
141
|
/**
|
|
229
|
-
* Sends a message to this channel.
|
|
142
|
+
* Sends a message to this channel. Strips `localMetadata` from attachments and drops those whose
|
|
143
|
+
* upload never completed.
|
|
230
144
|
*
|
|
231
145
|
* @param ...args - `[request, requestOptions]`. `request` holds the message body and optional
|
|
232
146
|
* flags such as `skip_enrich_url`, `skip_push`, and `keep_channel_hidden`; `requestOptions`
|
|
@@ -237,44 +151,53 @@ export declare class Channel extends ChannelApi {
|
|
|
237
151
|
sendReaction(...args: Parameters<ChatApi['sendReaction']>): Promise<StreamResponse<import(".").SendReactionResponse>>;
|
|
238
152
|
deleteReaction(...args: Parameters<ChatApi['deleteReaction']>): Promise<StreamResponse<import(".").DeleteReactionResponse>>;
|
|
239
153
|
/**
|
|
240
|
-
*
|
|
154
|
+
* Uploads a file to this channel's file endpoint (multipart).
|
|
241
155
|
*
|
|
242
156
|
* @param request - Upload payload. `request.file` is the file to upload.
|
|
243
|
-
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
244
|
-
*
|
|
157
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
158
|
+
* (optional).
|
|
159
|
+
* @returns The upload response, with the CDN URL in `file`.
|
|
245
160
|
*/
|
|
246
161
|
uploadChannelFile(request?: Omit<UploadChannelFileRequest, 'file'> & {
|
|
247
162
|
file?: FileUploadInput;
|
|
248
163
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
|
|
249
164
|
/**
|
|
250
|
-
*
|
|
165
|
+
* Uploads an image to this channel's image endpoint (multipart).
|
|
251
166
|
*
|
|
252
167
|
* @param request - Upload payload. `request.file` is the image to upload.
|
|
253
|
-
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
254
|
-
*
|
|
168
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
169
|
+
* (optional).
|
|
170
|
+
* @returns The upload response, with the CDN URL in `file`.
|
|
255
171
|
*/
|
|
256
172
|
uploadChannelImage(request?: Omit<UploadChannelRequest, 'file'> & {
|
|
257
173
|
file?: FileUploadInput;
|
|
258
174
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UploadChannelResponse>>;
|
|
259
|
-
/**
|
|
260
|
-
* Alias for {@link uploadChannelFile}, mirroring `client.uploadFile`.
|
|
261
|
-
*/
|
|
175
|
+
/** Alias for {@link uploadChannelFile}. */
|
|
262
176
|
uploadFile: (...args: Parameters<Channel["uploadChannelFile"]>) => Promise<StreamResponse<import(".").UploadChannelFileResponse>>;
|
|
263
|
-
/** Alias for {@link uploadChannelImage}
|
|
177
|
+
/** Alias for {@link uploadChannelImage}. */
|
|
264
178
|
uploadImage: (...args: Parameters<Channel["uploadChannelImage"]>) => Promise<StreamResponse<import(".").UploadChannelResponse>>;
|
|
265
|
-
deleteFile(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
266
|
-
deleteImage(url: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
267
179
|
/**
|
|
268
|
-
*
|
|
180
|
+
* Deletes a file uploaded to this channel, the same request shape as `client.deleteFile`.
|
|
181
|
+
*
|
|
182
|
+
* @param request - The file to delete. `request.url` is its URL.
|
|
183
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
184
|
+
* into the request (optional).
|
|
185
|
+
* @returns The server response.
|
|
186
|
+
*/
|
|
187
|
+
deleteFile(request: {
|
|
188
|
+
url: string;
|
|
189
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
190
|
+
/**
|
|
191
|
+
* Deletes an image uploaded to this channel, the same request shape as `client.deleteImage`.
|
|
269
192
|
*
|
|
270
|
-
* @param request -
|
|
193
|
+
* @param request - The image to delete. `request.url` is its URL.
|
|
271
194
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
272
195
|
* into the request (optional).
|
|
273
196
|
* @returns The server response.
|
|
274
197
|
*/
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").
|
|
198
|
+
deleteImage(request: {
|
|
199
|
+
url: string;
|
|
200
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").Response>>;
|
|
278
201
|
/**
|
|
279
202
|
* Queries members.
|
|
280
203
|
*
|
|
@@ -289,20 +212,19 @@ export declare class Channel extends ChannelApi {
|
|
|
289
212
|
payload?: Partial<QueryMembersPayload>;
|
|
290
213
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MembersResponse>>;
|
|
291
214
|
/**
|
|
292
|
-
*
|
|
293
|
-
* server-returned channel onto `this.data`.
|
|
215
|
+
* Updates the channel and stores the returned channel in `this.data`.
|
|
294
216
|
*
|
|
295
217
|
* @param ...args - `[request, requestOptions]`. `request` is the channel update payload, e.g.
|
|
296
|
-
* `{ data: { name: 'foo' }, message }`; `requestOptions` carries per-request options
|
|
297
|
-
* abort `signal` and is never serialized into the request.
|
|
218
|
+
* `{ data: { custom: { name: 'foo' } }, message }`; `requestOptions` carries per-request options
|
|
219
|
+
* such as an abort `signal` and is never serialized into the request.
|
|
298
220
|
* @returns The server response.
|
|
299
221
|
*/
|
|
300
222
|
update(...args: Parameters<ChannelApi['update']>): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
301
223
|
/**
|
|
302
|
-
*
|
|
224
|
+
* Partially updates the channel's properties and stores the returned channel in `this.data`.
|
|
303
225
|
*
|
|
304
226
|
* @param update - The partial update request.
|
|
305
|
-
* @param
|
|
227
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
306
228
|
* into the request (optional).
|
|
307
229
|
* @returns The server response.
|
|
308
230
|
*/
|
|
@@ -311,7 +233,7 @@ export declare class Channel extends ChannelApi {
|
|
|
311
233
|
* Enables slow mode.
|
|
312
234
|
*
|
|
313
235
|
* @param coolDownInterval - The cooldown interval in seconds.
|
|
314
|
-
* @param
|
|
236
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
315
237
|
* into the request (optional).
|
|
316
238
|
* @returns The server response.
|
|
317
239
|
*/
|
|
@@ -319,13 +241,11 @@ export declare class Channel extends ChannelApi {
|
|
|
319
241
|
/**
|
|
320
242
|
* Disables slow mode.
|
|
321
243
|
*
|
|
322
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
323
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
324
244
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
325
245
|
* into the request (optional).
|
|
326
246
|
* @returns The server response.
|
|
327
247
|
*/
|
|
328
|
-
disableSlowMode(
|
|
248
|
+
disableSlowMode(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
329
249
|
sendSharedLocation(location: SharedLocation & {
|
|
330
250
|
message_id?: string;
|
|
331
251
|
}): Promise<import(".").SendMessageResponse & {
|
|
@@ -335,196 +255,175 @@ export declare class Channel extends ChannelApi {
|
|
|
335
255
|
/**
|
|
336
256
|
* Accepts an invitation to the channel.
|
|
337
257
|
*
|
|
338
|
-
* @param options -
|
|
258
|
+
* @param options - Other channel update options to send with it. Defaults to `{}`.
|
|
339
259
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
340
260
|
* into the request (optional).
|
|
341
261
|
* @returns The server response.
|
|
342
262
|
*/
|
|
343
|
-
acceptInvite(options?:
|
|
263
|
+
acceptInvite(options?: NonNullable<Parameters<ChannelApi['update']>[0]>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
344
264
|
/**
|
|
345
265
|
* Rejects an invitation to the channel.
|
|
346
266
|
*
|
|
347
|
-
* @param options -
|
|
267
|
+
* @param options - Other channel update options to send with it. Defaults to `{}`.
|
|
348
268
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
349
269
|
* into the request (optional).
|
|
350
270
|
* @returns The server response.
|
|
351
271
|
*/
|
|
352
|
-
rejectInvite(options?:
|
|
272
|
+
rejectInvite(options?: NonNullable<Parameters<ChannelApi['update']>[0]>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
353
273
|
/**
|
|
354
274
|
* Adds members to the channel.
|
|
355
275
|
*
|
|
356
|
-
* @param
|
|
357
|
-
* @param
|
|
358
|
-
* @param
|
|
276
|
+
* @param request - The members to add, and any other channel update option.
|
|
277
|
+
* @param request.members - User IDs, or member requests (`{ user_id, channel_role?, custom? }`).
|
|
278
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
359
279
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
360
280
|
* into the request (optional).
|
|
361
281
|
* @returns The server response.
|
|
362
282
|
*/
|
|
363
|
-
addMembers(members
|
|
283
|
+
addMembers({ members, ...options }: AddMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
364
284
|
/**
|
|
365
285
|
* Adds filter tags to the channel.
|
|
366
286
|
*
|
|
367
|
-
* @param
|
|
368
|
-
* @param
|
|
369
|
-
* @param
|
|
287
|
+
* @param request - The tags to add, and any other channel update option.
|
|
288
|
+
* @param request.tags - The tags to add.
|
|
289
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
370
290
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
371
291
|
* into the request (optional).
|
|
372
292
|
* @returns The server response.
|
|
373
293
|
*/
|
|
374
|
-
addFilterTags(tags
|
|
294
|
+
addFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
375
295
|
/**
|
|
376
296
|
* Removes filter tags from the channel.
|
|
377
297
|
*
|
|
378
|
-
* @param
|
|
379
|
-
* @param
|
|
380
|
-
* @param
|
|
298
|
+
* @param request - The tags to remove, and any other channel update option.
|
|
299
|
+
* @param request.tags - The tags to remove.
|
|
300
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
381
301
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
382
302
|
* into the request (optional).
|
|
383
303
|
* @returns The server response.
|
|
384
304
|
*/
|
|
385
|
-
removeFilterTags(tags
|
|
305
|
+
removeFilterTags({ tags, ...options }: FilterTagsRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
386
306
|
/**
|
|
387
307
|
* Invite members to the channel.
|
|
388
308
|
*
|
|
389
|
-
* @param
|
|
390
|
-
* @param
|
|
391
|
-
* @param
|
|
309
|
+
* @param request - The members to invite, and any other channel update option.
|
|
310
|
+
* @param request.members - User IDs, or member requests (`{ user_id, custom }`).
|
|
311
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
392
312
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
393
313
|
* into the request (optional).
|
|
394
314
|
* @returns The server response.
|
|
395
315
|
*/
|
|
396
|
-
inviteMembers(members
|
|
316
|
+
inviteMembers({ members, ...options }: InviteMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
397
317
|
/**
|
|
398
318
|
* Removes members from the channel.
|
|
399
319
|
*
|
|
400
|
-
* @param
|
|
401
|
-
* @param
|
|
402
|
-
* @param
|
|
320
|
+
* @param request - The members to remove, and any other channel update option.
|
|
321
|
+
* @param request.members - The user IDs to remove.
|
|
322
|
+
* @param request.message - Message object for channel members notification (optional).
|
|
403
323
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
404
324
|
* into the request (optional).
|
|
405
325
|
* @returns The server response.
|
|
406
326
|
*/
|
|
407
|
-
removeMembers(members
|
|
327
|
+
removeMembers({ members, ...options }: RemoveMembersRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateChannelResponse>>;
|
|
408
328
|
/**
|
|
409
|
-
* Mutes the
|
|
329
|
+
* Mutes the channel.
|
|
410
330
|
*
|
|
411
331
|
* @example
|
|
412
|
-
* // with expiration
|
|
413
|
-
* await channel.mute({ expiration:
|
|
332
|
+
* // with expiration (two weeks)
|
|
333
|
+
* await channel.mute({ expiration: 14 * 24 * 60 * 60 * 1000 });
|
|
414
334
|
*
|
|
415
|
-
* @
|
|
416
|
-
*
|
|
417
|
-
* await channel.mute({ user_id: userId });
|
|
418
|
-
*
|
|
419
|
-
* @param options - Mute options (optional, defaults to `{}`).
|
|
420
|
-
* @param options.expiration - Expiration in minutes (optional).
|
|
335
|
+
* @param options - Mute options (optional).
|
|
336
|
+
* @param options.expiration - Mute duration in milliseconds (optional).
|
|
421
337
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
422
338
|
* into the request (optional).
|
|
423
339
|
* @returns The server response.
|
|
424
340
|
*/
|
|
425
341
|
mute(options?: Gen_MuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MuteChannelResponse>>;
|
|
426
342
|
/**
|
|
427
|
-
* Unmutes the
|
|
343
|
+
* Unmutes the channel.
|
|
428
344
|
*
|
|
429
345
|
* @example
|
|
430
|
-
*
|
|
431
|
-
* await channel.unmute({ user_id: userId });
|
|
346
|
+
* await channel.unmute();
|
|
432
347
|
*
|
|
433
|
-
* @param options - Unmute options (optional
|
|
434
|
-
* @param options.user_id - User ID (optional).
|
|
348
|
+
* @param options - Unmute options (optional).
|
|
435
349
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
436
350
|
* into the request (optional).
|
|
437
351
|
* @returns The server response.
|
|
438
352
|
*/
|
|
439
353
|
unmute(options?: Gen_UnmuteChannelRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnmuteResponse>>;
|
|
440
354
|
/**
|
|
441
|
-
* Archives the current
|
|
355
|
+
* Archives the channel for the current user.
|
|
442
356
|
*
|
|
443
357
|
* @example
|
|
444
358
|
* await channel.archive();
|
|
445
359
|
*
|
|
446
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
447
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
448
360
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
449
361
|
* into the request (optional).
|
|
450
362
|
* @returns The server response.
|
|
451
363
|
*/
|
|
452
|
-
archive(
|
|
364
|
+
archive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
453
365
|
/**
|
|
454
|
-
* Unarchives the current
|
|
366
|
+
* Unarchives the channel for the current user.
|
|
455
367
|
*
|
|
456
368
|
* @example
|
|
457
369
|
* await channel.unarchive();
|
|
458
370
|
*
|
|
459
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
460
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
461
371
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
462
372
|
* into the request (optional).
|
|
463
373
|
* @returns The server response.
|
|
464
374
|
*/
|
|
465
|
-
unarchive(
|
|
375
|
+
unarchive(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
466
376
|
/**
|
|
467
|
-
* Pins the current
|
|
377
|
+
* Pins the channel for the current user.
|
|
468
378
|
*
|
|
469
379
|
* @example
|
|
470
380
|
* await channel.pin();
|
|
471
381
|
*
|
|
472
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
473
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
474
382
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
475
383
|
* into the request (optional).
|
|
476
384
|
* @returns The server response.
|
|
477
385
|
*/
|
|
478
|
-
pin(
|
|
386
|
+
pin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
479
387
|
/**
|
|
480
|
-
* Unpins the current
|
|
388
|
+
* Unpins the channel for the current user.
|
|
481
389
|
*
|
|
482
390
|
* @example
|
|
483
391
|
* await channel.unpin();
|
|
484
392
|
*
|
|
485
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
486
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
487
393
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
488
394
|
* into the request (optional).
|
|
489
395
|
* @returns The server response.
|
|
490
396
|
*/
|
|
491
|
-
unpin(
|
|
397
|
+
unpin(requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMemberPartialResponse>>;
|
|
492
398
|
/**
|
|
493
|
-
* Returns the mute status
|
|
399
|
+
* Returns the mute status of the channel.
|
|
494
400
|
*
|
|
495
|
-
* @returns
|
|
496
|
-
*
|
|
401
|
+
* @returns `{ muted, createdAt, expiresAt }`, the timestamps in unix nanoseconds as the API sends
|
|
402
|
+
* them.
|
|
497
403
|
*/
|
|
498
404
|
muteStatus(): import("./channel_state").ChannelMuteStatus;
|
|
499
405
|
/**
|
|
500
|
-
* Recomputes
|
|
501
|
-
*
|
|
502
|
-
* churn subscribers. Called from the constructor and by the client whenever `mutedChannels`
|
|
503
|
-
* updates. Unlike `muteStatus()`, this does not require the channel to be initialized.
|
|
406
|
+
* Recomputes `state.muteStatus` from `client.mutedChannels`, publishing only on change (the client
|
|
407
|
+
* calls this on every `mutedChannels` update). Unlike `muteStatus()`, it needs no channel ID.
|
|
504
408
|
*/
|
|
505
409
|
_syncMuteStatus(): void;
|
|
506
410
|
sendAction(messageId: string, formData: Record<string, string>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MessageActionResponse>>;
|
|
507
411
|
/**
|
|
508
|
-
*
|
|
509
|
-
* Call this on every keystroke.
|
|
412
|
+
* Call on every keystroke: sends `typing.start` at most every 2 seconds.
|
|
510
413
|
*
|
|
511
414
|
* @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs}
|
|
512
415
|
*
|
|
513
|
-
* @param parentId -
|
|
514
|
-
* @param options - Optional override carrying a `user_id` (optional).
|
|
416
|
+
* @param parentId - The parent message ID, for a typing event in a thread (optional).
|
|
515
417
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
516
418
|
* into the request (optional).
|
|
517
419
|
*/
|
|
518
|
-
keystroke(parentId?: string,
|
|
519
|
-
user_id: string;
|
|
520
|
-
}, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
420
|
+
keystroke(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
521
421
|
/**
|
|
522
|
-
*
|
|
523
|
-
* Typically used by the server connected to the AI service to notify clients of state changes.
|
|
422
|
+
* Notifies watchers of a message's AI state. Meant for the server connected to the AI service.
|
|
524
423
|
*
|
|
525
424
|
* @param messageId - The ID of the message associated with the AI state.
|
|
526
425
|
* @param state - The new state of the AI process, e.g. thinking, generating.
|
|
527
|
-
* @param options -
|
|
426
|
+
* @param options - Additional details for the event. Defaults to `{}`.
|
|
528
427
|
* @param options.ai_message - Additional message detail to include in the event (optional).
|
|
529
428
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
530
429
|
* into the request (optional).
|
|
@@ -536,173 +435,120 @@ export declare class Channel extends ChannelApi {
|
|
|
536
435
|
* Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming.
|
|
537
436
|
* Typically used by the server connected to the AI service to inform clients that the AI response has started.
|
|
538
437
|
*
|
|
539
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
540
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
541
438
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
542
439
|
* into the request (optional).
|
|
543
440
|
*/
|
|
544
|
-
clearAIIndicator(
|
|
441
|
+
clearAIIndicator(requestOptions?: StreamRequestOptions): Promise<void>;
|
|
545
442
|
/**
|
|
546
443
|
* Sends an event to stop AI response generation, leaving the message in its current state.
|
|
547
444
|
* Triggered by the user to halt the AI response process.
|
|
548
445
|
*
|
|
549
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
550
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
551
446
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
552
447
|
* into the request (optional).
|
|
553
448
|
*/
|
|
554
|
-
stopAIResponse(
|
|
449
|
+
stopAIResponse(requestOptions?: StreamRequestOptions): Promise<void>;
|
|
555
450
|
/**
|
|
556
|
-
*
|
|
451
|
+
* Resets the typing state and sends `typing.stop`.
|
|
557
452
|
*
|
|
558
|
-
* @
|
|
559
|
-
*
|
|
560
|
-
* @param parentId - Set this field to `message.id` to indicate that the typing event is happening in a thread (optional).
|
|
561
|
-
* @param options - Optional override carrying a `user_id` (optional).
|
|
453
|
+
* @param parentId - The parent message ID, for a typing event in a thread (optional).
|
|
562
454
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
563
455
|
* into the request (optional).
|
|
564
456
|
*/
|
|
565
|
-
stopTyping(parentId?: string,
|
|
566
|
-
user_id: string;
|
|
567
|
-
}, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
457
|
+
stopTyping(parentId?: string, requestOptions?: StreamRequestOptions): Promise<void>;
|
|
568
458
|
_isTypingIndicatorsEnabled(): boolean;
|
|
569
459
|
/**
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
*
|
|
460
|
+
* Marks read through `MessageDeliveryReporter`: uses the `markReadRequest` handler if set, marks
|
|
461
|
+
* read locally when read events are off and `localUnreadCountEnabled` is set, and drops the
|
|
462
|
+
* delivery candidate when a request went out. `markRead()` does none of this.
|
|
573
463
|
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
* @param data - Mark read options (optional, defaults to `{}`).
|
|
464
|
+
* @param data - Mark read options. Defaults to `{}`.
|
|
465
|
+
* @returns The server response, or `null` when no request went out.
|
|
577
466
|
*/
|
|
578
467
|
markReadViaReporter(data?: MarkReadRequest): Promise<Partial<StreamResponse<MarkReadResponse>> | null>;
|
|
579
468
|
/**
|
|
580
|
-
*
|
|
581
|
-
* channel to be initialized and respects the `read_events` channel config.
|
|
469
|
+
* Marks the channel read.
|
|
582
470
|
*
|
|
583
471
|
* @param ...args - `[data, requestOptions]`. `data` holds the mark-read options;
|
|
584
472
|
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
585
473
|
* serialized into the request.
|
|
586
|
-
* @returns The server response
|
|
474
|
+
* @returns The server response.
|
|
475
|
+
* @throws If the channel is not initialized or read events are disabled.
|
|
587
476
|
*/
|
|
588
477
|
markRead(...args: Parameters<ChannelApi['markRead']>): Promise<StreamResponse<MarkReadResponse>>;
|
|
589
|
-
/**
|
|
590
|
-
* Whether a live server response was applied to this instance since it was created — see
|
|
591
|
-
* {@link ChannelLifecycleState.initialized}. Store-backed and reactive: subscribe via
|
|
592
|
-
* `useStateStore(channel.state, (s) => ({ initialized: s.initialized }))`.
|
|
593
|
-
*/
|
|
478
|
+
/** See {@link ChannelLifecycleState.initialized}. */
|
|
594
479
|
get initialized(): boolean;
|
|
595
480
|
set initialized(initialized: boolean);
|
|
596
481
|
/**
|
|
597
|
-
* Whether the channel has no
|
|
598
|
-
*
|
|
599
|
-
* the temporary one built from the members. A channel with an id is never provisional, whether or
|
|
600
|
-
* not the server has it: requests for it go to the server, which answers for it.
|
|
482
|
+
* Whether the channel has no ID yet: it was built from members and the server assigns the ID when its
|
|
483
|
+
* query is answered. Until then only that query can be sent and the cid is a temporary one.
|
|
601
484
|
*
|
|
602
|
-
* Not reactive
|
|
603
|
-
*
|
|
485
|
+
* Not reactive: subscribe to {@link Channel.initialized}, which turns `true` with the response that
|
|
486
|
+
* sets `id`.
|
|
604
487
|
*/
|
|
605
488
|
get isProvisional(): boolean;
|
|
606
489
|
/**
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
* A superseded instance receives no events (they go to the stored instance under its cid) and
|
|
611
|
-
* reports `watchStatus: NotWatching`. Use the successor from then on: switch a UI showing this
|
|
612
|
-
* instance to it, as `ChatView` does. `ensureWatched()` resolves with it.
|
|
613
|
-
*
|
|
614
|
-
* The SDK never disconnects a superseded instance on its own before logout, as the app may still
|
|
615
|
-
* hold it. Call {@link Channel.disconnect} on it once nothing uses it.
|
|
490
|
+
* See {@link ChannelLifecycleState.supersededBy}. A superseded instance receives no events and
|
|
491
|
+
* reports `watchStatus: NotWatching`: use its successor (`ensureWatched()` resolves with it). The SDK
|
|
492
|
+
* does not disconnect it before logout, so call {@link Channel.disconnect} once nothing uses it.
|
|
616
493
|
*/
|
|
617
494
|
get supersededBy(): Channel | undefined;
|
|
618
|
-
/**
|
|
619
|
-
* Whether the channel was initialized by manually populating its state (offline hydration) rather
|
|
620
|
-
* than a live watch. Store-backed and reactive.
|
|
621
|
-
*/
|
|
495
|
+
/** See {@link ChannelLifecycleState.offlineMode}. */
|
|
622
496
|
get offlineMode(): boolean;
|
|
623
497
|
set offlineMode(offlineMode: boolean);
|
|
624
498
|
/**
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
* with the store. The assigned object itself is never changed; editing `channel.data.x` in place
|
|
630
|
-
* doesn't reach the state.
|
|
499
|
+
* Reads `state.data`. Assigning publishes `data`, `memberCount` and `ownCapabilities` in one update.
|
|
500
|
+
* If the object omits `member_count` or `own_capabilities`, the last known values are carried onto
|
|
501
|
+
* a copy (the assigned object is not changed). Editing `channel.data.x` in place does not reach
|
|
502
|
+
* the state.
|
|
631
503
|
*/
|
|
632
504
|
get data(): Partial<ChannelResponse> | undefined;
|
|
633
505
|
set data(next: Partial<ChannelResponse> | undefined);
|
|
634
506
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
* One-way and terminal — read-only, set only by {@link Channel.disconnect}, and nothing revives
|
|
639
|
-
* the instance. Its resources are already released ({@link Channel.disconnect} disposes the
|
|
640
|
-
* paginators and unregisters the subscriptions), so nothing should touch it. It stays in the
|
|
641
|
-
* channel store until `client.channelManager.releaseUnusedChannels()` drops it, and until then the
|
|
642
|
-
* SDK treats it as not stored: `client.channelManager.ensure(…)` gives a fresh instance for its
|
|
643
|
-
* cid, lists refuse it, and recovery never re-watches it. The offline DB refuses it as a source of
|
|
644
|
-
* `channel.data`, and `getClient()` throws on it, so a reference held across a `disconnectUser()`
|
|
645
|
-
* fails loudly instead of quietly requesting on a client with no user.
|
|
507
|
+
* See {@link ChannelLifecycleState.pendingDisposal}. Set only by {@link Channel.disconnect} and never
|
|
508
|
+
* reverted: `getClient()` throws, `client.channelManager.ensure()` returns a fresh instance for the
|
|
509
|
+
* cid, and lists and recovery skip it.
|
|
646
510
|
*/
|
|
647
511
|
get pendingDisposal(): boolean;
|
|
648
|
-
/**
|
|
649
|
-
* Whether this client holds a server-side watch on the channel, and if not, whether it should be
|
|
650
|
-
* restored — see {@link ChannelWatchStatus}. Store-backed and reactive: subscribe via
|
|
651
|
-
* `useStateStore(channel.state, (s) => ({ watchStatus: s.watchStatus }))`.
|
|
652
|
-
*/
|
|
512
|
+
/** See {@link ChannelWatchStatus}. */
|
|
653
513
|
get watchStatus(): ChannelWatchStatus;
|
|
654
514
|
set watchStatus(watchStatus: ChannelWatchStatus);
|
|
655
515
|
/**
|
|
656
|
-
* Whether a query for this channel (`watch()`, `query()`, `create()`)
|
|
657
|
-
*
|
|
516
|
+
* Whether a query for this channel (`watch()`, `query()`, `create()`) awaits its response. The
|
|
517
|
+
* channel store keeps the channel meanwhile.
|
|
658
518
|
*
|
|
659
519
|
* @internal
|
|
660
520
|
*/
|
|
661
521
|
get isQueryingChannel(): boolean;
|
|
662
|
-
/**
|
|
663
|
-
* Whether a consumer has declared this channel as the one it is currently consuming (see
|
|
664
|
-
* {@link Channel.activate}). Reactive — subscribe via
|
|
665
|
-
* `useStateStore(channel.state, (s) => ({ active: s.active }))`.
|
|
666
|
-
*/
|
|
522
|
+
/** See {@link Channel.activate}. */
|
|
667
523
|
get active(): boolean;
|
|
668
524
|
/**
|
|
669
|
-
* Declares that a consumer is
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
* nothing.
|
|
673
|
-
*
|
|
674
|
-
* While active, the channel's own state takes precedence over bulk state writes: channel-list
|
|
675
|
-
* hydration does not re-seed its message list (its own `channel.reload()` owns that window).
|
|
525
|
+
* Declares that a consumer is consuming this channel's own state and returns its release function.
|
|
526
|
+
* Refcounted: the channel stays active until the last consumer releases, and releasing twice is a
|
|
527
|
+
* no-op.
|
|
676
528
|
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* may still hold it. It ends at logout, or when the app calls {@link Channel.disconnect}.
|
|
681
|
-
*
|
|
682
|
-
* A disposed channel (`pendingDisposal`) isn't activated: it is not stored, gets no events and
|
|
683
|
-
* recovery skips it. A warning points at `client.channelManager.ensure()` for a live instance, and
|
|
684
|
-
* the returned release does nothing, so the caller's cleanup still runs.
|
|
529
|
+
* While active, channel-list hydration does not re-seed the message list (`channel.reload()` owns
|
|
530
|
+
* it) and the channel stays in the channel store. A disposed channel is not activated: a warning is
|
|
531
|
+
* logged and the returned release does nothing.
|
|
685
532
|
*/
|
|
686
533
|
activate: () => (() => void);
|
|
687
534
|
/**
|
|
688
|
-
* Marks the channel
|
|
535
|
+
* Marks the channel unread from a message.
|
|
689
536
|
*
|
|
690
537
|
* @param ...args - `[data, requestOptions]`. `data` holds the mark-unread options;
|
|
691
538
|
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
692
539
|
* serialized into the request.
|
|
693
|
-
* @returns
|
|
540
|
+
* @returns The server response.
|
|
541
|
+
* @throws If the channel is not initialized or read events are disabled.
|
|
694
542
|
*/
|
|
695
543
|
markUnread(...args: Parameters<ChannelApi['markUnread']>): Promise<StreamResponse<import(".").Response>>;
|
|
696
544
|
/**
|
|
697
|
-
* Resets
|
|
698
|
-
*
|
|
699
|
-
* `
|
|
700
|
-
*
|
|
701
|
-
* delivery-report network sync), so the read-state update lives in one place. When offline support
|
|
702
|
-
* is enabled, the offline DB persists the reset for read-events-disabled channels, so the local
|
|
703
|
-
* count stays consistent across app restarts.
|
|
545
|
+
* Resets the unread count without a backend call, for channels with read events disabled (e.g.
|
|
546
|
+
* livestreams) that set `readEvents.localUnreadCountEnabled`. Dispatches the client-only
|
|
547
|
+
* `message.read_locally` event, handled like `message.read` minus the delivery-report sync. With
|
|
548
|
+
* offline support the reset is persisted.
|
|
704
549
|
*
|
|
705
|
-
* @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected
|
|
550
|
+
* @returns The dispatched `message.read_locally` event, or `undefined` if there is no connected
|
|
551
|
+
* user.
|
|
706
552
|
*/
|
|
707
553
|
markReadLocally(): ({
|
|
708
554
|
type: "message.read_locally";
|
|
@@ -718,65 +564,44 @@ export declare class Channel extends ChannelApi {
|
|
|
718
564
|
received_at?: TimestampNS;
|
|
719
565
|
}) | undefined;
|
|
720
566
|
/**
|
|
721
|
-
*
|
|
567
|
+
* Sends `typing.stop` after a second without a keystroke, drops stale typing users, and resets a
|
|
568
|
+
* stuck AI indicator while the connection is unhealthy. Run by the client's cleaning interval.
|
|
569
|
+
*
|
|
570
|
+
* @internal
|
|
722
571
|
*/
|
|
723
572
|
clean(): void;
|
|
724
573
|
/**
|
|
725
|
-
* Watches the channel unless it is watched already
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
* {@link Channel.watch} and {@link Channel.query} are not affected: they always send their request,
|
|
731
|
-
* and are not joined by this method. A channel already watched sends nothing, so `options` such as
|
|
732
|
-
* a message window apply only when the call watches it; use the message paginator to load a window.
|
|
574
|
+
* Watches the channel unless it is watched already. A call made while an earlier `ensureWatched()`
|
|
575
|
+
* with the same options is in flight waits for that request instead of sending another. `watch()` and
|
|
576
|
+
* `query()` always send theirs. An already watched channel sends nothing, so `options` (such as a
|
|
577
|
+
* message window) apply only when the call watches it.
|
|
733
578
|
*
|
|
734
|
-
*
|
|
735
|
-
* ({@link Channel.supersededBy}). A channel created from members is superseded when its watch
|
|
736
|
-
* answers with a cid another instance is already stored under; that instance is the one stored,
|
|
737
|
-
* listed and receiving events, so it is the one this ensures watched and resolves with.
|
|
738
|
-
*
|
|
739
|
-
* Rejects as the watch does, and every caller waiting for that watch gets its rejection. The next
|
|
740
|
-
* call sends a new request.
|
|
579
|
+
* Rejects as the watch does, for every caller waiting on it. The next call sends a new request.
|
|
741
580
|
*
|
|
742
581
|
* @param options - Options for the watch request (optional). Calls join only a watch with the same
|
|
743
582
|
* options.
|
|
744
|
-
* @returns The instance to use,
|
|
745
|
-
*
|
|
583
|
+
* @returns The instance to use: this one, or the one that superseded it
|
|
584
|
+
* ({@link Channel.supersededBy}).
|
|
746
585
|
*/
|
|
747
586
|
ensureWatched(options?: ChannelGetOrCreateRequest): Promise<Channel>;
|
|
748
|
-
/** This instance, or its successor if the watch just superseded it (see `ensureWatched`). */
|
|
749
587
|
private afterEnsuredWatch;
|
|
750
588
|
/**
|
|
751
|
-
* Loads the initial
|
|
589
|
+
* Loads the initial state and watches for changes. The latest message page is loaded when this
|
|
590
|
+
* resolves.
|
|
752
591
|
*
|
|
753
592
|
* @param options - Additional options for the query endpoint (optional).
|
|
754
593
|
* @param requestOptions - Per-request options such as an abort `signal` (optional). The signal
|
|
755
|
-
*
|
|
756
|
-
* wait with it.
|
|
594
|
+
* also ends the wait for a live socket.
|
|
757
595
|
* @returns The server response.
|
|
758
596
|
*/
|
|
759
597
|
watch(options?: ChannelGetOrCreateRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ChannelStateResponse>>;
|
|
760
598
|
/**
|
|
761
|
-
* Re-
|
|
762
|
-
* {@link Thread.reload}. Used on reconnect
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* (`items.length`, so the whole loaded window is refreshed — not the smaller channel-list page). The
|
|
768
|
-
* actual fold + destructive reconciliation happens inside `query()` → `seedFirstPageSync`
|
|
769
|
-
* (the same path the channel-list re-hydrate and connection recovery use), driven by the loaded-id
|
|
770
|
-
* snapshot `query()` captures before its await. Owning that single path is what lets the SDK stop
|
|
771
|
-
* passing the reconciliation window/snapshot itself.
|
|
772
|
-
*
|
|
773
|
-
* Preserves failed (unsent) messages: an overlap merge keeps them (the reconcile's provenance guard
|
|
774
|
-
* never prunes a non-server message); only a disjoint rebuild can drop them, so any that actually
|
|
775
|
-
* fell out are re-ingested below. The offline DB is consulted alongside the in-memory window, because
|
|
776
|
-
* a failed message can be absent from memory and still be the user's unsent work — a cold boot starts
|
|
777
|
-
* with an empty paginator, and an eviction can drop it mid-session. v9 got this from a second, lagging
|
|
778
|
-
* copy of the list (the React SDK's own state); with one reactive source of truth the persisted row is
|
|
779
|
-
* that buffer.
|
|
599
|
+
* Re-watches the channel and refreshes its whole loaded message window (the channel analog of
|
|
600
|
+
* {@link Thread.reload}). Used on reconnect. Hard deletes reach other clients through no event, so
|
|
601
|
+
* `query()` (`seedFirstPageSync`) reconciles them by diffing the re-queried page.
|
|
602
|
+
*
|
|
603
|
+
* Failed (unsent) messages are kept: any that fell out of the window are re-ingested. The offline DB
|
|
604
|
+
* is read too, since a failed message can be absent from memory (cold boot, eviction).
|
|
780
605
|
*/
|
|
781
606
|
reload(): Promise<void>;
|
|
782
607
|
/**
|
|
@@ -789,16 +614,16 @@ export declare class Channel extends ChannelApi {
|
|
|
789
614
|
*/
|
|
790
615
|
stopWatching(...args: Parameters<ChannelApi['stopWatching']>): Promise<StreamResponse<import(".").Response>>;
|
|
791
616
|
/**
|
|
792
|
-
* Retrieves
|
|
617
|
+
* Retrieves messages of this channel by ID.
|
|
793
618
|
*
|
|
794
|
-
* @param messageIds - The IDs of the messages to retrieve
|
|
619
|
+
* @param messageIds - The IDs of the messages to retrieve.
|
|
795
620
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
796
621
|
* into the request (optional).
|
|
797
|
-
* @returns
|
|
622
|
+
* @returns The server response.
|
|
798
623
|
*/
|
|
799
624
|
getMessagesById(messageIds: string[], requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").GetManyMessagesResponse>>;
|
|
800
625
|
/**
|
|
801
|
-
* Returns
|
|
626
|
+
* Returns when the current user last marked the channel read.
|
|
802
627
|
*
|
|
803
628
|
* @returns The last-read timestamp in unix nanoseconds, `null` if never read, or `undefined` if
|
|
804
629
|
* the user is unset.
|
|
@@ -806,51 +631,47 @@ export declare class Channel extends ChannelApi {
|
|
|
806
631
|
lastRead(): TimestampNS | null | undefined;
|
|
807
632
|
_countMessageAsUnread(message: LocalMessage | MessageResponse): boolean;
|
|
808
633
|
/**
|
|
809
|
-
*
|
|
634
|
+
* Counts the unread messages.
|
|
810
635
|
*
|
|
811
|
-
* @param lastRead - The time
|
|
812
|
-
*
|
|
813
|
-
* @returns
|
|
636
|
+
* @param lastRead - The time the user read a message, in unix nanoseconds (optional). Defaults to
|
|
637
|
+
* the current user's read state.
|
|
638
|
+
* @returns The unread count.
|
|
814
639
|
*/
|
|
815
640
|
countUnread(lastRead?: TimestampNS | null): number;
|
|
816
641
|
/**
|
|
817
|
-
*
|
|
642
|
+
* Counts the unread messages that mention the current user.
|
|
818
643
|
*
|
|
819
|
-
* @returns
|
|
644
|
+
* @returns The unread mentions count.
|
|
820
645
|
*/
|
|
821
646
|
countUnreadMentions(): number;
|
|
822
647
|
/**
|
|
823
|
-
* Creates
|
|
648
|
+
* Creates the channel without watching it.
|
|
824
649
|
*
|
|
825
650
|
* @param options - Channel query options (optional).
|
|
826
651
|
* @returns The server response.
|
|
827
652
|
*/
|
|
828
653
|
create: (options?: ChannelGetOrCreateRequest) => Promise<StreamResponse<import(".").ChannelStateResponse>>;
|
|
829
654
|
/**
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
* another instance already holds that cid (stored by an event or a list while this one was in
|
|
834
|
-
* flight), that instance stays the one stored, since something may be using it, and takes over
|
|
835
|
-
* from this one ({@link ChannelManager.supersedeChannel}), which also drops this one's entry.
|
|
655
|
+
* Moves this channel, created without an ID, from its temporary cid to the one the server gave it.
|
|
656
|
+
* If another instance already holds that cid, it stays stored and takes over from this one
|
|
657
|
+
* ({@link ChannelManager.supersedeChannel}).
|
|
836
658
|
*/
|
|
837
659
|
private storeUnderServerCid;
|
|
838
660
|
/**
|
|
839
|
-
* Queries the API
|
|
661
|
+
* Queries the API for messages, members and other channel fields.
|
|
840
662
|
*
|
|
841
|
-
* @param options - The query options
|
|
842
|
-
* @param messageSetToAddToIfDoesNotExist -
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
* used for loading a specific message and its surroundings (optional, defaults to `'current'`).
|
|
663
|
+
* @param options - The query options. Defaults to `{}`.
|
|
664
|
+
* @param messageSetToAddToIfDoesNotExist - `'latest'` is what the open paths (`watch`,
|
|
665
|
+
* `create`) pass: it seeds the message paginator with the fetched page. Other values do not
|
|
666
|
+
* seed it. Defaults to `'current'`.
|
|
846
667
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
847
668
|
* into the request (optional).
|
|
848
|
-
* @returns
|
|
669
|
+
* @returns The query response.
|
|
849
670
|
*/
|
|
850
671
|
query(options?: ChannelGetOrCreateRequest, messageSetToAddToIfDoesNotExist?: MessageSetType, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ChannelStateResponse>>;
|
|
851
672
|
private runQuery;
|
|
852
673
|
/**
|
|
853
|
-
* Bans a user from
|
|
674
|
+
* Bans a user from this channel.
|
|
854
675
|
*
|
|
855
676
|
* @param targetUserId - The user to ban.
|
|
856
677
|
* @param options - Ban options.
|
|
@@ -859,7 +680,6 @@ export declare class Channel extends ChannelApi {
|
|
|
859
680
|
banUser(targetUserId: string, options: Omit<BanUserOptions, 'channel_cid'>): Promise<StreamResponse<import(".").ModerationBanResponse>>;
|
|
860
681
|
/**
|
|
861
682
|
* Hides the channel from `queryChannels` for the user until a message is added.
|
|
862
|
-
* If `clear_history` is set to `true`, all messages will be removed for the user.
|
|
863
683
|
*
|
|
864
684
|
* @param ...args - `[request, requestOptions]`. Pass `request: { clear_history: true }` to clear
|
|
865
685
|
* message history for the user; `requestOptions` carries per-request options such as an abort
|
|
@@ -868,7 +688,7 @@ export declare class Channel extends ChannelApi {
|
|
|
868
688
|
*/
|
|
869
689
|
hide(...args: Parameters<ChannelApi['hide']>): Promise<StreamResponse<import(".").HideChannelResponse>>;
|
|
870
690
|
/**
|
|
871
|
-
* Removes the hidden status
|
|
691
|
+
* Removes the hidden status of the channel.
|
|
872
692
|
*
|
|
873
693
|
* @param ...args - `[request, requestOptions]`. `request` is the show-channel payload;
|
|
874
694
|
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
@@ -877,7 +697,7 @@ export declare class Channel extends ChannelApi {
|
|
|
877
697
|
*/
|
|
878
698
|
show(...args: Parameters<ChannelApi['show']>): Promise<StreamResponse<import(".").ShowChannelResponse>>;
|
|
879
699
|
/**
|
|
880
|
-
* Removes the bans
|
|
700
|
+
* Removes the bans of a user on this channel.
|
|
881
701
|
*
|
|
882
702
|
* @param targetUserId - The user to unban.
|
|
883
703
|
* @param options - Unban options (optional).
|
|
@@ -885,34 +705,27 @@ export declare class Channel extends ChannelApi {
|
|
|
885
705
|
*/
|
|
886
706
|
unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<import("./types").APIResponse>;
|
|
887
707
|
/**
|
|
888
|
-
* Casts
|
|
708
|
+
* Casts a vote on a poll. `removeVote()` removes one.
|
|
889
709
|
*
|
|
890
710
|
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams` holds the target
|
|
891
|
-
* `message_id` and `poll_id`; `request` holds the vote to cast
|
|
892
|
-
*
|
|
893
|
-
* serialized into the request.
|
|
711
|
+
* `message_id` and `poll_id`; `request` holds the vote to cast; `requestOptions` carries
|
|
712
|
+
* per-request options such as an abort `signal` and is never serialized into the request.
|
|
894
713
|
* @returns The poll vote response.
|
|
895
714
|
*/
|
|
896
715
|
vote(...args: Parameters<ChatApi['castPollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
|
|
897
716
|
removeVote(...args: Parameters<ChatApi['deletePollVote']>): Promise<StreamResponse<import(".").PollVoteResponse>>;
|
|
898
717
|
_createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<StreamResponse<import(".").CreateDraftResponse>>;
|
|
899
|
-
/**
|
|
900
|
-
* Creates or updates a draft message in a channel. If offline support is enabled, the
|
|
901
|
-
* call is queued so it is replayed on reconnect.
|
|
902
|
-
*/
|
|
718
|
+
/** Creates or updates a draft. With offline support the call is queued and replayed on reconnect. */
|
|
903
719
|
createDraft(...args: Parameters<ChannelApi['createDraft']>): Promise<import(".").CreateDraftResponse & {
|
|
904
720
|
metadata: import("./types").RequestMetadata;
|
|
905
721
|
}>;
|
|
906
722
|
_deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<StreamResponse<import(".").Response>>;
|
|
907
|
-
/**
|
|
908
|
-
* Deletes a draft message from a channel or a thread. If offline support is enabled, the
|
|
909
|
-
* call is queued so it is replayed on reconnect.
|
|
910
|
-
*/
|
|
723
|
+
/** Deletes a draft. With offline support the call is queued and replayed on reconnect. */
|
|
911
724
|
deleteDraft(...args: Parameters<ChannelApi['deleteDraft']>): Promise<import(".").Response & {
|
|
912
725
|
metadata: import("./types").RequestMetadata;
|
|
913
726
|
}>;
|
|
914
727
|
/**
|
|
915
|
-
* Listens to events on this channel.
|
|
728
|
+
* Listens to events on this channel. A callback alone listens to all events.
|
|
916
729
|
*
|
|
917
730
|
* @example
|
|
918
731
|
* channel.on('message.new', (event) => {
|
|
@@ -924,79 +737,71 @@ export declare class Channel extends ChannelApi {
|
|
|
924
737
|
* console.log(event.type);
|
|
925
738
|
* });
|
|
926
739
|
*
|
|
927
|
-
* @param
|
|
928
|
-
* @param
|
|
740
|
+
* @param eventType - The event type to listen for.
|
|
741
|
+
* @param callback - Called with each event of that type.
|
|
929
742
|
* @returns An object with an `unsubscribe()` method.
|
|
930
743
|
*/
|
|
931
|
-
on<T extends EventType
|
|
744
|
+
on<T extends EventType>(eventType: T, callback: EventHandler<T>): {
|
|
932
745
|
unsubscribe: () => void;
|
|
933
746
|
};
|
|
747
|
+
/**
|
|
748
|
+
* Listens to all events on this channel.
|
|
749
|
+
*
|
|
750
|
+
* @param callback - Called with every event.
|
|
751
|
+
* @returns An object with an `unsubscribe()` method.
|
|
752
|
+
*/
|
|
934
753
|
on(callback: EventHandler): {
|
|
935
754
|
unsubscribe: () => void;
|
|
936
755
|
};
|
|
937
756
|
/**
|
|
938
|
-
* Removes
|
|
757
|
+
* Removes a listener for one event type.
|
|
758
|
+
*
|
|
759
|
+
* @param eventType - The event type it listens to.
|
|
760
|
+
* @param callback - The listener to remove.
|
|
761
|
+
*/
|
|
762
|
+
off<T extends EventType>(eventType: T, callback: EventHandler<T>): void;
|
|
763
|
+
/**
|
|
764
|
+
* Removes a listener for all events.
|
|
939
765
|
*
|
|
940
|
-
* @param
|
|
941
|
-
* @param callbackOrNothing - The callback to remove when an event type was provided (optional).
|
|
766
|
+
* @param callback - The listener to remove.
|
|
942
767
|
*/
|
|
943
|
-
off<T extends EventType | string>(eventType: T, callback: EventHandler): void;
|
|
944
768
|
off(callback: EventHandler): void;
|
|
945
769
|
private _patchReadState;
|
|
946
770
|
private _upsertReadState;
|
|
947
771
|
/**
|
|
948
|
-
* Sets the current user's unread count
|
|
949
|
-
* `
|
|
950
|
-
* `state.unreadCount` derives from — so channel-wide resets (`channel.truncated`, "all channels
|
|
951
|
-
* read") must route through here rather than writing a count of their own.
|
|
772
|
+
* Sets the current user's unread count in `read[userId].unread_messages`, the one place it lives
|
|
773
|
+
* (`state.unreadCount` derives from it). Returns whether the count changed.
|
|
952
774
|
*/
|
|
953
|
-
/** @returns whether the count actually changed, so callers can react only to the channels it did. */
|
|
954
775
|
_setOwnUnreadCount(unreadCount: number): boolean;
|
|
955
776
|
_handleChannelEvent(event: Event): void;
|
|
956
777
|
_callChannelListeners: (event: WSEvent) => void;
|
|
957
778
|
/**
|
|
958
|
-
*
|
|
959
|
-
*
|
|
960
|
-
*
|
|
961
|
-
* Note: only id is optional, cid is defined as string, so TS won't complain about a missing check there.
|
|
779
|
+
* Throws if the channel has no ID (created from members only). Narrows `id` to `string`. Call it
|
|
780
|
+
* before any request that uses `this.cid`: it is a string (possibly temporary) even without an ID,
|
|
781
|
+
* so TypeScript does not flag a missing check.
|
|
962
782
|
*/
|
|
963
783
|
_checkHasId(): asserts this is this & {
|
|
964
784
|
id: string;
|
|
965
785
|
};
|
|
966
|
-
/**
|
|
967
|
-
* Checks if channel has been queried/initialized. Call this when a method relies on data only available after channel is queried from API.
|
|
968
|
-
*/
|
|
786
|
+
/** Throws unless the channel was queried or populated from the offline DB. */
|
|
969
787
|
_checkInitialized(): void;
|
|
970
788
|
_initializeState(state: ChannelStateResponseFields): void;
|
|
971
789
|
_extendEventWithOwnReactions(event: EventPayload<'message.undeleted' | 'message.updated' | 'message.deleted'>): void;
|
|
972
790
|
_hydrateMembers({ members, overrideCurrentState, }: {
|
|
973
791
|
members: ChannelMemberResponse[];
|
|
974
|
-
/**
|
|
975
|
-
* If set to `true` then `ChannelState.members` will be overriden with the newly
|
|
976
|
-
* provided `members`, setting this property to `false` will merge current `ChannelState.members`
|
|
977
|
-
* object with the newly provided `members`
|
|
978
|
-
* (new members with the same `userId` will replace the old ones).
|
|
979
|
-
*/
|
|
792
|
+
/** `true` replaces `state.members`. `false` merges (a new member replaces one with the same ID). */
|
|
980
793
|
overrideCurrentState?: boolean;
|
|
981
794
|
}): void;
|
|
982
795
|
/**
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
*
|
|
986
|
-
*
|
|
987
|
-
* server keeps a watch this connection held until the connection ends. Calling it again does
|
|
988
|
-
* nothing, and nothing revives the instance.
|
|
989
|
-
*
|
|
990
|
-
* The SDK calls it when a channel ends: deleted, the current user removed from it, the user
|
|
991
|
-
* logged out, or released as unused. Call it yourself to finish an instance you are done with.
|
|
992
|
-
*
|
|
993
|
-
* It doesn't remove the channel from the channel store, as parts of the app may still use the
|
|
994
|
-
* instance: a stored instance stays there, and in the lists showing it, finished, until the next
|
|
995
|
-
* `client.channelManager.releaseUnusedChannels()` removes it (or an end the SDK handles: deleted,
|
|
996
|
-
* removed from it, logout). Meanwhile `client.channelManager.ensure(…)` gives a fresh instance
|
|
997
|
-
* for its cid.
|
|
796
|
+
* Ends the instance for good: unsubscribes from the configuration and the server config, stops the
|
|
797
|
+
* receipts tracker and the cooldown timer, disposes both paginators, then sets
|
|
798
|
+
* `pendingDisposal: true` and `watchStatus: NotWatching`. It sends no request, so the server keeps a
|
|
799
|
+
* watch this connection held until the connection ends. Calling it again does nothing.
|
|
998
800
|
*
|
|
999
|
-
*
|
|
801
|
+
* The SDK calls it when a channel ends (deleted, current user removed, logout, released as unused).
|
|
802
|
+
* It does not remove the channel from the channel store. The SDK's own ends remove it; after a
|
|
803
|
+
* direct call it stays until `client.channelManager.releaseUnusedChannels()`, or until `ensure()`
|
|
804
|
+
* for the same cid replaces it.
|
|
1000
805
|
*/
|
|
1001
806
|
disconnect(): void;
|
|
1002
807
|
}
|