stream-chat 10.0.0-rc.2 → 10.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/dist/cjs/index.browser.js +15397 -12090
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +15349 -11991
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +15164 -11880
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +246 -6
- package/dist/types/CooldownTimer.d.ts +22 -8
- package/dist/types/EventHandlerPipeline.d.ts +12 -16
- package/dist/types/LiveLocationManager.d.ts +69 -6
- package/dist/types/api-client.d.ts +22 -9
- package/dist/types/channel.d.ts +550 -300
- package/dist/types/channel_state.d.ts +167 -22
- package/dist/types/client.d.ts +325 -305
- package/dist/types/configuration/ConfigController.d.ts +172 -0
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +192 -0
- package/dist/types/configuration/index.d.ts +3 -0
- package/dist/types/configuration/keys.d.ts +31 -0
- package/dist/types/configuration/shape.d.ts +58 -0
- package/dist/types/configuration/types.d.ts +206 -50
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +59 -0
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +1 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +24 -0
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +22 -0
- package/dist/types/configuration/utils/index.d.ts +1 -0
- package/dist/types/configuration/utils/serverAuthority.d.ts +49 -0
- package/dist/types/connection/ConnectionIdManager.d.ts +67 -0
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +164 -0
- package/dist/types/connection/index.d.ts +4 -0
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +153 -0
- package/dist/types/connection/networkConnection/index.d.ts +3 -0
- package/dist/types/connection/networkConnection/reporters.d.ts +43 -0
- package/dist/types/connection/networkConnection/types.d.ts +55 -0
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +204 -0
- package/dist/types/connection/wsConnection/WSConnection.d.ts +168 -0
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +55 -0
- package/dist/types/connection/wsConnection/config.d.ts +51 -0
- package/dist/types/connection/wsConnection/index.d.ts +4 -0
- package/dist/types/connection/wsConnection/types.d.ts +99 -0
- package/dist/types/constants.d.ts +3 -1
- package/dist/types/entityStore/EntityStore.d.ts +160 -40
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +48 -29
- package/dist/types/entityStore/index.d.ts +0 -1
- package/dist/types/errors.d.ts +24 -4
- package/dist/types/formatMessageMemo.d.ts +5 -0
- package/dist/types/gen/chat/ChannelApi.d.ts +51 -23
- package/dist/types/gen/chat/ChatApi.d.ts +215 -168
- package/dist/types/gen/models/index.d.ts +2164 -557
- package/dist/types/gen/models/timestamp-guard.d.ts +22 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +39 -32
- package/dist/types/gen-imports.d.ts +1 -0
- package/dist/types/index.d.ts +20 -7
- package/dist/types/languageNames.d.ts +97 -0
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/messageComposer/CustomDataManager.d.ts +7 -1
- package/dist/types/messageComposer/LocationComposer.d.ts +10 -4
- package/dist/types/messageComposer/attachmentIdentity.d.ts +11 -0
- package/dist/types/messageComposer/attachmentManager.d.ts +48 -10
- package/dist/types/messageComposer/attachmentUtils.d.ts +34 -0
- package/dist/types/messageComposer/configuration/commands.configuration.d.ts +1 -3
- package/dist/types/messageComposer/configuration/configuration.d.ts +9 -1
- package/dist/types/messageComposer/configuration/index.d.ts +0 -1
- package/dist/types/messageComposer/configuration/types.d.ts +57 -1
- package/dist/types/messageComposer/index.d.ts +1 -0
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +10 -4
- package/dist/types/messageComposer/messageComposer.d.ts +210 -14
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +20 -1
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +11 -0
- package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +2 -2
- package/dist/types/messageComposer/middleware/pollComposer/index.d.ts +1 -0
- package/dist/types/messageComposer/middleware/pollComposer/state.d.ts +3 -2
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +9 -2
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +44 -0
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +2 -2
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +94 -229
- package/dist/types/messageComposer/pollComposer.d.ts +8 -3
- package/dist/types/messageComposer/textComposer.d.ts +9 -1
- package/dist/types/messageComposer/types.d.ts +7 -3
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +64 -8
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +48 -11
- package/dist/types/messageOperations/FailedSendCache.d.ts +34 -0
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +52 -6
- package/dist/types/messageOperations/MessageOperations.d.ts +94 -11
- package/dist/types/{entityStore → messageOperations}/applyReactionLocally.d.ts +8 -2
- package/dist/types/messageOperations/createMessageOperations.d.ts +11 -0
- package/dist/types/messageOperations/index.d.ts +7 -1
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +24 -0
- package/dist/types/messageOperations/sendOrdering.d.ts +17 -0
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +28 -0
- package/dist/types/messageOperations/types.d.ts +66 -1
- package/dist/types/middleware.d.ts +8 -0
- package/dist/types/moderation.d.ts +18 -4
- package/dist/types/notifications/NotificationManager.d.ts +43 -2
- package/dist/types/notifications/types.d.ts +55 -42
- package/dist/types/offline-support/offline_support_api.d.ts +128 -12
- package/dist/types/offline-support/offline_sync_manager.d.ts +26 -5
- package/dist/types/offline-support/queueableOperations.d.ts +106 -0
- package/dist/types/offline-support/types.d.ts +77 -28
- package/dist/types/pagination/FilterBuilder.d.ts +1 -18
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -1
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +21 -3
- package/dist/types/pagination/filterCompiler.d.ts +5 -0
- package/dist/types/pagination/paginators/BasePaginator.d.ts +331 -7
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +54 -11
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +283 -66
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +10 -9
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +17 -1
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +8 -8
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +57 -0
- package/dist/types/pagination/paginators/index.d.ts +1 -0
- package/dist/types/pagination/utility.normalization.d.ts +29 -2
- package/dist/types/poll.d.ts +41 -14
- package/dist/types/poll_manager.d.ts +3 -2
- package/dist/types/poll_optimistic_votes.d.ts +61 -0
- package/dist/types/reminders/Reminder.d.ts +17 -7
- package/dist/types/reminders/ReminderManager.d.ts +34 -6
- package/dist/types/search/BaseSearchSource.d.ts +50 -25
- package/dist/types/search/ChannelMemberSearchSource.d.ts +11 -6
- package/dist/types/search/ChannelSearchSource.d.ts +27 -5
- package/dist/types/search/MessageSearchSource.d.ts +36 -6
- package/dist/types/search/SearchController.d.ts +44 -11
- package/dist/types/search/UserSearchSource.d.ts +11 -5
- package/dist/types/search/types.d.ts +14 -1
- package/dist/types/signing.d.ts +0 -157
- package/dist/types/thread.d.ts +118 -62
- package/dist/types/thread_manager.d.ts +124 -35
- package/dist/types/token_manager.d.ts +5 -8
- package/dist/types/types.d.ts +138 -562
- package/dist/types/types.utility.d.ts +8 -0
- package/dist/types/upload-utils.d.ts +20 -0
- package/dist/types/uploadManager.d.ts +50 -2
- package/dist/types/utils/FixedSizeQueueCache.d.ts +2 -0
- package/dist/types/utils/WithSubscriptions.d.ts +1 -1
- package/dist/types/utils/objectPath.d.ts +49 -0
- package/dist/types/utils/time.d.ts +85 -0
- package/dist/types/utils.d.ts +63 -40
- package/package.json +22 -33
- package/src/ChannelManager.ts +561 -109
- package/src/CooldownTimer.ts +55 -45
- package/src/EventHandlerPipeline.ts +13 -23
- package/src/LiveLocationManager.ts +191 -37
- package/src/api-client.ts +144 -53
- package/src/channel.ts +1573 -1050
- package/src/channel_state.ts +239 -129
- package/src/client.ts +843 -892
- package/src/client_state.ts +2 -2
- package/src/configuration/ConfigController.ts +298 -0
- package/src/configuration/InstanceConfigurationRegistry.ts +430 -0
- package/src/configuration/index.ts +7 -0
- package/src/configuration/keys.ts +86 -0
- package/src/configuration/shape.ts +776 -0
- package/src/configuration/types.ts +218 -60
- package/src/configuration/utils/applyInstanceConfiguration.ts +184 -0
- package/src/configuration/utils/copyConfigPatch.ts +61 -0
- package/src/configuration/utils/declarativeSlices.ts +81 -0
- package/src/configuration/utils/deepFreezeConfig.ts +33 -0
- package/src/configuration/utils/index.ts +5 -0
- package/src/configuration/utils/serverAuthority.ts +146 -0
- package/src/connection/ConnectionIdManager.ts +153 -0
- package/src/connection/ConnectionRecoveryManager.ts +371 -0
- package/src/connection/index.ts +4 -0
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +281 -0
- package/src/connection/networkConnection/index.ts +3 -0
- package/src/connection/networkConnection/reporters.ts +85 -0
- package/src/connection/networkConnection/types.ts +60 -0
- package/src/{connection.ts → connection/wsConnection/StableWSConnection.ts} +242 -151
- package/src/connection/wsConnection/WSConnection.ts +345 -0
- package/src/connection/wsConnection/WSConnectionFallback.ts +259 -0
- package/src/connection/wsConnection/config.ts +108 -0
- package/src/connection/wsConnection/index.ts +4 -0
- package/src/connection/wsConnection/types.ts +101 -0
- package/src/constants.ts +5 -3
- package/src/entityStore/EntityStore.ts +350 -10
- package/src/entityStore/StoreBackedItemIndex.ts +66 -37
- package/src/entityStore/index.ts +0 -1
- package/src/errors.ts +40 -7
- package/src/formatMessageMemo.ts +23 -0
- package/src/gen/chat/ChannelApi.ts +230 -44
- package/src/gen/chat/ChatApi.ts +1047 -1745
- package/src/gen/models/index.ts +2378 -3721
- package/src/gen/models/timestamp-guard.ts +27 -0
- package/src/gen/moderation/ModerationApi.ts +218 -388
- package/src/gen-imports.ts +1 -0
- package/src/index.ts +82 -6
- package/src/languageNames.ts +103 -0
- package/src/logger.ts +1 -1
- package/src/messageComposer/CustomDataManager.ts +10 -1
- package/src/messageComposer/LocationComposer.ts +68 -20
- package/src/messageComposer/attachmentIdentity.ts +39 -0
- package/src/messageComposer/attachmentManager.ts +191 -68
- package/src/messageComposer/attachmentUtils.ts +58 -0
- package/src/messageComposer/configuration/commands.configuration.ts +1 -26
- package/src/messageComposer/configuration/configuration.ts +22 -3
- package/src/messageComposer/configuration/index.ts +0 -1
- package/src/messageComposer/configuration/types.ts +58 -1
- package/src/messageComposer/index.ts +1 -0
- package/src/messageComposer/linkPreviewsManager.ts +16 -10
- package/src/messageComposer/messageComposer.ts +487 -98
- package/src/messageComposer/middleware/attachmentManager/postUpload/AttachmentPostUploadMiddlewareExecutor.ts +1 -1
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +58 -33
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +7 -2
- package/src/messageComposer/middleware/attachmentManager/preUpload/blockedUploadNotification.ts +3 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +98 -1
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +20 -10
- package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +7 -2
- package/src/messageComposer/middleware/messageComposer/types.ts +2 -7
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +11 -6
- package/src/messageComposer/middleware/pollComposer/index.ts +1 -0
- package/src/messageComposer/middleware/pollComposer/state.ts +43 -11
- package/src/messageComposer/middleware/pollComposer/types.ts +9 -2
- package/src/messageComposer/middleware/pollComposer/validation.ts +76 -0
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +1 -2
- package/src/messageComposer/middleware/textComposer/mentions.ts +91 -39
- package/src/messageComposer/pollComposer.ts +11 -3
- package/src/messageComposer/textComposer.ts +36 -4
- package/src/messageComposer/types.ts +19 -14
- package/src/messageDelivery/MessageDeliveryReporter.ts +154 -53
- package/src/messageDelivery/MessageReceiptsTracker.ts +136 -64
- package/src/messageOperations/FailedSendCache.ts +90 -0
- package/src/messageOperations/MessageOperationStatePolicy.ts +269 -27
- package/src/messageOperations/MessageOperations.ts +340 -136
- package/src/{entityStore → messageOperations}/applyReactionLocally.ts +10 -3
- package/src/messageOperations/createMessageOperations.ts +192 -0
- package/src/messageOperations/index.ts +7 -0
- package/src/messageOperations/reflectReactionEvent.ts +51 -0
- package/src/messageOperations/sendOrdering.ts +28 -0
- package/src/messageOperations/settlePendingAttachmentUploads.ts +110 -0
- package/src/messageOperations/types.ts +74 -0
- package/src/middleware.ts +11 -0
- package/src/moderation.ts +47 -24
- package/src/notifications/NotificationManager.ts +73 -3
- package/src/notifications/configuration.ts +10 -8
- package/src/notifications/types.ts +58 -42
- package/src/offline-support/offline_support_api.ts +380 -197
- package/src/offline-support/offline_sync_manager.ts +105 -32
- package/src/offline-support/queueableOperations.ts +270 -0
- package/src/offline-support/types.ts +85 -39
- package/src/pagination/FilterBuilder.ts +1 -22
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +11 -7
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +25 -7
- package/src/pagination/filterCompiler.ts +17 -0
- package/src/pagination/paginators/BasePaginator.ts +731 -81
- package/src/pagination/paginators/ChannelPaginator.ts +210 -102
- package/src/pagination/paginators/MessageIntervalPaginator.ts +703 -193
- package/src/pagination/paginators/MessagePaginator.ts +45 -36
- package/src/pagination/paginators/PinnedMessagePaginator.ts +74 -28
- package/src/pagination/paginators/ReminderPaginator.ts +15 -13
- package/src/pagination/paginators/ThreadPaginator.ts +181 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +8 -1
- package/src/pagination/paginators/index.ts +1 -0
- package/src/pagination/utility.normalization.ts +37 -9
- package/src/poll.ts +189 -112
- package/src/poll_manager.ts +14 -8
- package/src/poll_optimistic_votes.ts +335 -0
- package/src/reminders/Reminder.ts +34 -16
- package/src/reminders/ReminderManager.ts +68 -41
- package/src/reminders/ReminderTimer.ts +7 -6
- package/src/search/BaseSearchSource.ts +133 -40
- package/src/search/ChannelMemberSearchSource.ts +27 -18
- package/src/search/ChannelSearchSource.ts +61 -7
- package/src/search/MessageSearchSource.ts +133 -28
- package/src/search/SearchController.ts +93 -16
- package/src/search/UserSearchSource.ts +27 -13
- package/src/search/types.ts +14 -1
- package/src/signing.ts +1 -315
- package/src/thread.ts +503 -511
- package/src/thread_manager.ts +339 -204
- package/src/token_manager.ts +12 -32
- package/src/types.ts +159 -780
- package/src/types.utility.ts +14 -0
- package/src/upload-utils.ts +53 -0
- package/src/uploadManager.ts +85 -7
- package/src/utils/FixedSizeQueueCache.ts +5 -0
- package/src/utils/WithSubscriptions.ts +1 -1
- package/src/utils/objectPath.ts +67 -0
- package/src/utils/time.ts +104 -0
- package/src/utils.ts +209 -157
- package/dist/types/base64.d.ts +0 -2
- package/dist/types/configuration/InstanceConfigurationService.d.ts +0 -26
- package/dist/types/connection.d.ts +0 -146
- package/dist/types/connection_fallback.d.ts +0 -42
- package/dist/types/gen/model-decoders/decoders.d.ts +0 -3
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +0 -6
- package/dist/types/insights.d.ts +0 -58
- package/dist/types/pagination/utility.queryChannel.d.ts +0 -26
- package/dist/types/permissions.d.ts +0 -55
- package/dist/types/store.d.ts +0 -125
- package/src/base64.ts +0 -78
- package/src/configuration/InstanceConfigurationService.ts +0 -73
- package/src/connection_fallback.ts +0 -215
- package/src/gen/model-decoders/decoders.ts +0 -2680
- package/src/gen/model-decoders/event-decoder-mapping.ts +0 -198
- package/src/insights.ts +0 -83
- package/src/pagination/utility.queryChannel.ts +0 -84
- package/src/permissions.ts +0 -102
- package/src/store.ts +0 -304
package/dist/types/client.d.ts
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import type { AxiosInstance
|
|
2
|
-
import { Channel } from './channel';
|
|
1
|
+
import type { AxiosInstance } from 'axios';
|
|
2
|
+
import type { Channel } from './channel';
|
|
3
|
+
import type { ChannelMuteStatus } from './channel_state';
|
|
3
4
|
import { ClientState } from './client_state';
|
|
4
|
-
import { StableWSConnection } from './connection';
|
|
5
5
|
import { UploadManager } from './uploadManager';
|
|
6
6
|
import { TokenManager, type TokenManagerMinimalUser } from './token_manager';
|
|
7
|
-
import { WSConnectionFallback } from './connection_fallback';
|
|
8
7
|
import { ApiClient } from './api-client';
|
|
9
|
-
import type { APIResponse, AppIdentifier,
|
|
10
|
-
import { InsightMetrics } from './insights';
|
|
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, StreamChatOptions, StreamRequestOptions, TimestampNS, TokenOrProvider, UnBanUserOptions, UserMuteResponse, UserResponse } from './types';
|
|
11
9
|
import { Thread } from './thread';
|
|
12
10
|
import { Moderation } from './moderation';
|
|
13
11
|
import { ThreadManager } from './thread_manager';
|
|
14
12
|
import { PollManager } from './poll_manager';
|
|
15
13
|
import { EntityStore } from './entityStore/EntityStore';
|
|
16
14
|
import { ChannelManager } from './ChannelManager';
|
|
15
|
+
import { ConnectionIdManager, ConnectionRecoveryManager, NetworkConnectionObserver, WSConnection } from './connection';
|
|
17
16
|
import { MessageDeliveryReporter } from './messageDelivery';
|
|
18
17
|
import { NotificationManager } from './notifications';
|
|
19
18
|
import { ReminderManager } from './reminders';
|
|
20
19
|
import type { AbstractOfflineDB } from './offline-support';
|
|
21
20
|
import { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
|
|
22
21
|
import type { MessageComposer } from './messageComposer';
|
|
23
|
-
import type {
|
|
24
|
-
import {
|
|
25
|
-
import { StateStore } from '
|
|
26
|
-
import type { GetApplicationResponse as Gen_GetApplicationResponse, MarkDeliveredRequest as Gen_MarkDeliveredRequest,
|
|
22
|
+
import type { InstanceSetupState } from './configuration';
|
|
23
|
+
import { InstanceConfigurationRegistry } from './configuration/InstanceConfigurationRegistry';
|
|
24
|
+
import { StateStore } from '@stream-io/state-store';
|
|
25
|
+
import type { FileUploadRequest, GetApplicationResponse as Gen_GetApplicationResponse, MarkDeliveredRequest as Gen_MarkDeliveredRequest, ImageUploadRequest, WSAuthMessage, WSEvent } from './gen/models';
|
|
27
26
|
import { ChatApi } from './gen-imports';
|
|
28
27
|
import type { StreamResponse } from './types';
|
|
29
28
|
export type QueryChannelsResponseWithChannels = Omit<QueryChannelsResponse, 'channels'> & {
|
|
@@ -38,6 +37,12 @@ export type ChannelConfigsState = {
|
|
|
38
37
|
export type ClientUser = PartializeAllBut<OwnUserResponse, 'id'> & {
|
|
39
38
|
anon?: boolean;
|
|
40
39
|
};
|
|
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;
|
|
41
46
|
export declare class StreamChat extends ChatApi {
|
|
42
47
|
private static _instance?;
|
|
43
48
|
messageDeliveryReporter: MessageDeliveryReporter;
|
|
@@ -50,9 +55,6 @@ export declare class StreamChat extends ChatApi {
|
|
|
50
55
|
*/
|
|
51
56
|
_user?: ClientUser;
|
|
52
57
|
appSettingsPromise?: Promise<StreamResponse<Gen_GetApplicationResponse>>;
|
|
53
|
-
activeChannels: {
|
|
54
|
-
[key: string]: Channel;
|
|
55
|
-
};
|
|
56
58
|
threads: ThreadManager;
|
|
57
59
|
polls: PollManager;
|
|
58
60
|
/**
|
|
@@ -67,6 +69,40 @@ export declare class StreamChat extends ChatApi {
|
|
|
67
69
|
* `removeEventHandlers`), which is also the only way to reconfigure it later.
|
|
68
70
|
*/
|
|
69
71
|
channelManager: ChannelManager;
|
|
72
|
+
/**
|
|
73
|
+
* Owns connection recovery: on reconnect it re-runs each loaded channel list's own first-page query
|
|
74
|
+
* and reloads each active channel, then dispatches `connection.recovered`. Instantiated with the
|
|
75
|
+
* client and subscribed for its lifetime.
|
|
76
|
+
*
|
|
77
|
+
* Turn it off through the declarative configuration if the application recovers state itself:
|
|
78
|
+
* `client.config.set({ client: { connectionRecovery: { enabled: false } } })`.
|
|
79
|
+
*/
|
|
80
|
+
connectionRecovery: ConnectionRecoveryManager;
|
|
81
|
+
/**
|
|
82
|
+
* The device's own network status — whether this machine has a network at all, which is a different
|
|
83
|
+
* fact from whether our WebSocket is up ({@link wsConnection}). The two disagree routinely: a
|
|
84
|
+
* socket dies on a working network (server close, expired token, health-check timeout), and a
|
|
85
|
+
* device goes offline while the socket has not noticed yet.
|
|
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.
|
|
95
|
+
*/
|
|
96
|
+
networkConnection: NetworkConnectionObserver;
|
|
97
|
+
/**
|
|
98
|
+
* The connection id — the WebSocket's, or the long-poll's after an `enableWSFallback`
|
|
99
|
+
* switch — and the one place the rest of the client reads it from.
|
|
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`.
|
|
104
|
+
*/
|
|
105
|
+
connectionIdManager: ConnectionIdManager;
|
|
70
106
|
/**
|
|
71
107
|
* Client-global, normalized store holding one canonical copy of each message. The channel main
|
|
72
108
|
* list and thread reply paginators read/write message content through it, so a message held in
|
|
@@ -80,20 +116,10 @@ export declare class StreamChat extends ChatApi {
|
|
|
80
116
|
axiosInstance: AxiosInstance;
|
|
81
117
|
baseURL?: string;
|
|
82
118
|
browser: boolean;
|
|
83
|
-
cleaningIntervalRef?:
|
|
119
|
+
cleaningIntervalRef?: ReturnType<typeof setTimeout>;
|
|
84
120
|
clientId?: string;
|
|
85
121
|
key: string;
|
|
86
122
|
listeners: Map<EventType, Set<EventHandler>>;
|
|
87
|
-
/**
|
|
88
|
-
* When network is recovered, we re-query the active channels on client. But in single query, you can recover
|
|
89
|
-
* only 30 channels. So its not guaranteed that all the channels in activeChannels object have updated state.
|
|
90
|
-
* Thus in UI sdks, state recovery is managed by components themselves, they don't rely on js client for this.
|
|
91
|
-
*
|
|
92
|
-
* `recoverStateOnReconnect` parameter can be used in such cases, to disable state recovery within js client.
|
|
93
|
-
* When false, user/consumer of this client will need to make sure all the channels present on UI by
|
|
94
|
-
* manually calling queryChannels endpoint.
|
|
95
|
-
*/
|
|
96
|
-
recoverStateOnReconnect?: boolean;
|
|
97
123
|
/**
|
|
98
124
|
* If true, we will not clean up threads when channel state is in initializing state.
|
|
99
125
|
* The main use case for SDKs who do independent state recovery for channels.
|
|
@@ -104,7 +130,17 @@ export declare class StreamChat extends ChatApi {
|
|
|
104
130
|
readonly mutedUsersStore: StateStore<{
|
|
105
131
|
mutedUsers: UserMuteResponse[];
|
|
106
132
|
}>;
|
|
107
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Reactive store behind {@link channelServerConfigs}. The only reactive way to observe server channel
|
|
135
|
+
* configuration today, which is why `stream-chat-react` reads it — a public, per-channel feature
|
|
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}.
|
|
140
|
+
*
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
readonly channelServerConfigsStore: StateStore<ChannelConfigsState>;
|
|
108
144
|
blockedUsers: StateStore<BlockedUsersState>;
|
|
109
145
|
node: boolean;
|
|
110
146
|
options: StreamChatOptions;
|
|
@@ -114,9 +150,12 @@ export declare class StreamChat extends ChatApi {
|
|
|
114
150
|
user?: ClientUser;
|
|
115
151
|
userAgent?: string;
|
|
116
152
|
wsBaseURL?: string;
|
|
117
|
-
wsConnection:
|
|
118
|
-
wsFallback?: WSConnectionFallback;
|
|
153
|
+
wsConnection: WSConnection;
|
|
119
154
|
wsPromise: ConnectAPIResponse | null;
|
|
155
|
+
private _wsPromiseSettled;
|
|
156
|
+
private _wsConnectId;
|
|
157
|
+
private _resolveWsPromise?;
|
|
158
|
+
private _rejectWsPromise?;
|
|
120
159
|
get anonymous(): boolean;
|
|
121
160
|
get userId(): string | undefined;
|
|
122
161
|
/**
|
|
@@ -129,16 +168,21 @@ export declare class StreamChat extends ChatApi {
|
|
|
129
168
|
get clientID(): string | undefined;
|
|
130
169
|
set clientID(id: string | undefined);
|
|
131
170
|
get api(): ApiClient;
|
|
132
|
-
insightMetrics: InsightMetrics;
|
|
133
|
-
defaultWSTimeoutWithFallback: number;
|
|
134
|
-
defaultWSTimeout: number;
|
|
135
171
|
sdkIdentifier?: SdkIdentifier;
|
|
136
172
|
deviceIdentifier?: DeviceIdentifier;
|
|
137
173
|
appIdentifier?: AppIdentifier;
|
|
138
174
|
private cachedUserAgent?;
|
|
139
175
|
readonly messageComposerCache: FixedSizeQueueCache<string, MessageComposer>;
|
|
140
|
-
|
|
141
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Configuration you register for instances the SDK creates on your behalf — channels, threads,
|
|
178
|
+
* composers, and the client's own managers. See `InstanceConfigurationRegistry`.
|
|
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.
|
|
182
|
+
*/
|
|
183
|
+
readonly config: InstanceConfigurationRegistry;
|
|
184
|
+
/** Teardown for the `'client'` setup function, released by {@link disconnectUser}. */
|
|
185
|
+
private unsubscribeClientConfiguration?;
|
|
142
186
|
/**
|
|
143
187
|
* Initializes a client.
|
|
144
188
|
*
|
|
@@ -146,25 +190,65 @@ export declare class StreamChat extends ChatApi {
|
|
|
146
190
|
*
|
|
147
191
|
* @example <caption>initialize the client in user mode</caption>
|
|
148
192
|
* new StreamChat('api_key')
|
|
149
|
-
* @example <caption>initialize the client
|
|
150
|
-
* new StreamChat('api_key', {
|
|
151
|
-
* @example <caption>secret is optional and only used in server side mode</caption>
|
|
152
|
-
* new StreamChat('api_key', 'secret', { httpsAgent: customAgent })
|
|
193
|
+
* @example <caption>initialize the client with options</caption>
|
|
194
|
+
* new StreamChat('api_key', { axiosRequestConfig: { timeout: 5000 } })
|
|
153
195
|
*
|
|
154
196
|
* @param key - The API key.
|
|
155
|
-
* @param options - Additional options
|
|
197
|
+
* @param options - Additional options (optional).
|
|
156
198
|
* @param options.browser - Enforce the client to be in browser mode (optional).
|
|
157
|
-
* @param options.
|
|
158
|
-
*
|
|
159
|
-
* @param options.logOptions - Per-scope sink/level overrides for `chatLoggerSystem` (optional).
|
|
160
|
-
* @param options.timeout - Request timeout (optional, defaults to `3000`).
|
|
161
|
-
* @param options.httpsAgent - Custom `httpsAgent` (optional, in Node defaults to `https.agent()`).
|
|
199
|
+
* @param options.axiosRequestConfig - Axios-level request configuration such as `timeout`,
|
|
200
|
+
* `headers` or `httpsAgent`, spread into the client's axios instance (optional).
|
|
162
201
|
*/
|
|
163
202
|
constructor(key: string, options?: StreamChatOptions);
|
|
203
|
+
/**
|
|
204
|
+
* Subscribes the client's managers to the `'client'` configuration key.
|
|
205
|
+
*
|
|
206
|
+
* Called by the constructor and again by {@link _setUser}, because {@link disconnectUser} releases this
|
|
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`.
|
|
215
|
+
*/
|
|
216
|
+
private wireClientConfiguration;
|
|
217
|
+
/**
|
|
218
|
+
* Derives each manager's configuration from package defaults plus the `client` declarative subtree.
|
|
219
|
+
* Shared by the constructor and `config.reset()`, so the two cannot drift.
|
|
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.
|
|
226
|
+
*/
|
|
227
|
+
private initializeManagerConfig;
|
|
164
228
|
get mutedUsers(): UserMuteResponse[];
|
|
165
229
|
set mutedUsers(mutedUsers: UserMuteResponse[]);
|
|
166
|
-
|
|
167
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Cache of server-provided channel configuration, keyed by **cid** — a channel's own
|
|
232
|
+
* `config_overrides` can make it differ from every other channel of its type, so one entry per
|
|
233
|
+
* channel is the only key space that can represent the answer. See {@link _addChannelConfig}.
|
|
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}.
|
|
246
|
+
*
|
|
247
|
+
* @internal
|
|
248
|
+
*/
|
|
249
|
+
get channelServerConfigs(): Configs;
|
|
250
|
+
/** @internal */
|
|
251
|
+
set channelServerConfigs(configs: Configs);
|
|
168
252
|
/**
|
|
169
253
|
* Returns a client instance.
|
|
170
254
|
*
|
|
@@ -174,19 +258,14 @@ export declare class StreamChat extends ChatApi {
|
|
|
174
258
|
*
|
|
175
259
|
* @example <caption>initialize the client in user mode</caption>
|
|
176
260
|
* StreamChat.getInstance('api_key')
|
|
177
|
-
* @example <caption>initialize the client
|
|
178
|
-
* StreamChat.getInstance('api_key', { timeout: 5000 })
|
|
179
|
-
* @example <caption>secret is optional and only used in server side mode</caption>
|
|
180
|
-
* StreamChat.getInstance('api_key', 'secret', { httpsAgent: customAgent })
|
|
261
|
+
* @example <caption>initialize the client with options</caption>
|
|
262
|
+
* StreamChat.getInstance('api_key', { axiosRequestConfig: { timeout: 5000 } })
|
|
181
263
|
*
|
|
182
264
|
* @param key - The API key.
|
|
183
|
-
* @param options - Additional options
|
|
265
|
+
* @param options - Additional options (optional).
|
|
184
266
|
* @param options.browser - Enforce the client to be in browser mode (optional).
|
|
185
|
-
* @param options.
|
|
186
|
-
*
|
|
187
|
-
* @param options.logOptions - Per-scope sink/level overrides for `chatLoggerSystem` (optional).
|
|
188
|
-
* @param options.timeout - Request timeout (optional, defaults to `3000`).
|
|
189
|
-
* @param options.httpsAgent - Custom `httpsAgent` (optional, in Node defaults to `https.agent()`).
|
|
267
|
+
* @param options.axiosRequestConfig - Axios-level request configuration such as `timeout`,
|
|
268
|
+
* `headers` or `httpsAgent`, spread into the client's axios instance (optional).
|
|
190
269
|
* @returns The shared client instance.
|
|
191
270
|
*/
|
|
192
271
|
static getInstance(key: string, options?: StreamChatOptions): StreamChat;
|
|
@@ -195,8 +274,10 @@ export declare class StreamChat extends ChatApi {
|
|
|
195
274
|
setBaseURL(baseURL: string): void;
|
|
196
275
|
_getConnectionID: () => string | undefined;
|
|
197
276
|
_hasConnectionID: () => boolean;
|
|
198
|
-
|
|
199
|
-
|
|
277
|
+
/**
|
|
278
|
+
* @deprecated Use `client.config.setSetupFunction('messageComposer', fn)`.
|
|
279
|
+
*/
|
|
280
|
+
setMessageComposerSetupFunction: (setupFunction: InstanceSetupState<"messageComposer">["setupFunction"]) => void;
|
|
200
281
|
/**
|
|
201
282
|
* Sets the current user and opens a WebSocket connection.
|
|
202
283
|
*
|
|
@@ -204,9 +285,7 @@ export declare class StreamChat extends ChatApi {
|
|
|
204
285
|
* @param userTokenOrProvider - A token string or an async provider that returns one.
|
|
205
286
|
* @returns A promise that resolves when the connection is set up.
|
|
206
287
|
*/
|
|
207
|
-
connectUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | (
|
|
208
|
-
type: "health.check";
|
|
209
|
-
} & import(".").HealthCheckEvent)>;
|
|
288
|
+
connectUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
|
|
210
289
|
/**
|
|
211
290
|
* Sets the current user and opens a WebSocket connection.
|
|
212
291
|
*
|
|
@@ -216,9 +295,7 @@ export declare class StreamChat extends ChatApi {
|
|
|
216
295
|
* @param userTokenOrProvider - A token string or an async provider that returns one.
|
|
217
296
|
* @returns A promise that resolves when the connection is set up.
|
|
218
297
|
*/
|
|
219
|
-
setUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | (
|
|
220
|
-
type: "health.check";
|
|
221
|
-
} & import(".").HealthCheckEvent)>;
|
|
298
|
+
setUser: (user: ClientUser, userTokenOrProvider: TokenOrProvider) => Promise<void | import("./types").ConnectionOpen>;
|
|
222
299
|
_setToken: (user: TokenManagerMinimalUser, userTokenOrProvider: TokenOrProvider) => Promise<void>;
|
|
223
300
|
_setUser(user: TokenManagerMinimalUser): void;
|
|
224
301
|
/**
|
|
@@ -231,29 +308,49 @@ export declare class StreamChat extends ChatApi {
|
|
|
231
308
|
* So when your app goes to background, you can call `client.closeConnection`.
|
|
232
309
|
* And when app comes back to foreground, call `client.openConnection`.
|
|
233
310
|
*
|
|
311
|
+
* After an `enableWSFallback` switch it closes the long-poll as well, telling the server to
|
|
312
|
+
* close its connection id.
|
|
313
|
+
*
|
|
234
314
|
* @param timeout - Max number of milliseconds to wait for the WebSocket close event before forcefully assuming
|
|
235
315
|
* successful disconnection. See https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent (optional).
|
|
316
|
+
* The long-poll's close request uses it as its timeout (2s when omitted).
|
|
236
317
|
*/
|
|
237
318
|
closeConnection: (timeout?: number) => Promise<void>;
|
|
238
319
|
/**
|
|
239
|
-
* Creates a new WebSocket connection with the current user.
|
|
320
|
+
* Creates a new WebSocket connection with the current user. After an `enableWSFallback` switch it
|
|
321
|
+
* reconnects the long-poll instead: the client never goes back to the WebSocket.
|
|
240
322
|
*
|
|
241
323
|
* @returns The WebSocket connect promise, or an empty resolved promise if a connection is already active.
|
|
242
324
|
*/
|
|
243
325
|
openConnection: () => ConnectAPIResponse | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* Rejects the shared `wsPromise`, invalidates any in-flight connect attempt
|
|
328
|
+
*/
|
|
329
|
+
private _rejectPendingWsPromise;
|
|
330
|
+
/**
|
|
331
|
+
* Keep a single pending `wsPromise` across close/reopen so callers that already
|
|
332
|
+
* `await this.wsPromise` are not stranded when `openConnection` starts a new connect.
|
|
333
|
+
*/
|
|
334
|
+
private _bindWsPromise;
|
|
244
335
|
/**
|
|
245
336
|
* Revokes tokens for a connected user issued before the given time.
|
|
246
337
|
*
|
|
247
338
|
* @param before - Cutoff date; tokens issued before this are revoked (optional, defaults to the current time).
|
|
339
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
340
|
+
* into the request (optional).
|
|
248
341
|
* @returns The updated users response.
|
|
249
342
|
*/
|
|
250
|
-
revokeTokens(before?: Date | null): Promise<StreamResponse<import(".").UpdateUsersResponse>>;
|
|
343
|
+
revokeTokens(before?: Date | null, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateUsersResponse>>;
|
|
251
344
|
/**
|
|
252
345
|
* Retrieves application settings.
|
|
253
346
|
*
|
|
347
|
+
* @param _request - Unused. Holds the request position so `requestOptions` stays the
|
|
348
|
+
* second argument, as on the generated methods; pass `undefined`.
|
|
349
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
350
|
+
* into the request (optional).
|
|
254
351
|
* @returns The application settings response.
|
|
255
352
|
*/
|
|
256
|
-
getAppSettings(): Promise<StreamResponse<Gen_GetApplicationResponse>>;
|
|
353
|
+
getAppSettings(_request?: Record<string, never>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<Gen_GetApplicationResponse>>;
|
|
257
354
|
/**
|
|
258
355
|
* Disconnects the WebSocket and removes the user from client.
|
|
259
356
|
*
|
|
@@ -275,15 +372,22 @@ export declare class StreamChat extends ChatApi {
|
|
|
275
372
|
* @returns A promise that resolves when the connection is set up.
|
|
276
373
|
*/
|
|
277
374
|
connectAnonymousUser: () => ConnectAPIResponse | undefined;
|
|
375
|
+
/**
|
|
376
|
+
* Creates a guest user and returns its access token.
|
|
377
|
+
*
|
|
378
|
+
* @param args - The guest creation request, plus optional per-request options.
|
|
379
|
+
* @returns The created guest user and its access token.
|
|
380
|
+
*/
|
|
381
|
+
createGuest(...args: Parameters<ChatApi['createGuest']>): Promise<StreamResponse<import(".").CreateGuestResponse>>;
|
|
278
382
|
/**
|
|
279
383
|
* Sets up a temporary guest user.
|
|
280
384
|
*
|
|
281
385
|
* @param user - Data about this user, e.g. `{ name: 'john' }`.
|
|
386
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
387
|
+
* into the request (optional).
|
|
282
388
|
* @returns A promise that resolves when the connection is set up.
|
|
283
389
|
*/
|
|
284
|
-
setGuestUser(user: UserResponse): Promise<void | (
|
|
285
|
-
type: "health.check";
|
|
286
|
-
} & import(".").HealthCheckEvent)>;
|
|
390
|
+
setGuestUser(user: UserResponse, requestOptions?: StreamRequestOptions): Promise<void | import("./types").ConnectionOpen>;
|
|
287
391
|
/**
|
|
288
392
|
* Listens to events on all channels and users you're watching.
|
|
289
393
|
*
|
|
@@ -317,18 +421,27 @@ export declare class StreamChat extends ChatApi {
|
|
|
317
421
|
off(eventType: string, callback: EventHandler): void;
|
|
318
422
|
dispatchEvent: (event: Event) => void;
|
|
319
423
|
/**
|
|
320
|
-
*
|
|
424
|
+
* Puts `user`'s new object into the members, watchers, own membership and (with `readEntries`)
|
|
425
|
+
* read entries of the channels that list them. Each channel gets new objects in one state update,
|
|
426
|
+
* so its subscribers re-render.
|
|
321
427
|
*
|
|
322
428
|
* @param user - The updated user.
|
|
429
|
+
* @param options.readEntries - Also replace the user in read entries, refreshing the read receipts
|
|
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.
|
|
323
432
|
*/
|
|
324
|
-
_updateMemberWatcherReferences: (user: UserResponse
|
|
433
|
+
_updateMemberWatcherReferences: (user: UserResponse, { readEntries }?: {
|
|
434
|
+
readEntries?: boolean;
|
|
435
|
+
}) => void;
|
|
325
436
|
/**
|
|
326
437
|
* @deprecated Please use `_updateMemberWatcherReferences` instead.
|
|
327
438
|
* @private
|
|
328
439
|
*/
|
|
329
|
-
_updateUserReferences: (user: UserResponse
|
|
440
|
+
_updateUserReferences: (user: UserResponse, { readEntries }?: {
|
|
441
|
+
readEntries?: boolean;
|
|
442
|
+
}) => void;
|
|
330
443
|
/**
|
|
331
|
-
* Updates the messages from the
|
|
444
|
+
* Updates the messages from the loaded channels that contain this user, with the updated user object.
|
|
332
445
|
*
|
|
333
446
|
* @private
|
|
334
447
|
*
|
|
@@ -336,7 +449,7 @@ export declare class StreamChat extends ChatApi {
|
|
|
336
449
|
*/
|
|
337
450
|
_updateUserMessageReferences: (user: UserResponse) => void;
|
|
338
451
|
/**
|
|
339
|
-
* Deletes the messages from the
|
|
452
|
+
* Deletes the messages from the loaded channels that contain this user.
|
|
340
453
|
*
|
|
341
454
|
* If `hardDelete` is `true`, all the content of the message will be stripped down.
|
|
342
455
|
* Otherwise, only `message.type` will be set as `'deleted'`.
|
|
@@ -362,52 +475,53 @@ export declare class StreamChat extends ChatApi {
|
|
|
362
475
|
type: "user.presence.changed" | "user.updated" | "user.deleted";
|
|
363
476
|
}>) => void;
|
|
364
477
|
_handleClientEvent(event: WSEvent): (() => void)[];
|
|
365
|
-
_muteStatus(cid: string):
|
|
366
|
-
muted: boolean;
|
|
367
|
-
createdAt: Date;
|
|
368
|
-
expiresAt: Date | null;
|
|
369
|
-
} | {
|
|
370
|
-
muted: boolean;
|
|
371
|
-
createdAt: null;
|
|
372
|
-
expiresAt: null;
|
|
373
|
-
};
|
|
478
|
+
_muteStatus(cid: string): ChannelMuteStatus;
|
|
374
479
|
_callClientListeners: (event: Event) => void;
|
|
375
|
-
recoverState: () => Promise<void>;
|
|
376
480
|
/**
|
|
377
|
-
*
|
|
481
|
+
* Settles the connect promises after a successful reconnect, so `connectUser()` and the
|
|
482
|
+
* `wsPromise`/`setUserPromise` a caller may still be holding stop resolving against a superseded
|
|
483
|
+
* (possibly rejected) attempt.
|
|
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.
|
|
493
|
+
*
|
|
494
|
+
* @internal
|
|
378
495
|
*/
|
|
379
|
-
|
|
380
|
-
type: "health.check";
|
|
381
|
-
} & import(".").HealthCheckEvent)>;
|
|
496
|
+
_settleConnectPromises: () => void;
|
|
382
497
|
/**
|
|
383
|
-
* Checks connectivity with the server for warmup purposes.
|
|
384
|
-
*
|
|
385
498
|
* @private
|
|
386
499
|
*/
|
|
387
|
-
|
|
500
|
+
connect(): Promise<void | import("./types").ConnectionOpen>;
|
|
388
501
|
/**
|
|
389
502
|
* Queries users and watches user presence.
|
|
390
503
|
*
|
|
391
|
-
* @param
|
|
504
|
+
* @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts
|
|
392
505
|
* MongoDB-style filter conditions, sort directions (e.g. `[{ field: 'last_active', direction: -1 }]`),
|
|
393
|
-
* and options such as `presence`.
|
|
506
|
+
* and options such as `presence`. `requestOptions` carries per-request options such as an
|
|
507
|
+
* abort `signal` and is never serialized into the request.
|
|
394
508
|
* @returns The user query response.
|
|
395
509
|
*/
|
|
396
|
-
queryUsers(
|
|
397
|
-
payload?: Gen_QueryUsersPayload;
|
|
398
|
-
}): Promise<StreamResponse<import(".").QueryUsersResponse>>;
|
|
510
|
+
queryUsers(...args: Parameters<ChatApi['queryUsers']>): Promise<StreamResponse<import(".").QueryUsersResponse>>;
|
|
399
511
|
/**
|
|
400
|
-
*
|
|
512
|
+
* Stops watching a channel on this client's connection.
|
|
401
513
|
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
*
|
|
514
|
+
* It carries no `watch` flag, so the request layer does not hold it, but it is connection-scoped
|
|
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
|
|
518
|
+
* established.
|
|
519
|
+
*
|
|
520
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams` identifies the channel
|
|
521
|
+
* (`{ type, id }`); `request.connection_id` is replaced by this client's connection id.
|
|
522
|
+
* @returns The server response.
|
|
407
523
|
*/
|
|
408
|
-
|
|
409
|
-
payload?: QueryBannedUsersPayload;
|
|
410
|
-
}): Promise<StreamResponse<import(".").QueryBannedUsersResponse>>;
|
|
524
|
+
stopWatchingChannel(...args: Parameters<ChatApi['stopWatchingChannel']>): Promise<StreamResponse<import(".").Response>>;
|
|
411
525
|
/**
|
|
412
526
|
* Queries channels and returns the full API response including top-level metadata such as
|
|
413
527
|
* `predefined_filter`.
|
|
@@ -417,12 +531,13 @@ export declare class StreamChat extends ChatApi {
|
|
|
417
531
|
* only the channel list. In the next major release, the request/response APIs should
|
|
418
532
|
* be consolidated so callers can access the full response through the primary API.
|
|
419
533
|
*
|
|
420
|
-
* @param
|
|
421
|
-
* conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and
|
|
422
|
-
* such as `predefined_filter`, `filter_values`, and `sort_values`.
|
|
534
|
+
* @param ...args - `[request, requestOptions]`. The optional `request` accepts MongoDB-style
|
|
535
|
+
* filter conditions, sort directions (e.g. `[{ field: 'created_at', direction: -1 }]`), and
|
|
536
|
+
* options such as `predefined_filter`, `filter_values`, and `sort_values`. `requestOptions`
|
|
537
|
+
* carries per-request options such as an abort `signal` and is never serialized into the request.
|
|
423
538
|
* @returns The full query channels response.
|
|
424
539
|
*/
|
|
425
|
-
queryChannels(
|
|
540
|
+
queryChannels(...args: Parameters<ChatApi['queryChannels']>): Promise<StreamResponse<QueryChannelsResponse>>;
|
|
426
541
|
/**
|
|
427
542
|
* Queries channels and hydrates them into `Channel` instances on this client.
|
|
428
543
|
*
|
|
@@ -442,99 +557,67 @@ export declare class StreamChat extends ChatApi {
|
|
|
442
557
|
* @param stateOptions.withResponse - Returns the full query response with hydrated channels.
|
|
443
558
|
* This is a compatibility bridge for internal callers that need response-level metadata while
|
|
444
559
|
* the default return value remains `Channel[]` (optional).
|
|
560
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
561
|
+
* into the request (optional).
|
|
445
562
|
* @returns The hydrated channel list, or the full response when `withResponse` is `true`.
|
|
446
563
|
*/
|
|
447
564
|
queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions & {
|
|
448
565
|
withResponse: true;
|
|
449
|
-
}): Promise<QueryChannelsResponseWithChannels>;
|
|
450
|
-
queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions): Promise<Channel[]>;
|
|
566
|
+
}, requestOptions?: StreamRequestOptions): Promise<QueryChannelsResponseWithChannels>;
|
|
567
|
+
queryChannelsAndHydrate(options?: QueryChannelsRequest, stateOptions?: ChannelStateOptions, requestOptions?: StreamRequestOptions): Promise<Channel[]>;
|
|
451
568
|
/**
|
|
452
569
|
* Queries reactions for a message and hydrates any cached offline reactions before the network
|
|
453
570
|
* request.
|
|
454
571
|
*
|
|
455
|
-
* @param
|
|
456
|
-
* MongoDB-style filters, sort directions (e.g.
|
|
457
|
-
* and pagination options
|
|
572
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.id` is the target message ID;
|
|
573
|
+
* `request` carries MongoDB-style filters, sort directions (e.g.
|
|
574
|
+
* `[{ field: 'created_at', direction: -1 }]`) and pagination options; `requestOptions` carries
|
|
575
|
+
* per-request options such as an abort `signal` and is never serialized into the request.
|
|
458
576
|
* @returns The query reactions response.
|
|
459
577
|
*/
|
|
460
|
-
queryReactionsAndHydrate(
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Queries messages.
|
|
464
|
-
*
|
|
465
|
-
* @param request - The search request payload (optional). The inner `payload` accepts
|
|
466
|
-
* MongoDB-style filter conditions, a search query, and options such as `user_id`.
|
|
467
|
-
* @returns The search messages response.
|
|
468
|
-
*/
|
|
469
|
-
search(request?: {
|
|
470
|
-
payload?: SearchPayload;
|
|
471
|
-
}): Promise<StreamResponse<import(".").SearchResponse>>;
|
|
472
|
-
/**
|
|
473
|
-
* Sets the device info for the current client. It will be sent via the WS connection automatically.
|
|
474
|
-
*
|
|
475
|
-
* @param device - The device object.
|
|
476
|
-
* @param device.id - Device ID.
|
|
477
|
-
* @param device.push_provider - The push provider.
|
|
478
|
-
*/
|
|
479
|
-
setLocalDevice(device: BaseDeviceFields): void;
|
|
480
|
-
_addChannelConfig({ cid, config }: ChannelResponse): void;
|
|
578
|
+
queryReactionsAndHydrate(...args: Parameters<ChatApi['queryReactions']>): Promise<StreamResponse<import(".").QueryReactionsResponse>>;
|
|
579
|
+
hydrateChannels(channelsFromApi?: ChannelStateResponseFields[], stateOptions?: ChannelStateOptions, queryChannelsOptions?: ChannelOptions, candidateIdsByCid?: Map<string, ReadonlySet<string>>): Channel[];
|
|
481
580
|
/**
|
|
482
|
-
* Returns
|
|
581
|
+
* Returns the channel with the given type, ID and custom data: a shorthand for
|
|
582
|
+
* {@link ChannelManager.ensure} (`client.channelManager.ensure({ type, id, data })`), so it returns
|
|
583
|
+
* the stored instance for the cid, or creates and stores it.
|
|
483
584
|
*
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
* i.e. `channel = client.channel('messaging', { members: ['tommaso', 'thierry'] })` then
|
|
488
|
-
* `await channel.create()` to assign an ID to the channel.
|
|
585
|
+
* To get a distinct channel between two or more users, leave out the ID and pass the members:
|
|
586
|
+
* `client.channel('messaging', { members: [{ user_id: 'tommaso' }, { user_id: 'thierry' }] })`.
|
|
587
|
+
* It has no ID until `channel.watch()`, `query()` or `create()` returns one.
|
|
489
588
|
*
|
|
490
589
|
* @param channelType - The channel type.
|
|
491
|
-
* @param channelIdOrCustom - The channel ID;
|
|
492
|
-
*
|
|
493
|
-
* @param custom -
|
|
494
|
-
* @returns The channel
|
|
590
|
+
* @param channelIdOrCustom - The channel ID; leave it out for a distinct channel created from
|
|
591
|
+
* members (optional).
|
|
592
|
+
* @param custom - Data for a new channel, e.g. `members` or `custom` (optional, defaults to `{}`).
|
|
593
|
+
* @returns The channel; initialize it with `channel.watch()`.
|
|
495
594
|
*/
|
|
496
|
-
channel(channelType: string, channelId?: string | null, custom?:
|
|
497
|
-
channel(channelType: string, custom?:
|
|
595
|
+
channel(channelType: string, channelId?: string | null, custom?: ChannelInput): Channel;
|
|
596
|
+
channel(channelType: string, custom?: ChannelInput): Channel;
|
|
498
597
|
/**
|
|
499
|
-
*
|
|
500
|
-
* channel based on member list instead of ID.
|
|
501
|
-
*
|
|
502
|
-
* If the channel already exists in `activeChannels` list, then we simply return it, since that
|
|
503
|
-
* means the same channel was already requested or created.
|
|
504
|
-
*
|
|
505
|
-
* Otherwise we create a new instance of Channel class and return it.
|
|
506
|
-
*
|
|
507
|
-
* @private
|
|
598
|
+
* Queries messages.
|
|
508
599
|
*
|
|
509
|
-
* @param
|
|
510
|
-
*
|
|
511
|
-
*
|
|
600
|
+
* @param ...args - `[request, requestOptions]`. The optional `request.payload` accepts
|
|
601
|
+
* MongoDB-style filter conditions, a search query, and options such as `user_id`.
|
|
602
|
+
* `requestOptions` carries per-request options such as an abort `signal` and is never
|
|
603
|
+
* serialized into the request.
|
|
604
|
+
* @returns The search messages response.
|
|
512
605
|
*/
|
|
513
|
-
|
|
606
|
+
search(...args: Parameters<ChatApi['search']>): Promise<StreamResponse<import(".").SearchResponse>>;
|
|
514
607
|
/**
|
|
515
|
-
*
|
|
608
|
+
* Caches one channel's server configuration, read through {@link Channel.serverConfig}.
|
|
516
609
|
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
610
|
+
* Keyed by **cid** rather than by channel type: a channel's own `config_overrides` narrow its type's
|
|
611
|
+
* settings for that channel alone, so two channels of one type can disagree.
|
|
519
612
|
*
|
|
520
|
-
*
|
|
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.
|
|
521
617
|
*
|
|
522
|
-
* @
|
|
523
|
-
*
|
|
524
|
-
* @param channelType - The channel type.
|
|
525
|
-
* @param channelId - The channel ID.
|
|
526
|
-
* @param custom - Custom data to attach to the channel.
|
|
527
|
-
* @returns The channel object; initialize it using `channel.watch()`.
|
|
528
|
-
*/
|
|
529
|
-
getChannelById: (channelType: string, channelId: string, custom: ChannelData) => Channel;
|
|
530
|
-
/**
|
|
531
|
-
* Bans a user from all channels.
|
|
532
|
-
*
|
|
533
|
-
* @param targetUserId - The user to ban.
|
|
534
|
-
* @param options - Ban options (optional).
|
|
535
|
-
* @returns The server response.
|
|
618
|
+
* @internal
|
|
536
619
|
*/
|
|
537
|
-
|
|
620
|
+
_addChannelConfig({ cid, config }: Pick<ChannelResponse, 'cid' | 'config'>): void;
|
|
538
621
|
/**
|
|
539
622
|
* Revoke a global ban for a user.
|
|
540
623
|
*
|
|
@@ -543,40 +626,9 @@ export declare class StreamChat extends ChatApi {
|
|
|
543
626
|
* @returns The server response.
|
|
544
627
|
*/
|
|
545
628
|
unbanUser(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
* @param targetUserId - The user to shadow ban.
|
|
550
|
-
* @param options - Ban options (optional).
|
|
551
|
-
* @returns The server response.
|
|
552
|
-
*/
|
|
553
|
-
shadowBan(targetUserId: string, options?: BanUserOptions): Promise<APIResponse>;
|
|
554
|
-
/**
|
|
555
|
-
* Revoke a global shadow ban for a user.
|
|
556
|
-
*
|
|
557
|
-
* @param targetUserId - The user to remove the shadow ban for.
|
|
558
|
-
* @param options - Unban options (optional).
|
|
559
|
-
* @returns The server response.
|
|
560
|
-
*/
|
|
561
|
-
removeShadowBan(targetUserId: string, options?: UnBanUserOptions): Promise<APIResponse>;
|
|
562
|
-
blockUser(blockedUserId: string): Promise<StreamResponse<import(".").BlockUsersResponse>>;
|
|
563
|
-
getBlockedUsers(): Promise<StreamResponse<import(".").GetBlockedUsersResponse>>;
|
|
564
|
-
unblockUser(blockedUserId: string): Promise<StreamResponse<import(".").UnblockUsersResponse>>;
|
|
565
|
-
/**
|
|
566
|
-
* Mutes a user.
|
|
567
|
-
*
|
|
568
|
-
* @param targetId - The user to mute.
|
|
569
|
-
* @param options - UserMuteResponse options (optional, defaults to `{}`).
|
|
570
|
-
* @returns The server response.
|
|
571
|
-
*/
|
|
572
|
-
muteUser(targetId: string, options?: MuteUserOptions): Promise<MuteUserResponse>;
|
|
573
|
-
/**
|
|
574
|
-
* Unmutes a user.
|
|
575
|
-
*
|
|
576
|
-
* @param targetId - The user to unmute.
|
|
577
|
-
* @returns The server response.
|
|
578
|
-
*/
|
|
579
|
-
unmuteUser(targetId: string): Promise<APIResponse>;
|
|
629
|
+
blockUser(blockedUserId: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").BlockUsersResponse>>;
|
|
630
|
+
getBlockedUsers(...args: Parameters<ChatApi['getBlockedUsers']>): Promise<StreamResponse<import(".").GetBlockedUsersResponse>>;
|
|
631
|
+
unblockUser(blockedUserId: string, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UnblockUsersResponse>>;
|
|
580
632
|
/**
|
|
581
633
|
* Checks whether a user is muted. Can be used after `connectUser()` is called.
|
|
582
634
|
*
|
|
@@ -584,55 +636,16 @@ export declare class StreamChat extends ChatApi {
|
|
|
584
636
|
* @returns `true` if the user is muted, otherwise `false`.
|
|
585
637
|
*/
|
|
586
638
|
userMuteStatus(targetId: string): boolean;
|
|
587
|
-
/**
|
|
588
|
-
* Flag a message.
|
|
589
|
-
*
|
|
590
|
-
* @param targetMessageId - The message to flag.
|
|
591
|
-
* @param options - Flag options (optional, defaults to `{}`).
|
|
592
|
-
* @param options.reason - Reason for flagging (optional).
|
|
593
|
-
* @returns The server response.
|
|
594
|
-
*/
|
|
595
|
-
flagMessage(targetMessageId: string, options?: {
|
|
596
|
-
reason?: string;
|
|
597
|
-
}): Promise<FlagMessageResponse>;
|
|
598
|
-
/**
|
|
599
|
-
* Flag a user.
|
|
600
|
-
*
|
|
601
|
-
* @param targetId - The user to flag.
|
|
602
|
-
* @param options - Flag options (optional, defaults to `{}`).
|
|
603
|
-
* @param options.reason - Reason for flagging (optional).
|
|
604
|
-
* @returns The server response.
|
|
605
|
-
*/
|
|
606
|
-
flagUser(targetId: string, options?: {
|
|
607
|
-
reason?: string;
|
|
608
|
-
}): Promise<FlagUserResponse>;
|
|
609
|
-
/**
|
|
610
|
-
* Unflag a message.
|
|
611
|
-
*
|
|
612
|
-
* @param targetMessageId - The message to unflag.
|
|
613
|
-
* @returns The server response.
|
|
614
|
-
*/
|
|
615
|
-
unflagMessage(targetMessageId: string): Promise<FlagMessageResponse>;
|
|
616
|
-
/**
|
|
617
|
-
* Unflag a user.
|
|
618
|
-
*
|
|
619
|
-
* @param targetId - The user to unflag.
|
|
620
|
-
* @returns The server response.
|
|
621
|
-
*/
|
|
622
|
-
unflagUser(targetId: string): Promise<FlagUserResponse>;
|
|
623
|
-
/**
|
|
624
|
-
* Unblocks a message blocked by automod.
|
|
625
|
-
*
|
|
626
|
-
* @param targetMessageId - The message to unblock.
|
|
627
|
-
* @returns The server response.
|
|
628
|
-
*/
|
|
629
|
-
unblockMessage(targetMessageId: string): Promise<APIResponse>;
|
|
630
639
|
/**
|
|
631
640
|
* Transforms an expiration value into an ISO string.
|
|
632
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
|
+
*
|
|
633
645
|
* @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
|
|
634
646
|
* in seconds, `string` or `Date` to set the exact expiration date (optional).
|
|
635
647
|
* @returns The expiration as an ISO string, or `null`.
|
|
648
|
+
* @throws If a numeric offset does not resolve to a representable date.
|
|
636
649
|
*/
|
|
637
650
|
_normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
|
|
638
651
|
/**
|
|
@@ -648,42 +661,44 @@ export declare class StreamChat extends ChatApi {
|
|
|
648
661
|
/**
|
|
649
662
|
* Pins the message.
|
|
650
663
|
*
|
|
664
|
+
* A `number` is a relative offset in SECONDS, so a server-sent timestamp (`message.pinned_at`,
|
|
665
|
+
* `message.pin_expires`) is rejected at compile time rather than read as ~1.79e18 seconds from now.
|
|
666
|
+
* Hand one back as a date with `nsToDate(timestamp)`.
|
|
667
|
+
*
|
|
651
668
|
* @param messageOrMessageId - MessageRequest object or message ID.
|
|
652
669
|
* @param timeoutOrExpirationDate - Expiration date or timeout. Use `number` to set the timeout
|
|
653
670
|
* in seconds, `string` or `Date` to set the exact expiration date (optional).
|
|
654
671
|
* @param pinnedAt - Date when the message should be pinned. It affects the order of pinned
|
|
655
672
|
* messages. Use a negative number to set relative time in the past, `string` or `Date` to
|
|
656
673
|
* set the exact date of pin (optional).
|
|
674
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
675
|
+
* into the request (optional).
|
|
657
676
|
* @returns The updated message response.
|
|
658
677
|
*/
|
|
659
|
-
pinMessage(messageOrMessageId: string | {
|
|
678
|
+
pinMessage<Expiration extends null | number | string | Date | undefined = undefined, PinnedAt extends number | string | Date | undefined = undefined>(messageOrMessageId: string | {
|
|
660
679
|
id: string;
|
|
661
|
-
}, timeoutOrExpirationDate?:
|
|
680
|
+
}, timeoutOrExpirationDate?: NotATimestampNS<Expiration>, pinnedAt?: NotATimestampNS<PinnedAt>, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
|
|
662
681
|
/**
|
|
663
682
|
* Unpins the message that was previously pinned.
|
|
664
683
|
*
|
|
665
684
|
* @param messageOrMessageId - MessageRequest object or message ID.
|
|
685
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
686
|
+
* into the request (optional).
|
|
666
687
|
* @returns The updated message response.
|
|
667
688
|
*/
|
|
668
689
|
unpinMessage(messageOrMessageId: string | {
|
|
669
690
|
id: string;
|
|
670
|
-
}): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
|
|
691
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").UpdateMessagePartialResponse>>;
|
|
671
692
|
/**
|
|
672
|
-
* Updates the given message
|
|
673
|
-
*
|
|
693
|
+
* Updates the given message — the HTTP request and nothing else: no offline queueing and no local
|
|
694
|
+
* state. `messageOperations.update` on a channel or thread is the full edit.
|
|
674
695
|
*/
|
|
675
|
-
updateMessage(
|
|
676
|
-
message: {
|
|
677
|
-
cid?: string;
|
|
678
|
-
};
|
|
679
|
-
}): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
|
|
680
|
-
_updateMessage(request: Parameters<ChatApi['updateMessage']>[0]): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
|
|
696
|
+
updateMessage(...args: Parameters<ChatApi['updateMessage']>): Promise<StreamResponse<import(".").UpdateMessageResponse>>;
|
|
681
697
|
/**
|
|
682
|
-
* Deletes a message
|
|
683
|
-
* is
|
|
698
|
+
* Deletes a message — the HTTP request and nothing else: no offline queueing and no local state.
|
|
699
|
+
* `messageOperations.delete` on a channel or thread is the full delete.
|
|
684
700
|
*/
|
|
685
|
-
deleteMessage(
|
|
686
|
-
_deleteMessage(request: Parameters<ChatApi['deleteMessage']>[0]): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
|
|
701
|
+
deleteMessage(...args: Parameters<ChatApi['deleteMessage']>): Promise<StreamResponse<import(".").DeleteMessageResponse>>;
|
|
687
702
|
/**
|
|
688
703
|
* Returns the list of threads of the current user.
|
|
689
704
|
*
|
|
@@ -695,9 +710,11 @@ export declare class StreamChat extends ChatApi {
|
|
|
695
710
|
* @param options.reply_limit - Limits the number of replies returned per thread (optional).
|
|
696
711
|
* @param options.filter - MongoDB style filters for threads (optional).
|
|
697
712
|
* @param options.sort - MongoDB style sort for threads (optional).
|
|
713
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
714
|
+
* into the request (optional).
|
|
698
715
|
* @returns The list of threads and the next cursor.
|
|
699
716
|
*/
|
|
700
|
-
queryThreadsAndHydrate(options?: QueryThreadsRequest): Promise<{
|
|
717
|
+
queryThreadsAndHydrate(options?: QueryThreadsRequest, requestOptions?: StreamRequestOptions): Promise<{
|
|
701
718
|
threads: Thread[];
|
|
702
719
|
next: string | undefined;
|
|
703
720
|
}>;
|
|
@@ -710,17 +727,11 @@ export declare class StreamChat extends ChatApi {
|
|
|
710
727
|
* @param options.watch - Subscribes the user to the channel of the thread (optional).
|
|
711
728
|
* @param options.participant_limit - Limits the number of participants returned per thread (optional).
|
|
712
729
|
* @param options.reply_limit - Limits the number of replies returned per thread (optional).
|
|
730
|
+
* @param requestOptions - Per-request options such as an abort `signal`. Never serialized
|
|
731
|
+
* into the request (optional).
|
|
713
732
|
* @returns The thread.
|
|
714
733
|
*/
|
|
715
|
-
getThreadAndHydrate(messageId: string, options?: GetThreadOptions): Promise<Thread>;
|
|
716
|
-
/**
|
|
717
|
-
* Updates the given thread.
|
|
718
|
-
*
|
|
719
|
-
* @param messageId - The ID of the thread message which needs to be updated.
|
|
720
|
-
* @param partialThreadObject - Should contain `set` or `unset` params for any of the thread's non-reserved fields.
|
|
721
|
-
* @returns The updated thread.
|
|
722
|
-
*/
|
|
723
|
-
partialUpdateThread(messageId: string, partialThreadObject: PartialThreadUpdate): Promise<StreamResponse<import(".").UpdateThreadPartialResponse>>;
|
|
734
|
+
getThreadAndHydrate(messageId: string, options?: GetThreadOptions, requestOptions?: StreamRequestOptions): Promise<Thread>;
|
|
724
735
|
getUserAgent: () => string;
|
|
725
736
|
/**
|
|
726
737
|
* Sets the user agent string.
|
|
@@ -730,55 +741,64 @@ export declare class StreamChat extends ChatApi {
|
|
|
730
741
|
* @param userAgent - The user agent string.
|
|
731
742
|
*/
|
|
732
743
|
setUserAgent(userAgent: string): void;
|
|
733
|
-
_cacheEnabled: () => boolean;
|
|
734
744
|
_startCleaning(): void;
|
|
735
745
|
/**
|
|
736
|
-
* Encodes the
|
|
746
|
+
* Encodes the WebSocket auth message, sent as the first frame once the socket opens.
|
|
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.
|
|
750
|
+
*
|
|
751
|
+
* @private
|
|
752
|
+
*
|
|
753
|
+
* @returns The JSON-encoded auth message.
|
|
754
|
+
*/
|
|
755
|
+
_buildWSAuthMessage: () => string;
|
|
756
|
+
/**
|
|
757
|
+
* The auth message itself — what {@link _buildWSAuthMessage} encodes for the WebSocket, and what
|
|
758
|
+
* the long-poll fallback sends as `longPoll()`'s `json` query param.
|
|
737
759
|
*
|
|
738
760
|
* @private
|
|
739
761
|
*
|
|
740
|
-
* @param
|
|
741
|
-
*
|
|
762
|
+
* @param token - The token the message carries. The long-poll passes none: it authenticates
|
|
763
|
+
* through the request's `Authorization` header instead.
|
|
742
764
|
*/
|
|
743
|
-
|
|
765
|
+
_buildWSAuthPayload: (token?: string) => WSAuthMessage;
|
|
744
766
|
/**
|
|
745
767
|
* Queries poll answers.
|
|
746
768
|
*
|
|
747
|
-
* @param
|
|
748
|
-
* filter conditions, sort directions, and pagination options
|
|
749
|
-
*
|
|
750
|
-
* @param request.filter - Vote filter conditions.
|
|
769
|
+
* @param ...args - `[pathParams, request, requestOptions]`. `pathParams.poll_id` is the poll ID;
|
|
770
|
+
* `request` carries optional vote filter conditions, sort directions, and pagination options
|
|
771
|
+
* (`limit`, `offset`).
|
|
751
772
|
* @returns The poll answers.
|
|
752
773
|
*/
|
|
753
|
-
queryPollAnswers(
|
|
774
|
+
queryPollAnswers(...args: Parameters<ChatApi['queryPollVotes']>): Promise<StreamResponse<import(".").PollVotesResponse>>;
|
|
754
775
|
/**
|
|
755
|
-
* Uploads a file to the
|
|
776
|
+
* Uploads a file to the Stream CDN
|
|
756
777
|
*
|
|
757
|
-
* @param
|
|
758
|
-
* @param
|
|
759
|
-
* @param contentType - The content type of the file (optional).
|
|
760
|
-
* @param user - User information (optional).
|
|
761
|
-
* @param axiosRequestConfig - Axios config, e.g. `onUploadProgress` for progress tracking (optional).
|
|
778
|
+
* @param request - Upload payload. `request.file` is the file to upload.
|
|
779
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
|
|
762
780
|
* @returns Response containing the file URL.
|
|
763
781
|
*/
|
|
764
|
-
|
|
782
|
+
uploadFile(request?: Omit<FileUploadRequest, 'file'> & {
|
|
783
|
+
file?: FileUploadInput;
|
|
784
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").FileUploadResponse>>;
|
|
765
785
|
/**
|
|
766
|
-
* Uploads an image to
|
|
786
|
+
* Uploads an image to Stream CDN
|
|
767
787
|
*
|
|
768
|
-
* @param
|
|
769
|
-
* @param
|
|
770
|
-
* @param contentType - The content type of the image (optional).
|
|
771
|
-
* @param user - User information (optional).
|
|
772
|
-
* @param axiosRequestConfig - Axios config, e.g. `onUploadProgress` for progress tracking (optional).
|
|
788
|
+
* @param request - Upload payload. `request.file` is the image to upload.
|
|
789
|
+
* @param requestOptions - Per-request options, e.g. `onUploadProgress` or an abort `signal` (optional).
|
|
773
790
|
* @returns Response containing the image URL.
|
|
774
791
|
*/
|
|
775
|
-
|
|
792
|
+
uploadImage(request?: Omit<ImageUploadRequest, 'file'> & {
|
|
793
|
+
file?: FileUploadInput;
|
|
794
|
+
}, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").ImageUploadResponse>>;
|
|
776
795
|
/**
|
|
777
796
|
* Marks the channels as delivered for the given messages and the user.
|
|
778
797
|
*
|
|
779
798
|
* @param request - Mark delivered options.
|
|
780
799
|
* @returns The server response, or `undefined` if there are no messages to mark.
|
|
781
800
|
*/
|
|
782
|
-
markChannelsDelivered(request?: Gen_MarkDeliveredRequest): Promise<StreamResponse<import(".").MarkDeliveredResponse> | undefined>;
|
|
801
|
+
markChannelsDelivered(request?: Gen_MarkDeliveredRequest, requestOptions?: StreamRequestOptions): Promise<StreamResponse<import(".").MarkDeliveredResponse> | undefined>;
|
|
783
802
|
syncDeliveredCandidates(collections: Channel[]): void;
|
|
784
803
|
}
|
|
804
|
+
export {};
|