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/client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ClientState } from './client_state';
|
|
|
5
5
|
import { UploadManager } from './uploadManager';
|
|
6
6
|
import { TokenManager, type TokenManagerMinimalUser } from './token_manager';
|
|
7
7
|
import { ApiClient } from './api-client';
|
|
8
|
-
import type { APIResponse, AppIdentifier, ChannelInput, ChannelMute, ChannelOptions, ChannelResponse, ChannelStateOptions, ChannelStateResponseFields, Configs, ConnectAPIResponse, DeviceIdentifier, Event, EventHandler, EventType, FileUploadInput, GetThreadOptions, LocalMessage, OwnUserResponse, PartializeAllBut, QueryChannelsRequest, QueryChannelsResponse, QueryThreadsRequest, SdkIdentifier,
|
|
8
|
+
import type { APIResponse, AppIdentifier, ChannelInput, ChannelMute, ChannelOptions, ChannelResponse, ChannelStateOptions, ChannelStateResponseFields, Configs, ConnectAPIResponse, DeviceIdentifier, Event, EventHandler, EventType, FileUploadInput, GetThreadOptions, LocalMessage, OwnUserResponse, PartializeAllBut, PinMessageOptions, QueryChannelsRequest, QueryChannelsResponse, QueryThreadsRequest, SdkIdentifier, StreamRequestOptions, TokenOrProvider, UnBanUserOptions, UserMuteResponse, UserRequest, UserResponse } from './types';
|
|
9
9
|
import { Thread } from './thread';
|
|
10
10
|
import { Moderation } from './moderation';
|
|
11
11
|
import { ThreadManager } from './thread_manager';
|
|
@@ -19,7 +19,8 @@ import { ReminderManager } from './reminders';
|
|
|
19
19
|
import type { AbstractOfflineDB } from './offline-support';
|
|
20
20
|
import { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
|
|
21
21
|
import type { MessageComposer } from './messageComposer';
|
|
22
|
-
import type { InstanceSetupState } from './configuration';
|
|
22
|
+
import type { InstanceConfigTree, InstanceSetupState } from './configuration';
|
|
23
|
+
import type { DeepPartial } from './types.utility';
|
|
23
24
|
import { InstanceConfigurationRegistry } from './configuration/InstanceConfigurationRegistry';
|
|
24
25
|
import { StateStore } from '@stream-io/state-store';
|
|
25
26
|
import type { FileUploadRequest, GetApplicationResponse as Gen_GetApplicationResponse, MarkDeliveredRequest as Gen_MarkDeliveredRequest, ImageUploadRequest, WSAuthMessage, WSEvent } from './gen/models';
|
|
@@ -37,92 +38,60 @@ export type ChannelConfigsState = {
|
|
|
37
38
|
export type ClientUser = PartializeAllBut<OwnUserResponse, 'id'> & {
|
|
38
39
|
anon?: boolean;
|
|
39
40
|
};
|
|
40
|
-
/**
|
|
41
|
-
* `T`, unless it is a server-sent {@link TimestampNS}: for parameters where a bare `number` means a
|
|
42
|
-
* relative offset rather than an instant. `any` passes through (`0 extends 1 & T`), so untyped
|
|
43
|
-
* callers are not suddenly rejected.
|
|
44
|
-
*/
|
|
45
|
-
type NotATimestampNS<T> = 0 extends 1 & T ? T : T extends TimestampNS ? never : T;
|
|
46
41
|
export declare class StreamChat extends ChatApi {
|
|
47
42
|
private static _instance?;
|
|
48
43
|
messageDeliveryReporter: MessageDeliveryReporter;
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
44
|
+
/** @internal */
|
|
52
45
|
uploadManager: UploadManager;
|
|
53
|
-
/**
|
|
54
|
-
* @private
|
|
55
|
-
*/
|
|
46
|
+
/** @private */
|
|
56
47
|
_user?: ClientUser;
|
|
57
48
|
appSettingsPromise?: Promise<StreamResponse<Gen_GetApplicationResponse>>;
|
|
58
49
|
threads: ThreadManager;
|
|
59
50
|
polls: PollManager;
|
|
60
51
|
/**
|
|
61
|
-
* Channel lists
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* It is deliberately not configurable through the client options — everything is set on the
|
|
68
|
-
* manager itself (`setOwnershipResolver`, `addEventHandler` / `setEventHandlers` /
|
|
69
|
-
* `removeEventHandlers`), which is also the only way to reconfigure it later.
|
|
52
|
+
* Channel lists (`ChannelPaginator`s kept in sync with WS events, with ownership arbitration
|
|
53
|
+
* between them). Register lists with `insertPaginator()` / `removePaginator()`. It handles events
|
|
54
|
+
* only once something calls its ref-counted `registerSubscriptions()`. It is configured on the
|
|
55
|
+
* manager itself (`setOwnershipResolver`, `addEventHandler`, ...), not through the client
|
|
56
|
+
* options.
|
|
70
57
|
*/
|
|
71
58
|
channelManager: ChannelManager;
|
|
72
59
|
/**
|
|
73
|
-
*
|
|
74
|
-
* and
|
|
75
|
-
* client
|
|
76
|
-
*
|
|
77
|
-
* Turn it off through the declarative configuration if the application recovers state itself:
|
|
78
|
-
* `client.config.set({ client: { connectionRecovery: { enabled: false } } })`.
|
|
60
|
+
* On reconnect, re-runs each loaded channel list's first-page query and reloads each active
|
|
61
|
+
* channel and thread, then dispatches `connection.recovered`. Disable it when the app recovers
|
|
62
|
+
* state itself: `client.config.set({ client: { connectionRecovery: { enabled: false } } })`.
|
|
79
63
|
*/
|
|
80
64
|
connectionRecovery: ConnectionRecoveryManager;
|
|
81
65
|
/**
|
|
82
|
-
* The device's
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* The SDK cannot detect this itself — every platform reports it differently — so it has to be told:
|
|
88
|
-
* `client.config.set({ client: { networkConnection: { statusReporter } } })`, or
|
|
89
|
-
* `client.networkConnection.setStatusReporter(…)` afterwards.
|
|
90
|
-
*
|
|
91
|
-
* A browser answers the question properly and its reporter is installed automatically. Everywhere
|
|
92
|
-
* else a stand-in mirrors the WebSocket until a real one arrives, which is coarse but better than
|
|
93
|
-
* nothing at all on an integration that forgot the line of setup. Either way `isOnline` is
|
|
94
|
-
* `undefined` — *unknown*, not offline — until something has reported.
|
|
66
|
+
* The device's network status, separate from the WebSocket's ({@link wsConnection}). Platforms
|
|
67
|
+
* report it through `client.config.set({ client: { networkConnection: { statusReporter } } })` or
|
|
68
|
+
* `client.networkConnection.setStatusReporter(...)`. Browsers get a reporter automatically;
|
|
69
|
+
* elsewhere a stand-in mirrors the WebSocket. `isOnline` is `undefined` (unknown, not offline)
|
|
70
|
+
* until something reports.
|
|
95
71
|
*/
|
|
96
72
|
networkConnection: NetworkConnectionObserver;
|
|
97
73
|
/**
|
|
98
|
-
* The connection
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* The server keys channel watches and presence subscriptions by it, so a request carrying either
|
|
102
|
-
* waits here for the handshake rather than racing it. See `requiresConnectionId` in
|
|
103
|
-
* `api-client.ts`.
|
|
74
|
+
* The connection ID (the WebSocket's, or the long-poll's after an `enableWSFallback` switch). A
|
|
75
|
+
* request with `watch` or `presence` waits here for the handshake (see `requiresConnectionId`).
|
|
104
76
|
*/
|
|
105
77
|
connectionIdManager: ConnectionIdManager;
|
|
106
78
|
/**
|
|
107
|
-
* Client-global
|
|
108
|
-
*
|
|
109
|
-
* more than one of them stays consistent without copy-to-copy fan-out.
|
|
79
|
+
* Client-global store with one canonical copy of each message. The channel and thread paginators
|
|
80
|
+
* read and write messages through it, so a message held in several of them stays consistent.
|
|
110
81
|
*/
|
|
111
82
|
messageStore: EntityStore<LocalMessage>;
|
|
112
83
|
offlineDb?: AbstractOfflineDB;
|
|
113
84
|
notifications: NotificationManager;
|
|
114
85
|
reminders: ReminderManager;
|
|
115
|
-
persistUserOnConnectionFailure?: boolean;
|
|
116
86
|
axiosInstance: AxiosInstance;
|
|
117
87
|
baseURL?: string;
|
|
118
|
-
browser: boolean;
|
|
119
88
|
cleaningIntervalRef?: ReturnType<typeof setTimeout>;
|
|
120
89
|
clientId?: string;
|
|
121
90
|
key: string;
|
|
122
91
|
listeners: Map<EventType, Set<EventHandler>>;
|
|
123
92
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
93
|
+
* When true, threads are not cleaned up while the channel state is initializing (for SDKs that
|
|
94
|
+
* recover channel state themselves).
|
|
126
95
|
*/
|
|
127
96
|
preventThreadCleanup: boolean;
|
|
128
97
|
moderation: Moderation;
|
|
@@ -131,19 +100,13 @@ export declare class StreamChat extends ChatApi {
|
|
|
131
100
|
mutedUsers: UserMuteResponse[];
|
|
132
101
|
}>;
|
|
133
102
|
/**
|
|
134
|
-
* Reactive store behind {@link channelServerConfigs}
|
|
135
|
-
*
|
|
136
|
-
* resolver is the intended replacement.
|
|
137
|
-
*
|
|
138
|
-
* Named for what it holds plus a `Store` suffix for what it is, matching {@link mutedUsersStore}. These
|
|
139
|
-
* are the backend's configs, not the ones you register through {@link config}.
|
|
103
|
+
* Reactive store behind {@link channelServerConfigs}: the backend's channel configs, not the ones
|
|
104
|
+
* registered through {@link config}.
|
|
140
105
|
*
|
|
141
106
|
* @internal
|
|
142
107
|
*/
|
|
143
108
|
readonly channelServerConfigsStore: StateStore<ChannelConfigsState>;
|
|
144
109
|
blockedUsers: StateStore<BlockedUsersState>;
|
|
145
|
-
node: boolean;
|
|
146
|
-
options: StreamChatOptions;
|
|
147
110
|
setUserPromise: ConnectAPIResponse | null;
|
|
148
111
|
state: ClientState;
|
|
149
112
|
tokenManager: TokenManager;
|
|
@@ -156,15 +119,17 @@ export declare class StreamChat extends ChatApi {
|
|
|
156
119
|
private _wsConnectId;
|
|
157
120
|
private _resolveWsPromise?;
|
|
158
121
|
private _rejectWsPromise?;
|
|
159
|
-
get anonymous(): boolean;
|
|
160
|
-
get userId(): string | undefined;
|
|
161
122
|
/**
|
|
162
|
-
*
|
|
123
|
+
* Whether the client runs in a browser: the `client.browser` option, else whether `window`
|
|
124
|
+
* exists.
|
|
163
125
|
*/
|
|
126
|
+
get browser(): boolean;
|
|
127
|
+
get node(): boolean;
|
|
128
|
+
get anonymous(): boolean;
|
|
129
|
+
get userId(): string | undefined;
|
|
130
|
+
/** @deprecated Use `userId` instead. */
|
|
164
131
|
get userID(): string | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated Use `clientId` instead.
|
|
167
|
-
*/
|
|
132
|
+
/** @deprecated Use `clientId` instead. */
|
|
168
133
|
get clientID(): string | undefined;
|
|
169
134
|
set clientID(id: string | undefined);
|
|
170
135
|
get api(): ApiClient;
|
|
@@ -174,11 +139,8 @@ export declare class StreamChat extends ChatApi {
|
|
|
174
139
|
private cachedUserAgent?;
|
|
175
140
|
readonly messageComposerCache: FixedSizeQueueCache<string, MessageComposer>;
|
|
176
141
|
/**
|
|
177
|
-
* Configuration
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* Not to be confused with {@link channelServerConfigs}, which holds the **server-provided channel
|
|
181
|
-
* configs** keyed by cid. This one is yours; that one is the backend's.
|
|
142
|
+
* Configuration registered for the instances the SDK creates (channels, threads, composers, the
|
|
143
|
+
* client's own managers). Not the server-provided channel configs ({@link channelServerConfigs}).
|
|
182
144
|
*/
|
|
183
145
|
readonly config: InstanceConfigurationRegistry;
|
|
184
146
|
/** Teardown for the `'client'` setup function, released by {@link disconnectUser}. */
|
|
@@ -186,63 +148,38 @@ export declare class StreamChat extends ChatApi {
|
|
|
186
148
|
/**
|
|
187
149
|
* Initializes a client.
|
|
188
150
|
*
|
|
189
|
-
* **
|
|
151
|
+
* **Prefer `StreamChat.getInstance()`: a second client opens a second WebSocket connection.**
|
|
190
152
|
*
|
|
191
153
|
* @example <caption>initialize the client in user mode</caption>
|
|
192
154
|
* new StreamChat('api_key')
|
|
193
|
-
* @example <caption>initialize the client with
|
|
194
|
-
* new StreamChat('api_key', { axiosRequestConfig: { timeout: 5000 } })
|
|
155
|
+
* @example <caption>initialize the client with configuration</caption>
|
|
156
|
+
* new StreamChat('api_key', { client: { axiosRequestConfig: { timeout: 5000 } } })
|
|
195
157
|
*
|
|
196
158
|
* @param key - The API key.
|
|
197
|
-
* @param
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* `headers` or `httpsAgent`, spread into the client's axios instance (optional).
|
|
159
|
+
* @param config - Declarative configuration, the tree `client.config.set()` takes (optional).
|
|
160
|
+
* Applied before anything is built, so it reaches the managers and the options read once at
|
|
161
|
+
* construction (`client.baseURL`, `client.axiosRequestConfig`, `client.notificationManager`).
|
|
201
162
|
*/
|
|
202
|
-
constructor(key: string,
|
|
163
|
+
constructor(key: string, config?: DeepPartial<InstanceConfigTree>);
|
|
203
164
|
/**
|
|
204
|
-
* Subscribes the client's managers to the `'client'` configuration key.
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* subscription to run the setup function's teardown. A client is reusable — `getInstance` hands the same
|
|
208
|
-
* object back, and disconnect/connect is the documented multi-user and mobile-background flow — and the
|
|
209
|
-
* managers this key configures (`reminders`, `threads`, `messageDeliveryReporter`, `notifications`)
|
|
210
|
-
* outlive the user. Without the re-arm the key went permanently dead on the second connect: `setConfig`,
|
|
211
|
-
* `setSetupFunction` and `reset` all stopped reaching any manager, silently.
|
|
212
|
-
*
|
|
213
|
-
* Idempotent through the `unsubscribeClientConfiguration` guard, so the constructor's wiring is not
|
|
214
|
-
* duplicated by the first `connectUser`.
|
|
165
|
+
* Subscribes the client's managers to the `'client'` configuration key. Called by the constructor
|
|
166
|
+
* and by {@link _setUser}, because {@link disconnectUser} releases the subscription (to run the
|
|
167
|
+
* setup function's teardown) while the managers outlive the user. Idempotent.
|
|
215
168
|
*/
|
|
216
169
|
private wireClientConfiguration;
|
|
217
170
|
/**
|
|
218
|
-
* Derives each manager's configuration from package defaults plus the `client`
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* Defaults are spread first, and every manager is written unconditionally, because this is a
|
|
222
|
-
* derivation* rather than a patch — the same rule `Channel.initializeConfig` follows. Guarding on
|
|
223
|
-
* `if (config?.reminders)` and merging made `reset()` a no-op for this key: the store is cleared
|
|
224
|
-
* before instances re-derive, so the guards all failed and the registered values stayed in force.
|
|
225
|
-
* It also meant a field *removed* from the tree lingered, which is exactly what a merge cannot express.
|
|
171
|
+
* Derives each manager's configuration from the package defaults plus the `client` subtree. Every
|
|
172
|
+
* manager is written unconditionally: it is a derivation, not a merge, so `config.reset()` and
|
|
173
|
+
* removed fields take effect.
|
|
226
174
|
*/
|
|
227
175
|
private initializeManagerConfig;
|
|
228
176
|
get mutedUsers(): UserMuteResponse[];
|
|
229
177
|
set mutedUsers(mutedUsers: UserMuteResponse[]);
|
|
230
178
|
/**
|
|
231
|
-
* Cache of server-provided channel configuration, keyed by
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* Read it through {@link Channel.serverConfig} rather than here. Not to be confused with
|
|
236
|
-
* {@link config}, which is the configuration *you* register for SDK-created instances.
|
|
237
|
-
*
|
|
238
|
-
* This is `client.configs` from v9 under a name that says whose configuration it is — the key space is
|
|
239
|
-
* unchanged, so a v9 `client.configs[cid]` lookup translates directly. There is deliberately no
|
|
240
|
-
* `configs` alias: it read as a sibling of the integrator-facing {@link config} while holding the
|
|
241
|
-
* backend's answer, and the two being one letter apart is what made `channel.getConfig()` ambiguous
|
|
242
|
-
* enough to rename as well.
|
|
243
|
-
*
|
|
244
|
-
* Assigning through this setter notifies subscribers; mutating the returned record in place does not.
|
|
245
|
-
* Prefer {@link _addChannelConfig}.
|
|
179
|
+
* Cache of server-provided channel configuration, keyed by cid (a channel's `config_overrides`
|
|
180
|
+
* can make it differ from other channels of its type). Read it through
|
|
181
|
+
* {@link Channel.serverConfig}. Assigning through the setter notifies subscribers, mutating the
|
|
182
|
+
* record in place does not (prefer {@link _addChannelConfig}).
|
|
246
183
|
*
|
|
247
184
|
* @internal
|
|
248
185
|
*/
|
|
@@ -250,93 +187,86 @@ export declare class StreamChat extends ChatApi {
|
|
|
250
187
|
/** @internal */
|
|
251
188
|
set channelServerConfigs(configs: Configs);
|
|
252
189
|
/**
|
|
253
|
-
* Returns
|
|
190
|
+
* Returns the shared client instance, so there is only one client and WebSocket connection.
|
|
254
191
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* **After the first call, the client configuration will not change if the key or options parameters change.**
|
|
192
|
+
* **After the first call, the `key` and `config` parameters are ignored.**
|
|
258
193
|
*
|
|
259
194
|
* @example <caption>initialize the client in user mode</caption>
|
|
260
195
|
* StreamChat.getInstance('api_key')
|
|
261
|
-
* @example <caption>initialize the client with
|
|
262
|
-
* StreamChat.getInstance('api_key', { axiosRequestConfig: { timeout: 5000 } })
|
|
196
|
+
* @example <caption>initialize the client with configuration</caption>
|
|
197
|
+
* StreamChat.getInstance('api_key', { client: { axiosRequestConfig: { timeout: 5000 } } })
|
|
263
198
|
*
|
|
264
199
|
* @param key - The API key.
|
|
265
|
-
* @param
|
|
266
|
-
* @param options.browser - Enforce the client to be in browser mode (optional).
|
|
267
|
-
* @param options.axiosRequestConfig - Axios-level request configuration such as `timeout`,
|
|
268
|
-
* `headers` or `httpsAgent`, spread into the client's axios instance (optional).
|
|
200
|
+
* @param config - Declarative configuration, as for the constructor (optional).
|
|
269
201
|
* @returns The shared client instance.
|
|
270
202
|
*/
|
|
271
|
-
static getInstance(key: string,
|
|
203
|
+
static getInstance(key: string, config?: DeepPartial<InstanceConfigTree>): StreamChat;
|
|
272
204
|
setOfflineDBApi(offlineDBInstance: AbstractOfflineDB): void;
|
|
205
|
+
/**
|
|
206
|
+
* Creates a development token for apps with auth checks disabled. Never use one in production.
|
|
207
|
+
* See {@link DevToken}.
|
|
208
|
+
*
|
|
209
|
+
* @param userId - The ID of the user the token is for.
|
|
210
|
+
* @returns The development token.
|
|
211
|
+
*/
|
|
212
|
+
devToken(userId: string): string;
|
|
273
213
|
getAuthType(): "anonymous" | "jwt";
|
|
274
214
|
setBaseURL(baseURL: string): void;
|
|
275
215
|
_getConnectionID: () => string | undefined;
|
|
276
216
|
_hasConnectionID: () => boolean;
|
|
277
|
-
/**
|
|
278
|
-
* @deprecated Use `client.config.setSetupFunction('messageComposer', fn)`.
|
|
279
|
-
*/
|
|
217
|
+
/** @deprecated Use `client.config.setSetupFunction('messageComposer', fn)`. */
|
|
280
218
|
setMessageComposerSetupFunction: (setupFunction: InstanceSetupState<"messageComposer">["setupFunction"]) => void;
|
|
281
219
|
/**
|
|
282
|
-
* Sets the current user and opens
|
|
220
|
+
* Sets the current user and opens the WebSocket connection.
|
|
283
221
|
*
|
|
284
|
-
* @param user -
|
|
285
|
-
* @param userTokenOrProvider - A token string or an async provider that
|
|
222
|
+
* @param user - The user, with its required `id`, e.g. `{ id: 'john', name: 'John' }`.
|
|
223
|
+
* @param userTokenOrProvider - A token string, or an async provider that resolves to one.
|
|
286
224
|
* @returns A promise that resolves when the connection is set up.
|
|
225
|
+
* @throws For a different user, unless `disconnectUser()` ran first.
|
|
287
226
|
*/
|
|
288
227
|
connectUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
|
|
289
228
|
/**
|
|
290
|
-
* Sets the current user and opens
|
|
229
|
+
* Sets the current user and opens the WebSocket connection.
|
|
291
230
|
*
|
|
292
|
-
* @deprecated Use {@link StreamChat.connectUser} instead.
|
|
231
|
+
* @deprecated Use {@link StreamChat.connectUser} instead.
|
|
293
232
|
*
|
|
294
|
-
* @param user -
|
|
295
|
-
* @param userTokenOrProvider - A token string or an async provider that
|
|
233
|
+
* @param user - The user, with its required `id`, e.g. `{ id: 'john', name: 'John' }`.
|
|
234
|
+
* @param userTokenOrProvider - A token string, or an async provider that resolves to one.
|
|
296
235
|
* @returns A promise that resolves when the connection is set up.
|
|
297
236
|
*/
|
|
298
237
|
setUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
|
|
299
238
|
_setToken: (user: TokenManagerMinimalUser, userTokenOrProvider: TokenOrProvider) => Promise<void>;
|
|
300
239
|
_setUser(user: TokenManagerMinimalUser): void;
|
|
301
240
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* if you don't have an active WebSocket connection.
|
|
308
|
-
* So when your app goes to background, you can call `client.closeConnection`.
|
|
309
|
-
* And when app comes back to foreground, call `client.openConnection`.
|
|
310
|
-
*
|
|
311
|
-
* After an `enableWSFallback` switch it closes the long-poll as well, telling the server to
|
|
312
|
-
* close its connection id.
|
|
241
|
+
* Closes the WebSocket without removing the user, and without auto-reconnect: call
|
|
242
|
+
* `openConnection` to reconnect. Mainly for mobile: push notifications arrive only while no
|
|
243
|
+
* WebSocket is active, so close on background and reopen on foreground. After an
|
|
244
|
+
* `enableWSFallback` switch it also closes the long-poll, telling the server to close its
|
|
245
|
+
* connection ID.
|
|
313
246
|
*
|
|
314
|
-
* @param timeout -
|
|
315
|
-
*
|
|
316
|
-
* The long-poll's close request uses it as its timeout (2s when omitted).
|
|
247
|
+
* @param timeout - Milliseconds to wait for the WebSocket close event and for the long-poll close
|
|
248
|
+
* request. Defaults to 1s and 2s respectively.
|
|
317
249
|
*/
|
|
318
250
|
closeConnection: (timeout?: number) => Promise<void>;
|
|
319
251
|
/**
|
|
320
|
-
*
|
|
252
|
+
* Opens a WebSocket connection for the current user. After an `enableWSFallback` switch it
|
|
321
253
|
* reconnects the long-poll instead: the client never goes back to the WebSocket.
|
|
322
254
|
*
|
|
323
|
-
* @returns The
|
|
255
|
+
* @returns The connect promise, or `undefined` when a healthy connection already exists.
|
|
324
256
|
*/
|
|
325
257
|
openConnection: () => ConnectAPIResponse | undefined;
|
|
326
|
-
/**
|
|
327
|
-
* Rejects the shared `wsPromise`, invalidates any in-flight connect attempt
|
|
328
|
-
*/
|
|
258
|
+
/** Rejects the shared `wsPromise` and invalidates any in-flight connect attempt. */
|
|
329
259
|
private _rejectPendingWsPromise;
|
|
330
260
|
/**
|
|
331
|
-
*
|
|
332
|
-
*
|
|
261
|
+
* Keeps a single pending `wsPromise` across close/reopen, so callers already awaiting it are not
|
|
262
|
+
* stranded when `openConnection` starts a new connect.
|
|
333
263
|
*/
|
|
334
264
|
private _bindWsPromise;
|
|
335
265
|
/**
|
|
336
|
-
* Revokes
|
|
266
|
+
* Revokes the connected user's tokens issued before the given time.
|
|
337
267
|
*
|
|
338
|
-
* @param before - Cutoff date; tokens issued before
|
|
339
|
-
* @param
|
|
268
|
+
* @param before - Cutoff date; tokens issued before it are revoked (optional). Defaults to now.
|
|
269
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
340
270
|
* into the request (optional).
|
|
341
271
|
* @returns The updated users response.
|
|
342
272
|
*/
|
|
@@ -344,50 +274,43 @@ export declare class StreamChat extends ChatApi {
|
|
|
344
274
|
/**
|
|
345
275
|
* Retrieves application settings.
|
|
346
276
|
*
|
|
347
|
-
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
348
|
-
* second argument, as on the generated methods; pass `undefined`.
|
|
349
277
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
350
278
|
* into the request (optional).
|
|
351
279
|
* @returns The application settings response.
|
|
352
280
|
*/
|
|
353
|
-
getAppSettings(
|
|
281
|
+
getAppSettings(requestOptions?: StreamRequestOptions): Promise<StreamResponse<Gen_GetApplicationResponse>>;
|
|
354
282
|
/**
|
|
355
|
-
* Disconnects the WebSocket and removes the user
|
|
283
|
+
* Disconnects the WebSocket and removes the user and its state.
|
|
356
284
|
*
|
|
357
|
-
* @param timeout -
|
|
358
|
-
* successful disconnection. See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent (optional).
|
|
359
|
-
* @returns The close-connection promise.
|
|
285
|
+
* @param timeout - Passed to {@link closeConnection} (optional).
|
|
360
286
|
*/
|
|
361
287
|
disconnectUser: (timeout?: number) => Promise<void>;
|
|
362
|
-
/**
|
|
363
|
-
*
|
|
364
|
-
* @deprecated Please use client.disconnectUser instead.
|
|
365
|
-
*
|
|
366
|
-
* Disconnects the WebSocket and removes the user from client.
|
|
367
|
-
*/
|
|
288
|
+
/** @deprecated Use `client.disconnectUser` instead. */
|
|
368
289
|
disconnect: (timeout?: number) => Promise<void>;
|
|
369
290
|
/**
|
|
370
|
-
* Sets an anonymous user and opens
|
|
291
|
+
* Sets an anonymous user and opens the WebSocket connection.
|
|
371
292
|
*
|
|
372
293
|
* @returns A promise that resolves when the connection is set up.
|
|
373
294
|
*/
|
|
374
295
|
connectAnonymousUser: () => ConnectAPIResponse | undefined;
|
|
375
296
|
/**
|
|
376
|
-
* Creates a guest user
|
|
297
|
+
* Creates a guest user.
|
|
377
298
|
*
|
|
378
|
-
* @param args -
|
|
299
|
+
* @param ...args - `[request, requestOptions]`. `request.user` is the guest user to create;
|
|
300
|
+
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
301
|
+
* serialized into the request.
|
|
379
302
|
* @returns The created guest user and its access token.
|
|
380
303
|
*/
|
|
381
304
|
createGuest(...args: Parameters<ChatApi['createGuest']>): Promise<StreamResponse<import(".").CreateGuestResponse>>;
|
|
382
305
|
/**
|
|
383
|
-
*
|
|
306
|
+
* Creates a temporary guest user and connects as it.
|
|
384
307
|
*
|
|
385
|
-
* @param user -
|
|
386
|
-
* @param
|
|
308
|
+
* @param user - The guest user, with its required `id`, e.g. `{ id: 'john', name: 'John' }`.
|
|
309
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
387
310
|
* into the request (optional).
|
|
388
311
|
* @returns A promise that resolves when the connection is set up.
|
|
389
312
|
*/
|
|
390
|
-
setGuestUser(user:
|
|
313
|
+
setGuestUser(user: UserRequest, requestOptions?: StreamRequestOptions): Promise<void | import("./types").ConnectionOpen>;
|
|
391
314
|
/**
|
|
392
315
|
* Listens to events on all channels and users you're watching.
|
|
393
316
|
*
|
|
@@ -401,34 +324,42 @@ export declare class StreamChat extends ChatApi {
|
|
|
401
324
|
* console.log(event.type);
|
|
402
325
|
* });
|
|
403
326
|
*
|
|
404
|
-
* @param
|
|
405
|
-
* @param callbackOrNothing - The callback to call when an event type was provided (optional).
|
|
327
|
+
* @param callback - Called with every event.
|
|
406
328
|
* @returns An object with an `unsubscribe()` method.
|
|
407
329
|
*/
|
|
408
330
|
on(callback: EventHandler): {
|
|
409
331
|
unsubscribe: () => void;
|
|
410
332
|
};
|
|
411
|
-
|
|
333
|
+
/**
|
|
334
|
+
* Listens to one event type on all channels and users you're watching.
|
|
335
|
+
*
|
|
336
|
+
* @param eventType - The event type to listen for.
|
|
337
|
+
* @param callback - Called with each event of that type.
|
|
338
|
+
* @returns An object with an `unsubscribe()` method.
|
|
339
|
+
*/
|
|
340
|
+
on<T extends EventType>(eventType: T, callback: EventHandler<T>): {
|
|
412
341
|
unsubscribe: () => void;
|
|
413
342
|
};
|
|
414
343
|
/**
|
|
415
|
-
* Removes
|
|
344
|
+
* Removes a listener for all events.
|
|
416
345
|
*
|
|
417
|
-
* @param
|
|
418
|
-
* @param callbackOrNothing - The callback to remove when an event type was provided (optional).
|
|
346
|
+
* @param callback - The listener to remove.
|
|
419
347
|
*/
|
|
420
348
|
off(callback: EventHandler): void;
|
|
421
|
-
|
|
349
|
+
/**
|
|
350
|
+
* Removes a listener for one event type.
|
|
351
|
+
*
|
|
352
|
+
* @param eventType - The event type it listens to.
|
|
353
|
+
* @param callback - The listener to remove.
|
|
354
|
+
*/
|
|
355
|
+
off<T extends EventType>(eventType: T, callback: EventHandler<T>): void;
|
|
422
356
|
dispatchEvent: (event: Event) => void;
|
|
423
357
|
/**
|
|
424
358
|
* Puts `user`'s new object into the members, watchers, own membership and (with `readEntries`)
|
|
425
|
-
* read entries of the channels that list them
|
|
426
|
-
* so its subscribers re-render.
|
|
359
|
+
* read entries of the channels that list them, in one state update per channel.
|
|
427
360
|
*
|
|
428
|
-
* @param
|
|
429
|
-
*
|
|
430
|
-
* (defaults to `true`). Off for a presence change: receipts show a user's name and image, never
|
|
431
|
-
* their online status, so they would rebuild for nothing.
|
|
361
|
+
* @param options.readEntries - Also replace the user in read entries, refreshing read receipts.
|
|
362
|
+
* Off for presence changes: receipts never show online status. Defaults to `true`.
|
|
432
363
|
*/
|
|
433
364
|
_updateMemberWatcherReferences: (user: UserResponse, { readEntries }?: {
|
|
434
365
|
readEntries?: boolean;
|
|
@@ -441,36 +372,19 @@ export declare class StreamChat extends ChatApi {
|
|
|
441
372
|
readEntries?: boolean;
|
|
442
373
|
}) => void;
|
|
443
374
|
/**
|
|
444
|
-
*
|
|
375
|
+
* Replaces the user's object in the messages of the loaded channels.
|
|
445
376
|
*
|
|
446
377
|
* @private
|
|
447
|
-
*
|
|
448
|
-
* @param user - The updated user.
|
|
449
378
|
*/
|
|
450
379
|
_updateUserMessageReferences: (user: UserResponse) => void;
|
|
451
380
|
/**
|
|
452
|
-
* Deletes the messages
|
|
453
|
-
*
|
|
454
|
-
* If `hardDelete` is `true`, all the content of the message will be stripped down.
|
|
455
|
-
* Otherwise, only `message.type` will be set as `'deleted'`.
|
|
381
|
+
* Deletes the user's messages in the loaded channels: stripped of their content with
|
|
382
|
+
* `hardDelete`, otherwise marked as deleted. `deletedAt` defaults to now.
|
|
456
383
|
*
|
|
457
384
|
* @private
|
|
458
|
-
*
|
|
459
|
-
* @param user - The user whose messages should be deleted.
|
|
460
|
-
* @param hardDelete - Whether to fully strip the message content (optional, defaults to `false`).
|
|
461
|
-
* @param deletedAt - Timestamp to mark messages as deleted at (optional).
|
|
462
385
|
*/
|
|
463
386
|
_deleteUserMessageReference: (user: UserResponse, hardDelete?: boolean, deletedAt?: LocalMessage["deleted_at"]) => void;
|
|
464
|
-
/**
|
|
465
|
-
* Handle the following user-related events:
|
|
466
|
-
* - `user.presence.changed`
|
|
467
|
-
* - `user.updated`
|
|
468
|
-
* - `user.deleted`
|
|
469
|
-
*
|
|
470
|
-
* @private
|
|
471
|
-
*
|
|
472
|
-
* @param event - The user event.
|
|
473
|
-
*/
|
|
387
|
+
/** @private */
|
|
474
388
|
_handleUserEvent: (event: Extract<WSEvent, {
|
|
475
389
|
type: "user.presence.changed" | "user.updated" | "user.deleted";
|
|
476
390
|
}>) => void;
|
|
@@ -478,99 +392,78 @@ export declare class StreamChat extends ChatApi {
|
|
|
478
392
|
_muteStatus(cid: string): ChannelMuteStatus;
|
|
479
393
|
_callClientListeners: (event: Event) => void;
|
|
480
394
|
/**
|
|
481
|
-
* Settles the connect promises after a successful reconnect, so `
|
|
482
|
-
* `
|
|
483
|
-
* (
|
|
484
|
-
*
|
|
485
|
-
* Requests no longer settle against these: waiting for a connection id is the
|
|
486
|
-
* {@link ConnectionIdManager}'s job, applied centrally in `ApiClient`.
|
|
487
|
-
*
|
|
488
|
-
* Called by `StableWSConnection._reconnect()`, and by `WSConnectionFallback.connect(true)`
|
|
489
|
-
* for the long-poll's own reconnects. Recovery itself is owned by
|
|
490
|
-
* {@link ConnectionRecoveryManager}, which subscribes to the connection lifecycle and so
|
|
491
|
-
* covers every reconnect path — including `closeConnection()` → `openConnection()` (mobile
|
|
492
|
-
* backgrounding), which reaches neither.
|
|
395
|
+
* Settles the connect promises after a successful reconnect, so a held `wsPromise` /
|
|
396
|
+
* `setUserPromise` stops resolving against a superseded (possibly rejected) attempt. Called by
|
|
397
|
+
* `StableWSConnection._reconnect()` and `WSConnectionFallback.connect(true)`. Recovery itself
|
|
398
|
+
* belongs to {@link ConnectionRecoveryManager}.
|
|
493
399
|
*
|
|
494
400
|
* @internal
|
|
495
401
|
*/
|
|
496
402
|
_settleConnectPromises: () => void;
|
|
497
|
-
/**
|
|
498
|
-
* @private
|
|
499
|
-
*/
|
|
403
|
+
/** @private */
|
|
500
404
|
connect(): Promise<void | import("./types").ConnectionOpen>;
|
|
501
405
|
/**
|
|
502
|
-
* Queries users and
|
|
406
|
+
* Queries users and stores them in `client.state.users`. Watches presence only when
|
|
407
|
+
* `request.payload.presence` is set.
|
|
503
408
|
*
|
|
504
409
|
* @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts
|
|
505
|
-
* MongoDB-style filter conditions, sort directions (e.g.
|
|
506
|
-
*
|
|
507
|
-
* abort `signal` and is never
|
|
410
|
+
* MongoDB-style filter conditions, sort directions (e.g.
|
|
411
|
+
* `[{ field: 'last_active', direction: -1 }]`), and options such as `presence`.
|
|
412
|
+
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
413
|
+
* serialized into the request.
|
|
508
414
|
* @returns The user query response.
|
|
509
415
|
*/
|
|
510
416
|
queryUsers(...args: Parameters<ChatApi['queryUsers']>): Promise<StreamResponse<import(".").QueryUsersResponse>>;
|
|
511
417
|
/**
|
|
512
|
-
* Stops watching a channel on this client's connection.
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
* by definition: it tells the server which connection should stop watching. So it waits for this
|
|
516
|
-
* client's connection id exactly as a watching request does — through a handshake or a reconnect,
|
|
517
|
-
* until the caller's abort signal fires — and throws when there is no connection and none is being
|
|
418
|
+
* Stops watching a channel on this client's connection. It carries no `watch` flag, but it waits
|
|
419
|
+
* for the connection ID like a watching request (through a handshake or reconnect, until the
|
|
420
|
+
* caller's abort signal fires) and throws when there is no connection and none is being
|
|
518
421
|
* established.
|
|
519
422
|
*
|
|
520
423
|
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams` identifies the channel
|
|
521
|
-
* (`{ type, id }`); `request.connection_id` is replaced by this client's connection
|
|
424
|
+
* (`{ type, id }`); `request.connection_id` is replaced by this client's connection ID.
|
|
522
425
|
* @returns The server response.
|
|
523
426
|
*/
|
|
524
427
|
stopWatchingChannel(...args: Parameters<ChatApi['stopWatchingChannel']>): Promise<StreamResponse<import(".").Response>>;
|
|
525
428
|
/**
|
|
526
|
-
* Queries channels and returns the
|
|
527
|
-
* `
|
|
528
|
-
*
|
|
529
|
-
* This exists as a compatibility bridge, as changing `queryChannelsRequest()` to return
|
|
530
|
-
* `QueryChannelsResponse` would be a breaking change because it currently returns
|
|
531
|
-
* only the channel list. In the next major release, the request/response APIs should
|
|
532
|
-
* be consolidated so callers can access the full response through the primary API.
|
|
429
|
+
* Queries channels and returns the raw API response. See {@link queryChannelsAndHydrate} for
|
|
430
|
+
* `Channel` instances.
|
|
533
431
|
*
|
|
534
432
|
* @param ...args - `[request, requestOptions]`. The optional `request` accepts MongoDB-style
|
|
535
433
|
* filter conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and
|
|
536
|
-
* options such as `predefined_filter`, `filter_values`, and `sort_values`. `
|
|
537
|
-
*
|
|
538
|
-
*
|
|
434
|
+
* options such as `predefined_filter`, `filter_values`, and `sort_values`. `state`, `watch` and
|
|
435
|
+
* `presence` default to `true`, `true` and `false`. `requestOptions` carries per-request
|
|
436
|
+
* options such as an abort `signal` and is never serialized into the request.
|
|
437
|
+
* @returns The full query channels response, including metadata such as `predefined_filter`.
|
|
539
438
|
*/
|
|
540
439
|
queryChannels(...args: Parameters<ChatApi['queryChannels']>): Promise<StreamResponse<QueryChannelsResponse>>;
|
|
541
440
|
/**
|
|
542
|
-
* Queries channels and hydrates them into `Channel` instances on this client
|
|
543
|
-
*
|
|
544
|
-
* Use the inherited `queryChannels()` from `ChatApi` when only the raw API response
|
|
545
|
-
* is needed; this method wraps it with state hydration, `channels.queried` dispatch,
|
|
546
|
-
* and offline-db sync.
|
|
441
|
+
* Queries channels and hydrates them into `Channel` instances on this client, dispatching
|
|
442
|
+
* `channels.queried` and syncing the offline DB. Use `queryChannels()` for the raw API response.
|
|
547
443
|
*
|
|
548
444
|
* @param options - The query channels request payload (optional). Accepts MongoDB-style filter
|
|
549
445
|
* conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and options
|
|
550
446
|
* such as `predefined_filter`, `filter_values`, and `sort_values`.
|
|
551
|
-
* @param stateOptions - Options that only affect state management and
|
|
552
|
-
*
|
|
553
|
-
* @param stateOptions.skipInitialization -
|
|
554
|
-
*
|
|
555
|
-
* @param stateOptions.
|
|
556
|
-
*
|
|
557
|
-
* @param
|
|
558
|
-
* This is a compatibility bridge for internal callers that need response-level metadata while
|
|
559
|
-
* the default return value remains `Channel[]` (optional).
|
|
560
|
-
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
447
|
+
* @param stateOptions - Options that only affect state management and are not sent in the
|
|
448
|
+
* request. Defaults to `{}`.
|
|
449
|
+
* @param stateOptions.skipInitialization - IDs of channels whose state is not initialized.
|
|
450
|
+
* @param stateOptions.skipHydration - Not read: it has no effect.
|
|
451
|
+
* @param stateOptions.withResponse - Returns the full query response (with hydrated `channels`)
|
|
452
|
+
* instead of `Channel[]`.
|
|
453
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
561
454
|
* into the request (optional).
|
|
562
455
|
* @returns The hydrated channel list, or the full response when `withResponse` is `true`.
|
|
563
456
|
*/
|
|
564
|
-
queryChannelsAndHydrate(options
|
|
457
|
+
queryChannelsAndHydrate(options: QueryChannelsRequest | undefined, stateOptions: ChannelStateOptions & {
|
|
565
458
|
withResponse: true;
|
|
566
459
|
}, requestOptions?: StreamRequestOptions): Promise<QueryChannelsResponseWithChannels>;
|
|
567
460
|
queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions, requestOptions?: StreamRequestOptions): Promise<Channel[]>;
|
|
568
461
|
/**
|
|
569
|
-
* Queries
|
|
570
|
-
* request.
|
|
462
|
+
* Queries a message's reactions. On the first page, cached offline reactions are dispatched
|
|
463
|
+
* (`offline_reactions.queried`) before the network request.
|
|
571
464
|
*
|
|
572
|
-
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the target message
|
|
573
|
-
* `request` carries MongoDB-style filters, sort directions (e.g.
|
|
465
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the target message
|
|
466
|
+
* ID; `request` carries MongoDB-style filters, sort directions (e.g.
|
|
574
467
|
* `[{ field: 'created_at', direction: -1 }]`) and pagination options; `requestOptions` carries
|
|
575
468
|
* per-request options such as an abort `signal` and is never serialized into the request.
|
|
576
469
|
* @returns The query reactions response.
|
|
@@ -579,47 +472,43 @@ export declare class StreamChat extends ChatApi {
|
|
|
579
472
|
hydrateChannels(channelsFromApi?: ChannelStateResponseFields[], stateOptions?: ChannelStateOptions, queryChannelsOptions?: ChannelOptions, candidateIdsByCid?: Map<string, ReadonlySet<string>>): Channel[];
|
|
580
473
|
/**
|
|
581
474
|
* Returns the channel with the given type, ID and custom data: a shorthand for
|
|
582
|
-
* {@link ChannelManager.ensure}
|
|
583
|
-
*
|
|
475
|
+
* {@link ChannelManager.ensure}, so it returns the stored instance for the cid or creates and
|
|
476
|
+
* stores it.
|
|
584
477
|
*
|
|
585
|
-
*
|
|
478
|
+
* For a distinct channel between users, leave out the ID and pass the members:
|
|
586
479
|
* `client.channel('messaging', { members: [{ user_id: 'tommaso' }, { user_id: 'thierry' }] })`.
|
|
587
480
|
* It has no ID until `channel.watch()`, `query()` or `create()` returns one.
|
|
588
481
|
*
|
|
589
482
|
* @param channelType - The channel type.
|
|
590
|
-
* @param
|
|
591
|
-
*
|
|
592
|
-
* @param custom - Data for a new channel, e.g. `members` or `custom
|
|
483
|
+
* @param channelId - The channel ID; leave it out for a distinct channel created from members
|
|
484
|
+
* (optional).
|
|
485
|
+
* @param custom - Data for a new channel, e.g. `members` or `custom`. Defaults to `{}`.
|
|
593
486
|
* @returns The channel; initialize it with `channel.watch()`.
|
|
594
487
|
*/
|
|
595
488
|
channel(channelType: string, channelId?: string | null, custom?: ChannelInput): Channel;
|
|
596
489
|
channel(channelType: string, custom?: ChannelInput): Channel;
|
|
597
490
|
/**
|
|
598
|
-
*
|
|
491
|
+
* Searches messages.
|
|
599
492
|
*
|
|
600
|
-
* @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts
|
|
601
|
-
*
|
|
602
|
-
* `requestOptions` carries per-request options such as an abort
|
|
603
|
-
* serialized into the request.
|
|
493
|
+
* @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts channel
|
|
494
|
+
* `filter_conditions`, `message_filter_conditions`, a `query`, and options such as `limit`,
|
|
495
|
+
* `offset`, `next` and `sort`. `requestOptions` carries per-request options such as an abort
|
|
496
|
+
* `signal` and is never serialized into the request.
|
|
604
497
|
* @returns The search messages response.
|
|
498
|
+
* @throws When both `offset` and `next` are given.
|
|
605
499
|
*/
|
|
606
500
|
search(...args: Parameters<ChatApi['search']>): Promise<StreamResponse<import(".").SearchResponse>>;
|
|
607
501
|
/**
|
|
608
|
-
* Caches one channel's server configuration,
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
* Two writes are skipped. A response with no `config` — `notification.message_new` is one route that
|
|
614
|
-
* omits it — would otherwise un-learn a config already known for the channel. A config deep-equal to
|
|
615
|
-
* the stored one keeps a repeated query from waking that channel's subscribers, which matters because
|
|
616
|
-
* the API returns a fresh object every time and the store compares by reference.
|
|
502
|
+
* Caches one channel's server configuration, keyed by cid (see {@link Channel.serverConfig}).
|
|
503
|
+
* Skips the write for a response without `config` (`notification.message_new` omits it) and for a
|
|
504
|
+
* config deep-equal to the stored one: the API returns a fresh object each time and the store
|
|
505
|
+
* compares by reference.
|
|
617
506
|
*
|
|
618
507
|
* @internal
|
|
619
508
|
*/
|
|
620
509
|
_addChannelConfig({ cid, config }: Pick<ChannelResponse, 'cid' | 'config'>): void;
|
|
621
510
|
/**
|
|
622
|
-
*
|
|
511
|
+
* Revokes a global ban.
|
|
623
512
|
*
|
|
624
513
|
* @param targetUserId - The user to unban.
|
|
625
514
|
* @param options - Unban options (optional).
|
|
@@ -630,89 +519,74 @@ export declare class StreamChat extends ChatApi {
|
|
|
630
519
|
getBlockedUsers(...args: Parameters<ChatApi['getBlockedUsers']>): Promise<StreamResponse<import(".").GetBlockedUsersResponse>>;
|
|
631
520
|
unblockUser(blockedUserId: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnblockUsersResponse>>;
|
|
632
521
|
/**
|
|
633
|
-
* Checks whether a user is muted.
|
|
522
|
+
* Checks whether a user is muted.
|
|
634
523
|
*
|
|
635
524
|
* @param targetId - The user ID to check.
|
|
636
525
|
* @returns `true` if the user is muted, otherwise `false`.
|
|
526
|
+
* @throws When no user is connected.
|
|
637
527
|
*/
|
|
638
528
|
userMuteStatus(targetId: string): boolean;
|
|
639
|
-
/**
|
|
640
|
-
* Transforms an expiration value into an ISO string.
|
|
641
|
-
*
|
|
642
|
-
* A `number` is an offset in SECONDS, not a timestamp — passing a wire `pin_expires` overflows
|
|
643
|
-
* `Date`, which used to surface as an opaque `RangeError` from `toISOString()`.
|
|
644
|
-
*
|
|
645
|
-
* @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
|
|
646
|
-
* in seconds, `string` or `Date` to set the exact expiration date (optional).
|
|
647
|
-
* @returns The expiration as an ISO string, or `null`.
|
|
648
|
-
* @throws If a numeric offset does not resolve to a representable date.
|
|
649
|
-
*/
|
|
650
|
-
_normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
|
|
651
|
-
/**
|
|
652
|
-
* Extracts a string message ID from either a message object or a message ID.
|
|
653
|
-
*
|
|
654
|
-
* @param messageOrMessageId - MessageRequest object or message ID.
|
|
655
|
-
* @param errorText - Error message to report in case of message ID absence.
|
|
656
|
-
* @returns The extracted message ID.
|
|
657
|
-
*/
|
|
658
|
-
_validateAndGetMessageId(messageOrMessageId: string | {
|
|
659
|
-
id: string;
|
|
660
|
-
}, errorText: string): string;
|
|
661
529
|
/**
|
|
662
530
|
* Pins the message.
|
|
663
531
|
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
* @param
|
|
669
|
-
*
|
|
670
|
-
* in seconds, `string` or `Date` to set the exact expiration date (optional).
|
|
671
|
-
* @param pinnedAt - Date when the message should be pinned. It affects the order of pinned
|
|
672
|
-
* messages. Use a negative number to set relative time in the past, `string` or `Date` to
|
|
673
|
-
* set the exact date of pin (optional).
|
|
532
|
+
* @param message - The message to pin, or just its `{ id }`.
|
|
533
|
+
* @param options - When the pin expires and where it sorts (optional).
|
|
534
|
+
* @param options.pin_expires - When the pin expires, as a `Date` or an RFC3339 string; `null` or
|
|
535
|
+
* leaving it out pins without expiry. Hand a server-sent timestamp back with `nsToDate(timestamp)`.
|
|
536
|
+
* @param options.pinned_at - The pin time, which orders the pinned messages, as a `Date` or an
|
|
537
|
+
* RFC3339 string (optional). Defaults to now.
|
|
674
538
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
675
539
|
* into the request (optional).
|
|
676
540
|
* @returns The updated message response.
|
|
677
541
|
*/
|
|
678
|
-
pinMessage
|
|
542
|
+
pinMessage({ id }: {
|
|
679
543
|
id: string;
|
|
680
|
-
},
|
|
544
|
+
}, { pin_expires, pinned_at }?: PinMessageOptions, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
|
|
681
545
|
/**
|
|
682
546
|
* Unpins the message that was previously pinned.
|
|
683
547
|
*
|
|
684
|
-
* @param
|
|
548
|
+
* @param message - The message to unpin, or just its `{ id }`.
|
|
685
549
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
686
550
|
* into the request (optional).
|
|
687
551
|
* @returns The updated message response.
|
|
688
552
|
*/
|
|
689
|
-
unpinMessage(
|
|
553
|
+
unpinMessage({ id }: {
|
|
690
554
|
id: string;
|
|
691
555
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
|
|
692
556
|
/**
|
|
693
|
-
* Updates
|
|
694
|
-
*
|
|
557
|
+
* Updates a message over HTTP only: no offline queueing and no local state.
|
|
558
|
+
* `messageOperations.update` on a channel or thread is the full edit.
|
|
559
|
+
*
|
|
560
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the message ID;
|
|
561
|
+
* `request.message` is the updated message; `requestOptions` carries per-request options such
|
|
562
|
+
* as an abort `signal` and is never serialized into the request.
|
|
563
|
+
* @returns The update message response.
|
|
695
564
|
*/
|
|
696
565
|
updateMessage(...args: Parameters<ChatApi['updateMessage']>): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
|
|
697
566
|
/**
|
|
698
|
-
* Deletes a message
|
|
567
|
+
* Deletes a message over HTTP only: no offline queueing and no local state.
|
|
699
568
|
* `messageOperations.delete` on a channel or thread is the full delete.
|
|
569
|
+
*
|
|
570
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the message ID;
|
|
571
|
+
* `request.hard` deletes it permanently and `request.delete_for_me` deletes it for the current
|
|
572
|
+
* user only; `requestOptions` carries per-request options such as an abort `signal` and is
|
|
573
|
+
* never serialized into the request.
|
|
574
|
+
* @returns The delete message response.
|
|
700
575
|
*/
|
|
701
576
|
deleteMessage(...args: Parameters<ChatApi['deleteMessage']>): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
|
|
702
577
|
/**
|
|
703
|
-
* Returns the
|
|
578
|
+
* Returns the current user's threads as hydrated `Thread` instances.
|
|
704
579
|
*
|
|
705
|
-
* @param options -
|
|
706
|
-
*
|
|
707
|
-
* @param options.
|
|
708
|
-
* @param options.
|
|
709
|
-
* @param options.
|
|
710
|
-
* @param options.
|
|
711
|
-
* @param options.
|
|
712
|
-
* @param
|
|
713
|
-
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
580
|
+
* @param options - Pagination and limits for the participants and replies. Defaults to `{}`.
|
|
581
|
+
* @param options.limit - Limits the number of threads returned. Defaults to 10.
|
|
582
|
+
* @param options.watch - Subscribes the user to the channels of the threads. Defaults to `true`.
|
|
583
|
+
* @param options.participant_limit - Limits the participants returned per thread. Defaults to 10.
|
|
584
|
+
* @param options.reply_limit - Limits the replies returned per thread. Defaults to 3.
|
|
585
|
+
* @param options.filter - MongoDB-style filters for threads (optional).
|
|
586
|
+
* @param options.sort - MongoDB-style sort for threads (optional).
|
|
587
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
714
588
|
* into the request (optional).
|
|
715
|
-
* @returns The
|
|
589
|
+
* @returns The threads and the next cursor.
|
|
716
590
|
*/
|
|
717
591
|
queryThreadsAndHydrate(options?: QueryThreadsRequest, requestOptions?: StreamRequestOptions): Promise<{
|
|
718
592
|
threads: Thread[];
|
|
@@ -721,17 +595,20 @@ export declare class StreamChat extends ChatApi {
|
|
|
721
595
|
/**
|
|
722
596
|
* Returns the thread of a message by its ID, wrapped in a hydrated `Thread` instance.
|
|
723
597
|
*
|
|
724
|
-
* @param
|
|
725
|
-
* @param
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
* @param options.
|
|
729
|
-
* @param options.
|
|
598
|
+
* @param pathParams - The thread's parent message, as for `getThread`.
|
|
599
|
+
* @param pathParams.message_id - The parent message ID.
|
|
600
|
+
* @param options - Options object for pagination and limiting the participants and replies.
|
|
601
|
+
* Defaults to `{}`.
|
|
602
|
+
* @param options.watch - Subscribes the user to the channel of the thread. Defaults to `true`.
|
|
603
|
+
* @param options.participant_limit - Limits the participants returned. Defaults to 100.
|
|
604
|
+
* @param options.reply_limit - Limits the replies returned. Defaults to 3.
|
|
730
605
|
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
731
606
|
* into the request (optional).
|
|
732
607
|
* @returns The thread.
|
|
733
608
|
*/
|
|
734
|
-
getThreadAndHydrate(
|
|
609
|
+
getThreadAndHydrate({ message_id: messageId }: {
|
|
610
|
+
message_id: string;
|
|
611
|
+
}, options?: GetThreadOptions, requestOptions?: StreamRequestOptions): Promise<Thread>;
|
|
735
612
|
getUserAgent: () => string;
|
|
736
613
|
/**
|
|
737
614
|
* Sets the user agent string.
|
|
@@ -743,62 +620,60 @@ export declare class StreamChat extends ChatApi {
|
|
|
743
620
|
setUserAgent(userAgent: string): void;
|
|
744
621
|
_startCleaning(): void;
|
|
745
622
|
/**
|
|
746
|
-
*
|
|
747
|
-
*
|
|
748
|
-
* `products` is not optional in practice: without `'chat'` the server treats the
|
|
749
|
-
* connection as video-only, which drops every chat event and unread count.
|
|
623
|
+
* The JSON-encoded WebSocket auth message, sent as the first frame once the socket opens.
|
|
750
624
|
*
|
|
751
625
|
* @private
|
|
752
|
-
*
|
|
753
|
-
* @returns The JSON-encoded auth message.
|
|
754
626
|
*/
|
|
755
627
|
_buildWSAuthMessage: () => string;
|
|
756
628
|
/**
|
|
757
|
-
* The auth message
|
|
758
|
-
*
|
|
629
|
+
* The auth message that {@link _buildWSAuthMessage} encodes for the WebSocket and the long-poll
|
|
630
|
+
* fallback sends as `longPoll()`'s `json` query param.
|
|
759
631
|
*
|
|
760
632
|
* @private
|
|
761
633
|
*
|
|
762
|
-
* @param token - The
|
|
763
|
-
* through the request's `Authorization` header instead.
|
|
634
|
+
* @param token - The long-poll passes none: it authenticates through the `Authorization` header.
|
|
764
635
|
*/
|
|
765
636
|
_buildWSAuthPayload: (token?: string) => WSAuthMessage;
|
|
766
637
|
/**
|
|
767
|
-
* Queries poll answers
|
|
638
|
+
* Queries poll answers: the votes with `is_answer: true`.
|
|
768
639
|
*
|
|
769
640
|
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.poll_id` is the poll ID;
|
|
770
641
|
* `request` carries optional vote filter conditions, sort directions, and pagination options
|
|
771
|
-
* (`limit`, `
|
|
642
|
+
* (`limit`, `next`, `prev`); `requestOptions` carries per-request options such as an abort
|
|
643
|
+
* `signal` and is never serialized into the request.
|
|
772
644
|
* @returns The poll answers.
|
|
773
645
|
*/
|
|
774
646
|
queryPollAnswers(...args: Parameters<ChatApi['queryPollVotes']>): Promise<StreamResponse<import(".").PollVotesResponse>>;
|
|
775
647
|
/**
|
|
776
|
-
* Uploads a file to the Stream CDN
|
|
648
|
+
* Uploads a file to the Stream CDN.
|
|
777
649
|
*
|
|
778
650
|
* @param request - Upload payload. `request.file` is the file to upload.
|
|
779
|
-
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
780
|
-
*
|
|
651
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
652
|
+
* (optional).
|
|
653
|
+
* @returns The upload response, with the file URL.
|
|
781
654
|
*/
|
|
782
655
|
uploadFile(request?: Omit<FileUploadRequest, 'file'> & {
|
|
783
656
|
file?: FileUploadInput;
|
|
784
657
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").FileUploadResponse>>;
|
|
785
658
|
/**
|
|
786
|
-
* Uploads an image to Stream CDN
|
|
659
|
+
* Uploads an image to the Stream CDN.
|
|
787
660
|
*
|
|
788
661
|
* @param request - Upload payload. `request.file` is the image to upload.
|
|
789
|
-
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
790
|
-
*
|
|
662
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal`
|
|
663
|
+
* (optional).
|
|
664
|
+
* @returns The upload response, with the image URL.
|
|
791
665
|
*/
|
|
792
666
|
uploadImage(request?: Omit<ImageUploadRequest, 'file'> & {
|
|
793
667
|
file?: FileUploadInput;
|
|
794
668
|
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ImageUploadResponse>>;
|
|
795
669
|
/**
|
|
796
|
-
* Marks
|
|
670
|
+
* Marks channels as delivered for the given messages.
|
|
797
671
|
*
|
|
798
672
|
* @param request - Mark delivered options.
|
|
673
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
674
|
+
* into the request (optional).
|
|
799
675
|
* @returns The server response, or `undefined` if there are no messages to mark.
|
|
800
676
|
*/
|
|
801
677
|
markChannelsDelivered(request?: Gen_MarkDeliveredRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MarkDeliveredResponse> | undefined>;
|
|
802
678
|
syncDeliveredCandidates(collections: Channel[]): void;
|
|
803
679
|
}
|
|
804
|
-
export {};
|