stream-chat 9.50.3 → 10.0.0-rc.2
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 +19798 -14472
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +19817 -14482
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +19795 -14469
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +221 -0
- package/dist/types/EventHandlerPipeline.d.ts +104 -0
- package/dist/types/api-client.d.ts +26 -0
- package/dist/types/campaign.d.ts +0 -44
- package/dist/types/channel.d.ts +454 -479
- package/dist/types/channel_batch_updater.d.ts +0 -93
- package/dist/types/channel_state.d.ts +53 -201
- package/dist/types/client.d.ts +451 -1920
- package/dist/types/client_state.d.ts +4 -4
- package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
- package/dist/types/configuration/index.d.ts +1 -0
- package/dist/types/configuration/types.d.ts +53 -0
- package/dist/types/connection.d.ts +49 -41
- package/dist/types/connection_fallback.d.ts +6 -4
- package/dist/types/constants.d.ts +0 -4
- package/dist/types/custom_types.d.ts +2 -0
- package/dist/types/entityStore/EntityStore.d.ts +111 -0
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +60 -0
- package/dist/types/entityStore/applyReactionLocally.d.ts +26 -0
- package/dist/types/entityStore/index.d.ts +2 -0
- package/dist/types/errors.d.ts +10 -2
- package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
- package/dist/types/gen/chat/ChatApi.d.ts +334 -0
- package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
- package/dist/types/gen/models/index.d.ts +8836 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
- package/dist/types/gen-imports.d.ts +3 -0
- package/dist/types/index.d.ts +8 -7
- package/dist/types/insights.d.ts +9 -8
- package/dist/types/logger.d.ts +9 -0
- package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
- package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
- package/dist/types/messageComposer/configuration/types.d.ts +11 -11
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
- package/dist/types/messageComposer/messageComposer.d.ts +10 -10
- package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
- package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
- package/dist/types/messageComposer/pollComposer.d.ts +5 -4
- package/dist/types/messageComposer/textComposer.d.ts +8 -3
- package/dist/types/messageComposer/types.d.ts +6 -28
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
- package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
- package/dist/types/messageOperations/index.d.ts +3 -0
- package/dist/types/messageOperations/types.d.ts +49 -0
- package/dist/types/moderation.d.ts +21 -203
- package/dist/types/notifications/types.d.ts +8 -7
- package/dist/types/offline-support/offline_support_api.d.ts +111 -87
- package/dist/types/offline-support/offline_sync_manager.d.ts +0 -7
- package/dist/types/offline-support/types.d.ts +19 -23
- package/dist/types/offline-support/util.d.ts +4 -2
- package/dist/types/pagination/FilterBuilder.d.ts +1 -1
- package/dist/types/pagination/ItemIndex.d.ts +25 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
- package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/filterCompiler.d.ts +7 -0
- package/dist/types/pagination/index.d.ts +1 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +848 -0
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +212 -0
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +282 -0
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
- package/dist/types/pagination/paginators/index.d.ts +7 -0
- package/dist/types/pagination/paginators/stateThrottling.d.ts +2 -0
- package/dist/types/pagination/sortCompiler.d.ts +49 -0
- package/dist/types/pagination/types.normalization.d.ts +11 -0
- package/dist/types/pagination/utility.normalization.d.ts +18 -0
- package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
- package/dist/types/pagination/utility.search.d.ts +13 -0
- package/dist/types/permissions.d.ts +1 -1
- package/dist/types/poll.d.ts +29 -32
- package/dist/types/poll_manager.d.ts +2 -2
- package/dist/types/reminders/Reminder.d.ts +2 -5
- package/dist/types/reminders/ReminderManager.d.ts +2 -9
- package/dist/types/search/MessageSearchSource.d.ts +4 -4
- package/dist/types/search/UserSearchSource.d.ts +1 -1
- package/dist/types/search/types.d.ts +3 -3
- package/dist/types/segment.d.ts +0 -34
- package/dist/types/signing.d.ts +105 -65
- package/dist/types/store.d.ts +1 -0
- package/dist/types/thread.d.ts +70 -34
- package/dist/types/thread_manager.d.ts +3 -3
- package/dist/types/token_manager.d.ts +15 -10
- package/dist/types/types.d.ts +197 -3404
- package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
- package/dist/types/utils/WithSubscriptions.d.ts +2 -1
- package/dist/types/utils/concurrency.d.ts +4 -4
- package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
- package/dist/types/utils/retryable.d.ts +34 -0
- package/dist/types/utils/throttling/throttle.d.ts +36 -0
- package/dist/types/utils.d.ts +100 -194
- package/package.json +7 -3
- package/src/ChannelManager.ts +724 -0
- package/src/CooldownTimer.ts +2 -2
- package/src/EventHandlerPipeline.ts +228 -0
- package/src/LiveLocationManager.ts +12 -11
- package/src/api-client.ts +275 -0
- package/src/campaign.ts +1 -77
- package/src/channel.ts +1344 -1282
- package/src/channel_batch_updater.ts +1 -211
- package/src/channel_state.ts +144 -1013
- package/src/client.ts +936 -3995
- package/src/client_state.ts +4 -4
- package/src/configuration/InstanceConfigurationService.ts +73 -0
- package/src/configuration/index.ts +1 -0
- package/src/configuration/types.ts +81 -0
- package/src/connection.ts +145 -94
- package/src/connection_fallback.ts +29 -27
- package/src/constants.ts +1 -5
- package/src/custom_types.ts +4 -1
- package/src/entityStore/EntityStore.ts +208 -0
- package/src/entityStore/StoreBackedItemIndex.ts +115 -0
- package/src/entityStore/applyReactionLocally.ts +113 -0
- package/src/entityStore/index.ts +2 -0
- package/src/errors.ts +14 -2
- package/src/gen/chat/ChannelApi.ts +275 -0
- package/src/gen/chat/ChatApi.ts +2554 -0
- package/src/gen/model-decoders/decoders.ts +2680 -0
- package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
- package/src/gen/models/index.ts +12673 -0
- package/src/gen/moderation/ModerationApi.ts +607 -0
- package/src/gen-imports.ts +3 -0
- package/src/index.ts +11 -12
- package/src/insights.ts +6 -5
- package/src/logger.ts +28 -0
- package/src/messageComposer/LocationComposer.ts +9 -5
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
- package/src/messageComposer/attachmentIdentity.ts +16 -9
- package/src/messageComposer/attachmentManager.ts +13 -8
- package/src/messageComposer/configuration/types.ts +11 -11
- package/src/messageComposer/linkPreviewsManager.ts +9 -10
- package/src/messageComposer/messageComposer.ts +57 -53
- package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
- package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
- package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
- package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
- package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
- package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
- package/src/messageComposer/middleware/textComposer/types.ts +9 -4
- package/src/messageComposer/pollComposer.ts +6 -8
- package/src/messageComposer/textComposer.ts +27 -2
- package/src/messageComposer/types.ts +6 -28
- package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
- package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
- package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
- package/src/messageOperations/MessageOperations.ts +212 -0
- package/src/messageOperations/index.ts +10 -0
- package/src/messageOperations/types.ts +64 -0
- package/src/moderation.ts +38 -431
- package/src/notifications/types.ts +8 -7
- package/src/offline-support/offline_support_api.ts +200 -133
- package/src/offline-support/offline_sync_manager.ts +23 -44
- package/src/offline-support/types.ts +23 -26
- package/src/offline-support/util.ts +5 -4
- package/src/pagination/FilterBuilder.ts +4 -1
- package/src/pagination/ItemIndex.ts +25 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
- package/src/pagination/cursorDerivation/index.ts +1 -0
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
- package/src/pagination/filterCompiler.ts +196 -0
- package/src/pagination/index.ts +1 -3
- package/src/pagination/paginators/BasePaginator.ts +2859 -0
- package/src/pagination/paginators/ChannelPaginator.ts +729 -0
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1116 -0
- package/src/pagination/paginators/MessagePaginator.ts +508 -0
- package/src/pagination/paginators/PinnedMessagePaginator.ts +108 -0
- package/src/pagination/paginators/ReminderPaginator.ts +107 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +127 -0
- package/src/pagination/paginators/index.ts +7 -0
- package/src/pagination/paginators/stateThrottling.ts +31 -0
- package/src/pagination/sortCompiler.ts +193 -0
- package/src/pagination/types.normalization.ts +14 -0
- package/src/pagination/utility.normalization.ts +106 -0
- package/src/pagination/utility.queryChannel.ts +84 -0
- package/src/pagination/utility.search.ts +80 -0
- package/src/permissions.ts +7 -8
- package/src/poll.ts +101 -110
- package/src/poll_manager.ts +14 -8
- package/src/reminders/Reminder.ts +2 -5
- package/src/reminders/ReminderManager.ts +19 -21
- package/src/search/BaseSearchSource.ts +0 -3
- package/src/search/ChannelMemberSearchSource.ts +7 -1
- package/src/search/ChannelSearchSource.ts +10 -3
- package/src/search/MessageSearchSource.ts +29 -30
- package/src/search/UserSearchSource.ts +12 -8
- package/src/search/types.ts +3 -4
- package/src/segment.ts +1 -95
- package/src/signing.ts +107 -67
- package/src/store.ts +2 -1
- package/src/thread.ts +562 -238
- package/src/thread_manager.ts +37 -16
- package/src/token_manager.ts +21 -10
- package/src/types.ts +364 -4533
- package/src/uploadManager.ts +8 -0
- package/src/utils/FixedSizeQueueCache.ts +12 -6
- package/src/utils/WithSubscriptions.ts +2 -1
- package/src/utils/concurrency.ts +4 -4
- package/src/utils/mergeWith/mergeWith.ts +3 -3
- package/src/utils/mergeWith/mergeWithCore.ts +140 -164
- package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
- package/src/utils/retryable.ts +117 -0
- package/src/utils/throttling/throttle.ts +130 -0
- package/src/utils.ts +208 -754
- package/dist/types/channel_manager.d.ts +0 -122
- package/dist/types/events.d.ts +0 -72
- package/dist/types/pagination/BasePaginator.d.ts +0 -69
- package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
- package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
- package/src/channel_manager.ts +0 -830
- package/src/events.ts +0 -75
- package/src/pagination/BasePaginator.ts +0 -184
- package/src/pagination/ReminderPaginator.ts +0 -56
- package/src/pagination/UserGroupPaginator.ts +0 -93
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { UserResponse } from './types';
|
|
1
|
+
import type { OwnUserResponse, UserResponse } from './types';
|
|
2
2
|
import type { StreamChat } from './client';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Container class for the client state.
|
|
5
5
|
*/
|
|
6
6
|
export declare class ClientState {
|
|
7
7
|
private client;
|
|
8
8
|
users: {
|
|
9
|
-
[key: string]: UserResponse;
|
|
9
|
+
[key: string]: UserResponse | OwnUserResponse;
|
|
10
10
|
};
|
|
11
11
|
userChannelReferences: {
|
|
12
12
|
[key: string]: {
|
|
@@ -17,7 +17,7 @@ export declare class ClientState {
|
|
|
17
17
|
client: StreamChat;
|
|
18
18
|
});
|
|
19
19
|
updateUsers(users: UserResponse[]): void;
|
|
20
|
-
updateUser(user?: UserResponse): void;
|
|
20
|
+
updateUser(user?: UserResponse | OwnUserResponse): void;
|
|
21
21
|
updateUserReference(user: UserResponse, channelID: string): void;
|
|
22
22
|
deleteAllChannelReference(channelID: string): void;
|
|
23
23
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InstanceConfigurationService is a singleton class that is used to store the configuration for the instances of classes exposed by the SKD such as:
|
|
3
|
+
* - StreamChat
|
|
4
|
+
* - Channel
|
|
5
|
+
* - Thread
|
|
6
|
+
* - MessageComposer
|
|
7
|
+
*
|
|
8
|
+
* Every existing and future instance configuration of the above classes will be setup using the following pattern:
|
|
9
|
+
* - StreamChat: StreamChat.setClientSetupFunction(setupFunction)
|
|
10
|
+
* - Channel: StreamChat.setChannelSetupFunction(setupFunction)
|
|
11
|
+
* - Thread: StreamChat.setThreadSetupFunction(setupFunction)
|
|
12
|
+
* - MessageComposer: StreamChat.setMessageComposerSetupFunction(setupFunction)
|
|
13
|
+
*
|
|
14
|
+
* The setupFunction is a function that is used to set up the instance configuration.
|
|
15
|
+
*/
|
|
16
|
+
import { StateStore } from '../store';
|
|
17
|
+
import type { ChannelSetupState, MessageComposerSetupState, SetInstanceConfigurationFunctions, StreamChatSetupState, ThreadSetupState } from './types';
|
|
18
|
+
export declare class InstanceConfigurationService {
|
|
19
|
+
private static instance;
|
|
20
|
+
private setupStates;
|
|
21
|
+
setSetupFunctions(setupFunctions: SetInstanceConfigurationFunctions): void;
|
|
22
|
+
get Channel(): StateStore<ChannelSetupState>;
|
|
23
|
+
get MessageComposer(): StateStore<MessageComposerSetupState>;
|
|
24
|
+
get StreamChat(): StateStore<StreamChatSetupState>;
|
|
25
|
+
get Thread(): StateStore<ThreadSetupState>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { StreamChat } from '../client';
|
|
2
|
+
import type { MessageComposer } from '../messageComposer';
|
|
3
|
+
import type { Channel } from '../channel';
|
|
4
|
+
import type { Thread } from '../thread';
|
|
5
|
+
import type { StateStore } from '../store';
|
|
6
|
+
export type MessageComposerTearDownFunction = () => void;
|
|
7
|
+
export type MessageComposerSetupFunction = ({ composer, }: {
|
|
8
|
+
composer: MessageComposer;
|
|
9
|
+
}) => void | MessageComposerTearDownFunction;
|
|
10
|
+
export type MessageComposerSetupState = {
|
|
11
|
+
/**
|
|
12
|
+
* Each `MessageComposer` runs this function each time its signature changes or
|
|
13
|
+
* whenever you run `MessageComposer.registerSubscriptions`. Function returned
|
|
14
|
+
* from `applyModifications` will be used as a cleanup function - it will be stored
|
|
15
|
+
* and ran before new modification is applied. Cleaning up only the
|
|
16
|
+
* modified parts is the general way to go but if your setup gets a bit
|
|
17
|
+
* complicated, feel free to restore the whole composer with `MessageComposer.restore`.
|
|
18
|
+
*/
|
|
19
|
+
setupFunction: MessageComposerSetupFunction | null;
|
|
20
|
+
};
|
|
21
|
+
export type StreamChatTearDownFunction = () => void;
|
|
22
|
+
export type StreamChatSetupFunction = ({ client, }: {
|
|
23
|
+
client: StreamChat;
|
|
24
|
+
}) => void | StreamChatTearDownFunction;
|
|
25
|
+
export type StreamChatSetupState = {
|
|
26
|
+
setupFunction: StreamChatSetupFunction | null;
|
|
27
|
+
};
|
|
28
|
+
export type ChannelTearDownFunction = () => void;
|
|
29
|
+
export type ChannelSetupFunction = ({ channel, }: {
|
|
30
|
+
channel: Channel;
|
|
31
|
+
}) => void | ChannelTearDownFunction;
|
|
32
|
+
export type ChannelSetupState = {
|
|
33
|
+
setupFunction: ChannelSetupFunction | null;
|
|
34
|
+
};
|
|
35
|
+
export type ThreadTearDownFunction = () => void;
|
|
36
|
+
export type ThreadSetupFunction = ({ thread, }: {
|
|
37
|
+
thread: Thread;
|
|
38
|
+
}) => void | ThreadTearDownFunction;
|
|
39
|
+
export type ThreadSetupState = {
|
|
40
|
+
setupFunction: ThreadSetupFunction | null;
|
|
41
|
+
};
|
|
42
|
+
export type SetInstanceConfigurationServiceStates = {
|
|
43
|
+
Channel: StateStore<ChannelSetupState>;
|
|
44
|
+
MessageComposer: StateStore<MessageComposerSetupState>;
|
|
45
|
+
StreamChat: StateStore<StreamChatSetupState>;
|
|
46
|
+
Thread: StateStore<ThreadSetupState>;
|
|
47
|
+
};
|
|
48
|
+
export type SetupFnOf<T> = T extends StateStore<infer S> ? S extends {
|
|
49
|
+
setupFunction?: infer F;
|
|
50
|
+
} ? F : never : never;
|
|
51
|
+
export type SetInstanceConfigurationFunctions = {
|
|
52
|
+
[K in keyof SetInstanceConfigurationServiceStates]?: SetupFnOf<SetInstanceConfigurationServiceStates[K]>;
|
|
53
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import WebSocket from 'isomorphic-ws';
|
|
2
|
-
import type { ConnectAPIResponse, ConnectionOpen
|
|
2
|
+
import type { ConnectAPIResponse, ConnectionOpen } from './types';
|
|
3
3
|
import type { StreamChat } from './client';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A WS connection that reconnects upon failure.
|
|
6
|
+
*
|
|
6
7
|
* - the browser will sometimes report that you're online or offline
|
|
7
8
|
* - the WS connection can break and fail (there is a 30s health check)
|
|
8
9
|
* - sometimes your WS connection will seem to work while the user is in fact offline
|
|
9
|
-
* - to speed up online/offline detection you can use the window.addEventListener('offline')
|
|
10
|
+
* - to speed up online/offline detection you can use the `window.addEventListener('offline')`
|
|
10
11
|
*
|
|
11
12
|
* There are 4 ways in which a connection can become unhealthy:
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
13
|
+
* - WebSocket.onerror is called
|
|
14
|
+
* - WebSocket.onclose is called
|
|
14
15
|
* - the health check fails and no event is received for ~40 seconds
|
|
15
16
|
* - the browser indicates the connection is now offline
|
|
16
17
|
*
|
|
@@ -45,71 +46,79 @@ export declare class StableWSConnection {
|
|
|
45
46
|
constructor({ client }: {
|
|
46
47
|
client: StreamChat;
|
|
47
48
|
});
|
|
48
|
-
_log(msg: string, extra?: UR, level?: LogLevel): void;
|
|
49
49
|
setClient(client: StreamChat): void;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
51
|
+
* Connects to the WS URL. The default 15s timeout allows between 2 and 3 tries.
|
|
52
|
+
*
|
|
53
|
+
* @param timeout - Connect timeout in milliseconds (optional, defaults to `15000`).
|
|
54
|
+
* @returns A promise that resolves once the first health check message is received.
|
|
54
55
|
*/
|
|
55
|
-
connect(timeout?: number): Promise<void |
|
|
56
|
+
connect(timeout?: number): Promise<void | ({
|
|
57
|
+
type: "health.check";
|
|
58
|
+
} & import(".").HealthCheckEvent)>;
|
|
56
59
|
/**
|
|
57
60
|
* _waitForHealthy polls the promise connection to see if its resolved until it times out
|
|
58
61
|
* the default 15s timeout allows between 2~3 tries
|
|
59
|
-
*
|
|
62
|
+
*
|
|
63
|
+
* @param timeout - duration (ms)
|
|
60
64
|
*/
|
|
61
|
-
_waitForHealthy(timeout?: number): Promise<void |
|
|
65
|
+
_waitForHealthy(timeout?: number): Promise<void | ({
|
|
66
|
+
type: "health.check";
|
|
67
|
+
} & import(".").HealthCheckEvent)>;
|
|
62
68
|
/**
|
|
63
|
-
* Builds and returns the
|
|
69
|
+
* Builds and returns the URL for the WebSocket connection.
|
|
70
|
+
*
|
|
64
71
|
* @private
|
|
65
72
|
* @returns url string
|
|
66
73
|
*/
|
|
67
74
|
_buildUrl: () => string;
|
|
68
75
|
/**
|
|
69
|
-
*
|
|
76
|
+
* Disconnects the connection without attempting to recover.
|
|
70
77
|
*
|
|
78
|
+
* @param timeout - Optional timeout in milliseconds to wait for the close frame from the server.
|
|
71
79
|
*/
|
|
72
80
|
disconnect(timeout?: number): Promise<void>;
|
|
73
81
|
/**
|
|
74
|
-
*
|
|
82
|
+
* Connects to the WS endpoint.
|
|
75
83
|
*
|
|
76
|
-
* @
|
|
84
|
+
* @returns A promise that resolves once the first health check message is received.
|
|
77
85
|
*/
|
|
78
|
-
_connect(): Promise<
|
|
86
|
+
_connect(): Promise<({
|
|
87
|
+
type: "health.check";
|
|
88
|
+
} & import(".").HealthCheckEvent) | undefined>;
|
|
79
89
|
/**
|
|
80
|
-
*
|
|
90
|
+
* Retries the connection to the WS endpoint.
|
|
81
91
|
*
|
|
82
|
-
* @param
|
|
83
|
-
*
|
|
84
|
-
* -
|
|
85
|
-
* - `refreshToken` {boolean} reload/refresh user token be refreshed before attempting reconnection.
|
|
92
|
+
* @param options - Reconnect options.
|
|
93
|
+
* @param options.interval - Number of milliseconds to wait before reconnecting.
|
|
94
|
+
* @param options.refreshToken - Reload/refresh the user token before attempting to reconnect.
|
|
86
95
|
*/
|
|
87
96
|
_reconnect(options?: {
|
|
88
97
|
interval?: number;
|
|
89
98
|
refreshToken?: boolean;
|
|
90
99
|
}): Promise<void>;
|
|
91
100
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* @param {Event} event Event with type online or offline
|
|
101
|
+
* Called when the browser connects or disconnects from the internet.
|
|
95
102
|
*
|
|
103
|
+
* @param event - The DOM event whose `type` is `'online'` or `'offline'`.
|
|
96
104
|
*/
|
|
97
105
|
onlineStatusChanged: (event: Event) => void;
|
|
98
|
-
onopen: (
|
|
99
|
-
onmessage: (
|
|
100
|
-
onclose: (
|
|
101
|
-
onerror: (
|
|
106
|
+
onopen: (wsId: number) => void;
|
|
107
|
+
onmessage: (wsId: number, event: WebSocket.MessageEvent) => void;
|
|
108
|
+
onclose: (wsId: number, event: WebSocket.CloseEvent) => void;
|
|
109
|
+
onerror: (wsId: number, event: WebSocket.ErrorEvent) => void;
|
|
102
110
|
/**
|
|
103
|
-
*
|
|
104
|
-
* Broadcasts an event in case the connection status changed.
|
|
105
|
-
*
|
|
106
|
-
* @param {boolean} healthy boolean indicating if the connection is healthy or not
|
|
111
|
+
* Sets the connection to healthy or unhealthy. Broadcasts an event if the connection status changed.
|
|
107
112
|
*
|
|
113
|
+
* @param healthy - Whether the connection is healthy.
|
|
108
114
|
*/
|
|
109
115
|
_setHealth: (healthy: boolean) => void;
|
|
110
116
|
/**
|
|
111
|
-
*
|
|
117
|
+
* Creates an error object for the WS event.
|
|
112
118
|
*
|
|
119
|
+
* @param event - The raw WebSocket close / data / error event.
|
|
120
|
+
* @param isWSFailure - Whether the underlying cause is a WebSocket failure (optional, defaults to `true`).
|
|
121
|
+
* @returns A normalized error describing the WS failure.
|
|
113
122
|
*/
|
|
114
123
|
_errorFromWSEvent: (event: WebSocket.CloseEvent | WebSocket.Data | WebSocket.ErrorEvent, isWSFailure?: boolean) => Error & {
|
|
115
124
|
code?: string | number;
|
|
@@ -117,22 +126,21 @@ export declare class StableWSConnection {
|
|
|
117
126
|
StatusCode?: string | number;
|
|
118
127
|
};
|
|
119
128
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
129
|
+
* Removes the current WS connection.
|
|
122
130
|
*/
|
|
123
131
|
_destroyCurrentWSConnection(): void;
|
|
124
132
|
/**
|
|
125
|
-
*
|
|
133
|
+
* Sets up the `this.connectionOpen` promise.
|
|
126
134
|
*/
|
|
127
135
|
_setupConnectionPromise: () => void;
|
|
128
136
|
/**
|
|
129
|
-
* Schedules
|
|
137
|
+
* Schedules the next health check ping for the WebSocket connection.
|
|
130
138
|
*/
|
|
131
139
|
scheduleNextPing: () => void;
|
|
132
140
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* to be reconnected.
|
|
141
|
+
* Schedules a check for the time difference between the last received event and now. If the
|
|
142
|
+
* difference is more than 35 seconds, it means our health check logic has failed and the
|
|
143
|
+
* WebSocket needs to be reconnected.
|
|
136
144
|
*/
|
|
137
145
|
scheduleConnectionCheck: () => void;
|
|
138
146
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxiosRequestConfig, CancelTokenSource } from 'axios';
|
|
2
2
|
import type { StreamChat } from './client';
|
|
3
|
-
import type {
|
|
3
|
+
import type { UR } from './types';
|
|
4
4
|
export declare enum ConnectionState {
|
|
5
5
|
Closed = "CLOSED",
|
|
6
6
|
Connected = "CONNECTED",
|
|
@@ -17,7 +17,6 @@ export declare class WSConnectionFallback {
|
|
|
17
17
|
constructor({ client }: {
|
|
18
18
|
client: StreamChat;
|
|
19
19
|
});
|
|
20
|
-
_log(msg: string, extra?: UR, level?: LogLevel): void;
|
|
21
20
|
_setState(state: ConnectionState): void;
|
|
22
21
|
/** @private */
|
|
23
22
|
_onlineStatusChanged: (event: {
|
|
@@ -29,9 +28,12 @@ export declare class WSConnectionFallback {
|
|
|
29
28
|
_poll: () => Promise<void>;
|
|
30
29
|
/**
|
|
31
30
|
* connect try to open a longpoll request
|
|
32
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* @param reconnect - should be false for first call and true for subsequent calls to keep the connection alive and call recoverState
|
|
33
33
|
*/
|
|
34
|
-
connect: (reconnect?: boolean) => Promise<
|
|
34
|
+
connect: (reconnect?: boolean) => Promise<({
|
|
35
|
+
type: "health.check";
|
|
36
|
+
} & import(".").HealthCheckEvent) | undefined>;
|
|
35
37
|
/**
|
|
36
38
|
* isHealthy checks if there is a connectionID and connection is in Connected state
|
|
37
39
|
*/
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export declare const DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE = 25;
|
|
2
2
|
export declare const DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE = 100;
|
|
3
|
-
export declare const DEFAULT_MESSAGE_SET_PAGINATION: Readonly<{
|
|
4
|
-
hasNext: false;
|
|
5
|
-
hasPrev: false;
|
|
6
|
-
}>;
|
|
7
3
|
export declare const DEFAULT_UPLOAD_SIZE_LIMIT_BYTES: number;
|
|
8
4
|
export declare const API_MAX_FILES_ALLOWED_PER_MESSAGE = 10;
|
|
9
5
|
export declare const MAX_CHANNEL_MEMBER_COUNT_IN_CHANNEL_QUERY = 100;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Unsubscribe } from '../store';
|
|
2
|
+
/**
|
|
3
|
+
* A batch of entity-store changes delivered to a subscriber in a single notification.
|
|
4
|
+
*
|
|
5
|
+
* `changedIds` are the ids the subscriber watches whose canonical object changed reference this
|
|
6
|
+
* flush (an upsert, or a removal — a removal makes `store.get(id)` return `undefined`).
|
|
7
|
+
*/
|
|
8
|
+
export type EntityStoreChangeBatch = {
|
|
9
|
+
changedIds: ReadonlySet<string>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Anything that observes entities held in an {@link EntityStore}.
|
|
13
|
+
*
|
|
14
|
+
* A subscriber watches a *set* of entity ids (a paginator watches all ids in its
|
|
15
|
+
* intervals; a thread watches its single parent id). It is notified at most once
|
|
16
|
+
* per store transaction with the subset of its watched ids that changed.
|
|
17
|
+
*/
|
|
18
|
+
export type EntityStoreSubscriber = {
|
|
19
|
+
onEntitiesChanged: (batch: EntityStoreChangeBatch) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Optional: emit any throttled/pending state notification immediately. Called by
|
|
22
|
+
* {@link EntityStore.flushSubscribers} after an optimistic (local-user) write so the change
|
|
23
|
+
* renders without throttle delay. A paginator implements this by flushing its throttled window
|
|
24
|
+
* publish.
|
|
25
|
+
*/
|
|
26
|
+
flushState?: () => void;
|
|
27
|
+
};
|
|
28
|
+
export type EntityStoreOptions<T> = {
|
|
29
|
+
/** Extracts the canonical id an entity is stored and addressed under. */
|
|
30
|
+
getEntityId: (entity: T) => string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A client-global, normalized store for domain entities addressed by id.
|
|
34
|
+
*
|
|
35
|
+
* The store holds exactly **one** canonical `T` per id and lets any number of entities
|
|
36
|
+
* (paginators, threads, ad-hoc consumers) subscribe to individual ids. Every mutation of a
|
|
37
|
+
* stored entity becomes a single `upsert`, and the store fans the change out to exactly the
|
|
38
|
+
* subscribers holding that id — replacing the manual copy-to-copy fan-out that keeping N
|
|
39
|
+
* per-consumer copies in sync required.
|
|
40
|
+
*
|
|
41
|
+
* The store is entity-agnostic: it learns how to extract an id from a `T` via the `getEntityId`
|
|
42
|
+
* function passed to its constructor. The client holds one as `client.messageStore`, an
|
|
43
|
+
* `EntityStore<LocalMessage>`, for message content.
|
|
44
|
+
*
|
|
45
|
+
* ## Design
|
|
46
|
+
*
|
|
47
|
+
* - **Content:** `byId` (`Map<id, T>`) is the single source of truth. Objects are immutable
|
|
48
|
+
* snapshots: `upsert` *replaces*, never mutates in place, so the reference-equality
|
|
49
|
+
* short-circuit (mirroring {@link StateStore.next}) and every downstream selector keep working.
|
|
50
|
+
* - **Subscription registry / refcount:** `subscribers` (`Map<id, Set<subscriber>>`) is both the
|
|
51
|
+
* per-id notification list and the reference count — when the last subscriber of an id unlinks,
|
|
52
|
+
* the canonical copy is garbage-collected.
|
|
53
|
+
* - **Batching:** `transaction` coalesces a bulk write (e.g. a page of N entities) so each affected
|
|
54
|
+
* subscriber is notified **once** with the full changed-id set, instead of N times.
|
|
55
|
+
* - **Signal-then-pull:** subscribers receive the set of changed ids and pull the new content via
|
|
56
|
+
* `get`; the store never pushes objects.
|
|
57
|
+
*
|
|
58
|
+
* This is deliberately a hand-rolled per-id registry rather than a {@link StateStore}: a single
|
|
59
|
+
* `StateStore` would run every subscriber's selector on every change (O(all subscribers) per emit),
|
|
60
|
+
* and a store-per-entity would allocate a full `StateStore` per id with no cross-id batching. The
|
|
61
|
+
* `Map<id, Set>` gives O(subscribers-of-changed-id) fan-out — the same idiom as `PollManager`'s
|
|
62
|
+
* cache.
|
|
63
|
+
*
|
|
64
|
+
* @template T The domain entity type held by the store.
|
|
65
|
+
*/
|
|
66
|
+
export declare class EntityStore<T> {
|
|
67
|
+
private byId;
|
|
68
|
+
private subscribers;
|
|
69
|
+
private readonly getEntityId;
|
|
70
|
+
private transactionDepth;
|
|
71
|
+
private pendingChanged;
|
|
72
|
+
constructor({ getEntityId }: EntityStoreOptions<T>);
|
|
73
|
+
get(id: string | undefined): T | undefined;
|
|
74
|
+
has(id: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Replaces the canonical copy of `entity` and notifies every subscriber watching its id —
|
|
77
|
+
* except `subscriber`, the one that performed the write, which is expected to re-render itself
|
|
78
|
+
* (the paginator that performed the write already emits its own window inline, so it must not be
|
|
79
|
+
* notified a second time through the subscription).
|
|
80
|
+
*/
|
|
81
|
+
upsert(entity: T, subscriber?: EntityStoreSubscriber): void;
|
|
82
|
+
/** Registers `subscriber` for `id` (notification target + refcount). */
|
|
83
|
+
link(id: string, subscriber: EntityStoreSubscriber): void;
|
|
84
|
+
/** Drops `subscriber` from `id`; GCs the canonical copy when none remain. */
|
|
85
|
+
unlink(id: string, subscriber: EntityStoreSubscriber): void;
|
|
86
|
+
/**
|
|
87
|
+
* Sugar for atomic / ad-hoc consumers that watch a single id (e.g. a thread watching its parent
|
|
88
|
+
* message). Fires `handler` immediately with the current value (mirroring
|
|
89
|
+
* {@link StateStore.subscribe}) and on every subsequent change.
|
|
90
|
+
*/
|
|
91
|
+
subscribe(id: string, handler: (entity: T | undefined) => void): Unsubscribe;
|
|
92
|
+
/**
|
|
93
|
+
* Runs `fn`, coalescing all notifications produced by writes inside it into a single flush on
|
|
94
|
+
* exit. Re-entrant: nested transactions flush only when the outermost exits.
|
|
95
|
+
*/
|
|
96
|
+
transaction<R>(fn: () => R): R;
|
|
97
|
+
/**
|
|
98
|
+
* Immediately flushes any throttled/pending state publish on the subscribers of `id` (via
|
|
99
|
+
* {@link EntityStoreSubscriber.flushState}). Called after an optimistic (local-user) write to
|
|
100
|
+
* `id` so it renders without the throttle delay. Only that id's own subscribers are flushed — the
|
|
101
|
+
* write touched no other id — and flushing a subscriber with nothing pending is a no-op.
|
|
102
|
+
*/
|
|
103
|
+
flushSubscribers(id: string): void;
|
|
104
|
+
/**
|
|
105
|
+
* Records `id` as changed for every subscriber watching it, except `subscriber` — the one that
|
|
106
|
+
* wrote it and is resposible for updating itself (see {@link EntityStore.upsert}).
|
|
107
|
+
*/
|
|
108
|
+
private markDirty;
|
|
109
|
+
private autoFlush;
|
|
110
|
+
private flush;
|
|
111
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ItemIndexApi } from '../pagination/ItemIndex';
|
|
2
|
+
import { EntityStore, type EntityStoreSubscriber } from './EntityStore';
|
|
3
|
+
export type StoreBackedItemIndexOptions<T> = {
|
|
4
|
+
getEntityId: (item: T) => string;
|
|
5
|
+
/**
|
|
6
|
+
* The entity that owns this index; used as the store subscriber, which also holds its refcount.
|
|
7
|
+
* Optional: an index over a private store (see `store`) has no one to fan out to, so an
|
|
8
|
+
* owner-less index just uses an internal no-op subscriber to hold its refcount. Message paginators pass themselves so
|
|
9
|
+
* cross-collection updates reach them; single-home collections (channels, reminders, …) omit it.
|
|
10
|
+
*/
|
|
11
|
+
owner?: EntityStoreSubscriber;
|
|
12
|
+
/**
|
|
13
|
+
* The shared, client-global store that holds the canonical content. Optional: when omitted the
|
|
14
|
+
* index provisions a **private** {@link EntityStore} of its own, so it behaves exactly like a
|
|
15
|
+
* plain, per-instance index — same code path, no shared content, no fan-out. This is the mode used
|
|
16
|
+
* by single-home collections and by detached paginators (e.g. built without a client, in tests).
|
|
17
|
+
*/
|
|
18
|
+
store?: EntityStore<T>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* An {@link ItemIndexApi} implementation that keeps entity **content** in an {@link EntityStore}
|
|
22
|
+
* while keeping **membership** local.
|
|
23
|
+
*
|
|
24
|
+
* A consumer sees the same minimal CRUD surface ({@link ItemIndexApi}), but:
|
|
25
|
+
*
|
|
26
|
+
* - `get`/`has`/`values`/`entries` are scoped to *this* index's membership (`memberIds`), so
|
|
27
|
+
* `getItem(id)` still means "does THIS index hold the id" — even though the canonical object
|
|
28
|
+
* lives in the (possibly shared) store. This is what keeps e.g. reaction routing
|
|
29
|
+
* (`threadPaginator.getItem(id) ? thread : channel`) correct and keeps the `.values()` scans
|
|
30
|
+
* from ever walking other channels' entities.
|
|
31
|
+
* - `setOne` writes content once into the store and links the owner as a subscriber (drives both
|
|
32
|
+
* notification fan-out and refcount GC). The write passes the owner as the `subscriber` to skip, so
|
|
33
|
+
* the owner is not notified of its own write (it re-emits its window inline); other subscribers of
|
|
34
|
+
* the same id ARE notified and re-project.
|
|
35
|
+
* - `remove`/`clear` unlink the owner rather than hard-deleting content, so an entity still held by
|
|
36
|
+
* another index (e.g. a `show_in_channel` reply in both the channel list and its thread) survives;
|
|
37
|
+
* the store GCs it only when the last subscriber unlinks.
|
|
38
|
+
*
|
|
39
|
+
* When no shared store is supplied the index holds a private store — every id it links has exactly
|
|
40
|
+
* one subscriber (its own owner), so no fan-out ever fires and removal GCs immediately, matching a plain
|
|
41
|
+
* per-instance index.
|
|
42
|
+
*
|
|
43
|
+
* @template T The domain item type held by the index; collocated with the {@link EntityStore}'s.
|
|
44
|
+
*/
|
|
45
|
+
export declare class StoreBackedItemIndex<T> implements ItemIndexApi<T> {
|
|
46
|
+
private memberIds;
|
|
47
|
+
private readonly store;
|
|
48
|
+
private readonly owner;
|
|
49
|
+
private readonly getEntityId;
|
|
50
|
+
constructor({ store, owner, getEntityId }: StoreBackedItemIndexOptions<T>);
|
|
51
|
+
setMany(items: T[]): void;
|
|
52
|
+
setOne(item: T): void;
|
|
53
|
+
get(id: string): T | undefined;
|
|
54
|
+
has(id: string): boolean;
|
|
55
|
+
remove(id: string): void;
|
|
56
|
+
clear(): void;
|
|
57
|
+
entries(): [string, T][];
|
|
58
|
+
values(): T[];
|
|
59
|
+
batch<R>(fn: () => R): R;
|
|
60
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StreamChat } from '../client';
|
|
2
|
+
import type { ReactionRequest } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Applies a reaction to the single canonical copy of a message in the client-global
|
|
5
|
+
* {@link EntityStore} (`client.messageStore`), addressed purely by id — NOT through any paginator's
|
|
6
|
+
* membership. It reads the
|
|
7
|
+
* current message POJO (`store.get`), produces a new POJO with the reaction folded into its
|
|
8
|
+
* `reaction_groups` / `latest_reactions` (shared count helpers) and `own_reactions`
|
|
9
|
+
* ({@link computeOwnReactions}), and writes it back (`store.upsert`). The store then notifies every
|
|
10
|
+
* collection currently holding that id — the main-list / thread-reply paginators, a thread's
|
|
11
|
+
* subscribed parent, any future consumer — and each re-projects. The message stays a plain object;
|
|
12
|
+
* the store's per-id registry is the reactivity.
|
|
13
|
+
*
|
|
14
|
+
* Because it is keyed by id rather than by a paginator's `getItem`, it reaches a message held by ANY
|
|
15
|
+
* collection, including the thread parent that lives in no paginator — with no per-home wiring.
|
|
16
|
+
*
|
|
17
|
+
* Writes memory (synchronous) + the offline DB (fire-and-forget), and returns an `undo()` reversing
|
|
18
|
+
* both on the current state (inverse deltas, concurrency-safe), or `undefined` when the user isn't
|
|
19
|
+
* connected or the message isn't in the store.
|
|
20
|
+
*/
|
|
21
|
+
export declare const applyReactionLocally: (client: StreamChat, { enforceUnique, messageId, reaction, removed, }: {
|
|
22
|
+
messageId: string;
|
|
23
|
+
reaction: ReactionRequest;
|
|
24
|
+
enforceUnique?: boolean;
|
|
25
|
+
removed?: boolean;
|
|
26
|
+
}) => (() => void) | undefined;
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AxiosResponse } from 'axios';
|
|
2
|
-
import type {
|
|
2
|
+
import type { APIError as Gen_APIError } from './types';
|
|
3
3
|
export declare const APIErrorCodes: Record<string, {
|
|
4
4
|
name: string;
|
|
5
5
|
retryable: boolean;
|
|
@@ -11,6 +11,14 @@ export type APIError = Error & {
|
|
|
11
11
|
};
|
|
12
12
|
export declare function isAPIError(error: Error): error is APIError;
|
|
13
13
|
export declare function isErrorRetryable(error: APIError): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether an error is EPHEMERAL — a transient failure worth queueing/retrying rather than a
|
|
16
|
+
* definitive rejection. True when the server never responded (connection/network/offline error - no
|
|
17
|
+
* `response`, i.e an axios network error or an `OfflineError`) and when the server responded with a
|
|
18
|
+
* retryable code (see {@link APIErrorCodes}); false only when the server responded with a
|
|
19
|
+
* non-retryable code (InputError 4, DoesNotExist 16, NotAllowed 17, …).
|
|
20
|
+
*/
|
|
21
|
+
export declare function isEphemeral(error: Error): boolean;
|
|
14
22
|
export declare function isConnectionIDError(error: APIError): boolean;
|
|
15
23
|
export declare function isWSFailure(err: APIError): boolean;
|
|
16
|
-
export declare function isErrorResponse(res: AxiosResponse<unknown>): res is AxiosResponse<
|
|
24
|
+
export declare function isErrorResponse(res: AxiosResponse<unknown>): res is AxiosResponse<Gen_APIError>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ChatApi, StreamResponse } from '../../gen-imports';
|
|
2
|
+
import type { ChannelGetOrCreateRequest, ChannelStateResponse, ChannelStopWatchingRequest, CreateDraftRequest, CreateDraftResponse, DeleteChannelResponse, EventResponse, GetDraftResponse, GetManyMessagesResponse, HideChannelRequest, HideChannelResponse, MarkReadRequest, MarkReadResponse, MarkUnreadRequest, Response, SendEventRequest, SendMessageRequest, SendMessageResponse, ShowChannelRequest, ShowChannelResponse, TruncateChannelRequest, TruncateChannelResponse, UpdateChannelPartialRequest, UpdateChannelPartialResponse, UpdateChannelRequest, UpdateChannelResponse, UpdateMemberPartialRequest, UpdateMemberPartialResponse, UploadChannelFileRequest, UploadChannelFileResponse, UploadChannelRequest, UploadChannelResponse } from '../models';
|
|
3
|
+
export declare class ChannelApi {
|
|
4
|
+
protected chatApi: ChatApi;
|
|
5
|
+
readonly type: string;
|
|
6
|
+
id: string | undefined;
|
|
7
|
+
constructor(chatApi: ChatApi, type: string, id: string | undefined);
|
|
8
|
+
delete(request?: {
|
|
9
|
+
hard_delete?: boolean;
|
|
10
|
+
}): Promise<StreamResponse<DeleteChannelResponse>>;
|
|
11
|
+
updateChannelPartial(request?: UpdateChannelPartialRequest): Promise<StreamResponse<UpdateChannelPartialResponse>>;
|
|
12
|
+
update(request?: UpdateChannelRequest): Promise<StreamResponse<UpdateChannelResponse>>;
|
|
13
|
+
deleteDraft(request?: {
|
|
14
|
+
parent_id?: string;
|
|
15
|
+
}): Promise<StreamResponse<Response>>;
|
|
16
|
+
getDraft(request?: {
|
|
17
|
+
parent_id?: string;
|
|
18
|
+
}): Promise<StreamResponse<GetDraftResponse>>;
|
|
19
|
+
createDraft(request: CreateDraftRequest): Promise<StreamResponse<CreateDraftResponse>>;
|
|
20
|
+
sendEvent(request: SendEventRequest): Promise<StreamResponse<EventResponse>>;
|
|
21
|
+
deleteChannelFile(request?: {
|
|
22
|
+
url?: string;
|
|
23
|
+
}): Promise<StreamResponse<Response>>;
|
|
24
|
+
uploadChannelFile(request?: UploadChannelFileRequest): Promise<StreamResponse<UploadChannelFileResponse>>;
|
|
25
|
+
hide(request?: HideChannelRequest): Promise<StreamResponse<HideChannelResponse>>;
|
|
26
|
+
deleteChannelImage(request?: {
|
|
27
|
+
url?: string;
|
|
28
|
+
}): Promise<StreamResponse<Response>>;
|
|
29
|
+
uploadChannelImage(request?: UploadChannelRequest): Promise<StreamResponse<UploadChannelResponse>>;
|
|
30
|
+
updateMemberPartial(request?: UpdateMemberPartialRequest): Promise<StreamResponse<UpdateMemberPartialResponse>>;
|
|
31
|
+
sendMessage(request: SendMessageRequest): Promise<StreamResponse<SendMessageResponse>>;
|
|
32
|
+
getManyMessages(request: {
|
|
33
|
+
ids: Array<string>;
|
|
34
|
+
}): Promise<StreamResponse<GetManyMessagesResponse>>;
|
|
35
|
+
getOrCreate(request?: ChannelGetOrCreateRequest & {
|
|
36
|
+
connection_id?: string;
|
|
37
|
+
}): Promise<StreamResponse<ChannelStateResponse>>;
|
|
38
|
+
markRead(request?: MarkReadRequest): Promise<StreamResponse<MarkReadResponse>>;
|
|
39
|
+
show(request?: ShowChannelRequest): Promise<StreamResponse<ShowChannelResponse>>;
|
|
40
|
+
stopWatching(request?: ChannelStopWatchingRequest & {
|
|
41
|
+
connection_id?: string;
|
|
42
|
+
}): Promise<StreamResponse<Response>>;
|
|
43
|
+
truncate(request?: TruncateChannelRequest): Promise<StreamResponse<TruncateChannelResponse>>;
|
|
44
|
+
markUnread(request?: MarkUnreadRequest): Promise<StreamResponse<Response>>;
|
|
45
|
+
}
|